diff --git a/crates/next-api/src/project.rs b/crates/next-api/src/project.rs index 1b552ad382a59..a8e821d0ff01d 100644 --- a/crates/next-api/src/project.rs +++ b/crates/next-api/src/project.rs @@ -1007,6 +1007,7 @@ impl Project { self.next_config().turbo_minify(self.next_mode()), self.next_config().client_source_maps(self.next_mode()), self.no_mangling(), + self.next_config().turbo_scope_hoisting(self.next_mode()), ) } @@ -1028,6 +1029,7 @@ impl Project { self.next_config().turbo_minify(self.next_mode()), self.next_config().server_source_maps(), self.no_mangling(), + self.next_config().turbo_scope_hoisting(self.next_mode()), ) } else { get_server_chunking_context( @@ -1040,6 +1042,7 @@ impl Project { self.next_config().turbo_minify(self.next_mode()), self.next_config().server_source_maps(), self.no_mangling(), + self.next_config().turbo_scope_hoisting(self.next_mode()), ) } } @@ -1062,6 +1065,7 @@ impl Project { self.next_config().turbo_minify(self.next_mode()), self.next_config().server_source_maps(), self.no_mangling(), + self.next_config().turbo_scope_hoisting(self.next_mode()), ) } else { get_edge_chunking_context( @@ -1074,6 +1078,7 @@ impl Project { self.next_config().turbo_minify(self.next_mode()), self.next_config().server_source_maps(), self.no_mangling(), + self.next_config().turbo_scope_hoisting(self.next_mode()), ) } } diff --git a/crates/next-core/src/next_client/context.rs b/crates/next-core/src/next_client/context.rs index b5b0532572b78..ef22e9e178511 100644 --- a/crates/next-core/src/next_client/context.rs +++ b/crates/next-core/src/next_client/context.rs @@ -437,6 +437,7 @@ pub async fn get_client_chunking_context( minify: Vc, source_maps: Vc, no_mangling: Vc, + scope_hoisting: Vc, ) -> Result>> { let next_mode = mode.await?; let mut builder = BrowserChunkingContext::builder( @@ -473,23 +474,25 @@ pub async fn get_client_chunking_context( if next_mode.is_development() { builder = builder.hot_module_replacement().use_file_source_map_uris(); } else { - builder = builder.chunking_config( - Vc::::default().to_resolved().await?, - ChunkingConfig { - min_chunk_size: 50_000, - max_chunk_count_per_group: 40, - max_merge_chunk_size: 200_000, - ..Default::default() - }, - ); - builder = builder.chunking_config( - Vc::::default().to_resolved().await?, - ChunkingConfig { - max_merge_chunk_size: 100_000, - ..Default::default() - }, - ); - builder = builder.use_content_hashing(ContentHashing::Direct { length: 16 }) + builder = builder + .chunking_config( + Vc::::default().to_resolved().await?, + ChunkingConfig { + min_chunk_size: 50_000, + max_chunk_count_per_group: 40, + max_merge_chunk_size: 200_000, + ..Default::default() + }, + ) + .chunking_config( + Vc::::default().to_resolved().await?, + ChunkingConfig { + max_merge_chunk_size: 100_000, + ..Default::default() + }, + ) + .use_content_hashing(ContentHashing::Direct { length: 16 }) + .module_merging(*scope_hoisting.await?); } Ok(Vc::upcast(builder.build())) diff --git a/crates/next-core/src/next_config.rs b/crates/next-core/src/next_config.rs index 51666aafad382..d9a6699461cd9 100644 --- a/crates/next-core/src/next_config.rs +++ b/crates/next-core/src/next_config.rs @@ -795,6 +795,7 @@ pub struct ExperimentalConfig { turbopack_persistent_caching: Option, turbopack_source_maps: Option, turbopack_tree_shaking: Option, + turbopack_scope_hoisting: Option, // Whether to enable the global-not-found convention global_not_found: Option, /// Defaults to false in development mode, true in production mode. @@ -1585,6 +1586,14 @@ impl NextConfig { )) } + #[turbo_tasks::function] + pub async fn turbo_scope_hoisting(&self, mode: Vc) -> Result> { + let minify = self.experimental.turbopack_scope_hoisting; + Ok(Vc::cell( + minify.unwrap_or(matches!(*mode.await?, NextMode::Build)), + )) + } + #[turbo_tasks::function] pub async fn client_source_maps(&self, _mode: Vc) -> Result> { // Temporarily always enable client source maps as tests regress. diff --git a/crates/next-core/src/next_edge/context.rs b/crates/next-core/src/next_edge/context.rs index 7179aab11723d..95569dcf4a9f6 100644 --- a/crates/next-core/src/next_edge/context.rs +++ b/crates/next-core/src/next_edge/context.rs @@ -222,6 +222,7 @@ pub async fn get_edge_chunking_context_with_client_assets( turbo_minify: Vc, turbo_source_maps: Vc, no_mangling: Vc, + scope_hoisting: Vc, ) -> Result>> { let output_root = node_root.join("server/edge".into()).to_resolved().await?; let next_mode = mode.await?; @@ -255,20 +256,22 @@ pub async fn get_edge_chunking_context_with_client_assets( .module_id_strategy(module_id_strategy); if !next_mode.is_development() { - builder = builder.chunking_config( - Vc::::default().to_resolved().await?, - ChunkingConfig { - min_chunk_size: 20_000, - ..Default::default() - }, - ); - builder = builder.chunking_config( - Vc::::default().to_resolved().await?, - ChunkingConfig { - max_merge_chunk_size: 100_000, - ..Default::default() - }, - ); + builder = builder + .chunking_config( + Vc::::default().to_resolved().await?, + ChunkingConfig { + min_chunk_size: 20_000, + ..Default::default() + }, + ) + .chunking_config( + Vc::::default().to_resolved().await?, + ChunkingConfig { + max_merge_chunk_size: 100_000, + ..Default::default() + }, + ) + .module_merging(*scope_hoisting.await?); } Ok(Vc::upcast(builder.build())) @@ -285,6 +288,7 @@ pub async fn get_edge_chunking_context( turbo_minify: Vc, turbo_source_maps: Vc, no_mangling: Vc, + scope_hoisting: Vc, ) -> Result>> { let output_root = node_root.join("server/edge".into()).to_resolved().await?; let next_mode = mode.await?; @@ -318,20 +322,22 @@ pub async fn get_edge_chunking_context( .module_id_strategy(module_id_strategy); if !next_mode.is_development() { - builder = builder.chunking_config( - Vc::::default().to_resolved().await?, - ChunkingConfig { - min_chunk_size: 20_000, - ..Default::default() - }, - ); - builder = builder.chunking_config( - Vc::::default().to_resolved().await?, - ChunkingConfig { - max_merge_chunk_size: 100_000, - ..Default::default() - }, - ); + builder = builder + .chunking_config( + Vc::::default().to_resolved().await?, + ChunkingConfig { + min_chunk_size: 20_000, + ..Default::default() + }, + ) + .chunking_config( + Vc::::default().to_resolved().await?, + ChunkingConfig { + max_merge_chunk_size: 100_000, + ..Default::default() + }, + ) + .module_merging(*scope_hoisting.await?); } Ok(Vc::upcast(builder.build())) diff --git a/crates/next-core/src/next_server/context.rs b/crates/next-core/src/next_server/context.rs index 2289a62628ab6..db69aee3b0abd 100644 --- a/crates/next-core/src/next_server/context.rs +++ b/crates/next-core/src/next_server/context.rs @@ -994,6 +994,7 @@ pub async fn get_server_chunking_context_with_client_assets( turbo_minify: Vc, turbo_source_maps: Vc, no_mangling: Vc, + scope_hoisting: Vc, ) -> Result> { let next_mode = mode.await?; // TODO(alexkirsz) This should return a trait that can be implemented by the @@ -1035,22 +1036,24 @@ pub async fn get_server_chunking_context_with_client_assets( if next_mode.is_development() { builder = builder.use_file_source_map_uris(); } else { - builder = builder.chunking_config( - Vc::::default().to_resolved().await?, - ChunkingConfig { - min_chunk_size: 20_000, - max_chunk_count_per_group: 100, - max_merge_chunk_size: 100_000, - ..Default::default() - }, - ); - builder = builder.chunking_config( - Vc::::default().to_resolved().await?, - ChunkingConfig { - max_merge_chunk_size: 100_000, - ..Default::default() - }, - ); + builder = builder + .chunking_config( + Vc::::default().to_resolved().await?, + ChunkingConfig { + min_chunk_size: 20_000, + max_chunk_count_per_group: 100, + max_merge_chunk_size: 100_000, + ..Default::default() + }, + ) + .chunking_config( + Vc::::default().to_resolved().await?, + ChunkingConfig { + max_merge_chunk_size: 100_000, + ..Default::default() + }, + ) + .module_merging(*scope_hoisting.await?); } Ok(builder.build()) @@ -1067,6 +1070,7 @@ pub async fn get_server_chunking_context( turbo_minify: Vc, turbo_source_maps: Vc, no_mangling: Vc, + scope_hoisting: Vc, ) -> Result> { let next_mode = mode.await?; // TODO(alexkirsz) This should return a trait that can be implemented by the @@ -1100,22 +1104,24 @@ pub async fn get_server_chunking_context( if next_mode.is_development() { builder = builder.use_file_source_map_uris() } else { - builder = builder.chunking_config( - Vc::::default().to_resolved().await?, - ChunkingConfig { - min_chunk_size: 20_000, - max_chunk_count_per_group: 100, - max_merge_chunk_size: 100_000, - ..Default::default() - }, - ); - builder = builder.chunking_config( - Vc::::default().to_resolved().await?, - ChunkingConfig { - max_merge_chunk_size: 100_000, - ..Default::default() - }, - ); + builder = builder + .chunking_config( + Vc::::default().to_resolved().await?, + ChunkingConfig { + min_chunk_size: 20_000, + max_chunk_count_per_group: 100, + max_merge_chunk_size: 100_000, + ..Default::default() + }, + ) + .chunking_config( + Vc::::default().to_resolved().await?, + ChunkingConfig { + max_merge_chunk_size: 100_000, + ..Default::default() + }, + ) + .module_merging(*scope_hoisting.await?); } Ok(builder.build()) diff --git a/packages/next/src/server/config-schema.ts b/packages/next/src/server/config-schema.ts index a76addf23c834..b4d1b8f2d78e6 100644 --- a/packages/next/src/server/config-schema.ts +++ b/packages/next/src/server/config-schema.ts @@ -461,6 +461,7 @@ export const configSchema: zod.ZodType = z.lazy(() => turbopackSourceMaps: z.boolean().optional(), turbopackTreeShaking: z.boolean().optional(), turbopackRemoveUnusedExports: z.boolean().optional(), + turbopackScopeHoisting: z.boolean().optional(), optimizePackageImports: z.array(z.string()).optional(), optimizeServerReact: z.boolean().optional(), clientTraceMetadata: z.array(z.string()).optional(), diff --git a/packages/next/src/server/config-shared.ts b/packages/next/src/server/config-shared.ts index 1b0935d166bff..391b8e89c9676 100644 --- a/packages/next/src/server/config-shared.ts +++ b/packages/next/src/server/config-shared.ts @@ -417,6 +417,11 @@ export interface ExperimentalConfig { */ turbopackMinify?: boolean + /** + * Enable scope hoisting. Defaults to true in build mode and false in dev mode. + */ + turbopackScopeHoisting?: boolean + /** * Enable persistent caching for the turbopack dev server and build. */ diff --git a/turbopack/crates/turbopack-browser/src/chunking_context.rs b/turbopack/crates/turbopack-browser/src/chunking_context.rs index c0ed6baebdf41..fb86b0ab98e7d 100644 --- a/turbopack/crates/turbopack-browser/src/chunking_context.rs +++ b/turbopack/crates/turbopack-browser/src/chunking_context.rs @@ -97,6 +97,11 @@ impl BrowserChunkingContextBuilder { self } + pub fn module_merging(mut self, enable_module_merging: bool) -> Self { + self.chunking_context.enable_module_merging = enable_module_merging; + self + } + pub fn asset_base_path(mut self, asset_base_path: ResolvedVc>) -> Self { self.chunking_context.asset_base_path = asset_base_path; self @@ -202,6 +207,8 @@ pub struct BrowserChunkingContext { enable_hot_module_replacement: bool, /// Enable tracing for this chunking enable_tracing: bool, + /// Enable module merging + enable_module_merging: bool, /// The environment chunks will be evaluated in. environment: ResolvedVc, /// The kind of runtime to include in the output. @@ -248,6 +255,7 @@ impl BrowserChunkingContext { asset_base_path: ResolvedVc::cell(None), enable_hot_module_replacement: false, enable_tracing: false, + enable_module_merging: false, environment, runtime_type, minify_type: MinifyType::NoMinify, @@ -510,6 +518,11 @@ impl ChunkingContext for BrowserChunkingContext { Vc::cell(self.enable_tracing) } + #[turbo_tasks::function] + fn is_module_merging_enabled(&self) -> Vc { + Vc::cell(self.enable_module_merging) + } + #[turbo_tasks::function] pub fn minify_type(&self) -> Vc { self.minify_type.cell() diff --git a/turbopack/crates/turbopack-cli/src/build/mod.rs b/turbopack/crates/turbopack-cli/src/build/mod.rs index bf30ef769adda..955289de168f5 100644 --- a/turbopack/crates/turbopack-cli/src/build/mod.rs +++ b/turbopack/crates/turbopack-cli/src/build/mod.rs @@ -343,23 +343,25 @@ async fn build_internal( match *node_env.await? { NodeEnv::Development => {} NodeEnv::Production => { - builder = builder.chunking_config( - Vc::::default().to_resolved().await?, - ChunkingConfig { - min_chunk_size: 50_000, - max_chunk_count_per_group: 40, - max_merge_chunk_size: 200_000, - ..Default::default() - }, - ); - builder = builder.chunking_config( - Vc::::default().to_resolved().await?, - ChunkingConfig { - max_merge_chunk_size: 100_000, - ..Default::default() - }, - ); - builder = builder.use_content_hashing(ContentHashing::Direct { length: 16 }) + builder = builder + .chunking_config( + Vc::::default().to_resolved().await?, + ChunkingConfig { + min_chunk_size: 50_000, + max_chunk_count_per_group: 40, + max_merge_chunk_size: 200_000, + ..Default::default() + }, + ) + .chunking_config( + Vc::::default().to_resolved().await?, + ChunkingConfig { + max_merge_chunk_size: 100_000, + ..Default::default() + }, + ) + .use_content_hashing(ContentHashing::Direct { length: 16 }) + .module_merging(true); } } @@ -387,22 +389,24 @@ async fn build_internal( match *node_env.await? { NodeEnv::Development => {} NodeEnv::Production => { - builder = builder.chunking_config( - Vc::::default().to_resolved().await?, - ChunkingConfig { - min_chunk_size: 20_000, - max_chunk_count_per_group: 100, - max_merge_chunk_size: 100_000, - ..Default::default() - }, - ); - builder = builder.chunking_config( - Vc::::default().to_resolved().await?, - ChunkingConfig { - max_merge_chunk_size: 100_000, - ..Default::default() - }, - ); + builder = builder + .chunking_config( + Vc::::default().to_resolved().await?, + ChunkingConfig { + min_chunk_size: 20_000, + max_chunk_count_per_group: 100, + max_merge_chunk_size: 100_000, + ..Default::default() + }, + ) + .chunking_config( + Vc::::default().to_resolved().await?, + ChunkingConfig { + max_merge_chunk_size: 100_000, + ..Default::default() + }, + ) + .module_merging(true); } } diff --git a/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs b/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs index 8e62c12f2e4c5..be29d0f2c3c4e 100644 --- a/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs +++ b/turbopack/crates/turbopack-core/src/chunk/chunk_group.rs @@ -1,8 +1,9 @@ -use std::collections::HashSet; +use std::{collections::HashSet, sync::atomic::AtomicBool}; use anyhow::{Context, Result}; use rustc_hash::FxHashMap; -use turbo_tasks::{FxIndexSet, ResolvedVc, TryJoinIterExt, Value, Vc}; +use smallvec::{SmallVec, smallvec}; +use turbo_tasks::{FxIndexSet, ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt, Value, Vc}; use super::{ Chunk, ChunkGroupContent, ChunkItem, ChunkItemWithAsyncModuleInfo, ChunkingContext, @@ -45,6 +46,7 @@ pub async fn make_chunk_group( ChunkLoading::Edge ); let should_trace = *chunking_context.is_tracing_enabled().await?; + let should_merge_modules = *chunking_context.is_module_merging_enabled().await?; let batching_config = chunking_context.batching_config(); let ChunkGroupContent { @@ -58,6 +60,7 @@ pub async fn make_chunk_group( availability_info, can_split_async, should_trace, + should_merge_modules, batching_config, ) .await?; @@ -189,6 +192,7 @@ pub async fn chunk_group_content( availability_info: AvailabilityInfo, can_split_async: bool, should_trace: bool, + should_merge_modules: bool, batching_config: Vc, ) -> Result { let module_batches_graph = module_graph.module_batches(batching_config).await?; @@ -315,6 +319,106 @@ pub async fn chunk_group_content( }, )?; + if should_merge_modules { + let merged_modules = module_graph.merged_modules().await?; + // let old_items: Vec>> = state + // .chunkable_items + // .iter() + // .map(async |m| { + // Ok(match m { + // ChunkableModuleOrBatch::Module(module) => vec![ResolvedVc::upcast(*module)], + // ChunkableModuleOrBatch::Batch(batch) => batch + // .await? + // .modules + // .iter() + // .map(|m| ResolvedVc::upcast(*m)) + // .collect(), + // ChunkableModuleOrBatch::None(_) => vec![], + // }) + // }) + // .try_flat_join() + // .await?; + state.chunkable_items = state + .chunkable_items + .into_iter() + .map(async |chunkable_module| match chunkable_module { + ChunkableModuleOrBatch::Module(module) => { + if !merged_modules.should_create_chunk_item_for(ResolvedVc::upcast(module)) { + return Ok(smallvec![]); + } + + let module = if let Some(replacement) = + merged_modules.should_replace_module(ResolvedVc::upcast(module)) + { + // debug_assert!( + // merged_modules + // .replacements_included + // .get(&ResolvedVc::upcast(module)) + // .unwrap() + // .iter() + // .all(|m| old_items.contains(m)), + // "Hoisting included too many modules", + // ); + replacement + } else { + module + }; + + Ok(smallvec![ChunkableModuleOrBatch::Module(module)]) + } + ChunkableModuleOrBatch::Batch(batch) => { + let batch_ref = batch.await?; + let modules = &batch_ref.modules; + + let modified = AtomicBool::new(false); + let modules = modules + .iter() + .filter(|module| { + if merged_modules + .should_create_chunk_item_for(ResolvedVc::upcast(**module)) + { + true + } else { + modified.store(true, std::sync::atomic::Ordering::Release); + false + } + }) + .map(|&module| { + if let Some(replacement) = + merged_modules.should_replace_module(ResolvedVc::upcast(module)) + { + // debug_assert!( + // merged_modules + // .replacements_included + // .get(&ResolvedVc::upcast(module)) + // .unwrap() + // .iter() + // .all(|m| old_items.contains(m)), + // "Hoisting included too many modules", + // ); + modified.store(true, std::sync::atomic::Ordering::Release); + replacement + } else { + module + } + }) + .map(ChunkableModuleOrBatch::Module) + .collect::>(); + + if modified.load(std::sync::atomic::Ordering::Acquire) { + Ok(modules) + } else { + Ok(smallvec![ChunkableModuleOrBatch::Batch(batch)]) + } + } + ChunkableModuleOrBatch::None(i) => Ok(smallvec![ChunkableModuleOrBatch::None(i)]), + }) + .try_flat_join() + .await? + .into_iter() + .collect(); + } + let mut batch_groups = FxIndexSet::default(); for &module in &state.chunkable_items { if let Some(batch_group) = module_batches_graph.get_batch_group(&module.into()) { diff --git a/turbopack/crates/turbopack-core/src/chunk/chunking_context.rs b/turbopack/crates/turbopack-core/src/chunk/chunking_context.rs index 9b7871da6d3fe..212ee5112fd8e 100644 --- a/turbopack/crates/turbopack-core/src/chunk/chunking_context.rs +++ b/turbopack/crates/turbopack-core/src/chunk/chunking_context.rs @@ -193,10 +193,17 @@ pub trait ChunkingContext { }) } + /// Whether `ChunkingType::Traced` are used to create corresponding output assets for each + /// traced module. fn is_tracing_enabled(self: Vc) -> Vc { Vc::cell(false) } + /// Whether to use `MergableModule` to merge modules if possible. + fn is_module_merging_enabled(self: Vc) -> Vc { + Vc::cell(false) + } + fn minify_type(self: Vc) -> Vc { MinifyType::NoMinify.cell() } diff --git a/turbopack/crates/turbopack-core/src/chunk/mod.rs b/turbopack/crates/turbopack-core/src/chunk/mod.rs index b8fed85d52d38..2ec304dda3693 100644 --- a/turbopack/crates/turbopack-core/src/chunk/mod.rs +++ b/turbopack/crates/turbopack-core/src/chunk/mod.rs @@ -107,6 +107,64 @@ impl ChunkableModules { } } +#[turbo_tasks::value(shared)] +pub enum MergeableModuleResult { + Merged { + merged_module: ResolvedVc>, + consumed: u32, + skipped: u32, + }, + NotMerged, +} +#[turbo_tasks::value_impl] +impl MergeableModuleResult { + #[turbo_tasks::function] + pub fn not_merged() -> Vc { + MergeableModuleResult::NotMerged.cell() + } +} + +/// A [Module] that can be merged with other [Module]s (to perform scope hoisting) +// TODO currently this is only used for ecmascript modules, and with the current API cannot be used +// with other module types (as a MergeableModule cannot prevent itself from being mrerged with other +// arbitrary module types) +#[turbo_tasks::value_trait] +pub trait MergeableModule: Module + Asset { + /// Even though MergeableModule is implemented, this allows a dynamic condition to determine + /// mergeability + fn is_mergeable(self: Vc) -> Vc { + Vc::cell(true) + } + + /// Create a new module representing the merged content of the given modules. + fn merge( + self: Vc, + modules: Vc, + entries: Vc, + ) -> Vc>; +} +#[turbo_tasks::value(transparent)] +pub struct MergeableModules(Vec>>); + +#[turbo_tasks::value_impl] +impl MergeableModules { + #[turbo_tasks::function] + pub fn interned(modules: Vec>>) -> Vc { + Vc::cell(modules) + } +} + +#[turbo_tasks::value(transparent)] +pub struct MergeableModulesExposed(Vec<(ResolvedVc>, bool)>); + +#[turbo_tasks::value_impl] +impl MergeableModulesExposed { + #[turbo_tasks::function] + pub fn interned(modules: Vec<(ResolvedVc>, bool)>) -> Vc { + Vc::cell(modules) + } +} + #[turbo_tasks::value(transparent)] pub struct Chunks(Vec>>); diff --git a/turbopack/crates/turbopack-core/src/module_graph/merged_modules.rs b/turbopack/crates/turbopack-core/src/module_graph/merged_modules.rs new file mode 100644 index 0000000000000..befc311ea5bde --- /dev/null +++ b/turbopack/crates/turbopack-core/src/module_graph/merged_modules.rs @@ -0,0 +1,865 @@ +use std::{cmp::Ordering, collections::hash_map::Entry}; + +use anyhow::{Context, Result, bail}; +use roaring::RoaringBitmap; +use rustc_hash::{FxHashMap, FxHashSet}; +use tracing::Instrument; +use turbo_tasks::{ + FxIndexMap, FxIndexSet, ResolvedVc, SliceMap, TryFlatJoinIterExt, TryJoinIterExt, + ValueToString, Vc, +}; + +use crate::{ + chunk::{ + ChunkableModule, ChunkingType, MergeableModule, MergeableModules, MergeableModulesExposed, + }, + module::Module, + module_graph::{ + GraphTraversalAction, ModuleGraph, RefData, SingleModuleGraphModuleNode, + chunk_group_info::RoaringBitmapWrapper, + }, + resolve::ExportUsage, +}; + +#[turbo_tasks::value(transparent)] +pub struct MergedModules(SliceMap>, bool>); +#[turbo_tasks::value_impl] +impl MergedModules { + #[turbo_tasks::function] + pub fn empty() -> Vc { + Vc::cell(Default::default()) + } +} + +// TODO maybe a smallvec once we know the size distribution? +#[turbo_tasks::value] +pub struct MergedModuleInfo { + /// A map of modules to the merged module containing the module plus additional modules. + #[allow(clippy::type_complexity)] + pub replacements: FxHashMap>, ResolvedVc>>, + // #[allow(clippy::type_complexity)] + // pub replacements_included: + // FxHashMap>, Vec>>>, + /// A map of modules that are already contained as values in replacements. + pub included: FxHashSet>>, +} + +impl MergedModuleInfo { + pub fn should_replace_module( + &self, + module: ResolvedVc>, + ) -> Option>> { + self.replacements.get(&module).copied() + } + + pub fn should_create_chunk_item_for(&self, module: ResolvedVc>) -> bool { + !self.included.contains(&module) + } +} + +/// Determine which modules can be merged together: +/// - if all chunks execute a sequence of modules in the same order, they can be merged together and +/// treated as one. +/// - if a merged module has an incoming edge not contained in the group, it has to expose its +/// exports into the module cache. +pub async fn compute_merged_modules(module_graph: Vc) -> Result> { + let span_outer = tracing::info_span!( + "compute merged modules", + module_count = tracing::field::Empty, + visit_count = tracing::field::Empty, + merged_groups = tracing::field::Empty, + included_modules = tracing::field::Empty + ); + + let span = span_outer.clone(); + async move { + let async_module_info = module_graph.async_module_info().await?; + let chunk_group_info = module_graph.chunk_group_info().await?; + let module_graph = module_graph.await?; + + let graphs = module_graph.graphs.iter().try_join().await?; + let module_count = graphs.iter().map(|g| g.graph.node_count()).sum::(); + span.record("module_count", module_count); + + // Use all entries from all graphs + let entries = graphs + .iter() + .flat_map(|g| g.entries.iter()) + .flat_map(|g| g.entries()) + .collect::>(); + + // For each module, the indices in the bitmap store which merge group entry modules + // transitively import that module. The bitmap can be treated as an opaque value, merging + // all modules with the same bitmap. + let mut module_merged_groups: FxHashMap>, RoaringBitmapWrapper> = + FxHashMap::with_capacity_and_hasher(module_count, Default::default()); + // Entries that started a new merge group for some deopt reason + let mut entry_modules = + FxHashSet::with_capacity_and_hasher(module_count, Default::default()); + + // let idents = graphs + // .iter() + // .flat_map(|g| g.graph.node_weights()) + // .map(async |n| Ok((n.module(), n.module().ident().to_string().await?))) + // .try_join() + // .await? + // .into_iter() + // .collect::>(); + + let mergeable = graphs + .iter() + .flat_map(|g| g.iter_nodes()) + .map(async |n| { + let module = n.module; + let mergeable = ResolvedVc::try_downcast::>(module); + if let Some(mergeable) = mergeable { + if *mergeable.is_mergeable().await? { + return Ok(Some(module)); + } + } + Ok(None) + }) + .try_flat_join() + .await? + .into_iter() + .collect::>(); + + let mut next_index = 0u32; + let visit_count = module_graph + .traverse_edges_fixed_point_with_priority( + entries.iter().map(|e| (*e, 0)), + &mut (), + |parent_info: Option<(&'_ SingleModuleGraphModuleNode, &'_ RefData)>, + node: &'_ SingleModuleGraphModuleNode, + _| + -> Result { + // On the down traversal, establish which edges are mergable and set the list + // indices. + let (parent_module, hoisted) = + parent_info.map_or((None, false), |(node, ty)| { + ( + Some(node.module), + match &ty.chunking_type { + ChunkingType::Parallel { hoisted, .. } => *hoisted, + _ => false, + }, + ) + }); + let module = node.module; + + // println!( + // "{} -> {} {:?} {:?}", + // parent_module.map_or("".to_string(), |p| idents[&p].to_string()), + // idents[&module], + // parent_module, + // module, + // ); + + Ok(if parent_module.is_some_and(|p| p == module) { + // A self-reference + GraphTraversalAction::Skip + } else if let (Some(parent_module), true, true, true) = ( + parent_module.filter(|m| { + ResolvedVc::try_downcast::>(*m).is_some() + }), + mergeable.contains(&module), + hoisted, + // TODO technically we could merge a sync child into an async parent + !parent_module.is_some_and(|p| async_module_info.contains(&p)) + && !async_module_info.contains(&module), + ) { + // A hoisted reference from a mergeable module to a non-async mergeable + // module, inherit bitmaps from parent. + module_merged_groups.entry(node.module).or_default(); + let [Some(parent_merged_groups), Some(current_merged_groups)] = + module_merged_groups.get_disjoint_mut([&parent_module, &node.module]) + else { + // All modules are inserted in the previous iteration + bail!("unreachable except for eventual consistency"); + }; + + if current_merged_groups.is_empty() { + // Initial visit, clone instead of merging + *current_merged_groups = parent_merged_groups.clone(); + GraphTraversalAction::Continue + } else if parent_merged_groups.is_proper_superset(current_merged_groups) { + // Add bits from parent, and continue traversal because changed + **current_merged_groups |= &**parent_merged_groups; + GraphTraversalAction::Continue + } else { + // Unchanged, no need to forward to children + GraphTraversalAction::Skip + } + } else { + // Either a non-hoisted reference or an incompatible parent or child module + + if entry_modules.insert(module) { + // Not assigned a new group before, create a new one. + let idx = next_index; + next_index += 1; + + match module_merged_groups.entry(module) { + Entry::Occupied(mut entry) => { + let current = entry.get_mut(); + if !current.contains(idx) { + // Mark and continue traversal because modified + current.insert(idx); + GraphTraversalAction::Continue + } else { + // Unchanged, no need to forward to children + GraphTraversalAction::Skip + } + } + Entry::Vacant(entry) => { + // First visit + entry.insert(RoaringBitmapWrapper( + RoaringBitmap::from_sorted_iter(std::iter::once(idx)) + .unwrap(), + )); + GraphTraversalAction::Continue + } + } + } else { + // Already visited and assigned a new group, no need to forward to + // children. + GraphTraversalAction::Skip + } + }) + }, + |_, _| Ok(0), + ) + .await?; + + span.record("visit_count", visit_count); + + // { + // let mut x: FxIndexMap>> = + // Default::default(); for (k, v) in &module_merged_groups { + // x.entry(v.clone()) + // .or_default() + // .push(k.ident().to_string().await?); + // } + // println!( + // "list candidates {} {} {:#?}", + // visit_count, + // module_merged_groups.len(), + // x.iter().filter(|(_, v)| v.len() > 1).collect::>() + // ); + // } + + #[derive(Debug, PartialEq, Eq, Hash)] + struct ListOccurence { + list: usize, + entry: usize, + } + impl PartialOrd for ListOccurence { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } + } + impl Ord for ListOccurence { + fn cmp(&self, other: &Self) -> Ordering { + self.entry + .cmp(&other.entry) + // don't matter but needed to make it a total ordering + .then_with(|| self.list.cmp(&other.list)) + } + } + + // A list of all different execution traces (orders) of all modules, initially a union of + // the partition of each chunk's modules (one for each ESM subtree in each chunks), but + // further split up later on. + let mut lists = vec![]; + let mut lists_reverse_indices: FxIndexMap< + ResolvedVc>, + FxIndexSet, + > = FxIndexMap::default(); + + // A map of all references betwee modules with the same bitmap. These are all references, + // including reexecution edges and cycles. Used to expose additional modules if the + // bitmap-groups are split up further. + #[allow(clippy::type_complexity)] + let mut intra_group_references: FxIndexMap< + ResolvedVc>, + FxIndexSet>>, + > = FxIndexMap::default(); + // A map of all references betwee modules with the same bitmap. These are only the + // references relevant for execution (ignoring cycles), to find the entries of a group. + #[allow(clippy::type_complexity)] + let mut intra_group_references_rev: FxIndexMap< + ResolvedVc>, + FxIndexSet>>, + > = FxIndexMap::default(); + + // TODO try to parallelize this loop somehow + for chunk_group in &chunk_group_info.chunk_groups { + // A partition of all modules in the chunk into several execution traces (orders), + // stored in the top-level lists and referenced here by index. + let mut chunk_lists: FxHashMap = + FxHashMap::with_capacity_and_hasher( + module_merged_groups.len() / chunk_group_info.chunk_groups.len(), + Default::default(), + ); + + // This is necessary to have the correct order with cycles: a `a -> b -> a` graph would + // otherwise be visited as `b->a`, `a->b`, leading to the list `a, b` which is not + // execution order. + let mut visited = FxHashSet::default(); + + module_graph + .traverse_edges_from_entries_topological( + chunk_group.entries(), + &mut (), + |parent_info, node, _| { + if parent_info.is_none_or(|(_, r)| r.chunking_type.is_parallel()) + && visited.insert(node.module) + { + Ok(GraphTraversalAction::Continue) + } else { + Ok(GraphTraversalAction::Exclude) + } + }, + |parent_info, node, _| { + let module = node.module; + + if let Some(bitmap) = module_merged_groups.get(&module) { + if let Some(mergeable_module) = + ResolvedVc::try_downcast::>(module) + { + match chunk_lists.entry(bitmap.clone()) { + Entry::Vacant(e) => { + // New list, insert the module + let idx = lists.len(); + e.insert(idx); + lists.push(vec![mergeable_module]); + lists_reverse_indices + .entry(mergeable_module) + .or_default() + .insert(ListOccurence { + list: idx, + entry: 0, + }); + } + Entry::Occupied(e) => { + let list_idx = *e.get(); + let list = &mut lists[list_idx]; + list.push(mergeable_module); + lists_reverse_indices + .entry(mergeable_module) + .or_default() + .insert(ListOccurence { + list: list_idx, + entry: list.len() - 1, + }); + } + } + } + } + + if let Some((parent, _)) = parent_info { + let same_bitmap = module_merged_groups.get(&parent.module).unwrap() + == module_merged_groups.get(&module).unwrap(); + + if same_bitmap { + intra_group_references_rev + .entry(module) + .or_default() + .insert(parent.module); + } + } + }, + ) + .await?; + + // println!( + // "lists {:#?}", + // chunk_lists + // .iter() + // .map(async |(b, l)| Ok(( + // b, + // lists[*l] + // .iter() + // .map(|m| m.ident().to_string()) + // .try_join() + // .await? + // ))) + // .try_join() + // .await? + // ); + } + + // TODO sort lists_reverse_indices somehow? + // We use list.pop() below, so reverse order using negation + lists_reverse_indices + .sort_by_cached_key(|_, b| b.iter().map(|o| o.entry).min().map(|v| -(v as i64))); + + // Modules that are referenced from outside the group, so their exports need to be exposed. + // Initially these are set based on the bitmaps (and namespace imports), but more modules + // might need to be exposed if the lists are split up further below. + let mut exposed_modules: FxHashSet>> = + FxHashSet::with_capacity_and_hasher(module_merged_groups.len(), Default::default()); + + module_graph + .traverse_edges_from_entries_topological( + entries, + &mut (), + |_, _, _| Ok(GraphTraversalAction::Continue), + |parent_info, node, _| { + let module = node.module; + + if let Some((parent, _)) = parent_info { + let same_bitmap = module_merged_groups.get(&parent.module).unwrap() + == module_merged_groups.get(&module).unwrap(); + + if same_bitmap { + intra_group_references + .entry(parent.module) + .or_default() + .insert(module); + } + } + + if parent_info.is_none_or(|(parent, r)| { + (module_merged_groups.get(&parent.module).unwrap() + != module_merged_groups.get(&module).unwrap()) + || matches!(r.export, ExportUsage::All) + }) { + // This module needs to be exposed: + // - referenced from another group or + // - a namespace import or an entry module or + // - an entry module (TODO assume it will be required for Node/Edge, but not + // necessarily needed for browser), + exposed_modules.insert(module); + } + }, + ) + .await?; + + // println!( + // "pre-split lists {:#?}", + // lists + // .iter() + // .map(|m| m.iter().map(|m| m.ident().to_string()).try_join()) + // .try_join() + // .await?, + // // lists + // // .iter() + // // .filter(|(_, v)| v.len() > 1) + // // .map(|(_, l)| l.iter().map(|m| m.ident().to_string()).try_join()) + // // .try_join() + // // .await? + // ); + + // println!( + // "lists_reverse_indices {:#?}", + // lists_reverse_indices + // .iter() + // .map(async |(m, l)| Ok((m.ident().to_string().await?, l))) + // .try_join() + // .await?, + // // lists + // // .iter() + // // .filter(|(_, v)| v.len() > 1) + // // .map(|(_, l)| l.iter().map(|m| m.ident().to_string()).try_join()) + // // .try_join() + // // .await? + // ); + + while let Some((_, common_occurences)) = lists_reverse_indices.pop() { + if common_occurences.len() < 2 { + // Module exists only in one list, no need to split + continue; + } + // println!("{:?} {:?}", m.ident().to_string().await?, common_occurences); + // The module occurs in multiple lists, which need to split up so that there is exactly + // one list containing the module. + + let first_occurence = &common_occurences[0]; + + // Find the longest common sequence in the lists, starting from the given module. + let mut common_length = 2; + loop { + let m = lists[first_occurence.list].get(first_occurence.entry + common_length - 1); + if m.is_some() + && common_occurences + .iter() + .skip(1) + .all(|ListOccurence { list, entry }| { + lists[*list].get(*entry + common_length - 1) == m + }) + { + common_length += 1; + continue; + } + + // Went one too far, the common length is what the previous iteration verified + common_length -= 1; + break; + } + + // println!( + // "{:?} {:?}", + // lists[first_occurence.list] + // .iter() + // .map(|m| m.ident().to_string()) + // .try_join() + // .await?, + // (first_occurence.entry..first_occurence.entry + + // common_length).collect::>(), ); + + // Split into three lists: + // - "common" [occurrence.entry .. occurrence.entry + common_length) -- same for all + // - "before" [0 .. occurrence.entry) + // - "after" [occurrence.entry + common_length .. ] + let common_list = lists[first_occurence.list] + [first_occurence.entry..first_occurence.entry + common_length] + .to_vec(); + + let common_list_index = lists.len(); + lists.push(common_list.clone()); + + // Insert occurences for the "common" list, skip the first because that is now + // guaranteed to exist only once + for (i, &m) in common_list.iter().enumerate().skip(1) { + let occurrences = lists_reverse_indices.get_mut(&m).unwrap(); + for common_occurrence in &common_occurences { + let removed = occurrences.swap_remove(&ListOccurence { + list: common_occurrence.list, + entry: common_occurrence.entry + i, + }); + debug_assert!(removed); + } + occurrences.insert(ListOccurence { + list: common_list_index, + entry: i, + }); + } + + for common_occurrence in &common_occurences { + let list = &mut lists[common_occurrence.list]; + let after_list = list.split_off(common_occurrence.entry + common_length); + list.truncate(common_occurrence.entry); + let before_list = &*list; + + // For all previously merged references that exist from "after" to "common"/"before" + // and from "common" to "before", mark the referenced modules as exposed. + for m in &common_list { + let m = ResolvedVc::upcast(*m); + if let Some(refs) = intra_group_references.get(&m) { + exposed_modules.extend( + before_list + .iter() + .map(|n| ResolvedVc::upcast(*n)) + .filter(|n| refs.contains(n)), + ); + } + } + for m in &after_list { + let m = ResolvedVc::upcast(*m); + if let Some(refs) = intra_group_references.get(&m) { + exposed_modules.extend( + before_list + .iter() + .chain(common_list.iter()) + .map(|n| ResolvedVc::upcast(*n)) + .filter(|n| refs.contains(n)), + ); + } + } + + // println!( + // "{} {:#?} {:#?} {:#?}", + // common_length, + // list.iter() + // .map(|m| m.ident().to_string()) + // .try_join() + // .await?, + // common_list + // .iter() + // .map(|m| m.ident().to_string()) + // .try_join() + // .await?, + // after_list + // .iter() + // .map(|m| m.ident().to_string()) + // .try_join() + // .await? + // ); + + // The occurences for the "before" list (`list`) are still valid, need to update the + // occurences for the "after" list + if !after_list.is_empty() { + let after_index = lists.len(); + lists.push(after_list.clone()); + for (i, &m) in after_list.iter().enumerate() { + let occurrences = lists_reverse_indices + .get_mut(&m) + .context(format!("{:?}", m.ident().to_string().await?))?; + + let removed = occurrences.swap_remove(&ListOccurence { + list: common_occurrence.list, + entry: common_occurrence.entry + common_length + i, + }); + debug_assert!(removed); + + occurrences.insert(ListOccurence { + list: after_index, + entry: i, + }); + } + } + } + } + + // println!( + // "lists {:#?}", + // lists + // .iter() + // .map(|m| m.iter().map(|m| m.ident().to_string()).try_join()) + // .try_join() + // .await?, + // // lists + // // .iter() + // // .filter(|(_, v)| v.len() > 1) + // // .map(|(_, l)| l.iter().map(|m| m.ident().to_string()).try_join()) + // // .try_join() + // // .await? + // ); + // println!( + // "exposed_modules {:#?}", + // exposed_modules + // .iter() + // .map(|m| m.ident().to_string()) + // .try_join() + // .await?, + // // lists + // // .iter() + // // .filter(|(_, v)| v.len() > 1) + // // .map(|(_, l)| l.iter().map(|m| m.ident().to_string()).try_join()) + // // .try_join() + // // .await? + // ); + + // println!( + // "lists_reverse_indices {:#?}", + // lists_reverse_indices + // .iter() + // .map(async |(m, l)| Ok((m.ident().to_string().await?, l))) + // .try_join() + // .await?, + // // lists + // // .iter() + // // .filter(|(_, v)| v.len() > 1) + // // .map(|(_, l)| l.iter().map(|m| m.ident().to_string()).try_join()) + // // .try_join() + // // .await? + // ); + + // Dedupe the lists + let lists = lists.into_iter().collect::>(); + + // Call MergeableModule impl to merge the modules (or not, if they are rejected). + let result = lists + .into_iter() + .map(async |list| { + if list.len() < 2 { + // Nothing to merge + return Ok(None); + } + + let list_set = list + .iter() + .map(|&m| ResolvedVc::upcast::>(m)) + .collect::>(); + + // Group entries are not referenced by any other module in the group + let entries = list + .iter() + .filter(|m| { + intra_group_references_rev + .get(&ResolvedVc::upcast(**m)) + .is_none_or(|refs| refs.is_disjoint(&list_set)) + }) + .map(|m| **m) + .collect::>(); + debug_assert_ne!(entries.len(), 0); + + let list_exposed = list + .iter() + .map(|&m| (m, exposed_modules.contains(&ResolvedVc::upcast(m)))) + .collect::>(); + + // println!( + // "merged {:#?} {:#?} {:#?}", + // list.iter() + // .map(|m| m.ident().to_string()) + // .try_join() + // .await?, + // list.iter() + // .map(async |m| { + // Ok( + // if let Some(refs) = + // intra_group_references_rev.get(&ResolvedVc::upcast(*m)) + // { + // Some( + // refs.iter() + // .map(|r| r.ident().to_string()) + // .try_join() + // .await?, + // ) + // } else { + // None + // }, + // ) + // }) + // .try_join() + // .await?, + // entries + // .iter() + // .map(|m| m.ident().to_string()) + // .try_join() + // .await? + // ); + + let entry = *list.last().unwrap(); + let result = entry + .merge( + MergeableModulesExposed::interned(list_exposed), + MergeableModules::interned(entries), + ) + .to_resolved() + .await?; + + let list_len = list.len(); + Ok(Some(( + ResolvedVc::upcast::>(entry), + result, + list.into_iter() + .take(list_len - 1) + .map(ResolvedVc::upcast) + .collect::>(), + ))) + + // let mut resulting_list = vec![]; + // let mut included: Vec>> = vec![]; + // let mut i = 0; + // while i < list.len() - 1 { + // let first = list[i]; + // let modules = list[i..] + // .iter() + // .map(|&m| (m, exposed_modules.contains(&ResolvedVc::upcast(m)))) + // .collect::>(); + // match *first.merge(MergeableModules::interned(modules)).await? { + // MergeableModuleResult::Merged { + // merged_module, + // consumed, + // skipped, + // } => { + // // println!( + // // "accepted from {:?} {:#?} {:?} consumed {} {:#?} skipped {} + // // {:#?}", first.ident().to_string(). + // // await?, list[i..] + // // .iter() + // // .map(|m| m.ident().to_string()) + // // .try_join() + // // .await?, + // // merged_module.ident().to_string().await?, + // // consumed, + // // list.iter() + // // .skip(i) + // // .skip(skipped as usize) + // // .take(consumed as usize) + // // .map(|m| m.ident().to_string()) + // // .try_join() + // // .await?, + // // skipped, + // // list.iter() + // // .skip(i) + // // .take(skipped as usize) + // // .map(|m| m.ident().to_string()) + // // .try_join() + // // .await?, + // // ); + + // let mut current_included = list[i..] + // .iter() + // .skip(skipped as usize) + // .take(consumed as usize); + // // The first module should not be `included` but `replaced` + // let first = *current_included.next().unwrap(); + // debug_assert!( + // first.ident().to_string().await? + // == merged_module.ident().to_string().await?, + // "{} == {}", + // first.ident().to_string().await?, + // merged_module.ident().to_string().await? + // ); + // resulting_list.push(( + // ResolvedVc::upcast::>(first), + // merged_module, + // )); + // included.extend(current_included.copied().map(ResolvedVc::upcast)); + // i += (skipped + consumed) as usize; + // } + // MergeableModuleResult::NotMerged => { + // // None of them are mergeable. + // return Ok(None); + // } + // } + // } + // Ok(Some((resulting_list, included))) + }) + .try_join() + .await?; + + #[allow(clippy::type_complexity)] + let mut replacements: FxHashMap< + ResolvedVc>, + ResolvedVc>, + > = Default::default(); + // #[allow(clippy::type_complexity)] + // let mut replacements_included: FxHashMap< + // ResolvedVc>, + // Vec>>, + // > = Default::default(); + let mut included: FxHashSet>> = FxHashSet::default(); + + for (original, replacement, replacement_included) in result.into_iter().flatten() { + replacements.insert(original, replacement); + // replacements_included.insert(original, replacement_included.clone()); + included.extend(replacement_included); + } + + span.record("merged_groups", replacements.len()); + span.record("included_modules", included.len()); + + // println!( + // "included {:#?}", + // included + // .iter() + // .map(|m| m.ident().to_string()) + // .try_join() + // .await? + // ); + // println!( + // "replacements {:#?}", + // replacements + // .iter() + // .map(async |(k, v)| Ok(( + // k.ident().to_string().await?, + // v.ident().to_string().await? + // ))) + // .try_join() + // .await? + // ); + + Ok(MergedModuleInfo { + replacements, + // replacements_included, + included, + } + .cell()) + } + .instrument(span_outer) + .await +} diff --git a/turbopack/crates/turbopack-core/src/module_graph/mod.rs b/turbopack/crates/turbopack-core/src/module_graph/mod.rs index 0b6ae47ce0355..8c14a71480289 100644 --- a/turbopack/crates/turbopack-core/src/module_graph/mod.rs +++ b/turbopack/crates/turbopack-core/src/module_graph/mod.rs @@ -27,6 +27,7 @@ use crate::{ module_graph::{ async_module_info::{AsyncModulesInfo, compute_async_module_info}, chunk_group_info::{ChunkGroupEntry, ChunkGroupInfo, compute_chunk_group_info}, + merged_modules::{MergedModuleInfo, compute_merged_modules}, module_batches::{ModuleBatchesGraph, compute_module_batches}, style_groups::{StyleGroups, StyleGroupsConfig, compute_style_groups}, traced_di_graph::{TracedDiGraph, iter_neighbors_rev}, @@ -37,6 +38,7 @@ use crate::{ pub mod async_module_info; pub mod chunk_group_info; +pub mod merged_modules; pub mod module_batch; pub(crate) mod module_batches; pub(crate) mod style_groups; @@ -777,6 +779,11 @@ impl ModuleGraph { compute_chunk_group_info(self).await } + #[turbo_tasks::function] + pub async fn merged_modules(self: Vc) -> Result> { + compute_merged_modules(self).await + } + #[turbo_tasks::function] pub async fn module_batches( self: Vc, diff --git a/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/build-base.ts b/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/build-base.ts index ea58f1ad1057a..71a2ea5308faf 100644 --- a/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/build-base.ts +++ b/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/build-base.ts @@ -109,10 +109,10 @@ function instantiateModule(id: ModuleId, source: SourceInfo): Module { t: runtimeRequire, f: moduleContext, i: esmImport.bind(null, module), - s: esmExport.bind(null, module, module.exports), - j: dynamicExport.bind(null, module, module.exports), - v: exportValue.bind(null, module), - n: exportNamespace.bind(null, module), + s: esmExport.bind(null, module, module.exports, moduleCache), + j: dynamicExport.bind(null, module, module.exports, moduleCache), + v: exportValue.bind(null, module, moduleCache), + n: exportNamespace.bind(null, module, moduleCache), m: module, c: moduleCache, M: moduleFactories, diff --git a/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/dev-base.ts b/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/dev-base.ts index 30e8286f3e774..296efdd325c88 100644 --- a/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/dev-base.ts +++ b/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/dev-base.ts @@ -43,7 +43,7 @@ interface TurbopackDevContext extends TurbopackDevBaseContext {} type ModuleFactory = ( this: Module['exports'], context: TurbopackDevBaseContext -) => undefined +) => unknown interface DevRuntimeBackend { reloadChunk?: (chunkUrl: ChunkUrl) => Promise @@ -205,10 +205,10 @@ function instantiateModule(id: ModuleId, source: SourceInfo): Module { t: runtimeRequire, f: moduleContext, i: esmImport.bind(null, module), - s: esmExport.bind(null, module, module.exports), - j: dynamicExport.bind(null, module, module.exports), - v: exportValue.bind(null, module), - n: exportNamespace.bind(null, module), + s: esmExport.bind(null, module, module.exports, devModuleCache), + j: dynamicExport.bind(null, module, module.exports, devModuleCache), + v: exportValue.bind(null, module, devModuleCache), + n: exportNamespace.bind(null, module, devModuleCache), m: module, c: devModuleCache, M: moduleFactories, diff --git a/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/runtime-base.ts b/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/runtime-base.ts index 43e1d2bb426ca..4dada0e519f20 100644 --- a/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/runtime-base.ts +++ b/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/runtime-base.ts @@ -31,7 +31,7 @@ type RuntimeParams = { type ChunkRegistration = [ chunkPath: ChunkScript, - chunkModules: ModuleFactories, + chunkModules: CompressedModuleFactories, params: RuntimeParams | undefined, ] @@ -361,7 +361,15 @@ function registerChunk([ const chunkPath = getPathFromScript(chunkScript) for (const [moduleId, moduleFactory] of Object.entries(chunkModules)) { if (!moduleFactories[moduleId]) { - moduleFactories[moduleId] = moduleFactory + if (Array.isArray(moduleFactory)) { + let [moduleFactoryFn, otherIds] = moduleFactory + moduleFactories[moduleId] = moduleFactoryFn + for (const otherModuleId of otherIds) { + moduleFactories[otherModuleId] = moduleFactoryFn + } + } else { + moduleFactories[moduleId] = moduleFactory + } } addModuleToChunk(moduleId, chunkPath) } diff --git a/turbopack/crates/turbopack-ecmascript-runtime/js/src/nodejs/runtime.ts b/turbopack/crates/turbopack-ecmascript-runtime/js/src/nodejs/runtime.ts index f5fce590667e9..5906ddf04d2ae 100644 --- a/turbopack/crates/turbopack-ecmascript-runtime/js/src/nodejs/runtime.ts +++ b/turbopack/crates/turbopack-ecmascript-runtime/js/src/nodejs/runtime.ts @@ -56,7 +56,7 @@ interface TurbopackNodeBuildContext extends TurbopackBaseContext { type ModuleFactory = ( this: Module['exports'], context: TurbopackNodeBuildContext -) => undefined +) => unknown const url = require('url') as typeof import('url') const fs = require('fs/promises') as typeof import('fs/promises') @@ -107,11 +107,19 @@ function loadChunkPath(chunkPath: ChunkPath, source?: SourceInfo): void { try { const resolved = path.resolve(RUNTIME_ROOT, chunkPath) - const chunkModules: ModuleFactories = require(resolved) + const chunkModules: CompressedModuleFactories = require(resolved) for (const [moduleId, moduleFactory] of Object.entries(chunkModules)) { if (!moduleFactories[moduleId]) { - moduleFactories[moduleId] = moduleFactory + if (Array.isArray(moduleFactory)) { + let [moduleFactoryFn, otherIds] = moduleFactory + moduleFactories[moduleId] = moduleFactoryFn + for (const otherModuleId of otherIds) { + moduleFactories[otherModuleId] = moduleFactoryFn + } + } else { + moduleFactories[moduleId] = moduleFactory + } } } loadedChunks.add(chunkPath) @@ -165,10 +173,18 @@ async function loadChunkAsync( url.pathToFileURL(resolved) )(module, module.exports, localRequire, path.dirname(resolved), resolved) - const chunkModules: ModuleFactories = module.exports + const chunkModules: CompressedModuleFactories = module.exports for (const [moduleId, moduleFactory] of Object.entries(chunkModules)) { if (!moduleFactories[moduleId]) { - moduleFactories[moduleId] = moduleFactory + if (Array.isArray(moduleFactory)) { + let [moduleFactoryFn, otherIds] = moduleFactory + moduleFactories[moduleId] = moduleFactoryFn + for (const otherModuleId of otherIds) { + moduleFactories[otherModuleId] = moduleFactoryFn + } + } else { + moduleFactories[moduleId] = moduleFactory + } } } loadedChunks.add(chunkPath) @@ -235,20 +251,6 @@ function instantiateModule(id: ModuleId, source: SourceInfo): Module { ) } - let parents: ModuleId[] - switch (source.type) { - case SourceType.Runtime: - parents = [] - break - case SourceType.Parent: - // No need to add this module as a child of the parent module here, this - // has already been taken care of in `getOrInstantiateModuleFromParent`. - parents = [source.parentId] - break - default: - invariant(source, (source) => `Unknown source type: ${source?.type}`) - } - const module: Module = { exports: {}, error: undefined, @@ -270,10 +272,10 @@ function instantiateModule(id: ModuleId, source: SourceInfo): Module { y: externalImport, f: moduleContext, i: esmImport.bind(null, module), - s: esmExport.bind(null, module, module.exports), - j: dynamicExport.bind(null, module, module.exports), - v: exportValue.bind(null, module), - n: exportNamespace.bind(null, module), + s: esmExport.bind(null, module, module.exports, moduleCache), + j: dynamicExport.bind(null, module, module.exports, moduleCache), + v: exportValue.bind(null, module, moduleCache), + n: exportNamespace.bind(null, module, moduleCache), m: module, c: moduleCache, M: moduleFactories, diff --git a/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime-types.d.ts b/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime-types.d.ts index 7fd3eb52a4148..89f79ab8d5e73 100644 --- a/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime-types.d.ts +++ b/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime-types.d.ts @@ -13,6 +13,7 @@ type ChunkListScript = CurrentScript & { readonly brand: unique symbol } type ChunkPath = string & { readonly brand: unique symbol } type ChunkScript = CurrentScript & { readonly brand: unique symbol } type ChunkUrl = string & { readonly brand: unique symbol } +// TODO this should actually be `string | number` type ModuleId = string interface Exports { @@ -36,10 +37,16 @@ type EsmImport = ( moduleId: ModuleId, allowExportDefault: boolean ) => EsmNamespaceObject | Promise -type EsmExport = (exportGetters: Record any>) => void -type ExportValue = (value: any) => void -type ExportNamespace = (namespace: any) => void -type DynamicExport = (object: Record) => void +type EsmExport = ( + exportGetters: Record any>, + id: ModuleId | undefined +) => void +type ExportValue = (value: any, id: ModuleId | undefined) => void +type ExportNamespace = (namespace: any, id: ModuleId | undefined) => void +type DynamicExport = ( + object: Record, + id: ModuleId | undefined +) => void type LoadChunk = (chunkPath: ChunkPath) => Promise | undefined type LoadChunkByUrl = (chunkUrl: ChunkUrl) => Promise | undefined @@ -54,7 +61,13 @@ type LoadWebAssemblyModule = ( ) => WebAssembly.Module type ModuleCache = Record -type ModuleFactories = Record +// TODO properly type values here +type ModuleFactories = Record +// The value is an array with scope hoisting +type CompressedModuleFactories = Record< + ModuleId, + Function | [Function, ModuleId[]] +> type RelativeURL = (inputUrl: string) => void type ResolvePathFromModule = (moduleId: string) => string diff --git a/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime-utils.ts b/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime-utils.ts index 6100e84547a18..3a5d22fce5fda 100644 --- a/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime-utils.ts +++ b/turbopack/crates/turbopack-ecmascript-runtime/js/src/shared/runtime-utils.ts @@ -59,6 +59,26 @@ function defineProp( if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options) } +function getOverwrittenModule( + moduleCache: ModuleCache, + id: ModuleId +): Module { + let module = moduleCache[id] + if (!module) { + // This is invoked when a module is merged into another module, thus it wasn't invoced via + // instantiateModule and the cache entry wasn't created yet. + module = { + exports: {}, + error: undefined, + loaded: false, + id, + namespaceObject: undefined, + } + moduleCache[id] = module + } + return module +} + /** * Adds the getters to the exports object. */ @@ -89,8 +109,14 @@ function esm( function esmExport( module: Module, exports: Exports, - getters: Record any> + moduleCache: ModuleCache, + getters: Record any>, + id: ModuleId | undefined ) { + if (id != null) { + module = getOverwrittenModule(moduleCache, id) + exports = module.exports + } module.namespaceObject = module.exports esm(exports, getters) } @@ -134,8 +160,14 @@ function ensureDynamicExports(module: Module, exports: Exports) { function dynamicExport( module: Module, exports: Exports, - object: Record + moduleCache: ModuleCache, + object: Record, + id: ModuleId | undefined ) { + if (id != null) { + module = getOverwrittenModule(moduleCache, id) + exports = module.exports + } ensureDynamicExports(module, exports) if (typeof object === 'object' && object !== null) { @@ -143,11 +175,27 @@ function dynamicExport( } } -function exportValue(module: Module, value: any) { +function exportValue( + module: Module, + moduleCache: ModuleCache, + value: any, + id: ModuleId | undefined +) { + if (id != null) { + module = getOverwrittenModule(moduleCache, id) + } module.exports = value } -function exportNamespace(module: Module, namespace: any) { +function exportNamespace( + module: Module, + moduleCache: ModuleCache, + namespace: any, + id: ModuleId | undefined +) { + if (id != null) { + module = getOverwrittenModule(moduleCache, id) + } module.exports = module.namespaceObject = namespace } diff --git a/turbopack/crates/turbopack-ecmascript/src/chunk/item.rs b/turbopack/crates/turbopack-ecmascript/src/chunk/item.rs index 6d289d741ec63..9b1bebe35b563 100644 --- a/turbopack/crates/turbopack-ecmascript/src/chunk/item.rs +++ b/turbopack/crates/turbopack-ecmascript/src/chunk/item.rs @@ -2,12 +2,14 @@ use std::io::Write; use anyhow::{Result, bail}; use serde::{Deserialize, Serialize}; +use smallvec::SmallVec; use turbo_tasks::{ - NonLocalValue, ResolvedVc, TaskInput, Upcast, ValueToString, Vc, trace::TraceRawVcs, + NonLocalValue, ResolvedVc, TaskInput, TryJoinIterExt, Upcast, ValueToString, Vc, + trace::TraceRawVcs, }; use turbo_tasks_fs::{FileSystemPath, rope::Rope}; use turbopack_core::{ - chunk::{AsyncModuleInfo, ChunkItem, ChunkItemWithAsyncModuleInfo, ChunkingContext}, + chunk::{AsyncModuleInfo, ChunkItem, ChunkItemWithAsyncModuleInfo, ChunkingContext, ModuleId}, code_builder::{Code, CodeBuilder}, error::PrettyPrintError, issue::{IssueExt, IssueSeverity, StyledString, code_gen::CodeGenerationIssue}, @@ -17,7 +19,7 @@ use turbopack_core::{ use crate::{ EcmascriptModuleContent, EcmascriptOptions, references::async_module::{AsyncModuleOptions, OptionAsyncModuleOptions}, - utils::FormatIter, + utils::{FormatIter, StringifyJs}, }; #[turbo_tasks::value(shared)] @@ -25,6 +27,7 @@ use crate::{ pub struct EcmascriptChunkItemContent { pub inner_code: Rope, pub source_map: Option, + pub additional_ids: SmallVec<[ResolvedVc; 1]>, pub options: EcmascriptChunkItemOptions, pub rewrite_source_path: Option>, pub placeholder_for_future_extensions: (), @@ -56,6 +59,7 @@ impl EcmascriptChunkItemContent { }, inner_code: content.inner_code.clone(), source_map: content.source_map.clone(), + additional_ids: content.additional_ids.clone(), options: if content.is_esm { EcmascriptChunkItemOptions { strict: true, @@ -104,7 +108,12 @@ impl EcmascriptChunkItemContent { args.push("w: __turbopack_wasm__"); args.push("u: __turbopack_wasm_module__"); } + let mut code = CodeBuilder::default(); + let additional_ids = self.additional_ids.iter().try_join().await?; + if !additional_ids.is_empty() { + code += "[" + } if self.options.this { code += "(function(__turbopack_context__) {\n"; } else { @@ -147,6 +156,10 @@ impl EcmascriptChunkItemContent { } code += "})"; + if !additional_ids.is_empty() { + writeln!(code, ", {}]", StringifyJs(&additional_ids))?; + } + Ok(code.build().cell()) } } diff --git a/turbopack/crates/turbopack-ecmascript/src/code_gen.rs b/turbopack/crates/turbopack-ecmascript/src/code_gen.rs index bd77f1da1c9d4..133db172bfbae 100644 --- a/turbopack/crates/turbopack-ecmascript/src/code_gen.rs +++ b/turbopack/crates/turbopack-ecmascript/src/code_gen.rs @@ -16,26 +16,29 @@ use turbopack_core::{ chunk::ChunkingContext, module_graph::ModuleGraph, reference::ModuleReference, }; -use crate::references::{ - AstPath, - amd::AmdDefineWithDependenciesCodeGen, - cjs::{ - CjsRequireAssetReferenceCodeGen, CjsRequireCacheAccess, - CjsRequireResolveAssetReferenceCodeGen, - }, - constant_condition::ConstantConditionCodeGen, - constant_value::ConstantValueCodeGen, - dynamic_expression::DynamicExpression, - esm::{ - EsmBinding, EsmModuleItem, ImportMetaBinding, ImportMetaRef, - dynamic::EsmAsyncAssetReferenceCodeGen, module_id::EsmModuleIdAssetReferenceCodeGen, - url::UrlAssetReferenceCodeGen, +use crate::{ + ScopeHoistingContext, + references::{ + AstPath, + amd::AmdDefineWithDependenciesCodeGen, + cjs::{ + CjsRequireAssetReferenceCodeGen, CjsRequireCacheAccess, + CjsRequireResolveAssetReferenceCodeGen, + }, + constant_condition::ConstantConditionCodeGen, + constant_value::ConstantValueCodeGen, + dynamic_expression::DynamicExpression, + esm::{ + EsmBinding, EsmModuleItem, ImportMetaBinding, ImportMetaRef, + dynamic::EsmAsyncAssetReferenceCodeGen, module_id::EsmModuleIdAssetReferenceCodeGen, + url::UrlAssetReferenceCodeGen, + }, + ident::IdentReplacement, + member::MemberReplacement, + require_context::RequireContextAssetReferenceCodeGen, + unreachable::Unreachable, + worker::WorkerAssetReferenceCodeGen, }, - ident::IdentReplacement, - member::MemberReplacement, - require_context::RequireContextAssetReferenceCodeGen, - unreachable::Unreachable, - worker::WorkerAssetReferenceCodeGen, }; #[derive(Default)] @@ -193,6 +196,7 @@ impl CodeGen { &self, g: Vc, ctx: Vc>, + scope_hoisting_context: Option>, ) -> Result { match self { Self::AmdDefineWithDependenciesCodeGen(v) => v.code_generation(g, ctx).await, @@ -200,7 +204,7 @@ impl CodeGen { Self::ConstantConditionCodeGen(v) => v.code_generation(g, ctx).await, Self::ConstantValueCodeGen(v) => v.code_generation(g, ctx).await, Self::DynamicExpression(v) => v.code_generation(g, ctx).await, - Self::EsmBinding(v) => v.code_generation(g, ctx).await, + Self::EsmBinding(v) => v.code_generation(g, ctx, scope_hoisting_context).await, Self::EsmModuleItem(v) => v.code_generation(g, ctx).await, Self::IdentReplacement(v) => v.code_generation(g, ctx).await, Self::ImportMetaBinding(v) => v.code_generation(g, ctx).await, diff --git a/turbopack/crates/turbopack-ecmascript/src/lib.rs b/turbopack/crates/turbopack-ecmascript/src/lib.rs index 39ed416385b07..f7d37c4296ac4 100644 --- a/turbopack/crates/turbopack-ecmascript/src/lib.rs +++ b/turbopack/crates/turbopack-ecmascript/src/lib.rs @@ -16,6 +16,7 @@ pub mod code_gen; mod errors; pub mod magic_identifier; pub mod manifest; +mod merged_module; pub mod minify; pub mod parse; mod path_visitor; @@ -40,7 +41,7 @@ use std::{ sync::Arc, }; -use anyhow::Result; +use anyhow::{Context, Result}; use chunk::EcmascriptChunkItem; use code_gen::{CodeGeneration, CodeGenerationHoistedStmt}; use either::Either; @@ -48,19 +49,25 @@ use parse::{ParseResult, parse}; use path_visitor::ApplyVisitors; use references::esm::UrlRewriteBehavior; pub use references::{AnalyzeEcmascriptModuleResult, TURBOPACK_HELPER}; +use rustc_hash::FxHashSet; use serde::{Deserialize, Serialize}; +use smallvec::SmallVec; pub use static_code::StaticEcmascriptCode; use swc_core::{ + atoms::Atom, base::SwcComments, common::{ - BytePos, DUMMY_SP, GLOBALS, Globals, Mark, SourceMap, + BytePos, DUMMY_SP, GLOBALS, Globals, Mark, SourceMap, SyntaxContext, comments::{Comment, Comments}, util::take::Take, }, ecma::{ - ast::{self, Expr, ModuleItem, Program, Script}, + ast::{ + self, CallExpr, Callee, EmptyStmt, Expr, ExprStmt, Id, ModuleItem, Program, Script, + Stmt, + }, codegen::{Emitter, text_writer::JsWriter}, - visit::{VisitMutWith, VisitMutWithAstPath}, + visit::{VisitMut, VisitMutWith, VisitMutWithAstPath}, }, quote, }; @@ -79,6 +86,7 @@ use turbopack_core::{ asset::{Asset, AssetContent}, chunk::{ AsyncModuleInfo, ChunkItem, ChunkType, ChunkableModule, ChunkingContext, EvaluatableAsset, + MergeableModule, MergeableModules, MergeableModulesExposed, ModuleChunkItemIdExt, ModuleId, }, compile_time_info::CompileTimeInfo, context::AssetContext, @@ -101,9 +109,12 @@ use self::chunk::{EcmascriptChunkItemContent, EcmascriptChunkType, EcmascriptExp use crate::{ chunk::{EcmascriptChunkPlaceable, placeable::is_marked_as_side_effect_free}, code_gen::{CodeGens, ModifiableAst}, + merged_module::MergedEcmascriptModule, parse::generate_js_source_map, references::{ - analyse_ecmascript_module, async_module::OptionAsyncModule, esm::base::EsmAssetReferences, + analyse_ecmascript_module, + async_module::OptionAsyncModule, + esm::{base::EsmAssetReferences, export}, }, side_effect_optimization::reference::EcmascriptModulePartReference, simple_tree_shake::{ModuleExportUsageInfo, get_module_export_usages}, @@ -320,12 +331,10 @@ pub trait EcmascriptAnalyzable: Module + Asset { module_graph: Vc, chunking_context: Vc>, async_module_info: Option>, - ) -> Vc { - EcmascriptModuleContent::new(self.module_content_options( - module_graph, - chunking_context, - async_module_info, - )) + ) -> Result> { + let own_options = + self.module_content_options(module_graph, chunking_context, async_module_info); + Ok(EcmascriptModuleContent::new(own_options)) } } @@ -711,6 +720,151 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleAsset { } } +#[turbo_tasks::value_impl] +impl MergeableModule for EcmascriptModuleAsset { + #[turbo_tasks::function] + async fn is_mergeable(self: ResolvedVc) -> Result> { + if matches!( + &*self.get_exports().await?, + EcmascriptExports::EsmExports(_) + ) { + return Ok(Vc::cell(true)); + } + + Ok(Vc::cell(false)) + } + + #[turbo_tasks::function] + async fn merge( + self: Vc, + modules: Vc, + entries: Vc, + ) -> Result>> { + Ok(Vc::upcast(*MergedEcmascriptModule::new( + modules + .await? + .iter() + .map(|(m, exposed)| { + Ok(( + ResolvedVc::try_sidecast::>(*m) + .context("expected EcmascriptAnalyzable")?, + *exposed, + )) + }) + .collect::>>()?, + entries + .await? + .iter() + .map(|m| { + ResolvedVc::try_sidecast::>(*m) + .context("expected EcmascriptAnalyzable") + }) + .collect::>>()?, + self.options().to_resolved().await?, + ))) + + // let modules = modules.await?; + + // async fn is_eligible( + // module: ResolvedVc>, + // ) -> Result>>> { + // if let Some(analyzable) = + // ResolvedVc::try_sidecast::>(module) + // { + // if let Some(placeable) = + // ResolvedVc::try_sidecast::>(module) + // { + // if matches!( + // &*placeable.get_exports().await?, + // |EcmascriptExports::DynamicNamespace| EcmascriptExports::CommonJs + // | EcmascriptExports::EmptyCommonJs + // | EcmascriptExports::Value + // ) { + // return Ok(None); + // } + // } + // Ok(Some(analyzable)) + // } else { + // Ok(None) + // } + // } + + // // let mut start_idx = None; + // // let mut length = 0; + // // for i in 0..modules.len() { + // // let module = modules[i]; + // // if let Some(module) = is_eligible(module).await? { + // // if start_idx.is_some() { + // // continue; + // // } else { + // // start_idx = Some(i); + // // } + // // } else { + // // if let Some(start_idx) = start_idx + // // && (i - start_idx) >= 2 + // // { + // // // We found a sequence of modules containing least 2 modules + // // length = i - start_idx; + // // break; + // // } else { + // // start_idx = None; + // // } + // // } + // // } + // // let Some(start_idx) = start_idx else { + // // return Ok(MergeableModuleResult::not_merged()); + // // }; + // // let consumed_modules = modules[start_idx..start_idx + length].to_vec(); + + // let mut modules = modules.iter().zip(0u32..); + // let mut merged_modules = vec![]; + // let mut start_index = 0; + // while let Some(((first, exposed), first_i)) = modules.next() { + // // Skip some modules, try to find the first eligible module + // if let Some(first) = is_eligible(*first).await? { + // if merged_modules.is_empty() { + // start_index = first_i; + // } + // merged_modules.push((first, *exposed)); + + // // Consume as many modules as possible to merge together + // for ((m, exposed), _) in &mut modules { + // if let Some(m) = is_eligible(*m).await? { + // merged_modules.push((m, *exposed)); + // } else { + // break; + // } + // } + + // // List has ended or incompatible module encountered + // if merged_modules.len() > 1 { + // // ... but we successfully found something to merge. + // break; + // } + + // // Only a single module, ignore and try to find a bigger sequence in the + // remaining // list. + // merged_modules.clear(); + // } + // } + + // if merged_modules.len() > 1 { + // Ok(MergeableModuleResult::Merged { + // consumed: merged_modules.len() as u32, + // skipped: start_index, + // merged_module: ResolvedVc::upcast(MergedEcmascriptModule::new( + // merged_modules, + // // TODO where to get options from? + // self.options().to_resolved().await?, + // )), + // } + // .cell()) + // } else { + // Ok(MergeableModuleResult::not_merged()) + // } + } +} + #[turbo_tasks::value_impl] impl EvaluatableAsset for EcmascriptModuleAsset {} @@ -822,7 +976,7 @@ pub struct EcmascriptModuleContent { pub inner_code: Rope, pub source_map: Option, pub is_esm: bool, - // pub refresh: bool, + pub additional_ids: SmallVec<[ResolvedVc; 1]>, } #[turbo_tasks::value(shared)] @@ -846,7 +1000,10 @@ pub struct EcmascriptModuleContentOptions { } impl EcmascriptModuleContentOptions { - async fn merged_code_gens(&self) -> Result> { + async fn merged_code_gens( + &self, + scope_hoisting_context: Option>, + ) -> Result> { let EcmascriptModuleContentOptions { parsed, module_graph, @@ -880,7 +1037,12 @@ impl EcmascriptModuleContentOptions { if let EcmascriptExports::EsmExports(exports) = *exports.await? { Some( exports - .code_generation(**chunking_context, Some(**parsed), *export_usage_info) + .code_generation( + **chunking_context, + scope_hoisting_context, + Some(**parsed), + *export_usage_info, + ) .await?, ) } else { @@ -891,7 +1053,7 @@ impl EcmascriptModuleContentOptions { let esm_code_gens = esm_references .await? .iter() - .map(|r| r.code_generation(**chunking_context)) + .map(|r| r.code_generation(**chunking_context, scope_hoisting_context)) .try_join() .await?; @@ -904,7 +1066,9 @@ impl EcmascriptModuleContentOptions { let code_gens = code_generation .await? .iter() - .map(|c| c.code_generation(**module_graph, **chunking_context)) + .map(|c| { + c.code_generation(**module_graph, **chunking_context, scope_hoisting_context) + }) .try_join() .await?; @@ -936,7 +1100,8 @@ impl EcmascriptModuleContent { original_source_map, .. } = &*input; - let code_gens = input.merged_code_gens().await?; + + let code_gens = input.merged_code_gens(None).await?; async { let content = process_parse_result( *parsed, @@ -945,9 +1110,10 @@ impl EcmascriptModuleContent { code_gens, *generate_source_map, *original_source_map, + None, ) .await?; - emit_content(content).await + emit_content(content, Default::default()).await } .instrument(tracing::info_span!("gen content with code gens")) .await @@ -968,15 +1134,301 @@ impl EcmascriptModuleContent { vec![], generate_source_map, None, + None, ) .await?; - emit_content(content).await + emit_content(content, Default::default()).await + } + + /// Creates a new [`Vc`] from multiple modules, performing scope + /// hoisting. + #[turbo_tasks::function] + pub async fn new_merged( + modules: Vec<(ResolvedVc>, bool)>, + module_options: Vec>, + entries: Vec>>, + ) -> Result> { + let modules = modules + .into_iter() + .map(|(m, exposed)| { + ( + ResolvedVc::try_sidecast::>(m).unwrap(), + exposed, + ) + }) + .collect::>(); + let entries = entries + .into_iter() + .map(|m| { + let m = ResolvedVc::try_sidecast::>(m).unwrap(); + (m, modules.get_index_of(&m).unwrap()) + }) + .collect::>(); + + let globals_merged = Globals::default(); + let merged_ctxts = GLOBALS.set(&globals_merged, || { + let exports_mark = Mark::new(); + FxIndexMap::from_iter(modules.keys().map(|m| { + ( + *m, + SyntaxContext::empty().apply_mark(Mark::fresh(exports_mark)), + ) + })) + }); + + let contents = module_options + .iter() + .zip(modules.keys().copied()) + .map(async |(options, module)| { + let options = options.await?; + let EcmascriptModuleContentOptions { + parsed, + ident, + specified_module_type, + generate_source_map, + original_source_map, + .. + } = &*options; + let var_name = parsed.await?; + let globals = if let ParseResult::Ok { globals, .. } = &*var_name { + globals + } else { + unreachable!() + }; + let (is_export_mark, module_syntax_contexts) = GLOBALS.set(globals, || { + let is_export_mark = Mark::new(); + let module_syntax_contexts: FxIndexMap<_, _> = modules + .keys() + .map(|m| { + let mark = Mark::fresh(is_export_mark); + ( + *m, + SyntaxContext::empty() + .apply_mark(is_export_mark) + .apply_mark(mark), + ) + }) + .collect(); + (is_export_mark, module_syntax_contexts) + }); + let ctx = ScopeHoistingContext { + module, + modules: &modules, + module_syntax_contexts: &module_syntax_contexts, + }; + let code_gens = options.merged_code_gens(Some(ctx)).await?; + let preserved_exports = match &*module.get_exports().await? { + EcmascriptExports::EsmExports(exports) => exports + .await? + .exports + .iter() + .flat_map(|(_, e)| { + if let export::EsmExport::LocalBinding(n, _) = e { + Some(Atom::from(&**n)) + } else { + None + } + }) + .collect(), + _ => Default::default(), + }; + let result = process_parse_result( + *parsed, + **ident, + *specified_module_type, + code_gens, + *generate_source_map, + *original_source_map, + Some((is_export_mark, preserved_exports)), + ) + .await?; + Ok((module, module_syntax_contexts, is_export_mark, result)) + }) + .try_join() + .await?; + + // TODO properly merge ASTs: + // - somehow merge the SourceMap struct + let merged_ast = merge_modules(contents, entries, &merged_ctxts, &globals_merged).await?; + let content = CodeGenResult { + program: merged_ast, + source_map: Arc::new(SourceMap::default()), + globals: Arc::new(globals_merged), + comments: Either::Left(Default::default()), + is_esm: true, + generate_source_map: false, + original_source_map: None, + extra_comments: SwcComments::default(), + }; + let chunking_context = module_options.last().unwrap().await?.chunking_context; + let additional_ids = modules + .keys() + .take(modules.len() - 1) + .map(|m| m.chunk_item_id(*chunking_context).to_resolved()) + .try_join() + .await? + .into(); + + emit_content(content, additional_ids).await } } +#[allow(clippy::type_complexity)] +async fn merge_modules( + mut contents: Vec<( + ResolvedVc>, + FxIndexMap>, SyntaxContext>, + Mark, + CodeGenResult, + )>, + entries: Vec<(ResolvedVc>, usize)>, + merged_ctxts: &'_ FxIndexMap>, SyntaxContext>, + globals_merged: &'_ Globals, +) -> Result { + struct SetSyntaxContextVisitor<'a> { + current_module: ResolvedVc>, + // A marker to quickly identify the special cross-module variable references + export_mark: Mark, + // The syntax contexts in the merged AST (each module has its own) + merged_ctxts: &'a FxIndexMap>, SyntaxContext>, + // The export syntax contexts in the current AST, which will be mapped to merged_ctxts + current_module_contexts: + &'a FxIndexMap>, SyntaxContext>, + } + impl VisitMut for SetSyntaxContextVisitor<'_> { + fn visit_mut_syntax_context(&mut self, ctxt: &mut SyntaxContext) { + let module = if ctxt.has_mark(self.export_mark) { + *self + .current_module_contexts + .iter() + .find(|(_, module_ctxt)| *ctxt == **module_ctxt) + .unwrap() + .0 + } else { + self.current_module + }; + + *ctxt = *self.merged_ctxts.get(&module).unwrap(); + } + // fn visit_mut_span(&mut self, span: &mut Span) {} + } + + let prepare_module = |(module, module_contexts, export_mark, content): &mut ( + ResolvedVc>, + FxIndexMap>, SyntaxContext>, + Mark, + CodeGenResult, + )| { + if let CodeGenResult { + program: Program::Module(content), + globals, + .. + } = content + { + GLOBALS.set(&*globals, || { + content.visit_mut_with(&mut SetSyntaxContextVisitor { + current_module: *module, + export_mark: *export_mark, + merged_ctxts, + current_module_contexts: module_contexts, + }); + }); + + content.take().body + } else { + unreachable!() + } + }; + + let mut inserted = FxHashSet::with_capacity_and_hasher(contents.len(), Default::default()); + + inserted.extend(entries.iter().map(|(_, i)| *i)); + + let mut merged_ast = swc_core::ecma::ast::Module { + span: DUMMY_SP, + shebang: None, + body: entries + .iter() + .flat_map(|(_, i)| prepare_module(&mut contents[*i])) + .collect(), + }; + + // Replace inserted `__turbopack_merged_esm__(i);` statements with the corresponding ith-module + let mut i = 0; + loop { + if i >= merged_ast.body.len() { + break; + } + if let ModuleItem::Stmt(Stmt::Expr(ExprStmt { expr, .. })) = &merged_ast.body[i] { + if let Expr::Call(CallExpr { + callee: Callee::Expr(callee), + args, + .. + }) = &**expr + { + if callee.is_ident_ref_to("__turbopack_merged_esm__") { + let index = args[0].expr.as_lit().unwrap().as_num().unwrap().value as usize; + + if inserted.insert(index) { + let module = &mut contents[index]; + merged_ast.body.splice(i..=i, prepare_module(module)); + + // Don't increment, the ith item has just changed + continue; + } else { + // Already inserted (and thus already executed), remove the placeholder + merged_ast.body[i] = + ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP })); + } + } + } + } + + i += 1; + } + + debug_assert!( + inserted.len() == contents.len(), + "Not all merged modules were inserted: {:?}", + contents + .iter() + .enumerate() + .map(async |(i, m)| Ok((inserted.contains(&i), m.0.ident().to_string().await?))) + .try_join() + .await?, + ); + + let mut merged_ast = Program::Module(merged_ast); + + GLOBALS.set(globals_merged, || { + merged_ast.visit_mut_with(&mut swc_core::ecma::transforms::base::hygiene::hygiene()); + // merged_ast.visit_mut_with(&mut DisplayContextVisitor { postfix: "merged" }); + }); + + Ok(merged_ast) +} + +// struct DisplayContextVisitor { +// postfix: &'static str, +// } +// impl VisitMut for DisplayContextVisitor { +// fn visit_mut_ident(&mut self, ident: &mut swc_core::ecma::ast::Ident) { +// ident.sym = format!("{}$$${}{}", ident.sym, self.postfix, ident.ctxt.as_u32()).into(); +// } +// } +#[derive(Clone, Copy)] +pub struct ScopeHoistingContext<'a> { + module: ResolvedVc>, + modules: &'a FxIndexMap>, bool>, + /// To import a specifier from another module, apply this context to the Ident + module_syntax_contexts: + &'a FxIndexMap>, SyntaxContext>, +} + struct CodeGenResult { program: Program, source_map: Arc, + globals: Arc, comments: Either>, extra_comments: SwcComments, is_esm: bool, @@ -991,6 +1443,7 @@ async fn process_parse_result( mut code_gens: Vec, generate_source_map: bool, original_source_map: Option>>, + retain_syntax_context: Option<(Mark, FxHashSet)>, ) -> Result { let parsed = parsed.final_read_hint().await?; @@ -1045,12 +1498,7 @@ async fn process_parse_result( let top_level_mark = eval_context.top_level_mark; let is_esm = eval_context.is_esm(specified_module_type); - process_content_with_code_gens( - &mut program, - globals, - Some(top_level_mark), - &mut code_gens, - ); + process_content_with_code_gens(&mut program, globals, &mut code_gens); for comments in code_gens.iter_mut().flat_map(|cg| cg.comments.as_mut()) { let leading = Arc::unwrap_or_clone(take(&mut comments.leading)); @@ -1065,9 +1513,37 @@ async fn process_parse_result( } } + GLOBALS.set(globals, || { + if let Some((is_export_mark, preserved_symbols)) = retain_syntax_context { + program.visit_mut_with(&mut hygiene_rename_only( + Some(top_level_mark), + is_export_mark, + preserved_symbols, + )); + } else { + program.visit_mut_with( + &mut swc_core::ecma::transforms::base::hygiene::hygiene_with_config( + swc_core::ecma::transforms::base::hygiene::Config { + top_level_mark, + ..Default::default() + }, + ), + ); + } + // program.visit_mut_with(&mut DisplayContextVisitor { + // postfix: "individual", + // }); + program.visit_mut_with(&mut swc_core::ecma::transforms::base::fixer::fixer(None)); + + // we need to remove any shebang before bundling as it's only valid as the first + // line in a js file (not in a chunk item wrapped in the runtime) + remove_shebang(&mut program); + }); + CodeGenResult { program, source_map: source_map.clone(), + globals: globals.clone(), comments, extra_comments, is_esm, @@ -1098,6 +1574,7 @@ async fn process_parse_result( shebang: None, }), source_map: Arc::new(SourceMap::default()), + globals: Arc::new(Globals::default()), comments: Either::Left(Default::default()), extra_comments: Default::default(), is_esm: false, @@ -1123,6 +1600,7 @@ async fn process_parse_result( shebang: None, }), source_map: Arc::new(SourceMap::default()), + globals: Arc::new(Globals::default()), comments: Either::Left(Default::default()), extra_comments: Default::default(), is_esm: false, @@ -1133,7 +1611,10 @@ async fn process_parse_result( }) } -async fn emit_content(content: CodeGenResult) -> Result> { +async fn emit_content( + content: CodeGenResult, + additional_ids: SmallVec<[ResolvedVc; 1]>, +) -> Result> { let CodeGenResult { program, source_map, @@ -1142,6 +1623,7 @@ async fn emit_content(content: CodeGenResult) -> Result = vec![]; @@ -1209,6 +1691,7 @@ async fn emit_content(content: CodeGenResult) -> Result Result, code_gens: &mut Vec, ) { let mut visitors = Vec::new(); @@ -1250,19 +1732,6 @@ fn process_content_with_code_gens( for pass in root_visitors { program.modify(pass); } - program.visit_mut_with( - &mut swc_core::ecma::transforms::base::hygiene::hygiene_with_config( - swc_core::ecma::transforms::base::hygiene::Config { - top_level_mark: top_level_mark.unwrap_or_default(), - ..Default::default() - }, - ), - ); - program.visit_mut_with(&mut swc_core::ecma::transforms::base::fixer::fixer(None)); - - // we need to remove any shebang before bundling as it's only valid as the first - // line in a js file (not in a chunk item wrapped in the runtime) - remove_shebang(program); }); match program { @@ -1286,6 +1755,50 @@ fn process_content_with_code_gens( }; } +/// Like `hygiene`, but only renames the Atoms without clearing all SyntaxContexts +/// +/// Don't rename idents marked with `is_export_mark` (i.e. imported identifier from another module) +/// or listed in `preserve_name` (i.e. export local binding): even if they are causing collisions, +/// they will be handled by the next hygiene pass over the whole module. +fn hygiene_rename_only( + top_level_mark: Option, + is_export_mark: Mark, + preserved_symbols: FxHashSet, +) -> impl VisitMut { + struct HygieneRenamer { + preserved_symbols: FxHashSet, + is_export_mark: Mark, + } + impl swc_core::ecma::transforms::base::rename::Renamer for HygieneRenamer { + const MANGLE: bool = false; + const RESET_N: bool = true; + + fn new_name_for(&self, orig: &Id, n: &mut usize) -> Atom { + let res = if *n == 0 { + orig.0.clone() + } else { + format!("{}{}", orig.0, n).into() + }; + *n += 1; + res + } + + fn preserve_name(&self, orig: &Id) -> bool { + self.preserved_symbols.contains(&orig.0) || orig.1.has_mark(self.is_export_mark) + } + } + swc_core::ecma::transforms::base::rename::renamer( + swc_core::ecma::transforms::base::hygiene::Config { + top_level_mark: top_level_mark.unwrap_or_default(), + ..Default::default() + }, + HygieneRenamer { + preserved_symbols, + is_export_mark, + }, + ) +} + struct MergedComments where A: Comments, diff --git a/turbopack/crates/turbopack-ecmascript/src/merged_module.rs b/turbopack/crates/turbopack-ecmascript/src/merged_module.rs new file mode 100644 index 0000000000000..645a42c5f9dca --- /dev/null +++ b/turbopack/crates/turbopack-ecmascript/src/merged_module.rs @@ -0,0 +1,171 @@ +use anyhow::Result; +use turbo_tasks::{ResolvedVc, Vc}; +use turbopack_core::{ + asset::{Asset, AssetContent}, + chunk::{AsyncModuleInfo, ChunkItem, ChunkType, ChunkableModule, ChunkingContext}, + ident::AssetIdent, + module::Module, + module_graph::ModuleGraph, + reference::ModuleReferences, +}; + +use crate::{ + EcmascriptAnalyzable, EcmascriptModuleContent, EcmascriptOptions, + chunk::{EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkType}, +}; + +#[turbo_tasks::value(shared)] +pub(crate) struct MergedEcmascriptModule { + modules: Vec<(ResolvedVc>, bool)>, + entries: Vec>>, + options: ResolvedVc, +} + +impl MergedEcmascriptModule { + pub fn new( + modules: Vec<(ResolvedVc>, bool)>, + entries: Vec>>, + options: ResolvedVc, + ) -> ResolvedVc { + MergedEcmascriptModule { + modules, + entries, + options, + } + .resolved_cell() + } +} + +#[turbo_tasks::value_impl] +impl Asset for MergedEcmascriptModule { + #[turbo_tasks::function] + fn content(&self) -> Vc { + panic!("content() should not be called"); + } +} + +#[turbo_tasks::value_impl] +impl Module for MergedEcmascriptModule { + #[turbo_tasks::function] + fn ident(&self) -> Vc { + // This purposely reuses the module's ident as it has replaced the original module, thus + // there can never be a collision. + self.modules.last().unwrap().0.ident() + } + + #[turbo_tasks::function] + async fn references(self: Vc) -> Result> { + panic!("references() should not be called"); + } + + #[turbo_tasks::function] + async fn is_self_async(&self) -> Result> { + panic!("is_self_async() should not be called"); + } +} + +#[turbo_tasks::value_impl] +impl ChunkableModule for MergedEcmascriptModule { + #[turbo_tasks::function] + fn as_chunk_item( + self: ResolvedVc, + module_graph: ResolvedVc, + chunking_context: ResolvedVc>, + ) -> Vc> { + Vc::upcast( + MergedEcmascriptModuleChunkItem { + module: self, + module_graph, + chunking_context, + } + .cell(), + ) + } +} + +#[turbo_tasks::value] +struct MergedEcmascriptModuleChunkItem { + module: ResolvedVc, + module_graph: ResolvedVc, + chunking_context: ResolvedVc>, +} + +#[turbo_tasks::value_impl] +impl ChunkItem for MergedEcmascriptModuleChunkItem { + #[turbo_tasks::function] + fn asset_ident(&self) -> Vc { + self.module.ident() + } + + #[turbo_tasks::function] + fn chunking_context(&self) -> Vc> { + *ResolvedVc::upcast(self.chunking_context) + } + + #[turbo_tasks::function] + async fn ty(&self) -> Result>> { + Ok(Vc::upcast( + Vc::::default().resolve().await?, + )) + } + + #[turbo_tasks::function] + fn module(&self) -> Vc> { + *ResolvedVc::upcast(self.module) + } +} + +#[turbo_tasks::value_impl] +impl EcmascriptChunkItem for MergedEcmascriptModuleChunkItem { + #[turbo_tasks::function] + fn content(self: Vc) -> Vc { + panic!("content() should not be called"); + } + + #[turbo_tasks::function] + async fn content_with_async_module_info( + &self, + async_module_info: Option>, + ) -> Result> { + let module = self.module.await?; + let modules = &module.modules; + let entries = &module.entries; + // println!( + // "merged chunk item: {:?}", + // modules + // .iter() + // .map(|m| m.ident().to_string()) + // .try_join() + // .await? + // ); + let options = modules + .iter() + .map(|(m, _)| { + let Some(m) = ResolvedVc::try_downcast::>(*m) else { + anyhow::bail!("Expected EcmascriptAnalyzable in scope hoisting group"); + }; + Ok(m.module_content_options( + *self.module_graph, + *self.chunking_context, + async_module_info, + )) + }) + .collect::>>()?; + + let content = EcmascriptModuleContent::new_merged( + modules.clone(), + options, + entries.iter().map(|m| **m).collect(), + ); + + // TODO async + let async_module_options = Vc::cell(None); + + Ok(EcmascriptChunkItemContent::new( + content, + *self.chunking_context, + *module.options, + async_module_options, + )) + } +} diff --git a/turbopack/crates/turbopack-ecmascript/src/references/async_module.rs b/turbopack/crates/turbopack-ecmascript/src/references/async_module.rs index 75a731a5f9183..227322ae6320d 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/async_module.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/async_module.rs @@ -1,7 +1,7 @@ use anyhow::Result; use serde::{Deserialize, Serialize}; use swc_core::{ - common::DUMMY_SP, + common::{DUMMY_SP, SyntaxContext}, ecma::ast::{ArrayLit, ArrayPat, Expr, Ident}, quote, }; @@ -76,7 +76,7 @@ impl OptionAsyncModule { } #[turbo_tasks::value(transparent)] -struct AsyncModuleIdents(FxIndexSet); +struct AsyncModuleIdents(FxIndexSet<(String, u32)>); async fn get_inherit_async_referenced_asset( r: Vc>, @@ -122,7 +122,11 @@ impl AsyncModule { Ok(match &*referenced_asset { ReferencedAsset::External(_, ExternalType::EcmaScriptModule) => { if self.import_externals { - referenced_asset.get_ident(chunking_context).await? + referenced_asset + .get_ident(chunking_context, None, None) + .await? + .map(|i| i.into_module_namespace_ident().unwrap()) + .map(|(i, ctx)| (i, ctx.unwrap_or_default().as_u32())) } else { None } @@ -132,7 +136,11 @@ impl AsyncModule { .referenced_async_modules .contains(&ResolvedVc::upcast(*placeable)) { - referenced_asset.get_ident(chunking_context).await? + referenced_asset + .get_ident(chunking_context, None, None) + .await? + .map(|i| i.into_module_namespace_ident().unwrap()) + .map(|(i, ctx)| (i, ctx.unwrap_or_default().as_u32())) } else { None } @@ -207,8 +215,12 @@ impl AsyncModule { if !async_idents.is_empty() { let idents = async_idents .iter() - .map(|ident: &String| { - Ident::new(ident.clone().into(), DUMMY_SP, Default::default()) + .map(|(ident, ctxt)| { + Ident::new( + ident.clone().into(), + DUMMY_SP, + SyntaxContext::from_u32(*ctxt), + ) }) .collect::>(); diff --git a/turbopack/crates/turbopack-ecmascript/src/references/esm/base.rs b/turbopack/crates/turbopack-ecmascript/src/references/esm/base.rs index b4e6f87682773..99037747405b3 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/esm/base.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/esm/base.rs @@ -1,8 +1,12 @@ use anyhow::{Result, anyhow, bail}; +use either::Either; use strsim::jaro; use swc_core::{ - common::{BytePos, DUMMY_SP, Span}, - ecma::ast::{Decl, Expr, ExprStmt, Ident, Stmt}, + common::{BytePos, DUMMY_SP, Span, SyntaxContext}, + ecma::ast::{ + ComputedPropName, Decl, Expr, ExprStmt, Ident, Lit, MemberExpr, MemberProp, Number, + SeqExpr, Stmt, Str, + }, quote, }; use turbo_rcstr::RcStr; @@ -32,12 +36,15 @@ use turbopack_resolve::ecmascript::esm_resolve; use super::export::{all_known_export_names, is_export_missing}; use crate::{ - TreeShakingMode, + ScopeHoistingContext, TreeShakingMode, analyzer::imports::ImportAnnotations, - chunk::EcmascriptChunkPlaceable, - code_gen::CodeGeneration, + chunk::{EcmascriptChunkPlaceable, EcmascriptExports}, + code_gen::{CodeGeneration, CodeGenerationHoistedStmt}, magic_identifier, - references::util::{request_to_string, throw_module_not_found_expr}, + references::{ + esm::EsmExport, + util::{request_to_string, throw_module_not_found_expr}, + }, runtime_functions::{TURBOPACK_EXTERNAL_IMPORT, TURBOPACK_EXTERNAL_REQUIRE, TURBOPACK_IMPORT}, tree_shake::{TURBOPACK_PART_IMPORT_SOURCE, asset::EcmascriptModulePartAsset}, utils::module_id_to_lit, @@ -51,18 +58,181 @@ pub enum ReferencedAsset { Unresolvable, } +#[derive(Debug)] +pub enum ReferencedAssetIdent { + LocalBinding { + ident: RcStr, + ctxt: SyntaxContext, + }, + Module { + namespace_ident: String, + ctxt: Option, + export: Option, + }, +} + +impl ReferencedAssetIdent { + pub fn into_module_namespace_ident(self) -> Option<(String, Option)> { + match self { + ReferencedAssetIdent::Module { + namespace_ident, + ctxt, + .. + } => Some((namespace_ident, ctxt)), + ReferencedAssetIdent::LocalBinding { .. } => None, + } + } + + pub fn as_expr_individual(&self, span: Span) -> Either { + match self { + ReferencedAssetIdent::LocalBinding { ident, ctxt } => { + Either::Left(Ident::new(ident.as_str().into(), span, *ctxt)) + } + ReferencedAssetIdent::Module { + namespace_ident, + ctxt, + export, + } => { + let ns = Ident::new( + namespace_ident.as_str().into(), + span, + ctxt.unwrap_or_default(), + ); + if let Some(export) = export { + Either::Right(MemberExpr { + span, + obj: Box::new(Expr::Ident(ns)), + prop: MemberProp::Computed(ComputedPropName { + span, + expr: Box::new(Expr::Lit(Lit::Str(Str { + span, + value: export.as_str().into(), + raw: None, + }))), + }), + }) + } else { + Either::Left(ns) + } + } + } + } + pub fn as_expr(&self, span: Span, is_callee: bool) -> Expr { + match self.as_expr_individual(span) { + Either::Left(ident) => ident.into(), + Either::Right(member) => { + if is_callee { + Expr::Seq(SeqExpr { + exprs: vec![ + Box::new(Expr::Lit(Lit::Num(Number { + span, + value: 0.0, + raw: None, + }))), + Box::new(member.into()), + ], + span, + }) + } else { + member.into() + } + } + } + } +} + impl ReferencedAsset { pub async fn get_ident( &self, chunking_context: Vc>, - ) -> Result> { + export: Option, + scope_hoisting_context: Option>, + ) -> Result> { Ok(match self { ReferencedAsset::Some(asset) => { - Some(Self::get_ident_from_placeable(asset, chunking_context).await?) + if let Some(scope_hoisting_context) = scope_hoisting_context { + if let Some(ctxt) = scope_hoisting_context + .module_syntax_contexts + .get(&ResolvedVc::upcast(*asset)) + { + if let Some(export) = &export { + if let EcmascriptExports::EsmExports(exports) = + *asset.get_exports().await? + { + let exports = exports.expand_exports(None).await?; + let export = exports.exports.get(export); + match export { + Some(EsmExport::LocalBinding(name, _)) => { + // A local binding in a module that is merged in the same + // group + return Ok(Some(ReferencedAssetIdent::LocalBinding { + ident: name.clone(), + ctxt: *ctxt, + })); + } + Some(b @ EsmExport::ImportedBinding(esm_ref, _, _)) + | Some(b @ EsmExport::ImportedNamespace(esm_ref)) => { + let export = + if let EsmExport::ImportedBinding(_, export, _) = b { + Some(export.clone()) + } else { + None + }; + + let referenced_asset = + ReferencedAsset::from_resolve_result( + esm_ref.resolve_reference(), + ) + .await?; + + // If the target module is still in the same group, we can + // refer it locally, otherwise it will be imported + return Ok( + match Box::pin(referenced_asset.get_ident( + chunking_context, + export, + Some(scope_hoisting_context), + )) + .await? + { + Some(ReferencedAssetIdent::Module { + namespace_ident, + // Overwrite the context. This import isn't + // inserted in the module that uses the import, + // but in the module containing the reexport + ctxt: None, + export, + }) => Some(ReferencedAssetIdent::Module { + namespace_ident, + ctxt: Some(*ctxt), + export, + }), + ident => ident, + }, + ); + } + Some(EsmExport::Error) | None => { + // Export not found, either there was already an error, or + // this is some dynamic (CJS) (re)export situation. + } + } + } + } + } + } + + Some(ReferencedAssetIdent::Module { + namespace_ident: Self::get_ident_from_placeable(asset, chunking_context) + .await?, + ctxt: None, + export, + }) } - ReferencedAsset::External(request, ty) => Some(magic_identifier::mangle(&format!( - "{ty} external {request}" - ))), + ReferencedAsset::External(request, ty) => Some(ReferencedAssetIdent::Module { + namespace_ident: magic_identifier::mangle(&format!("{ty} external {request}")), + ctxt: None, + export, + }), ReferencedAsset::None | ReferencedAsset::Unresolvable => None, }) } @@ -304,137 +474,177 @@ impl EsmAssetReference { pub async fn code_generation( self: Vc, chunking_context: Vc>, + scope_hoisting_context: Option>, ) -> Result { let this = &*self.await?; // only chunked references can be imported - let result = if this.annotations.chunking_type() != Some("none") { + if this.annotations.chunking_type() != Some("none") { let import_externals = this.import_externals; let referenced_asset = self.get_referenced_asset().await?; - if let ReferencedAsset::Unresolvable = &*referenced_asset { - // Insert code that throws immediately at time of import if a request is - // unresolvable - let request = request_to_string(*this.request).await?.to_string(); - let stmt = Stmt::Expr(ExprStmt { - expr: Box::new(throw_module_not_found_expr(&request)), - span: DUMMY_SP, - }); - Some((format!("throw {request}").into(), stmt)) - } else if let Some(ident) = referenced_asset.get_ident(chunking_context).await? { - let span = this - .issue_source - .to_swc_offsets() - .await? - .map_or(DUMMY_SP, |(start, end)| { - Span::new(BytePos(start), BytePos(end)) + + match &*referenced_asset { + ReferencedAsset::Unresolvable => { + // Insert code that throws immediately at time of import if a request is + // unresolvable + let request = request_to_string(*this.request).await?.to_string(); + let stmt = Stmt::Expr(ExprStmt { + expr: Box::new(throw_module_not_found_expr(&request)), + span: DUMMY_SP, }); - match &*referenced_asset { - ReferencedAsset::Unresolvable => { - unreachable!() - } - ReferencedAsset::Some(asset) => { - let id = asset.chunk_item_id(Vc::upcast(chunking_context)).await?; - let name = ident; - Some(( - id.to_string().into(), - var_decl_with_span( - quote!( - "var $name = $turbopack_import($id);" as Stmt, - name = Ident::new(name.clone().into(), DUMMY_SP, Default::default()), - turbopack_import: Expr = TURBOPACK_IMPORT.into(), - id: Expr = module_id_to_lit(&id), - ), - span, - ), - )) - } - ReferencedAsset::External(request, ExternalType::EcmaScriptModule) => { - if !*chunking_context - .environment() - .supports_esm_externals() - .await? - { - bail!( - "the chunking context ({}) does not support external modules (esm \ - request: {})", - chunking_context.name().await?, - request - ); - } - Some(( - ident.clone().into(), - var_decl_with_span( - if import_externals { - quote!( - "var $name = $turbopack_external_import($id);" as Stmt, - name = Ident::new(ident.clone().into(), DUMMY_SP, Default::default()), - turbopack_external_import: Expr = TURBOPACK_EXTERNAL_IMPORT.into(), - id: Expr = Expr::Lit(request.clone().to_string().into()) - ) - } else { - quote!( - "var $name = $turbopack_external_require($id, () => require($id), true);" as Stmt, - name = Ident::new(ident.clone().into(), DUMMY_SP, Default::default()), - turbopack_external_require: Expr = TURBOPACK_EXTERNAL_REQUIRE.into(), - id: Expr = Expr::Lit(request.clone().to_string().into()) - ) - }, - span, + return Ok(CodeGeneration::hoisted_stmt( + format!("throw {request}").into(), + stmt, + )); + } + ReferencedAsset::None => {} + _ => { + let mut result = vec![]; + + let merged_index = scope_hoisting_context + .zip(if let ReferencedAsset::Some(asset) = &*referenced_asset { + Some(*asset) + } else { + None + }) + .and_then(|(c, asset)| c.modules.get_index_of(&ResolvedVc::upcast(asset))); + + if let Some(merged_index) = merged_index { + // Insert a placeholder to inline the merged module at the right place + // relative to the other references (so to keep reference order). + result.push(CodeGenerationHoistedStmt::new( + format!("hoisted {merged_index}").into(), + quote!( + "__turbopack_merged_esm__($id);" as Stmt, + id: Expr = Lit::Num(merged_index.into()).into(), ), - )) + )); } - ReferencedAsset::External( - request, - ExternalType::CommonJs | ExternalType::Url, - ) => { - if !*chunking_context - .environment() - .supports_commonjs_externals() + + if merged_index.is_some() + && !this + .export_name + .as_ref() + .is_none_or(|e| matches!(e, ModulePart::Exports)) + { + // No need to import, the module is already available in the same scope + // hoisting group (unless it's a namespace import) + } else if let Some(ident) = referenced_asset + .get_ident(chunking_context, None, scope_hoisting_context) + .await? + { + let span = this + .issue_source + .to_swc_offsets() .await? - { - bail!( - "the chunking context ({}) does not support external modules \ - (request: {})", - chunking_context.name().await?, - request - ); - } - Some(( - ident.clone().into(), - var_decl_with_span( - quote!( - "var $name = $turbopack_external_require($id, () => require($id), true);" as Stmt, - name = Ident::new(ident.clone().into(), DUMMY_SP, Default::default()), - turbopack_external_require: Expr = TURBOPACK_EXTERNAL_REQUIRE.into(), - id: Expr = Expr::Lit(request.clone().to_string().into()) - ), - span, - ), - )) - } - // fallback in case we introduce a new `ExternalType` - #[allow(unreachable_patterns)] - ReferencedAsset::External(request, ty) => { - bail!( - "Unsupported external type {:?} for ESM reference with request: {:?}", - ty, - request - ) + .map_or(DUMMY_SP, |(start, end)| { + Span::new(BytePos(start), BytePos(end)) + }); + match &*referenced_asset { + ReferencedAsset::Unresolvable => { + unreachable!(); + } + ReferencedAsset::Some(asset) => { + let id = asset.chunk_item_id(Vc::upcast(chunking_context)).await?; + let name = ident.as_expr_individual(DUMMY_SP).unwrap_left(); + result.push(CodeGenerationHoistedStmt::new( + id.to_string().into(), + var_decl_with_span( + quote!( + "var $name = $turbopack_import($id);" as Stmt, + name = name, + turbopack_import: Expr = TURBOPACK_IMPORT.into(), + id: Expr = module_id_to_lit(&id), + ), + span, + ), + )); + } + ReferencedAsset::External(request, ExternalType::EcmaScriptModule) => { + if !*chunking_context + .environment() + .supports_esm_externals() + .await? + { + bail!( + "the chunking context ({}) does not support external \ + modules (esm request: {})", + chunking_context.name().await?, + request + ); + } + let name = ident.as_expr_individual(DUMMY_SP).unwrap_left(); + result.push(CodeGenerationHoistedStmt::new( + name.sym.as_str().into(), + var_decl_with_span( + if import_externals { + quote!( + "var $name = $turbopack_external_import($id);" as Stmt, + name = name, + turbopack_external_import: Expr = TURBOPACK_EXTERNAL_IMPORT.into(), + id: Expr = Expr::Lit(request.clone().to_string().into()) + ) + } else { + quote!( + "var $name = $turbopack_external_require($id, () => require($id), true);" as Stmt, + name = name, + turbopack_external_require: Expr = TURBOPACK_EXTERNAL_REQUIRE.into(), + id: Expr = Expr::Lit(request.clone().to_string().into()) + ) + }, + span, + ), + )); + } + ReferencedAsset::External( + request, + ExternalType::CommonJs | ExternalType::Url, + ) => { + if !*chunking_context + .environment() + .supports_commonjs_externals() + .await? + { + bail!( + "the chunking context ({}) does not support external \ + modules (request: {})", + chunking_context.name().await?, + request + ); + } + let name = ident.as_expr_individual(DUMMY_SP).unwrap_left(); + result.push(CodeGenerationHoistedStmt::new( + name.sym.as_str().into(), + var_decl_with_span( + quote!( + "var $name = $turbopack_external_require($id, () => require($id), true);" as Stmt, + name = name, + turbopack_external_require: Expr = TURBOPACK_EXTERNAL_REQUIRE.into(), + id: Expr = Expr::Lit(request.clone().to_string().into()) + ), + span, + ), + )); + } + // fallback in case we introduce a new `ExternalType` + #[allow(unreachable_patterns)] + ReferencedAsset::External(request, ty) => { + bail!( + "Unsupported external type {:?} for ESM reference with \ + request: {:?}", + ty, + request + ) + } + ReferencedAsset::None => {} + }; } - ReferencedAsset::None => None, + return Ok(CodeGeneration::hoisted_stmts(result)); } - } else { - None } - } else { - None }; - if let Some((key, stmt)) = result { - Ok(CodeGeneration::hoisted_stmt(key, stmt)) - } else { - Ok(CodeGeneration::empty()) - } + Ok(CodeGeneration::empty()) } } diff --git a/turbopack/crates/turbopack-ecmascript/src/references/esm/binding.rs b/turbopack/crates/turbopack-ecmascript/src/references/esm/binding.rs index c11187ddfd1b5..733aec38ab9e0 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/esm/binding.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/esm/binding.rs @@ -1,14 +1,8 @@ use anyhow::Result; use serde::{Deserialize, Serialize}; -use swc_core::{ - common::Span, - ecma::{ - ast::{ - ComputedPropName, Expr, Ident, KeyValueProp, Lit, MemberExpr, MemberProp, Number, Prop, - PropName, SeqExpr, SimpleAssignTarget, Str, - }, - visit::fields::{CalleeField, PropField}, - }, +use swc_core::ecma::{ + ast::{Expr, KeyValueProp, Prop, PropName, SimpleAssignTarget}, + visit::fields::{CalleeField, PropField}, }; use turbo_rcstr::RcStr; use turbo_tasks::{NonLocalValue, ResolvedVc, Vc, trace::TraceRawVcs}; @@ -16,9 +10,13 @@ use turbopack_core::{chunk::ChunkingContext, module_graph::ModuleGraph}; use super::EsmAssetReference; use crate::{ + ScopeHoistingContext, code_gen::{CodeGen, CodeGeneration}, create_visitor, - references::{AstPath, esm::base::ReferencedAsset}, + references::{ + AstPath, + esm::base::{ReferencedAsset, ReferencedAssetIdent}, + }, }; #[derive(Hash, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, TraceRawVcs, NonLocalValue)] @@ -45,22 +43,23 @@ impl EsmBinding { &self, _module_graph: Vc, chunking_context: Vc>, + scope_hoisting_context: Option>, ) -> Result { let mut visitors = vec![]; let export = self.export.clone(); - let imported_module = self.reference.get_referenced_asset(); + let imported_module = self.reference.get_referenced_asset().await?; enum ImportedIdent { - Module(String), + Module(ReferencedAssetIdent), None, Unresolvable, } - let imported_ident = match &*imported_module.await? { + let imported_ident = match &*imported_module { ReferencedAsset::None => ImportedIdent::None, imported_module => imported_module - .get_ident(chunking_context) + .get_ident(chunking_context, export, scope_hoisting_context) .await? .map_or(ImportedIdent::Unresolvable, ImportedIdent::Module), }; @@ -80,18 +79,14 @@ impl EsmBinding { ImportedIdent::Module(imported_ident) => { *prop = Prop::KeyValue(KeyValueProp { key: PropName::Ident(ident.clone().into()), - value: Box::new(make_expr( - imported_ident, - export.as_deref(), - ident.span, - false, - )), + value: Box::new(imported_ident.as_expr(ident.span, false)) }); } ImportedIdent::None => { *prop = Prop::KeyValue(KeyValueProp { key: PropName::Ident(ident.clone().into()), - value: Expr::undefined(ident.span), + value: + Expr::undefined(ident.span), }); } ImportedIdent::Unresolvable => { @@ -118,7 +113,7 @@ impl EsmBinding { use swc_core::common::Spanned; match &imported_ident { ImportedIdent::Module(imported_ident) => { - *expr = make_expr(imported_ident, export.as_deref(), expr.span(), in_call); + *expr = imported_ident.as_expr(expr.span(), in_call); } ImportedIdent::None => { *expr = *Expr::undefined(expr.span()); @@ -145,24 +140,27 @@ impl EsmBinding { ast_path.pop(); visitors.push( - create_visitor!(exact ast_path, visit_mut_simple_assign_target(l: &mut SimpleAssignTarget) { - use swc_core::common::Spanned; - match &imported_ident { - ImportedIdent::Module(imported_ident) => { - *l = match make_expr(imported_ident, export.as_deref(), l.span(), false) { - Expr::Ident(ident) => SimpleAssignTarget::Ident(ident.into()), - Expr::Member(member) => SimpleAssignTarget::Member(member), - _ => unreachable!(), - }; - } - ImportedIdent::None => { - // Do nothing, cannot assign to `undefined` - } - ImportedIdent::Unresolvable => { - // Do nothing, the reference will insert a throw + create_visitor!(exact ast_path, visit_mut_simple_assign_target(l: &mut SimpleAssignTarget) { + use swc_core::common::Spanned; + match &imported_ident { + ImportedIdent::Module(imported_ident) => { + *l = imported_ident + .as_expr_individual(l.span()) + .map_either( + |i| SimpleAssignTarget::Ident(i.into()), + SimpleAssignTarget::Member, + ) + .into_inner(); + } + ImportedIdent::None => { + // Do nothing, cannot assign to `undefined` + } + ImportedIdent::Unresolvable => { + // Do nothing, the reference will insert a throw + } } - } - })); + }) + ); break; } } @@ -182,40 +180,3 @@ impl From for CodeGen { CodeGen::EsmBinding(val) } } - -fn make_expr(imported_module: &str, export: Option<&str>, span: Span, in_call: bool) -> Expr { - if let Some(export) = export { - let mut expr = Expr::Member(MemberExpr { - span, - obj: Box::new(Expr::Ident(Ident::new( - imported_module.into(), - span, - Default::default(), - ))), - prop: MemberProp::Computed(ComputedPropName { - span, - expr: Box::new(Expr::Lit(Lit::Str(Str { - span, - value: export.into(), - raw: None, - }))), - }), - }); - if in_call { - expr = Expr::Seq(SeqExpr { - exprs: vec![ - Box::new(Expr::Lit(Lit::Num(Number { - span, - value: 0.0, - raw: None, - }))), - Box::new(expr), - ], - span, - }); - } - expr - } else { - Expr::Ident(Ident::new(imported_module.into(), span, Default::default())) - } -} diff --git a/turbopack/crates/turbopack-ecmascript/src/references/esm/export.rs b/turbopack/crates/turbopack-ecmascript/src/references/esm/export.rs index ffdaa6fe8d929..8222b11c5fb35 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/esm/export.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/esm/export.rs @@ -6,8 +6,8 @@ use serde::{Deserialize, Serialize}; use swc_core::{ common::DUMMY_SP, ecma::ast::{ - AssignTarget, ComputedPropName, Expr, ExprStmt, Ident, KeyValueProp, Lit, MemberExpr, - MemberProp, ObjectLit, Prop, PropName, PropOrSpread, SimpleAssignTarget, Stmt, Str, + AssignTarget, Expr, ExprStmt, Ident, KeyValueProp, ObjectLit, Prop, PropName, PropOrSpread, + SimpleAssignTarget, Stmt, Str, }, quote, quote_expr, }; @@ -18,7 +18,7 @@ use turbo_tasks::{ }; use turbo_tasks_fs::glob::Glob; use turbopack_core::{ - chunk::ChunkingContext, + chunk::{ChunkingContext, ModuleChunkItemIdExt}, ident::AssetIdent, issue::{IssueExt, IssueSeverity, StyledString, analyze::AnalyzeIssue}, module::Module, @@ -28,7 +28,7 @@ use turbopack_core::{ use super::base::ReferencedAsset; use crate::{ - EcmascriptModuleAsset, + EcmascriptModuleAsset, ScopeHoistingContext, chunk::{EcmascriptChunkPlaceable, EcmascriptExports}, code_gen::{CodeGeneration, CodeGenerationHoistedStmt}, magic_identifier, @@ -36,6 +36,7 @@ use crate::{ runtime_functions::{TURBOPACK_DYNAMIC, TURBOPACK_ESM}, simple_tree_shake::ModuleExportUsageInfo, tree_shake::asset::EcmascriptModulePartAsset, + utils::module_id_to_lit, }; #[derive(Clone, Hash, Debug, PartialEq, Eq, Serialize, Deserialize, TraceRawVcs, NonLocalValue)] @@ -556,9 +557,15 @@ impl EsmExports { pub async fn code_generation( self: Vc, chunking_context: Vc>, + scope_hoisting_context: Option>, parsed: Option>, export_usage_info: Option>, ) -> Result { + if scope_hoisting_context.is_some_and(|ctx| !*ctx.modules.get(&ctx.module).unwrap()) { + // If the current module is not exposed, no need to generate exports + return Ok(CodeGeneration::empty()); + } + let expanded = self.expand_exports(export_usage_info.map(|v| *v)).await?; let parsed = if let Some(parsed) = parsed { Some(parsed.await?) @@ -567,40 +574,71 @@ impl EsmExports { }; let mut dynamic_exports = Vec::>::new(); - for dynamic_export_asset in &expanded.dynamic_exports { - let ident = - ReferencedAsset::get_ident_from_placeable(dynamic_export_asset, chunking_context) - .await?; + { + let id = if let Some(scope_hoisting_context) = scope_hoisting_context + && !expanded.dynamic_exports.is_empty() + { + Some( + scope_hoisting_context + .module + .chunk_item_id(Vc::upcast(chunking_context)) + .await?, + ) + } else { + None + }; - dynamic_exports.push(quote_expr!( - "$turbopack_dynamic($arg)", - turbopack_dynamic: Expr = TURBOPACK_DYNAMIC.into(), - arg: Expr = Ident::new(ident.into(), DUMMY_SP, Default::default()).into() - )); + for dynamic_export_asset in &expanded.dynamic_exports { + let ident = ReferencedAsset::get_ident_from_placeable( + dynamic_export_asset, + chunking_context, + ) + .await?; + + if let Some(id) = &id { + dynamic_exports.push(quote_expr!( + "$turbopack_dynamic($arg, $id)", + turbopack_dynamic: Expr = TURBOPACK_DYNAMIC.into(), + arg: Expr = Ident::new(ident.into(), DUMMY_SP, Default::default()).into(), + id: Expr = module_id_to_lit(id) + )); + } else { + dynamic_exports.push(quote_expr!( + "$turbopack_dynamic($arg)", + turbopack_dynamic: Expr = TURBOPACK_DYNAMIC.into(), + arg: Expr = Ident::new(ident.into(), DUMMY_SP, Default::default()).into() + )); + } + } } - let mut props = Vec::new(); + let mut getters = Vec::new(); for (exported, local) in &expanded.exports { let expr = match local { EsmExport::Error => Some(quote!( "(() => { throw new Error(\"Failed binding. See build errors!\"); })" as Expr, )), EsmExport::LocalBinding(name, mutable) => { - let local = if name == "default" { - Cow::Owned(magic_identifier::mangle("default export")) + let (local, ctxt) = if name == "default" { + ( + Cow::Owned(magic_identifier::mangle("default export")), + Default::default(), + ) } else { - Cow::Borrowed(name.as_str()) + ( + Cow::Borrowed(name.as_str()), + parsed + .as_ref() + .and_then(|parsed| { + if let ParseResult::Ok { eval_context, .. } = &**parsed { + eval_context.imports.exports.get(name).map(|id| id.1) + } else { + None + } + }) + .unwrap_or_default(), + ) }; - let ctxt = parsed - .as_ref() - .and_then(|parsed| { - if let ParseResult::Ok { eval_context, .. } = &**parsed { - eval_context.imports.exports.get(name).map(|id| id.1) - } else { - None - } - }) - .unwrap_or_default(); if *mutable { Some(quote!( @@ -618,60 +656,47 @@ impl EsmExports { EsmExport::ImportedBinding(esm_ref, name, mutable) => { let referenced_asset = ReferencedAsset::from_resolve_result(esm_ref.resolve_reference()).await?; - referenced_asset.get_ident( - chunking_context - ).await?.map(|ident| { - let expr = MemberExpr { - span: DUMMY_SP, - obj: Box::new(Expr::Ident(Ident::new( - ident.into(), - DUMMY_SP, - Default::default(), - ))), - prop: MemberProp::Computed(ComputedPropName { - span: DUMMY_SP, - expr: Box::new(Expr::Lit(Lit::Str(Str { - span: DUMMY_SP, - value: (name as &str).into(), - raw: None, - }))), - }), - }; - if *mutable { - quote!( - "([() => $expr, ($new) => $lhs = $new])" as Expr, - expr: Expr = Expr::Member(expr.clone()), - lhs: AssignTarget = AssignTarget::Simple(SimpleAssignTarget::Member(expr)), - new = Ident::new( - format!("new_{name}").into(), - DUMMY_SP, - Default::default() - ), - ) - } else { - quote!( - "(() => $expr)" as Expr, - expr: Expr = Expr::Member(expr), - ) - } - }) + referenced_asset + .get_ident(chunking_context, Some(name.clone()), scope_hoisting_context) + .await? + .map(|ident| { + let expr = ident.as_expr_individual(DUMMY_SP); + if *mutable { + quote!( + "([() => $expr, ($new) => $lhs = $new])" as Expr, + expr: Expr = expr.clone().map_either(Expr::from, Expr::from).into_inner(), + lhs: AssignTarget = AssignTarget::Simple( + expr.map_either(|i| SimpleAssignTarget::Ident(i.into()), SimpleAssignTarget::Member).into_inner()), + new = Ident::new( + format!("new_{name}").into(), + DUMMY_SP, + Default::default() + ), + ) + } else { + quote!( + "(() => $expr)" as Expr, + expr: Expr = expr.map_either(Expr::from, Expr::from).into_inner() + ) + } + }) } EsmExport::ImportedNamespace(esm_ref) => { let referenced_asset = ReferencedAsset::from_resolve_result(esm_ref.resolve_reference()).await?; referenced_asset - .get_ident(chunking_context) + .get_ident(chunking_context, None, scope_hoisting_context) .await? .map(|ident| { quote!( "(() => $imported)" as Expr, - imported = Ident::new(ident.into(), DUMMY_SP, Default::default()) + imported: Expr = ident.as_expr(DUMMY_SP, false) ) }) } }; if let Some(expr) = expr { - props.push(PropOrSpread::Prop(Box::new(Prop::KeyValue(KeyValueProp { + getters.push(PropOrSpread::Prop(Box::new(Prop::KeyValue(KeyValueProp { key: PropName::Str(Str { span: DUMMY_SP, value: exported.as_str().into(), @@ -683,7 +708,7 @@ impl EsmExports { } let getters = Expr::Object(ObjectLit { span: DUMMY_SP, - props, + props: getters, }); let dynamic_stmt = if !dynamic_exports.is_empty() { Some(Stmt::Expr(ExprStmt { @@ -694,6 +719,26 @@ impl EsmExports { None }; + let early_hoisted_stmts = vec![CodeGenerationHoistedStmt::new( + "__turbopack_esm__".into(), + if let Some(scope_hoisting_context) = scope_hoisting_context { + let id = scope_hoisting_context + .module + .chunk_item_id(Vc::upcast(chunking_context)) + .await?; + quote!("$turbopack_esm($getters, $id);" as Stmt, + turbopack_esm: Expr = TURBOPACK_ESM.into(), + getters: Expr = getters, + id: Expr = module_id_to_lit(&id) + ) + } else { + quote!("$turbopack_esm($getters);" as Stmt, + turbopack_esm: Expr = TURBOPACK_ESM.into(), + getters: Expr = getters + ) + }, + )]; + Ok(CodeGeneration::new( vec![], [dynamic_stmt @@ -701,13 +746,7 @@ impl EsmExports { .into_iter() .flatten() .collect(), - vec![CodeGenerationHoistedStmt::new( - "__turbopack_esm__".into(), - quote!("$turbopack_esm($getters);" as Stmt, - turbopack_esm: Expr = TURBOPACK_ESM.into(), - getters: Expr = getters - ), - )], + early_hoisted_stmts, )) } } diff --git a/turbopack/crates/turbopack-ecmascript/src/references/external_module.rs b/turbopack/crates/turbopack-ecmascript/src/references/external_module.rs index b5430179c1a26..8338978e62d94 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/external_module.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/external_module.rs @@ -2,6 +2,7 @@ use std::{fmt::Display, io::Write}; use anyhow::Result; use serde::{Deserialize, Serialize}; +use smallvec::SmallVec; use turbo_rcstr::RcStr; use turbo_tasks::{NonLocalValue, ResolvedVc, TaskInput, Vc, trace::TraceRawVcs}; use turbo_tasks_fs::{FileContent, FileSystem, VirtualFileSystem, glob::Glob, rope::RopeBuilder}; @@ -114,6 +115,7 @@ impl CachedExternalModule { inner_code: code.build(), source_map: None, is_esm: self.external_type != CachedExternalType::CommonJs, + additional_ids: SmallVec::new(), } .cell()) } diff --git a/turbopack/crates/turbopack-ecmascript/src/references/mod.rs b/turbopack/crates/turbopack-ecmascript/src/references/mod.rs index 07da584617782..a1c89c06ddf4f 100644 --- a/turbopack/crates/turbopack-ecmascript/src/references/mod.rs +++ b/turbopack/crates/turbopack-ecmascript/src/references/mod.rs @@ -760,7 +760,7 @@ pub(crate) async fn analyse_ecmascript_module_internal( ImportedSymbol::Part(part_id) => Some(ModulePart::internal(*part_id)), ImportedSymbol::Exports => Some(ModulePart::exports()), }, - Some(TreeShakingMode::ReexportsOnly) => match &r.imported_symbol { + _ => match &r.imported_symbol { ImportedSymbol::ModuleEvaluation => { should_add_evaluation = true; Some(ModulePart::evaluation()) @@ -776,10 +776,6 @@ pub(crate) async fn analyse_ecmascript_module_internal( } ImportedSymbol::Exports => None, }, - None => { - should_add_evaluation = true; - None - } }, import_externals, ) diff --git a/turbopack/crates/turbopack-ecmascript/src/side_effect_optimization/reference.rs b/turbopack/crates/turbopack-ecmascript/src/side_effect_optimization/reference.rs index d09394f28385f..aa0a54ed480e0 100644 --- a/turbopack/crates/turbopack-ecmascript/src/side_effect_optimization/reference.rs +++ b/turbopack/crates/turbopack-ecmascript/src/side_effect_optimization/reference.rs @@ -1,5 +1,5 @@ use anyhow::{Context, Result, bail}; -use swc_core::{common::DUMMY_SP, ecma::ast::Ident, quote}; +use swc_core::{common::DUMMY_SP, quote}; use turbo_rcstr::RcStr; use turbo_tasks::{ResolvedVc, ValueToString, Vc}; use turbopack_core::{ @@ -138,9 +138,11 @@ impl EcmascriptModulePartReference { let referenced_asset = ReferencedAsset::from_resolve_result(self.resolve_reference()); let referenced_asset = referenced_asset.await?; let ident = referenced_asset - .get_ident(chunking_context) + .get_ident(chunking_context, None, None) .await? - .context("part module reference should have an ident")?; + .context("part module reference should have an ident")? + .as_expr_individual(DUMMY_SP) + .unwrap_left(); let ReferencedAsset::Some(module) = *referenced_asset else { bail!("part module reference should have an module reference"); @@ -148,10 +150,10 @@ impl EcmascriptModulePartReference { let id = module.chunk_item_id(Vc::upcast(chunking_context)).await?; Ok(CodeGeneration::hoisted_stmt( - ident.clone().into(), + ident.sym.as_str().into(), quote!( "var $name = $turbopack_import($id);" as Stmt, - name = Ident::new(ident.clone().into(), DUMMY_SP, Default::default()), + name = ident, turbopack_import: Expr = TURBOPACK_IMPORT.into(), id: Expr = module_id_to_lit(&id), ), diff --git a/turbopack/crates/turbopack-ecmascript/src/tree_shake/chunk_item.rs b/turbopack/crates/turbopack-ecmascript/src/tree_shake/chunk_item.rs index 9576997c12095..c751b13e356d0 100644 --- a/turbopack/crates/turbopack-ecmascript/src/tree_shake/chunk_item.rs +++ b/turbopack/crates/turbopack-ecmascript/src/tree_shake/chunk_item.rs @@ -183,6 +183,7 @@ impl EcmascriptChunkItem for SideEffectsModuleChunkItem { }, ..Default::default() }, + additional_ids: Default::default(), placeholder_for_future_extensions: (), } .cell()) diff --git a/turbopack/crates/turbopack-nodejs/src/chunking_context.rs b/turbopack/crates/turbopack-nodejs/src/chunking_context.rs index 2b65b9945392e..ce2ccbf0292b9 100644 --- a/turbopack/crates/turbopack-nodejs/src/chunking_context.rs +++ b/turbopack/crates/turbopack-nodejs/src/chunking_context.rs @@ -56,6 +56,11 @@ impl NodeJsChunkingContextBuilder { self } + pub fn module_merging(mut self, enable_module_merging: bool) -> Self { + self.chunking_context.enable_module_merging = enable_module_merging; + self + } + pub fn runtime_type(mut self, runtime_type: RuntimeType) -> Self { self.chunking_context.runtime_type = runtime_type; self @@ -119,6 +124,8 @@ pub struct NodeJsChunkingContext { runtime_type: RuntimeType, /// Enable tracing for this chunking enable_file_tracing: bool, + /// Enable module merging + enable_module_merging: bool, /// Whether to minify resulting chunks minify_type: MinifyType, /// Whether to generate source maps @@ -155,6 +162,7 @@ impl NodeJsChunkingContext { asset_root_path, asset_prefix: ResolvedVc::cell(None), enable_file_tracing: false, + enable_module_merging: false, environment, runtime_type, minify_type: MinifyType::NoMinify, @@ -248,6 +256,11 @@ impl ChunkingContext for NodeJsChunkingContext { Vc::cell(self.enable_file_tracing) } + #[turbo_tasks::function] + fn is_module_merging_enabled(&self) -> Vc { + Vc::cell(self.enable_module_merging) + } + #[turbo_tasks::function] pub fn minify_type(&self) -> Vc { self.minify_type.cell() diff --git a/turbopack/crates/turbopack-tests/tests/execution.rs b/turbopack/crates/turbopack-tests/tests/execution.rs index e6cc649c5013d..4dcba18bc429b 100644 --- a/turbopack/crates/turbopack-tests/tests/execution.rs +++ b/turbopack/crates/turbopack-tests/tests/execution.rs @@ -435,6 +435,7 @@ async fn run_test_operation(prepared_test: ResolvedVc) -> Resultdog, (new_dog)=>dog = new_dog -]) +] }); let dog = 'dog'; ; @@ -50,19 +50,19 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ "use strict"; __turbopack_context__.s({ -"b": ([ +"b": [ ()=>getDog, (new_getDog)=>getDog = new_getDog -]), -"c": ([ +], +"c": [ ()=>setDog, (new_setDog)=>setDog = new_setDog -]), -"d": ([ +], +"d": [ ()=>dogRef, (new_dogRef)=>dogRef = new_dogRef -]), -"dogRef": (()=>dogRef) +], +"dogRef": ()=>dogRef }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); @@ -88,10 +88,10 @@ set: setDog "use strict"; __turbopack_context__.s({ -"e": ([ +"e": [ ()=>cat, (new_cat)=>cat = new_cat -]) +] }); let cat = 'cat'; ; @@ -100,11 +100,11 @@ let cat = 'cat'; "use strict"; __turbopack_context__.s({ -"f": ([ +"f": [ ()=>initialCat, (new_initialCat)=>initialCat = new_initialCat -]), -"initialCat": (()=>initialCat) +], +"initialCat": ()=>initialCat }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); ; @@ -116,11 +116,11 @@ const initialCat = __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$ "use strict"; __turbopack_context__.s({ -"g": ([ +"g": [ ()=>getChimera, (new_getChimera)=>getChimera = new_getChimera -]), -"getChimera": (()=>getChimera) +], +"getChimera": ()=>getChimera }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); @@ -138,7 +138,7 @@ return __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$tu "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); ; @@ -148,10 +148,10 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__["cat"]), -"dogRef": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__["dogRef"]), -"getChimera": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__7$3e$__["getChimera"]), -"initialCat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__["initialCat"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__["cat"], +"dogRef": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__["dogRef"], +"getChimera": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__7$3e$__["getChimera"], +"initialCat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__["initialCat"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); @@ -166,10 +166,10 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["cat"]), -"dogRef": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["dogRef"]), -"getChimera": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["getChimera"]), -"initialCat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["initialCat"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["cat"], +"dogRef": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["dogRef"], +"getChimera": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["getChimera"], +"initialCat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["initialCat"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__2$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) "); diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_export-named_input_058a40bc._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_export-named_input_058a40bc._.js index a3c61365c95c4..7a6bc87af58bc 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_export-named_input_058a40bc._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_export-named_input_058a40bc._.js @@ -4,10 +4,10 @@ "use strict"; __turbopack_context__.s({ -"a": ([ +"a": [ ()=>dog, (new_dog)=>dog = new_dog -]) +] }); let dog = 'dog'; ; @@ -50,10 +50,10 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ "use strict"; __turbopack_context__.s({ -"e": ([ +"e": [ ()=>cat, (new_cat)=>cat = new_cat -]) +] }); let cat = 'cat'; ; @@ -62,7 +62,7 @@ let cat = 'cat'; "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/input/lib.js [test] (ecmascript) "); ; @@ -72,11 +72,11 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo "use strict"; __turbopack_context__.s({ -"a": ([ +"a": [ ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__["cat"], (new_cat)=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__["cat"] = new_cat -]), -"fakeCat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__["cat"]) +], +"fakeCat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__["cat"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__2$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-named/input/lib.js [test] (ecmascript) "); diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_f7fde6f3._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_f7fde6f3._.js index bfcf6475befff..41c6f125dacb9 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_f7fde6f3._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_export-namespace_input_f7fde6f3._.js @@ -4,10 +4,10 @@ "use strict"; __turbopack_context__.s({ -"a": ([ +"a": [ ()=>dog, (new_dog)=>dog = new_dog -]) +] }); let dog = 'dog'; ; @@ -50,19 +50,19 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ "use strict"; __turbopack_context__.s({ -"b": ([ +"b": [ ()=>getDog, (new_getDog)=>getDog = new_getDog -]), -"c": ([ +], +"c": [ ()=>setDog, (new_setDog)=>setDog = new_setDog -]), -"d": ([ +], +"d": [ ()=>dogRef, (new_dogRef)=>dogRef = new_dogRef -]), -"dogRef": (()=>dogRef) +], +"dogRef": ()=>dogRef }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); @@ -88,10 +88,10 @@ set: setDog "use strict"; __turbopack_context__.s({ -"e": ([ +"e": [ ()=>cat, (new_cat)=>cat = new_cat -]) +] }); let cat = 'cat'; ; @@ -100,11 +100,11 @@ let cat = 'cat'; "use strict"; __turbopack_context__.s({ -"f": ([ +"f": [ ()=>initialCat, (new_initialCat)=>initialCat = new_initialCat -]), -"initialCat": (()=>initialCat) +], +"initialCat": ()=>initialCat }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); ; @@ -116,11 +116,11 @@ const initialCat = __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$ "use strict"; __turbopack_context__.s({ -"g": ([ +"g": [ ()=>getChimera, (new_getChimera)=>getChimera = new_getChimera -]), -"getChimera": (()=>getChimera) +], +"getChimera": ()=>getChimera }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); @@ -138,7 +138,7 @@ return __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$tu "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); ; @@ -148,10 +148,10 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__["cat"]), -"dogRef": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__["dogRef"]), -"getChimera": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__7$3e$__["getChimera"]), -"initialCat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__["initialCat"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__["cat"], +"dogRef": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__["dogRef"], +"getChimera": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__7$3e$__["getChimera"], +"initialCat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__["initialCat"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); @@ -166,8 +166,8 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo "use strict"; __turbopack_context__.s({ -"a": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__), -"lib": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__) +"a": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__, +"lib": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__ }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__2$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$export$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/export-namespace/input/lib.js [test] (ecmascript) "); diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_import-named-all_input_00b867a0._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_import-named-all_input_00b867a0._.js index 8eceab1c12a6e..288dc01e40cf4 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_import-named-all_input_00b867a0._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_import-named-all_input_00b867a0._.js @@ -4,10 +4,10 @@ "use strict"; __turbopack_context__.s({ -"a": ([ +"a": [ ()=>dog, (new_dog)=>dog = new_dog -]) +] }); let dog = 'dog'; ; @@ -50,10 +50,10 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ "use strict"; __turbopack_context__.s({ -"e": ([ +"e": [ ()=>cat, (new_cat)=>cat = new_cat -]) +] }); let cat = 'cat'; ; @@ -62,7 +62,7 @@ let cat = 'cat'; "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$named$2d$all$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$named$2d$all$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$named$2d$all$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named-all/input/lib.js [test] (ecmascript) "); ; diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_import-named_input_f64e7412._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_import-named_input_f64e7412._.js index c17bfc069c556..9ba58ea4d95f7 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_import-named_input_f64e7412._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_import-named_input_f64e7412._.js @@ -4,10 +4,10 @@ "use strict"; __turbopack_context__.s({ -"a": ([ +"a": [ ()=>dog, (new_dog)=>dog = new_dog -]) +] }); let dog = 'dog'; ; @@ -50,10 +50,10 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ "use strict"; __turbopack_context__.s({ -"e": ([ +"e": [ ()=>cat, (new_cat)=>cat = new_cat -]) +] }); let cat = 'cat'; ; @@ -62,7 +62,7 @@ let cat = 'cat'; "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$named$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-named/input/lib.js [test] (ecmascript) "); ; diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_25e69485._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_25e69485._.js index c05cc7493d23d..1b72f66a6669f 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_25e69485._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/output/b1abf_turbopack-tests_tests_snapshot_basic-tree-shake_import-namespace_input_25e69485._.js @@ -4,10 +4,10 @@ "use strict"; __turbopack_context__.s({ -"a": ([ +"a": [ ()=>dog, (new_dog)=>dog = new_dog -]) +] }); let dog = 'dog'; ; @@ -50,19 +50,19 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ "use strict"; __turbopack_context__.s({ -"b": ([ +"b": [ ()=>getDog, (new_getDog)=>getDog = new_getDog -]), -"c": ([ +], +"c": [ ()=>setDog, (new_setDog)=>setDog = new_setDog -]), -"d": ([ +], +"d": [ ()=>dogRef, (new_dogRef)=>dogRef = new_dogRef -]), -"dogRef": (()=>dogRef) +], +"dogRef": ()=>dogRef }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); @@ -88,10 +88,10 @@ set: setDog "use strict"; __turbopack_context__.s({ -"e": ([ +"e": [ ()=>cat, (new_cat)=>cat = new_cat -]) +] }); let cat = 'cat'; ; @@ -100,11 +100,11 @@ let cat = 'cat'; "use strict"; __turbopack_context__.s({ -"f": ([ +"f": [ ()=>initialCat, (new_initialCat)=>initialCat = new_initialCat -]), -"initialCat": (()=>initialCat) +], +"initialCat": ()=>initialCat }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); ; @@ -116,11 +116,11 @@ const initialCat = __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$ "use strict"; __turbopack_context__.s({ -"g": ([ +"g": [ ()=>getChimera, (new_getChimera)=>getChimera = new_getChimera -]), -"getChimera": (()=>getChimera) +], +"getChimera": ()=>getChimera }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); @@ -138,7 +138,7 @@ return __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$tu "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); ; @@ -148,10 +148,10 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__["cat"]), -"dogRef": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__["dogRef"]), -"getChimera": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__7$3e$__["getChimera"]), -"initialCat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__["initialCat"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__["cat"], +"dogRef": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__["dogRef"], +"getChimera": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__7$3e$__["getChimera"], +"initialCat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__["initialCat"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$import$2d$namespace$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-namespace/input/lib.js [test] (ecmascript) "); diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-side-effect/output/4c35f_tests_snapshot_basic-tree-shake_import-side-effect_input_e082b9f6._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-side-effect/output/4c35f_tests_snapshot_basic-tree-shake_import-side-effect_input_e082b9f6._.js index 2dbdd1db5ed5a..d419e6e1d1dfd 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-side-effect/output/4c35f_tests_snapshot_basic-tree-shake_import-side-effect_input_e082b9f6._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/import-side-effect/output/4c35f_tests_snapshot_basic-tree-shake_import-side-effect_input_e082b9f6._.js @@ -4,10 +4,10 @@ "use strict"; __turbopack_context__.s({ -"a": ([ +"a": [ ()=>dog, (new_dog)=>dog = new_dog -]) +] }); let dog = 'dog'; ; diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/4c35f_tests_snapshot_basic-tree-shake_require-side-effect_input_f83a22d6._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/4c35f_tests_snapshot_basic-tree-shake_require-side-effect_input_f83a22d6._.js index cd27a376ebf9f..0543afd8b5fa3 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/4c35f_tests_snapshot_basic-tree-shake_require-side-effect_input_f83a22d6._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/4c35f_tests_snapshot_basic-tree-shake_require-side-effect_input_f83a22d6._.js @@ -4,10 +4,10 @@ "use strict"; __turbopack_context__.s({ -"a": ([ +"a": [ ()=>dog, (new_dog)=>dog = new_dog -]) +] }); let dog = 'dog'; ; @@ -50,19 +50,19 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ "use strict"; __turbopack_context__.s({ -"b": ([ +"b": [ ()=>getDog, (new_getDog)=>getDog = new_getDog -]), -"c": ([ +], +"c": [ ()=>setDog, (new_setDog)=>setDog = new_setDog -]), -"d": ([ +], +"d": [ ()=>dogRef, (new_dogRef)=>dogRef = new_dogRef -]), -"dogRef": (()=>dogRef) +], +"dogRef": ()=>dogRef }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); @@ -88,10 +88,10 @@ set: setDog "use strict"; __turbopack_context__.s({ -"e": ([ +"e": [ ()=>cat, (new_cat)=>cat = new_cat -]) +] }); let cat = 'cat'; ; @@ -100,11 +100,11 @@ let cat = 'cat'; "use strict"; __turbopack_context__.s({ -"f": ([ +"f": [ ()=>initialCat, (new_initialCat)=>initialCat = new_initialCat -]), -"initialCat": (()=>initialCat) +], +"initialCat": ()=>initialCat }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); ; @@ -116,11 +116,11 @@ const initialCat = __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$ "use strict"; __turbopack_context__.s({ -"g": ([ +"g": [ ()=>getChimera, (new_getChimera)=>getChimera = new_getChimera -]), -"getChimera": (()=>getChimera) +], +"getChimera": ()=>getChimera }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); @@ -138,7 +138,7 @@ return __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$tu "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); ; @@ -148,10 +148,10 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__["cat"]), -"dogRef": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__["dogRef"]), -"getChimera": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__7$3e$__["getChimera"]), -"initialCat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__["initialCat"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__["cat"], +"dogRef": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__["dogRef"], +"getChimera": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__7$3e$__["getChimera"], +"initialCat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__["initialCat"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); @@ -166,10 +166,10 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["cat"]), -"dogRef": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["dogRef"]), -"getChimera": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["getChimera"]), -"initialCat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["initialCat"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["cat"], +"dogRef": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["dogRef"], +"getChimera": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["getChimera"], +"initialCat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["initialCat"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__2$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) "); diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/output/4c35f_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_09a16221.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/output/4c35f_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_09a16221.js index 4734be5eeab41..b7972db466582 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/output/4c35f_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_09a16221.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/output/4c35f_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_09a16221.js @@ -4,10 +4,10 @@ "use strict"; __turbopack_context__.s({ -"a": ([ +"a": [ ()=>dog, (new_dog)=>dog = new_dog -]) +] }); let dog = 'dog'; ; @@ -50,19 +50,19 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ "use strict"; __turbopack_context__.s({ -"b": ([ +"b": [ ()=>getDog, (new_getDog)=>getDog = new_getDog -]), -"c": ([ +], +"c": [ ()=>setDog, (new_setDog)=>setDog = new_setDog -]), -"d": ([ +], +"d": [ ()=>dogRef, (new_dogRef)=>dogRef = new_dogRef -]), -"dogRef": (()=>dogRef) +], +"dogRef": ()=>dogRef }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__4$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) "); @@ -88,10 +88,10 @@ set: setDog "use strict"; __turbopack_context__.s({ -"e": ([ +"e": [ ()=>cat, (new_cat)=>cat = new_cat -]) +] }); let cat = 'cat'; ; @@ -100,11 +100,11 @@ let cat = 'cat'; "use strict"; __turbopack_context__.s({ -"f": ([ +"f": [ ()=>initialCat, (new_initialCat)=>initialCat = new_initialCat -]), -"initialCat": (()=>initialCat) +], +"initialCat": ()=>initialCat }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) "); ; @@ -116,11 +116,11 @@ const initialCat = __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$ "use strict"; __turbopack_context__.s({ -"g": ([ +"g": [ ()=>getChimera, (new_getChimera)=>getChimera = new_getChimera -]), -"getChimera": (()=>getChimera) +], +"getChimera": ()=>getChimera }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__0$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) "); @@ -138,7 +138,7 @@ return __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$tu "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__["e"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__5$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) "); ; @@ -148,10 +148,10 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__["cat"]), -"dogRef": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__["dogRef"]), -"getChimera": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__7$3e$__["getChimera"]), -"initialCat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__["initialCat"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__8$3e$__["cat"], +"dogRef": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__["dogRef"], +"getChimera": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__7$3e$__["getChimera"], +"initialCat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__["initialCat"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__3$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__6$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) "); @@ -166,10 +166,10 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo "use strict"; __turbopack_context__.s({ -"cat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["cat"]), -"dogRef": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["dogRef"]), -"getChimera": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["getChimera"]), -"initialCat": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["initialCat"]) +"cat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["cat"], +"dogRef": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["dogRef"], +"getChimera": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["getChimera"], +"initialCat": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__["initialCat"] }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__2$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) "); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$exports$3e$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) "); diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_46366300._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_46366300._.js index cb2d77dc7fba3..70cab41e9b1bb 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_46366300._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_46366300._.js @@ -23,7 +23,7 @@ foo(true); "use strict"; __turbopack_context__.s({ -"bar": (()=>bar) +"bar": ()=>bar }); function bar(value) { console.assert(value); diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_b274c771._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_b274c771._.js index 8c08c0c04683e..7ee83e132e929 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_b274c771._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_b274c771._.js @@ -17,7 +17,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo "use strict"; __turbopack_context__.s({ -"foo": (()=>foo) +"foo": ()=>foo }); function foo(value) { console.assert(value); diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk_build/output/4e721_crates_turbopack-tests_tests_snapshot_basic_async_chunk_build_input_1e41378a._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk_build/output/4e721_crates_turbopack-tests_tests_snapshot_basic_async_chunk_build_input_1e41378a._.js index 17fc50f3748c2..29a6296d70f5b 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk_build/output/4e721_crates_turbopack-tests_tests_snapshot_basic_async_chunk_build_input_1e41378a._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk_build/output/4e721_crates_turbopack-tests_tests_snapshot_basic_async_chunk_build_input_1e41378a._.js @@ -23,7 +23,7 @@ foo(true); "use strict"; __turbopack_context__.s({ -"bar": (()=>bar) +"bar": ()=>bar }); function bar(value) { console.assert(value); diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk_build/output/4e721_crates_turbopack-tests_tests_snapshot_basic_async_chunk_build_input_23e8ba79._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk_build/output/4e721_crates_turbopack-tests_tests_snapshot_basic_async_chunk_build_input_23e8ba79._.js index bbd186c95f118..af36b1ae9ff13 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk_build/output/4e721_crates_turbopack-tests_tests_snapshot_basic_async_chunk_build_input_23e8ba79._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/async_chunk_build/output/4e721_crates_turbopack-tests_tests_snapshot_basic_async_chunk_build_input_23e8ba79._.js @@ -17,7 +17,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo "use strict"; __turbopack_context__.s({ -"foo": (()=>foo) +"foo": ()=>foo }); function foo(value) { console.assert(value); diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/chunked/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_chunked_input_1efdaca0._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/chunked/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_chunked_input_1efdaca0._.js index 218b055b3fc7d..dfd35e84f6847 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/chunked/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_chunked_input_1efdaca0._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/chunked/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_chunked_input_1efdaca0._.js @@ -12,7 +12,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo "use strict"; __turbopack_context__.s({ -"foo": (()=>foo) +"foo": ()=>foo }); function foo(value) { console.assert(value); diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/shebang/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_shebang_input_d5e8dcd4._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/shebang/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_shebang_input_d5e8dcd4._.js index c38498df99a25..ca24ee7f8454d 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/shebang/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_shebang_input_d5e8dcd4._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/shebang/output/turbopack_crates_turbopack-tests_tests_snapshot_basic_shebang_input_d5e8dcd4._.js @@ -12,7 +12,7 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo "use strict"; __turbopack_context__.s({ -"foo": (()=>foo) +"foo": ()=>foo }); function foo(value) { console.assert(value); diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/4e721_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_9acd43f4._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/4e721_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_9acd43f4._.js index fd6ba76df9081..a6527d039f2d3 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/4e721_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_9acd43f4._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/4e721_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_9acd43f4._.js @@ -5,8 +5,8 @@ // import() doesn't care about whether a module is an async module or not __turbopack_context__.s({ -"AlternativeCreateUserAction": (()=>AlternativeCreateUserAction), -"CreateUserAction": (()=>CreateUserAction) +"AlternativeCreateUserAction": ()=>AlternativeCreateUserAction, +"CreateUserAction": ()=>CreateUserAction }); const UserApi = __turbopack_context__.r("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/input/UserAPI.js [test] (ecmascript, async loader)")(__turbopack_context__.i); const CreateUserAction = async (name)=>{ diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/4e721_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_aa0a0c39._.js b/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/4e721_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_aa0a0c39._.js index bd36c5c012830..45fced03e7f26 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/4e721_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_aa0a0c39._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/output/4e721_crates_turbopack-tests_tests_snapshot_basic_top-level-await_input_aa0a0c39._.js @@ -6,8 +6,8 @@ var { a: __turbopack_async_module__ } = __turbopack_context__; __turbopack_async_module__(async (__turbopack_handle_async_dependencies__, __turbopack_async_result__) => { try { __turbopack_context__.s({ -"close": (()=>close), -"dbCall": (()=>dbCall) +"close": ()=>close, +"dbCall": ()=>dbCall }); const connectToDB = async (url)=>{ console.log('connecting to db', url); @@ -32,13 +32,13 @@ __turbopack_async_result__(); var { a: __turbopack_async_module__ } = __turbopack_context__; __turbopack_async_module__(async (__turbopack_handle_async_dependencies__, __turbopack_async_result__) => { try { __turbopack_context__.s({ -"createUser": (()=>createUser) +"createUser": ()=>createUser }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$top$2d$level$2d$await$2f$input$2f$db$2d$connection$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/input/db-connection.js [test] (ecmascript)"); var __turbopack_async_dependencies__ = __turbopack_handle_async_dependencies__([ __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$top$2d$level$2d$await$2f$input$2f$db$2d$connection$2e$js__$5b$test$5d$__$28$ecmascript$29$__ ]); -([__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$top$2d$level$2d$await$2f$input$2f$db$2d$connection$2e$js__$5b$test$5d$__$28$ecmascript$29$__] = __turbopack_async_dependencies__.then ? (await __turbopack_async_dependencies__)() : __turbopack_async_dependencies__); +[__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2f$top$2d$level$2d$await$2f$input$2f$db$2d$connection$2e$js__$5b$test$5d$__$28$ecmascript$29$__] = __turbopack_async_dependencies__.then ? (await __turbopack_async_dependencies__)() : __turbopack_async_dependencies__; ; const createUser = async (name)=>{ const command = `CREATE USER ${name}`; diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/early-return/output/4e721_crates_turbopack-tests_tests_snapshot_comptime_early-return_input_82bbae08._.js b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/early-return/output/4e721_crates_turbopack-tests_tests_snapshot_comptime_early-return_input_82bbae08._.js index 9277e570f439d..0d00f9ccef5f0 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/comptime/early-return/output/4e721_crates_turbopack-tests_tests_snapshot_comptime_early-return_input_82bbae08._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/comptime/early-return/output/4e721_crates_turbopack-tests_tests_snapshot_comptime_early-return_input_82bbae08._.js @@ -4,16 +4,16 @@ "use strict"; __turbopack_context__.s({ -"a": (()=>a), -"b": (()=>b), -"c": (()=>c), -"d": (()=>d), -"e": (()=>e), -"f": (()=>f), -"g": (()=>g), -"h": (()=>h), -"i": (()=>i), -"j": (()=>j) +"a": ()=>a, +"b": ()=>b, +"c": ()=>c, +"d": ()=>d, +"e": ()=>e, +"f": ()=>f, +"g": ()=>g, +"h": ()=>h, +"i": ()=>i, +"j": ()=>j }); function a() { if ("TURBOPACK compile-time truthy", 1) { diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/turbopack_crates_turbopack-tests_tests_snapshot_6fdc60d8._.js b/turbopack/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/turbopack_crates_turbopack-tests_tests_snapshot_6fdc60d8._.js index ebc96fa57d9ae..d9dc657abd579 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/turbopack_crates_turbopack-tests_tests_snapshot_6fdc60d8._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/turbopack_crates_turbopack-tests_tests_snapshot_6fdc60d8._.js @@ -27,20 +27,26 @@ columnNumber: 5 } console.log(StyledButton, ClassNameButton); }), -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/jsx-dev-runtime.js [test] (ecmascript)": (function(__turbopack_context__) { +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/jsx-dev-runtime.js [test] (ecmascript)": ((__turbopack_context__) => { +"use strict"; -var { m: module, e: exports } = __turbopack_context__; -{ -"purposefully empty stub"; -"@emtion/react/jsx-dev-runtime.js"; -}}), -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/index.js [test] (ecmascript)": (function(__turbopack_context__) { +__turbopack_context__.s({ +"jsxDEV": ()=>jsxDEV +}); +function jsxDEV() { +return 'purposefully empty stub for @emotion/react/jsx-dev-runtime.js'; +} +}), +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/index.js [test] (ecmascript)": ((__turbopack_context__) => { +"use strict"; -var { m: module, e: exports } = __turbopack_context__; -{ -"purposefully empty stub"; -"@emtion/react/index.js"; -}}), +__turbopack_context__.s({ +"jsx": ()=>jsx +}); +function jsx() { +return 'purposefully empty stub for @emotion/react/index.js'; +} +}), "[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/styled/index.js [test] (ecmascript)": (function(__turbopack_context__) { var { m: module, e: exports } = __turbopack_context__; diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/turbopack_crates_turbopack-tests_tests_snapshot_6fdc60d8._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/turbopack_crates_turbopack-tests_tests_snapshot_6fdc60d8._.js.map index 0a3189981c08b..890fc490a1139 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/turbopack_crates_turbopack-tests_tests_snapshot_6fdc60d8._.js.map +++ b/turbopack/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/turbopack_crates_turbopack-tests_tests_snapshot_6fdc60d8._.js.map @@ -3,7 +3,7 @@ "sources": [], "sections": [ {"offset": {"line": 5, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/emotion/emotion/input/index.js"],"sourcesContent":["/** @jsxImportSource @emotion/react */\n\nimport { jsx } from '@emotion/react'\nimport styled from '@emotion/styled'\n\nconst StyledButton = styled.button`\n background: blue;\n`\n\nfunction ClassNameButton({ children }) {\n return (\n \n {children}\n \n )\n}\n\nconsole.log(StyledButton, ClassNameButton)\n"],"names":[],"mappings":"AAAA,oCAAoC;;AAEpC;AACA;;;;AAEA,MAAM,6BAAe,CAAA,GAAA,wMAAA,CAAA,UAAM,AAAD;;;AAI1B,SAAS,gBAAgB,EAAE,QAAQ,EAAE;AACnC,qBACE,uOAAC;AACC,WAAW,GAAG,CAAC;;MAEf,CAAC;UAEA;;;;;;AAGP;AAEA,QAAQ,GAAG,CAAC,cAAc"}}, - {"offset": {"line": 33, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/jsx-dev-runtime.js"],"sourcesContent":["\"purposefully empty stub\";\n\"@emtion/react/jsx-dev-runtime.js\";\n"],"names":[],"mappings":"AAAA;AACA","ignoreList":[0]}}, - {"offset": {"line": 40, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/index.js"],"sourcesContent":["\"purposefully empty stub\";\n\"@emtion/react/index.js\";\n"],"names":[],"mappings":"AAAA;AACA","ignoreList":[0]}}, - {"offset": {"line": 47, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/styled/index.js"],"sourcesContent":["\"purposefully empty stub\";\n\"@emtion/styled/index.js\";\n"],"names":[],"mappings":"AAAA;AACA","ignoreList":[0]}}] + {"offset": {"line": 32, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/jsx-dev-runtime.js"],"sourcesContent":["export function jsxDEV() {\n return 'purposefully empty stub for @emotion/react/jsx-dev-runtime.js'\n}\n"],"names":[],"mappings":";;;AAAO,SAAS;AACd,OAAO;AACT","ignoreList":[0]}}, + {"offset": {"line": 42, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/index.js"],"sourcesContent":["export function jsx() {\n return 'purposefully empty stub for @emotion/react/index.js'\n}\n"],"names":[],"mappings":";;;AAAO,SAAS;AACd,OAAO;AACT","ignoreList":[0]}}, + {"offset": {"line": 53, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/styled/index.js"],"sourcesContent":["\"purposefully empty stub\";\n\"@emtion/styled/index.js\";\n"],"names":[],"mappings":"AAAA;AACA","ignoreList":[0]}}] } \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/duplicate-binding/output/4e721_crates_turbopack-tests_tests_snapshot_imports_duplicate-binding_input_8498b7ee._.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/duplicate-binding/output/4e721_crates_turbopack-tests_tests_snapshot_imports_duplicate-binding_input_8498b7ee._.js index d2b65f3a12f09..94c6c6ee58b73 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/duplicate-binding/output/4e721_crates_turbopack-tests_tests_snapshot_imports_duplicate-binding_input_8498b7ee._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/duplicate-binding/output/4e721_crates_turbopack-tests_tests_snapshot_imports_duplicate-binding_input_8498b7ee._.js @@ -4,7 +4,7 @@ "use strict"; __turbopack_context__.s({ -"Table": (()=>Table) +"Table": ()=>Table }); const Table = ()=>{ return 'table'; @@ -14,7 +14,7 @@ return 'table'; "use strict"; __turbopack_context__.s({ -"Table": (()=>Table) +"Table": ()=>Table }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$imports$2f$duplicate$2d$binding$2f$input$2f$table$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/duplicate-binding/input/table.js [test] (ecmascript)"); ; diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/dynamic/output/4e721_crates_turbopack-tests_tests_snapshot_imports_dynamic_input_vercel_mjs_7f2965b8._.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/dynamic/output/4e721_crates_turbopack-tests_tests_snapshot_imports_dynamic_input_vercel_mjs_7f2965b8._.js index 657b0554e7c54..b66ef1b1b208e 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/dynamic/output/4e721_crates_turbopack-tests_tests_snapshot_imports_dynamic_input_vercel_mjs_7f2965b8._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/dynamic/output/4e721_crates_turbopack-tests_tests_snapshot_imports_dynamic_input_vercel_mjs_7f2965b8._.js @@ -4,7 +4,7 @@ "use strict"; __turbopack_context__.s({ -"default": (()=>__TURBOPACK__default__export__) +"default": ()=>__TURBOPACK__default__export__ }); const __TURBOPACK__default__export__ = 'turbopack'; }), diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_9a2c4881._.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_9a2c4881._.js index 844119d265cf0..e1eb92496fe4c 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_9a2c4881._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4c35f_tests_snapshot_imports_ignore-comments_input_vercel_mjs_9a2c4881._.js @@ -4,7 +4,7 @@ "use strict"; __turbopack_context__.s({ -"default": (()=>__TURBOPACK__default__export__) +"default": ()=>__TURBOPACK__default__export__ }); const __TURBOPACK__default__export__ = 'turbopack'; }), diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js index 91395f3924759..7b451a48bf000 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/ignore-comments/output/4e721_crates_turbopack-tests_tests_snapshot_imports_ignore-comments_input_7f940ff3._.js @@ -23,7 +23,7 @@ __turbopack_context__.v("/static/ignore-worker.c7cb9893.cjs");}), "use strict"; __turbopack_context__.s({ -"foo": (()=>foo) +"foo": ()=>foo }); const __TURBOPACK__import$2e$meta__ = { get url () { diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/order/output/turbopack_crates_turbopack-tests_tests_snapshot_imports_order_input_152f317f._.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/order/output/turbopack_crates_turbopack-tests_tests_snapshot_imports_order_input_152f317f._.js index 513ff0bc44cfe..36e370c2f49cb 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/order/output/turbopack_crates_turbopack-tests_tests_snapshot_imports_order_input_152f317f._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/order/output/turbopack_crates_turbopack-tests_tests_snapshot_imports_order_input_152f317f._.js @@ -4,7 +4,7 @@ "use strict"; __turbopack_context__.s({ -"default": (()=>__TURBOPACK__default__export__) +"default": ()=>__TURBOPACK__default__export__ }); const __TURBOPACK__default__export__ = { js: true diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/issues/__l___Module not found____c__ Can't resolve __c_'d-8707b3.txt b/turbopack/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/issues/__l___Module not found____c__ Can't resolve __c_'d-9608dd.txt similarity index 93% rename from turbopack/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/issues/__l___Module not found____c__ Can't resolve __c_'d-8707b3.txt rename to turbopack/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/issues/__l___Module not found____c__ Can't resolve __c_'d-9608dd.txt index 52431f06c4097..dcd399c3bd776 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/issues/__l___Module not found____c__ Can't resolve __c_'d-8707b3.txt +++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/issues/__l___Module not found____c__ Can't resolve __c_'d-9608dd.txt @@ -13,5 +13,5 @@ error - [resolve] [project]/turbopack/crates/turbopack-tests/tests/snapshot/impo | It was not possible to find the requested file. | Parsed request as written in source code: module "does-not-exist" with subpath '/path' | Path where resolving has started: [project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/input/index.js - | Type of request: EcmaScript Modules request + | Type of request: EcmaScript Modules (part) request | \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/static-and-dynamic/output/4e721_crates_turbopack-tests_tests_snapshot_imports_static-and-dynamic_input_ab9cac73._.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/static-and-dynamic/output/4e721_crates_turbopack-tests_tests_snapshot_imports_static-and-dynamic_input_ab9cac73._.js index de5e8a3c84011..4183b4ec76c29 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/static-and-dynamic/output/4e721_crates_turbopack-tests_tests_snapshot_imports_static-and-dynamic_input_ab9cac73._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/static-and-dynamic/output/4e721_crates_turbopack-tests_tests_snapshot_imports_static-and-dynamic_input_ab9cac73._.js @@ -4,7 +4,7 @@ "use strict"; __turbopack_context__.s({ -"default": (()=>__TURBOPACK__default__export__) +"default": ()=>__TURBOPACK__default__export__ }); const __TURBOPACK__default__export__ = 'turbopack'; }), diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/b1abf_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_2e0531bf._.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/b1abf_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_2e0531bf._.js index 6828b4c645ca3..28aa1e3562161 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/b1abf_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_2e0531bf._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/output/b1abf_turbopack-tests_tests_snapshot_imports_subpath-imports-nested_input_2e0531bf._.js @@ -4,7 +4,7 @@ "use strict"; __turbopack_context__.s({ -"default": (()=>__TURBOPACK__default__export__) +"default": ()=>__TURBOPACK__default__export__ }); const __TURBOPACK__default__export__ = 'foo'; }), @@ -12,7 +12,7 @@ const __TURBOPACK__default__export__ = 'foo'; "use strict"; __turbopack_context__.s({ -"default": (()=>__TURBOPACK__default__export__) +"default": ()=>__TURBOPACK__default__export__ }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$imports$2f$subpath$2d$imports$2d$nested$2f$input$2f$foo$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports-nested/input/foo.js [test] (ecmascript)"); ; diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/4e721_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_1e655205._.js b/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/4e721_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_1e655205._.js index 4690b71697f96..47dbcf6d5b181 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/4e721_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_1e655205._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/imports/subpath-imports/output/4e721_crates_turbopack-tests_tests_snapshot_imports_subpath-imports_input_1e655205._.js @@ -4,7 +4,7 @@ "use strict"; __turbopack_context__.s({ -"default": (()=>__TURBOPACK__default__export__) +"default": ()=>__TURBOPACK__default__export__ }); const __TURBOPACK__default__export__ = 'foo'; }), @@ -12,7 +12,7 @@ const __TURBOPACK__default__export__ = 'foo'; "use strict"; __turbopack_context__.s({ -"default": (()=>__TURBOPACK__default__export__) +"default": ()=>__TURBOPACK__default__export__ }); const __TURBOPACK__default__export__ = 'dep'; }), @@ -20,7 +20,7 @@ const __TURBOPACK__default__export__ = 'dep'; "use strict"; __turbopack_context__.s({ -"default": (()=>__TURBOPACK__default__export__) +"default": ()=>__TURBOPACK__default__export__ }); const __TURBOPACK__default__export__ = 'pat'; }), @@ -28,7 +28,7 @@ const __TURBOPACK__default__export__ = 'pat'; "use strict"; __turbopack_context__.s({ -"default": (()=>__TURBOPACK__default__export__) +"default": ()=>__TURBOPACK__default__export__ }); const __TURBOPACK__default__export__ = 'import'; }), diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/node/spawn_dynamic/output/4e721_crates_turbopack-tests_tests_snapshot_node_spawn_dynamic_input_d33fdf1c._.js b/turbopack/crates/turbopack-tests/tests/snapshot/node/spawn_dynamic/output/4e721_crates_turbopack-tests_tests_snapshot_node_spawn_dynamic_input_d33fdf1c._.js index c1f2672f59e58..38a002c4bd5c6 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/node/spawn_dynamic/output/4e721_crates_turbopack-tests_tests_snapshot_node_spawn_dynamic_input_d33fdf1c._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/node/spawn_dynamic/output/4e721_crates_turbopack-tests_tests_snapshot_node_spawn_dynamic_input_d33fdf1c._.js @@ -17,7 +17,7 @@ const proc = (0, __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$cr "use strict"; __turbopack_context__.s({ -"spawn": (()=>spawn) +"spawn": ()=>spawn }); function spawn(cmd, args) { // diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/node/spawn_node_eval/output/4e721_crates_turbopack-tests_tests_snapshot_node_spawn_node_eval_input_bf21d136._.js b/turbopack/crates/turbopack-tests/tests/snapshot/node/spawn_node_eval/output/4e721_crates_turbopack-tests_tests_snapshot_node_spawn_node_eval_input_bf21d136._.js index 5dba0365ae01a..7efe02856119a 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/node/spawn_node_eval/output/4e721_crates_turbopack-tests_tests_snapshot_node_spawn_node_eval_input_bf21d136._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/node/spawn_node_eval/output/4e721_crates_turbopack-tests_tests_snapshot_node_spawn_node_eval_input_bf21d136._.js @@ -15,7 +15,7 @@ let x = (0, __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ "use strict"; __turbopack_context__.s({ -"spawn": (()=>spawn) +"spawn": ()=>spawn }); function spawn(cmd, args) { // diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/index.js b/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/index.js index 9d2737fd0b1b5..6904604683173 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/index.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/index.js @@ -1,2 +1,3 @@ -"purposefully empty stub"; -"@emtion/react/index.js"; +export function jsx() { + return 'purposefully empty stub for @emotion/react/index.js' +} diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/jsx-dev-runtime.js b/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/jsx-dev-runtime.js index eee7c33dd5e39..d5d921ad46b8b 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/jsx-dev-runtime.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/jsx-dev-runtime.js @@ -1,2 +1,3 @@ -"purposefully empty stub"; -"@emtion/react/jsx-dev-runtime.js"; +export function jsxDEV() { + return 'purposefully empty stub for @emotion/react/jsx-dev-runtime.js' +} diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/jsx-runtime.js b/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/jsx-runtime.js index 885532e7a31df..e849b32f98a35 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/jsx-runtime.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/jsx-runtime.js @@ -1,2 +1,6 @@ -"purposefully empty stub"; -"@emtion/react/jsx-runtime.js"; +export function jsx() { + return 'purposefully empty stub for @emotion/react/jsx-runtime.js' +} +export function jsxs() { + return 'purposefully empty stub for @emotion/react/jsx-runtime.js' +} diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@swc/helpers/_/_class_call_check.js b/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@swc/helpers/_/_class_call_check.js index e66813ad2bca4..457130ced6414 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@swc/helpers/_/_class_call_check.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@swc/helpers/_/_class_call_check.js @@ -1,2 +1,3 @@ -"purposefully empty stub"; -"@swc/helpers/_/_class_call_check.js"; +export function _() { + return 'purposefully empty stub for @swc/helpers/_/_class_call_check.js' +} diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/index.js b/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/index.js index f115b2d8e1395..98e53699f5402 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/index.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/index.js @@ -1,2 +1,3 @@ -"purposefully empty stub"; -"react/index.js"; +export function jsx() { + return 'purposefully empty stub for react/index.js' +} diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/jsx-dev-runtime.js b/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/jsx-dev-runtime.js index f561dbe24f620..99633e29cba2f 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/jsx-dev-runtime.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/jsx-dev-runtime.js @@ -1,2 +1,3 @@ -"purposefully empty stub"; -"react/jsx-dev-runtime.js"; +export function jsxDEV() { + return 'purposefully empty stub for react/jsx-dev-runtime.js' +} diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/jsx-runtime.js b/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/jsx-runtime.js index ee1da08297184..35cdcbf319d0f 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/jsx-runtime.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/jsx-runtime.js @@ -1,2 +1,6 @@ -"purposefully empty stub"; -"react/jsx-runtime.js"; +export function jsx() { + return 'purposefully empty stub for react/jsx-runtime.js' +} +export function jsxs() { + return 'purposefully empty stub for react/jsx-runtime.js' +} diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js b/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js index 88af654ad63d4..9c04fdabc6b53 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js @@ -13,6 +13,22 @@ const toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag; function defineProp(obj, name, options) { if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options); } +function getOverwrittenModule(moduleCache, id) { +let module = moduleCache[id]; +if (!module) { +// This is invoked when a module is merged into another module, thus it wasn't invoced via +// instantiateModule and the cache entry wasn't created yet. +module = { +exports: {}, +error: undefined, +loaded: false, +id, +namespaceObject: undefined +}; +moduleCache[id] = module; +} +return module; +} /** * Adds the getters to the exports object. */ function esm(exports, getters) { @@ -41,7 +57,11 @@ Object.seal(exports); } /** * Makes the module an ESM with exports - */ function esmExport(module, exports, getters) { + */ function esmExport(module, exports, moduleCache, getters, id) { +if (id != null) { +module = getOverwrittenModule(moduleCache, id); +exports = module.exports; +} module.namespaceObject = module.exports; esm(exports, getters); } @@ -74,16 +94,26 @@ return keys; } /** * Dynamically exports properties from an object - */ function dynamicExport(module, exports, object) { + */ function dynamicExport(module, exports, moduleCache, object, id) { +if (id != null) { +module = getOverwrittenModule(moduleCache, id); +exports = module.exports; +} ensureDynamicExports(module, exports); if (typeof object === 'object' && object !== null) { module[REEXPORTED_OBJECTS].push(object); } } -function exportValue(module, value) { +function exportValue(module, moduleCache, value, id) { +if (id != null) { +module = getOverwrittenModule(moduleCache, id); +} module.exports = value; } -function exportNamespace(module, namespace) { +function exportNamespace(module, moduleCache, namespace, id) { +if (id != null) { +module = getOverwrittenModule(moduleCache, id); +} module.exports = module.namespaceObject = namespace; } function createGetter(obj, key) { @@ -480,9 +510,17 @@ const resolved = path.resolve(RUNTIME_ROOT, chunkPath); const chunkModules = require(resolved); for (const [moduleId, moduleFactory] of Object.entries(chunkModules)){ if (!moduleFactories[moduleId]) { +if (Array.isArray(moduleFactory)) { +let [moduleFactoryFn, otherIds] = moduleFactory; +moduleFactories[moduleId] = moduleFactoryFn; +for (const otherModuleId of otherIds){ +moduleFactories[otherModuleId] = moduleFactoryFn; +} +} else { moduleFactories[moduleId] = moduleFactory; } } +} loadedChunks.add(chunkPath); } catch (e) { let errorMessage = `Failed to load chunk ${chunkPath}`; @@ -522,9 +560,17 @@ exports: {} const chunkModules = module1.exports; for (const [moduleId, moduleFactory] of Object.entries(chunkModules)){ if (!moduleFactories[moduleId]) { +if (Array.isArray(moduleFactory)) { +let [moduleFactoryFn, otherIds] = moduleFactory; +moduleFactories[moduleId] = moduleFactoryFn; +for (const otherModuleId of otherIds){ +moduleFactories[otherModuleId] = moduleFactoryFn; +} +} else { moduleFactories[moduleId] = moduleFactory; } } +} loadedChunks.add(chunkPath); } catch (e) { let errorMessage = `Failed to load chunk ${chunkPath}`; @@ -570,21 +616,6 @@ invariant(source, (source)=>`Unknown source type: ${source?.type}`); } throw new Error(`Module ${id} was instantiated ${instantiationReason}, but the module factory is not available. It might have been deleted in an HMR update.`); } -let parents; -switch(source.type){ -case 0: -parents = []; -break; -case 1: -// No need to add this module as a child of the parent module here, this -// has already been taken care of in `getOrInstantiateModuleFromParent`. -parents = [ -source.parentId -]; -break; -default: -invariant(source, (source)=>`Unknown source type: ${source?.type}`); -} const module1 = { exports: {}, error: undefined, @@ -605,10 +636,10 @@ x: externalRequire, y: externalImport, f: moduleContext, i: esmImport.bind(null, module1), -s: esmExport.bind(null, module1, module1.exports), -j: dynamicExport.bind(null, module1, module1.exports), -v: exportValue.bind(null, module1), -n: exportNamespace.bind(null, module1), +s: esmExport.bind(null, module1, module1.exports, moduleCache), +j: dynamicExport.bind(null, module1, module1.exports, moduleCache), +v: exportValue.bind(null, module1, moduleCache), +n: exportNamespace.bind(null, module1, moduleCache), m: module1, c: moduleCache, M: moduleFactories, diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js.map index 135041eb0baaa..f7f4415f7396b 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js.map +++ b/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_build_runtime/output/[turbopack]_runtime.js.map @@ -2,9 +2,9 @@ "version": 3, "sources": [], "sections": [ - {"offset": {"line": 3, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime-utils.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * TurboPack ECMAScript runtimes.\n *\n * It will be prepended to the runtime code of each runtime.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n\ntype EsmNamespaceObject = Record\n\n// @ts-ignore Defined in `dev-base.ts`\ndeclare function getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: M\n): M\n\nconst REEXPORTED_OBJECTS = Symbol('reexported objects')\n\ntype ModuleContextMap = Record\n\ninterface ModuleContextEntry {\n id: () => ModuleId\n module: () => any\n}\n\ninterface ModuleContext {\n // require call\n (moduleId: ModuleId): Exports | EsmNamespaceObject\n\n // async import call\n import(moduleId: ModuleId): Promise\n\n keys(): ModuleId[]\n\n resolve(moduleId: ModuleId): ModuleId\n}\n\ntype GetOrInstantiateModuleFromParent = (\n moduleId: ModuleId,\n parentModule: M\n) => M\n\ndeclare function getOrInstantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty\nconst toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag\n\nfunction defineProp(\n obj: any,\n name: PropertyKey,\n options: PropertyDescriptor & ThisType\n) {\n if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options)\n}\n\n/**\n * Adds the getters to the exports object.\n */\nfunction esm(\n exports: Exports,\n getters: Record any) | [() => any, (v: any) => void]>\n) {\n defineProp(exports, '__esModule', { value: true })\n if (toStringTag) defineProp(exports, toStringTag, { value: 'Module' })\n for (const key in getters) {\n const item = getters[key]\n if (Array.isArray(item)) {\n defineProp(exports, key, {\n get: item[0],\n set: item[1],\n enumerable: true,\n })\n } else {\n defineProp(exports, key, { get: item, enumerable: true })\n }\n }\n Object.seal(exports)\n}\n\n/**\n * Makes the module an ESM with exports\n */\nfunction esmExport(\n module: Module,\n exports: Exports,\n getters: Record any>\n) {\n module.namespaceObject = module.exports\n esm(exports, getters)\n}\n\nfunction ensureDynamicExports(module: Module, exports: Exports) {\n let reexportedObjects = module[REEXPORTED_OBJECTS]\n\n if (!reexportedObjects) {\n reexportedObjects = module[REEXPORTED_OBJECTS] = []\n module.exports = module.namespaceObject = new Proxy(exports, {\n get(target, prop) {\n if (\n hasOwnProperty.call(target, prop) ||\n prop === 'default' ||\n prop === '__esModule'\n ) {\n return Reflect.get(target, prop)\n }\n for (const obj of reexportedObjects!) {\n const value = Reflect.get(obj, prop)\n if (value !== undefined) return value\n }\n return undefined\n },\n ownKeys(target) {\n const keys = Reflect.ownKeys(target)\n for (const obj of reexportedObjects!) {\n for (const key of Reflect.ownKeys(obj)) {\n if (key !== 'default' && !keys.includes(key)) keys.push(key)\n }\n }\n return keys\n },\n })\n }\n}\n\n/**\n * Dynamically exports properties from an object\n */\nfunction dynamicExport(\n module: Module,\n exports: Exports,\n object: Record\n) {\n ensureDynamicExports(module, exports)\n\n if (typeof object === 'object' && object !== null) {\n module[REEXPORTED_OBJECTS]!.push(object)\n }\n}\n\nfunction exportValue(module: Module, value: any) {\n module.exports = value\n}\n\nfunction exportNamespace(module: Module, namespace: any) {\n module.exports = module.namespaceObject = namespace\n}\n\nfunction createGetter(obj: Record, key: string | symbol) {\n return () => obj[key]\n}\n\n/**\n * @returns prototype of the object\n */\nconst getProto: (obj: any) => any = Object.getPrototypeOf\n ? (obj) => Object.getPrototypeOf(obj)\n : (obj) => obj.__proto__\n\n/** Prototypes that are not expanded for exports */\nconst LEAF_PROTOTYPES = [null, getProto({}), getProto([]), getProto(getProto)]\n\n/**\n * @param raw\n * @param ns\n * @param allowExportDefault\n * * `false`: will have the raw module as default export\n * * `true`: will have the default property as default export\n */\nfunction interopEsm(\n raw: Exports,\n ns: EsmNamespaceObject,\n allowExportDefault?: boolean\n) {\n const getters: { [s: string]: () => any } = Object.create(null)\n for (\n let current = raw;\n (typeof current === 'object' || typeof current === 'function') &&\n !LEAF_PROTOTYPES.includes(current);\n current = getProto(current)\n ) {\n for (const key of Object.getOwnPropertyNames(current)) {\n getters[key] = createGetter(raw, key)\n }\n }\n\n // this is not really correct\n // we should set the `default` getter if the imported module is a `.cjs file`\n if (!(allowExportDefault && 'default' in getters)) {\n getters['default'] = () => raw\n }\n\n esm(ns, getters)\n return ns\n}\n\nfunction createNS(raw: Module['exports']): EsmNamespaceObject {\n if (typeof raw === 'function') {\n return function (this: any, ...args: any[]) {\n return raw.apply(this, args)\n }\n } else {\n return Object.create(null)\n }\n}\n\nfunction esmImport(\n sourceModule: Module,\n id: ModuleId\n): Exclude {\n const module = getOrInstantiateModuleFromParent(id, sourceModule)\n if (module.error) throw module.error\n\n // any ES module has to have `module.namespaceObject` defined.\n if (module.namespaceObject) return module.namespaceObject\n\n // only ESM can be an async module, so we don't need to worry about exports being a promise here.\n const raw = module.exports\n return (module.namespaceObject = interopEsm(\n raw,\n createNS(raw),\n raw && (raw as any).__esModule\n ))\n}\n\n// Add a simple runtime require so that environments without one can still pass\n// `typeof require` CommonJS checks so that exports are correctly registered.\nconst runtimeRequire =\n // @ts-ignore\n typeof require === 'function'\n ? // @ts-ignore\n require\n : function require() {\n throw new Error('Unexpected use of runtime require')\n }\n\nfunction commonJsRequire(sourceModule: Module, id: ModuleId): Exports {\n const module = getOrInstantiateModuleFromParent(id, sourceModule)\n if (module.error) throw module.error\n return module.exports\n}\n\n/**\n * `require.context` and require/import expression runtime.\n */\nfunction moduleContext(map: ModuleContextMap): ModuleContext {\n function moduleContext(id: ModuleId): Exports {\n if (hasOwnProperty.call(map, id)) {\n return map[id].module()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.keys = (): ModuleId[] => {\n return Object.keys(map)\n }\n\n moduleContext.resolve = (id: ModuleId): ModuleId => {\n if (hasOwnProperty.call(map, id)) {\n return map[id].id()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.import = async (id: ModuleId) => {\n return await (moduleContext(id) as Promise)\n }\n\n return moduleContext\n}\n\n/**\n * Returns the path of a chunk defined by its data.\n */\nfunction getChunkPath(chunkData: ChunkData): ChunkPath {\n return typeof chunkData === 'string' ? chunkData : chunkData.path\n}\n\nfunction isPromise(maybePromise: any): maybePromise is Promise {\n return (\n maybePromise != null &&\n typeof maybePromise === 'object' &&\n 'then' in maybePromise &&\n typeof maybePromise.then === 'function'\n )\n}\n\nfunction isAsyncModuleExt(obj: T): obj is AsyncModuleExt & T {\n return turbopackQueues in obj\n}\n\nfunction createPromise() {\n let resolve: (value: T | PromiseLike) => void\n let reject: (reason?: any) => void\n\n const promise = new Promise((res, rej) => {\n reject = rej\n resolve = res\n })\n\n return {\n promise,\n resolve: resolve!,\n reject: reject!,\n }\n}\n\n// everything below is adapted from webpack\n// https://github.com/webpack/webpack/blob/6be4065ade1e252c1d8dcba4af0f43e32af1bdc1/lib/runtime/AsyncModuleRuntimeModule.js#L13\n\nconst turbopackQueues = Symbol('turbopack queues')\nconst turbopackExports = Symbol('turbopack exports')\nconst turbopackError = Symbol('turbopack error')\n\nconst enum QueueStatus {\n Unknown = -1,\n Unresolved = 0,\n Resolved = 1,\n}\n\ntype AsyncQueueFn = (() => void) & { queueCount: number }\ntype AsyncQueue = AsyncQueueFn[] & {\n status: QueueStatus\n}\n\nfunction resolveQueue(queue?: AsyncQueue) {\n if (queue && queue.status !== QueueStatus.Resolved) {\n queue.status = QueueStatus.Resolved\n queue.forEach((fn) => fn.queueCount--)\n queue.forEach((fn) => (fn.queueCount-- ? fn.queueCount++ : fn()))\n }\n}\n\ntype Dep = Exports | AsyncModulePromise | Promise\n\ntype AsyncModuleExt = {\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => void\n [turbopackExports]: Exports\n [turbopackError]?: any\n}\n\ntype AsyncModulePromise = Promise & AsyncModuleExt\n\nfunction wrapDeps(deps: Dep[]): AsyncModuleExt[] {\n return deps.map((dep): AsyncModuleExt => {\n if (dep !== null && typeof dep === 'object') {\n if (isAsyncModuleExt(dep)) return dep\n if (isPromise(dep)) {\n const queue: AsyncQueue = Object.assign([], {\n status: QueueStatus.Unresolved,\n })\n\n const obj: AsyncModuleExt = {\n [turbopackExports]: {},\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => fn(queue),\n }\n\n dep.then(\n (res) => {\n obj[turbopackExports] = res\n resolveQueue(queue)\n },\n (err) => {\n obj[turbopackError] = err\n resolveQueue(queue)\n }\n )\n\n return obj\n }\n }\n\n return {\n [turbopackExports]: dep,\n [turbopackQueues]: () => {},\n }\n })\n}\n\nfunction asyncModule(\n module: Module,\n body: (\n handleAsyncDependencies: (\n deps: Dep[]\n ) => Exports[] | Promise<() => Exports[]>,\n asyncResult: (err?: any) => void\n ) => void,\n hasAwait: boolean\n) {\n const queue: AsyncQueue | undefined = hasAwait\n ? Object.assign([], { status: QueueStatus.Unknown })\n : undefined\n\n const depQueues: Set = new Set()\n\n const { resolve, reject, promise: rawPromise } = createPromise()\n\n const promise: AsyncModulePromise = Object.assign(rawPromise, {\n [turbopackExports]: module.exports,\n [turbopackQueues]: (fn) => {\n queue && fn(queue)\n depQueues.forEach(fn)\n promise['catch'](() => {})\n },\n } satisfies AsyncModuleExt)\n\n const attributes: PropertyDescriptor = {\n get(): any {\n return promise\n },\n set(v: any) {\n // Calling `esmExport` leads to this.\n if (v !== promise) {\n promise[turbopackExports] = v\n }\n },\n }\n\n Object.defineProperty(module, 'exports', attributes)\n Object.defineProperty(module, 'namespaceObject', attributes)\n\n function handleAsyncDependencies(deps: Dep[]) {\n const currentDeps = wrapDeps(deps)\n\n const getResult = () =>\n currentDeps.map((d) => {\n if (d[turbopackError]) throw d[turbopackError]\n return d[turbopackExports]\n })\n\n const { promise, resolve } = createPromise<() => Exports[]>()\n\n const fn: AsyncQueueFn = Object.assign(() => resolve(getResult), {\n queueCount: 0,\n })\n\n function fnQueue(q: AsyncQueue) {\n if (q !== queue && !depQueues.has(q)) {\n depQueues.add(q)\n if (q && q.status === QueueStatus.Unresolved) {\n fn.queueCount++\n q.push(fn)\n }\n }\n }\n\n currentDeps.map((dep) => dep[turbopackQueues](fnQueue))\n\n return fn.queueCount ? promise : getResult()\n }\n\n function asyncResult(err?: any) {\n if (err) {\n reject((promise[turbopackError] = err))\n } else {\n resolve(promise[turbopackExports])\n }\n\n resolveQueue(queue)\n }\n\n body(handleAsyncDependencies, asyncResult)\n\n if (queue && queue.status === QueueStatus.Unknown) {\n queue.status = QueueStatus.Unresolved\n }\n}\n\n/**\n * A pseudo \"fake\" URL object to resolve to its relative path.\n *\n * When UrlRewriteBehavior is set to relative, calls to the `new URL()` will construct url without base using this\n * runtime function to generate context-agnostic urls between different rendering context, i.e ssr / client to avoid\n * hydration mismatch.\n *\n * This is based on webpack's existing implementation:\n * https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/runtime/RelativeUrlRuntimeModule.js\n */\nconst relativeURL = function relativeURL(this: any, inputUrl: string) {\n const realUrl = new URL(inputUrl, 'x:/')\n const values: Record = {}\n for (const key in realUrl) values[key] = (realUrl as any)[key]\n values.href = inputUrl\n values.pathname = inputUrl.replace(/[?#].*/, '')\n values.origin = values.protocol = ''\n values.toString = values.toJSON = (..._args: Array) => inputUrl\n for (const key in values)\n Object.defineProperty(this, key, {\n enumerable: true,\n configurable: true,\n value: values[key],\n })\n}\n\nrelativeURL.prototype = URL.prototype\n\n/**\n * Utility function to ensure all variants of an enum are handled.\n */\nfunction invariant(never: never, computeMessage: (arg: any) => string): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n}\n\n/**\n * A stub function to make `require` available but non-functional in ESM.\n */\nfunction requireStub(_moduleId: ModuleId): never {\n throw new Error('dynamic usage of require is not supported')\n}\n"],"names":[],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,6CAA6C;AAU7C,MAAM,qBAAqB,OAAO;AA+BlC,MAAM,iBAAiB,OAAO,SAAS,CAAC,cAAc;AACtD,MAAM,cAAc,OAAO,WAAW,eAAe,OAAO,WAAW;AAEvE,SAAS,WACP,GAAQ,EACR,IAAiB,EACjB,OAA2C;AAE3C,IAAI,CAAC,eAAe,IAAI,CAAC,KAAK,OAAO,OAAO,cAAc,CAAC,KAAK,MAAM;AACxE;AAEA;;CAEC,GACD,SAAS,IACP,OAAgB,EAChB,OAAoE;AAEpE,WAAW,SAAS,cAAc;AAAE,OAAO;AAAK;AAChD,IAAI,aAAa,WAAW,SAAS,aAAa;AAAE,OAAO;AAAS;AACpE,IAAK,MAAM,OAAO,QAAS;AACzB,MAAM,OAAO,OAAO,CAAC,IAAI;AACzB,IAAI,MAAM,OAAO,CAAC,OAAO;AACvB,WAAW,SAAS,KAAK;AACvB,KAAK,IAAI,CAAC,EAAE;AACZ,KAAK,IAAI,CAAC,EAAE;AACZ,YAAY;AACd;AACF,OAAO;AACL,WAAW,SAAS,KAAK;AAAE,KAAK;AAAM,YAAY;AAAK;AACzD;AACF;AACA,OAAO,IAAI,CAAC;AACd;AAEA;;CAEC,GACD,SAAS,UACP,MAAc,EACd,OAAgB,EAChB,OAAkC;AAElC,OAAO,eAAe,GAAG,OAAO,OAAO;AACvC,IAAI,SAAS;AACf;AAEA,SAAS,qBAAqB,MAAc,EAAE,OAAgB;AAC5D,IAAI,oBAAoB,MAAM,CAAC,mBAAmB;AAElD,IAAI,CAAC,mBAAmB;AACtB,oBAAoB,MAAM,CAAC,mBAAmB,GAAG,EAAE;AACnD,OAAO,OAAO,GAAG,OAAO,eAAe,GAAG,IAAI,MAAM,SAAS;AAC3D,KAAI,MAAM,EAAE,IAAI;AACd,IACE,eAAe,IAAI,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AClC,OAAO,QAAQ,GAAG,OAAO,MAAM,GAAG,CAAC,GAAG,QAAsB;AAC5D,IAAK,MAAM,OAAO,OAChB,OAAO,cAAc,CAAC,IAAI,EAAE,KAAK;AAC/B,YAAY;AACZ,cAAc;AACd,OAAO,MAAM,CAAC,IAAI;AACpB;AACJ;AAEA,YAAY,SAAS,GAAG,IAAI,SAAS;AAErC;;CAEC,GACD,SAAS,UAAU,KAAY,EAAE,cAAoC;AACnE,MAAM,IAAI,MAAM,CAAC,WAAW,EAAE,eAAe,QAAQ;AACvD;AAEA;;CAEC,GACD,SAAS,YAAY,SAAmB;AACtC,MAAM,IAAI,MAAM;AAClB","ignoreList":[0]}}, - {"offset": {"line": 337, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared-node/base-externals-utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n\n/// A 'base' utilities to support runtime can have externals.\n/// Currently this is for node.js / edge runtime both.\n/// If a fn requires node.js specific behavior, it should be placed in `node-external-utils` instead.\n\nasync function externalImport(id: ModuleId) {\n let raw\n try {\n raw = await import(id)\n } catch (err) {\n // TODO(alexkirsz) This can happen when a client-side module tries to load\n // an external module we don't provide a shim for (e.g. querystring, url).\n // For now, we fail semi-silently, but in the future this should be a\n // compilation error.\n throw new Error(`Failed to load external module ${id}: ${err}`)\n }\n\n if (raw && raw.__esModule && raw.default && 'default' in raw.default) {\n return interopEsm(raw.default, createNS(raw), true)\n }\n\n return raw\n}\n\nfunction externalRequire(\n id: ModuleId,\n thunk: () => any,\n esm: boolean = false\n): Exports | EsmNamespaceObject {\n let raw\n try {\n raw = thunk()\n } catch (err) {\n // TODO(alexkirsz) This can happen when a client-side module tries to load\n // an external module we don't provide a shim for (e.g. querystring, url).\n // For now, we fail semi-silently, but in the future this should be a\n // compilation error.\n throw new Error(`Failed to load external module ${id}: ${err}`)\n }\n\n if (!esm || raw.__esModule) {\n return raw\n }\n\n return interopEsm(raw, createNS(raw), true)\n}\n\nexternalRequire.resolve = (\n id: string,\n options?: {\n paths?: string[]\n }\n) => {\n return require.resolve(id, options)\n}\n"],"names":[],"mappings":"AAAA,oDAAoD,GAEpD,mDAAmD;AAEnD,6DAA6D;AAC7D,sDAAsD;AACtD,qGAAqG;AAErG,eAAe,eAAe,EAAY;AACxC,IAAI;AACJ,IAAI;AACF,MAAM,MAAM,MAAM,CAAC;AACrB,EAAE,OAAO,KAAK;AACZ,0EAA0E;AAC1E,0EAA0E;AAC1E,qEAAqE;AACrE,qBAAqB;AACrB,MAAM,IAAI,MAAM,CAAC,+BAA+B,EAAE,GAAG,EAAE,EAAE,KAAK;AAChE;AAEA,IAAI,OAAO,IAAI,UAAU,IAAI,IAAI,OAAO,IAAI,aAAa,IAAI,OAAO,EAAE;AACpE,OAAO,WAAW,IAAI,OAAO,EAAE,SAAS,MAAM;AAChD;AAEA,OAAO;AACT;AAEA,SAAS,gBACP,EAAY,EACZ,KAAgB,EAChB,MAAe,KAAK;AAEpB,IAAI;AACJ,IAAI;AACF,MAAM;AACR,EAAE,OAAO,KAAK;AACZ,0EAA0E;AAC1E,0EAA0E;AAC1E,qEAAqE;AACrE,qBAAqB;AACrB,MAAM,IAAI,MAAM,CAAC,+BAA+B,EAAE,GAAG,EAAE,EAAE,KAAK;AAChE;AAEA,IAAI,CAAC,OAAO,IAAI,UAAU,EAAE;AAC1B,OAAO;AACT;AAEA,OAAO,WAAW,KAAK,SAAS,MAAM;AACxC;AAEA,gBAAgB,OAAO,GAAG,CACxB,IACA;AAIA,OAAO,QAAQ,OAAO,CAAC,IAAI;AAC7B","ignoreList":[0]}}, - {"offset": {"line": 376, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared-node/node-externals-utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\ndeclare var RUNTIME_PUBLIC_PATH: string\ndeclare var RELATIVE_ROOT_PATH: string\ndeclare var ASSET_PREFIX: string\n\nconst path = require('path')\n\nconst relativePathToRuntimeRoot = path.relative(RUNTIME_PUBLIC_PATH, '.')\n// Compute the relative path to the `distDir`.\nconst relativePathToDistRoot = path.join(\n relativePathToRuntimeRoot,\n RELATIVE_ROOT_PATH\n)\nconst RUNTIME_ROOT = path.resolve(__filename, relativePathToRuntimeRoot)\n// Compute the absolute path to the root, by stripping distDir from the absolute path to this file.\nconst ABSOLUTE_ROOT = path.resolve(__filename, relativePathToDistRoot)\n\n/**\n * Returns an absolute path to the given module path.\n * Module path should be relative, either path to a file or a directory.\n *\n * This fn allows to calculate an absolute path for some global static values, such as\n * `__dirname` or `import.meta.url` that Turbopack will not embeds in compile time.\n * See ImportMetaBinding::code_generation for the usage.\n */\nfunction resolveAbsolutePath(modulePath?: string): string {\n if (modulePath) {\n return path.join(ABSOLUTE_ROOT, modulePath)\n }\n return ABSOLUTE_ROOT\n}\n"],"names":[],"mappings":"AAAA,oDAAoD,GAMpD,MAAM,OAAO,QAAQ;AAErB,MAAM,4BAA4B,KAAK,QAAQ,CAAC,qBAAqB;AACrE,8CAA8C;AAC9C,MAAM,yBAAyB,KAAK,IAAI,CACtC,2BACA;AAEF,MAAM,eAAe,KAAK,OAAO,CAAC,YAAY;AAC9C,mGAAmG;AACnG,MAAM,gBAAgB,KAAK,OAAO,CAAC,YAAY;AAE/C;;;;;;;CAOC,GACD,SAAS,oBAAoB,UAAmB;AAC9C,IAAI,YAAY;AACd,OAAO,KAAK,IAAI,CAAC,eAAe;AAClC;AACA,OAAO;AACT","ignoreList":[0]}}, - {"offset": {"line": 396, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared-node/node-wasm-utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n\nfunction readWebAssemblyAsResponse(path: string) {\n const { createReadStream } = require('fs') as typeof import('fs')\n const { Readable } = require('stream') as typeof import('stream')\n\n const stream = createReadStream(path)\n\n // @ts-ignore unfortunately there's a slight type mismatch with the stream.\n return new Response(Readable.toWeb(stream), {\n headers: {\n 'content-type': 'application/wasm',\n },\n })\n}\n\nasync function compileWebAssemblyFromPath(\n path: string\n): Promise {\n const response = readWebAssemblyAsResponse(path)\n\n return await WebAssembly.compileStreaming(response)\n}\n\nasync function instantiateWebAssemblyFromPath(\n path: string,\n importsObj: WebAssembly.Imports\n): Promise {\n const response = readWebAssemblyAsResponse(path)\n\n const { instance } = await WebAssembly.instantiateStreaming(\n response,\n importsObj\n )\n\n return instance.exports\n}\n"],"names":[],"mappings":"AAAA,oDAAoD,GAEpD,mDAAmD;AAEnD,SAAS,0BAA0B,IAAY;AAC7C,MAAM,EAAE,gBAAgB,EAAE,GAAG,QAAQ;AACrC,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ;AAE7B,MAAM,SAAS,iBAAiB;AAEhC,2EAA2E;AAC3E,OAAO,IAAI,SAAS,SAAS,KAAK,CAAC,SAAS;AAC1C,SAAS;AACP,gBAAgB;AAClB;AACF;AACF;AAEA,eAAe,2BACb,IAAY;AAEZ,MAAM,WAAW,0BAA0B;AAE3C,OAAO,MAAM,YAAY,gBAAgB,CAAC;AAC5C;AAEA,eAAe,+BACb,IAAY,EACZ,UAA+B;AAE/B,MAAM,WAAW,0BAA0B;AAE3C,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,YAAY,oBAAoB,CACzD,UACA;AAGF,OAAO,SAAS,OAAO;AACzB","ignoreList":[0]}}, - {"offset": {"line": 417, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/nodejs/runtime.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n/// \n/// \n\nenum SourceType {\n /**\n * The module was instantiated because it was included in an evaluated chunk's\n * runtime.\n */\n Runtime = 0,\n /**\n * The module was instantiated because a parent module imported it.\n */\n Parent = 1,\n}\n\ntype SourceInfo =\n | {\n type: SourceType.Runtime\n chunkPath: ChunkPath\n }\n | {\n type: SourceType.Parent\n parentId: ModuleId\n }\n\nprocess.env.TURBOPACK = '1'\n\nfunction stringifySourceInfo(source: SourceInfo): string {\n switch (source.type) {\n case SourceType.Runtime:\n return `runtime for chunk ${source.chunkPath}`\n case SourceType.Parent:\n return `parent module ${source.parentId}`\n default:\n invariant(source, (source) => `Unknown source type: ${source?.type}`)\n }\n}\n\ntype ExternalRequire = (\n id: ModuleId,\n thunk: () => any,\n esm?: boolean\n) => Exports | EsmNamespaceObject\ntype ExternalImport = (id: ModuleId) => Promise\n\ninterface TurbopackNodeBuildContext extends TurbopackBaseContext {\n R: ResolvePathFromModule\n x: ExternalRequire\n y: ExternalImport\n}\n\ntype ModuleFactory = (\n this: Module['exports'],\n context: TurbopackNodeBuildContext\n) => undefined\n\nconst url = require('url') as typeof import('url')\nconst fs = require('fs/promises') as typeof import('fs/promises')\n\nconst moduleFactories: ModuleFactories = Object.create(null)\nconst moduleCache: ModuleCache = Object.create(null)\n\n/**\n * Returns an absolute path to the given module's id.\n */\nfunction createResolvePathFromModule(\n resolver: (moduleId: string) => Exports\n): (moduleId: string) => string {\n return function resolvePathFromModule(moduleId: string): string {\n const exported = resolver(moduleId)\n const exportedPath = exported?.default ?? exported\n if (typeof exportedPath !== 'string') {\n return exported as any\n }\n\n const strippedAssetPrefix = exportedPath.slice(ASSET_PREFIX.length)\n const resolved = path.resolve(RUNTIME_ROOT, strippedAssetPrefix)\n\n return url.pathToFileURL(resolved).href\n }\n}\n\nfunction loadChunk(chunkData: ChunkData, source?: SourceInfo): void {\n if (typeof chunkData === 'string') {\n return loadChunkPath(chunkData, source)\n } else {\n return loadChunkPath(chunkData.path, source)\n }\n}\n\nconst loadedChunks = new Set()\n\nfunction loadChunkPath(chunkPath: ChunkPath, source?: SourceInfo): void {\n if (!isJs(chunkPath)) {\n // We only support loading JS chunks in Node.js.\n // This branch can be hit when trying to load a CSS chunk.\n return\n }\n\n if (loadedChunks.has(chunkPath)) {\n return\n }\n\n try {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n const chunkModules: ModuleFactories = require(resolved)\n\n for (const [moduleId, moduleFactory] of Object.entries(chunkModules)) {\n if (!moduleFactories[moduleId]) {\n moduleFactories[moduleId] = moduleFactory\n }\n }\n loadedChunks.add(chunkPath)\n } catch (e) {\n let errorMessage = `Failed to load chunk ${chunkPath}`\n\n if (source) {\n errorMessage += ` from ${stringifySourceInfo(source)}`\n }\n\n throw new Error(errorMessage, {\n cause: e,\n })\n }\n}\n\nasync function loadChunkAsync(\n source: SourceInfo,\n chunkData: ChunkData\n): Promise {\n const chunkPath = typeof chunkData === 'string' ? chunkData : chunkData.path\n if (!isJs(chunkPath)) {\n // We only support loading JS chunks in Node.js.\n // This branch can be hit when trying to load a CSS chunk.\n return\n }\n\n if (loadedChunks.has(chunkPath)) {\n return\n }\n\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n\n try {\n const contents = await fs.readFile(resolved, 'utf-8')\n\n const localRequire = (id: string) => {\n let resolvedId = require.resolve(id, { paths: [path.dirname(resolved)] })\n return require(resolvedId)\n }\n const module = {\n exports: {},\n }\n // TODO: Use vm.runInThisContext once our minimal supported Node.js version includes https://github.com/nodejs/node/pull/52153\n // eslint-disable-next-line no-eval -- Can't use vm.runInThisContext due to https://github.com/nodejs/node/issues/52102\n ;(0, eval)(\n '(function(module, exports, require, __dirname, __filename) {' +\n contents +\n '\\n})' +\n '\\n//# sourceURL=' +\n url.pathToFileURL(resolved)\n )(module, module.exports, localRequire, path.dirname(resolved), resolved)\n\n const chunkModules: ModuleFactories = module.exports\n for (const [moduleId, moduleFactory] of Object.entries(chunkModules)) {\n if (!moduleFactories[moduleId]) {\n moduleFactories[moduleId] = moduleFactory\n }\n }\n loadedChunks.add(chunkPath)\n } catch (e) {\n let errorMessage = `Failed to load chunk ${chunkPath}`\n\n if (source) {\n errorMessage += ` from ${stringifySourceInfo(source)}`\n }\n\n throw new Error(errorMessage, {\n cause: e,\n })\n }\n}\n\nasync function loadChunkAsyncByUrl(source: SourceInfo, chunkUrl: string) {\n const path = url.fileURLToPath(new URL(chunkUrl, RUNTIME_ROOT)) as ChunkPath\n return loadChunkAsync(source, path)\n}\n\nfunction loadWebAssembly(\n chunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n imports: WebAssembly.Imports\n) {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n\n return instantiateWebAssemblyFromPath(resolved, imports)\n}\n\nfunction loadWebAssemblyModule(\n chunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n) {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n\n return compileWebAssemblyFromPath(resolved)\n}\n\nfunction getWorkerBlobURL(_chunks: ChunkPath[]): string {\n throw new Error('Worker blobs are not implemented yet for Node.js')\n}\n\nfunction instantiateModule(id: ModuleId, source: SourceInfo): Module {\n const moduleFactory = moduleFactories[id]\n if (typeof moduleFactory !== 'function') {\n // This can happen if modules incorrectly handle HMR disposes/updates,\n // e.g. when they keep a `setTimeout` around which still executes old code\n // and contains e.g. a `require(\"something\")` call.\n let instantiationReason\n switch (source.type) {\n case SourceType.Runtime:\n instantiationReason = `as a runtime entry of chunk ${source.chunkPath}`\n break\n case SourceType.Parent:\n instantiationReason = `because it was required from module ${source.parentId}`\n break\n default:\n invariant(source, (source) => `Unknown source type: ${source?.type}`)\n }\n throw new Error(\n `Module ${id} was instantiated ${instantiationReason}, but the module factory is not available. It might have been deleted in an HMR update.`\n )\n }\n\n let parents: ModuleId[]\n switch (source.type) {\n case SourceType.Runtime:\n parents = []\n break\n case SourceType.Parent:\n // No need to add this module as a child of the parent module here, this\n // has already been taken care of in `getOrInstantiateModuleFromParent`.\n parents = [source.parentId]\n break\n default:\n invariant(source, (source) => `Unknown source type: ${source?.type}`)\n }\n\n const module: Module = {\n exports: {},\n error: undefined,\n loaded: false,\n id,\n namespaceObject: undefined,\n }\n moduleCache[id] = module\n\n // NOTE(alexkirsz) This can fail when the module encounters a runtime error.\n try {\n const r = commonJsRequire.bind(null, module)\n moduleFactory.call(module.exports, {\n a: asyncModule.bind(null, module),\n e: module.exports,\n r,\n t: runtimeRequire,\n x: externalRequire,\n y: externalImport,\n f: moduleContext,\n i: esmImport.bind(null, module),\n s: esmExport.bind(null, module, module.exports),\n j: dynamicExport.bind(null, module, module.exports),\n v: exportValue.bind(null, module),\n n: exportNamespace.bind(null, module),\n m: module,\n c: moduleCache,\n M: moduleFactories,\n l: loadChunkAsync.bind(null, { type: SourceType.Parent, parentId: id }),\n L: loadChunkAsyncByUrl.bind(null, {\n type: SourceType.Parent,\n parentId: id,\n }),\n w: loadWebAssembly,\n u: loadWebAssemblyModule,\n P: resolveAbsolutePath,\n U: relativeURL,\n R: createResolvePathFromModule(r),\n b: getWorkerBlobURL,\n z: requireStub,\n })\n } catch (error) {\n module.error = error as any\n throw error\n }\n\n module.loaded = true\n if (module.namespaceObject && module.exports !== module.namespaceObject) {\n // in case of a circular dependency: cjs1 -> esm2 -> cjs1\n interopEsm(module.exports, module.namespaceObject)\n }\n\n return module\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it if it is not cached.\n */\n// @ts-ignore\nfunction getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: Module\n): Module {\n const module = moduleCache[id]\n\n if (module) {\n return module\n }\n\n return instantiateModule(id, {\n type: SourceType.Parent,\n parentId: sourceModule.id,\n })\n}\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n return instantiateModule(moduleId, { type: SourceType.Runtime, chunkPath })\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it as a runtime module if it is not cached.\n */\n// @ts-ignore TypeScript doesn't separate this module space from the browser runtime\nfunction getOrInstantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n const module = moduleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n return instantiateRuntimeModule(moduleId, chunkPath)\n}\n\nconst regexJsUrl = /\\.js(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment.\n */\nfunction isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {\n return regexJsUrl.test(chunkUrlOrPath)\n}\n\nmodule.exports = {\n getOrInstantiateRuntimeModule,\n loadChunk,\n}\n"],"names":[],"mappings":"AAAA,oDAAoD,GAEpD,mDAAmD;AACnD,+DAA+D;AAC/D,+DAA+D;AAC/D,0DAA0D;AAE1D,IAAA,AAAK,oCAAA;AACH;;;GAGC;AAED;;GAEC;OARE;EAAA;AAsBL,QAAQ,GAAG,CAAC,SAAS,GAAG;AAExB,SAAS,oBAAoB,MAAkB;AAC7C,OAAQ,OAAO,IAAI;AACjB;AACE,OAAO,CAAC,kBAAkB,EAAE,OAAO,SAAS,EAAE;AAChD;AACE,OAAO,CAAC,cAAc,EAAE,OAAO,QAAQ,EAAE;AAC3C;AACE,UAAU,QAAQ,CAAC,SAAW,CAAC,qBAAqB,EAAE,QAAQ,MAAM;AACxE;AACF;AAoBA,MAAM,MAAM,QAAQ;AACpB,MAAM,KAAK,QAAQ;AAEnB,MAAM,kBAAmC,OAAO,MAAM,CAAC;AACvD,MAAM,cAAmC,OAAO,MAAM,CAAC;AAEvD;;CAEC,GACD,SAAS,4BACP,QAAuC;AAEvC,OAAO,SAAS,sBAAsB,QAAgB;AACpD,MAAM,WAAW,SAAS;AAC1B,MAAM,eAAe,UAAU,WAAW;AAC1C,IAAI,OAAO,iBAAiB,UAAU;AACpC,OAAO;AACT;AAEA,MAAM,sBAAsB,aAAa,KAAK,CAAC,aAAa,MAAM;AAClE,MAAM,WAAW,KAAK,OAAO,CAAC,cAAc;AAE5C,OAAO,IAAI,aAAa,CAAC,UAAU,IAAI;AACzC;AACF;AAEA,SAAS,UAAU,SAAoB,EAAE,MAAmB;AAC1D,IAAI,OAAO,cAAc,UAAU;AACjC,OAAO,cAAc,WAAW;AAClC,OAAO;AACL,OAAO,cAAc,UAAU,IAAI,EAAE;AACvC;AACF;AAEA,MAAM,e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IAAI,QAAO,eAAe,IAAI,QAAO,OAAO,KAAK,QAAO,eAAe,EAAE;AACvE,yDAAyD;AACzD,WAAW,QAAO,OAAO,EAAE,QAAO,eAAe;AACnD;AAEA,OAAO;AACT;AAEA;;CAEC,GACD,aAAa;AACb,SAAS,iCACP,EAAY,EACZ,YAAoB;AAEpB,MAAM,UAAS,WAAW,CAAC,GAAG;AAE9B,IAAI,SAAQ;AACV,OAAO;AACT;AAEA,OAAO,kBAAkB,IAAI;AAC3B,IAAI;AACJ,UAAU,aAAa,EAAE;AAC3B;AACF;AAEA;;CAEC,GACD,SAAS,yBACP,QAAkB,EAClB,SAAoB;AAEpB,OAAO,kBAAkB,UAAU;AAAE,IAAI;AAAsB;AAAU;AAC3E;AAEA;;CAEC,GACD,oFAAoF;AACpF,SAAS,8BACP,QAAkB,EAClB,SAAoB;AAEpB,MAAM,UAAS,WAAW,CAAC,SAAS;AACpC,IAAI,SAAQ;AACV,IAAI,QAAO,KAAK,EAAE;AAChB,MAAM,QAAO,KAAK;AACpB;AACA,OAAO;AACT;AAEA,OAAO,yBAAyB,UAAU;AAC5C;AAEA,MAAM,aAAa;AACnB;;CAEC,GACD,SAAS,KAAK,cAAoC;AAChD,OAAO,WAAW,IAAI,CAAC;AACzB;AAEA,OAAO,OAAO,GAAG;AACf;AACA;AACF","ignoreList":[0]}}] + {"offset": {"line": 3, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime-utils.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * TurboPack ECMAScript runtimes.\n *\n * It will be prepended to the runtime code of each runtime.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n\ntype EsmNamespaceObject = Record\n\n// @ts-ignore Defined in `dev-base.ts`\ndeclare function getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: M\n): M\n\nconst REEXPORTED_OBJECTS = Symbol('reexported objects')\n\ntype ModuleContextMap = Record\n\ninterface ModuleContextEntry {\n id: () => ModuleId\n module: () => any\n}\n\ninterface ModuleContext {\n // require call\n (moduleId: ModuleId): Exports | EsmNamespaceObject\n\n // async import call\n import(moduleId: ModuleId): Promise\n\n keys(): ModuleId[]\n\n resolve(moduleId: ModuleId): ModuleId\n}\n\ntype GetOrInstantiateModuleFromParent = (\n moduleId: ModuleId,\n parentModule: M\n) => M\n\ndeclare function getOrInstantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty\nconst toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag\n\nfunction defineProp(\n obj: any,\n name: PropertyKey,\n options: PropertyDescriptor & ThisType\n) {\n if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options)\n}\n\nfunction getOverwrittenModule(\n moduleCache: ModuleCache,\n id: ModuleId\n): Module {\n let module = moduleCache[id]\n if (!module) {\n // This is invoked when a module is merged into another module, thus it wasn't invoced via\n // instantiateModule and the cache entry wasn't created yet.\n module = {\n exports: {},\n error: undefined,\n loaded: false,\n id,\n namespaceObject: undefined,\n }\n moduleCache[id] = module\n }\n return module\n}\n\n/**\n * Adds the getters to the exports object.\n */\nfunction esm(\n exports: Exports,\n getters: Record any) | [() => any, (v: any) => void]>\n) {\n defineProp(exports, '__esModule', { value: true })\n if (toStringTag) defineProp(exports, toStringTag, { value: 'Module' })\n for (const key in getters) {\n const item = getters[key]\n if (Array.isArray(item)) {\n defineProp(exports, key, {\n get: item[0],\n set: item[1],\n enumerable: true,\n })\n } else {\n defineProp(exports, key, { get: item, enumerable: true })\n }\n }\n Object.seal(exports)\n}\n\n/**\n * Makes the module an ESM with exports\n */\nfunction esmExport(\n module: Module,\n exports: Exports,\n moduleCache: ModuleCache,\n getters: Record any>,\n id: ModuleId | undefined\n) {\n if (id != null) {\n module = getOverwrittenModule(moduleCache, id)\n exports = module.exports\n }\n module.namespaceObject = module.exports\n esm(exports, getters)\n}\n\nfunction ensureDynamicExports(module: Module, exports: Exports) {\n let reexportedObjects = module[REEXPORTED_OBJECTS]\n\n if (!reexportedObjects) {\n reexportedObjects = module[REEXPORTED_OBJECTS] = []\n module.exports = module.namespaceObject = new Proxy(exports, {\n get(target, prop) {\n if (\n hasOwnProperty.call(target, prop) ||\n prop === 'default' ||\n prop === '__esModule'\n ) {\n return Reflect.get(target, prop)\n }\n for (const obj of reexportedObjects!) {\n const value = Reflect.get(obj, prop)\n if (value !== undefined) return value\n }\n return undefined\n },\n ownKeys(target) {\n const keys = Reflect.ownKeys(target)\n for (const obj of reexportedObjects!) {\n for (const key of Reflect.ownKeys(obj)) {\n if (key !== 'default' && !keys.includes(key)) keys.push(key)\n }\n }\n return keys\n },\n })\n }\n}\n\n/**\n * Dynamically exports properties from an object\n */\nfunction dynamicExport(\n module: Module,\n exports: Exports,\n moduleCache: ModuleCache,\n object: Record,\n id: ModuleId | undefined\n) {\n if (id != null) {\n module = getOverwrittenModule(moduleCache, id)\n exports = module.exports\n }\n ensureDynamicExports(module, exports)\n\n if (typeof object === 'object' && object !== null) {\n module[REEXPORTED_OBJECTS]!.push(object)\n }\n}\n\nfunction exportValue(\n module: Module,\n moduleCache: ModuleCache,\n value: any,\n id: ModuleId | undefined\n) {\n if (id != null) {\n module = getOverwrittenModule(moduleCache, id)\n }\n module.exports = value\n}\n\nfunction exportNamespace(\n module: Module,\n moduleCache: ModuleCache,\n namespace: any,\n id: ModuleId | undefined\n) {\n if (id != null) {\n module = getOverwrittenModule(moduleCache, id)\n }\n module.exports = module.namespaceObject = namespace\n}\n\nfunction createGetter(obj: Record, key: string | symbol) {\n return () => obj[key]\n}\n\n/**\n * @returns prototype of the object\n */\nconst getProto: (obj: any) => any = Object.getPrototypeOf\n ? (obj) => Object.getPrototypeOf(obj)\n : (obj) => obj.__proto__\n\n/** Prototypes that are not expanded for exports */\nconst LEAF_PROTOTYPES = [null, getProto({}), getProto([]), getProto(getProto)]\n\n/**\n * @param raw\n * @param ns\n * @param allowExportDefault\n * * `false`: will have the raw module as default export\n * * `true`: will have the default property as default export\n */\nfunction interopEsm(\n raw: Exports,\n ns: EsmNamespaceObject,\n allowExportDefault?: boolean\n) {\n const getters: { [s: string]: () => any } = Object.create(null)\n for (\n let current = raw;\n (typeof current === 'object' || typeof current === 'function') &&\n !LEAF_PROTOTYPES.includes(current);\n current = getProto(current)\n ) {\n for (const key of Object.getOwnPropertyNames(current)) {\n getters[key] = createGetter(raw, key)\n }\n }\n\n // this is not really correct\n // we should set the `default` getter if the imported module is a `.cjs file`\n if (!(allowExportDefault && 'default' in getters)) {\n getters['default'] = () => raw\n }\n\n esm(ns, getters)\n return ns\n}\n\nfunction createNS(raw: Module['exports']): EsmNamespaceObject {\n if (typeof raw === 'function') {\n return function (this: any, ...args: any[]) {\n return raw.apply(this, args)\n }\n } else {\n return Object.create(null)\n }\n}\n\nfunction esmImport(\n sourceModule: Module,\n id: ModuleId\n): Exclude {\n const module = getOrInstantiateModuleFromParent(id, sourceModule)\n if (module.error) throw module.error\n\n // any ES module has to have `module.namespaceObject` defined.\n if (module.namespaceObject) return module.namespaceObject\n\n // only ESM can be an async module, so we don't need to worry about exports being a promise here.\n const raw = module.exports\n return (module.namespaceObject = interopEsm(\n raw,\n createNS(raw),\n raw && (raw as any).__esModule\n ))\n}\n\n// Add a simple runtime require so that environments without one can still pass\n// `typeof require` CommonJS checks so that exports are correctly registered.\nconst runtimeRequire =\n // @ts-ignore\n typeof require === 'function'\n ? // @ts-ignore\n require\n : function require() {\n throw new Error('Unexpected use of runtime require')\n }\n\nfunction commonJsRequire(sourceModule: Module, id: ModuleId): Exports {\n const module = getOrInstantiateModuleFromParent(id, sourceModule)\n if (module.error) throw module.error\n return module.exports\n}\n\n/**\n * `require.context` and require/import expression runtime.\n */\nfunction moduleContext(map: ModuleContextMap): ModuleContext {\n function moduleContext(id: ModuleId): Exports {\n if (hasOwnProperty.call(map, id)) {\n return map[id].module()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.keys = (): ModuleId[] => {\n return Object.keys(map)\n }\n\n moduleContext.resolve = (id: ModuleId): ModuleId => {\n if (hasOwnProperty.call(map, id)) {\n return map[id].id()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.import = async (id: ModuleId) => {\n return await (moduleContext(id) as Promise)\n }\n\n return moduleContext\n}\n\n/**\n * Returns the path of a chunk defined by its data.\n */\nfunction getChunkPath(chunkData: ChunkData): ChunkPath {\n return typeof chunkData === 'string' ? chunkData : chunkData.path\n}\n\nfunction isPromise(maybePromise: any): maybePromise is Promise {\n return (\n maybePromise != null &&\n typeof maybePromise === 'object' &&\n 'then' in maybePromise &&\n typeof maybePromise.then === 'function'\n )\n}\n\nfunction isAsyncModuleExt(obj: T): obj is AsyncModuleExt & T {\n return turbopackQueues in obj\n}\n\nfunction createPromise() {\n let resolve: (value: T | PromiseLike) => void\n let reject: (reason?: any) => void\n\n const promise = new Promise((res, rej) => {\n reject = rej\n resolve = res\n })\n\n return {\n promise,\n resolve: resolve!,\n reject: reject!,\n }\n}\n\n// everything below is adapted from webpack\n// https://github.com/webpack/webpack/blob/6be4065ade1e252c1d8dcba4af0f43e32af1bdc1/lib/runtime/AsyncModuleRuntimeModule.js#L13\n\nconst turbopackQueues = Symbol('turbopack queues')\nconst turbopackExports = Symbol('turbopack exports')\nconst turbopackError = Symbol('turbopack error')\n\nconst enum QueueStatus {\n Unknown = -1,\n Unresolved = 0,\n Resolved = 1,\n}\n\ntype AsyncQueueFn = (() => void) & { queueCount: number }\ntype AsyncQueue = AsyncQueueFn[] & {\n status: QueueStatus\n}\n\nfunction resolveQueue(queue?: AsyncQueue) {\n if (queue && queue.status !== QueueStatus.Resolved) {\n queue.status = QueueStatus.Resolved\n queue.forEach((fn) => fn.queueCount--)\n queue.forEach((fn) => (fn.queueCount-- ? fn.queueCount++ : fn()))\n }\n}\n\ntype Dep = Exports | AsyncModulePromise | Promise\n\ntype AsyncModuleExt = {\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => void\n [turbopackExports]: Exports\n [turbopackError]?: any\n}\n\ntype AsyncModulePromise = Promise & AsyncModuleExt\n\nfunction wrapDeps(deps: Dep[]): AsyncModuleExt[] {\n return deps.map((dep): AsyncModuleExt => {\n if (dep !== null && typeof dep === 'object') {\n if (isAsyncModuleExt(dep)) return dep\n if (isPromise(dep)) {\n const queue: AsyncQueue = Object.assign([], {\n status: QueueStatus.Unresolved,\n })\n\n const obj: AsyncModuleExt = {\n [turbopackExports]: {},\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => fn(queue),\n }\n\n dep.then(\n (res) => {\n obj[turbopackExports] = res\n resolveQueue(queue)\n },\n (err) => {\n obj[turbopackError] = err\n resolveQueue(queue)\n }\n )\n\n return obj\n }\n }\n\n return {\n [turbopackExports]: dep,\n [turbopackQueues]: () => {},\n }\n })\n}\n\nfunction asyncModule(\n module: Module,\n body: (\n handleAsyncDependencies: (\n deps: Dep[]\n ) => Exports[] | Promise<() => Exports[]>,\n asyncResult: (err?: any) => void\n ) => void,\n hasAwait: boolean\n) {\n const queue: AsyncQueue | undefined = hasAwait\n ? Object.assign([], { status: QueueStatus.Unknown })\n : undefined\n\n const depQueues: Set = new Set()\n\n const { resolve, reject, promise: rawPromise } = createPromise()\n\n const promise: AsyncModulePromise = Object.assign(rawPromise, {\n [turbopackExports]: module.exports,\n [turbopackQueues]: (fn) => {\n queue && fn(queue)\n depQueues.forEach(fn)\n promise['catch'](() => {})\n },\n } satisfies AsyncModuleExt)\n\n const attributes: PropertyDescriptor = {\n get(): any {\n return promise\n },\n set(v: any) {\n // Calling `esmExport` leads to this.\n if (v !== promise) {\n promise[turbopackExports] = v\n }\n },\n }\n\n Object.defineProperty(module, 'exports', attributes)\n Object.defineProperty(module, 'namespaceObject', attributes)\n\n function handleAsyncDependencies(deps: Dep[]) {\n const currentDeps = wrapDeps(deps)\n\n const getResult = () =>\n currentDeps.map((d) => {\n if (d[turbopackError]) throw d[turbopackError]\n return d[turbopackExports]\n })\n\n const { promise, resolve } = createPromise<() => Exports[]>()\n\n const fn: AsyncQueueFn = Object.assign(() => resolve(getResult), {\n queueCount: 0,\n })\n\n function fnQueue(q: AsyncQueue) {\n if (q !== queue && !depQueues.has(q)) {\n depQueues.add(q)\n if (q && q.status === QueueStatus.Unresolved) {\n fn.queueCount++\n q.push(fn)\n }\n }\n }\n\n currentDeps.map((dep) => dep[turbopackQueues](fnQueue))\n\n return fn.queueCount ? promise : getResult()\n }\n\n function asyncResult(err?: any) {\n if (err) {\n reject((promise[turbopackError] = err))\n } else {\n resolve(promise[turbopackExports])\n }\n\n resolveQueue(queue)\n }\n\n body(handleAsyncDependencies, asyncResult)\n\n if (queue && queue.status === QueueStatus.Unknown) {\n queue.status = QueueStatus.Unresolved\n }\n}\n\n/**\n * A pseudo \"fake\" URL object to resolve to its relative path.\n *\n * When UrlRewriteBehavior is set to relative, calls to the `new URL()` will construct url without base using this\n * runtime function to generate context-agnostic urls between different rendering context, i.e ssr / client to avoid\n * hydration mismatch.\n *\n * This is based on webpack's existing implementation:\n * https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/runtime/RelativeUrlRuntimeModule.js\n */\nconst relativeURL = function relativeURL(this: any, inputUrl: string) {\n const realUrl = new URL(inputUrl, 'x:/')\n const values: Record = {}\n for (const key in realUrl) values[key] = (realUrl as any)[key]\n values.href = inputUrl\n values.pathname = inputUrl.replace(/[?#].*/, '')\n values.origin = values.protocol = ''\n values.toString = values.toJSON = (..._args: Array) => inputUrl\n for (const key in values)\n Object.defineProperty(this, key, {\n enumerable: true,\n configurable: true,\n value: values[key],\n })\n}\n\nrelativeURL.prototype = URL.prototype\n\n/**\n * Utility function to ensure all variants of an enum are handled.\n */\nfunction invariant(never: never, computeMessage: (arg: any) => string): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n}\n\n/**\n * A stub function to make `require` available but non-functional in ESM.\n */\nfunction requireStub(_moduleId: ModuleId): never {\n throw new Error('dynamic usage of require is not supported')\n}\n"],"names":[],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,6CAA6C;AAU7C,MAAM,qBAAqB,OAAO;AA+BlC,MAAM,iBAAiB,OAAO,SAAS,CAAC,cAAc;AACtD,MAAM,cAAc,OAAO,WAAW,eAAe,OAAO,WAAW;AAEvE,SAAS,WACP,GAAQ,EACR,IAAiB,EACjB,OAA2C;AAE3C,IAAI,CAAC,eAAe,IAAI,CAAC,KAAK,OAAO,OAAO,cAAc,CAAC,KAAK,MAAM;AACxE;AAEA,SAAS,qBACP,WAAgC,EAChC,EAAY;AAEZ,IAAI,SAAS,WAAW,CAAC,GAAG;AAC5B,IAAI,CAAC,QAAQ;AACX,0FAA0F;AAC1F,4DAA4D;AAC5D,SAAS;AACP,SAAS,CAAC;AACV,OAAO;AACP,QAAQ;AACR;AACA,iBAAiB;AACnB;AACA,WAAW,CAAC,GAAG,GAAG;AACpB;AACA,OAAO;AACT;AAEA;;CAEC,GACD,SAAS,IACP,OAAgB,EAChB,OAAoE;AAEpE,WAAW,SAAS,cAAc;AAAE,OAAO;AAAK;AAChD,IAAI,aAAa,WAAW,SAAS,aAAa;AAAE,OAAO;AAAS;AACpE,IAAK,MAAM,OAAO,QAAS;AACzB,MAAM,OAAO,OAAO,CAAC,IAAI;AACzB,IAAI,MAAM,OAAO,CAAC,OAAO;AACvB,WAAW,SAAS,KAAK;AACvB,KAAK,IAAI,CAAC,EAAE;AACZ,KAAK,IAAI,CAAC,EAAE;AACZ,YAAY;AACd;AACF,OAAO;AACL,WAAW,SAAS,KAAK;AAAE,KAAK;AAAM,YAAY;AAAK;AACzD;AACF;AACA,OAAO,IAAI,CAAC;AACd;AAEA;;CAEC,GACD,SAAS,UACP,MAAc,EACd,OAAgB,EAChB,WAAgC,EAChC,OAAkC,EAClC,EAAwB;AAExB,IAAI,MAAM,MAAM;AACd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G,CAAC,CAAC,MAAQ,GAAG,CAAC,gBAAgB,CAAC;AAE9C,OAAO,GAAG,UAAU,GAAG,UAAU;AACnC;AAEA,SAAS,YAAY,GAAS;AAC5B,IAAI,KAAK;AACP,OAAQ,OAAO,CAAC,eAAe,GAAG;AACpC,OAAO;AACL,QAAQ,OAAO,CAAC,iBAAiB;AACnC;AAEA,aAAa;AACf;AAEA,KAAK,yBAAyB;AAE9B,IAAI,SAAS,MAAM,MAAM,SAA0B;AACjD,MAAM,MAAM;AACd;AACF;AAEA;;;;;;;;;CASC,GACD,MAAM,cAAc,SAAS,YAAuB,QAAgB;AAClE,MAAM,UAAU,IAAI,IAAI,UAAU;AAClC,MAAM,SAA8B,CAAC;AACrC,IAAK,MAAM,OAAO,QAAS,MAAM,CAAC,IAAI,GAAG,AAAC,OAAe,CAAC,IAAI;AAC9D,OAAO,IAAI,GAAG;AACd,OAAO,QAAQ,GAAG,SAAS,OAAO,CAAC,UAAU;AAC7C,OAAO,MAAM,GAAG,OAAO,QAAQ,GAAG;AAClC,OAAO,QAAQ,GAAG,OAAO,MAAM,GAAG,CAAC,GAAG,QAAsB;AAC5D,IAAK,MAAM,OAAO,OAChB,OAAO,cAAc,CAAC,IAAI,EAAE,KAAK;AAC/B,YAAY;AACZ,cAAc;AACd,OAAO,MAAM,CAAC,IAAI;AACpB;AACJ;AAEA,YAAY,SAAS,GAAG,IAAI,SAAS;AAErC;;CAEC,GACD,SAAS,UAAU,KAAY,EAAE,cAAoC;AACnE,MAAM,IAAI,MAAM,CAAC,WAAW,EAAE,eAAe,QAAQ;AACvD;AAEA;;CAEC,GACD,SAAS,YAAY,SAAmB;AACtC,MAAM,IAAI,MAAM;AAClB","ignoreList":[0]}}, + {"offset": {"line": 367, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared-node/base-externals-utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n\n/// A 'base' utilities to support runtime can have externals.\n/// Currently this is for node.js / edge runtime both.\n/// If a fn requires node.js specific behavior, it should be placed in `node-external-utils` instead.\n\nasync function externalImport(id: ModuleId) {\n let raw\n try {\n raw = await import(id)\n } catch (err) {\n // TODO(alexkirsz) This can happen when a client-side module tries to load\n // an external module we don't provide a shim for (e.g. querystring, url).\n // For now, we fail semi-silently, but in the future this should be a\n // compilation error.\n throw new Error(`Failed to load external module ${id}: ${err}`)\n }\n\n if (raw && raw.__esModule && raw.default && 'default' in raw.default) {\n return interopEsm(raw.default, createNS(raw), true)\n }\n\n return raw\n}\n\nfunction externalRequire(\n id: ModuleId,\n thunk: () => any,\n esm: boolean = false\n): Exports | EsmNamespaceObject {\n let raw\n try {\n raw = thunk()\n } catch (err) {\n // TODO(alexkirsz) This can happen when a client-side module tries to load\n // an external module we don't provide a shim for (e.g. querystring, url).\n // For now, we fail semi-silently, but in the future this should be a\n // compilation error.\n throw new Error(`Failed to load external module ${id}: ${err}`)\n }\n\n if (!esm || raw.__esModule) {\n return raw\n }\n\n return interopEsm(raw, createNS(raw), true)\n}\n\nexternalRequire.resolve = (\n id: string,\n options?: {\n paths?: string[]\n }\n) => {\n return require.resolve(id, options)\n}\n"],"names":[],"mappings":"AAAA,oDAAoD,GAEpD,mDAAmD;AAEnD,6DAA6D;AAC7D,sDAAsD;AACtD,qGAAqG;AAErG,eAAe,eAAe,EAAY;AACxC,IAAI;AACJ,IAAI;AACF,MAAM,MAAM,MAAM,CAAC;AACrB,EAAE,OAAO,KAAK;AACZ,0EAA0E;AAC1E,0EAA0E;AAC1E,qEAAqE;AACrE,qBAAqB;AACrB,MAAM,IAAI,MAAM,CAAC,+BAA+B,EAAE,GAAG,EAAE,EAAE,KAAK;AAChE;AAEA,IAAI,OAAO,IAAI,UAAU,IAAI,IAAI,OAAO,IAAI,aAAa,IAAI,OAAO,EAAE;AACpE,OAAO,WAAW,IAAI,OAAO,EAAE,SAAS,MAAM;AAChD;AAEA,OAAO;AACT;AAEA,SAAS,gBACP,EAAY,EACZ,KAAgB,EAChB,MAAe,KAAK;AAEpB,IAAI;AACJ,IAAI;AACF,MAAM;AACR,EAAE,OAAO,KAAK;AACZ,0EAA0E;AAC1E,0EAA0E;AAC1E,qEAAqE;AACrE,qBAAqB;AACrB,MAAM,IAAI,MAAM,CAAC,+BAA+B,EAAE,GAAG,EAAE,EAAE,KAAK;AAChE;AAEA,IAAI,CAAC,OAAO,IAAI,UAAU,EAAE;AAC1B,OAAO;AACT;AAEA,OAAO,WAAW,KAAK,SAAS,MAAM;AACxC;AAEA,gBAAgB,OAAO,GAAG,CACxB,IACA;AAIA,OAAO,QAAQ,OAAO,CAAC,IAAI;AAC7B","ignoreList":[0]}}, + {"offset": {"line": 406, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared-node/node-externals-utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\ndeclare var RUNTIME_PUBLIC_PATH: string\ndeclare var RELATIVE_ROOT_PATH: string\ndeclare var ASSET_PREFIX: string\n\nconst path = require('path')\n\nconst relativePathToRuntimeRoot = path.relative(RUNTIME_PUBLIC_PATH, '.')\n// Compute the relative path to the `distDir`.\nconst relativePathToDistRoot = path.join(\n relativePathToRuntimeRoot,\n RELATIVE_ROOT_PATH\n)\nconst RUNTIME_ROOT = path.resolve(__filename, relativePathToRuntimeRoot)\n// Compute the absolute path to the root, by stripping distDir from the absolute path to this file.\nconst ABSOLUTE_ROOT = path.resolve(__filename, relativePathToDistRoot)\n\n/**\n * Returns an absolute path to the given module path.\n * Module path should be relative, either path to a file or a directory.\n *\n * This fn allows to calculate an absolute path for some global static values, such as\n * `__dirname` or `import.meta.url` that Turbopack will not embeds in compile time.\n * See ImportMetaBinding::code_generation for the usage.\n */\nfunction resolveAbsolutePath(modulePath?: string): string {\n if (modulePath) {\n return path.join(ABSOLUTE_ROOT, modulePath)\n }\n return ABSOLUTE_ROOT\n}\n"],"names":[],"mappings":"AAAA,oDAAoD,GAMpD,MAAM,OAAO,QAAQ;AAErB,MAAM,4BAA4B,KAAK,QAAQ,CAAC,qBAAqB;AACrE,8CAA8C;AAC9C,MAAM,yBAAyB,KAAK,IAAI,CACtC,2BACA;AAEF,MAAM,eAAe,KAAK,OAAO,CAAC,YAAY;AAC9C,mGAAmG;AACnG,MAAM,gBAAgB,KAAK,OAAO,CAAC,YAAY;AAE/C;;;;;;;CAOC,GACD,SAAS,oBAAoB,UAAmB;AAC9C,IAAI,YAAY;AACd,OAAO,KAAK,IAAI,CAAC,eAAe;AAClC;AACA,OAAO;AACT","ignoreList":[0]}}, + {"offset": {"line": 426, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared-node/node-wasm-utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n\nfunction readWebAssemblyAsResponse(path: string) {\n const { createReadStream } = require('fs') as typeof import('fs')\n const { Readable } = require('stream') as typeof import('stream')\n\n const stream = createReadStream(path)\n\n // @ts-ignore unfortunately there's a slight type mismatch with the stream.\n return new Response(Readable.toWeb(stream), {\n headers: {\n 'content-type': 'application/wasm',\n },\n })\n}\n\nasync function compileWebAssemblyFromPath(\n path: string\n): Promise {\n const response = readWebAssemblyAsResponse(path)\n\n return await WebAssembly.compileStreaming(response)\n}\n\nasync function instantiateWebAssemblyFromPath(\n path: string,\n importsObj: WebAssembly.Imports\n): Promise {\n const response = readWebAssemblyAsResponse(path)\n\n const { instance } = await WebAssembly.instantiateStreaming(\n response,\n importsObj\n )\n\n return instance.exports\n}\n"],"names":[],"mappings":"AAAA,oDAAoD,GAEpD,mDAAmD;AAEnD,SAAS,0BAA0B,IAAY;AAC7C,MAAM,EAAE,gBAAgB,EAAE,GAAG,QAAQ;AACrC,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ;AAE7B,MAAM,SAAS,iBAAiB;AAEhC,2EAA2E;AAC3E,OAAO,IAAI,SAAS,SAAS,KAAK,CAAC,SAAS;AAC1C,SAAS;AACP,gBAAgB;AAClB;AACF;AACF;AAEA,eAAe,2BACb,IAAY;AAEZ,MAAM,WAAW,0BAA0B;AAE3C,OAAO,MAAM,YAAY,gBAAgB,CAAC;AAC5C;AAEA,eAAe,+BACb,IAAY,EACZ,UAA+B;AAE/B,MAAM,WAAW,0BAA0B;AAE3C,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,YAAY,oBAAoB,CACzD,UACA;AAGF,OAAO,SAAS,OAAO;AACzB","ignoreList":[0]}}, + {"offset": {"line": 447, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/nodejs/runtime.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n/// \n/// \n\nenum SourceType {\n /**\n * The module was instantiated because it was included in an evaluated chunk's\n * runtime.\n */\n Runtime = 0,\n /**\n * The module was instantiated because a parent module imported it.\n */\n Parent = 1,\n}\n\ntype SourceInfo =\n | {\n type: SourceType.Runtime\n chunkPath: ChunkPath\n }\n | {\n type: SourceType.Parent\n parentId: ModuleId\n }\n\nprocess.env.TURBOPACK = '1'\n\nfunction stringifySourceInfo(source: SourceInfo): string {\n switch (source.type) {\n case SourceType.Runtime:\n return `runtime for chunk ${source.chunkPath}`\n case SourceType.Parent:\n return `parent module ${source.parentId}`\n default:\n invariant(source, (source) => `Unknown source type: ${source?.type}`)\n }\n}\n\ntype ExternalRequire = (\n id: ModuleId,\n thunk: () => any,\n esm?: boolean\n) => Exports | EsmNamespaceObject\ntype ExternalImport = (id: ModuleId) => Promise\n\ninterface TurbopackNodeBuildContext extends TurbopackBaseContext {\n R: ResolvePathFromModule\n x: ExternalRequire\n y: ExternalImport\n}\n\ntype ModuleFactory = (\n this: Module['exports'],\n context: TurbopackNodeBuildContext\n) => unknown\n\nconst url = require('url') as typeof import('url')\nconst fs = require('fs/promises') as typeof import('fs/promises')\n\nconst moduleFactories: ModuleFactories = Object.create(null)\nconst moduleCache: ModuleCache = Object.create(null)\n\n/**\n * Returns an absolute path to the given module's id.\n */\nfunction createResolvePathFromModule(\n resolver: (moduleId: string) => Exports\n): (moduleId: string) => string {\n return function resolvePathFromModule(moduleId: string): string {\n const exported = resolver(moduleId)\n const exportedPath = exported?.default ?? exported\n if (typeof exportedPath !== 'string') {\n return exported as any\n }\n\n const strippedAssetPrefix = exportedPath.slice(ASSET_PREFIX.length)\n const resolved = path.resolve(RUNTIME_ROOT, strippedAssetPrefix)\n\n return url.pathToFileURL(resolved).href\n }\n}\n\nfunction loadChunk(chunkData: ChunkData, source?: SourceInfo): void {\n if (typeof chunkData === 'string') {\n return loadChunkPath(chunkData, source)\n } else {\n return loadChunkPath(chunkData.path, source)\n }\n}\n\nconst loadedChunks = new Set()\n\nfunction loadChunkPath(chunkPath: ChunkPath, source?: SourceInfo): void {\n if (!isJs(chunkPath)) {\n // We only support loading JS chunks in Node.js.\n // This branch can be hit when trying to load a CSS chunk.\n return\n }\n\n if (loadedChunks.has(chunkPath)) {\n return\n }\n\n try {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n const chunkModules: CompressedModuleFactories = require(resolved)\n\n for (const [moduleId, moduleFactory] of Object.entries(chunkModules)) {\n if (!moduleFactories[moduleId]) {\n if (Array.isArray(moduleFactory)) {\n let [moduleFactoryFn, otherIds] = moduleFactory\n moduleFactories[moduleId] = moduleFactoryFn\n for (const otherModuleId of otherIds) {\n moduleFactories[otherModuleId] = moduleFactoryFn\n }\n } else {\n moduleFactories[moduleId] = moduleFactory\n }\n }\n }\n loadedChunks.add(chunkPath)\n } catch (e) {\n let errorMessage = `Failed to load chunk ${chunkPath}`\n\n if (source) {\n errorMessage += ` from ${stringifySourceInfo(source)}`\n }\n\n throw new Error(errorMessage, {\n cause: e,\n })\n }\n}\n\nasync function loadChunkAsync(\n source: SourceInfo,\n chunkData: ChunkData\n): Promise {\n const chunkPath = typeof chunkData === 'string' ? chunkData : chunkData.path\n if (!isJs(chunkPath)) {\n // We only support loading JS chunks in Node.js.\n // This branch can be hit when trying to load a CSS chunk.\n return\n }\n\n if (loadedChunks.has(chunkPath)) {\n return\n }\n\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n\n try {\n const contents = await fs.readFile(resolved, 'utf-8')\n\n const localRequire = (id: string) => {\n let resolvedId = require.resolve(id, { paths: [path.dirname(resolved)] })\n return require(resolvedId)\n }\n const module = {\n exports: {},\n }\n // TODO: Use vm.runInThisContext once our minimal supported Node.js version includes https://github.com/nodejs/node/pull/52153\n // eslint-disable-next-line no-eval -- Can't use vm.runInThisContext due to https://github.com/nodejs/node/issues/52102\n ;(0, eval)(\n '(function(module, exports, require, __dirname, __filename) {' +\n contents +\n '\\n})' +\n '\\n//# sourceURL=' +\n url.pathToFileURL(resolved)\n )(module, module.exports, localRequire, path.dirname(resolved), resolved)\n\n const chunkModules: CompressedModuleFactories = module.exports\n for (const [moduleId, moduleFactory] of Object.entries(chunkModules)) {\n if (!moduleFactories[moduleId]) {\n if (Array.isArray(moduleFactory)) {\n let [moduleFactoryFn, otherIds] = moduleFactory\n moduleFactories[moduleId] = moduleFactoryFn\n for (const otherModuleId of otherIds) {\n moduleFactories[otherModuleId] = moduleFactoryFn\n }\n } else {\n moduleFactories[moduleId] = moduleFactory\n }\n }\n }\n loadedChunks.add(chunkPath)\n } catch (e) {\n let errorMessage = `Failed to load chunk ${chunkPath}`\n\n if (source) {\n errorMessage += ` from ${stringifySourceInfo(source)}`\n }\n\n throw new Error(errorMessage, {\n cause: e,\n })\n }\n}\n\nasync function loadChunkAsyncByUrl(source: SourceInfo, chunkUrl: string) {\n const path = url.fileURLToPath(new URL(chunkUrl, RUNTIME_ROOT)) as ChunkPath\n return loadChunkAsync(source, path)\n}\n\nfunction loadWebAssembly(\n chunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n imports: WebAssembly.Imports\n) {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n\n return instantiateWebAssemblyFromPath(resolved, imports)\n}\n\nfunction loadWebAssemblyModule(\n chunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n) {\n const resolved = path.resolve(RUNTIME_ROOT, chunkPath)\n\n return compileWebAssemblyFromPath(resolved)\n}\n\nfunction getWorkerBlobURL(_chunks: ChunkPath[]): string {\n throw new Error('Worker blobs are not implemented yet for Node.js')\n}\n\nfunction instantiateModule(id: ModuleId, source: SourceInfo): Module {\n const moduleFactory = moduleFactories[id]\n if (typeof moduleFactory !== 'function') {\n // This can happen if modules incorrectly handle HMR disposes/updates,\n // e.g. when they keep a `setTimeout` around which still executes old code\n // and contains e.g. a `require(\"something\")` call.\n let instantiationReason\n switch (source.type) {\n case SourceType.Runtime:\n instantiationReason = `as a runtime entry of chunk ${source.chunkPath}`\n break\n case SourceType.Parent:\n instantiationReason = `because it was required from module ${source.parentId}`\n break\n default:\n invariant(source, (source) => `Unknown source type: ${source?.type}`)\n }\n throw new Error(\n `Module ${id} was instantiated ${instantiationReason}, but the module factory is not available. It might have been deleted in an HMR update.`\n )\n }\n\n const module: Module = {\n exports: {},\n error: undefined,\n loaded: false,\n id,\n namespaceObject: undefined,\n }\n moduleCache[id] = module\n\n // NOTE(alexkirsz) This can fail when the module encounters a runtime error.\n try {\n const r = commonJsRequire.bind(null, module)\n moduleFactory.call(module.exports, {\n a: asyncModule.bind(null, module),\n e: module.exports,\n r,\n t: runtimeRequire,\n x: externalRequire,\n y: externalImport,\n f: moduleContext,\n i: esmImport.bind(null, module),\n s: esmExport.bind(null, module, module.exports, moduleCache),\n j: dynamicExport.bind(null, module, module.exports, moduleCache),\n v: exportValue.bind(null, module, moduleCache),\n n: exportNamespace.bind(null, module, moduleCache),\n m: module,\n c: moduleCache,\n M: moduleFactories,\n l: loadChunkAsync.bind(null, { type: SourceType.Parent, parentId: id }),\n L: loadChunkAsyncByUrl.bind(null, {\n type: SourceType.Parent,\n parentId: id,\n }),\n w: loadWebAssembly,\n u: loadWebAssemblyModule,\n P: resolveAbsolutePath,\n U: relativeURL,\n R: createResolvePathFromModule(r),\n b: getWorkerBlobURL,\n z: requireStub,\n })\n } catch (error) {\n module.error = error as any\n throw error\n }\n\n module.loaded = true\n if (module.namespaceObject && module.exports !== module.namespaceObject) {\n // in case of a circular dependency: cjs1 -> esm2 -> cjs1\n interopEsm(module.exports, module.namespaceObject)\n }\n\n return module\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it if it is not cached.\n */\n// @ts-ignore\nfunction getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: Module\n): Module {\n const module = moduleCache[id]\n\n if (module) {\n return module\n }\n\n return instantiateModule(id, {\n type: SourceType.Parent,\n parentId: sourceModule.id,\n })\n}\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n return instantiateModule(moduleId, { type: SourceType.Runtime, chunkPath })\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it as a runtime module if it is not cached.\n */\n// @ts-ignore TypeScript doesn't separate this module space from the browser runtime\nfunction getOrInstantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n const module = moduleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n return instantiateRuntimeModule(moduleId, chunkPath)\n}\n\nconst regexJsUrl = /\\.js(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment.\n */\nfunction isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {\n return regexJsUrl.test(chunkUrlOrPath)\n}\n\nmodule.exports = {\n getOrInstantiateRuntimeModule,\n loadChunk,\n}\n"],"names":[],"mappings":"AAAA,oDAAoD,GAEpD,mDAAmD;AACnD,+DAA+D;AAC/D,+DAA+D;AAC/D,0DAA0D;AAE1D,IAAA,AAAK,oCAAA;AACH;;;GAGC;AAED;;GAEC;OARE;EAAA;AAsBL,QAAQ,GAAG,CAAC,SAAS,GAAG;AAExB,SAAS,oBAAoB,MAAkB;AAC7C,OAAQ,OAAO,IAAI;AACjB;AACE,OAAO,CAAC,k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AACV,OAAO;AACT;AAEA,OAAO,kBAAkB,IAAI;AAC3B,IAAI;AACJ,UAAU,aAAa,EAAE;AAC3B;AACF;AAEA;;CAEC,GACD,SAAS,yBACP,QAAkB,EAClB,SAAoB;AAEpB,OAAO,kBAAkB,UAAU;AAAE,IAAI;AAAsB;AAAU;AAC3E;AAEA;;CAEC,GACD,oFAAoF;AACpF,SAAS,8BACP,QAAkB,EAClB,SAAoB;AAEpB,MAAM,UAAS,WAAW,CAAC,SAAS;AACpC,IAAI,SAAQ;AACV,IAAI,QAAO,KAAK,EAAE;AAChB,MAAM,QAAO,KAAK;AACpB;AACA,OAAO;AACT;AAEA,OAAO,yBAAyB,UAAU;AAC5C;AAEA,MAAM,aAAa;AACnB;;CAEC,GACD,SAAS,KAAK,cAAoC;AAChD,OAAO,WAAW,IAAI,CAAC;AACzB;AAEA,OAAO,OAAO,GAAG;AACf;AACA;AACF","ignoreList":[0]}}] } \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js b/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js index f9e2368c26f1b..a77d635b0a743 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js @@ -24,6 +24,22 @@ const toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag; function defineProp(obj, name, options) { if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options); } +function getOverwrittenModule(moduleCache, id) { +let module = moduleCache[id]; +if (!module) { +// This is invoked when a module is merged into another module, thus it wasn't invoced via +// instantiateModule and the cache entry wasn't created yet. +module = { +exports: {}, +error: undefined, +loaded: false, +id, +namespaceObject: undefined +}; +moduleCache[id] = module; +} +return module; +} /** * Adds the getters to the exports object. */ function esm(exports, getters) { @@ -52,7 +68,11 @@ Object.seal(exports); } /** * Makes the module an ESM with exports - */ function esmExport(module, exports, getters) { + */ function esmExport(module, exports, moduleCache, getters, id) { +if (id != null) { +module = getOverwrittenModule(moduleCache, id); +exports = module.exports; +} module.namespaceObject = module.exports; esm(exports, getters); } @@ -85,16 +105,26 @@ return keys; } /** * Dynamically exports properties from an object - */ function dynamicExport(module, exports, object) { + */ function dynamicExport(module, exports, moduleCache, object, id) { +if (id != null) { +module = getOverwrittenModule(moduleCache, id); +exports = module.exports; +} ensureDynamicExports(module, exports); if (typeof object === 'object' && object !== null) { module[REEXPORTED_OBJECTS].push(object); } } -function exportValue(module, value) { +function exportValue(module, moduleCache, value, id) { +if (id != null) { +module = getOverwrittenModule(moduleCache, id); +} module.exports = value; } -function exportNamespace(module, namespace) { +function exportNamespace(module, moduleCache, namespace, id) { +if (id != null) { +module = getOverwrittenModule(moduleCache, id); +} module.exports = module.namespaceObject = namespace; } function createGetter(obj, key) { @@ -575,8 +605,16 @@ function registerChunk([chunkScript, chunkModules, runtimeParams]) { const chunkPath = getPathFromScript(chunkScript); for (const [moduleId, moduleFactory] of Object.entries(chunkModules)){ if (!moduleFactories[moduleId]) { +if (Array.isArray(moduleFactory)) { +let [moduleFactoryFn, otherIds] = moduleFactory; +moduleFactories[moduleId] = moduleFactoryFn; +for (const otherModuleId of otherIds){ +moduleFactories[otherModuleId] = moduleFactoryFn; +} +} else { moduleFactories[moduleId] = moduleFactory; } +} addModuleToChunk(moduleId, chunkPath); } return BACKEND.registerChunk(chunkPath, runtimeParams); @@ -731,10 +769,10 @@ r: commonJsRequire.bind(null, module), t: runtimeRequire, f: moduleContext, i: esmImport.bind(null, module), -s: esmExport.bind(null, module, module.exports), -j: dynamicExport.bind(null, module, module.exports), -v: exportValue.bind(null, module), -n: exportNamespace.bind(null, module), +s: esmExport.bind(null, module, module.exports, devModuleCache), +j: dynamicExport.bind(null, module, module.exports, devModuleCache), +v: exportValue.bind(null, module, devModuleCache), +n: exportNamespace.bind(null, module, devModuleCache), m: module, c: devModuleCache, M: moduleFactories, diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js.map index d95cdae01e36e..245003264f303 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js.map +++ b/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/b1abf_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_75df6705.js.map @@ -2,9 +2,9 @@ "version": 3, "sources": [], "sections": [ - {"offset": {"line": 14, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime-utils.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * TurboPack ECMAScript runtimes.\n *\n * It will be prepended to the runtime code of each runtime.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n\ntype EsmNamespaceObject = Record\n\n// @ts-ignore Defined in `dev-base.ts`\ndeclare function getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: M\n): M\n\nconst REEXPORTED_OBJECTS = Symbol('reexported objects')\n\ntype ModuleContextMap = Record\n\ninterface ModuleContextEntry {\n id: () => ModuleId\n module: () => any\n}\n\ninterface ModuleContext {\n // require call\n (moduleId: ModuleId): Exports | EsmNamespaceObject\n\n // async import call\n import(moduleId: ModuleId): Promise\n\n keys(): ModuleId[]\n\n resolve(moduleId: ModuleId): ModuleId\n}\n\ntype GetOrInstantiateModuleFromParent = (\n moduleId: ModuleId,\n parentModule: M\n) => M\n\ndeclare function getOrInstantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty\nconst toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag\n\nfunction defineProp(\n obj: any,\n name: PropertyKey,\n options: PropertyDescriptor & ThisType\n) {\n if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options)\n}\n\n/**\n * Adds the getters to the exports object.\n */\nfunction esm(\n exports: Exports,\n getters: Record any) | [() => any, (v: any) => void]>\n) {\n defineProp(exports, '__esModule', { value: true })\n if (toStringTag) defineProp(exports, toStringTag, { value: 'Module' })\n for (const key in getters) {\n const item = getters[key]\n if (Array.isArray(item)) {\n defineProp(exports, key, {\n get: item[0],\n set: item[1],\n enumerable: true,\n })\n } else {\n defineProp(exports, key, { get: item, enumerable: true })\n }\n }\n Object.seal(exports)\n}\n\n/**\n * Makes the module an ESM with exports\n */\nfunction esmExport(\n module: Module,\n exports: Exports,\n getters: Record any>\n) {\n module.namespaceObject = module.exports\n esm(exports, getters)\n}\n\nfunction ensureDynamicExports(module: Module, exports: Exports) {\n let reexportedObjects = module[REEXPORTED_OBJECTS]\n\n if (!reexportedObjects) {\n reexportedObjects = module[REEXPORTED_OBJECTS] = []\n module.exports = module.namespaceObject = new Proxy(exports, {\n get(target, prop) {\n if (\n hasOwnProperty.call(target, prop) ||\n prop === 'default' ||\n prop === '__esModule'\n ) {\n return Reflect.get(target, prop)\n }\n for (const obj of reexportedObjects!) {\n const value = Reflect.get(obj, prop)\n if (value !== undefined) return value\n }\n return undefined\n },\n ownKeys(target) {\n const keys = Reflect.ownKeys(target)\n for (const obj of reexportedObjects!) {\n for (const key of Reflect.ownKeys(obj)) {\n if (key !== 'default' && !keys.includes(key)) keys.push(key)\n }\n }\n return keys\n },\n })\n }\n}\n\n/**\n * Dynamically exports properties from an object\n */\nfunction dynamicExport(\n module: Module,\n exports: Exports,\n object: Record\n) {\n ensureDynamicExports(module, exports)\n\n if (typeof object === 'object' && object !== null) {\n module[REEXPORTED_OBJECTS]!.push(object)\n }\n}\n\nfunction exportValue(module: Module, value: any) {\n module.exports = value\n}\n\nfunction exportNamespace(module: Module, namespace: any) {\n module.exports = module.namespaceObject = namespace\n}\n\nfunction createGetter(obj: Record, key: string | symbol) {\n return () => obj[key]\n}\n\n/**\n * @returns prototype of the object\n */\nconst getProto: (obj: any) => any = Object.getPrototypeOf\n ? (obj) => Object.getPrototypeOf(obj)\n : (obj) => obj.__proto__\n\n/** Prototypes that are not expanded for exports */\nconst LEAF_PROTOTYPES = [null, getProto({}), getProto([]), getProto(getProto)]\n\n/**\n * @param raw\n * @param ns\n * @param allowExportDefault\n * * `false`: will have the raw module as default export\n * * `true`: will have the default property as default export\n */\nfunction interopEsm(\n raw: Exports,\n ns: EsmNamespaceObject,\n allowExportDefault?: boolean\n) {\n const getters: { [s: string]: () => any } = Object.create(null)\n for (\n let current = raw;\n (typeof current === 'object' || typeof current === 'function') &&\n !LEAF_PROTOTYPES.includes(current);\n current = getProto(current)\n ) {\n for (const key of Object.getOwnPropertyNames(current)) {\n getters[key] = createGetter(raw, key)\n }\n }\n\n // this is not really correct\n // we should set the `default` getter if the imported module is a `.cjs file`\n if (!(allowExportDefault && 'default' in getters)) {\n getters['default'] = () => raw\n }\n\n esm(ns, getters)\n return ns\n}\n\nfunction createNS(raw: Module['exports']): EsmNamespaceObject {\n if (typeof raw === 'function') {\n return function (this: any, ...args: any[]) {\n return raw.apply(this, args)\n }\n } else {\n return Object.create(null)\n }\n}\n\nfunction esmImport(\n sourceModule: Module,\n id: ModuleId\n): Exclude {\n const module = getOrInstantiateModuleFromParent(id, sourceModule)\n if (module.error) throw module.error\n\n // any ES module has to have `module.namespaceObject` defined.\n if (module.namespaceObject) return module.namespaceObject\n\n // only ESM can be an async module, so we don't need to worry about exports being a promise here.\n const raw = module.exports\n return (module.namespaceObject = interopEsm(\n raw,\n createNS(raw),\n raw && (raw as any).__esModule\n ))\n}\n\n// Add a simple runtime require so that environments without one can still pass\n// `typeof require` CommonJS checks so that exports are correctly registered.\nconst runtimeRequire =\n // @ts-ignore\n typeof require === 'function'\n ? // @ts-ignore\n require\n : function require() {\n throw new Error('Unexpected use of runtime require')\n }\n\nfunction commonJsRequire(sourceModule: Module, id: ModuleId): Exports {\n const module = getOrInstantiateModuleFromParent(id, sourceModule)\n if (module.error) throw module.error\n return module.exports\n}\n\n/**\n * `require.context` and require/import expression runtime.\n */\nfunction moduleContext(map: ModuleContextMap): ModuleContext {\n function moduleContext(id: ModuleId): Exports {\n if (hasOwnProperty.call(map, id)) {\n return map[id].module()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.keys = (): ModuleId[] => {\n return Object.keys(map)\n }\n\n moduleContext.resolve = (id: ModuleId): ModuleId => {\n if (hasOwnProperty.call(map, id)) {\n return map[id].id()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.import = async (id: ModuleId) => {\n return await (moduleContext(id) as Promise)\n }\n\n return moduleContext\n}\n\n/**\n * Returns the path of a chunk defined by its data.\n */\nfunction getChunkPath(chunkData: ChunkData): ChunkPath {\n return typeof chunkData === 'string' ? chunkData : chunkData.path\n}\n\nfunction isPromise(maybePromise: any): maybePromise is Promise {\n return (\n maybePromise != null &&\n typeof maybePromise === 'object' &&\n 'then' in maybePromise &&\n typeof maybePromise.then === 'function'\n )\n}\n\nfunction isAsyncModuleExt(obj: T): obj is AsyncModuleExt & T {\n return turbopackQueues in obj\n}\n\nfunction createPromise() {\n let resolve: (value: T | PromiseLike) => void\n let reject: (reason?: any) => void\n\n const promise = new Promise((res, rej) => {\n reject = rej\n resolve = res\n })\n\n return {\n promise,\n resolve: resolve!,\n reject: reject!,\n }\n}\n\n// everything below is adapted from webpack\n// https://github.com/webpack/webpack/blob/6be4065ade1e252c1d8dcba4af0f43e32af1bdc1/lib/runtime/AsyncModuleRuntimeModule.js#L13\n\nconst turbopackQueues = Symbol('turbopack queues')\nconst turbopackExports = Symbol('turbopack exports')\nconst turbopackError = Symbol('turbopack error')\n\nconst enum QueueStatus {\n Unknown = -1,\n Unresolved = 0,\n Resolved = 1,\n}\n\ntype AsyncQueueFn = (() => void) & { queueCount: number }\ntype AsyncQueue = AsyncQueueFn[] & {\n status: QueueStatus\n}\n\nfunction resolveQueue(queue?: AsyncQueue) {\n if (queue && queue.status !== QueueStatus.Resolved) {\n queue.status = QueueStatus.Resolved\n queue.forEach((fn) => fn.queueCount--)\n queue.forEach((fn) => (fn.queueCount-- ? fn.queueCount++ : fn()))\n }\n}\n\ntype Dep = Exports | AsyncModulePromise | Promise\n\ntype AsyncModuleExt = {\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => void\n [turbopackExports]: Exports\n [turbopackError]?: any\n}\n\ntype AsyncModulePromise = Promise & AsyncModuleExt\n\nfunction wrapDeps(deps: Dep[]): AsyncModuleExt[] {\n return deps.map((dep): AsyncModuleExt => {\n if (dep !== null && typeof dep === 'object') {\n if (isAsyncModuleExt(dep)) return dep\n if (isPromise(dep)) {\n const queue: AsyncQueue = Object.assign([], {\n status: QueueStatus.Unresolved,\n })\n\n const obj: AsyncModuleExt = {\n [turbopackExports]: {},\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => fn(queue),\n }\n\n dep.then(\n (res) => {\n obj[turbopackExports] = res\n resolveQueue(queue)\n },\n (err) => {\n obj[turbopackError] = err\n resolveQueue(queue)\n }\n )\n\n return obj\n }\n }\n\n return {\n [turbopackExports]: dep,\n [turbopackQueues]: () => {},\n }\n })\n}\n\nfunction asyncModule(\n module: Module,\n body: (\n handleAsyncDependencies: (\n deps: Dep[]\n ) => Exports[] | Promise<() => Exports[]>,\n asyncResult: (err?: any) => void\n ) => void,\n hasAwait: boolean\n) {\n const queue: AsyncQueue | undefined = hasAwait\n ? Object.assign([], { status: QueueStatus.Unknown })\n : undefined\n\n const depQueues: Set = new Set()\n\n const { resolve, reject, promise: rawPromise } = createPromise()\n\n const promise: AsyncModulePromise = Object.assign(rawPromise, {\n [turbopackExports]: module.exports,\n [turbopackQueues]: (fn) => {\n queue && fn(queue)\n depQueues.forEach(fn)\n promise['catch'](() => {})\n },\n } satisfies AsyncModuleExt)\n\n const attributes: PropertyDescriptor = {\n get(): any {\n return promise\n },\n set(v: any) {\n // Calling `esmExport` leads to this.\n if (v !== promise) {\n promise[turbopackExports] = v\n }\n },\n }\n\n Object.defineProperty(module, 'exports', attributes)\n Object.defineProperty(module, 'namespaceObject', attributes)\n\n function handleAsyncDependencies(deps: Dep[]) {\n const currentDeps = wrapDeps(deps)\n\n const getResult = () =>\n currentDeps.map((d) => {\n if (d[turbopackError]) throw d[turbopackError]\n return d[turbopackExports]\n })\n\n const { promise, resolve } = createPromise<() => Exports[]>()\n\n const fn: AsyncQueueFn = Object.assign(() => resolve(getResult), {\n queueCount: 0,\n })\n\n function fnQueue(q: AsyncQueue) {\n if (q !== queue && !depQueues.has(q)) {\n depQueues.add(q)\n if (q && q.status === QueueStatus.Unresolved) {\n fn.queueCount++\n q.push(fn)\n }\n }\n }\n\n currentDeps.map((dep) => dep[turbopackQueues](fnQueue))\n\n return fn.queueCount ? promise : getResult()\n }\n\n function asyncResult(err?: any) {\n if (err) {\n reject((promise[turbopackError] = err))\n } else {\n resolve(promise[turbopackExports])\n }\n\n resolveQueue(queue)\n }\n\n body(handleAsyncDependencies, asyncResult)\n\n if (queue && queue.status === QueueStatus.Unknown) {\n queue.status = QueueStatus.Unresolved\n }\n}\n\n/**\n * A pseudo \"fake\" URL object to resolve to its relative path.\n *\n * When UrlRewriteBehavior is set to relative, calls to the `new URL()` will construct url without base using this\n * runtime function to generate context-agnostic urls between different rendering context, i.e ssr / client to avoid\n * hydration mismatch.\n *\n * This is based on webpack's existing implementation:\n * https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/runtime/RelativeUrlRuntimeModule.js\n */\nconst relativeURL = function relativeURL(this: any, inputUrl: string) {\n const realUrl = new URL(inputUrl, 'x:/')\n const values: Record = {}\n for (const key in realUrl) values[key] = (realUrl as any)[key]\n values.href = inputUrl\n values.pathname = inputUrl.replace(/[?#].*/, '')\n values.origin = values.protocol = ''\n values.toString = values.toJSON = (..._args: Array) => inputUrl\n for (const key in values)\n Object.defineProperty(this, key, {\n enumerable: true,\n configurable: true,\n value: values[key],\n })\n}\n\nrelativeURL.prototype = URL.prototype\n\n/**\n * Utility function to ensure all variants of an enum are handled.\n */\nfunction invariant(never: never, computeMessage: (arg: any) => string): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n}\n\n/**\n * A stub function to make `require` available but non-functional in ESM.\n */\nfunction requireStub(_moduleId: ModuleId): never {\n throw new Error('dynamic usage of require is not supported')\n}\n"],"names":[],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,6CAA6C;AAU7C,MAAM,qBAAqB,OAAO;AA+BlC,MAAM,iBAAiB,OAAO,SAAS,CAAC,cAAc;AACtD,MAAM,cAAc,OAAO,WAAW,eAAe,OAAO,WAAW;AAEvE,SAAS,WACP,GAAQ,EACR,IAAiB,EACjB,OAA2C;AAE3C,IAAI,CAAC,eAAe,IAAI,CAAC,KAAK,OAAO,OAAO,cAAc,CAAC,KAAK,MAAM;AACxE;AAEA;;CAEC,GACD,SAAS,IACP,OAAgB,EAChB,OAAoE;AAEpE,WAAW,SAAS,cAAc;AAAE,OAAO;AAAK;AAChD,IAAI,aAAa,WAAW,SAAS,aAAa;AAAE,OAAO;AAAS;AACpE,IAAK,MAAM,OAAO,QAAS;AACzB,MAAM,OAAO,OAAO,CAAC,IAAI;AACzB,IAAI,MAAM,OAAO,CAAC,OAAO;AACvB,WAAW,SAAS,KAAK;AACvB,KAAK,IAAI,CAAC,EAAE;AACZ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,GAAS;AAC5B,IAAI,KAAK;AACP,OAAQ,OAAO,CAAC,eAAe,GAAG;AACpC,OAAO;AACL,QAAQ,OAAO,CAAC,iBAAiB;AACnC;AAEA,aAAa;AACf;AAEA,KAAK,yBAAyB;AAE9B,IAAI,SAAS,MAAM,MAAM,SAA0B;AACjD,MAAM,MAAM;AACd;AACF;AAEA;;;;;;;;;CASC,GACD,MAAM,cAAc,SAAS,YAAuB,QAAgB;AAClE,MAAM,UAAU,IAAI,IAAI,UAAU;AAClC,MAAM,SAA8B,CAAC;AACrC,IAAK,MAAM,OAAO,QAAS,MAAM,CAAC,IAAI,GAAG,AAAC,OAAe,CAAC,IAAI;AAC9D,OAAO,IAAI,GAAG;AACd,OAAO,QAAQ,GAAG,SAAS,OAAO,CAAC,UAAU;AAC7C,OAAO,MAAM,GAAG,OAAO,QAAQ,GAAG;AAClC,OAAO,QAAQ,GAAG,OAAO,MAAM,GAAG,CAAC,GAAG,QAAsB;AAC5D,IAAK,MAAM,OAAO,OAChB,OAAO,cAAc,CAAC,IAAI,EAAE,KAAK;AAC/B,YAAY;AACZ,cAAc;AACd,OAAO,MAAM,CAAC,IAAI;AACpB;AACJ;AAEA,YAAY,SAAS,GAAG,IAAI,SAAS;AAErC;;CAEC,GACD,SAAS,UAAU,KAAY,EAAE,cAAoC;AACnE,MAAM,IAAI,MAAM,CAAC,WAAW,EAAE,eAAe,QAAQ;AACvD;AAEA;;CAEC,GACD,SAAS,YAAY,SAAmB;AACtC,MAAM,IAAI,MAAM;AAClB","ignoreList":[0]}}, - {"offset": {"line": 348, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/runtime-base.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *development* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\n// Used in WebWorkers to tell the runtime about the chunk base path\ndeclare var TURBOPACK_WORKER_LOCATION: string\n// Used in WebWorkers to tell the runtime about the current chunk url since it can't be detected via document.currentScript\n// Note it's stored in reversed order to use push and pop\ndeclare var TURBOPACK_NEXT_CHUNK_URLS: ChunkUrl[] | undefined\n\n// Injected by rust code\ndeclare var CHUNK_BASE_PATH: string\ndeclare var CHUNK_SUFFIX_PATH: string\n\n// Provided by build or dev base\ndeclare function instantiateModule(id: ModuleId, source: SourceInfo): Module\n\ntype RuntimeParams = {\n otherChunks: ChunkData[]\n runtimeModuleIds: ModuleId[]\n}\n\ntype ChunkRegistration = [\n chunkPath: ChunkScript,\n chunkModules: ModuleFactories,\n params: RuntimeParams | undefined,\n]\n\ntype ChunkList = {\n script: ChunkListScript\n chunks: ChunkData[]\n source: 'entry' | 'dynamic'\n}\n\nenum SourceType {\n /**\n * The module was instantiated because it was included in an evaluated chunk's\n * runtime.\n */\n Runtime = 0,\n /**\n * The module was instantiated because a parent module imported it.\n */\n Parent = 1,\n /**\n * The module was instantiated because it was included in a chunk's hot module\n * update.\n */\n Update = 2,\n}\n\ntype SourceInfo =\n | {\n type: SourceType.Runtime\n chunkPath: ChunkPath\n }\n | {\n type: SourceType.Parent\n parentId: ModuleId\n }\n | {\n type: SourceType.Update\n parents?: ModuleId[]\n }\n\ninterface RuntimeBackend {\n registerChunk: (chunkPath: ChunkPath, params?: RuntimeParams) => void\n loadChunk: (chunkUrl: ChunkUrl, source: SourceInfo) => Promise\n}\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nconst moduleFactories: ModuleFactories = Object.create(null)\n/**\n * Module IDs that are instantiated as part of the runtime of a chunk.\n */\nconst runtimeModules: Set = new Set()\n/**\n * Map from module ID to the chunks that contain this module.\n *\n * In HMR, we need to keep track of which modules are contained in which so\n * chunks. This is so we don't eagerly dispose of a module when it is removed\n * from chunk A, but still exists in chunk B.\n */\nconst moduleChunksMap: Map> = new Map()\n/**\n * Map from a chunk path to all modules it contains.\n */\nconst chunkModulesMap: Map> = new Map()\n/**\n * Chunk lists that contain a runtime. When these chunk lists receive an update\n * that can't be reconciled with the current state of the page, we need to\n * reload the runtime entirely.\n */\nconst runtimeChunkLists: Set = new Set()\n/**\n * Map from a chunk list to the chunk paths it contains.\n */\nconst chunkListChunksMap: Map> = new Map()\n/**\n * Map from a chunk path to the chunk lists it belongs to.\n */\nconst chunkChunkListsMap: Map> = new Map()\n\nconst availableModules: Map | true> = new Map()\n\nconst availableModuleChunks: Map | true> = new Map()\n\nasync function loadChunk(\n source: SourceInfo,\n chunkData: ChunkData\n): Promise {\n if (typeof chunkData === 'string') {\n return loadChunkPath(source, chunkData)\n }\n\n const includedList = chunkData.included || []\n const modulesPromises = includedList.map((included) => {\n if (moduleFactories[included]) return true\n return availableModules.get(included)\n })\n if (modulesPromises.length > 0 && modulesPromises.every((p) => p)) {\n // When all included items are already loaded or loading, we can skip loading ourselves\n return Promise.all(modulesPromises)\n }\n\n const includedModuleChunksList = chunkData.moduleChunks || []\n const moduleChunksPromises = includedModuleChunksList\n .map((included) => {\n // TODO(alexkirsz) Do we need this check?\n // if (moduleFactories[included]) return true;\n return availableModuleChunks.get(included)\n })\n .filter((p) => p)\n\n let promise\n if (moduleChunksPromises.length > 0) {\n // Some module chunks are already loaded or loading.\n\n if (moduleChunksPromises.length === includedModuleChunksList.length) {\n // When all included module chunks are already loaded or loading, we can skip loading ourselves\n return Promise.all(moduleChunksPromises)\n }\n\n const moduleChunksToLoad: Set = new Set()\n for (const moduleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(moduleChunk)) {\n moduleChunksToLoad.add(moduleChunk)\n }\n }\n\n for (const moduleChunkToLoad of moduleChunksToLoad) {\n const promise = loadChunkPath(source, moduleChunkToLoad)\n\n availableModuleChunks.set(moduleChunkToLoad, promise)\n\n moduleChunksPromises.push(promise)\n }\n\n promise = Promise.all(moduleChunksPromises)\n } else {\n promise = loadChunkPath(source, chunkData.path)\n\n // Mark all included module chunks as loading if they are not already loaded or loading.\n for (const includedModuleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(includedModuleChunk)) {\n availableModuleChunks.set(includedModuleChunk, promise)\n }\n }\n }\n\n for (const included of includedList) {\n if (!availableModules.has(included)) {\n // It might be better to race old and new promises, but it's rare that the new promise will be faster than a request started earlier.\n // In production it's even more rare, because the chunk optimization tries to deduplicate modules anyway.\n availableModules.set(included, promise)\n }\n }\n\n return promise\n}\n\nasync function loadChunkByUrl(source: SourceInfo, chunkUrl: ChunkUrl) {\n try {\n await BACKEND.loadChunk(chunkUrl, source)\n } catch (error) {\n let loadReason\n switch (source.type) {\n case SourceType.Runtime:\n loadReason = `as a runtime dependency of chunk ${source.chunkPath}`\n break\n case SourceType.Parent:\n loadReason = `from module ${source.parentId}`\n break\n case SourceType.Update:\n loadReason = 'from an HMR update'\n break\n default:\n invariant(source, (source) => `Unknown source type: ${source?.type}`)\n }\n throw new Error(\n `Failed to load chunk ${chunkUrl} ${loadReason}${\n error ? `: ${error}` : ''\n }`,\n error\n ? {\n cause: error,\n }\n : undefined\n )\n }\n}\n\nasync function loadChunkPath(\n source: SourceInfo,\n chunkPath: ChunkPath\n): Promise {\n const url = getChunkRelativeUrl(chunkPath)\n return loadChunkByUrl(source, url)\n}\n\n/**\n * Returns an absolute url to an asset.\n */\nfunction createResolvePathFromModule(\n resolver: (moduleId: string) => Exports\n): (moduleId: string) => string {\n return function resolvePathFromModule(moduleId: string): string {\n const exported = resolver(moduleId)\n return exported?.default ?? exported\n }\n}\n\n/**\n * no-op for browser\n * @param modulePath\n */\nfunction resolveAbsolutePath(modulePath?: string): string {\n return `/ROOT/${modulePath ?? ''}`\n}\n\n/**\n * Returns a blob URL for the worker.\n * @param chunks list of chunks to load\n */\nfunction getWorkerBlobURL(chunks: ChunkPath[]): string {\n // It is important to reverse the array so when bootstrapping we can infer what chunk is being\n // evaluated by poping urls off of this array. See `getPathFromScript`\n let bootstrap = `self.TURBOPACK_WORKER_LOCATION = ${JSON.stringify(location.origin)};\nself.TURBOPACK_NEXT_CHUNK_URLS = ${JSON.stringify(chunks.reverse().map(getChunkRelativeUrl), null, 2)};\nimportScripts(...self.TURBOPACK_NEXT_CHUNK_URLS.map(c => self.TURBOPACK_WORKER_LOCATION + c).reverse());`\n let blob = new Blob([bootstrap], { type: 'text/javascript' })\n return URL.createObjectURL(blob)\n}\n\n/**\n * Adds a module to a chunk.\n */\nfunction addModuleToChunk(moduleId: ModuleId, chunkPath: ChunkPath) {\n let moduleChunks = moduleChunksMap.get(moduleId)\n if (!moduleChunks) {\n moduleChunks = new Set([chunkPath])\n moduleChunksMap.set(moduleId, moduleChunks)\n } else {\n moduleChunks.add(chunkPath)\n }\n\n let chunkModules = chunkModulesMap.get(chunkPath)\n if (!chunkModules) {\n chunkModules = new Set([moduleId])\n chunkModulesMap.set(chunkPath, chunkModules)\n } else {\n chunkModules.add(moduleId)\n }\n}\n\n/**\n * Returns the first chunk that included a module.\n * This is used by the Node.js backend, hence why it's marked as unused in this\n * file.\n */\nfunction getFirstModuleChunk(moduleId: ModuleId) {\n const moduleChunkPaths = moduleChunksMap.get(moduleId)\n if (moduleChunkPaths == null) {\n return null\n }\n\n return moduleChunkPaths.values().next().value\n}\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n return instantiateModule(moduleId, { type: SourceType.Runtime, chunkPath })\n}\n/**\n * Returns the URL relative to the origin where a chunk can be fetched from.\n */\nfunction getChunkRelativeUrl(chunkPath: ChunkPath | ChunkListPath): ChunkUrl {\n return `${CHUNK_BASE_PATH}${chunkPath\n .split('/')\n .map((p) => encodeURIComponent(p))\n .join('/')}${CHUNK_SUFFIX_PATH}` as ChunkUrl\n}\n\n/**\n * Return the ChunkPath from a ChunkScript.\n */\nfunction getPathFromScript(chunkScript: ChunkPath | ChunkScript): ChunkPath\nfunction getPathFromScript(\n chunkScript: ChunkListPath | ChunkListScript\n): ChunkListPath\nfunction getPathFromScript(\n chunkScript: ChunkPath | ChunkListPath | ChunkScript | ChunkListScript\n): ChunkPath | ChunkListPath {\n if (typeof chunkScript === 'string') {\n return chunkScript as ChunkPath | ChunkListPath\n }\n const chunkUrl =\n typeof TURBOPACK_NEXT_CHUNK_URLS !== 'undefined'\n ? TURBOPACK_NEXT_CHUNK_URLS.pop()!\n : chunkScript.getAttribute('src')!\n const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/, ''))\n const path = src.startsWith(CHUNK_BASE_PATH)\n ? src.slice(CHUNK_BASE_PATH.length)\n : src\n return path as ChunkPath | ChunkListPath\n}\n\n/**\n * Marks a chunk list as a runtime chunk list. There can be more than one\n * runtime chunk list. For instance, integration tests can have multiple chunk\n * groups loaded at runtime, each with its own chunk list.\n */\nfunction markChunkListAsRuntime(chunkListPath: ChunkListPath) {\n runtimeChunkLists.add(chunkListPath)\n}\n\nfunction registerChunk([\n chunkScript,\n chunkModules,\n runtimeParams,\n]: ChunkRegistration) {\n const chunkPath = getPathFromScript(chunkScript)\n for (const [moduleId, moduleFactory] of Object.entries(chunkModules)) {\n if (!moduleFactories[moduleId]) {\n moduleFactories[moduleId] = moduleFactory\n }\n addModuleToChunk(moduleId, chunkPath)\n }\n\n return BACKEND.registerChunk(chunkPath, runtimeParams)\n}\n\nconst regexJsUrl = /\\.js(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment.\n */\nfunction isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {\n return regexJsUrl.test(chunkUrlOrPath)\n}\n\nconst regexCssUrl = /\\.css(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .css, optionally followed by ?query or #fragment.\n */\nfunction isCss(chunkUrl: ChunkUrl): boolean {\n return regexCssUrl.test(chunkUrl)\n}\n"],"names":[],"mappings":"AAAA;;;;;;CAMC,GAED,oDAAoD,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,QAAkB,EAClB,SAAoB;AAEpB,OAAO,kBAAkB,UAAU;AAAE,IAAI;AAAsB;AAAU;AAC3E;AACA;;CAEC,GACD,SAAS,oBAAoB,SAAoC;AAC/D,OAAO,GAAG,kBAAkB,UACzB,KAAK,CAAC,KACN,GAAG,CAAC,CAAC,IAAM,mBAAmB,IAC9B,IAAI,CAAC,OAAO,mBAAmB;AACpC;AASA,SAAS,kBACP,WAAsE;AAEtE,IAAI,OAAO,gBAAgB,UAAU;AACnC,OAAO;AACT;AACA,MAAM,WACJ,OAAO,8BAA8B,cACjC,0BAA0B,GAAG,KAC7B,YAAY,YAAY,CAAC;AAC/B,MAAM,MAAM,mBAAmB,SAAS,OAAO,CAAC,WAAW;AAC3D,MAAM,OAAO,IAAI,UAAU,CAAC,mBACxB,IAAI,KAAK,CAAC,gBAAgB,MAAM,IAChC;AACJ,OAAO;AACT;AAEA;;;;CAIC,GACD,SAAS,uBAAuB,aAA4B;AAC1D,kBAAkB,GAAG,CAAC;AACxB;AAEA,SAAS,cAAc,CACrB,aACA,cACA,cACkB;AAClB,MAAM,YAAY,kBAAkB;AACpC,KAAK,MAAM,CAAC,UAAU,cAAc,IAAI,OAAO,OAAO,CAAC,cAAe;AACpE,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE;AAC9B,eAAe,CAAC,SAAS,GAAG;AAC9B;AACA,iBAAiB,UAAU;AAC7B;AAEA,OAAO,QAAQ,aAAa,CAAC,WAAW;AAC1C;AAEA,MAAM,aAAa;AACnB;;CAEC,GACD,SAAS,KAAK,cAAoC;AAChD,OAAO,WAAW,IAAI,CAAC;AACzB;AAEA,MAAM,cAAc;AACpB;;CAEC,GACD,SAAS,MAAM,QAAkB;AAC/B,OAAO,YAAY,IAAI,CAAC;AAC1B","ignoreList":[0]}}, - {"offset": {"line": 595, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/dev-base.ts"],"sourcesContent":["/// \n/// \n/// \n\n/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *development* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\nconst devModuleCache: ModuleCache = Object.create(null)\n\n// This file must not use `import` and `export` statements. Otherwise, it\n// becomes impossible to augment interfaces declared in ``d files\n// (e.g. `Module`). Hence, the need for `import()` here.\ntype RefreshRuntimeGlobals =\n import('@next/react-refresh-utils/dist/runtime').RefreshRuntimeGlobals\n\ndeclare var $RefreshHelpers$: RefreshRuntimeGlobals['$RefreshHelpers$']\ndeclare var $RefreshReg$: RefreshRuntimeGlobals['$RefreshReg$']\ndeclare var $RefreshSig$: RefreshRuntimeGlobals['$RefreshSig$']\ndeclare var $RefreshInterceptModuleExecution$: RefreshRuntimeGlobals['$RefreshInterceptModuleExecution$']\n\ntype RefreshContext = {\n register: RefreshRuntimeGlobals['$RefreshReg$']\n signature: RefreshRuntimeGlobals['$RefreshSig$']\n registerExports: typeof registerExportsAndSetupBoundaryForReactRefresh\n}\n\ntype RefreshHelpers = RefreshRuntimeGlobals['$RefreshHelpers$']\n\ninterface TurbopackDevBaseContext extends TurbopackBaseContext {\n k: RefreshContext\n R: ResolvePathFromModule\n}\n\ninterface TurbopackDevContext extends TurbopackDevBaseContext {}\n\ntype ModuleFactory = (\n this: Module['exports'],\n context: TurbopackDevBaseContext\n) => undefined\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nclass UpdateApplyError extends Error {\n name = 'UpdateApplyError'\n\n dependencyChain: string[]\n\n constructor(message: string, dependencyChain: string[]) {\n super(message)\n this.dependencyChain = dependencyChain\n }\n}\n\n/**\n * Maps module IDs to persisted data between executions of their hot module\n * implementation (`hot.data`).\n */\nconst moduleHotData: Map = new Map()\n/**\n * Maps module instances to their hot module state.\n */\nconst moduleHotState: Map = new Map()\n/**\n * Modules that call `module.hot.invalidate()` (while being updated).\n */\nconst queuedInvalidatedModules: Set = new Set()\n\n/**\n * Gets or instantiates a runtime module.\n */\n// @ts-ignore\nfunction getOrInstantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n const module = devModuleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n // @ts-ignore\n return instantiateModule(moduleId, { type: SourceType.Runtime, chunkPath })\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it if it is not cached.\n */\n// @ts-ignore Defined in `runtime-utils.ts`\nconst getOrInstantiateModuleFromParent: GetOrInstantiateModuleFromParent<\n HotModule\n> = (id, sourceModule) => {\n if (!sourceModule.hot.active) {\n console.warn(\n `Unexpected import of module ${id} from module ${sourceModule.id}, which was deleted by an HMR update`\n )\n }\n\n const module = devModuleCache[id]\n\n if (sourceModule.children.indexOf(id) === -1) {\n sourceModule.children.push(id)\n }\n\n if (module) {\n if (module.parents.indexOf(sourceModule.id) === -1) {\n module.parents.push(sourceModule.id)\n }\n\n return module\n }\n\n return instantiateModule(id, {\n type: SourceType.Parent,\n parentId: sourceModule.id,\n })\n}\n\n// @ts-ignore Defined in `runtime-base.ts`\nfunction instantiateModule(id: ModuleId, source: SourceInfo): Module {\n const moduleFactory = moduleFactories[id]\n if (typeof moduleFactory !== 'function') {\n // This can happen if modules incorrectly handle HMR disposes/updates,\n // e.g. when they keep a `setTimeout` around which still executes old code\n // and contains e.g. a `require(\"something\")` call.\n let instantiationReason\n switch (source.type) {\n case SourceType.Runtime:\n instantiationReason = `as a runtime entry of chunk ${source.chunkPath}`\n break\n case SourceType.Parent:\n instantiationReason = `because it was required from module ${source.parentId}`\n break\n case SourceType.Update:\n instantiationReason = 'because of an HMR update'\n break\n default:\n invariant(source, (source) => `Unknown source type: ${source?.type}`)\n }\n throw new Error(\n `Module ${id} was instantiated ${instantiationReason}, but the module factory is not available. It might have been deleted in an HMR update.`\n )\n }\n\n const hotData = moduleHotData.get(id)!\n const { hot, hotState } = createModuleHot(id, hotData)\n\n let parents: ModuleId[]\n switch (source.type) {\n case SourceType.Runtime:\n runtimeModules.add(id)\n parents = []\n break\n case SourceType.Parent:\n // No need to add this module as a child of the parent module here, this\n // has already been taken care of in `getOrInstantiateModuleFromParent`.\n parents = [source.parentId]\n break\n case SourceType.Update:\n parents = source.parents || []\n break\n default:\n invariant(source, (source) => `Unknown source type: ${source?.type}`)\n }\n\n const module: HotModule = {\n exports: {},\n error: undefined,\n loaded: false,\n id,\n parents,\n children: [],\n namespaceObject: undefined,\n hot,\n }\n\n devModuleCache[id] = module\n moduleHotState.set(module, hotState)\n\n // NOTE(alexkirsz) This can fail when the module encounters a runtime error.\n try {\n const sourceInfo: SourceInfo = { type: SourceType.Parent, parentId: id }\n\n runModuleExecutionHooks(module, (refresh) => {\n const r = commonJsRequire.bind(null, module)\n moduleFactory.call(\n module.exports,\n augmentContext({\n a: asyncModule.bind(null, module),\n e: module.exports,\n r: commonJsRequire.bind(null, module),\n t: runtimeRequire,\n f: moduleContext,\n i: esmImport.bind(null, module),\n s: esmExport.bind(null, module, module.exports),\n j: dynamicExport.bind(null, module, module.exports),\n v: exportValue.bind(null, module),\n n: exportNamespace.bind(null, module),\n m: module,\n c: devModuleCache,\n M: moduleFactories,\n l: loadChunk.bind(null, sourceInfo),\n L: loadChunkByUrl.bind(null, sourceInfo),\n w: loadWebAssembly.bind(null, sourceInfo),\n u: loadWebAssemblyModule.bind(null, sourceInfo),\n P: resolveAbsolutePath,\n U: relativeURL,\n k: refresh,\n R: createResolvePathFromModule(r),\n b: getWorkerBlobURL,\n z: requireStub,\n })\n )\n })\n } catch (error) {\n module.error = error as any\n throw error\n }\n\n module.loaded = true\n if (module.namespaceObject && module.exports !== module.namespaceObject) {\n // in case of a circular dependency: cjs1 -> esm2 -> cjs1\n interopEsm(module.exports, module.namespaceObject)\n }\n\n return module\n}\n\n/**\n * NOTE(alexkirsz) Webpack has a \"module execution\" interception hook that\n * Next.js' React Refresh runtime hooks into to add module context to the\n * refresh registry.\n */\nfunction runModuleExecutionHooks(\n module: Module,\n executeModule: (ctx: RefreshContext) => void\n) {\n if (typeof globalThis.$RefreshInterceptModuleExecution$ === 'function') {\n const cleanupReactRefreshIntercept =\n globalThis.$RefreshInterceptModuleExecution$(module.id)\n try {\n executeModule({\n register: globalThis.$RefreshReg$,\n signature: globalThis.$RefreshSig$,\n registerExports: registerExportsAndSetupBoundaryForReactRefresh,\n })\n } finally {\n // Always cleanup the intercept, even if module execution failed.\n cleanupReactRefreshIntercept()\n }\n } else {\n // If the react refresh hooks are not installed we need to bind dummy functions.\n // This is expected when running in a Web Worker. It is also common in some of\n // our test environments.\n executeModule({\n register: (type, id) => {},\n signature: () => (type) => {},\n registerExports: (module, helpers) => {},\n })\n }\n}\n\n/**\n * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts\n */\nfunction registerExportsAndSetupBoundaryForReactRefresh(\n module: HotModule,\n helpers: RefreshHelpers\n) {\n const currentExports = module.exports\n const prevExports = module.hot.data.prevExports ?? null\n\n helpers.registerExportsForReactRefresh(currentExports, module.id)\n\n // A module can be accepted automatically based on its exports, e.g. when\n // it is a Refresh Boundary.\n if (helpers.isReactRefreshBoundary(currentExports)) {\n // Save the previous exports on update, so we can compare the boundary\n // signatures.\n module.hot.dispose((data) => {\n data.prevExports = currentExports\n })\n // Unconditionally accept an update to this module, we'll check if it's\n // still a Refresh Boundary later.\n module.hot.accept()\n\n // This field is set when the previous version of this module was a\n // Refresh Boundary, letting us know we need to check for invalidation or\n // enqueue an update.\n if (prevExports !== null) {\n // A boundary can become ineligible if its exports are incompatible\n // with the previous exports.\n //\n // For example, if you add/remove/change exports, we'll want to\n // re-execute the importing modules, and force those components to\n // re-render. Similarly, if you convert a class component to a\n // function, we want to invalidate the boundary.\n if (\n helpers.shouldInvalidateReactRefreshBoundary(\n helpers.getRefreshBoundarySignature(prevExports),\n helpers.getRefreshBoundarySignature(currentExports)\n )\n ) {\n module.hot.invalidate()\n } else {\n helpers.scheduleUpdate()\n }\n }\n } else {\n // Since we just executed the code for the module, it's possible that the\n // new exports made it ineligible for being a boundary.\n // We only care about the case when we were _previously_ a boundary,\n // because we already accepted this update (accidental side effect).\n const isNoLongerABoundary = prevExports !== null\n if (isNoLongerABoundary) {\n module.hot.invalidate()\n }\n }\n}\n\nfunction formatDependencyChain(dependencyChain: ModuleId[]): string {\n return `Dependency chain: ${dependencyChain.join(' -> ')}`\n}\n\nfunction computeOutdatedModules(\n added: Map,\n modified: Map\n): {\n outdatedModules: Set\n newModuleFactories: Map\n} {\n const newModuleFactories = new Map()\n\n for (const [moduleId, entry] of added) {\n if (entry != null) {\n newModuleFactories.set(moduleId, _eval(entry))\n }\n }\n\n const outdatedModules = computedInvalidatedModules(modified.keys())\n\n for (const [moduleId, entry] of modified) {\n newModuleFactories.set(moduleId, _eval(entry))\n }\n\n return { outdatedModules, newModuleFactories }\n}\n\nfunction computedInvalidatedModules(\n invalidated: Iterable\n): Set {\n const outdatedModules = new Set()\n\n for (const moduleId of invalidated) {\n const effect = getAffectedModuleEffects(moduleId)\n\n switch (effect.type) {\n case 'unaccepted':\n throw new UpdateApplyError(\n `cannot apply update: unaccepted module. ${formatDependencyChain(\n effect.dependencyChain\n )}.`,\n effect.dependencyChain\n )\n case 'self-declined':\n throw new UpdateApplyError(\n `cannot apply update: self-declined module. ${formatDependencyChain(\n effect.dependencyChain\n )}.`,\n effect.dependencyChain\n )\n case 'accepted':\n for (const outdatedModuleId of effect.outdatedModules) {\n outdatedModules.add(outdatedModuleId)\n }\n break\n // TODO(alexkirsz) Dependencies: handle dependencies effects.\n default:\n invariant(effect, (effect) => `Unknown effect type: ${effect?.type}`)\n }\n }\n\n return outdatedModules\n}\n\nfunction computeOutdatedSelfAcceptedModules(\n outdatedModules: Iterable\n): { moduleId: ModuleId; errorHandler: true | Function }[] {\n const outdatedSelfAcceptedModules: {\n moduleId: ModuleId\n errorHandler: true | Function\n }[] = []\n for (const moduleId of outdatedModules) {\n const module = devModuleCache[moduleId]\n const hotState = moduleHotState.get(module)!\n if (module && hotState.selfAccepted && !hotState.selfInvalidated) {\n outdatedSelfAcceptedModules.push({\n moduleId,\n errorHandler: hotState.selfAccepted,\n })\n }\n }\n return outdatedSelfAcceptedModules\n}\n\n/**\n * Adds, deletes, and moves modules between chunks. This must happen before the\n * dispose phase as it needs to know which modules were removed from all chunks,\n * which we can only compute *after* taking care of added and moved modules.\n */\nfunction updateChunksPhase(\n chunksAddedModules: Map>,\n chunksDeletedModules: Map>\n): { disposedModules: Set } {\n for (const [chunkPath, addedModuleIds] of chunksAddedModules) {\n for (const moduleId of addedModuleIds) {\n addModuleToChunk(moduleId, chunkPath)\n }\n }\n\n const disposedModules: Set = new Set()\n for (const [chunkPath, addedModuleIds] of chunksDeletedModules) {\n for (const moduleId of addedModuleIds) {\n if (removeModuleFromChunk(moduleId, chunkPath)) {\n disposedModules.add(moduleId)\n }\n }\n }\n\n return { disposedModules }\n}\n\nfunction disposePhase(\n outdatedModules: Iterable,\n disposedModules: Iterable\n): { outdatedModuleParents: Map> } {\n for (const moduleId of outdatedModules) {\n disposeModule(moduleId, 'replace')\n }\n\n for (const moduleId of disposedModules) {\n disposeModule(moduleId, 'clear')\n }\n\n // Removing modules from the module cache is a separate step.\n // We also want to keep track of previous parents of the outdated modules.\n const outdatedModuleParents = new Map()\n for (const moduleId of outdatedModules) {\n const oldModule = devModuleCache[moduleId]\n outdatedModuleParents.set(moduleId, oldModule?.parents)\n delete devModuleCache[moduleId]\n }\n\n // TODO(alexkirsz) Dependencies: remove outdated dependency from module\n // children.\n\n return { outdatedModuleParents }\n}\n\n/**\n * Disposes of an instance of a module.\n *\n * Returns the persistent hot data that should be kept for the next module\n * instance.\n *\n * NOTE: mode = \"replace\" will not remove modules from the devModuleCache\n * This must be done in a separate step afterwards.\n * This is important because all modules need to be disposed to update the\n * parent/child relationships before they are actually removed from the devModuleCache.\n * If this was done in this method, the following disposeModule calls won't find\n * the module from the module id in the cache.\n */\nfunction disposeModule(moduleId: ModuleId, mode: 'clear' | 'replace') {\n const module = devModuleCache[moduleId]\n if (!module) {\n return\n }\n\n const hotState = moduleHotState.get(module)!\n const data = {}\n\n // Run the `hot.dispose` handler, if any, passing in the persistent\n // `hot.data` object.\n for (const disposeHandler of hotState.disposeHandlers) {\n disposeHandler(data)\n }\n\n // This used to warn in `getOrInstantiateModuleFromParent` when a disposed\n // module is still importing other modules.\n module.hot.active = false\n\n moduleHotState.delete(module)\n\n // TODO(alexkirsz) Dependencies: delete the module from outdated deps.\n\n // Remove the disposed module from its children's parent list.\n // It will be added back once the module re-instantiates and imports its\n // children again.\n for (const childId of module.children) {\n const child = devModuleCache[childId]\n if (!child) {\n continue\n }\n\n const idx = child.parents.indexOf(module.id)\n if (idx >= 0) {\n child.parents.splice(idx, 1)\n }\n }\n\n switch (mode) {\n case 'clear':\n delete devModuleCache[module.id]\n moduleHotData.delete(module.id)\n break\n case 'replace':\n moduleHotData.set(module.id, data)\n break\n default:\n invariant(mode, (mode) => `invalid mode: ${mode}`)\n }\n}\n\nfunction applyPhase(\n outdatedSelfAcceptedModules: {\n moduleId: ModuleId\n errorHandler: true | Function\n }[],\n newModuleFactories: Map,\n outdatedModuleParents: Map>,\n reportError: (err: any) => void\n) {\n // Update module factories.\n for (const [moduleId, factory] of newModuleFactories.entries()) {\n moduleFactories[moduleId] = factory\n }\n\n // TODO(alexkirsz) Run new runtime entries here.\n\n // TODO(alexkirsz) Dependencies: call accept handlers for outdated deps.\n\n // Re-instantiate all outdated self-accepted modules.\n for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) {\n try {\n instantiateModule(moduleId, {\n type: SourceType.Update,\n parents: outdatedModuleParents.get(moduleId),\n })\n } catch (err) {\n if (typeof errorHandler === 'function') {\n try {\n errorHandler(err, { moduleId, module: devModuleCache[moduleId] })\n } catch (err2) {\n reportError(err2)\n reportError(err)\n }\n } else {\n reportError(err)\n }\n }\n }\n}\n\nfunction applyUpdate(update: PartialUpdate) {\n switch (update.type) {\n case 'ChunkListUpdate':\n applyChunkListUpdate(update)\n break\n default:\n invariant(update, (update) => `Unknown update type: ${update.type}`)\n }\n}\n\nfunction applyChunkListUpdate(update: ChunkListUpdate) {\n if (update.merged != null) {\n for (const merged of update.merged) {\n switch (merged.type) {\n case 'EcmascriptMergedUpdate':\n applyEcmascriptMergedUpdate(merged)\n break\n default:\n invariant(merged, (merged) => `Unknown merged type: ${merged.type}`)\n }\n }\n }\n\n if (update.chunks != null) {\n for (const [chunkPath, chunkUpdate] of Object.entries(\n update.chunks\n ) as Array<[ChunkPath, ChunkUpdate]>) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n switch (chunkUpdate.type) {\n case 'added':\n BACKEND.loadChunk(chunkUrl, { type: SourceType.Update })\n break\n case 'total':\n DEV_BACKEND.reloadChunk?.(chunkUrl)\n break\n case 'deleted':\n DEV_BACKEND.unloadChunk?.(chunkUrl)\n break\n case 'partial':\n invariant(\n chunkUpdate.instruction,\n (instruction) =>\n `Unknown partial instruction: ${JSON.stringify(instruction)}.`\n )\n break\n default:\n invariant(\n chunkUpdate,\n (chunkUpdate) => `Unknown chunk update type: ${chunkUpdate.type}`\n )\n }\n }\n }\n}\n\nfunction applyEcmascriptMergedUpdate(update: EcmascriptMergedUpdate) {\n const { entries = {}, chunks = {} } = update\n const { added, modified, chunksAdded, chunksDeleted } = computeChangedModules(\n entries,\n chunks\n )\n const { outdatedModules, newModuleFactories } = computeOutdatedModules(\n added,\n modified\n )\n const { disposedModules } = updateChunksPhase(chunksAdded, chunksDeleted)\n\n applyInternal(outdatedModules, disposedModules, newModuleFactories)\n}\n\nfunction applyInvalidatedModules(outdatedModules: Set) {\n if (queuedInvalidatedModules.size > 0) {\n computedInvalidatedModules(queuedInvalidatedModules).forEach((moduleId) => {\n outdatedModules.add(moduleId)\n })\n\n queuedInvalidatedModules.clear()\n }\n\n return outdatedModules\n}\n\nfunction applyInternal(\n outdatedModules: Set,\n disposedModules: Iterable,\n newModuleFactories: Map\n) {\n outdatedModules = applyInvalidatedModules(outdatedModules)\n\n const outdatedSelfAcceptedModules =\n computeOutdatedSelfAcceptedModules(outdatedModules)\n\n const { outdatedModuleParents } = disposePhase(\n outdatedModules,\n disposedModules\n )\n\n // we want to continue on error and only throw the error after we tried applying all updates\n let error: any\n\n function reportError(err: any) {\n if (!error) error = err\n }\n\n applyPhase(\n outdatedSelfAcceptedModules,\n newModuleFactories,\n outdatedModuleParents,\n reportError\n )\n\n if (error) {\n throw error\n }\n\n if (queuedInvalidatedModules.size > 0) {\n applyInternal(new Set(), [], new Map())\n }\n}\n\nfunction computeChangedModules(\n entries: Record,\n updates: Record\n): {\n added: Map\n modified: Map\n deleted: Set\n chunksAdded: Map>\n chunksDeleted: Map>\n} {\n const chunksAdded = new Map()\n const chunksDeleted = new Map()\n const added: Map = new Map()\n const modified = new Map()\n const deleted: Set = new Set()\n\n for (const [chunkPath, mergedChunkUpdate] of Object.entries(updates) as Array<\n [ChunkPath, EcmascriptMergedChunkUpdate]\n >) {\n switch (mergedChunkUpdate.type) {\n case 'added': {\n const updateAdded = new Set(mergedChunkUpdate.modules)\n for (const moduleId of updateAdded) {\n added.set(moduleId, entries[moduleId])\n }\n chunksAdded.set(chunkPath, updateAdded)\n break\n }\n case 'deleted': {\n // We could also use `mergedChunkUpdate.modules` here.\n const updateDeleted = new Set(chunkModulesMap.get(chunkPath))\n for (const moduleId of updateDeleted) {\n deleted.add(moduleId)\n }\n chunksDeleted.set(chunkPath, updateDeleted)\n break\n }\n case 'partial': {\n const updateAdded = new Set(mergedChunkUpdate.added)\n const updateDeleted = new Set(mergedChunkUpdate.deleted)\n for (const moduleId of updateAdded) {\n added.set(moduleId, entries[moduleId])\n }\n for (const moduleId of updateDeleted) {\n deleted.add(moduleId)\n }\n chunksAdded.set(chunkPath, updateAdded)\n chunksDeleted.set(chunkPath, updateDeleted)\n break\n }\n default:\n invariant(\n mergedChunkUpdate,\n (mergedChunkUpdate) =>\n `Unknown merged chunk update type: ${mergedChunkUpdate.type}`\n )\n }\n }\n\n // If a module was added from one chunk and deleted from another in the same update,\n // consider it to be modified, as it means the module was moved from one chunk to another\n // AND has new code in a single update.\n for (const moduleId of added.keys()) {\n if (deleted.has(moduleId)) {\n added.delete(moduleId)\n deleted.delete(moduleId)\n }\n }\n\n for (const [moduleId, entry] of Object.entries(entries)) {\n // Modules that haven't been added to any chunk but have new code are considered\n // to be modified.\n // This needs to be under the previous loop, as we need it to get rid of modules\n // that were added and deleted in the same update.\n if (!added.has(moduleId)) {\n modified.set(moduleId, entry)\n }\n }\n\n return { added, deleted, modified, chunksAdded, chunksDeleted }\n}\n\ntype ModuleEffect =\n | {\n type: 'unaccepted'\n dependencyChain: ModuleId[]\n }\n | {\n type: 'self-declined'\n dependencyChain: ModuleId[]\n moduleId: ModuleId\n }\n | {\n type: 'accepted'\n moduleId: ModuleId\n outdatedModules: Set\n }\n\nfunction getAffectedModuleEffects(moduleId: ModuleId): ModuleEffect {\n const outdatedModules: Set = new Set()\n\n type QueueItem = { moduleId?: ModuleId; dependencyChain: ModuleId[] }\n\n const queue: QueueItem[] = [\n {\n moduleId,\n dependencyChain: [],\n },\n ]\n\n let nextItem\n while ((nextItem = queue.shift())) {\n const { moduleId, dependencyChain } = nextItem\n\n if (moduleId != null) {\n if (outdatedModules.has(moduleId)) {\n // Avoid infinite loops caused by cycles between modules in the dependency chain.\n continue\n }\n\n outdatedModules.add(moduleId)\n }\n\n // We've arrived at the runtime of the chunk, which means that nothing\n // else above can accept this update.\n if (moduleId === undefined) {\n return {\n type: 'unaccepted',\n dependencyChain,\n }\n }\n\n const module = devModuleCache[moduleId]\n const hotState = moduleHotState.get(module)!\n\n if (\n // The module is not in the cache. Since this is a \"modified\" update,\n // it means that the module was never instantiated before.\n !module || // The module accepted itself without invalidating globalThis.\n // TODO is that right?\n (hotState.selfAccepted && !hotState.selfInvalidated)\n ) {\n continue\n }\n\n if (hotState.selfDeclined) {\n return {\n type: 'self-declined',\n dependencyChain,\n moduleId,\n }\n }\n\n if (runtimeModules.has(moduleId)) {\n queue.push({\n moduleId: undefined,\n dependencyChain: [...dependencyChain, moduleId],\n })\n continue\n }\n\n for (const parentId of module.parents) {\n const parent = devModuleCache[parentId]\n\n if (!parent) {\n // TODO(alexkirsz) Is this even possible?\n continue\n }\n\n // TODO(alexkirsz) Dependencies: check accepted and declined\n // dependencies here.\n\n queue.push({\n moduleId: parentId,\n dependencyChain: [...dependencyChain, moduleId],\n })\n }\n }\n\n return {\n type: 'accepted',\n moduleId,\n outdatedModules,\n }\n}\n\nfunction handleApply(chunkListPath: ChunkListPath, update: ServerMessage) {\n switch (update.type) {\n case 'partial': {\n // This indicates that the update is can be applied to the current state of the application.\n applyUpdate(update.instruction)\n break\n }\n case 'restart': {\n // This indicates that there is no way to apply the update to the\n // current state of the application, and that the application must be\n // restarted.\n DEV_BACKEND.restart()\n break\n }\n case 'notFound': {\n // This indicates that the chunk list no longer exists: either the dynamic import which created it was removed,\n // or the page itself was deleted.\n // If it is a dynamic import, we simply discard all modules that the chunk has exclusive access to.\n // If it is a runtime chunk list, we restart the application.\n if (runtimeChunkLists.has(chunkListPath)) {\n DEV_BACKEND.restart()\n } else {\n disposeChunkList(chunkListPath)\n }\n break\n }\n default:\n throw new Error(`Unknown update type: ${update.type}`)\n }\n}\n\nfunction createModuleHot(\n moduleId: ModuleId,\n hotData: HotData\n): { hot: Hot; hotState: HotState } {\n const hotState: HotState = {\n selfAccepted: false,\n selfDeclined: false,\n selfInvalidated: false,\n disposeHandlers: [],\n }\n\n const hot: Hot = {\n // TODO(alexkirsz) This is not defined in the HMR API. It was used to\n // decide whether to warn whenever an HMR-disposed module required other\n // modules. We might want to remove it.\n active: true,\n\n data: hotData ?? {},\n\n // TODO(alexkirsz) Support full (dep, callback, errorHandler) form.\n accept: (\n modules?: string | string[] | AcceptErrorHandler,\n _callback?: AcceptCallback,\n _errorHandler?: AcceptErrorHandler\n ) => {\n if (modules === undefined) {\n hotState.selfAccepted = true\n } else if (typeof modules === 'function') {\n hotState.selfAccepted = modules\n } else {\n throw new Error('unsupported `accept` signature')\n }\n },\n\n decline: (dep) => {\n if (dep === undefined) {\n hotState.selfDeclined = true\n } else {\n throw new Error('unsupported `decline` signature')\n }\n },\n\n dispose: (callback) => {\n hotState.disposeHandlers.push(callback)\n },\n\n addDisposeHandler: (callback) => {\n hotState.disposeHandlers.push(callback)\n },\n\n removeDisposeHandler: (callback) => {\n const idx = hotState.disposeHandlers.indexOf(callback)\n if (idx >= 0) {\n hotState.disposeHandlers.splice(idx, 1)\n }\n },\n\n invalidate: () => {\n hotState.selfInvalidated = true\n queuedInvalidatedModules.add(moduleId)\n },\n\n // NOTE(alexkirsz) This is part of the management API, which we don't\n // implement, but the Next.js React Refresh runtime uses this to decide\n // whether to schedule an update.\n status: () => 'idle',\n\n // NOTE(alexkirsz) Since we always return \"idle\" for now, these are no-ops.\n addStatusHandler: (_handler) => {},\n removeStatusHandler: (_handler) => {},\n\n // NOTE(jridgewell) Check returns the list of updated modules, but we don't\n // want the webpack code paths to ever update (the turbopack paths handle\n // this already).\n check: () => Promise.resolve(null),\n }\n\n return { hot, hotState }\n}\n\n/**\n * Removes a module from a chunk.\n * Returns `true` if there are no remaining chunks including this module.\n */\nfunction removeModuleFromChunk(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): boolean {\n const moduleChunks = moduleChunksMap.get(moduleId)!\n moduleChunks.delete(chunkPath)\n\n const chunkModules = chunkModulesMap.get(chunkPath)!\n chunkModules.delete(moduleId)\n\n const noRemainingModules = chunkModules.size === 0\n if (noRemainingModules) {\n chunkModulesMap.delete(chunkPath)\n }\n\n const noRemainingChunks = moduleChunks.size === 0\n if (noRemainingChunks) {\n moduleChunksMap.delete(moduleId)\n }\n\n return noRemainingChunks\n}\n\n/**\n * Disposes of a chunk list and its corresponding exclusive chunks.\n */\nfunction disposeChunkList(chunkListPath: ChunkListPath): boolean {\n const chunkPaths = chunkListChunksMap.get(chunkListPath)\n if (chunkPaths == null) {\n return false\n }\n chunkListChunksMap.delete(chunkListPath)\n\n for (const chunkPath of chunkPaths) {\n const chunkChunkLists = chunkChunkListsMap.get(chunkPath)!\n chunkChunkLists.delete(chunkListPath)\n\n if (chunkChunkLists.size === 0) {\n chunkChunkListsMap.delete(chunkPath)\n disposeChunk(chunkPath)\n }\n }\n\n // We must also dispose of the chunk list's chunk itself to ensure it may\n // be reloaded properly in the future.\n const chunkListUrl = getChunkRelativeUrl(chunkListPath)\n\n DEV_BACKEND.unloadChunk?.(chunkListUrl)\n\n return true\n}\n\n/**\n * Disposes of a chunk and its corresponding exclusive modules.\n *\n * @returns Whether the chunk was disposed of.\n */\nfunction disposeChunk(chunkPath: ChunkPath): boolean {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n // This should happen whether the chunk has any modules in it or not.\n // For instance, CSS chunks have no modules in them, but they still need to be unloaded.\n DEV_BACKEND.unloadChunk?.(chunkUrl)\n\n const chunkModules = chunkModulesMap.get(chunkPath)\n if (chunkModules == null) {\n return false\n }\n chunkModules.delete(chunkPath)\n\n for (const moduleId of chunkModules) {\n const moduleChunks = moduleChunksMap.get(moduleId)!\n moduleChunks.delete(chunkPath)\n\n const noRemainingChunks = moduleChunks.size === 0\n if (noRemainingChunks) {\n moduleChunksMap.delete(moduleId)\n disposeModule(moduleId, 'clear')\n availableModules.delete(moduleId)\n }\n }\n\n return true\n}\n\n/**\n * Subscribes to chunk list updates from the update server and applies them.\n */\nfunction registerChunkList(chunkList: ChunkList) {\n const chunkListScript = chunkList.script\n const chunkListPath = getPathFromScript(chunkListScript)\n // The \"chunk\" is also registered to finish the loading in the backend\n BACKEND.registerChunk(chunkListPath as string as ChunkPath)\n globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS!.push([\n chunkListPath,\n handleApply.bind(null, chunkListPath),\n ])\n\n // Adding chunks to chunk lists and vice versa.\n const chunkPaths = new Set(chunkList.chunks.map(getChunkPath))\n chunkListChunksMap.set(chunkListPath, chunkPaths)\n for (const chunkPath of chunkPaths) {\n let chunkChunkLists = chunkChunkListsMap.get(chunkPath)\n if (!chunkChunkLists) {\n chunkChunkLists = new Set([chunkListPath])\n chunkChunkListsMap.set(chunkPath, chunkChunkLists)\n } else {\n chunkChunkLists.add(chunkListPath)\n }\n }\n\n if (chunkList.source === 'entry') {\n markChunkListAsRuntime(chunkListPath)\n }\n}\n\nglobalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS ??= []\n"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,4CAA4C;AAC5C,4CAA4C;AAE5C;;;;;;CAMC,GAED,oDAAoD,GAEpD,MAAM,iBAAyC,OAAO,MAAM,CAAC;AAuC7D,MAAM,yBAAyB;AAC7B,OAAO,mBAAkB;AAEzB,gBAAyB;AAEzB,YAAY,OAAe,EAAE,eAAyB,CAAE;AACtD,KAAK,CAAC;AACN,IAAI,CAAC,eAAe,GAAG;AACzB;AACF;AAEA;;;CAGC,GACD,MAAM,gBAAwC,IAAI;AAClD;;CAEC,GACD,MAAM,iBAAwC,IAAI;AAClD;;CAEC,GACD,MAAM,2BAA0C,IAAI;AAEpD;;CAEC,GACD,aAAa;AACb,SAAS,8BACP,QAAkB,EAClB,SAAoB;AAEpB,MAAM,SAAS,cAAc,CAAC,SAAS;AACvC,IAAI,QAAQ;AACV,IAAI,OAAO,KAAK,EAAE;AAChB,MAAM,OAAO,KAAK;AACpB;AACA,OAAO;AACT;AAEA,aAAa;AACb,OAAO,kBAAkB,UAAU;AAAE,MAAM,WAAW,OAAO;AAAE;AAAU;AAC3E;AAEA;;CAEC,GACD,2CAA2C;AAC3C,MAAM,mCAEF,CAAC,IAAI;AACP,IAAI,CAAC,aAAa,GAAG,CAAC,MAAM,EAAE;AAC5B,QAAQ,IAAI,CACV,CAAC,4BAA4B,EAAE,GAAG,aAAa,EAAE,aAAa,EAAE,CAAC,oCAAoC,CAAC;AAE1G;AAEA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AAM,eAAe,gBAAgB,GAAG,CAAC;AACzC,aAAa,MAAM,CAAC;AAEpB,MAAM,oBAAoB,aAAa,IAAI,KAAK;AAChD,IAAI,mBAAmB;AACrB,gBAAgB,MAAM,CAAC;AACvB,cAAc,UAAU;AACxB,iBAAiB,MAAM,CAAC;AAC1B;AACF;AAEA,OAAO;AACT;AAEA;;CAEC,GACD,SAAS,kBAAkB,SAAoB;AAC7C,MAAM,kBAAkB,UAAU,MAAM;AACxC,MAAM,gBAAgB,kBAAkB;AACxC,sEAAsE;AACtE,QAAQ,aAAa,CAAC;AACtB,WAAW,gCAAgC,CAAE,IAAI,CAAC;AAChD;AACA,YAAY,IAAI,CAAC,MAAM;CACxB;AAED,+CAA+C;AAC/C,MAAM,aAAa,IAAI,IAAI,UAAU,MAAM,CAAC,GAAG,CAAC;AAChD,mBAAmB,GAAG,CAAC,eAAe;AACtC,KAAK,MAAM,aAAa,WAAY;AAClC,IAAI,kBAAkB,mBAAmB,GAAG,CAAC;AAC7C,IAAI,CAAC,iBAAiB;AACpB,kBAAkB,IAAI,IAAI;AAAC;CAAc;AACzC,mBAAmB,GAAG,CAAC,WAAW;AACpC,OAAO;AACL,gBAAgB,GAAG,CAAC;AACtB;AACF;AAEA,IAAI,UAAU,MAAM,KAAK,SAAS;AAChC,uBAAuB;AACzB;AACF;AAEA,WAAW,gCAAgC,KAAK,EAAE","ignoreList":[0]}}, - {"offset": {"line": 1430, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/runtime-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack development\n * ECMAScript DOM runtime.\n *\n * It will be appended to the base development runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\ntype ChunkResolver = {\n resolved: boolean\n loadingStarted: boolean\n resolve: () => void\n reject: (error?: Error) => void\n promise: Promise\n}\n\nlet BACKEND: RuntimeBackend\n\nfunction augmentContext(context: unknown): unknown {\n return context\n}\n\nfunction fetchWebAssembly(wasmChunkPath: ChunkPath) {\n return fetch(getChunkRelativeUrl(wasmChunkPath))\n}\n\nasync function loadWebAssembly(\n _source: unknown,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n const { instance } = await WebAssembly.instantiateStreaming(req, importsObj)\n\n return instance.exports\n}\n\nasync function loadWebAssemblyModule(\n _source: unknown,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n return await WebAssembly.compileStreaming(req)\n}\n\n/**\n * Maps chunk paths to the corresponding resolver.\n */\nconst chunkResolvers: Map = new Map()\n\n;(() => {\n BACKEND = {\n async registerChunk(chunkPath, params) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n const resolver = getOrCreateResolver(chunkUrl)\n resolver.resolve()\n\n if (params == null) {\n return\n }\n\n for (const otherChunkData of params.otherChunks) {\n const otherChunkPath = getChunkPath(otherChunkData)\n const otherChunkUrl = getChunkRelativeUrl(otherChunkPath)\n\n // Chunk might have started loading, so we want to avoid triggering another load.\n getOrCreateResolver(otherChunkUrl)\n }\n\n // This waits for chunks to be loaded, but also marks included items as available.\n await Promise.all(\n params.otherChunks.map((otherChunkData) =>\n loadChunk({ type: SourceType.Runtime, chunkPath }, otherChunkData)\n )\n )\n\n if (params.runtimeModuleIds.length > 0) {\n for (const moduleId of params.runtimeModuleIds) {\n getOrInstantiateRuntimeModule(moduleId, chunkPath)\n }\n }\n },\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n loadChunk(chunkUrl, source) {\n return doLoadChunk(chunkUrl, source)\n },\n }\n\n function getOrCreateResolver(chunkUrl: ChunkUrl): ChunkResolver {\n let resolver = chunkResolvers.get(chunkUrl)\n if (!resolver) {\n let resolve: () => void\n let reject: (error?: Error) => void\n const promise = new Promise((innerResolve, innerReject) => {\n resolve = innerResolve\n reject = innerReject\n })\n resolver = {\n resolved: false,\n loadingStarted: false,\n promise,\n resolve: () => {\n resolver!.resolved = true\n resolve()\n },\n reject: reject!,\n }\n chunkResolvers.set(chunkUrl, resolver)\n }\n return resolver\n }\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n function doLoadChunk(chunkUrl: ChunkUrl, source: SourceInfo) {\n const resolver = getOrCreateResolver(chunkUrl)\n if (resolver.loadingStarted) {\n return resolver.promise\n }\n\n if (source.type === SourceType.Runtime) {\n // We don't need to load chunks references from runtime code, as they're already\n // present in the DOM.\n resolver.loadingStarted = true\n\n if (isCss(chunkUrl)) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n\n // We need to wait for JS chunks to register themselves within `registerChunk`\n // before we can start instantiating runtime modules, hence the absence of\n // `resolver.resolve()` in this branch.\n\n return resolver.promise\n }\n\n if (typeof importScripts === 'function') {\n // We're in a web worker\n if (isCss(chunkUrl)) {\n // ignore\n } else if (isJs(chunkUrl)) {\n self.TURBOPACK_NEXT_CHUNK_URLS!.push(chunkUrl)\n importScripts(TURBOPACK_WORKER_LOCATION + chunkUrl)\n } else {\n throw new Error(\n `can't infer type of chunk from URL ${chunkUrl} in worker`\n )\n }\n } else {\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n if (previousLinks.length > 0) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n } else {\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href = chunkUrl\n link.onerror = () => {\n resolver.reject()\n }\n link.onload = () => {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n document.body.appendChild(link)\n }\n } else if (isJs(chunkUrl)) {\n const previousScripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n if (previousScripts.length > 0) {\n // There is this edge where the script already failed loading, but we\n // can't detect that. The Promise will never resolve in this case.\n for (const script of Array.from(previousScripts)) {\n script.addEventListener('error', () => {\n resolver.reject()\n })\n }\n } else {\n const script = document.createElement('script')\n script.src = chunkUrl\n // We'll only mark the chunk as loaded once the script has been executed,\n // which happens in `registerChunk`. Hence the absence of `resolve()` in\n // this branch.\n script.onerror = () => {\n resolver.reject()\n }\n document.body.appendChild(script)\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n }\n\n resolver.loadingStarted = true\n return resolver.promise\n }\n})()\n"],"names":[],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,sEAAsE;AACtE,2DAA2D;AAU3D,IAAI;AAEJ,SAAS,eAAe,OAAgB;AACtC,OAAO;AACT;AAEA,SAAS,iBAAiB,aAAwB;AAChD,OAAO,MAAM,oBAAoB;AACnC;AAEA,eAAe,gBACb,OAAgB,EAChB,aAAwB,EACxB,WAAqC,EACrC,UAA+B;AAE/B,MAAM,MAAM,iBAAiB;AAE7B,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,YAAY,oBAAoB,CAAC,KAAK;AAEjE,OAAO,SAAS,OAAO;AACzB;AAEA,eAAe,sBACb,OAAgB,EAChB,aAAwB,EACxB,WAAqC;AAErC,MAAM,MAAM,iBAAiB;AAE7B,OAAO,MAAM,YAAY,gBAAgB,CAAC;AAC5C;AAEA;;CAEC,GACD,MAAM,iBAA+C,IAAI;AAExD,CAAC;AACA,UAAU;AACR,MAAM,eAAc,SAAS,EAAE,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B,CAAC,SAAS;AAC/B,SAAS,MAAM;AACjB;AACF;AACF,OAAO;AACL,MAAM,SAAS,SAAS,aAAa,CAAC;AACtC,OAAO,GAAG,GAAG;AACb,yEAAyE;AACzE,wEAAwE;AACxE,eAAe;AACf,OAAO,OAAO,GAAG;AACf,SAAS,MAAM;AACjB;AACA,SAAS,IAAI,CAAC,WAAW,CAAC;AAC5B;AACF,OAAO;AACL,MAAM,IAAI,MAAM,CAAC,mCAAmC,EAAE,UAAU;AAClE;AACF;AAEA,SAAS,cAAc,GAAG;AAC1B,OAAO,SAAS,OAAO;AACzB;AACF,CAAC","ignoreList":[0]}}, - {"offset": {"line": 1596, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/dev-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack development\n * ECMAScript DOM runtime.\n *\n * It will be appended to the base development runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n/// \n/// \n\nlet DEV_BACKEND: DevRuntimeBackend\n;(() => {\n DEV_BACKEND = {\n unloadChunk(chunkUrl) {\n deleteResolver(chunkUrl)\n\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const links = document.querySelectorAll(\n `link[href=\"${chunkUrl}\"],link[href^=\"${chunkUrl}?\"],link[href=\"${decodedChunkUrl}\"],link[href^=\"${decodedChunkUrl}?\"]`\n )\n for (const link of Array.from(links)) {\n link.remove()\n }\n } else if (isJs(chunkUrl)) {\n // Unloading a JS chunk would have no effect, as it lives in the JS\n // runtime once evaluated.\n // However, we still want to remove the script tag from the DOM to keep\n // the HTML somewhat consistent from the user's perspective.\n const scripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n for (const script of Array.from(scripts)) {\n script.remove()\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n },\n\n reloadChunk(chunkUrl) {\n return new Promise((resolve, reject) => {\n if (!isCss(chunkUrl)) {\n reject(new Error('The DOM backend can only reload CSS chunks'))\n return\n }\n\n const decodedChunkUrl = decodeURI(chunkUrl)\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n\n if (previousLinks.length === 0) {\n reject(new Error(`No link element found for chunk ${chunkUrl}`))\n return\n }\n\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n\n if (navigator.userAgent.includes('Firefox')) {\n // Firefox won't reload CSS files that were previously loaded on the current page,\n // we need to add a query param to make sure CSS is actually reloaded from the server.\n //\n // I believe this is this issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1037506\n //\n // Safari has a similar issue, but only if you have a `` tag\n // pointing to the same URL as the stylesheet: https://bugs.webkit.org/show_bug.cgi?id=187726\n link.href = `${chunkUrl}?ts=${Date.now()}`\n } else {\n link.href = chunkUrl\n }\n\n link.onerror = () => {\n reject()\n }\n link.onload = () => {\n // First load the new CSS, then remove the old ones. This prevents visible\n // flickering that would happen in-between removing the previous CSS and\n // loading the new one.\n for (const previousLink of Array.from(previousLinks))\n previousLink.remove()\n\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolve()\n }\n\n // Make sure to insert the new CSS right after the previous one, so that\n // its precedence is higher.\n previousLinks[0].parentElement!.insertBefore(\n link,\n previousLinks[0].nextSibling\n )\n })\n },\n\n restart: () => self.location.reload(),\n }\n\n function deleteResolver(chunkUrl: ChunkUrl) {\n chunkResolvers.delete(chunkUrl)\n }\n})()\n\nfunction _eval({ code, url, map }: EcmascriptModuleEntry): ModuleFactory {\n code += `\\n\\n//# sourceURL=${encodeURI(\n location.origin + CHUNK_BASE_PATH + url + CHUNK_SUFFIX_PATH\n )}`\n if (map) {\n code += `\\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${btoa(\n // btoa doesn't handle nonlatin characters, so escape them as \\x sequences\n // See https://stackoverflow.com/a/26603875\n unescape(encodeURIComponent(map))\n )}`\n }\n\n // eslint-disable-next-line no-eval\n return eval(code)\n}\n"],"names":[],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,gDAAgD;AAChD,4CAA4C;AAC5C,iDAAiD;AACjD,0DAA0D;AAE1D,IAAI;AACH,CAAC;AACA,cAAc;AACZ,aAAY,QAAQ;AAClB,eAAe;AAEf,gFAAgF;AAChF,MAAM,kBAAkB,UAAU;AAElC,IAAI,MAAM,WAAW;AACnB,MAAM,QAAQ,SAAS,gBAAgB,CACrC,CAAC,WAAW,EAAE,SAAS,eAAe,EAAE,SAAS,eAAe,EAAE,gBAAgB,eAAe,EAAE,gBAAgB,GAAG,CAAC;AAEzH,KAAK,MAAM,QAAQ,MAAM,IAAI,CAAC,OAAQ;AACpC,KAAK,MAAM;AACb;AACF,OAAO,IAAI,KAAK,WAAW;AACzB,mEAAmE;AACnE,0BAA0B;AAC1B,uEAAuE;AACvE,4DAA4D;AAC5D,MAAM,UAAU,SAAS,gBAAgB,CACvC,CAAC,YAAY,EAAE,SAAS,gBAAgB,EAAE,SAAS,gBAAgB,EAAE,gBAAgB,gBAAgB,EAAE,gBAAgB,GAAG,CAAC;AAE7H,KAAK,MAAM,UAAU,MAAM,IAAI,CAAC,SAAU;AACxC,OAAO,MAAM;AACf;AACF,OAAO;AACL,MAAM,IAAI,MAAM,CAAC,mCAAmC,EAAE,UAAU;AAClE;AACF;AAEA,aAAY,QAAQ;AAClB,OAAO,IAAI,QAAc,CAAC,SAAS;AACjC,IAAI,CAAC,MAAM,WAAW;AACpB,OAAO,IAAI,MAAM;AACjB;AACF;AAEA,MAAM,kBAAkB,UAAU;AAClC,MAAM,gBAAgB,SAA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AC3B;AACL;AAEA,mCAAmC;AACnC,OAAO,KAAK;AACd","ignoreList":[0]}}] + {"offset": {"line": 14, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime-utils.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * TurboPack ECMAScript runtimes.\n *\n * It will be prepended to the runtime code of each runtime.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n\ntype EsmNamespaceObject = Record\n\n// @ts-ignore Defined in `dev-base.ts`\ndeclare function getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: M\n): M\n\nconst REEXPORTED_OBJECTS = Symbol('reexported objects')\n\ntype ModuleContextMap = Record\n\ninterface ModuleContextEntry {\n id: () => ModuleId\n module: () => any\n}\n\ninterface ModuleContext {\n // require call\n (moduleId: ModuleId): Exports | EsmNamespaceObject\n\n // async import call\n import(moduleId: ModuleId): Promise\n\n keys(): ModuleId[]\n\n resolve(moduleId: ModuleId): ModuleId\n}\n\ntype GetOrInstantiateModuleFromParent = (\n moduleId: ModuleId,\n parentModule: M\n) => M\n\ndeclare function getOrInstantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty\nconst toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag\n\nfunction defineProp(\n obj: any,\n name: PropertyKey,\n options: PropertyDescriptor & ThisType\n) {\n if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options)\n}\n\nfunction getOverwrittenModule(\n moduleCache: ModuleCache,\n id: ModuleId\n): Module {\n let module = moduleCache[id]\n if (!module) {\n // This is invoked when a module is merged into another module, thus it wasn't invoced via\n // instantiateModule and the cache entry wasn't created yet.\n module = {\n exports: {},\n error: undefined,\n loaded: false,\n id,\n namespaceObject: undefined,\n }\n moduleCache[id] = module\n }\n return module\n}\n\n/**\n * Adds the getters to the exports object.\n */\nfunction esm(\n exports: Exports,\n getters: Record any) | [() => any, (v: any) => void]>\n) {\n defineProp(exports, '__esModule', { value: true })\n if (toStringTag) defineProp(exports, toStringTag, { value: 'Module' })\n for (const key in getters) {\n const item = getters[key]\n if (Array.isArray(item)) {\n defineProp(exports, key, {\n get: item[0],\n set: item[1],\n enumerable: true,\n })\n } else {\n defineProp(exports, key, { get: item, enumerable: true })\n }\n }\n Object.seal(exports)\n}\n\n/**\n * Makes the module an ESM with exports\n */\nfunction esmExport(\n module: Module,\n exports: Exports,\n moduleCache: ModuleCache,\n getters: Record any>,\n id: ModuleId | undefined\n) {\n if (id != null) {\n module = getOverwrittenModule(moduleCache, id)\n exports = module.exports\n }\n module.namespaceObject = module.exports\n esm(exports, getters)\n}\n\nfunction ensureDynamicExports(module: Module, exports: Exports) {\n let reexportedObjects = module[REEXPORTED_OBJECTS]\n\n if (!reexportedObjects) {\n reexportedObjects = module[REEXPORTED_OBJECTS] = []\n module.exports = module.namespaceObject = new Proxy(exports, {\n get(target, prop) {\n if (\n hasOwnProperty.call(target, prop) ||\n prop === 'default' ||\n prop === '__esModule'\n ) {\n return Reflect.get(target, prop)\n }\n for (const obj of reexportedObjects!) {\n const value = Reflect.get(obj, prop)\n if (value !== undefined) return value\n }\n return undefined\n },\n ownKeys(target) {\n const keys = Reflect.ownKeys(target)\n for (const obj of reexportedObjects!) {\n for (const key of Reflect.ownKeys(obj)) {\n if (key !== 'default' && !keys.includes(key)) keys.push(key)\n }\n }\n return keys\n },\n })\n }\n}\n\n/**\n * Dynamically exports properties from an object\n */\nfunction dynamicExport(\n module: Module,\n exports: Exports,\n moduleCache: ModuleCache,\n object: Record,\n id: ModuleId | undefined\n) {\n if (id != null) {\n module = getOverwrittenModule(moduleCache, id)\n exports = module.exports\n }\n ensureDynamicExports(module, exports)\n\n if (typeof object === 'object' && object !== null) {\n module[REEXPORTED_OBJECTS]!.push(object)\n }\n}\n\nfunction exportValue(\n module: Module,\n moduleCache: ModuleCache,\n value: any,\n id: ModuleId | undefined\n) {\n if (id != null) {\n module = getOverwrittenModule(moduleCache, id)\n }\n module.exports = value\n}\n\nfunction exportNamespace(\n module: Module,\n moduleCache: ModuleCache,\n namespace: any,\n id: ModuleId | undefined\n) {\n if (id != null) {\n module = getOverwrittenModule(moduleCache, id)\n }\n module.exports = module.namespaceObject = namespace\n}\n\nfunction createGetter(obj: Record, key: string | symbol) {\n return () => obj[key]\n}\n\n/**\n * @returns prototype of the object\n */\nconst getProto: (obj: any) => any = Object.getPrototypeOf\n ? (obj) => Object.getPrototypeOf(obj)\n : (obj) => obj.__proto__\n\n/** Prototypes that are not expanded for exports */\nconst LEAF_PROTOTYPES = [null, getProto({}), getProto([]), getProto(getProto)]\n\n/**\n * @param raw\n * @param ns\n * @param allowExportDefault\n * * `false`: will have the raw module as default export\n * * `true`: will have the default property as default export\n */\nfunction interopEsm(\n raw: Exports,\n ns: EsmNamespaceObject,\n allowExportDefault?: boolean\n) {\n const getters: { [s: string]: () => any } = Object.create(null)\n for (\n let current = raw;\n (typeof current === 'object' || typeof current === 'function') &&\n !LEAF_PROTOTYPES.includes(current);\n current = getProto(current)\n ) {\n for (const key of Object.getOwnPropertyNames(current)) {\n getters[key] = createGetter(raw, key)\n }\n }\n\n // this is not really correct\n // we should set the `default` getter if the imported module is a `.cjs file`\n if (!(allowExportDefault && 'default' in getters)) {\n getters['default'] = () => raw\n }\n\n esm(ns, getters)\n return ns\n}\n\nfunction createNS(raw: Module['exports']): EsmNamespaceObject {\n if (typeof raw === 'function') {\n return function (this: any, ...args: any[]) {\n return raw.apply(this, args)\n }\n } else {\n return Object.create(null)\n }\n}\n\nfunction esmImport(\n sourceModule: Module,\n id: ModuleId\n): Exclude {\n const module = getOrInstantiateModuleFromParent(id, sourceModule)\n if (module.error) throw module.error\n\n // any ES module has to have `module.namespaceObject` defined.\n if (module.namespaceObject) return module.namespaceObject\n\n // only ESM can be an async module, so we don't need to worry about exports being a promise here.\n const raw = module.exports\n return (module.namespaceObject = interopEsm(\n raw,\n createNS(raw),\n raw && (raw as any).__esModule\n ))\n}\n\n// Add a simple runtime require so that environments without one can still pass\n// `typeof require` CommonJS checks so that exports are correctly registered.\nconst runtimeRequire =\n // @ts-ignore\n typeof require === 'function'\n ? // @ts-ignore\n require\n : function require() {\n throw new Error('Unexpected use of runtime require')\n }\n\nfunction commonJsRequire(sourceModule: Module, id: ModuleId): Exports {\n const module = getOrInstantiateModuleFromParent(id, sourceModule)\n if (module.error) throw module.error\n return module.exports\n}\n\n/**\n * `require.context` and require/import expression runtime.\n */\nfunction moduleContext(map: ModuleContextMap): ModuleContext {\n function moduleContext(id: ModuleId): Exports {\n if (hasOwnProperty.call(map, id)) {\n return map[id].module()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.keys = (): ModuleId[] => {\n return Object.keys(map)\n }\n\n moduleContext.resolve = (id: ModuleId): ModuleId => {\n if (hasOwnProperty.call(map, id)) {\n return map[id].id()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.import = async (id: ModuleId) => {\n return await (moduleContext(id) as Promise)\n }\n\n return moduleContext\n}\n\n/**\n * Returns the path of a chunk defined by its data.\n */\nfunction getChunkPath(chunkData: ChunkData): ChunkPath {\n return typeof chunkData === 'string' ? chunkData : chunkData.path\n}\n\nfunction isPromise(maybePromise: any): maybePromise is Promise {\n return (\n maybePromise != null &&\n typeof maybePromise === 'object' &&\n 'then' in maybePromise &&\n typeof maybePromise.then === 'function'\n )\n}\n\nfunction isAsyncModuleExt(obj: T): obj is AsyncModuleExt & T {\n return turbopackQueues in obj\n}\n\nfunction createPromise() {\n let resolve: (value: T | PromiseLike) => void\n let reject: (reason?: any) => void\n\n const promise = new Promise((res, rej) => {\n reject = rej\n resolve = res\n })\n\n return {\n promise,\n resolve: resolve!,\n reject: reject!,\n }\n}\n\n// everything below is adapted from webpack\n// https://github.com/webpack/webpack/blob/6be4065ade1e252c1d8dcba4af0f43e32af1bdc1/lib/runtime/AsyncModuleRuntimeModule.js#L13\n\nconst turbopackQueues = Symbol('turbopack queues')\nconst turbopackExports = Symbol('turbopack exports')\nconst turbopackError = Symbol('turbopack error')\n\nconst enum QueueStatus {\n Unknown = -1,\n Unresolved = 0,\n Resolved = 1,\n}\n\ntype AsyncQueueFn = (() => void) & { queueCount: number }\ntype AsyncQueue = AsyncQueueFn[] & {\n status: QueueStatus\n}\n\nfunction resolveQueue(queue?: AsyncQueue) {\n if (queue && queue.status !== QueueStatus.Resolved) {\n queue.status = QueueStatus.Resolved\n queue.forEach((fn) => fn.queueCount--)\n queue.forEach((fn) => (fn.queueCount-- ? fn.queueCount++ : fn()))\n }\n}\n\ntype Dep = Exports | AsyncModulePromise | Promise\n\ntype AsyncModuleExt = {\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => void\n [turbopackExports]: Exports\n [turbopackError]?: any\n}\n\ntype AsyncModulePromise = Promise & AsyncModuleExt\n\nfunction wrapDeps(deps: Dep[]): AsyncModuleExt[] {\n return deps.map((dep): AsyncModuleExt => {\n if (dep !== null && typeof dep === 'object') {\n if (isAsyncModuleExt(dep)) return dep\n if (isPromise(dep)) {\n const queue: AsyncQueue = Object.assign([], {\n status: QueueStatus.Unresolved,\n })\n\n const obj: AsyncModuleExt = {\n [turbopackExports]: {},\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => fn(queue),\n }\n\n dep.then(\n (res) => {\n obj[turbopackExports] = res\n resolveQueue(queue)\n },\n (err) => {\n obj[turbopackError] = err\n resolveQueue(queue)\n }\n )\n\n return obj\n }\n }\n\n return {\n [turbopackExports]: dep,\n [turbopackQueues]: () => {},\n }\n })\n}\n\nfunction asyncModule(\n module: Module,\n body: (\n handleAsyncDependencies: (\n deps: Dep[]\n ) => Exports[] | Promise<() => Exports[]>,\n asyncResult: (err?: any) => void\n ) => void,\n hasAwait: boolean\n) {\n const queue: AsyncQueue | undefined = hasAwait\n ? Object.assign([], { status: QueueStatus.Unknown })\n : undefined\n\n const depQueues: Set = new Set()\n\n const { resolve, reject, promise: rawPromise } = createPromise()\n\n const promise: AsyncModulePromise = Object.assign(rawPromise, {\n [turbopackExports]: module.exports,\n [turbopackQueues]: (fn) => {\n queue && fn(queue)\n depQueues.forEach(fn)\n promise['catch'](() => {})\n },\n } satisfies AsyncModuleExt)\n\n const attributes: PropertyDescriptor = {\n get(): any {\n return promise\n },\n set(v: any) {\n // Calling `esmExport` leads to this.\n if (v !== promise) {\n promise[turbopackExports] = v\n }\n },\n }\n\n Object.defineProperty(module, 'exports', attributes)\n Object.defineProperty(module, 'namespaceObject', attributes)\n\n function handleAsyncDependencies(deps: Dep[]) {\n const currentDeps = wrapDeps(deps)\n\n const getResult = () =>\n currentDeps.map((d) => {\n if (d[turbopackError]) throw d[turbopackError]\n return d[turbopackExports]\n })\n\n const { promise, resolve } = createPromise<() => Exports[]>()\n\n const fn: AsyncQueueFn = Object.assign(() => resolve(getResult), {\n queueCount: 0,\n })\n\n function fnQueue(q: AsyncQueue) {\n if (q !== queue && !depQueues.has(q)) {\n depQueues.add(q)\n if (q && q.status === QueueStatus.Unresolved) {\n fn.queueCount++\n q.push(fn)\n }\n }\n }\n\n currentDeps.map((dep) => dep[turbopackQueues](fnQueue))\n\n return fn.queueCount ? promise : getResult()\n }\n\n function asyncResult(err?: any) {\n if (err) {\n reject((promise[turbopackError] = err))\n } else {\n resolve(promise[turbopackExports])\n }\n\n resolveQueue(queue)\n }\n\n body(handleAsyncDependencies, asyncResult)\n\n if (queue && queue.status === QueueStatus.Unknown) {\n queue.status = QueueStatus.Unresolved\n }\n}\n\n/**\n * A pseudo \"fake\" URL object to resolve to its relative path.\n *\n * When UrlRewriteBehavior is set to relative, calls to the `new URL()` will construct url without base using this\n * runtime function to generate context-agnostic urls between different rendering context, i.e ssr / client to avoid\n * hydration mismatch.\n *\n * This is based on webpack's existing implementation:\n * https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/runtime/RelativeUrlRuntimeModule.js\n */\nconst relativeURL = function relativeURL(this: any, inputUrl: string) {\n const realUrl = new URL(inputUrl, 'x:/')\n const values: Record = {}\n for (const key in realUrl) values[key] = (realUrl as any)[key]\n values.href = inputUrl\n values.pathname = inputUrl.replace(/[?#].*/, '')\n values.origin = values.protocol = ''\n values.toString = values.toJSON = (..._args: Array) => inputUrl\n for (const key in values)\n Object.defineProperty(this, key, {\n enumerable: true,\n configurable: true,\n value: values[key],\n })\n}\n\nrelativeURL.prototype = URL.prototype\n\n/**\n * Utility function to ensure all variants of an enum are handled.\n */\nfunction invariant(never: never, computeMessage: (arg: any) => string): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n}\n\n/**\n * A stub function to make `require` available but non-functional in ESM.\n */\nfunction requireStub(_moduleId: ModuleId): never {\n throw new Error('dynamic usage of require is not supported')\n}\n"],"names":[],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,6CAA6C;AAU7C,MAAM,qBAAqB,OAAO;AA+BlC,MAAM,iBAAiB,OAAO,SAAS,CAAC,cAAc;AACtD,MAAM,cAAc,OAAO,WAAW,eAAe,OAAO,WAAW;AAEvE,SAAS,WACP,GAAQ,EACR,IAAiB,EACjB,OAA2C;AAE3C,IAAI,CAAC,eAAe,IAAI,CAAC,KAAK,OAAO,OAAO,cAAc,CAAC,KAAK,MAAM;AACxE;AAEA,SAAS,qBACP,WAAgC,EAChC,EAAY;AAEZ,IAAI,SAAS,WAAW,CAAC,GAAG;AAC5B,IAAI,CAAC,QAAQ;AACX,0FAA0F;AAC1F,4DAA4D;AAC5D,SAAS;AACP,SAAS,CAAC;AACV,OAAO;AACP,QAAQ;AACR;AACA,iBAAiB;AACnB;AACA,WAAW,CAAC,GAAG,GAAG;AACpB;AACA,OAAO;AACT;AAEA;;CAEC,GACD,SAAS,IACP,OAAgB,EAChB,OAAoE;AAEpE,WAAW,SAAS,cAAc;AAAE,OAAO;AAAK;AAChD,IAAI,a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AC/B,YAAY;AACZ,cAAc;AACd,OAAO,MAAM,CAAC,IAAI;AACpB;AACJ;AAEA,YAAY,SAAS,GAAG,IAAI,SAAS;AAErC;;CAEC,GACD,SAAS,UAAU,KAAY,EAAE,cAAoC;AACnE,MAAM,IAAI,MAAM,CAAC,WAAW,EAAE,eAAe,QAAQ;AACvD;AAEA;;CAEC,GACD,SAAS,YAAY,SAAmB;AACtC,MAAM,IAAI,MAAM;AAClB","ignoreList":[0]}}, + {"offset": {"line": 378, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/runtime-base.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *development* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\n// Used in WebWorkers to tell the runtime about the chunk base path\ndeclare var TURBOPACK_WORKER_LOCATION: string\n// Used in WebWorkers to tell the runtime about the current chunk url since it can't be detected via document.currentScript\n// Note it's stored in reversed order to use push and pop\ndeclare var TURBOPACK_NEXT_CHUNK_URLS: ChunkUrl[] | undefined\n\n// Injected by rust code\ndeclare var CHUNK_BASE_PATH: string\ndeclare var CHUNK_SUFFIX_PATH: string\n\n// Provided by build or dev base\ndeclare function instantiateModule(id: ModuleId, source: SourceInfo): Module\n\ntype RuntimeParams = {\n otherChunks: ChunkData[]\n runtimeModuleIds: ModuleId[]\n}\n\ntype ChunkRegistration = [\n chunkPath: ChunkScript,\n chunkModules: CompressedModuleFactories,\n params: RuntimeParams | undefined,\n]\n\ntype ChunkList = {\n script: ChunkListScript\n chunks: ChunkData[]\n source: 'entry' | 'dynamic'\n}\n\nenum SourceType {\n /**\n * The module was instantiated because it was included in an evaluated chunk's\n * runtime.\n */\n Runtime = 0,\n /**\n * The module was instantiated because a parent module imported it.\n */\n Parent = 1,\n /**\n * The module was instantiated because it was included in a chunk's hot module\n * update.\n */\n Update = 2,\n}\n\ntype SourceInfo =\n | {\n type: SourceType.Runtime\n chunkPath: ChunkPath\n }\n | {\n type: SourceType.Parent\n parentId: ModuleId\n }\n | {\n type: SourceType.Update\n parents?: ModuleId[]\n }\n\ninterface RuntimeBackend {\n registerChunk: (chunkPath: ChunkPath, params?: RuntimeParams) => void\n loadChunk: (chunkUrl: ChunkUrl, source: SourceInfo) => Promise\n}\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nconst moduleFactories: ModuleFactories = Object.create(null)\n/**\n * Module IDs that are instantiated as part of the runtime of a chunk.\n */\nconst runtimeModules: Set = new Set()\n/**\n * Map from module ID to the chunks that contain this module.\n *\n * In HMR, we need to keep track of which modules are contained in which so\n * chunks. This is so we don't eagerly dispose of a module when it is removed\n * from chunk A, but still exists in chunk B.\n */\nconst moduleChunksMap: Map> = new Map()\n/**\n * Map from a chunk path to all modules it contains.\n */\nconst chunkModulesMap: Map> = new Map()\n/**\n * Chunk lists that contain a runtime. When these chunk lists receive an update\n * that can't be reconciled with the current state of the page, we need to\n * reload the runtime entirely.\n */\nconst runtimeChunkLists: Set = new Set()\n/**\n * Map from a chunk list to the chunk paths it contains.\n */\nconst chunkListChunksMap: Map> = new Map()\n/**\n * Map from a chunk path to the chunk lists it belongs to.\n */\nconst chunkChunkListsMap: Map> = new Map()\n\nconst availableModules: Map | true> = new Map()\n\nconst availableModuleChunks: Map | true> = new Map()\n\nasync function loadChunk(\n source: SourceInfo,\n chunkData: ChunkData\n): Promise {\n if (typeof chunkData === 'string') {\n return loadChunkPath(source, chunkData)\n }\n\n const includedList = chunkData.included || []\n const modulesPromises = includedList.map((included) => {\n if (moduleFactories[included]) return true\n return availableModules.get(included)\n })\n if (modulesPromises.length > 0 && modulesPromises.every((p) => p)) {\n // When all included items are already loaded or loading, we can skip loading ourselves\n return Promise.all(modulesPromises)\n }\n\n const includedModuleChunksList = chunkData.moduleChunks || []\n const moduleChunksPromises = includedModuleChunksList\n .map((included) => {\n // TODO(alexkirsz) Do we need this check?\n // if (moduleFactories[included]) return true;\n return availableModuleChunks.get(included)\n })\n .filter((p) => p)\n\n let promise\n if (moduleChunksPromises.length > 0) {\n // Some module chunks are already loaded or loading.\n\n if (moduleChunksPromises.length === includedModuleChunksList.length) {\n // When all included module chunks are already loaded or loading, we can skip loading ourselves\n return Promise.all(moduleChunksPromises)\n }\n\n const moduleChunksToLoad: Set = new Set()\n for (const moduleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(moduleChunk)) {\n moduleChunksToLoad.add(moduleChunk)\n }\n }\n\n for (const moduleChunkToLoad of moduleChunksToLoad) {\n const promise = loadChunkPath(source, moduleChunkToLoad)\n\n availableModuleChunks.set(moduleChunkToLoad, promise)\n\n moduleChunksPromises.push(promise)\n }\n\n promise = Promise.all(moduleChunksPromises)\n } else {\n promise = loadChunkPath(source, chunkData.path)\n\n // Mark all included module chunks as loading if they are not already loaded or loading.\n for (const includedModuleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(includedModuleChunk)) {\n availableModuleChunks.set(includedModuleChunk, promise)\n }\n }\n }\n\n for (const included of includedList) {\n if (!availableModules.has(included)) {\n // It might be better to race old and new promises, but it's rare that the new promise will be faster than a request started earlier.\n // In production it's even more rare, because the chunk optimization tries to deduplicate modules anyway.\n availableModules.set(included, promise)\n }\n }\n\n return promise\n}\n\nasync function loadChunkByUrl(source: SourceInfo, chunkUrl: ChunkUrl) {\n try {\n await BACKEND.loadChunk(chunkUrl, source)\n } catch (error) {\n let loadReason\n switch (source.type) {\n case SourceType.Runtime:\n loadReason = `as a runtime dependency of chunk ${source.chunkPath}`\n break\n case SourceType.Parent:\n loadReason = `from module ${source.parentId}`\n break\n case SourceType.Update:\n loadReason = 'from an HMR update'\n break\n default:\n invariant(source, (source) => `Unknown source type: ${source?.type}`)\n }\n throw new Error(\n `Failed to load chunk ${chunkUrl} ${loadReason}${\n error ? `: ${error}` : ''\n }`,\n error\n ? {\n cause: error,\n }\n : undefined\n )\n }\n}\n\nasync function loadChunkPath(\n source: SourceInfo,\n chunkPath: ChunkPath\n): Promise {\n const url = getChunkRelativeUrl(chunkPath)\n return loadChunkByUrl(source, url)\n}\n\n/**\n * Returns an absolute url to an asset.\n */\nfunction createResolvePathFromModule(\n resolver: (moduleId: string) => Exports\n): (moduleId: string) => string {\n return function resolvePathFromModule(moduleId: string): string {\n const exported = resolver(moduleId)\n return exported?.default ?? exported\n }\n}\n\n/**\n * no-op for browser\n * @param modulePath\n */\nfunction resolveAbsolutePath(modulePath?: string): string {\n return `/ROOT/${modulePath ?? ''}`\n}\n\n/**\n * Returns a blob URL for the worker.\n * @param chunks list of chunks to load\n */\nfunction getWorkerBlobURL(chunks: ChunkPath[]): string {\n // It is important to reverse the array so when bootstrapping we can infer what chunk is being\n // evaluated by poping urls off of this array. See `getPathFromScript`\n let bootstrap = `self.TURBOPACK_WORKER_LOCATION = ${JSON.stringify(location.origin)};\nself.TURBOPACK_NEXT_CHUNK_URLS = ${JSON.stringify(chunks.reverse().map(getChunkRelativeUrl), null, 2)};\nimportScripts(...self.TURBOPACK_NEXT_CHUNK_URLS.map(c => self.TURBOPACK_WORKER_LOCATION + c).reverse());`\n let blob = new Blob([bootstrap], { type: 'text/javascript' })\n return URL.createObjectURL(blob)\n}\n\n/**\n * Adds a module to a chunk.\n */\nfunction addModuleToChunk(moduleId: ModuleId, chunkPath: ChunkPath) {\n let moduleChunks = moduleChunksMap.get(moduleId)\n if (!moduleChunks) {\n moduleChunks = new Set([chunkPath])\n moduleChunksMap.set(moduleId, moduleChunks)\n } else {\n moduleChunks.add(chunkPath)\n }\n\n let chunkModules = chunkModulesMap.get(chunkPath)\n if (!chunkModules) {\n chunkModules = new Set([moduleId])\n chunkModulesMap.set(chunkPath, chunkModules)\n } else {\n chunkModules.add(moduleId)\n }\n}\n\n/**\n * Returns the first chunk that included a module.\n * This is used by the Node.js backend, hence why it's marked as unused in this\n * file.\n */\nfunction getFirstModuleChunk(moduleId: ModuleId) {\n const moduleChunkPaths = moduleChunksMap.get(moduleId)\n if (moduleChunkPaths == null) {\n return null\n }\n\n return moduleChunkPaths.values().next().value\n}\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n return instantiateModule(moduleId, { type: SourceType.Runtime, chunkPath })\n}\n/**\n * Returns the URL relative to the origin where a chunk can be fetched from.\n */\nfunction getChunkRelativeUrl(chunkPath: ChunkPath | ChunkListPath): ChunkUrl {\n return `${CHUNK_BASE_PATH}${chunkPath\n .split('/')\n .map((p) => encodeURIComponent(p))\n .join('/')}${CHUNK_SUFFIX_PATH}` as ChunkUrl\n}\n\n/**\n * Return the ChunkPath from a ChunkScript.\n */\nfunction getPathFromScript(chunkScript: ChunkPath | ChunkScript): ChunkPath\nfunction getPathFromScript(\n chunkScript: ChunkListPath | ChunkListScript\n): ChunkListPath\nfunction getPathFromScript(\n chunkScript: ChunkPath | ChunkListPath | ChunkScript | ChunkListScript\n): ChunkPath | ChunkListPath {\n if (typeof chunkScript === 'string') {\n return chunkScript as ChunkPath | ChunkListPath\n }\n const chunkUrl =\n typeof TURBOPACK_NEXT_CHUNK_URLS !== 'undefined'\n ? TURBOPACK_NEXT_CHUNK_URLS.pop()!\n : chunkScript.getAttribute('src')!\n const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/, ''))\n const path = src.startsWith(CHUNK_BASE_PATH)\n ? src.slice(CHUNK_BASE_PATH.length)\n : src\n return path as ChunkPath | ChunkListPath\n}\n\n/**\n * Marks a chunk list as a runtime chunk list. There can be more than one\n * runtime chunk list. For instance, integration tests can have multiple chunk\n * groups loaded at runtime, each with its own chunk list.\n */\nfunction markChunkListAsRuntime(chunkListPath: ChunkListPath) {\n runtimeChunkLists.add(chunkListPath)\n}\n\nfunction registerChunk([\n chunkScript,\n chunkModules,\n runtimeParams,\n]: ChunkRegistration) {\n const chunkPath = getPathFromScript(chunkScript)\n for (const [moduleId, moduleFactory] of Object.entries(chunkModules)) {\n if (!moduleFactories[moduleId]) {\n if (Array.isArray(moduleFactory)) {\n let [moduleFactoryFn, otherIds] = moduleFactory\n moduleFactories[moduleId] = moduleFactoryFn\n for (const otherModuleId of otherIds) {\n moduleFactories[otherModuleId] = moduleFactoryFn\n }\n } else {\n moduleFactories[moduleId] = moduleFactory\n }\n }\n addModuleToChunk(moduleId, chunkPath)\n }\n\n return BACKEND.registerChunk(chunkPath, runtimeParams)\n}\n\nconst regexJsUrl = /\\.js(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment.\n */\nfunction isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {\n return regexJsUrl.test(chunkUrlOrPath)\n}\n\nconst regexCssUrl = /\\.css(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .css, optionally followed by ?query or #fragment.\n */\nfunction isCss(chunkUrl: ChunkUrl): boolean {\n return regexCssUrl.test(chunkUrl)\n}\n"],"names":[],"mappings":"AAAA;;;;;;CAMC,GAED,oDAAoD,GAEpD,6CAA6C;AAC7C,yDAAyD;AAEzD,mEAAmE;AA8BnE,IAAA,AAAK,oCAAA;AACH;;;GAGC;AAED;;GAEC;AAED;;;GAGC;OAbE;EAAA;AA0CL,MAAM,kBAAmC,OAAO,MAAM,CAAC;AACvD;;CAEC,GACD,MAAM,iBAAgC,IAAI;AAC1C;;;;;;CAMC,GACD,MAAM,kBAAiD,IAAI;AAC3D;;CAEC,GACD,MAAM,kBAAiD,IAAI;AAC3D;;;;CAIC,GACD,MAAM,oBAAwC,IAAI;AAClD;;CAEC,GACD,MAAM,qBAAyD,IAAI;AACnE;;CAEC,GACD,MAAM,qBAAyD,IAAI;AAEnE,MAAM,mBAAuD,IAAI;AAEjE,MAAM,wBAA6D,IAAI;AAEvE,eAAe,UACb,MAAkB,EAClB,SAAoB;AAEpB,I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gBAAgB,MAAM,IAChC;AACJ,OAAO;AACT;AAEA;;;;CAIC,GACD,SAAS,uBAAuB,aAA4B;AAC1D,kBAAkB,GAAG,CAAC;AACxB;AAEA,SAAS,cAAc,CACrB,aACA,cACA,cACkB;AAClB,MAAM,YAAY,kBAAkB;AACpC,KAAK,MAAM,CAAC,UAAU,cAAc,IAAI,OAAO,OAAO,CAAC,cAAe;AACpE,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE;AAC9B,IAAI,MAAM,OAAO,CAAC,gBAAgB;AAChC,IAAI,CAAC,iBAAiB,SAAS,GAAG;AAClC,eAAe,CAAC,SAAS,GAAG;AAC5B,KAAK,MAAM,iBAAiB,SAAU;AACpC,eAAe,CAAC,cAAc,GAAG;AACnC;AACF,OAAO;AACL,eAAe,CAAC,SAAS,GAAG;AAC9B;AACF;AACA,iBAAiB,UAAU;AAC7B;AAEA,OAAO,QAAQ,aAAa,CAAC,WAAW;AAC1C;AAEA,MAAM,aAAa;AACnB;;CAEC,GACD,SAAS,KAAK,cAAoC;AAChD,OAAO,WAAW,IAAI,CAAC;AACzB;AAEA,MAAM,cAAc;AACpB;;CAEC,GACD,SAAS,MAAM,QAAkB;AAC/B,OAAO,YAAY,IAAI,CAAC;AAC1B","ignoreList":[0]}}, + {"offset": {"line": 633, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/dev-base.ts"],"sourcesContent":["/// \n/// \n/// \n\n/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *development* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\nconst devModuleCache: ModuleCache = Object.create(null)\n\n// This file must not use `import` and `export` statements. Otherwise, it\n// becomes impossible to augment interfaces declared in ``d files\n// (e.g. `Module`). Hence, the need for `import()` here.\ntype RefreshRuntimeGlobals =\n import('@next/react-refresh-utils/dist/runtime').RefreshRuntimeGlobals\n\ndeclare var $RefreshHelpers$: RefreshRuntimeGlobals['$RefreshHelpers$']\ndeclare var $RefreshReg$: RefreshRuntimeGlobals['$RefreshReg$']\ndeclare var $RefreshSig$: RefreshRuntimeGlobals['$RefreshSig$']\ndeclare var $RefreshInterceptModuleExecution$: RefreshRuntimeGlobals['$RefreshInterceptModuleExecution$']\n\ntype RefreshContext = {\n register: RefreshRuntimeGlobals['$RefreshReg$']\n signature: RefreshRuntimeGlobals['$RefreshSig$']\n registerExports: typeof registerExportsAndSetupBoundaryForReactRefresh\n}\n\ntype RefreshHelpers = RefreshRuntimeGlobals['$RefreshHelpers$']\n\ninterface TurbopackDevBaseContext extends TurbopackBaseContext {\n k: RefreshContext\n R: ResolvePathFromModule\n}\n\ninterface TurbopackDevContext extends TurbopackDevBaseContext {}\n\ntype ModuleFactory = (\n this: Module['exports'],\n context: TurbopackDevBaseContext\n) => unknown\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nclass UpdateApplyError extends Error {\n name = 'UpdateApplyError'\n\n dependencyChain: string[]\n\n constructor(message: string, dependencyChain: string[]) {\n super(message)\n this.dependencyChain = dependencyChain\n }\n}\n\n/**\n * Maps module IDs to persisted data between executions of their hot module\n * implementation (`hot.data`).\n */\nconst moduleHotData: Map = new Map()\n/**\n * Maps module instances to their hot module state.\n */\nconst moduleHotState: Map = new Map()\n/**\n * Modules that call `module.hot.invalidate()` (while being updated).\n */\nconst queuedInvalidatedModules: Set = new Set()\n\n/**\n * Gets or instantiates a runtime module.\n */\n// @ts-ignore\nfunction getOrInstantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n const module = devModuleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n // @ts-ignore\n return instantiateModule(moduleId, { type: SourceType.Runtime, chunkPath })\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it if it is not cached.\n */\n// @ts-ignore Defined in `runtime-utils.ts`\nconst getOrInstantiateModuleFromParent: GetOrInstantiateModuleFromParent<\n HotModule\n> = (id, sourceModule) => {\n if (!sourceModule.hot.active) {\n console.warn(\n `Unexpected import of module ${id} from module ${sourceModule.id}, which was deleted by an HMR update`\n )\n }\n\n const module = devModuleCache[id]\n\n if (sourceModule.children.indexOf(id) === -1) {\n sourceModule.children.push(id)\n }\n\n if (module) {\n if (module.parents.indexOf(sourceModule.id) === -1) {\n module.parents.push(sourceModule.id)\n }\n\n return module\n }\n\n return instantiateModule(id, {\n type: SourceType.Parent,\n parentId: sourceModule.id,\n })\n}\n\n// @ts-ignore Defined in `runtime-base.ts`\nfunction instantiateModule(id: ModuleId, source: SourceInfo): Module {\n const moduleFactory = moduleFactories[id]\n if (typeof moduleFactory !== 'function') {\n // This can happen if modules incorrectly handle HMR disposes/updates,\n // e.g. when they keep a `setTimeout` around which still executes old code\n // and contains e.g. a `require(\"something\")` call.\n let instantiationReason\n switch (source.type) {\n case SourceType.Runtime:\n instantiationReason = `as a runtime entry of chunk ${source.chunkPath}`\n break\n case SourceType.Parent:\n instantiationReason = `because it was required from module ${source.parentId}`\n break\n case SourceType.Update:\n instantiationReason = 'because of an HMR update'\n break\n default:\n invariant(source, (source) => `Unknown source type: ${source?.type}`)\n }\n throw new Error(\n `Module ${id} was instantiated ${instantiationReason}, but the module factory is not available. It might have been deleted in an HMR update.`\n )\n }\n\n const hotData = moduleHotData.get(id)!\n const { hot, hotState } = createModuleHot(id, hotData)\n\n let parents: ModuleId[]\n switch (source.type) {\n case SourceType.Runtime:\n runtimeModules.add(id)\n parents = []\n break\n case SourceType.Parent:\n // No need to add this module as a child of the parent module here, this\n // has already been taken care of in `getOrInstantiateModuleFromParent`.\n parents = [source.parentId]\n break\n case SourceType.Update:\n parents = source.parents || []\n break\n default:\n invariant(source, (source) => `Unknown source type: ${source?.type}`)\n }\n\n const module: HotModule = {\n exports: {},\n error: undefined,\n loaded: false,\n id,\n parents,\n children: [],\n namespaceObject: undefined,\n hot,\n }\n\n devModuleCache[id] = module\n moduleHotState.set(module, hotState)\n\n // NOTE(alexkirsz) This can fail when the module encounters a runtime error.\n try {\n const sourceInfo: SourceInfo = { type: SourceType.Parent, parentId: id }\n\n runModuleExecutionHooks(module, (refresh) => {\n const r = commonJsRequire.bind(null, module)\n moduleFactory.call(\n module.exports,\n augmentContext({\n a: asyncModule.bind(null, module),\n e: module.exports,\n r: commonJsRequire.bind(null, module),\n t: runtimeRequire,\n f: moduleContext,\n i: esmImport.bind(null, module),\n s: esmExport.bind(null, module, module.exports, devModuleCache),\n j: dynamicExport.bind(null, module, module.exports, devModuleCache),\n v: exportValue.bind(null, module, devModuleCache),\n n: exportNamespace.bind(null, module, devModuleCache),\n m: module,\n c: devModuleCache,\n M: moduleFactories,\n l: loadChunk.bind(null, sourceInfo),\n L: loadChunkByUrl.bind(null, sourceInfo),\n w: loadWebAssembly.bind(null, sourceInfo),\n u: loadWebAssemblyModule.bind(null, sourceInfo),\n P: resolveAbsolutePath,\n U: relativeURL,\n k: refresh,\n R: createResolvePathFromModule(r),\n b: getWorkerBlobURL,\n z: requireStub,\n })\n )\n })\n } catch (error) {\n module.error = error as any\n throw error\n }\n\n module.loaded = true\n if (module.namespaceObject && module.exports !== module.namespaceObject) {\n // in case of a circular dependency: cjs1 -> esm2 -> cjs1\n interopEsm(module.exports, module.namespaceObject)\n }\n\n return module\n}\n\n/**\n * NOTE(alexkirsz) Webpack has a \"module execution\" interception hook that\n * Next.js' React Refresh runtime hooks into to add module context to the\n * refresh registry.\n */\nfunction runModuleExecutionHooks(\n module: Module,\n executeModule: (ctx: RefreshContext) => void\n) {\n if (typeof globalThis.$RefreshInterceptModuleExecution$ === 'function') {\n const cleanupReactRefreshIntercept =\n globalThis.$RefreshInterceptModuleExecution$(module.id)\n try {\n executeModule({\n register: globalThis.$RefreshReg$,\n signature: globalThis.$RefreshSig$,\n registerExports: registerExportsAndSetupBoundaryForReactRefresh,\n })\n } finally {\n // Always cleanup the intercept, even if module execution failed.\n cleanupReactRefreshIntercept()\n }\n } else {\n // If the react refresh hooks are not installed we need to bind dummy functions.\n // This is expected when running in a Web Worker. It is also common in some of\n // our test environments.\n executeModule({\n register: (type, id) => {},\n signature: () => (type) => {},\n registerExports: (module, helpers) => {},\n })\n }\n}\n\n/**\n * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts\n */\nfunction registerExportsAndSetupBoundaryForReactRefresh(\n module: HotModule,\n helpers: RefreshHelpers\n) {\n const currentExports = module.exports\n const prevExports = module.hot.data.prevExports ?? null\n\n helpers.registerExportsForReactRefresh(currentExports, module.id)\n\n // A module can be accepted automatically based on its exports, e.g. when\n // it is a Refresh Boundary.\n if (helpers.isReactRefreshBoundary(currentExports)) {\n // Save the previous exports on update, so we can compare the boundary\n // signatures.\n module.hot.dispose((data) => {\n data.prevExports = currentExports\n })\n // Unconditionally accept an update to this module, we'll check if it's\n // still a Refresh Boundary later.\n module.hot.accept()\n\n // This field is set when the previous version of this module was a\n // Refresh Boundary, letting us know we need to check for invalidation or\n // enqueue an update.\n if (prevExports !== null) {\n // A boundary can become ineligible if its exports are incompatible\n // with the previous exports.\n //\n // For example, if you add/remove/change exports, we'll want to\n // re-execute the importing modules, and force those components to\n // re-render. Similarly, if you convert a class component to a\n // function, we want to invalidate the boundary.\n if (\n helpers.shouldInvalidateReactRefreshBoundary(\n helpers.getRefreshBoundarySignature(prevExports),\n helpers.getRefreshBoundarySignature(currentExports)\n )\n ) {\n module.hot.invalidate()\n } else {\n helpers.scheduleUpdate()\n }\n }\n } else {\n // Since we just executed the code for the module, it's possible that the\n // new exports made it ineligible for being a boundary.\n // We only care about the case when we were _previously_ a boundary,\n // because we already accepted this update (accidental side effect).\n const isNoLongerABoundary = prevExports !== null\n if (isNoLongerABoundary) {\n module.hot.invalidate()\n }\n }\n}\n\nfunction formatDependencyChain(dependencyChain: ModuleId[]): string {\n return `Dependency chain: ${dependencyChain.join(' -> ')}`\n}\n\nfunction computeOutdatedModules(\n added: Map,\n modified: Map\n): {\n outdatedModules: Set\n newModuleFactories: Map\n} {\n const newModuleFactories = new Map()\n\n for (const [moduleId, entry] of added) {\n if (entry != null) {\n newModuleFactories.set(moduleId, _eval(entry))\n }\n }\n\n const outdatedModules = computedInvalidatedModules(modified.keys())\n\n for (const [moduleId, entry] of modified) {\n newModuleFactories.set(moduleId, _eval(entry))\n }\n\n return { outdatedModules, newModuleFactories }\n}\n\nfunction computedInvalidatedModules(\n invalidated: Iterable\n): Set {\n const outdatedModules = new Set()\n\n for (const moduleId of invalidated) {\n const effect = getAffectedModuleEffects(moduleId)\n\n switch (effect.type) {\n case 'unaccepted':\n throw new UpdateApplyError(\n `cannot apply update: unaccepted module. ${formatDependencyChain(\n effect.dependencyChain\n )}.`,\n effect.dependencyChain\n )\n case 'self-declined':\n throw new UpdateApplyError(\n `cannot apply update: self-declined module. ${formatDependencyChain(\n effect.dependencyChain\n )}.`,\n effect.dependencyChain\n )\n case 'accepted':\n for (const outdatedModuleId of effect.outdatedModules) {\n outdatedModules.add(outdatedModuleId)\n }\n break\n // TODO(alexkirsz) Dependencies: handle dependencies effects.\n default:\n invariant(effect, (effect) => `Unknown effect type: ${effect?.type}`)\n }\n }\n\n return outdatedModules\n}\n\nfunction computeOutdatedSelfAcceptedModules(\n outdatedModules: Iterable\n): { moduleId: ModuleId; errorHandler: true | Function }[] {\n const outdatedSelfAcceptedModules: {\n moduleId: ModuleId\n errorHandler: true | Function\n }[] = []\n for (const moduleId of outdatedModules) {\n const module = devModuleCache[moduleId]\n const hotState = moduleHotState.get(module)!\n if (module && hotState.selfAccepted && !hotState.selfInvalidated) {\n outdatedSelfAcceptedModules.push({\n moduleId,\n errorHandler: hotState.selfAccepted,\n })\n }\n }\n return outdatedSelfAcceptedModules\n}\n\n/**\n * Adds, deletes, and moves modules between chunks. This must happen before the\n * dispose phase as it needs to know which modules were removed from all chunks,\n * which we can only compute *after* taking care of added and moved modules.\n */\nfunction updateChunksPhase(\n chunksAddedModules: Map>,\n chunksDeletedModules: Map>\n): { disposedModules: Set } {\n for (const [chunkPath, addedModuleIds] of chunksAddedModules) {\n for (const moduleId of addedModuleIds) {\n addModuleToChunk(moduleId, chunkPath)\n }\n }\n\n const disposedModules: Set = new Set()\n for (const [chunkPath, addedModuleIds] of chunksDeletedModules) {\n for (const moduleId of addedModuleIds) {\n if (removeModuleFromChunk(moduleId, chunkPath)) {\n disposedModules.add(moduleId)\n }\n }\n }\n\n return { disposedModules }\n}\n\nfunction disposePhase(\n outdatedModules: Iterable,\n disposedModules: Iterable\n): { outdatedModuleParents: Map> } {\n for (const moduleId of outdatedModules) {\n disposeModule(moduleId, 'replace')\n }\n\n for (const moduleId of disposedModules) {\n disposeModule(moduleId, 'clear')\n }\n\n // Removing modules from the module cache is a separate step.\n // We also want to keep track of previous parents of the outdated modules.\n const outdatedModuleParents = new Map()\n for (const moduleId of outdatedModules) {\n const oldModule = devModuleCache[moduleId]\n outdatedModuleParents.set(moduleId, oldModule?.parents)\n delete devModuleCache[moduleId]\n }\n\n // TODO(alexkirsz) Dependencies: remove outdated dependency from module\n // children.\n\n return { outdatedModuleParents }\n}\n\n/**\n * Disposes of an instance of a module.\n *\n * Returns the persistent hot data that should be kept for the next module\n * instance.\n *\n * NOTE: mode = \"replace\" will not remove modules from the devModuleCache\n * This must be done in a separate step afterwards.\n * This is important because all modules need to be disposed to update the\n * parent/child relationships before they are actually removed from the devModuleCache.\n * If this was done in this method, the following disposeModule calls won't find\n * the module from the module id in the cache.\n */\nfunction disposeModule(moduleId: ModuleId, mode: 'clear' | 'replace') {\n const module = devModuleCache[moduleId]\n if (!module) {\n return\n }\n\n const hotState = moduleHotState.get(module)!\n const data = {}\n\n // Run the `hot.dispose` handler, if any, passing in the persistent\n // `hot.data` object.\n for (const disposeHandler of hotState.disposeHandlers) {\n disposeHandler(data)\n }\n\n // This used to warn in `getOrInstantiateModuleFromParent` when a disposed\n // module is still importing other modules.\n module.hot.active = false\n\n moduleHotState.delete(module)\n\n // TODO(alexkirsz) Dependencies: delete the module from outdated deps.\n\n // Remove the disposed module from its children's parent list.\n // It will be added back once the module re-instantiates and imports its\n // children again.\n for (const childId of module.children) {\n const child = devModuleCache[childId]\n if (!child) {\n continue\n }\n\n const idx = child.parents.indexOf(module.id)\n if (idx >= 0) {\n child.parents.splice(idx, 1)\n }\n }\n\n switch (mode) {\n case 'clear':\n delete devModuleCache[module.id]\n moduleHotData.delete(module.id)\n break\n case 'replace':\n moduleHotData.set(module.id, data)\n break\n default:\n invariant(mode, (mode) => `invalid mode: ${mode}`)\n }\n}\n\nfunction applyPhase(\n outdatedSelfAcceptedModules: {\n moduleId: ModuleId\n errorHandler: true | Function\n }[],\n newModuleFactories: Map,\n outdatedModuleParents: Map>,\n reportError: (err: any) => void\n) {\n // Update module factories.\n for (const [moduleId, factory] of newModuleFactories.entries()) {\n moduleFactories[moduleId] = factory\n }\n\n // TODO(alexkirsz) Run new runtime entries here.\n\n // TODO(alexkirsz) Dependencies: call accept handlers for outdated deps.\n\n // Re-instantiate all outdated self-accepted modules.\n for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) {\n try {\n instantiateModule(moduleId, {\n type: SourceType.Update,\n parents: outdatedModuleParents.get(moduleId),\n })\n } catch (err) {\n if (typeof errorHandler === 'function') {\n try {\n errorHandler(err, { moduleId, module: devModuleCache[moduleId] })\n } catch (err2) {\n reportError(err2)\n reportError(err)\n }\n } else {\n reportError(err)\n }\n }\n }\n}\n\nfunction applyUpdate(update: PartialUpdate) {\n switch (update.type) {\n case 'ChunkListUpdate':\n applyChunkListUpdate(update)\n break\n default:\n invariant(update, (update) => `Unknown update type: ${update.type}`)\n }\n}\n\nfunction applyChunkListUpdate(update: ChunkListUpdate) {\n if (update.merged != null) {\n for (const merged of update.merged) {\n switch (merged.type) {\n case 'EcmascriptMergedUpdate':\n applyEcmascriptMergedUpdate(merged)\n break\n default:\n invariant(merged, (merged) => `Unknown merged type: ${merged.type}`)\n }\n }\n }\n\n if (update.chunks != null) {\n for (const [chunkPath, chunkUpdate] of Object.entries(\n update.chunks\n ) as Array<[ChunkPath, ChunkUpdate]>) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n switch (chunkUpdate.type) {\n case 'added':\n BACKEND.loadChunk(chunkUrl, { type: SourceType.Update })\n break\n case 'total':\n DEV_BACKEND.reloadChunk?.(chunkUrl)\n break\n case 'deleted':\n DEV_BACKEND.unloadChunk?.(chunkUrl)\n break\n case 'partial':\n invariant(\n chunkUpdate.instruction,\n (instruction) =>\n `Unknown partial instruction: ${JSON.stringify(instruction)}.`\n )\n break\n default:\n invariant(\n chunkUpdate,\n (chunkUpdate) => `Unknown chunk update type: ${chunkUpdate.type}`\n )\n }\n }\n }\n}\n\nfunction applyEcmascriptMergedUpdate(update: EcmascriptMergedUpdate) {\n const { entries = {}, chunks = {} } = update\n const { added, modified, chunksAdded, chunksDeleted } = computeChangedModules(\n entries,\n chunks\n )\n const { outdatedModules, newModuleFactories } = computeOutdatedModules(\n added,\n modified\n )\n const { disposedModules } = updateChunksPhase(chunksAdded, chunksDeleted)\n\n applyInternal(outdatedModules, disposedModules, newModuleFactories)\n}\n\nfunction applyInvalidatedModules(outdatedModules: Set) {\n if (queuedInvalidatedModules.size > 0) {\n computedInvalidatedModules(queuedInvalidatedModules).forEach((moduleId) => {\n outdatedModules.add(moduleId)\n })\n\n queuedInvalidatedModules.clear()\n }\n\n return outdatedModules\n}\n\nfunction applyInternal(\n outdatedModules: Set,\n disposedModules: Iterable,\n newModuleFactories: Map\n) {\n outdatedModules = applyInvalidatedModules(outdatedModules)\n\n const outdatedSelfAcceptedModules =\n computeOutdatedSelfAcceptedModules(outdatedModules)\n\n const { outdatedModuleParents } = disposePhase(\n outdatedModules,\n disposedModules\n )\n\n // we want to continue on error and only throw the error after we tried applying all updates\n let error: any\n\n function reportError(err: any) {\n if (!error) error = err\n }\n\n applyPhase(\n outdatedSelfAcceptedModules,\n newModuleFactories,\n outdatedModuleParents,\n reportError\n )\n\n if (error) {\n throw error\n }\n\n if (queuedInvalidatedModules.size > 0) {\n applyInternal(new Set(), [], new Map())\n }\n}\n\nfunction computeChangedModules(\n entries: Record,\n updates: Record\n): {\n added: Map\n modified: Map\n deleted: Set\n chunksAdded: Map>\n chunksDeleted: Map>\n} {\n const chunksAdded = new Map()\n const chunksDeleted = new Map()\n const added: Map = new Map()\n const modified = new Map()\n const deleted: Set = new Set()\n\n for (const [chunkPath, mergedChunkUpdate] of Object.entries(updates) as Array<\n [ChunkPath, EcmascriptMergedChunkUpdate]\n >) {\n switch (mergedChunkUpdate.type) {\n case 'added': {\n const updateAdded = new Set(mergedChunkUpdate.modules)\n for (const moduleId of updateAdded) {\n added.set(moduleId, entries[moduleId])\n }\n chunksAdded.set(chunkPath, updateAdded)\n break\n }\n case 'deleted': {\n // We could also use `mergedChunkUpdate.modules` here.\n const updateDeleted = new Set(chunkModulesMap.get(chunkPath))\n for (const moduleId of updateDeleted) {\n deleted.add(moduleId)\n }\n chunksDeleted.set(chunkPath, updateDeleted)\n break\n }\n case 'partial': {\n const updateAdded = new Set(mergedChunkUpdate.added)\n const updateDeleted = new Set(mergedChunkUpdate.deleted)\n for (const moduleId of updateAdded) {\n added.set(moduleId, entries[moduleId])\n }\n for (const moduleId of updateDeleted) {\n deleted.add(moduleId)\n }\n chunksAdded.set(chunkPath, updateAdded)\n chunksDeleted.set(chunkPath, updateDeleted)\n break\n }\n default:\n invariant(\n mergedChunkUpdate,\n (mergedChunkUpdate) =>\n `Unknown merged chunk update type: ${mergedChunkUpdate.type}`\n )\n }\n }\n\n // If a module was added from one chunk and deleted from another in the same update,\n // consider it to be modified, as it means the module was moved from one chunk to another\n // AND has new code in a single update.\n for (const moduleId of added.keys()) {\n if (deleted.has(moduleId)) {\n added.delete(moduleId)\n deleted.delete(moduleId)\n }\n }\n\n for (const [moduleId, entry] of Object.entries(entries)) {\n // Modules that haven't been added to any chunk but have new code are considered\n // to be modified.\n // This needs to be under the previous loop, as we need it to get rid of modules\n // that were added and deleted in the same update.\n if (!added.has(moduleId)) {\n modified.set(moduleId, entry)\n }\n }\n\n return { added, deleted, modified, chunksAdded, chunksDeleted }\n}\n\ntype ModuleEffect =\n | {\n type: 'unaccepted'\n dependencyChain: ModuleId[]\n }\n | {\n type: 'self-declined'\n dependencyChain: ModuleId[]\n moduleId: ModuleId\n }\n | {\n type: 'accepted'\n moduleId: ModuleId\n outdatedModules: Set\n }\n\nfunction getAffectedModuleEffects(moduleId: ModuleId): ModuleEffect {\n const outdatedModules: Set = new Set()\n\n type QueueItem = { moduleId?: ModuleId; dependencyChain: ModuleId[] }\n\n const queue: QueueItem[] = [\n {\n moduleId,\n dependencyChain: [],\n },\n ]\n\n let nextItem\n while ((nextItem = queue.shift())) {\n const { moduleId, dependencyChain } = nextItem\n\n if (moduleId != null) {\n if (outdatedModules.has(moduleId)) {\n // Avoid infinite loops caused by cycles between modules in the dependency chain.\n continue\n }\n\n outdatedModules.add(moduleId)\n }\n\n // We've arrived at the runtime of the chunk, which means that nothing\n // else above can accept this update.\n if (moduleId === undefined) {\n return {\n type: 'unaccepted',\n dependencyChain,\n }\n }\n\n const module = devModuleCache[moduleId]\n const hotState = moduleHotState.get(module)!\n\n if (\n // The module is not in the cache. Since this is a \"modified\" update,\n // it means that the module was never instantiated before.\n !module || // The module accepted itself without invalidating globalThis.\n // TODO is that right?\n (hotState.selfAccepted && !hotState.selfInvalidated)\n ) {\n continue\n }\n\n if (hotState.selfDeclined) {\n return {\n type: 'self-declined',\n dependencyChain,\n moduleId,\n }\n }\n\n if (runtimeModules.has(moduleId)) {\n queue.push({\n moduleId: undefined,\n dependencyChain: [...dependencyChain, moduleId],\n })\n continue\n }\n\n for (const parentId of module.parents) {\n const parent = devModuleCache[parentId]\n\n if (!parent) {\n // TODO(alexkirsz) Is this even possible?\n continue\n }\n\n // TODO(alexkirsz) Dependencies: check accepted and declined\n // dependencies here.\n\n queue.push({\n moduleId: parentId,\n dependencyChain: [...dependencyChain, moduleId],\n })\n }\n }\n\n return {\n type: 'accepted',\n moduleId,\n outdatedModules,\n }\n}\n\nfunction handleApply(chunkListPath: ChunkListPath, update: ServerMessage) {\n switch (update.type) {\n case 'partial': {\n // This indicates that the update is can be applied to the current state of the application.\n applyUpdate(update.instruction)\n break\n }\n case 'restart': {\n // This indicates that there is no way to apply the update to the\n // current state of the application, and that the application must be\n // restarted.\n DEV_BACKEND.restart()\n break\n }\n case 'notFound': {\n // This indicates that the chunk list no longer exists: either the dynamic import which created it was removed,\n // or the page itself was deleted.\n // If it is a dynamic import, we simply discard all modules that the chunk has exclusive access to.\n // If it is a runtime chunk list, we restart the application.\n if (runtimeChunkLists.has(chunkListPath)) {\n DEV_BACKEND.restart()\n } else {\n disposeChunkList(chunkListPath)\n }\n break\n }\n default:\n throw new Error(`Unknown update type: ${update.type}`)\n }\n}\n\nfunction createModuleHot(\n moduleId: ModuleId,\n hotData: HotData\n): { hot: Hot; hotState: HotState } {\n const hotState: HotState = {\n selfAccepted: false,\n selfDeclined: false,\n selfInvalidated: false,\n disposeHandlers: [],\n }\n\n const hot: Hot = {\n // TODO(alexkirsz) This is not defined in the HMR API. It was used to\n // decide whether to warn whenever an HMR-disposed module required other\n // modules. We might want to remove it.\n active: true,\n\n data: hotData ?? {},\n\n // TODO(alexkirsz) Support full (dep, callback, errorHandler) form.\n accept: (\n modules?: string | string[] | AcceptErrorHandler,\n _callback?: AcceptCallback,\n _errorHandler?: AcceptErrorHandler\n ) => {\n if (modules === undefined) {\n hotState.selfAccepted = true\n } else if (typeof modules === 'function') {\n hotState.selfAccepted = modules\n } else {\n throw new Error('unsupported `accept` signature')\n }\n },\n\n decline: (dep) => {\n if (dep === undefined) {\n hotState.selfDeclined = true\n } else {\n throw new Error('unsupported `decline` signature')\n }\n },\n\n dispose: (callback) => {\n hotState.disposeHandlers.push(callback)\n },\n\n addDisposeHandler: (callback) => {\n hotState.disposeHandlers.push(callback)\n },\n\n removeDisposeHandler: (callback) => {\n const idx = hotState.disposeHandlers.indexOf(callback)\n if (idx >= 0) {\n hotState.disposeHandlers.splice(idx, 1)\n }\n },\n\n invalidate: () => {\n hotState.selfInvalidated = true\n queuedInvalidatedModules.add(moduleId)\n },\n\n // NOTE(alexkirsz) This is part of the management API, which we don't\n // implement, but the Next.js React Refresh runtime uses this to decide\n // whether to schedule an update.\n status: () => 'idle',\n\n // NOTE(alexkirsz) Since we always return \"idle\" for now, these are no-ops.\n addStatusHandler: (_handler) => {},\n removeStatusHandler: (_handler) => {},\n\n // NOTE(jridgewell) Check returns the list of updated modules, but we don't\n // want the webpack code paths to ever update (the turbopack paths handle\n // this already).\n check: () => Promise.resolve(null),\n }\n\n return { hot, hotState }\n}\n\n/**\n * Removes a module from a chunk.\n * Returns `true` if there are no remaining chunks including this module.\n */\nfunction removeModuleFromChunk(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): boolean {\n const moduleChunks = moduleChunksMap.get(moduleId)!\n moduleChunks.delete(chunkPath)\n\n const chunkModules = chunkModulesMap.get(chunkPath)!\n chunkModules.delete(moduleId)\n\n const noRemainingModules = chunkModules.size === 0\n if (noRemainingModules) {\n chunkModulesMap.delete(chunkPath)\n }\n\n const noRemainingChunks = moduleChunks.size === 0\n if (noRemainingChunks) {\n moduleChunksMap.delete(moduleId)\n }\n\n return noRemainingChunks\n}\n\n/**\n * Disposes of a chunk list and its corresponding exclusive chunks.\n */\nfunction disposeChunkList(chunkListPath: ChunkListPath): boolean {\n const chunkPaths = chunkListChunksMap.get(chunkListPath)\n if (chunkPaths == null) {\n return false\n }\n chunkListChunksMap.delete(chunkListPath)\n\n for (const chunkPath of chunkPaths) {\n const chunkChunkLists = chunkChunkListsMap.get(chunkPath)!\n chunkChunkLists.delete(chunkListPath)\n\n if (chunkChunkLists.size === 0) {\n chunkChunkListsMap.delete(chunkPath)\n disposeChunk(chunkPath)\n }\n }\n\n // We must also dispose of the chunk list's chunk itself to ensure it may\n // be reloaded properly in the future.\n const chunkListUrl = getChunkRelativeUrl(chunkListPath)\n\n DEV_BACKEND.unloadChunk?.(chunkListUrl)\n\n return true\n}\n\n/**\n * Disposes of a chunk and its corresponding exclusive modules.\n *\n * @returns Whether the chunk was disposed of.\n */\nfunction disposeChunk(chunkPath: ChunkPath): boolean {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n // This should happen whether the chunk has any modules in it or not.\n // For instance, CSS chunks have no modules in them, but they still need to be unloaded.\n DEV_BACKEND.unloadChunk?.(chunkUrl)\n\n const chunkModules = chunkModulesMap.get(chunkPath)\n if (chunkModules == null) {\n return false\n }\n chunkModules.delete(chunkPath)\n\n for (const moduleId of chunkModules) {\n const moduleChunks = moduleChunksMap.get(moduleId)!\n moduleChunks.delete(chunkPath)\n\n const noRemainingChunks = moduleChunks.size === 0\n if (noRemainingChunks) {\n moduleChunksMap.delete(moduleId)\n disposeModule(moduleId, 'clear')\n availableModules.delete(moduleId)\n }\n }\n\n return true\n}\n\n/**\n * Subscribes to chunk list updates from the update server and applies them.\n */\nfunction registerChunkList(chunkList: ChunkList) {\n const chunkListScript = chunkList.script\n const chunkListPath = getPathFromScript(chunkListScript)\n // The \"chunk\" is also registered to finish the loading in the backend\n BACKEND.registerChunk(chunkListPath as string as ChunkPath)\n globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS!.push([\n chunkListPath,\n handleApply.bind(null, chunkListPath),\n ])\n\n // Adding chunks to chunk lists and vice versa.\n const chunkPaths = new Set(chunkList.chunks.map(getChunkPath))\n chunkListChunksMap.set(chunkListPath, chunkPaths)\n for (const chunkPath of chunkPaths) {\n let chunkChunkLists = chunkChunkListsMap.get(chunkPath)\n if (!chunkChunkLists) {\n chunkChunkLists = new Set([chunkListPath])\n chunkChunkListsMap.set(chunkPath, chunkChunkLists)\n } else {\n chunkChunkLists.add(chunkListPath)\n }\n }\n\n if (chunkList.source === 'entry') {\n markChunkListAsRuntime(chunkListPath)\n }\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,MAAM,kBAAkB,UAAU,MAAM;AACxC,MAAM,gBAAgB,kBAAkB;AACxC,sEAAsE;AACtE,QAAQ,aAAa,CAAC;AACtB,WAAW,gCAAgC,CAAE,IAAI,CAAC;AAChD;AACA,YAAY,IAAI,CAAC,MAAM;CACxB;AAED,+CAA+C;AAC/C,MAAM,aAAa,IAAI,IAAI,UAAU,MAAM,CAAC,GAAG,CAAC;AAChD,mBAAmB,GAAG,CAAC,eAAe;AACtC,KAAK,MAAM,aAAa,WAAY;AAClC,IAAI,kBAAkB,mBAAmB,GAAG,CAAC;AAC7C,IAAI,CAAC,iBAAiB;AACpB,kBAAkB,IAAI,IAAI;AAAC;CAAc;AACzC,mBAAmB,GAAG,CAAC,WAAW;AACpC,OAAO;AACL,gBAAgB,GAAG,CAAC;AACtB;AACF;AAEA,IAAI,UAAU,MAAM,KAAK,SAAS;AAChC,uBAAuB;AACzB;AACF;AAEA,WAAW,gCAAgC,KAAK,EAAE","ignoreList":[0]}}, + {"offset": {"line": 1468, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/runtime-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack development\n * ECMAScript DOM runtime.\n *\n * It will be appended to the base development runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\ntype ChunkResolver = {\n resolved: boolean\n loadingStarted: boolean\n resolve: () => void\n reject: (error?: Error) => void\n promise: Promise\n}\n\nlet BACKEND: RuntimeBackend\n\nfunction augmentContext(context: unknown): unknown {\n return context\n}\n\nfunction fetchWebAssembly(wasmChunkPath: ChunkPath) {\n return fetch(getChunkRelativeUrl(wasmChunkPath))\n}\n\nasync function loadWebAssembly(\n _source: unknown,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n const { instance } = await WebAssembly.instantiateStreaming(req, importsObj)\n\n return instance.exports\n}\n\nasync function loadWebAssemblyModule(\n _source: unknown,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n return await WebAssembly.compileStreaming(req)\n}\n\n/**\n * Maps chunk paths to the corresponding resolver.\n */\nconst chunkResolvers: Map = new Map()\n\n;(() => {\n BACKEND = {\n async registerChunk(chunkPath, params) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n const resolver = getOrCreateResolver(chunkUrl)\n resolver.resolve()\n\n if (params == null) {\n return\n }\n\n for (const otherChunkData of params.otherChunks) {\n const otherChunkPath = getChunkPath(otherChunkData)\n const otherChunkUrl = getChunkRelativeUrl(otherChunkPath)\n\n // Chunk might have started loading, so we want to avoid triggering another load.\n getOrCreateResolver(otherChunkUrl)\n }\n\n // This waits for chunks to be loaded, but also marks included items as available.\n await Promise.all(\n params.otherChunks.map((otherChunkData) =>\n loadChunk({ type: SourceType.Runtime, chunkPath }, otherChunkData)\n )\n )\n\n if (params.runtimeModuleIds.length > 0) {\n for (const moduleId of params.runtimeModuleIds) {\n getOrInstantiateRuntimeModule(moduleId, chunkPath)\n }\n }\n },\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n loadChunk(chunkUrl, source) {\n return doLoadChunk(chunkUrl, source)\n },\n }\n\n function getOrCreateResolver(chunkUrl: ChunkUrl): ChunkResolver {\n let resolver = chunkResolvers.get(chunkUrl)\n if (!resolver) {\n let resolve: () => void\n let reject: (error?: Error) => void\n const promise = new Promise((innerResolve, innerReject) => {\n resolve = innerResolve\n reject = innerReject\n })\n resolver = {\n resolved: false,\n loadingStarted: false,\n promise,\n resolve: () => {\n resolver!.resolved = true\n resolve()\n },\n reject: reject!,\n }\n chunkResolvers.set(chunkUrl, resolver)\n }\n return resolver\n }\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n function doLoadChunk(chunkUrl: ChunkUrl, source: SourceInfo) {\n const resolver = getOrCreateResolver(chunkUrl)\n if (resolver.loadingStarted) {\n return resolver.promise\n }\n\n if (source.type === SourceType.Runtime) {\n // We don't need to load chunks references from runtime code, as they're already\n // present in the DOM.\n resolver.loadingStarted = true\n\n if (isCss(chunkUrl)) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n\n // We need to wait for JS chunks to register themselves within `registerChunk`\n // before we can start instantiating runtime modules, hence the absence of\n // `resolver.resolve()` in this branch.\n\n return resolver.promise\n }\n\n if (typeof importScripts === 'function') {\n // We're in a web worker\n if (isCss(chunkUrl)) {\n // ignore\n } else if (isJs(chunkUrl)) {\n self.TURBOPACK_NEXT_CHUNK_URLS!.push(chunkUrl)\n importScripts(TURBOPACK_WORKER_LOCATION + chunkUrl)\n } else {\n throw new Error(\n `can't infer type of chunk from URL ${chunkUrl} in worker`\n )\n }\n } else {\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n if (previousLinks.length > 0) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n } else {\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href = chunkUrl\n link.onerror = () => {\n resolver.reject()\n }\n link.onload = () => {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n document.body.appendChild(link)\n }\n } else if (isJs(chunkUrl)) {\n const previousScripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n if (previousScripts.length > 0) {\n // There is this edge where the script already failed loading, but we\n // can't detect that. The Promise will never resolve in this case.\n for (const script of Array.from(previousScripts)) {\n script.addEventListener('error', () => {\n resolver.reject()\n })\n }\n } else {\n const script = document.createElement('script')\n script.src = chunkUrl\n // We'll only mark the chunk as loaded once the script has been executed,\n // which happens in `registerChunk`. Hence the absence of `resolve()` in\n // this branch.\n script.onerror = () => {\n resolver.reject()\n }\n document.body.appendChild(script)\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n }\n\n resolver.loadingStarted = true\n return resolver.promise\n }\n})()\n"],"names":[],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,sEAAsE;AACtE,2DAA2D;AAU3D,IAAI;AAEJ,SAAS,eAAe,OAAgB;AACtC,OAAO;AACT;AAEA,SAAS,iBAAiB,aAAwB;AAChD,OAAO,MAAM,oBAAoB;AACnC;AAEA,eAAe,gBACb,OAAgB,EAChB,aAAwB,EACxB,WAAqC,EACrC,UAA+B;AAE/B,MAAM,MAAM,iBAAiB;AAE7B,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,YAAY,oBAAoB,CAAC,KAAK;AAEjE,OAAO,SAAS,OAAO;AACzB;AAEA,eAAe,sBACb,OAAgB,EAChB,aAAwB,EACxB,WAAqC;AAErC,MAAM,MAAM,iBAAiB;AAE7B,OAAO,MAAM,YAAY,gBAAgB,CAAC;AAC5C;AAEA;;CAEC,GACD,MAAM,iBAA+C,IAAI;AAExD,CAAC;AACA,UAAU;AACR,MAAM,eAAc,SAAS,EAAE,MAAM;AACnC,MAAM,WAAW,oBAAoB;AAErC,MAAM,WAAW,oBAAoB;AACrC,SAAS,OAAO;AAEhB,IAAI,UAAU,MAAM;AAClB;AACF;AAEA,KAAK,MAAM,kBAAkB,OAAO,WAAW,CAAE;AAC/C,MAAM,iBAAiB,aAAa;AACpC,MAAM,gBAAgB,oBAAoB;AAE1C,iFAAiF;AACjF,oBAAoB;AACtB;AAEA,kFAA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M,IAAI,MAAM,CAAC,mCAAmC,EAAE,UAAU;AAClE;AACF;AAEA,SAAS,cAAc,GAAG;AAC1B,OAAO,SAAS,OAAO;AACzB;AACF,CAAC","ignoreList":[0]}}, + {"offset": {"line": 1634, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/dev-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack development\n * ECMAScript DOM runtime.\n *\n * It will be appended to the base development runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n/// \n/// \n\nlet DEV_BACKEND: DevRuntimeBackend\n;(() => {\n DEV_BACKEND = {\n unloadChunk(chunkUrl) {\n deleteResolver(chunkUrl)\n\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const links = document.querySelectorAll(\n `link[href=\"${chunkUrl}\"],link[href^=\"${chunkUrl}?\"],link[href=\"${decodedChunkUrl}\"],link[href^=\"${decodedChunkUrl}?\"]`\n )\n for (const link of Array.from(links)) {\n link.remove()\n }\n } else if (isJs(chunkUrl)) {\n // Unloading a JS chunk would have no effect, as it lives in the JS\n // runtime once evaluated.\n // However, we still want to remove the script tag from the DOM to keep\n // the HTML somewhat consistent from the user's perspective.\n const scripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n for (const script of Array.from(scripts)) {\n script.remove()\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n },\n\n reloadChunk(chunkUrl) {\n return new Promise((resolve, reject) => {\n if (!isCss(chunkUrl)) {\n reject(new Error('The DOM backend can only reload CSS chunks'))\n return\n }\n\n const decodedChunkUrl = decodeURI(chunkUrl)\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n\n if (previousLinks.length === 0) {\n reject(new Error(`No link element found for chunk ${chunkUrl}`))\n return\n }\n\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n\n if (navigator.userAgent.includes('Firefox')) {\n // Firefox won't reload CSS files that were previously loaded on the current page,\n // we need to add a query param to make sure CSS is actually reloaded from the server.\n //\n // I believe this is this issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1037506\n //\n // Safari has a similar issue, but only if you have a `` tag\n // pointing to the same URL as the stylesheet: https://bugs.webkit.org/show_bug.cgi?id=187726\n link.href = `${chunkUrl}?ts=${Date.now()}`\n } else {\n link.href = chunkUrl\n }\n\n link.onerror = () => {\n reject()\n }\n link.onload = () => {\n // First load the new CSS, then remove the old ones. This prevents visible\n // flickering that would happen in-between removing the previous CSS and\n // loading the new one.\n for (const previousLink of Array.from(previousLinks))\n previousLink.remove()\n\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolve()\n }\n\n // Make sure to insert the new CSS right after the previous one, so that\n // its precedence is higher.\n previousLinks[0].parentElement!.insertBefore(\n link,\n previousLinks[0].nextSibling\n )\n })\n },\n\n restart: () => self.location.reload(),\n }\n\n function deleteResolver(chunkUrl: ChunkUrl) {\n chunkResolvers.delete(chunkUrl)\n }\n})()\n\nfunction _eval({ code, url, map }: EcmascriptModuleEntry): ModuleFactory {\n code += `\\n\\n//# sourceURL=${encodeURI(\n location.origin + CHUNK_BASE_PATH + url + CHUNK_SUFFIX_PATH\n )}`\n if (map) {\n code += `\\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${btoa(\n // btoa doesn't handle nonlatin characters, so escape them as \\x sequences\n // See https://stackoverflow.com/a/26603875\n unescape(encodeURIComponent(map))\n )}`\n }\n\n // eslint-disable-next-line no-eval\n return eval(code)\n}\n"],"names":[],"mappings":"AAA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ACpC,KAAK,GAAG,GAAG;AAEX,IAAI,UAAU,SAAS,CAAC,QAAQ,CAAC,YAAY;AAC3C,kFAAkF;AAClF,sFAAsF;AACtF,EAAE;AACF,qFAAqF;AACrF,EAAE;AACF,oFAAoF;AACpF,6FAA6F;AAC7F,KAAK,IAAI,GAAG,GAAG,SAAS,IAAI,EAAE,KAAK,GAAG,IAAI;AAC5C,OAAO;AACL,KAAK,IAAI,GAAG;AACd;AAEA,KAAK,OAAO,GAAG;AACb;AACF;AACA,KAAK,MAAM,GAAG;AACZ,0EAA0E;AAC1E,wEAAwE;AACxE,uBAAuB;AACvB,KAAK,MAAM,gBAAgB,MAAM,IAAI,CAAC,eACpC,aAAa,MAAM;AAErB,uEAAuE;AACvE,oBAAoB;AACpB;AACF;AAEA,wEAAwE;AACxE,4BAA4B;AAC5B,aAAa,CAAC,EAAE,CAAC,aAAa,CAAE,YAAY,CAC1C,MACA,aAAa,CAAC,EAAE,CAAC,WAAW;AAEhC;AACF;AAEA,SAAS,IAAM,KAAK,QAAQ,CAAC,MAAM;AACrC;AAEA,SAAS,eAAe,QAAkB;AACxC,eAAe,MAAM,CAAC;AACxB;AACF,CAAC;AAED,SAAS,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAyB;AACtD,QAAQ,CAAC,kBAAkB,EAAE,UAC3B,SAAS,MAAM,GAAG,kBAAkB,MAAM,oBACzC;AACH,IAAI,KAAK;AACP,QAAQ,CAAC,kEAAkE,EAAE,KAC3E,0EAA0E;AAC1E,2CAA2C;AAC3C,SAAS,mBAAmB,QAC3B;AACL;AAEA,mCAAmC;AACnC,OAAO,KAAK;AACd","ignoreList":[0]}}] } \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/turbopack_crates_turbopack-tests_tests_snapshot_b56e07c9._.js b/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/turbopack_crates_turbopack-tests_tests_snapshot_b56e07c9._.js index 11b6fa3806458..5a0604ee88801 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/turbopack_crates_turbopack-tests_tests_snapshot_b56e07c9._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/turbopack_crates_turbopack-tests_tests_snapshot_b56e07c9._.js @@ -4,7 +4,7 @@ "use strict"; __turbopack_context__.s({ -"default": (()=>MyApp) +"default": ()=>MyApp }); var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$node_modules$2f$react$2f$jsx$2d$dev$2d$runtime$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/jsx-dev-runtime.js [test] (ecmascript)"); ; @@ -28,18 +28,21 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo ; console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$swc_transforms$2f$mono_transforms$2f$input$2f$packages$2f$component$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__["default"], __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$swc_transforms$2f$mono_transforms$2f$input$2f$node_modules$2f$third_party_component$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__["default"]); }), -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/jsx-dev-runtime.js [test] (ecmascript)": (function(__turbopack_context__) { +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/jsx-dev-runtime.js [test] (ecmascript)": ((__turbopack_context__) => { +"use strict"; -var { m: module, e: exports } = __turbopack_context__; -{ -"purposefully empty stub"; -"react/jsx-dev-runtime.js"; -}}), +__turbopack_context__.s({ +"jsxDEV": ()=>jsxDEV +}); +function jsxDEV() { +return 'purposefully empty stub for react/jsx-dev-runtime.js'; +} +}), "[project]/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/input/node_modules/third_party_component/index.js [test] (ecmascript)": ((__turbopack_context__) => { "use strict"; __turbopack_context__.s({ -"default": (()=>ThirdPartyComponent) +"default": ()=>ThirdPartyComponent }); function ThirdPartyComponent() { return
Should not be transformed
; diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/turbopack_crates_turbopack-tests_tests_snapshot_b56e07c9._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/turbopack_crates_turbopack-tests_tests_snapshot_b56e07c9._.js.map index 821cb92f92a31..905ea4ed9530c 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/turbopack_crates_turbopack-tests_tests_snapshot_b56e07c9._.js.map +++ b/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/turbopack_crates_turbopack-tests_tests_snapshot_b56e07c9._.js.map @@ -4,6 +4,6 @@ "sections": [ {"offset": {"line": 5, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/input/packages/component/index.js"],"sourcesContent":["export default function MyApp() {\n return
App
\n}\n"],"names":[],"mappings":";;;;;AAAe,SAAS;AACtB,qBAAO,0NAAC;UAAI;;;;;;AACd"}}, {"offset": {"line": 23, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/input/packages/app/index.js"],"sourcesContent":["import MyApp from 'component'\nimport ThirdPartyComponent from 'third_party_component'\n\nconsole.log(MyApp, ThirdPartyComponent)\n"],"names":[],"mappings":";AAAA;AACA;;;AAEA,QAAQ,GAAG,CAAC,wOAAA,CAAA,UAAK,EAAE,wPAAA,CAAA,UAAmB"}}, - {"offset": {"line": 34, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/jsx-dev-runtime.js"],"sourcesContent":["\"purposefully empty stub\";\n\"react/jsx-dev-runtime.js\";\n"],"names":[],"mappings":"AAAA;AACA","ignoreList":[0]}}, - {"offset": {"line": 40, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/input/node_modules/third_party_component/index.js"],"sourcesContent":["export default function ThirdPartyComponent() {\n return
Should not be transformed
;\n}\n"],"names":[],"mappings":";;;AAAe,SAAS;AACtB,QAAQ,IAAI,yBAAyB,EAAE;AACzC","ignoreList":[0]}}] + {"offset": {"line": 33, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/react/jsx-dev-runtime.js"],"sourcesContent":["export function jsxDEV() {\n return 'purposefully empty stub for react/jsx-dev-runtime.js'\n}\n"],"names":[],"mappings":";;;AAAO,SAAS;AACd,OAAO;AACT","ignoreList":[0]}}, + {"offset": {"line": 43, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/input/node_modules/third_party_component/index.js"],"sourcesContent":["export default function ThirdPartyComponent() {\n return
Should not be transformed
;\n}\n"],"names":[],"mappings":";;;AAAe,SAAS;AACtB,QAAQ,IAAI,yBAAyB,EAAE;AACzC","ignoreList":[0]}}] } \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/turbopack_crates_turbopack-tests_tests_snapshot_bff03a32._.js b/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/turbopack_crates_turbopack-tests_tests_snapshot_bff03a32._.js index 0b3fc964ee9dd..1b43cd4a73482 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/turbopack_crates_turbopack-tests_tests_snapshot_bff03a32._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/turbopack_crates_turbopack-tests_tests_snapshot_bff03a32._.js @@ -12,13 +12,16 @@ var Foo = function Foo() { }; console.log(Foo, [].includes('foo')); }), -"[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@swc/helpers/_/_class_call_check.js [test] (ecmascript)": (function(__turbopack_context__) { +"[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@swc/helpers/_/_class_call_check.js [test] (ecmascript)": ((__turbopack_context__) => { +"use strict"; -var { m: module, e: exports } = __turbopack_context__; -{ -"purposefully empty stub"; -"@swc/helpers/_/_class_call_check.js"; -}}), +__turbopack_context__.s({ +"_": ()=>_ +}); +function _() { +return 'purposefully empty stub for @swc/helpers/_/_class_call_check.js'; +} +}), }]); //# sourceMappingURL=turbopack_crates_turbopack-tests_tests_snapshot_bff03a32._.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/turbopack_crates_turbopack-tests_tests_snapshot_bff03a32._.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/turbopack_crates_turbopack-tests_tests_snapshot_bff03a32._.js.map index 4cf4212b17ac6..c0be5cbd1c1ed 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/turbopack_crates_turbopack-tests_tests_snapshot_bff03a32._.js.map +++ b/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/turbopack_crates_turbopack-tests_tests_snapshot_bff03a32._.js.map @@ -3,5 +3,5 @@ "sources": [], "sections": [ {"offset": {"line": 5, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/input/index.js"],"sourcesContent":["class Foo {}\n\nconsole.log(Foo, [].includes('foo'))\n"],"names":[],"mappings":";;;AAAA,IAAA,AAAM,MAAN,SAAM;;uOAAA;;AAEN,QAAQ,GAAG,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC"}}, - {"offset": {"line": 18, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@swc/helpers/_/_class_call_check.js"],"sourcesContent":["\"purposefully empty stub\";\n\"@swc/helpers/_/_class_call_check.js\";\n"],"names":[],"mappings":"AAAA;AACA","ignoreList":[0]}}] + {"offset": {"line": 17, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@swc/helpers/_/_class_call_check.js"],"sourcesContent":["export function _() {\n return 'purposefully empty stub for @swc/helpers/_/_class_call_check.js'\n}\n"],"names":[],"mappings":";;;AAAO,SAAS;AACd,OAAO;AACT","ignoreList":[0]}}] } \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/typescript/jsconfig-baseurl/output/b1abf_turbopack-tests_tests_snapshot_typescript_jsconfig-baseurl_input_50efc170._.js b/turbopack/crates/turbopack-tests/tests/snapshot/typescript/jsconfig-baseurl/output/b1abf_turbopack-tests_tests_snapshot_typescript_jsconfig-baseurl_input_50efc170._.js index 4db5bfd715082..bdb6da5d6e9c0 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/typescript/jsconfig-baseurl/output/b1abf_turbopack-tests_tests_snapshot_typescript_jsconfig-baseurl_input_50efc170._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/typescript/jsconfig-baseurl/output/b1abf_turbopack-tests_tests_snapshot_typescript_jsconfig-baseurl_input_50efc170._.js @@ -4,7 +4,7 @@ "use strict"; __turbopack_context__.s({ -"prop": (()=>prop) +"prop": ()=>prop }); const prop = 1; }), diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-baseurl/output/b1abf_turbopack-tests_tests_snapshot_typescript_tsconfig-baseurl_input_88264193._.js b/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-baseurl/output/b1abf_turbopack-tests_tests_snapshot_typescript_tsconfig-baseurl_input_88264193._.js index 18443842aa7c9..4d466eecab16d 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-baseurl/output/b1abf_turbopack-tests_tests_snapshot_typescript_tsconfig-baseurl_input_88264193._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-baseurl/output/b1abf_turbopack-tests_tests_snapshot_typescript_tsconfig-baseurl_input_88264193._.js @@ -4,7 +4,7 @@ "use strict"; __turbopack_context__.s({ -"prop": (()=>prop) +"prop": ()=>prop }); const prop = 1; }), @@ -24,7 +24,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ "use strict"; __turbopack_context__.s({ -"bar": (()=>bar) +"bar": ()=>bar }); const bar = 'bar'; }), diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module-full-path/output/turbopack_crates_turbopack-tests_tests_snapshot_f038421b._.js b/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module-full-path/output/turbopack_crates_turbopack-tests_tests_snapshot_f038421b._.js index 1eeca42bbf03e..92d13b232f8f3 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module-full-path/output/turbopack_crates_turbopack-tests_tests_snapshot_f038421b._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module-full-path/output/turbopack_crates_turbopack-tests_tests_snapshot_f038421b._.js @@ -14,7 +14,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ "use strict"; __turbopack_context__.s({ -"prop": (()=>prop) +"prop": ()=>prop }); const prop = 1; }), diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module/output/turbopack_crates_turbopack-tests_tests_snapshot_cff3cff1._.js b/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module/output/turbopack_crates_turbopack-tests_tests_snapshot_cff3cff1._.js index b8981a4f32091..8094f3a27ecf3 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module/output/turbopack_crates_turbopack-tests_tests_snapshot_cff3cff1._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module/output/turbopack_crates_turbopack-tests_tests_snapshot_cff3cff1._.js @@ -14,7 +14,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$ "use strict"; __turbopack_context__.s({ -"prop": (()=>prop) +"prop": ()=>prop }); const prop = 1; }), diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-relative-dir/output/4c35f_tests_snapshot_typescript_tsconfig-extends-relative-dir_input_ef6815c7._.js b/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-relative-dir/output/4c35f_tests_snapshot_typescript_tsconfig-extends-relative-dir_input_ef6815c7._.js index b467dbe14db6f..9ebbb1a082271 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-relative-dir/output/4c35f_tests_snapshot_typescript_tsconfig-extends-relative-dir_input_ef6815c7._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-relative-dir/output/4c35f_tests_snapshot_typescript_tsconfig-extends-relative-dir_input_ef6815c7._.js @@ -4,7 +4,7 @@ "use strict"; __turbopack_context__.s({ -"prop": (()=>prop) +"prop": ()=>prop }); const prop = 1; }), diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-without-ext/output/4c35f_tests_snapshot_typescript_tsconfig-extends-without-ext_input_fcdb4390._.js b/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-without-ext/output/4c35f_tests_snapshot_typescript_tsconfig-extends-without-ext_input_fcdb4390._.js index 877152619f493..06b2e125d5c5a 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-without-ext/output/4c35f_tests_snapshot_typescript_tsconfig-extends-without-ext_input_fcdb4390._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-without-ext/output/4c35f_tests_snapshot_typescript_tsconfig-extends-without-ext_input_fcdb4390._.js @@ -4,7 +4,7 @@ "use strict"; __turbopack_context__.s({ -"prop": (()=>prop) +"prop": ()=>prop }); const prop = 1; }), diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends/output/b1abf_turbopack-tests_tests_snapshot_typescript_tsconfig-extends_input_39e68707._.js b/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends/output/b1abf_turbopack-tests_tests_snapshot_typescript_tsconfig-extends_input_39e68707._.js index 48b4c755a7702..47427c7278875 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends/output/b1abf_turbopack-tests_tests_snapshot_typescript_tsconfig-extends_input_39e68707._.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends/output/b1abf_turbopack-tests_tests_snapshot_typescript_tsconfig-extends_input_39e68707._.js @@ -4,7 +4,7 @@ "use strict"; __turbopack_context__.s({ -"prop": (()=>prop) +"prop": ()=>prop }); const prop = 1; }),