Unverified Commit e91660d1 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Turbopack: scope hoisting (#79459)

Enable Turbopack to merge modules together (when possible), getting rid of the `"module id...": (__turbopack_context__) => { ... __turbopack_esm_export__({foo: () => foo})` overhead:

<img width="1591" alt="Bildschirmfoto 2025-06-14 um 14 13 36" src="https://github.com/user-attachments/assets/b6baccbe-a2c7-4acd-b17b-f7bd91c8f349" />

## Details

There is a lot of complexity here, mostly for the problem of when this is actually safe to do.
Generally, modules can only be merged if they are known to always execute in that exact order (also meaning in every chunk these modules are part of).
This is done by first propagating a bitmap on the whole module graph, to determine which modules are safe to merge together (module type is compatible, only ESM, etc). Then, these potential merged groups are linearized in execution order _per chunk_. These orderings are then split up until every module is just part of a single ordering (together with the modules that are always executed before/after it, if any). Each of these orderings then becomes a merged module.

This information is then used to replace these modules with the merged version in the middle of chunking (after the module graph -> vec of modules step, but before turning vec of modules -> vec of chunks).

For code generation, the runtime helpers are omitted and imports just become straight variable references (i.e. across modules). This (together with preventing local variable naming collisions in the merged module) is achieved by leveraging swc's syntax contexts (each module effectively gets it's own syntax context, so that variables of the same name don't collide, and then imports are rewritten to point to the local variable in the other module). Comments and source maps work by encoding the module into the `BytePos`, so that a given `BytePos` in the merged AST can be decoded back into the module that it originated from, to lookup comments and source locations in the right structs.
parent 925fd916
......@@ -66,6 +66,7 @@ test/e2e/async-modules/amp-validator-wasm.js
/turbopack/crates/next-transform-dynamic/tests
/turbopack/crates/turbopack-tests/tests/execution/turbopack/basic/error/input/broken.js
/turbopack/crates/turbopack-tests/tests/snapshot/import-meta/cjs/input/mod.cjs
/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/*
/turbopack/crates/turbopack-tests/tests/**/output*
/turbopack/crates/turbopack-tests/tests/**/static
......@@ -8198,9 +8198,9 @@ dependencies = [
[[package]]
name = "swc_sourcemap"
version = "9.3.1"
version = "9.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "604e837ad12213d381dea886a184e06b4e09fd502e5d1a4db9d4b7341eb85105"
checksum = "9755c673c6a83c461e98fa018f681adb8394a3f44f89a06f27e80fd4fe4fa1e4"
dependencies = [
"base64-simd 0.8.0",
"bitvec",
......@@ -9674,6 +9674,7 @@ dependencies = [
"either",
"indexmap 2.7.1",
"indoc",
"itertools 0.10.5",
"num-bigint",
"num-traits",
"once_cell",
......
......@@ -411,7 +411,7 @@ smallvec = { version = "1.13.1", features = [
"union",
"const_new",
] }
swc_sourcemap = "9.2.2"
swc_sourcemap = "9.3.2"
strsim = "0.11.1"
shrink-to-fit = "0.2.10"
syn = "2.0.100"
......
......@@ -1018,6 +1018,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()),
))
}
......@@ -1039,6 +1040,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(
......@@ -1051,6 +1053,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()),
)
})
}
......@@ -1073,6 +1076,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(
......@@ -1085,6 +1089,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()),
)
})
}
......
......@@ -435,6 +435,7 @@ pub async fn get_client_chunking_context(
minify: Vc<bool>,
source_maps: Vc<bool>,
no_mangling: Vc<bool>,
scope_hoisting: Vc<bool>,
) -> Result<Vc<Box<dyn ChunkingContext>>> {
let next_mode = mode.await?;
let mut builder = BrowserChunkingContext::builder(
......@@ -471,7 +472,8 @@ 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(
builder = builder
.chunking_config(
Vc::<EcmascriptChunkType>::default().to_resolved().await?,
ChunkingConfig {
min_chunk_size: 50_000,
......@@ -479,15 +481,16 @@ pub async fn get_client_chunking_context(
max_merge_chunk_size: 200_000,
..Default::default()
},
);
builder = builder.chunking_config(
)
.chunking_config(
Vc::<CssChunkType>::default().to_resolved().await?,
ChunkingConfig {
max_merge_chunk_size: 100_000,
..Default::default()
},
);
builder = builder.use_content_hashing(ContentHashing::Direct { length: 16 })
)
.use_content_hashing(ContentHashing::Direct { length: 16 })
.module_merging(*scope_hoisting.await?);
}
Ok(Vc::upcast(builder.build()))
......
......@@ -795,6 +795,7 @@ pub struct ExperimentalConfig {
turbopack_persistent_caching: Option<bool>,
turbopack_source_maps: Option<bool>,
turbopack_tree_shaking: Option<bool>,
turbopack_scope_hoisting: Option<bool>,
// Whether to enable the global-not-found convention
global_not_found: Option<bool>,
/// Defaults to false in development mode, true in production mode.
......@@ -1593,6 +1594,15 @@ impl NextConfig {
))
}
#[turbo_tasks::function]
pub async fn turbo_scope_hoisting(&self, mode: Vc<NextMode>) -> Result<Vc<bool>> {
Ok(Vc::cell(match *mode.await? {
// Ignore configuration in development mode to not break HMR
NextMode::Development => false,
NextMode::Build => self.experimental.turbopack_scope_hoisting.unwrap_or(true),
}))
}
#[turbo_tasks::function]
pub async fn client_source_maps(&self, _mode: Vc<NextMode>) -> Result<Vc<bool>> {
// Temporarily always enable client source maps as tests regress.
......
......@@ -231,6 +231,7 @@ pub async fn get_edge_chunking_context_with_client_assets(
turbo_minify: Vc<bool>,
turbo_source_maps: Vc<bool>,
no_mangling: Vc<bool>,
scope_hoisting: Vc<bool>,
) -> Result<Vc<Box<dyn ChunkingContext>>> {
let output_root = node_root.join(rcstr!("server/edge")).to_resolved().await?;
let next_mode = mode.await?;
......@@ -264,20 +265,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(
builder = builder
.chunking_config(
Vc::<EcmascriptChunkType>::default().to_resolved().await?,
ChunkingConfig {
min_chunk_size: 20_000,
..Default::default()
},
);
builder = builder.chunking_config(
)
.chunking_config(
Vc::<CssChunkType>::default().to_resolved().await?,
ChunkingConfig {
max_merge_chunk_size: 100_000,
..Default::default()
},
);
)
.module_merging(*scope_hoisting.await?);
}
Ok(Vc::upcast(builder.build()))
......@@ -294,6 +297,7 @@ pub async fn get_edge_chunking_context(
turbo_minify: Vc<bool>,
turbo_source_maps: Vc<bool>,
no_mangling: Vc<bool>,
scope_hoisting: Vc<bool>,
) -> Result<Vc<Box<dyn ChunkingContext>>> {
let output_root = node_root.join(rcstr!("server/edge")).to_resolved().await?;
let next_mode = mode.await?;
......@@ -327,20 +331,22 @@ pub async fn get_edge_chunking_context(
.module_id_strategy(module_id_strategy);
if !next_mode.is_development() {
builder = builder.chunking_config(
builder = builder
.chunking_config(
Vc::<EcmascriptChunkType>::default().to_resolved().await?,
ChunkingConfig {
min_chunk_size: 20_000,
..Default::default()
},
);
builder = builder.chunking_config(
)
.chunking_config(
Vc::<CssChunkType>::default().to_resolved().await?,
ChunkingConfig {
max_merge_chunk_size: 100_000,
..Default::default()
},
);
)
.module_merging(*scope_hoisting.await?);
}
Ok(Vc::upcast(builder.build()))
......
......@@ -998,6 +998,7 @@ pub async fn get_server_chunking_context_with_client_assets(
turbo_minify: Vc<bool>,
turbo_source_maps: Vc<bool>,
no_mangling: Vc<bool>,
scope_hoisting: Vc<bool>,
) -> Result<Vc<NodeJsChunkingContext>> {
let next_mode = mode.await?;
// TODO(alexkirsz) This should return a trait that can be implemented by the
......@@ -1039,7 +1040,8 @@ 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(
builder = builder
.chunking_config(
Vc::<EcmascriptChunkType>::default().to_resolved().await?,
ChunkingConfig {
min_chunk_size: 20_000,
......@@ -1047,14 +1049,15 @@ pub async fn get_server_chunking_context_with_client_assets(
max_merge_chunk_size: 100_000,
..Default::default()
},
);
builder = builder.chunking_config(
)
.chunking_config(
Vc::<CssChunkType>::default().to_resolved().await?,
ChunkingConfig {
max_merge_chunk_size: 100_000,
..Default::default()
},
);
)
.module_merging(*scope_hoisting.await?);
}
Ok(builder.build())
......@@ -1071,6 +1074,7 @@ pub async fn get_server_chunking_context(
turbo_minify: Vc<bool>,
turbo_source_maps: Vc<bool>,
no_mangling: Vc<bool>,
scope_hoisting: Vc<bool>,
) -> Result<Vc<NodeJsChunkingContext>> {
let next_mode = mode.await?;
// TODO(alexkirsz) This should return a trait that can be implemented by the
......@@ -1110,7 +1114,8 @@ pub async fn get_server_chunking_context(
if next_mode.is_development() {
builder = builder.use_file_source_map_uris()
} else {
builder = builder.chunking_config(
builder = builder
.chunking_config(
Vc::<EcmascriptChunkType>::default().to_resolved().await?,
ChunkingConfig {
min_chunk_size: 20_000,
......@@ -1118,14 +1123,15 @@ pub async fn get_server_chunking_context(
max_merge_chunk_size: 100_000,
..Default::default()
},
);
builder = builder.chunking_config(
)
.chunking_config(
Vc::<CssChunkType>::default().to_resolved().await?,
ChunkingConfig {
max_merge_chunk_size: 100_000,
..Default::default()
},
);
)
.module_merging(*scope_hoisting.await?);
}
Ok(builder.build())
......
......@@ -462,6 +462,7 @@ export const configSchema: zod.ZodType<NextConfig> = 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(),
......
......@@ -452,6 +452,11 @@ export interface ExperimentalConfig {
*/
turbopackMinify?: boolean
/**
* Enable scope hoisting. Defaults to true in build mode. Always disabled in development mode.
*/
turbopackScopeHoisting?: boolean
/**
* Enable persistent caching for the turbopack dev server and build.
*/
......
......@@ -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: Option<RcStr>) -> 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<Environment>,
/// The kind of runtime to include in the output.
......@@ -248,6 +255,7 @@ impl BrowserChunkingContext {
asset_base_path: None,
enable_hot_module_replacement: false,
enable_tracing: false,
enable_module_merging: false,
environment,
runtime_type,
minify_type: MinifyType::NoMinify,
......@@ -513,6 +521,11 @@ impl ChunkingContext for BrowserChunkingContext {
Vc::cell(self.enable_tracing)
}
#[turbo_tasks::function]
fn is_module_merging_enabled(&self) -> Vc<bool> {
Vc::cell(self.enable_module_merging)
}
#[turbo_tasks::function]
pub fn minify_type(&self) -> Vc<MinifyType> {
self.minify_type.cell()
......
......@@ -342,7 +342,8 @@ async fn build_internal(
match *node_env.await? {
NodeEnv::Development => {}
NodeEnv::Production => {
builder = builder.chunking_config(
builder = builder
.chunking_config(
Vc::<EcmascriptChunkType>::default().to_resolved().await?,
ChunkingConfig {
min_chunk_size: 50_000,
......@@ -350,15 +351,16 @@ async fn build_internal(
max_merge_chunk_size: 200_000,
..Default::default()
},
);
builder = builder.chunking_config(
)
.chunking_config(
Vc::<CssChunkType>::default().to_resolved().await?,
ChunkingConfig {
max_merge_chunk_size: 100_000,
..Default::default()
},
);
builder = builder.use_content_hashing(ContentHashing::Direct { length: 16 })
)
.use_content_hashing(ContentHashing::Direct { length: 16 })
.module_merging(true);
}
}
......@@ -386,7 +388,8 @@ async fn build_internal(
match *node_env.await? {
NodeEnv::Development => {}
NodeEnv::Production => {
builder = builder.chunking_config(
builder = builder
.chunking_config(
Vc::<EcmascriptChunkType>::default().to_resolved().await?,
ChunkingConfig {
min_chunk_size: 20_000,
......@@ -394,14 +397,15 @@ async fn build_internal(
max_merge_chunk_size: 100_000,
..Default::default()
},
);
builder = builder.chunking_config(
)
.chunking_config(
Vc::<CssChunkType>::default().to_resolved().await?,
ChunkingConfig {
max_merge_chunk_size: 100_000,
..Default::default()
},
);
)
.module_merging(true);
}
}
......
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, Vc};
use smallvec::{SmallVec, smallvec};
use turbo_tasks::{FxIndexSet, ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt, 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 {
......@@ -52,12 +54,14 @@ pub async fn make_chunk_group(
batch_groups,
async_modules,
traced_modules,
availability_info,
} = chunk_group_content(
module_graph,
chunk_group_entries.clone(),
availability_info,
can_split_async,
should_trace,
should_merge_modules,
batching_config,
)
.await?;
......@@ -95,11 +99,6 @@ pub async fn make_chunk_group(
.try_join()
.await?;
// Compute new [AvailabilityInfo]
let availability_info = availability_info
.with_modules(Vc::cell(chunkable_items))
.await?;
// Insert async chunk loaders for every referenced async module
let async_loaders = async_modules
.into_iter()
......@@ -189,6 +188,7 @@ pub async fn chunk_group_content(
availability_info: AvailabilityInfo,
can_split_async: bool,
should_trace: bool,
should_merge_modules: bool,
batching_config: Vc<BatchingConfig>,
) -> Result<ChunkGroupContent> {
let module_batches_graph = module_graph.module_batches(batching_config).await?;
......@@ -315,6 +315,76 @@ pub async fn chunk_group_content(
},
)?;
// This needs to use the unmerged items
let availability_info = availability_info
.with_modules(Vc::cell(state.chunkable_items.clone()))
.await?;
if should_merge_modules {
let merged_modules = module_graph.merged_modules().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))
{
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::Relaxed);
false
}
})
.map(|&module| {
if let Some(replacement) =
merged_modules.should_replace_module(ResolvedVc::upcast(module))
{
modified.store(true, std::sync::atomic::Ordering::Relaxed);
replacement
} else {
module
}
})
.map(ChunkableModuleOrBatch::Module)
.collect::<SmallVec<[_; 1]>>();
if modified.load(std::sync::atomic::Ordering::Relaxed) {
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()) {
......@@ -327,5 +397,6 @@ pub async fn chunk_group_content(
batch_groups,
async_modules: state.async_modules,
traced_modules: state.traced_modules,
availability_info,
})
}
use std::{borrow::Cow, collections::BinaryHeap, hash::BuildHasherDefault, mem::take};
use anyhow::Result;
use anyhow::{Context, Result};
use rustc_hash::FxHasher;
use smallvec::SmallVec;
use tracing::{Instrument, field::Empty};
......@@ -32,6 +32,7 @@ pub async fn make_production_chunks(
let span = span_outer.clone();
async move {
let chunk_group_info = module_graph.chunk_group_info().await?;
let merged_modules = module_graph.merged_modules().await?;
#[derive(Default)]
struct GrouppedChunkItems<'l> {
......@@ -69,9 +70,21 @@ pub async fn make_production_chunks(
..
},
..
} => chunk_group_info
} => Some(
chunk_group_info
.module_chunk_groups
.get(&ResolvedVc::upcast(module)),
.get(&ResolvedVc::upcast(module))
.or_else(|| {
// Merged modules don't have a chunk group in chunk_group_info, so
// lookup using the original module.
merged_modules
.get_original_module(ResolvedVc::upcast(module))
.and_then(|module| {
chunk_group_info.module_chunk_groups.get(&module)
})
})
.context("every module should have a chunk group")?,
),
&ChunkItemOrBatchWithInfo::ChunkItem {
chunk_item: ChunkItemWithAsyncModuleInfo { module: None, .. },
..
......
......@@ -218,11 +218,19 @@ pub trait ChunkingContext {
})
}
/// Whether `ChunkingType::Traced` are used to create corresponding output assets for each
/// traced module.
#[turbo_tasks::function]
fn is_tracing_enabled(self: Vc<Self>) -> Vc<bool> {
Vc::cell(false)
}
/// Whether to use `MergableModule` to merge modules if possible.
#[turbo_tasks::function]
fn is_module_merging_enabled(self: Vc<Self>) -> Vc<bool> {
Vc::cell(false)
}
#[turbo_tasks::function]
fn minify_type(self: Vc<Self>) -> Vc<MinifyType> {
MinifyType::NoMinify.cell()
......
......@@ -36,6 +36,7 @@ pub use self::{
};
use crate::{
asset::Asset,
chunk::availability_info::AvailabilityInfo,
ident::AssetIdent,
module::Module,
module_graph::{
......@@ -108,6 +109,89 @@ impl ChunkableModules {
}
}
/// 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 merged with other
// module types)
#[turbo_tasks::value_trait]
pub trait MergeableModule: Module + Asset {
/// Even though MergeableModule is implemented, this allows a dynamic condition to determine
/// mergeability
#[turbo_tasks::function]
fn is_mergeable(self: Vc<Self>) -> Vc<bool> {
Vc::cell(true)
}
/// Create a new module representing the merged content of the given `modules`.
///
/// Group entry points are not referenced by any other module in the group. This list is needed
/// because the merged module is created by recursively inlining modules when they are imported,
/// but this process has to start somewhere (= with these entry points).
#[turbo_tasks::function]
fn merge(
self: Vc<Self>,
modules: Vc<MergeableModulesExposed>,
entry_points: Vc<MergeableModules>,
) -> Vc<Box<dyn ChunkableModule>>;
}
#[turbo_tasks::value(transparent)]
pub struct MergeableModules(Vec<ResolvedVc<Box<dyn MergeableModule>>>);
#[turbo_tasks::value_impl]
impl MergeableModules {
#[turbo_tasks::function]
pub fn interned(modules: Vec<ResolvedVc<Box<dyn MergeableModule>>>) -> Vc<Self> {
Vc::cell(modules)
}
}
/// Whether a given module needs to be exposed (depending on how it is imported by other modules)
#[derive(
Copy,
Clone,
Debug,
PartialEq,
Eq,
Serialize,
Deserialize,
TraceRawVcs,
NonLocalValue,
TaskInput,
Hash,
)]
pub enum MergeableModuleExposure {
// This module is only used from within the current group, and only individual exports are
// used (and no namespace object is required).
None,
// This module is only used from within the current group, and but the namespace object is
// needed.
Internal,
// The exports of this module are read from outside this group (necessitating a namespace
// object anyway).
External,
}
#[turbo_tasks::value(transparent)]
pub struct MergeableModulesExposed(
Vec<(
ResolvedVc<Box<dyn MergeableModule>>,
MergeableModuleExposure,
)>,
);
#[turbo_tasks::value_impl]
impl MergeableModulesExposed {
#[turbo_tasks::function]
pub fn interned(
modules: Vec<(
ResolvedVc<Box<dyn MergeableModule>>,
MergeableModuleExposure,
)>,
) -> Vc<Self> {
Vc::cell(modules)
}
}
#[turbo_tasks::value(transparent)]
pub struct Chunks(Vec<ResolvedVc<Box<dyn Chunk>>>);
......@@ -289,12 +373,12 @@ pub trait ChunkableModuleReference: ModuleReference + ValueToString {
}
}
#[derive(Default)]
pub struct ChunkGroupContent {
pub chunkable_items: FxIndexSet<ChunkableModuleOrBatch>,
pub batch_groups: FxIndexSet<ResolvedVc<ModuleBatchGroup>>,
pub async_modules: FxIndexSet<ResolvedVc<Box<dyn ChunkableModule>>>,
pub traced_modules: FxIndexSet<ResolvedVc<Box<dyn Module>>>,
pub availability_info: AvailabilityInfo,
}
#[turbo_tasks::value_trait]
......
use std::collections::hash_map::Entry;
use anyhow::{Context, Result, bail};
use rustc_hash::{FxHashMap, FxHashSet};
use tracing::Instrument;
use turbo_tasks::{
FxIndexMap, FxIndexSet, ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt, ValueToString, Vc,
};
use crate::{
chunk::{
ChunkableModule, ChunkingType, MergeableModule, MergeableModuleExposure, MergeableModules,
MergeableModulesExposed,
},
module::Module,
module_graph::{
GraphTraversalAction, ModuleGraph, RefData, SingleModuleGraphModuleNode,
chunk_group_info::RoaringBitmapWrapper,
},
resolve::ExportUsage,
};
#[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<Box<dyn Module>>, ResolvedVc<Box<dyn ChunkableModule>>>,
/// A map of replacement modules to their corresponding chunk group info (which is the same as
/// the chunk group info of the original module it replaced).
#[allow(clippy::type_complexity)]
pub replacements_to_original:
FxHashMap<ResolvedVc<Box<dyn Module>>, ResolvedVc<Box<dyn Module>>>,
/// A map of modules that are already contained as values in replacements.
pub included: FxHashSet<ResolvedVc<Box<dyn Module>>>,
}
impl MergedModuleInfo {
/// Whether the given module should be replaced with a merged module.
pub fn should_replace_module(
&self,
module: ResolvedVc<Box<dyn Module>>,
) -> Option<ResolvedVc<Box<dyn ChunkableModule>>> {
self.replacements.get(&module).copied()
}
/// Returns the original module for the given replacement module (useful for retrieving the
/// chunk group info).
pub fn get_original_module(
&self,
module: ResolvedVc<Box<dyn Module>>,
) -> Option<ResolvedVc<Box<dyn Module>>> {
self.replacements_to_original.get(&module).copied()
}
// Whether the given module should be skipped during chunking, as it is already included in a
// module returned by some `should_replace_module` call.
pub fn should_create_chunk_item_for(&self, module: ResolvedVc<Box<dyn Module>>) -> 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<ModuleGraph>) -> Result<Vc<MergedModuleInfo>> {
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::<usize>();
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::<Vec<_>>();
// 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<ResolvedVc<Box<dyn Module>>, 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 mergeable = graphs
.iter()
.flat_map(|g| g.iter_nodes())
.map(async |n| {
let module = n.module;
if let Some(mergeable) =
ResolvedVc::try_downcast::<Box<dyn MergeableModule>>(module)
&& *mergeable.is_mergeable().await?
{
return Ok(Some(module));
}
Ok(None)
})
.try_flat_join()
.await?
.into_iter()
.collect::<FxHashSet<_>>();
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<GraphTraversalAction> {
// 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;
Ok(if parent_module.is_some_and(|p| p == module) {
// A self-reference
GraphTraversalAction::Skip
} else if hoisted
&& let Some(parent_module) = parent_module
&& mergeable.contains(&parent_module)
&& mergeable.contains(&module)
&& !async_module_info.contains(&parent_module)
&& !async_module_info.contains(&module)
{
// ^ TODO technically we could merge a sync child into an async parent
// 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;
if module_merged_groups.entry(module).or_default().insert(idx) {
// Mark and continue traversal because modified (or first visit)
GraphTraversalAction::Continue
} else {
// Unchanged, no need to forward to children
GraphTraversalAction::Skip
}
} 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);
#[derive(Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
struct ListOccurence {
// The field order here is important, these structs will get ordered by the entry
// index.
entry: usize,
list: usize,
}
// A list of all different execution traces (orderings) 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<Box<dyn MergeableModule>>,
FxIndexSet<ListOccurence>,
> = FxIndexMap::default();
// A map of all references between 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<Box<dyn Module>>,
FxIndexSet<ResolvedVc<Box<dyn Module>>>,
> = FxIndexMap::default();
// A map of all references between 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<Box<dyn Module>>,
FxIndexSet<ResolvedVc<Box<dyn Module>>>,
> = 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 (orderings),
// stored in the top-level lists and referenced here by index.
let mut chunk_lists: FxHashMap<&RoaringBitmapWrapper, usize> =
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;
let bitmap = module_merged_groups
.get(&module)
.context("every module should have a bitmap at this point")?;
if mergeable.contains(&module) {
let mergeable_module =
ResolvedVc::try_downcast::<Box<dyn MergeableModule>>(module)
.unwrap();
match chunk_lists.entry(bitmap) {
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);
}
}
Ok(())
},
)
.await?;
}
// 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_imported: FxHashSet<ResolvedVc<Box<dyn Module>>> =
FxHashSet::with_capacity_and_hasher(module_merged_groups.len(), Default::default());
let mut exposed_modules_namespace: FxHashSet<ResolvedVc<Box<dyn Module>>> =
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, _)| {
module_merged_groups.get(&parent.module).unwrap()
!= module_merged_groups.get(&module).unwrap()
}) {
// This module needs to be exposed:
// - referenced from another group or
// - an entry module (TODO assume it will be required for Node/Edge, but not
// necessarily needed for browser),
exposed_modules_imported.insert(module);
}
if parent_info.is_some_and(|(_, r)| matches!(r.export, ExportUsage::All)) {
// This module needs to be exposed:
// - namespace import from another group
exposed_modules_namespace.insert(module);
}
Ok(())
},
)
.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;
}
// 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;
}
// 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_imported.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_imported.extend(
before_list
.iter()
.chain(common_list.iter())
.map(|n| ResolvedVc::upcast(*n))
.filter(|n| refs.contains(n)),
);
}
}
// 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,
});
}
}
}
}
// Dedupe the lists
let lists = lists.into_iter().collect::<FxHashSet<_>>();
// Call MergeableModule impl to merge the modules.
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::<Box<dyn Module>>(m))
.collect::<FxIndexSet<_>>();
let entry_points = 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::<Vec<_>>();
debug_assert_ne!(entry_points.len(), 0);
let list_exposed = list
.iter()
.map(|&m| {
(
m,
if exposed_modules_imported.contains(&ResolvedVc::upcast(m)) {
MergeableModuleExposure::External
} else if exposed_modules_namespace.contains(&ResolvedVc::upcast(m)) {
MergeableModuleExposure::Internal
} else {
MergeableModuleExposure::None
},
)
})
.collect::<Vec<_>>();
let entry = *list.last().unwrap();
let result = entry
.merge(
MergeableModulesExposed::interned(list_exposed),
MergeableModules::interned(entry_points),
)
.to_resolved()
.await?;
let list_len = list.len();
Ok(Some((
ResolvedVc::upcast::<Box<dyn Module>>(entry),
result,
list.into_iter()
.take(list_len - 1)
.map(ResolvedVc::upcast::<Box<dyn Module>>)
.collect::<Vec<_>>(),
)))
})
.try_join()
.await?;
#[allow(clippy::type_complexity)]
let mut replacements: FxHashMap<
ResolvedVc<Box<dyn Module>>,
ResolvedVc<Box<dyn ChunkableModule>>,
> = Default::default();
#[allow(clippy::type_complexity)]
let mut replacements_to_original: FxHashMap<
ResolvedVc<Box<dyn Module>>,
ResolvedVc<Box<dyn Module>>,
> = Default::default();
let mut included: FxHashSet<ResolvedVc<Box<dyn Module>>> = FxHashSet::default();
for (original, replacement, replacement_included) in result.into_iter().flatten() {
replacements.insert(original, replacement);
replacements_to_original.insert(ResolvedVc::upcast(replacement), original);
included.extend(replacement_included);
}
span.record("merged_groups", replacements.len());
span.record("included_modules", included.len());
Ok(MergedModuleInfo {
replacements,
replacements_to_original,
included,
}
.cell())
}
.instrument(span_outer)
.await
}
......@@ -32,6 +32,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},
......@@ -42,6 +43,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;
......@@ -992,6 +994,11 @@ impl ModuleGraph {
compute_chunk_group_info(self).await
}
#[turbo_tasks::function]
pub async fn merged_modules(self: Vc<Self>) -> Result<Vc<MergedModuleInfo>> {
compute_merged_modules(self).await
}
#[turbo_tasks::function]
pub async fn module_batches(
self: Vc<Self>,
......
......@@ -423,7 +423,7 @@ fn generate_minimal_source_map(filename: String, source: String) -> Result<Rope>
}
let sm: Arc<SourceMap> = Default::default();
sm.new_source_file(FileName::Custom(filename).into(), source);
let map = generate_js_source_map(sm, mappings, None, true)?;
let map = generate_js_source_map(&*sm, mappings, None, true, true)?;
Ok(map)
}
......
......@@ -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,
......
......@@ -43,7 +43,7 @@ interface TurbopackDevContext extends TurbopackDevBaseContext {}
type ModuleFactory = (
this: Module['exports'],
context: TurbopackDevBaseContext
) => undefined
) => unknown
interface DevRuntimeBackend {
reloadChunk?: (chunkUrl: ChunkUrl) => Promise<void>
......@@ -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,
......
......@@ -31,7 +31,7 @@ type RuntimeParams = {
type ChunkRegistration = [
chunkPath: ChunkScript,
chunkModules: ModuleFactories,
chunkModules: CompressedModuleFactories,
params: RuntimeParams | undefined,
]
......@@ -361,8 +361,16 @@ function registerChunk([
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)
}
......
......@@ -56,7 +56,7 @@ interface TurbopackNodeBuildContext extends TurbopackBaseContext<Module> {
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,13 +107,21 @@ 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]) {
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}`
......@@ -165,12 +173,20 @@ 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]) {
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}`
......@@ -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,
......
......@@ -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<EsmNamespaceObject>
type EsmExport = (exportGetters: Record<string, () => any>) => void
type ExportValue = (value: any) => void
type ExportNamespace = (namespace: any) => void
type DynamicExport = (object: Record<string, any>) => void
type EsmExport = (
exportGetters: Record<string, () => 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<string, any>,
id: ModuleId | undefined
) => void
type LoadChunk = (chunkPath: ChunkPath) => Promise<any> | undefined
type LoadChunkByUrl = (chunkUrl: ChunkUrl) => Promise<any> | undefined
......@@ -54,7 +61,13 @@ type LoadWebAssemblyModule = (
) => WebAssembly.Module
type ModuleCache<M> = Record<ModuleId, M>
type ModuleFactories = Record<ModuleId, unknown>
// TODO properly type values here
type ModuleFactories = Record<ModuleId, Function>
// 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
......
......@@ -59,6 +59,26 @@ function defineProp(
if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options)
}
function getOverwrittenModule(
moduleCache: ModuleCache<Module>,
id: ModuleId
): Module {
let module = moduleCache[id]
if (!module) {
// This is invoked when a module is merged into another module, thus it wasn't invoked 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<string, () => any>
moduleCache: ModuleCache<Module>,
getters: Record<string, () => 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<string, any>
moduleCache: ModuleCache<Module>,
object: Record<string, any>,
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<Module>,
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<Module>,
namespace: any,
id: ModuleId | undefined
) {
if (id != null) {
module = getOverwrittenModule(moduleCache, id)
}
module.exports = module.namespaceObject = namespace
}
......
......@@ -21,6 +21,7 @@ data-encoding = { workspace = true }
either = { workspace = true }
indexmap = { workspace = true }
indoc = { workspace = true }
itertools = { workspace = true }
num-bigint = "0.4"
num-traits = "0.2.15"
once_cell = { workspace = true }
......
......@@ -2,13 +2,15 @@ use std::io::Write;
use anyhow::{Result, bail};
use serde::{Deserialize, Serialize};
use smallvec::SmallVec;
use turbo_rcstr::rcstr;
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},
......@@ -18,7 +20,7 @@ use turbopack_core::{
use crate::{
EcmascriptModuleContent, EcmascriptOptions,
references::async_module::{AsyncModuleOptions, OptionAsyncModuleOptions},
utils::FormatIter,
utils::{FormatIter, StringifyJs},
};
#[turbo_tasks::value(shared)]
......@@ -26,6 +28,7 @@ use crate::{
pub struct EcmascriptChunkItemContent {
pub inner_code: Rope,
pub source_map: Option<Rope>,
pub additional_ids: SmallVec<[ResolvedVc<ModuleId>; 1]>,
pub options: EcmascriptChunkItemOptions,
pub rewrite_source_path: Option<ResolvedVc<FileSystemPath>>,
pub placeholder_for_future_extensions: (),
......@@ -57,6 +60,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,
......@@ -105,7 +109,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 {
......@@ -148,6 +157,10 @@ impl EcmascriptChunkItemContent {
}
code += "})";
if !additional_ids.is_empty() {
writeln!(code, ", {}]", StringifyJs(&additional_ids))?;
}
Ok(code.build().cell())
}
}
......@@ -261,11 +274,7 @@ async fn module_factory_with_code_generation_issue(
{
Ok(factory) => factory,
Err(error) => {
let id = chunk_item
.chunking_context()
.chunk_item_id(Vc::upcast(chunk_item))
.to_string()
.await;
let id = chunk_item.asset_ident().to_string().await;
let id = id.as_ref().map_or_else(|_| "unknown", |id| &**id);
let error = error.context(format!(
"An error occurred while generating the chunk item {id}"
......
......@@ -16,7 +16,9 @@ use turbopack_core::{
chunk::ChunkingContext, module_graph::ModuleGraph, reference::ModuleReference,
};
use crate::references::{
use crate::{
ScopeHoistingContext,
references::{
AstPath,
amd::AmdDefineWithDependenciesCodeGen,
cjs::{
......@@ -36,6 +38,7 @@ use crate::references::{
require_context::RequireContextAssetReferenceCodeGen,
unreachable::Unreachable,
worker::WorkerAssetReferenceCodeGen,
},
};
#[derive(Default)]
......@@ -193,6 +196,7 @@ impl CodeGen {
&self,
g: Vc<ModuleGraph>,
ctx: Vc<Box<dyn ChunkingContext>>,
scope_hoisting_context: ScopeHoistingContext<'_>,
) -> Result<CodeGeneration> {
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,
......
......@@ -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;
......@@ -35,32 +36,44 @@ pub mod webpack;
pub mod worker_chunk;
use std::{
fmt::{Display, Formatter},
borrow::Cow,
collections::hash_map::Entry,
fmt::{Debug, Display, Formatter},
mem::take,
sync::Arc,
};
use anyhow::Result;
use anyhow::{Context, Result, bail};
use chunk::EcmascriptChunkItem;
use code_gen::{CodeGeneration, CodeGenerationHoistedStmt};
use either::Either;
use itertools::Itertools;
use parse::{ParseResult, parse};
use path_visitor::ApplyVisitors;
use references::esm::UrlRewriteBehavior;
pub use references::{AnalyzeEcmascriptModuleResult, TURBOPACK_HELPER};
use rustc_hash::{FxHashMap, 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,
comments::{Comment, Comments},
BytePos, DUMMY_SP, FileName, GLOBALS, Globals, Loc, Mark, SourceFile, SourceMap,
SourceMapper, Span, SpanSnippetError, SyntaxContext,
comments::{Comment, CommentKind, Comments},
source_map::{FileLinesResult, Files, SourceMapLookupError},
util::take::Take,
},
ecma::{
ast::{self, Expr, ModuleItem, Program, Script},
ast::{
self, CallExpr, Callee, Decl, EmptyStmt, Expr, ExprStmt, Id, Ident, ModuleItem,
Program, Script, SourceMapperExt, Stmt,
},
codegen::{Emitter, text_writer::JsWriter},
visit::{VisitMutWith, VisitMutWithAstPath},
utils::StmtLikeInjector,
visit::{VisitMut, VisitMutWith, VisitMutWithAstPath},
},
quote,
};
......@@ -69,17 +82,18 @@ pub use transform::{
CustomTransformer, EcmascriptInputTransform, EcmascriptInputTransforms, TransformContext,
TransformPlugin, UnsupportedServerActionIssue,
};
use turbo_rcstr::rcstr;
use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{
FxIndexMap, IntoTraitRef, NonLocalValue, ReadRef, ResolvedVc, TaskInput, TryJoinIterExt,
ValueToString, Vc, trace::TraceRawVcs,
FxIndexMap, IntoTraitRef, NonLocalValue, ReadRef, ResolvedVc, TaskInput, TryFlatJoinIterExt,
TryJoinIterExt, ValueToString, Vc, trace::TraceRawVcs,
};
use turbo_tasks_fs::{FileJsonContent, FileSystemPath, glob::Glob, rope::Rope};
use turbopack_core::{
asset::{Asset, AssetContent},
chunk::{
AsyncModuleInfo, ChunkItem, ChunkType, ChunkableModule, ChunkingContext, EvaluatableAsset,
MinifyType,
MergeableModule, MergeableModuleExposure, MergeableModules, MergeableModulesExposed,
MinifyType, ModuleChunkItemIdExt, ModuleId,
},
compile_time_info::CompileTimeInfo,
context::AssetContext,
......@@ -100,15 +114,19 @@ pub use turbopack_resolve::ecmascript as resolve;
use self::chunk::{EcmascriptChunkItemContent, EcmascriptChunkType, EcmascriptExports};
use crate::{
analyzer::graph::EvalContext,
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},
swc_comments::ImmutableComments,
swc_comments::{CowComments, ImmutableComments},
transform::remove_shebang,
};
......@@ -335,12 +353,10 @@ pub trait EcmascriptAnalyzable: Module + Asset {
module_graph: Vc<ModuleGraph>,
chunking_context: Vc<Box<dyn ChunkingContext>>,
async_module_info: Option<Vc<AsyncModuleInfo>>,
) -> Vc<EcmascriptModuleContent> {
EcmascriptModuleContent::new(self.module_content_options(
module_graph,
chunking_context,
async_module_info,
))
) -> Result<Vc<EcmascriptModuleContent>> {
let own_options =
self.module_content_options(module_graph, chunking_context, async_module_info);
Ok(EcmascriptModuleContent::new(own_options))
}
}
......@@ -716,6 +732,51 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleAsset {
}
}
#[turbo_tasks::value_impl]
impl MergeableModule for EcmascriptModuleAsset {
#[turbo_tasks::function]
async fn is_mergeable(self: ResolvedVc<Self>) -> Result<Vc<bool>> {
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<Self>,
modules: Vc<MergeableModulesExposed>,
entry_points: Vc<MergeableModules>,
) -> Result<Vc<Box<dyn ChunkableModule>>> {
Ok(Vc::upcast(*MergedEcmascriptModule::new(
modules
.await?
.iter()
.map(|(m, exposed)| {
Ok((
ResolvedVc::try_sidecast::<Box<dyn EcmascriptAnalyzable>>(*m)
.context("expected EcmascriptAnalyzable")?,
*exposed,
))
})
.collect::<Result<Vec<_>>>()?,
entry_points
.await?
.iter()
.map(|m| {
ResolvedVc::try_sidecast::<Box<dyn EcmascriptAnalyzable>>(*m)
.context("expected EcmascriptAnalyzable")
})
.collect::<Result<Vec<_>>>()?,
self.options().to_resolved().await?,
)))
}
}
#[turbo_tasks::value_impl]
impl EvaluatableAsset for EcmascriptModuleAsset {}
......@@ -827,7 +888,7 @@ pub struct EcmascriptModuleContent {
pub inner_code: Rope,
pub source_map: Option<Rope>,
pub is_esm: bool,
// pub refresh: bool,
pub additional_ids: SmallVec<[ResolvedVc<ModuleId>; 1]>,
}
#[turbo_tasks::value(shared)]
......@@ -851,7 +912,10 @@ pub struct EcmascriptModuleContentOptions {
}
impl EcmascriptModuleContentOptions {
async fn merged_code_gens(&self) -> Result<Vec<CodeGeneration>> {
async fn merged_code_gens(
&self,
scope_hoisting_context: ScopeHoistingContext<'_>,
) -> Result<Vec<CodeGeneration>> {
let EcmascriptModuleContentOptions {
parsed,
module_graph,
......@@ -885,7 +949,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 {
......@@ -896,7 +965,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?;
......@@ -909,7 +978,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?;
......@@ -942,7 +1013,7 @@ impl EcmascriptModuleContent {
chunking_context,
..
} = &*input;
let code_gens = input.merged_code_gens().await?;
async {
let minify = chunking_context.minify_type().await?;
......@@ -950,13 +1021,14 @@ impl EcmascriptModuleContent {
*parsed,
**ident,
*specified_module_type,
code_gens,
*generate_source_map,
*original_source_map,
*minify,
Some(&*input),
None,
)
.await?;
emit_content(content).await
emit_content(content, Default::default()).await
}
.instrument(tracing::info_span!("gen content with code gens"))
.await
......@@ -974,226 +1046,869 @@ impl EcmascriptModuleContent {
parsed.to_resolved().await?,
ident,
specified_module_type,
vec![],
generate_source_map,
None,
MinifyType::NoMinify,
None,
None,
)
.await?;
emit_content(content).await
emit_content(content, Default::default()).await
}
}
struct CodeGenResult {
program: Program,
source_map: Arc<SourceMap>,
comments: Either<ImmutableComments, Arc<ImmutableComments>>,
extra_comments: SwcComments,
is_esm: bool,
generate_source_map: bool,
original_source_map: Option<ResolvedVc<Box<dyn GenerateSourceMap>>>,
minify: MinifyType,
}
/// Creates a new [`Vc<EcmascriptModuleContent>`] from multiple modules, performing scope
/// hoisting.
/// - The `modules` argument is a list of all modules to be merged (and whether their exports
/// should be exposed).
/// - The `entries` argument is a list of modules that should be treated as entry points for the
/// merged module (used to determine execution order).
#[turbo_tasks::function]
pub async fn new_merged(
modules: Vec<(
ResolvedVc<Box<dyn EcmascriptAnalyzable>>,
MergeableModuleExposure,
)>,
module_options: Vec<Vc<EcmascriptModuleContentOptions>>,
entry_points: Vec<ResolvedVc<Box<dyn EcmascriptAnalyzable>>>,
) -> Result<Vc<Self>> {
let modules = modules
.into_iter()
.map(|(m, exposed)| {
(
ResolvedVc::try_sidecast::<Box<dyn EcmascriptChunkPlaceable>>(m).unwrap(),
exposed,
)
})
.collect::<FxIndexMap<_, _>>();
let entry_points = entry_points
.into_iter()
.map(|m| {
let m = ResolvedVc::try_sidecast::<Box<dyn EcmascriptChunkPlaceable>>(m).unwrap();
(m, modules.get_index_of(&m).unwrap())
})
.collect::<Vec<_>>();
async fn process_parse_result(
parsed: ResolvedVc<ParseResult>,
ident: Vc<AssetIdent>,
specified_module_type: SpecifiedModuleType,
mut code_gens: Vec<CodeGeneration>,
generate_source_map: bool,
original_source_map: Option<ResolvedVc<Box<dyn GenerateSourceMap>>>,
minify: MinifyType,
) -> Result<CodeGenResult> {
let parsed = parsed.final_read_hint().await?;
let globals_merged = Globals::default();
Ok(match &*parsed {
ParseResult::Ok { .. } => {
let extra_comments = SwcComments {
leading: Default::default(),
trailing: Default::default(),
};
let contents = module_options
.iter()
.zip(modules.keys().copied())
.map(async |(options, module)| {
let options = options.await?;
let EcmascriptModuleContentOptions {
chunking_context,
parsed,
ident,
specified_module_type,
generate_source_map,
original_source_map,
..
} = &*options;
// We need a mutable version of the AST. We try to avoid cloning it by unwrapping the
// ReadRef.
let mut parsed = ReadRef::try_unwrap(parsed);
let (mut program, source_map, globals, eval_context, comments) = match &mut parsed {
Ok(ParseResult::Ok {
program,
source_map,
globals,
eval_context,
let result = process_parse_result(
*parsed,
**ident,
*specified_module_type,
*generate_source_map,
*original_source_map,
*chunking_context.minify_type().await?,
Some(&*options),
Some(ScopeHoistingOptions {
module,
modules: &modules,
}),
)
.await?;
Ok((module, result))
})
.try_join()
.await?;
let (merged_ast, comments, source_maps, original_source_maps) =
merge_modules(contents, &entry_points, &globals_merged).await?;
// Use the options from an arbitrary module, since they should all be the same.
let options = module_options.last().unwrap().await?;
let modules_header_width = modules.len().next_power_of_two().trailing_zeros();
let content = CodeGenResult {
program: merged_ast,
source_map: CodeGenResultSourceMap::ScopeHoisting {
modules_header_width,
source_maps,
},
comments: CodeGenResultComments::ScopeHoisting {
modules_header_width,
comments,
}) => (
program.take(),
&*source_map,
&*globals,
&*eval_context,
match Arc::try_unwrap(take(comments)) {
Ok(comments) => Either::Left(comments),
Err(comments) => Either::Right(comments),
},
export_contexts: None,
is_esm: true,
generate_source_map: options.generate_source_map,
original_source_map: CodeGenResultOriginalSourceMap::ScopeHoisting(
original_source_maps,
),
Err(parsed) => {
let ParseResult::Ok {
program,
source_map,
globals,
eval_context,
comments,
} = &**parsed
else {
unreachable!();
};
(
program.clone(),
source_map,
globals,
eval_context,
Either::Right(comments.clone()),
)
}
_ => unreachable!(),
minify: *options.chunking_context.minify_type().await?,
scope_hoisting_syntax_contexts: None,
};
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,
);
for comments in code_gens.iter_mut().flat_map(|cg| cg.comments.as_mut()) {
let leading = Arc::unwrap_or_clone(take(&mut comments.leading));
let trailing = Arc::unwrap_or_clone(take(&mut comments.trailing));
let first_entry = entry_points.first().unwrap().0;
let additional_ids = modules
.keys()
// Additionally set this module factory for all modules that are exposed. The whole
// group might be imported via a different entry import in different chunks (we only
// ensure that the modules are in the same order, not that they form a subgraph that is
// always imported from the same root module).
//
// Also skip the first entry, which is the name of the chunk item.
.filter(|m| {
**m != first_entry && *modules.get(*m).unwrap() == MergeableModuleExposure::External
})
.map(|m| m.chunk_item_id(*options.chunking_context).to_resolved())
.try_join()
.await?
.into();
for (pos, v) in leading {
extra_comments.leading.entry(pos).or_default().extend(v);
emit_content(content, additional_ids).await
}
}
for (pos, v) in trailing {
extra_comments.trailing.entry(pos).or_default().extend(v);
/// Merges multiple Ecmascript modules into a single AST, setting the syntax contexts correctly so
/// that imports work.
///
/// In `contents`, each import from another module in the group must have an Ident with
/// - a `ctxt` listed in scope_hoisting_syntax_contexts.module_contexts, and
/// - `sym` being the name of the import.
///
/// This is then used to map back to the variable name and context of the exporting module.
#[allow(clippy::type_complexity)]
async fn merge_modules(
mut contents: Vec<(ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>, CodeGenResult)>,
entry_points: &Vec<(ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>, usize)>,
globals_merged: &'_ Globals,
) -> Result<(
Program,
Vec<CodeGenResultComments>,
Vec<CodeGenResultSourceMap>,
SmallVec<[ResolvedVc<Box<dyn GenerateSourceMap>>; 1]>,
)> {
struct SetSyntaxContextVisitor<'a> {
modules_header_width: u32,
current_module: ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>,
current_module_idx: u32,
/// The export syntax contexts in the current AST, which will be mapped to merged_ctxts
reverse_module_contexts:
FxIndexMap<SyntaxContext, ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>>,
/// For a given module, the `eval_context.imports.exports`. So for a given export, this
/// allows looking up the corresponding local binding's name and context.
export_contexts:
&'a FxHashMap<ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>, &'a FxHashMap<RcStr, Id>>,
/// A fresh global SyntaxContext for each module-local context, so that we can merge them
/// into a single global AST.
unique_contexts_cache: &'a mut FxHashMap<
(ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>, SyntaxContext),
SyntaxContext,
>,
}
impl<'a> SetSyntaxContextVisitor<'a> {
fn get_context_for(
&mut self,
module: ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>,
local_ctxt: SyntaxContext,
) -> SyntaxContext {
if let Some(&global_ctxt) = self.unique_contexts_cache.get(&(module, local_ctxt)) {
global_ctxt
} else {
let global_ctxt = SyntaxContext::empty().apply_mark(Mark::new());
self.unique_contexts_cache
.insert((module, local_ctxt), global_ctxt);
global_ctxt
}
}
}
CodeGenResult {
program,
source_map: source_map.clone(),
comments,
extra_comments,
is_esm,
generate_source_map,
original_source_map,
minify,
impl VisitMut for SetSyntaxContextVisitor<'_> {
fn visit_mut_ident(&mut self, ident: &mut Ident) {
let Ident {
sym, ctxt, span, ..
} = ident;
// If this ident is an imported binding, rewrite the name and context to the
// corresponding export in the module that exports it.
if let Some(&module) = self.reverse_module_contexts.get(ctxt) {
let eval_context_exports = self.export_contexts.get(&module).unwrap();
// TODO looking up an Atom in a Map<RcStr, _>
let sym_rc_str: RcStr = sym.as_str().into();
let (local, local_ctxt) = if let Some((local, local_ctxt)) =
eval_context_exports.get(&sym_rc_str)
{
(Some(local), *local_ctxt)
} else if sym.starts_with("__TURBOPACK__imported__module__") {
// The variable corresponding to the `export * as foo from "...";` is generated
// in the module generating the reexport (and it's not listed in the
// eval_context). `EsmAssetReference::code_gen` uses a dummy span when
// generating this variable.
(None, SyntaxContext::empty())
} else {
panic!(
"Expected to find a local export for {sym} with ctxt {ctxt:#?} in \
{eval_context_exports:?}",
);
};
let global_ctxt = self.get_context_for(module, local_ctxt);
if let Some(local) = local {
*sym = local.clone();
}
*ctxt = global_ctxt;
span.visit_mut_with(self);
} else {
ident.visit_mut_children_with(self);
}
}
ParseResult::Unparseable { messages } => {
let path = ident.path().to_string().await?;
let error_messages = messages
.as_ref()
.and_then(|m| m.first().map(|f| format!("\n{f}")))
.unwrap_or("".into());
let msg = format!("Could not parse module '{path}'\n{error_messages}");
let body = vec![
quote!(
"const e = new Error($msg);" as Stmt,
msg: Expr = Expr::Lit(msg.into()),
),
quote!("e.code = 'MODULE_UNPARSEABLE';" as Stmt),
quote!("throw e;" as Stmt),
];
CodeGenResult {
program: Program::Script(Script {
span: DUMMY_SP,
body,
shebang: None,
}),
source_map: Arc::new(SourceMap::default()),
comments: Either::Left(Default::default()),
extra_comments: Default::default(),
is_esm: false,
generate_source_map: false,
original_source_map: None,
minify: MinifyType::NoMinify,
fn visit_mut_syntax_context(&mut self, local_ctxt: &mut SyntaxContext) {
// The modules have their own local syntax contexts, which needs to be mapped to
// contexts that were actually created in the merged Globals.
let module = self
.reverse_module_contexts
.get(local_ctxt)
.copied()
.unwrap_or(self.current_module);
let global_ctxt = self.get_context_for(module, *local_ctxt);
*local_ctxt = global_ctxt;
}
fn visit_mut_span(&mut self, span: &mut Span) {
// Encode the module index into the span, to be able to retrieve the module later for
// finding the correct Comments and SourceMap.
span.lo = CodeGenResultComments::encode_bytepos(
self.modules_header_width,
self.current_module_idx,
span.lo,
);
span.hi = CodeGenResultComments::encode_bytepos(
self.modules_header_width,
self.current_module_idx,
span.hi,
);
}
ParseResult::NotFound => {
let path = ident.path().to_string().await?;
let msg = format!("Could not parse module '{path}'");
let body = vec![
quote!(
"const e = new Error($msg);" as Stmt,
msg: Expr = Expr::Lit(msg.into()),
),
quote!("e.code = 'MODULE_UNPARSEABLE';" as Stmt),
quote!("throw e;" as Stmt),
];
CodeGenResult {
program: Program::Script(Script {
span: DUMMY_SP,
body,
shebang: None,
}),
source_map: Arc::new(SourceMap::default()),
comments: Either::Left(Default::default()),
extra_comments: Default::default(),
is_esm: false,
generate_source_map: false,
original_source_map: None,
minify: MinifyType::NoMinify,
}
// Extract programs into a separate mutable list so that `content` doesn't have to be mutably
// borrowed (and `export_contexts` doesn't have to clone).
let mut programs = contents
.iter_mut()
.map(|(_, content)| content.program.take())
.collect::<Vec<_>>();
let export_contexts = contents
.iter()
.map(|(module, content)| (*module, content.export_contexts.as_ref().unwrap()))
.collect::<FxHashMap<_, _>>();
let (merged_ast, inserted) = GLOBALS.set(globals_merged, || {
// As an optimization, assume an average number of 5 contexts per module.
let mut unique_contexts_cache =
FxHashMap::with_capacity_and_hasher(contents.len() * 5, Default::default());
let mut prepare_module =
|(module, content): &(ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>, CodeGenResult),
program: &mut Program| {
if let CodeGenResult {
scope_hoisting_syntax_contexts: Some(module_contexts),
..
} = content
{
GLOBALS.set(globals_merged, || {
program.visit_mut_with(&mut SetSyntaxContextVisitor {
modules_header_width: module_contexts
.len()
.next_power_of_two()
.trailing_zeros(),
current_module: *module,
current_module_idx: module_contexts.get_index_of(module).unwrap()
as u32,
reverse_module_contexts: module_contexts
.iter()
.map(|(m, ctxt)| (*ctxt, *m))
.collect(),
export_contexts: &export_contexts,
unique_contexts_cache: &mut unique_contexts_cache,
});
});
Ok(match program.take() {
Program::Module(module) => Either::Left(module.body.into_iter()),
// A module without any ModuleItem::ModuleDecl but a
// SpecifiedModuleType::EcmaScript can still contain a Module::Script.
Program::Script(script) => {
Either::Right(script.body.into_iter().map(ModuleItem::Stmt))
}
})
}
async fn emit_content(content: CodeGenResult) -> Result<Vc<EcmascriptModuleContent>> {
let CodeGenResult {
program,
source_map,
comments,
extra_comments,
is_esm,
generate_source_map,
original_source_map,
minify,
} = content;
} else {
bail!("Expected scope_hosting_syntax_contexts");
}
};
let mut bytes: Vec<u8> = vec![];
// TODO: Insert this as a sourceless segment so that sourcemaps aren't affected.
// = format!("/* {} */\n", self.module.path().to_string().await?).into_bytes();
let mut inserted = FxHashSet::with_capacity_and_hasher(contents.len(), Default::default());
// Start with inserting the entry points, and recursively inline all their imports.
inserted.extend(entry_points.iter().map(|(_, i)| *i));
let mut mappings = vec![];
let mut inserted_imports = FxHashMap::default();
// Replace inserted `__turbopack_merged_esm__(i);` statements with the corresponding
// ith-module.
let mut queue = entry_points
.iter()
.map(|(_, i)| prepare_module(&contents[*i], &mut programs[*i]))
.flatten_ok()
.rev()
.collect::<Result<Vec<_>>>()?;
let mut result = vec![];
while let Some(item) = queue.pop() {
if let ModuleItem::Stmt(stmt) = &item {
match stmt {
Stmt::Expr(ExprStmt { expr, .. }) => {
if let Expr::Call(CallExpr {
callee: Callee::Expr(callee),
args,
..
}) = &**expr
&& callee.is_ident_ref_to("__turbopack_merged_esm__")
{
let comments = match comments {
Either::Left(comments) => Either::Left(comments.into_consumable()),
Either::Right(ref comments) => Either::Right(comments.consumable()),
};
let comments: &dyn Comments = match &comments {
Either::Left(comments) => comments,
Either::Right(comments) => comments,
};
let comments = MergedComments {
baseline: comments,
mutable: extra_comments,
};
let index =
args[0].expr.as_lit().unwrap().as_num().unwrap().value as usize;
let mut wr = JsWriter::new(
source_map.clone(),
"\n",
&mut bytes,
generate_source_map.then_some(&mut mappings),
// Only insert once, otherwise the module was already executed
if inserted.insert(index) {
queue.extend(
prepare_module(&contents[index], &mut programs[index])?
.into_iter()
.rev(),
);
if matches!(minify, MinifyType::Minify { .. }) {
wr.set_indent_str("");
}
let mut emitter = Emitter {
cfg: swc_core::ecma::codegen::Config::default(),
cm: source_map.clone(),
continue;
}
}
Stmt::Decl(Decl::Var(var)) => {
if let [decl] = &*var.decls
&& let Some(name) = decl.name.as_ident()
&& name.sym.starts_with("__TURBOPACK__imported__module__")
{
// var __TURBOPACK__imported__module__.. = __turbopack_context__.i(..);
// Even if these imports are not side-effect free, they only execute
// once, so no need to insert multiple times.
match inserted_imports.entry(name.sym.clone()) {
Entry::Occupied(entry) => {
// If the import was already inserted, we can skip it. The
// variable mapping minifies better but is unfortunately
// necessary as the syntax contexts of the two imports are
// different.
let entry_ctxt = *entry.get();
let new = Ident::new(name.sym.clone(), DUMMY_SP, name.ctxt);
let old = Ident::new(name.sym.clone(), DUMMY_SP, entry_ctxt);
result.push(ModuleItem::Stmt(
quote!("var $new = $old;" as Stmt,
new: Ident = new,
old: Ident = old
),
));
continue;
}
Entry::Vacant(entry) => {
entry.insert(name.ctxt);
}
}
}
}
_ => (),
}
}
result.push(item);
}
let mut merged_ast = Program::Module(swc_core::ecma::ast::Module {
body: result,
span: DUMMY_SP,
shebang: None,
});
merged_ast.visit_mut_with(&mut swc_core::ecma::transforms::base::hygiene::hygiene());
anyhow::Ok((merged_ast, inserted))
})?;
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 comments = contents
.iter_mut()
.map(|(_, content)| content.comments.take())
.collect::<Vec<_>>();
let source_maps = contents
.iter_mut()
.map(|(_, content)| std::mem::take(&mut content.source_map))
.collect::<Vec<_>>();
let original_source_maps = contents
.iter_mut()
.flat_map(|(_, content)| match content.original_source_map {
CodeGenResultOriginalSourceMap::ScopeHoisting(_) => unreachable!(
"Didn't expect nested CodeGenResultOriginalSourceMap::ScopeHoisting: {:?}",
content.original_source_map
),
CodeGenResultOriginalSourceMap::Single(map) => map,
})
.collect();
Ok((merged_ast, comments, source_maps, original_source_maps))
}
/// Provides information about the other modules in the current scope hoisting group.
#[derive(Clone, Copy)]
pub enum ScopeHoistingContext<'a> {
Some {
/// The current module when scope hoisting
module: ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>,
/// All modules in the current group, and whether they should expose their exports
modules:
&'a FxIndexMap<ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>, MergeableModuleExposure>,
/// To import a specifier from another module, apply this context to the Ident
module_syntax_contexts:
&'a FxIndexMap<ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>, SyntaxContext>,
},
None,
}
impl<'a> ScopeHoistingContext<'a> {
/// The current module when scope hoisting
pub fn module(&self) -> Option<ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>> {
match self {
ScopeHoistingContext::Some { module, .. } => Some(*module),
ScopeHoistingContext::None => None,
}
}
/// Whether the current module should not expose it's exports into the module cache.
pub fn skip_module_exports(&self) -> bool {
match self {
ScopeHoistingContext::Some {
module, modules, ..
} => match modules.get(module).unwrap() {
MergeableModuleExposure::None => true,
MergeableModuleExposure::Internal | MergeableModuleExposure::External => false,
},
ScopeHoistingContext::None => false,
}
}
pub fn get_module_syntax_context(
&self,
module: ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>,
) -> Option<SyntaxContext> {
match self {
ScopeHoistingContext::Some {
module_syntax_contexts,
..
} => module_syntax_contexts.get(&module).copied(),
ScopeHoistingContext::None => None,
}
}
pub fn get_module_index(
&self,
module: ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>,
) -> Option<usize> {
match self {
ScopeHoistingContext::Some { modules, .. } => modules.get_index_of(&module),
ScopeHoistingContext::None => None,
}
}
}
struct CodeGenResult {
program: Program,
source_map: CodeGenResultSourceMap,
comments: CodeGenResultComments,
/// `eval_context.imports.exports`
export_contexts: Option<FxHashMap<RcStr, Id>>,
is_esm: bool,
generate_source_map: bool,
original_source_map: CodeGenResultOriginalSourceMap,
minify: MinifyType,
scope_hoisting_syntax_contexts:
Option<FxIndexMap<ResolvedVc<Box<dyn EcmascriptChunkPlaceable + 'static>>, SyntaxContext>>,
}
struct ScopeHoistingOptions<'a> {
module: ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>,
modules: &'a FxIndexMap<ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>, MergeableModuleExposure>,
}
async fn process_parse_result(
parsed: ResolvedVc<ParseResult>,
ident: Vc<AssetIdent>,
specified_module_type: SpecifiedModuleType,
generate_source_map: bool,
original_source_map: Option<ResolvedVc<Box<dyn GenerateSourceMap>>>,
minify: MinifyType,
options: Option<&EcmascriptModuleContentOptions>,
scope_hoisting_options: Option<ScopeHoistingOptions<'_>>,
) -> Result<CodeGenResult> {
with_consumed_parse_result(
parsed,
async |mut program, source_map, globals, eval_context, comments| -> Result<CodeGenResult> {
let (top_level_mark, is_esm, export_contexts) = eval_context
.map_either(
|e| {
(
e.top_level_mark,
e.is_esm(specified_module_type),
Cow::Owned(e.imports.exports),
)
},
|e| {
(
e.top_level_mark,
e.is_esm(specified_module_type),
Cow::Borrowed(&e.imports.exports),
)
},
)
.into_inner();
let (mut code_gens, retain_syntax_context, prepend_ident_comment) =
if let Some(scope_hoisting_options) = scope_hoisting_options {
let (is_import_mark, module_syntax_contexts) = GLOBALS.set(globals, || {
let is_import_mark = Mark::new();
let module_syntax_contexts: FxIndexMap<_, _> = scope_hoisting_options
.modules
.keys()
.map(|m| {
let mark = Mark::fresh(is_import_mark);
(
*m,
SyntaxContext::empty()
.apply_mark(is_import_mark)
.apply_mark(mark),
)
})
.collect();
(is_import_mark, module_syntax_contexts)
});
let ctx = ScopeHoistingContext::Some {
module: scope_hoisting_options.module,
modules: scope_hoisting_options.modules,
module_syntax_contexts: &module_syntax_contexts,
};
let code_gens = options.unwrap().merged_code_gens(ctx).await?;
let preserved_exports =
match &*scope_hoisting_options.module.get_exports().await? {
EcmascriptExports::EsmExports(exports) => exports
.await?
.exports
.iter()
.filter(|(_, e)| matches!(e, export::EsmExport::LocalBinding(_, _)))
.map(|(name, e)| {
if let Some((sym, ctxt)) = export_contexts.get(name) {
Ok((sym.clone(), *ctxt))
} else {
bail!("Couldn't find export {} for binding {:?}", name, e);
}
})
.collect::<Result<FxHashSet<_>>>()?,
_ => Default::default(),
};
let prepend_ident_comment = if matches!(minify, MinifyType::NoMinify) {
Some(Comment {
kind: CommentKind::Line,
span: DUMMY_SP,
text: format!(" MERGED MODULE: {}", ident.to_string().await?).into(),
})
} else {
None
};
(
code_gens,
Some((is_import_mark, module_syntax_contexts, preserved_exports)),
prepend_ident_comment,
)
} else if let Some(options) = options {
(
options.merged_code_gens(ScopeHoistingContext::None).await?,
None,
None,
)
} else {
(vec![], None, None)
};
let extra_comments = SwcComments {
leading: Default::default(),
trailing: Default::default(),
};
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));
let trailing = Arc::unwrap_or_clone(take(&mut comments.trailing));
for (pos, v) in leading {
extra_comments.leading.entry(pos).or_default().extend(v);
}
for (pos, v) in trailing {
extra_comments.trailing.entry(pos).or_default().extend(v);
}
}
GLOBALS.set(globals, || {
if let Some(prepend_ident_comment) = prepend_ident_comment {
let span = Span::dummy_with_cmt();
extra_comments.add_leading(span.lo, prepend_ident_comment);
let stmt = Stmt::Empty(EmptyStmt { span });
match &mut program {
Program::Module(module) => module.body.prepend_stmt(ModuleItem::Stmt(stmt)),
Program::Script(script) => script.body.prepend_stmt(stmt),
}
}
if let Some((is_import_mark, _, preserved_exports)) = &retain_syntax_context {
program.visit_mut_with(&mut hygiene_rename_only(
Some(top_level_mark),
*is_import_mark,
preserved_exports,
));
} 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 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);
});
Ok(CodeGenResult {
program,
source_map: CodeGenResultSourceMap::Single {
source_map: source_map.clone(),
},
comments: CodeGenResultComments::Single {
comments,
extra_comments,
},
// TODO ideally don't clone here at all
export_contexts: Some(export_contexts.into_owned()),
is_esm,
generate_source_map,
original_source_map: CodeGenResultOriginalSourceMap::Single(original_source_map),
minify,
scope_hoisting_syntax_contexts: retain_syntax_context.map(|(_, ctxts, _)| ctxts),
})
},
async |parse_result| -> Result<CodeGenResult> {
Ok(match parse_result {
ParseResult::Ok { .. } => unreachable!(),
ParseResult::Unparseable { messages } => {
let path = ident.path().to_string().await?;
let error_messages = messages
.as_ref()
.and_then(|m| m.first().map(|f| format!("\n{f}")))
.unwrap_or("".into());
let msg = format!("Could not parse module '{path}'\n{error_messages}");
let body = vec![
quote!(
"const e = new Error($msg);" as Stmt,
msg: Expr = Expr::Lit(msg.into()),
),
quote!("e.code = 'MODULE_UNPARSEABLE';" as Stmt),
quote!("throw e;" as Stmt),
];
CodeGenResult {
program: Program::Script(Script {
span: DUMMY_SP,
body,
shebang: None,
}),
source_map: CodeGenResultSourceMap::default(),
comments: CodeGenResultComments::Empty,
export_contexts: None,
is_esm: false,
generate_source_map: false,
original_source_map: CodeGenResultOriginalSourceMap::Single(None),
minify: MinifyType::NoMinify,
scope_hoisting_syntax_contexts: None,
}
}
ParseResult::NotFound => {
let path = ident.path().to_string().await?;
let msg = format!("Could not parse module '{path}'");
let body = vec![
quote!(
"const e = new Error($msg);" as Stmt,
msg: Expr = Expr::Lit(msg.into()),
),
quote!("e.code = 'MODULE_UNPARSEABLE';" as Stmt),
quote!("throw e;" as Stmt),
];
CodeGenResult {
program: Program::Script(Script {
span: DUMMY_SP,
body,
shebang: None,
}),
source_map: CodeGenResultSourceMap::default(),
comments: CodeGenResultComments::Empty,
export_contexts: None,
is_esm: false,
generate_source_map: false,
original_source_map: CodeGenResultOriginalSourceMap::Single(None),
minify: MinifyType::NoMinify,
scope_hoisting_syntax_contexts: None,
}
}
})
},
)
.await
}
/// Try to avoid cloning the AST and Globals by unwrapping the ReadRef (and cloning otherwise).
async fn with_consumed_parse_result<T>(
parsed: ResolvedVc<ParseResult>,
success: impl AsyncFnOnce(
Program,
&Arc<SourceMap>,
&Arc<Globals>,
Either<EvalContext, &'_ EvalContext>,
Either<ImmutableComments, Arc<ImmutableComments>>,
) -> Result<T>,
error: impl AsyncFnOnce(&ParseResult) -> Result<T>,
) -> Result<T> {
let parsed = parsed.final_read_hint().await?;
match &*parsed {
ParseResult::Ok { .. } => {
let mut parsed = ReadRef::try_unwrap(parsed);
let (program, source_map, globals, eval_context, comments) = match &mut parsed {
Ok(ParseResult::Ok {
program,
source_map,
globals,
eval_context,
comments,
}) => (
program.take(),
&*source_map,
&*globals,
Either::Left(std::mem::replace(
eval_context,
EvalContext {
unresolved_mark: eval_context.unresolved_mark,
top_level_mark: eval_context.top_level_mark,
imports: Default::default(),
force_free_values: Default::default(),
},
)),
match Arc::try_unwrap(take(comments)) {
Ok(comments) => Either::Left(comments),
Err(comments) => Either::Right(comments),
},
),
Err(parsed) => {
let ParseResult::Ok {
program,
source_map,
globals,
eval_context,
comments,
} = &**parsed
else {
unreachable!();
};
(
program.clone(),
source_map,
globals,
Either::Right(eval_context),
Either::Right(comments.clone()),
)
}
_ => unreachable!(),
};
success(program, source_map, globals, eval_context, comments).await
}
_ => error(&parsed).await,
}
}
async fn emit_content(
content: CodeGenResult,
additional_ids: SmallVec<[ResolvedVc<ModuleId>; 1]>,
) -> Result<Vc<EcmascriptModuleContent>> {
let CodeGenResult {
program,
source_map,
comments,
is_esm,
generate_source_map,
original_source_map,
minify,
export_contexts: _,
scope_hoisting_syntax_contexts: _,
} = content;
let mut bytes: Vec<u8> = vec![];
// TODO: Insert this as a sourceless segment so that sourcemaps aren't affected.
// = format!("/* {} */\n", self.module.path().to_string().await?).into_bytes();
let mut mappings = vec![];
let source_map = Arc::new(source_map);
{
let mut wr = JsWriter::new(
// unused anyway?
Default::default(),
"\n",
&mut bytes,
generate_source_map.then_some(&mut mappings),
);
if matches!(minify, MinifyType::Minify { .. }) {
wr.set_indent_str("");
}
let comments = comments.consumable();
let mut emitter = Emitter {
cfg: swc_core::ecma::codegen::Config::default(),
cm: source_map.clone(),
comments: Some(&comments as &dyn Comments),
wr,
};
......@@ -1204,21 +1919,20 @@ async fn emit_content(content: CodeGenResult) -> Result<Vc<EcmascriptModuleConte
}
let source_map = if generate_source_map {
if let Some(original_source_map) = original_source_map {
Some(generate_js_source_map(
source_map.clone(),
mappings,
original_source_map.generate_source_map().await?.as_ref(),
true,
)?)
} else {
Some(generate_js_source_map(
source_map.clone(),
&*source_map,
mappings,
None,
original_source_map
.iter()
.map(|map| map.generate_source_map())
.try_flat_join()
.await?,
matches!(
original_source_map,
CodeGenResultOriginalSourceMap::Single(_)
),
true,
)?)
}
} else {
None
};
......@@ -1227,6 +1941,7 @@ async fn emit_content(content: CodeGenResult) -> Result<Vc<EcmascriptModuleConte
inner_code: bytes.into(),
source_map,
is_esm,
additional_ids,
}
.cell())
}
......@@ -1234,7 +1949,6 @@ async fn emit_content(content: CodeGenResult) -> Result<Vc<EcmascriptModuleConte
fn process_content_with_code_gens(
program: &mut Program,
globals: &Globals,
top_level_mark: Option<Mark>,
code_gens: &mut Vec<CodeGeneration>,
) {
let mut visitors = Vec::new();
......@@ -1268,19 +1982,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 {
......@@ -1304,92 +2005,544 @@ fn process_content_with_code_gens(
};
}
struct MergedComments<A, B>
where
A: Comments,
B: Comments,
{
baseline: A,
mutable: B,
/// Like `hygiene`, but only renames the Atoms without clearing all SyntaxContexts
///
/// Don't rename idents marked with `is_import_mark` (i.e. a reference to a value which is imported
/// from another merged module) or listed in `preserve_exports` (i.e. an exported 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<Mark>,
is_import_mark: Mark,
preserved_exports: &FxHashSet<Id>,
) -> impl VisitMut {
struct HygieneRenamer<'a> {
preserved_exports: &'a FxHashSet<Id>,
is_import_mark: Mark,
}
// Copied from `hygiene_with_config`'s HygieneRenamer, but added an `preserved_exports`
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_exports.contains(orig) || orig.1.has_mark(self.is_import_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_exports,
is_import_mark,
},
)
}
enum CodeGenResultSourceMap {
Single {
source_map: Arc<SourceMap>,
},
ScopeHoisting {
/// The bitwidth of the modules header in the spans, see
/// [CodeGenResultComments::encode_bytepos]
modules_header_width: u32,
source_maps: Vec<CodeGenResultSourceMap>,
},
}
impl Debug for CodeGenResultSourceMap {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
CodeGenResultSourceMap::Single { source_map } => {
write!(
f,
"CodeGenResultSourceMap::Single {{ source_map: {:?} }}",
source_map.files().clone()
)
}
CodeGenResultSourceMap::ScopeHoisting {
modules_header_width,
source_maps,
} => write!(
f,
"CodeGenResultSourceMap::ScopeHoisting {{ modules_header_width: \
{modules_header_width}, source_maps: {source_maps:?} }}",
),
}
}
}
impl Default for CodeGenResultSourceMap {
fn default() -> Self {
CodeGenResultSourceMap::Single {
source_map: Arc::new(SourceMap::default()),
}
}
}
impl Files for CodeGenResultSourceMap {
fn try_lookup_source_file(
&self,
pos: BytePos,
) -> Result<Option<Arc<SourceFile>>, SourceMapLookupError> {
match self {
CodeGenResultSourceMap::Single { source_map } => source_map.try_lookup_source_file(pos),
CodeGenResultSourceMap::ScopeHoisting {
modules_header_width,
source_maps,
} => {
let (module, pos) =
CodeGenResultComments::decode_bytepos(*modules_header_width, pos);
source_maps[module].try_lookup_source_file(pos)
}
}
}
fn is_in_file(&self, f: &Arc<SourceFile>, raw_pos: BytePos) -> bool {
match self {
CodeGenResultSourceMap::Single { .. } => f.start_pos <= raw_pos && raw_pos < f.end_pos,
CodeGenResultSourceMap::ScopeHoisting { .. } => {
// let (module, pos) = CodeGenResultComments::decode_bytepos(*modules_header_width,
// pos);
// TODO optimize this, unfortunately, `SourceFile` doesn't know which `module` it
// belongs from.
false
}
}
}
fn map_raw_pos(&self, pos: BytePos) -> BytePos {
match self {
CodeGenResultSourceMap::Single { .. } => pos,
CodeGenResultSourceMap::ScopeHoisting {
modules_header_width,
..
} => CodeGenResultComments::decode_bytepos(*modules_header_width, pos).1,
}
}
}
impl SourceMapper for CodeGenResultSourceMap {
fn lookup_char_pos(&self, pos: BytePos) -> Loc {
match self {
CodeGenResultSourceMap::Single { source_map } => source_map.lookup_char_pos(pos),
CodeGenResultSourceMap::ScopeHoisting {
modules_header_width,
source_maps,
} => {
let (module, pos) =
CodeGenResultComments::decode_bytepos(*modules_header_width, pos);
source_maps[module].lookup_char_pos(pos)
}
}
}
fn span_to_lines(&self, sp: Span) -> FileLinesResult {
match self {
CodeGenResultSourceMap::Single { source_map } => source_map.span_to_lines(sp),
CodeGenResultSourceMap::ScopeHoisting {
modules_header_width,
source_maps,
} => {
let (module, lo) =
CodeGenResultComments::decode_bytepos(*modules_header_width, sp.lo);
source_maps[module].span_to_lines(Span {
lo,
hi: CodeGenResultComments::decode_bytepos(*modules_header_width, sp.hi).1,
})
}
}
}
fn span_to_string(&self, sp: Span) -> String {
match self {
CodeGenResultSourceMap::Single { source_map } => source_map.span_to_string(sp),
CodeGenResultSourceMap::ScopeHoisting {
modules_header_width,
source_maps,
} => {
let (module, lo) =
CodeGenResultComments::decode_bytepos(*modules_header_width, sp.lo);
source_maps[module].span_to_string(Span {
lo,
hi: CodeGenResultComments::decode_bytepos(*modules_header_width, sp.hi).1,
})
}
}
}
fn span_to_filename(&self, sp: Span) -> Arc<FileName> {
match self {
CodeGenResultSourceMap::Single { source_map } => source_map.span_to_filename(sp),
CodeGenResultSourceMap::ScopeHoisting {
modules_header_width,
source_maps,
} => {
let (module, lo) =
CodeGenResultComments::decode_bytepos(*modules_header_width, sp.lo);
source_maps[module].span_to_filename(Span {
lo,
hi: CodeGenResultComments::decode_bytepos(*modules_header_width, sp.hi).1,
})
}
}
}
fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span> {
match self {
CodeGenResultSourceMap::Single { source_map } => source_map.merge_spans(sp_lhs, sp_rhs),
CodeGenResultSourceMap::ScopeHoisting {
modules_header_width,
source_maps,
} => {
let (module_lhs, lo_lhs) =
CodeGenResultComments::decode_bytepos(*modules_header_width, sp_lhs.lo);
let (module_rhs, lo_rhs) =
CodeGenResultComments::decode_bytepos(*modules_header_width, sp_rhs.lo);
if module_lhs != module_rhs {
return None;
}
source_maps[module_lhs].merge_spans(
Span {
lo: lo_lhs,
hi: CodeGenResultComments::decode_bytepos(*modules_header_width, sp_lhs.hi)
.1,
},
Span {
lo: lo_rhs,
hi: CodeGenResultComments::decode_bytepos(*modules_header_width, sp_rhs.hi)
.1,
},
)
}
}
}
fn call_span_if_macro(&self, sp: Span) -> Span {
match self {
CodeGenResultSourceMap::Single { source_map } => source_map.call_span_if_macro(sp),
CodeGenResultSourceMap::ScopeHoisting {
modules_header_width,
source_maps,
} => {
let (module, lo) =
CodeGenResultComments::decode_bytepos(*modules_header_width, sp.lo);
source_maps[module].call_span_if_macro(Span {
lo,
hi: CodeGenResultComments::decode_bytepos(*modules_header_width, sp.hi).1,
})
}
}
}
fn doctest_offset_line(&self, _line: usize) -> usize {
panic!("doctest_offset_line is not implemented for CodeGenResultSourceMap");
}
fn span_to_snippet(&self, sp: Span) -> Result<String, Box<SpanSnippetError>> {
match self {
CodeGenResultSourceMap::Single { source_map } => source_map.span_to_snippet(sp),
CodeGenResultSourceMap::ScopeHoisting {
modules_header_width,
source_maps,
} => {
let (module, lo) =
CodeGenResultComments::decode_bytepos(*modules_header_width, sp.lo);
source_maps[module].span_to_snippet(Span {
lo,
hi: CodeGenResultComments::decode_bytepos(*modules_header_width, sp.hi).1,
})
}
}
}
}
impl SourceMapperExt for CodeGenResultSourceMap {
fn get_code_map(&self) -> &dyn SourceMapper {
self
}
}
#[derive(Debug)]
enum CodeGenResultOriginalSourceMap {
Single(Option<ResolvedVc<Box<dyn GenerateSourceMap>>>),
ScopeHoisting(SmallVec<[ResolvedVc<Box<dyn GenerateSourceMap>>; 1]>),
}
impl CodeGenResultOriginalSourceMap {
fn iter(&self) -> impl Iterator<Item = ResolvedVc<Box<dyn GenerateSourceMap>>> {
match self {
CodeGenResultOriginalSourceMap::Single(map) => Either::Left(map.iter().copied()),
CodeGenResultOriginalSourceMap::ScopeHoisting(maps) => {
Either::Right(maps.iter().copied())
}
}
}
}
enum CodeGenResultComments {
Single {
comments: Either<ImmutableComments, Arc<ImmutableComments>>,
extra_comments: SwcComments,
},
ScopeHoisting {
/// The bitwidth of the modules header in the spans, see
/// [CodeGenResultComments::encode_bytepos]
modules_header_width: u32,
comments: Vec<CodeGenResultComments>,
},
Empty,
}
impl CodeGenResultComments {
fn take(&mut self) -> Self {
std::mem::replace(self, CodeGenResultComments::Empty)
}
fn consumable(&self) -> CodeGenResultCommentsConsumable {
match self {
CodeGenResultComments::Single {
comments,
extra_comments,
} => CodeGenResultCommentsConsumable::Single {
comments: match comments {
Either::Left(comments) => comments.consumable(),
Either::Right(comments) => comments.consumable(),
},
extra_comments,
},
CodeGenResultComments::ScopeHoisting {
modules_header_width,
comments,
} => CodeGenResultCommentsConsumable::ScopeHoisting {
modules_header_width: *modules_header_width,
comments: comments.iter().map(|c| c.consumable()).collect(),
},
CodeGenResultComments::Empty => CodeGenResultCommentsConsumable::Empty,
}
}
fn encode_bytepos(modules_header_width: u32, module: u32, pos: BytePos) -> BytePos {
if pos.is_dummy() {
// nothing to encode
return pos;
}
// 00010000000000100100011010100101
// ^^^^ module id
// ^ whether the bits stolen for the module were once 1 (i.e. "sign extend" again later)
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the original bytepos
//
// # Example:
// pos=11111111111111110000000000000101 with module=0001
// would become
// pos=00011111111111110000000000000101
// # Example:
// pos=00000111111111110000000000000101 with module=0001
// would become
// pos=00010111111111110000000000000101
let header_width = modules_header_width + 1;
let pos_width = 32 - header_width;
let pos = pos.0;
let old_high_bits = pos >> pos_width;
let high_bits_set = if (2u32.pow(header_width) - 1) == old_high_bits {
true
} else if old_high_bits == 0 {
false
} else {
panic!("The high bits of the position {pos} are not all 0s or 1s: {old_high_bits:b}",);
};
let pos = pos & !((2u32.pow(header_width) - 1) << pos_width);
let encoded_high_bits = if high_bits_set { 1 } else { 0 } << pos_width;
let encoded_module = module << (pos_width + 1);
BytePos(encoded_module | encoded_high_bits | pos)
}
fn decode_bytepos(modules_header_width: u32, pos: BytePos) -> (usize, BytePos) {
if pos.is_dummy() {
// nothing to decode
panic!("Cannot decode dummy BytePos");
}
let header_width = modules_header_width + 1;
let pos_width = 32 - header_width;
let high_bits_set = ((pos.0 >> (pos_width)) & 1) == 1;
let module = pos.0 >> (pos_width + 1);
let pos = pos.0 & !((2u32.pow(header_width) - 1) << pos_width);
let pos = if high_bits_set {
pos | ((2u32.pow(header_width) - 1) << pos_width)
} else {
pos
};
(module as usize, BytePos(pos))
}
}
enum CodeGenResultCommentsConsumable<'a> {
Single {
comments: CowComments<'a>,
extra_comments: &'a SwcComments,
},
ScopeHoisting {
modules_header_width: u32,
comments: Vec<CodeGenResultCommentsConsumable<'a>>,
},
Empty,
}
impl<A, B> Comments for MergedComments<A, B>
where
A: Comments,
B: Comments,
{
fn add_leading(&self, pos: BytePos, cmt: Comment) {
self.mutable.add_leading(pos, cmt);
unsafe impl Send for CodeGenResultComments {}
unsafe impl Sync for CodeGenResultComments {}
impl Comments for CodeGenResultCommentsConsumable<'_> {
fn add_leading(&self, _pos: BytePos, _cmt: Comment) {
unimplemented!()
}
fn add_leading_comments(&self, pos: BytePos, comments: Vec<Comment>) {
self.mutable.add_leading_comments(pos, comments);
fn add_leading_comments(&self, _pos: BytePos, _comments: Vec<Comment>) {
unimplemented!()
}
fn has_leading(&self, pos: BytePos) -> bool {
self.baseline.has_leading(pos) || self.mutable.has_leading(pos)
match self {
Self::Single {
comments,
extra_comments,
} => comments.has_leading(pos) || extra_comments.has_leading(pos),
Self::ScopeHoisting {
modules_header_width,
comments,
} => {
let (module, pos) =
CodeGenResultComments::decode_bytepos(*modules_header_width, pos);
comments[module].has_leading(pos)
}
Self::Empty => false,
}
}
fn move_leading(&self, from: BytePos, to: BytePos) {
self.baseline.move_leading(from, to);
self.mutable.move_leading(from, to);
fn move_leading(&self, _from: BytePos, _to: BytePos) {
unimplemented!()
}
fn take_leading(&self, pos: BytePos) -> Option<Vec<Comment>> {
let (v1, v2) = (
self.baseline.take_leading(pos),
self.mutable.take_leading(pos),
);
merge_option_vec(v1, v2)
match self {
Self::Single {
comments,
extra_comments,
} => merge_option_vec(comments.take_leading(pos), extra_comments.take_leading(pos)),
Self::ScopeHoisting {
modules_header_width,
comments,
} => {
let (module, pos) =
CodeGenResultComments::decode_bytepos(*modules_header_width, pos);
comments[module].take_leading(pos)
}
Self::Empty => None,
}
}
fn get_leading(&self, pos: BytePos) -> Option<Vec<Comment>> {
let (v1, v2) = (
self.baseline.get_leading(pos),
self.mutable.get_leading(pos),
);
merge_option_vec(v1, v2)
match self {
Self::Single {
comments,
extra_comments,
} => merge_option_vec(comments.get_leading(pos), extra_comments.get_leading(pos)),
Self::ScopeHoisting {
modules_header_width,
comments,
} => {
let (module, pos) =
CodeGenResultComments::decode_bytepos(*modules_header_width, pos);
comments[module].get_leading(pos)
}
Self::Empty => None,
}
}
fn add_trailing(&self, pos: BytePos, cmt: Comment) {
self.mutable.add_trailing(pos, cmt);
fn add_trailing(&self, _pos: BytePos, _cmt: Comment) {
unimplemented!()
}
fn add_trailing_comments(&self, pos: BytePos, comments: Vec<Comment>) {
self.mutable.add_trailing_comments(pos, comments);
fn add_trailing_comments(&self, _pos: BytePos, _comments: Vec<Comment>) {
unimplemented!()
}
fn has_trailing(&self, pos: BytePos) -> bool {
self.baseline.has_trailing(pos) || self.mutable.has_trailing(pos)
match self {
Self::Single {
comments,
extra_comments,
} => comments.has_trailing(pos) || extra_comments.has_trailing(pos),
Self::ScopeHoisting {
modules_header_width,
comments,
} => {
let (module, pos) =
CodeGenResultComments::decode_bytepos(*modules_header_width, pos);
comments[module].has_trailing(pos)
}
Self::Empty => false,
}
}
fn move_trailing(&self, from: BytePos, to: BytePos) {
self.baseline.move_trailing(from, to);
self.mutable.move_trailing(from, to);
fn move_trailing(&self, _from: BytePos, _to: BytePos) {
unimplemented!()
}
fn take_trailing(&self, pos: BytePos) -> Option<Vec<Comment>> {
let (v1, v2) = (
self.baseline.take_trailing(pos),
self.mutable.take_trailing(pos),
);
merge_option_vec(v1, v2)
match self {
Self::Single {
comments,
extra_comments,
} => merge_option_vec(
comments.take_trailing(pos),
extra_comments.take_trailing(pos),
),
Self::ScopeHoisting {
modules_header_width,
comments,
} => {
let (module, pos) =
CodeGenResultComments::decode_bytepos(*modules_header_width, pos);
comments[module].take_trailing(pos)
}
Self::Empty => None,
}
}
fn get_trailing(&self, pos: BytePos) -> Option<Vec<Comment>> {
let (v1, v2) = (
self.baseline.get_trailing(pos),
self.mutable.get_trailing(pos),
);
merge_option_vec(v1, v2)
match self {
Self::Single {
comments,
extra_comments,
} => merge_option_vec(comments.get_leading(pos), extra_comments.get_leading(pos)),
Self::ScopeHoisting {
modules_header_width,
comments,
} => {
let (module, pos) =
CodeGenResultComments::decode_bytepos(*modules_header_width, pos);
comments[module].get_leading(pos)
}
Self::Empty => None,
}
}
fn add_pure_comment(&self, pos: BytePos) {
self.mutable.add_pure_comment(pos);
fn add_pure_comment(&self, _pos: BytePos) {
unimplemented!()
}
}
......@@ -1409,3 +2562,100 @@ pub fn register() {
turbo_esregex::register();
include!(concat!(env!("OUT_DIR"), "/register.rs"));
}
#[cfg(test)]
mod tests {
use super::*;
fn bytepos_ensure_identical(modules_header_width: u32, pos: BytePos) {
let module_count = 2u32.pow(modules_header_width);
for module in [
0,
1,
2,
module_count / 2,
module_count.wrapping_sub(5),
module_count.wrapping_sub(1),
]
.into_iter()
.filter(|&m| m < module_count)
{
let encoded = CodeGenResultComments::encode_bytepos(modules_header_width, module, pos);
let (decoded_module, decoded_pos) =
CodeGenResultComments::decode_bytepos(modules_header_width, encoded);
assert_eq!(
decoded_module as u32, module,
"Testing width {modules_header_width} and pos {pos:?}"
);
assert_eq!(
decoded_pos, pos,
"Testing width {modules_header_width} and pos {pos:?}"
);
}
}
#[test]
fn test_encode_decode_bytepos_format() {
for (pos, module, modules_header_width, result) in [
(
0b00000000000000000000000000000101,
0b1,
1,
0b10000000000000000000000000000101,
),
(
0b00000000000000000000000000000101,
0b01,
2,
0b01000000000000000000000000000101,
),
(
0b11111111111111110000000000000101,
0b0001,
4,
0b00011111111111110000000000000101,
),
(
0b00000111111111110000000000000101,
0b0001,
4,
0b00010111111111110000000000000101,
),
// Special case, DUMMY stays a DUMMY
(BytePos::DUMMY.0, 0b0001, 4, BytePos::DUMMY.0),
] {
let encoded =
CodeGenResultComments::encode_bytepos(modules_header_width, module, BytePos(pos));
assert_eq!(encoded.0, result);
}
}
#[test]
fn test_encode_decode_bytepos_lossless() {
// This is copied from swc (it's not exported), comments the range above this value.
const DUMMY_RESERVE: u32 = u32::MAX - 2_u32.pow(16);
for modules_header_width in 1..=6 {
for pos in [
// BytePos::DUMMY, // This must never get decoded in the first place
BytePos(1),
BytePos(2),
BytePos(100),
BytePos(4_000_000),
BytePos(60_000_000),
BytePos::PLACEHOLDER,
BytePos::SYNTHESIZED,
BytePos::PURE,
BytePos(DUMMY_RESERVE),
BytePos(DUMMY_RESERVE + 10),
BytePos(DUMMY_RESERVE + 10000),
] {
if modules_header_width == 6 && pos.0 == 60_000_000 {
// this is unfortunately too large indeed, will trigger the panic.
continue;
}
bytepos_ensure_identical(modules_header_width, pos);
}
}
}
}
use anyhow::Result;
use turbo_tasks::{ResolvedVc, Vc};
use turbopack_core::{
asset::{Asset, AssetContent},
chunk::{
AsyncModuleInfo, ChunkItem, ChunkType, ChunkableModule, ChunkingContext,
MergeableModuleExposure,
},
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<Box<dyn EcmascriptAnalyzable>>,
MergeableModuleExposure,
)>,
entry_points: Vec<ResolvedVc<Box<dyn EcmascriptAnalyzable>>>,
options: ResolvedVc<EcmascriptOptions>,
}
impl MergedEcmascriptModule {
pub fn new(
modules: Vec<(
ResolvedVc<Box<dyn EcmascriptAnalyzable>>,
MergeableModuleExposure,
)>,
entry_points: Vec<ResolvedVc<Box<dyn EcmascriptAnalyzable>>>,
options: ResolvedVc<EcmascriptOptions>,
) -> ResolvedVc<Self> {
MergedEcmascriptModule {
modules,
entry_points,
options,
}
.resolved_cell()
}
}
#[turbo_tasks::value_impl]
impl Asset for MergedEcmascriptModule {
#[turbo_tasks::function]
fn content(&self) -> Vc<AssetContent> {
panic!("content() should not be called");
}
}
#[turbo_tasks::value_impl]
impl Module for MergedEcmascriptModule {
#[turbo_tasks::function]
fn ident(&self) -> Vc<AssetIdent> {
// This purposely reuses the module's ident as it has replaced the original module, thus
// there can never be a collision.
self.entry_points.first().unwrap().ident()
}
#[turbo_tasks::function]
async fn references(self: Vc<Self>) -> Result<Vc<ModuleReferences>> {
panic!("references() should not be called");
}
#[turbo_tasks::function]
async fn is_self_async(&self) -> Result<Vc<bool>> {
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<Self>,
module_graph: ResolvedVc<ModuleGraph>,
chunking_context: ResolvedVc<Box<dyn ChunkingContext>>,
) -> Vc<Box<dyn ChunkItem>> {
Vc::upcast(
MergedEcmascriptModuleChunkItem {
module: self,
module_graph,
chunking_context,
}
.cell(),
)
}
}
#[turbo_tasks::value]
struct MergedEcmascriptModuleChunkItem {
module: ResolvedVc<MergedEcmascriptModule>,
module_graph: ResolvedVc<ModuleGraph>,
chunking_context: ResolvedVc<Box<dyn ChunkingContext>>,
}
#[turbo_tasks::value_impl]
impl ChunkItem for MergedEcmascriptModuleChunkItem {
#[turbo_tasks::function]
fn asset_ident(&self) -> Vc<AssetIdent> {
self.module.ident()
}
#[turbo_tasks::function]
fn chunking_context(&self) -> Vc<Box<dyn ChunkingContext>> {
*ResolvedVc::upcast(self.chunking_context)
}
#[turbo_tasks::function]
async fn ty(&self) -> Result<Vc<Box<dyn ChunkType>>> {
Ok(Vc::upcast(
Vc::<EcmascriptChunkType>::default().resolve().await?,
))
}
#[turbo_tasks::function]
fn module(&self) -> Vc<Box<dyn Module>> {
*ResolvedVc::upcast(self.module)
}
}
#[turbo_tasks::value_impl]
impl EcmascriptChunkItem for MergedEcmascriptModuleChunkItem {
#[turbo_tasks::function]
fn content(self: Vc<Self>) -> Vc<EcmascriptChunkItemContent> {
panic!("content() should not be called");
}
#[turbo_tasks::function]
async fn content_with_async_module_info(
&self,
async_module_info: Option<Vc<AsyncModuleInfo>>,
) -> Result<Vc<EcmascriptChunkItemContent>> {
let module = self.module.await?;
let modules = &module.modules;
let entry_points = &module.entry_points;
let options = modules
.iter()
.map(|(m, _)| {
let Some(m) = ResolvedVc::try_downcast::<Box<dyn EcmascriptAnalyzable>>(*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::<Result<Vec<_>>>()?;
let content = EcmascriptModuleContent::new_merged(
modules.clone(),
options,
ResolvedVc::deref_vec(entry_points.clone()),
);
// Currently, merged modules never include async modules.
let async_module_options = Vc::cell(None);
Ok(EcmascriptChunkItemContent::new(
content,
*self.chunking_context,
*module.options,
async_module_options,
))
}
}
......@@ -132,9 +132,10 @@ pub fn minify(code: Code, source_maps: bool, mangle: Option<MangleType>) -> Resu
builder.push_source(
&src.into(),
Some(generate_js_source_map(
cm,
&*cm,
src_map_buf,
Some(original_map),
true,
// We do not inline source contents.
// We provide a synthesized value to `cm.new_source_file` above, so it cannot be
// the value user expect anyway.
......
......@@ -9,7 +9,7 @@ use swc_core::{
BytePos, FileName, GLOBALS, Globals, LineCol, Mark, SyntaxContext,
errors::{HANDLER, Handler},
input::StringInput,
source_map::SourceMapGenConfig,
source_map::{Files, SourceMapGenConfig, build_source_map},
util::take::Take,
},
ecma::{
......@@ -99,36 +99,54 @@ impl ParseResult {
}
}
/// `original_source_maps_complete` indicates whether the `original_source_maps` cover the whole
/// map, i.e. whether every module that ended up in `mappings` had an original sourcemap.
#[instrument(level = Level::INFO, skip_all)]
pub fn generate_js_source_map(
files_map: Arc<swc_core::common::SourceMap>,
pub fn generate_js_source_map<'a>(
files_map: &impl Files,
mappings: Vec<(BytePos, LineCol)>,
original_source_map: Option<&Rope>,
original_source_maps: impl IntoIterator<Item = &'a Rope>,
original_source_maps_complete: bool,
inline_sources_content: bool,
) -> Result<Rope> {
let original_source_map = original_source_map.map(|x| x.to_bytes());
let input_map = if let Some(original_source_map) = &original_source_map {
Some(swc_sourcemap::lazy::decode(original_source_map)?.into_source_map()?)
} else {
None
};
let new_mappings = files_map.build_source_map(
let original_source_maps = original_source_maps
.into_iter()
.map(|map| map.to_bytes())
.collect::<Vec<_>>();
let original_source_maps = original_source_maps
.iter()
.map(|map| Ok(swc_sourcemap::lazy::decode(map)?.into_source_map()?))
.collect::<Result<Vec<_>>>()?;
let fast_path_single_original_source_map =
original_source_maps.len() == 1 && original_source_maps_complete;
let mut new_mappings = build_source_map(
files_map,
&mappings,
None,
InlineSourcesContentConfig {
&InlineSourcesContentConfig {
// If we are going to adjust the source map, we are going to throw the source contents
// of this source map away regardless.
//
// In other words, we don't need the content of `B` in source map chain of A -> B -> C.
// We only need the source content of `A`, and a way to map the content of `B` back to
// `A`, while constructing the final source map, `C`.
inline_sources_content: inline_sources_content && input_map.is_none(),
inline_sources_content: inline_sources_content && !fast_path_single_original_source_map,
},
);
match input_map {
Some(mut map) => {
if original_source_maps.is_empty() {
// We don't convert sourcemap::SourceMap into raw_sourcemap::SourceMap because we don't
// need to adjust mappings
add_default_ignore_list(&mut new_mappings);
let mut result = vec![];
new_mappings.to_writer(&mut result)?;
Ok(Rope::from(result))
} else if fast_path_single_original_source_map {
let mut map = original_source_maps.into_iter().next().unwrap();
// TODO: Make this more efficient
map.adjust_mappings(new_mappings);
......@@ -137,11 +155,8 @@ pub fn generate_js_source_map(
let map = map.into_raw_sourcemap();
let result = serde_json::to_vec(&map)?;
Ok(Rope::from(result))
}
None => {
// We don't convert sourcemap::SourceMap into raw_sourcemap::SourceMap because we don't
// need to adjust mappings
let mut map = new_mappings;
} else {
let mut map = new_mappings.adjust_mappings_from_multiple(original_source_maps);
add_default_ignore_list(&mut map);
......@@ -149,7 +164,6 @@ pub fn generate_js_source_map(
map.to_writer(&mut result)?;
Ok(Rope::from(result))
}
}
}
/// A config to generate a source map which includes the source content of every
......
......@@ -17,7 +17,11 @@ use turbopack_core::{
};
use super::esm::base::ReferencedAsset;
use crate::code_gen::{CodeGeneration, CodeGenerationHoistedStmt};
use crate::{
ScopeHoistingContext,
code_gen::{CodeGeneration, CodeGenerationHoistedStmt},
utils::AstSyntaxContext,
};
/// Information needed for generating the async module wrapper for
/// [EcmascriptChunkItem](crate::chunk::EcmascriptChunkItem)s.
......@@ -76,8 +80,10 @@ impl OptionAsyncModule {
}
}
/// The identifiers (and their corresponding syntax context) of all async modules referenced by the
/// current module.
#[turbo_tasks::value(transparent)]
struct AsyncModuleIdents(FxIndexSet<String>);
struct AsyncModuleIdents(FxIndexSet<(String, AstSyntaxContext)>);
async fn get_inherit_async_referenced_asset(
r: Vc<Box<dyn ModuleReference>>,
......@@ -123,7 +129,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, ScopeHoistingContext::None)
.await?
.map(|i| i.into_module_namespace_ident().unwrap())
.map(|(i, ctx)| (i, ctx.unwrap_or_default().into()))
} else {
None
}
......@@ -133,7 +143,11 @@ impl AsyncModule {
.referenced_async_modules
.contains(&ResolvedVc::upcast(*placeable))
{
referenced_asset.get_ident(chunking_context).await?
referenced_asset
.get_ident(chunking_context, None, ScopeHoistingContext::None)
.await?
.map(|i| i.into_module_namespace_ident().unwrap())
.map(|(i, ctx)| (i, ctx.unwrap_or_default().into()))
} else {
None
}
......@@ -208,9 +222,7 @@ 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, **ctxt))
.collect::<Vec<_>>();
return Ok(CodeGeneration::hoisted_stmts([
......
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, 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,199 @@ pub enum ReferencedAsset {
Unresolvable,
}
#[derive(Debug)]
pub enum ReferencedAssetIdent {
/// The given export (or namespace) is a local binding in the current scope hoisting group.
LocalBinding { ident: RcStr, ctxt: SyntaxContext },
/// The given export (or namespace) should be imported and will be assigned to a new variable.
Module {
namespace_ident: String,
ctxt: Option<SyntaxContext>,
export: Option<RcStr>,
},
}
impl ReferencedAssetIdent {
pub fn into_module_namespace_ident(self) -> Option<(String, Option<SyntaxContext>)> {
match self {
ReferencedAssetIdent::Module {
namespace_ident,
ctxt,
..
} => Some((namespace_ident, ctxt)),
ReferencedAssetIdent::LocalBinding { .. } => None,
}
}
pub fn as_expr_individual(&self, span: Span) -> Either<Ident, MemberExpr> {
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<Box<dyn ChunkingContext>>,
) -> Result<Option<String>> {
export: Option<RcStr>,
scope_hoisting_context: ScopeHoistingContext<'_>,
) -> Result<Option<ReferencedAssetIdent>> {
self.get_ident_inner(chunking_context, export, scope_hoisting_context, None)
.await
}
async fn get_ident_inner(
&self,
chunking_context: Vc<Box<dyn ChunkingContext>>,
export: Option<RcStr>,
scope_hoisting_context: ScopeHoistingContext<'_>,
initial: Option<&ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>>,
) -> Result<Option<ReferencedAssetIdent>> {
Ok(match self {
ReferencedAsset::Some(asset) => {
Some(Self::get_ident_from_placeable(asset, chunking_context).await?)
if let Some(ctxt) =
scope_hoisting_context.get_module_syntax_context(ResolvedVc::upcast(*asset))
&& let Some(export) = &export
&& let EcmascriptExports::EsmExports(exports) = *asset.get_exports().await?
{
let exports = exports.expand_exports(None).await?;
let esm_export = exports.exports.get(export);
match esm_export {
Some(EsmExport::LocalBinding(_, _)) => {
// A local binding in a module that is merged in the same group. Use the
// export name as identifier, it will be replaced with the actual
// variable name during AST merging.
return Ok(Some(ReferencedAssetIdent::LocalBinding {
ident: export.clone(),
ctxt,
}));
}
Some(b @ EsmExport::ImportedBinding(esm_ref, _, _))
| Some(b @ EsmExport::ImportedNamespace(esm_ref)) => {
let imported = if let EsmExport::ImportedBinding(_, export, _) = b {
Some(export.clone())
} else {
None
};
let referenced_asset =
ReferencedAsset::from_resolve_result(esm_ref.resolve_reference())
.await?;
if let Some(&initial) = initial
&& *referenced_asset == ReferencedAsset::Some(initial)
{
// `initial` reexports from `asset` reexports from
// `referenced_asset` (which is `initial`)
CircularReExport {
export: export.clone(),
import: imported.clone(),
module: *asset,
module_cycle: initial,
}
.resolved_cell()
.emit();
return Ok(None);
}
// 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_inner(
chunking_context,
imported,
scope_hoisting_context,
Some(asset),
))
.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.
}
ReferencedAsset::External(request, ty) => Some(magic_identifier::mangle(&format!(
"{ty} external {request}"
))),
}
}
Some(ReferencedAssetIdent::Module {
namespace_ident: Self::get_ident_from_placeable(asset, chunking_context)
.await?,
ctxt: None,
export,
})
}
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,14 +492,17 @@ impl EsmAssetReference {
pub async fn code_generation(
self: Vc<Self>,
chunking_context: Vc<Box<dyn ChunkingContext>>,
scope_hoisting_context: ScopeHoistingContext<'_>,
) -> Result<CodeGeneration> {
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 {
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();
......@@ -319,8 +510,51 @@ impl EsmAssetReference {
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? {
return Ok(CodeGeneration::hoisted_stmt(
format!("throw {request}").into(),
stmt,
));
}
ReferencedAsset::None => {}
_ => {
let mut result = vec![];
let merged_index = if let ReferencedAsset::Some(asset) = &*referenced_asset {
scope_hoisting_context.get_module_index(*asset)
} else {
None
};
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(),
),
));
}
if merged_index.is_some() && this.export_name == Some(ModulePart::Evaluation) {
// No need to import to execution, the module was already inlined.
} else {
let ident = referenced_asset
.get_ident(
chunking_context,
this.export_name.as_ref().and_then(|e| match e {
ModulePart::Export(export_name) => Some(export_name.clone()),
_ => None,
}),
scope_hoisting_context,
)
.await?;
match ident {
Some(ReferencedAssetIdent::LocalBinding { .. }) => {
// no need to import
}
Some(ident @ ReferencedAssetIdent::Module { .. }) => {
let span = this
.issue_source
.to_swc_offsets()
......@@ -330,58 +564,76 @@ impl EsmAssetReference {
});
match &*referenced_asset {
ReferencedAsset::Unresolvable => {
unreachable!()
unreachable!();
}
ReferencedAsset::Some(asset) => {
let id = asset.chunk_item_id(Vc::upcast(chunking_context)).await?;
let name = ident;
Some((
let id = asset
.chunk_item_id(Vc::upcast(chunking_context))
.await?;
let (sym, ctxt) =
ident.into_module_namespace_ident().unwrap();
let name = Ident::new(
sym.into(),
DUMMY_SP,
ctxt.unwrap_or_default(),
);
result.push(CodeGenerationHoistedStmt::new(
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()),
name = name,
turbopack_import: Expr = TURBOPACK_IMPORT.into(),
id: Expr = module_id_to_lit(&id),
),
span,
),
))
));
}
ReferencedAsset::External(request, ExternalType::EcmaScriptModule) => {
ReferencedAsset::External(
request,
ExternalType::EcmaScriptModule,
) => {
if !*chunking_context
.environment()
.supports_esm_externals()
.await?
{
bail!(
"the chunking context ({}) does not support external modules (esm \
request: {})",
"the chunking context ({}) does not support \
external modules (esm request: {})",
chunking_context.name().await?,
request
);
}
Some((
ident.clone().into(),
let (sym, ctxt) =
ident.into_module_namespace_ident().unwrap();
let name = Ident::new(
sym.into(),
DUMMY_SP,
ctxt.unwrap_or_default(),
);
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 = Ident::new(ident.clone().into(), DUMMY_SP, Default::default()),
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 = Ident::new(ident.clone().into(), DUMMY_SP, Default::default()),
name = name,
turbopack_external_require: Expr = TURBOPACK_EXTERNAL_REQUIRE.into(),
id: Expr = Expr::Lit(request.clone().to_string().into())
)
},
span,
),
))
));
}
ReferencedAsset::External(
request,
......@@ -393,49 +645,57 @@ impl EsmAssetReference {
.await?
{
bail!(
"the chunking context ({}) does not support external modules \
(request: {})",
"the chunking context ({}) does not support \
external modules (request: {})",
chunking_context.name().await?,
request
);
}
Some((
ident.clone().into(),
let (sym, ctxt) =
ident.into_module_namespace_ident().unwrap();
let name = Ident::new(
sym.into(),
DUMMY_SP,
ctxt.unwrap_or_default(),
);
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 = Ident::new(ident.clone().into(), DUMMY_SP, Default::default()),
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: {:?}",
"Unsupported external type {:?} for ESM reference \
with request: {:?}",
ty,
request
)
}
ReferencedAsset::None => None,
ReferencedAsset::None => {}
};
}
None => {
// Nothing to import.
}
}
}
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())
}
}
}
fn var_decl_with_span(mut decl: Stmt, span: Span) -> Stmt {
......@@ -539,3 +799,63 @@ impl Issue for InvalidExport {
Vc::cell(Some(self.source.clone()))
}
}
#[turbo_tasks::value(shared)]
pub struct CircularReExport {
export: RcStr,
import: Option<RcStr>,
module: ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>,
module_cycle: ResolvedVc<Box<dyn EcmascriptChunkPlaceable>>,
// TODO ideally we'd have an issue source here
}
#[turbo_tasks::value_impl]
impl Issue for CircularReExport {
fn severity(&self) -> IssueSeverity {
IssueSeverity::Error
}
#[turbo_tasks::function]
async fn title(&self) -> Result<Vc<StyledString>> {
Ok(StyledString::Line(vec![
StyledString::Text("Export ".into()),
StyledString::Code(self.export.clone()),
StyledString::Text(" is a circular re-export".into()),
])
.cell())
}
#[turbo_tasks::function]
fn stage(&self) -> Vc<IssueStage> {
IssueStage::Bindings.into()
}
#[turbo_tasks::function]
fn file_path(&self) -> Vc<FileSystemPath> {
self.module.ident().path()
}
#[turbo_tasks::function]
async fn description(&self) -> Result<Vc<OptionStyledString>> {
Ok(Vc::cell(Some(
StyledString::Stack(vec![
StyledString::Line(vec![StyledString::Text("The export".into())]),
StyledString::Line(vec![
StyledString::Code(self.export.clone()),
StyledString::Text(" of module ".into()),
StyledString::Strong(self.module.ident().to_string().owned().await?),
]),
StyledString::Line(vec![StyledString::Text(
"is a re-export of the export".into(),
)]),
StyledString::Line(vec![
StyledString::Code(self.import.clone().unwrap_or_else(|| "*".into())),
StyledString::Text(" of module ".into()),
StyledString::Strong(self.module_cycle.ident().to_string().owned().await?),
StyledString::Text(".".into()),
]),
])
.resolved_cell(),
)))
}
}
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,
},
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<ModuleGraph>,
chunking_context: Vc<Box<dyn ChunkingContext>>,
scope_hoisting_context: ScopeHoistingContext<'_>,
) -> Result<CodeGeneration> {
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());
......@@ -149,11 +144,13 @@ impl EsmBinding {
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!(),
};
*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`
......@@ -162,7 +159,8 @@ impl EsmBinding {
// Do nothing, the reference will insert a throw
}
}
}));
})
);
break;
}
}
......@@ -182,40 +180,3 @@ impl From<EsmBinding> 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()))
}
}
......@@ -6,8 +6,8 @@ use serde::{Deserialize, Serialize};
use swc_core::{
common::{DUMMY_SP, SyntaxContext},
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)]
......@@ -552,10 +553,21 @@ impl EsmExports {
pub async fn code_generation(
self: Vc<Self>,
chunking_context: Vc<Box<dyn ChunkingContext>>,
scope_hoisting_context: ScopeHoistingContext<'_>,
parsed: Option<Vc<ParseResult>>,
export_usage_info: Option<ResolvedVc<ModuleExportUsageInfo>>,
) -> Result<CodeGeneration> {
let expanded = self.expand_exports(export_usage_info.map(|v| *v)).await?;
if scope_hoisting_context.skip_module_exports() && expanded.dynamic_exports.is_empty() {
// If the current module is not exposed, no need to generate exports.
//
// If there are dynamic_exports, we still need to export everything because it wasn't
// possible to determine statically where a reexport is coming from which will instead
// be handled at runtime via property access, e.g. `export * from "./some-dynamic-cjs"`
return Ok(CodeGeneration::empty());
}
let parsed = if let Some(parsed) = parsed {
Some(parsed.await?)
} else {
......@@ -563,19 +575,40 @@ impl EsmExports {
};
let mut dynamic_exports = Vec::<Box<Expr>>::new();
{
let id = if let Some(module) = scope_hoisting_context.module()
&& !expanded.dynamic_exports.is_empty()
{
Some(module.chunk_item_id(Vc::upcast(chunking_context)).await?)
} else {
None
};
for dynamic_export_asset in &expanded.dynamic_exports {
let ident =
ReferencedAsset::get_ident_from_placeable(dynamic_export_asset, chunking_context)
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!(
......@@ -631,30 +664,17 @@ 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,
}))),
}),
};
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::Member(expr.clone()),
lhs: AssignTarget = AssignTarget::Simple(SimpleAssignTarget::Member(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,
......@@ -664,7 +684,7 @@ impl EsmExports {
} else {
quote!(
"(() => $expr)" as Expr,
expr: Expr = Expr::Member(expr),
expr: Expr = expr.map_either(Expr::from, Expr::from).into_inner()
)
}
})
......@@ -673,18 +693,18 @@ impl EsmExports {
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(),
......@@ -696,7 +716,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 {
......@@ -707,6 +727,23 @@ impl EsmExports {
None
};
let early_hoisted_stmts = vec![CodeGenerationHoistedStmt::new(
rcstr!("__turbopack_esm__"),
if let Some(module) = scope_hoisting_context.module() {
let id = 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
......@@ -714,13 +751,7 @@ impl EsmExports {
.into_iter()
.flatten()
.collect(),
vec![CodeGenerationHoistedStmt::new(
rcstr!("__turbopack_esm__"),
quote!("$turbopack_esm($getters);" as Stmt,
turbopack_esm: Expr = TURBOPACK_ESM.into(),
getters: Expr = getters
),
)],
early_hoisted_stmts,
))
}
}
......@@ -125,6 +125,7 @@ impl CachedExternalModule {
inner_code: code.build(),
source_map: None,
is_esm: self.external_type != CachedExternalType::CommonJs,
additional_ids: Default::default(),
}
.cell())
}
......
......@@ -761,7 +761,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())
......@@ -777,10 +777,6 @@ pub(crate) async fn analyse_ecmascript_module_internal(
}
ImportedSymbol::Exports => None,
},
None => {
should_add_evaluation = true;
None
}
},
import_externals,
)
......
use anyhow::{Context, Result, bail};
use serde::{Deserialize, Serialize};
use swc_core::{common::DUMMY_SP, ecma::ast::Ident, quote};
use swc_core::{common::DUMMY_SP, quote};
use turbo_rcstr::RcStr;
use turbo_tasks::{NonLocalValue, ResolvedVc, ValueToString, Vc, trace::TraceRawVcs};
use turbopack_core::{
......@@ -17,7 +17,7 @@ use super::{
facade::module::EcmascriptModuleFacadeModule, locals::module::EcmascriptModuleLocalsModule,
};
use crate::{
chunk::EcmascriptChunkPlaceable, code_gen::CodeGeneration,
ScopeHoistingContext, chunk::EcmascriptChunkPlaceable, code_gen::CodeGeneration,
references::esm::base::ReferencedAsset, runtime_functions::TURBOPACK_IMPORT,
utils::module_id_to_lit,
};
......@@ -156,9 +156,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, ScopeHoistingContext::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");
......@@ -166,10 +168,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),
),
......
......@@ -183,6 +183,7 @@ impl EcmascriptChunkItem for SideEffectsModuleChunkItem {
},
..Default::default()
},
additional_ids: Default::default(),
placeholder_for_future_extensions: (),
}
.cell())
......
use std::ops::Deref;
use serde::{Deserialize, Serialize};
use swc_core::{
common::DUMMY_SP,
common::{DUMMY_SP, SyntaxContext},
ecma::{
ast::{Expr, Lit, Str},
visit::AstParentKind,
},
};
use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{NonLocalValue, trace::TraceRawVcs};
use turbo_tasks::{NonLocalValue, TaskInput, trace::TraceRawVcs};
use turbopack_core::{chunk::ModuleId, resolve::pattern::Pattern};
use crate::analyzer::{
......@@ -216,6 +218,30 @@ pub fn module_value_to_well_known_object(module_value: &ModuleValue) -> Option<J
})
}
#[derive(Hash, Debug, Clone, Copy, Eq, Serialize, Deserialize, PartialEq, TraceRawVcs)]
pub struct AstSyntaxContext(#[turbo_tasks(trace_ignore)] SyntaxContext);
impl TaskInput for AstSyntaxContext {
fn is_transient(&self) -> bool {
false
}
}
unsafe impl NonLocalValue for AstSyntaxContext {}
impl Deref for AstSyntaxContext {
type Target = SyntaxContext;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<SyntaxContext> for AstSyntaxContext {
fn from(v: SyntaxContext) -> Self {
Self(v)
}
}
#[cfg(test)]
mod tests {
use turbo_rcstr::rcstr;
......
......@@ -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: None,
enable_file_tracing: false,
enable_module_merging: false,
environment,
runtime_type,
minify_type: MinifyType::NoMinify,
......@@ -249,6 +257,11 @@ impl ChunkingContext for NodeJsChunkingContext {
Vc::cell(self.enable_file_tracing)
}
#[turbo_tasks::function]
fn is_module_merging_enabled(&self) -> Vc<bool> {
Vc::cell(self.enable_module_merging)
}
#[turbo_tasks::function]
pub fn minify_type(&self) -> Vc<MinifyType> {
self.minify_type.cell()
......
......@@ -242,6 +242,7 @@ async fn run_inner_operation(
struct TestOptions {
tree_shaking_mode: Option<TreeShakingMode>,
remove_unused_exports: Option<bool>,
scope_hoisting: Option<bool>,
}
#[turbo_tasks::value]
......@@ -435,6 +436,7 @@ async fn run_test_operation(prepared_test: ResolvedVc<PreparedTest>) -> Result<V
..Default::default()
},
)
.module_merging(options.scope_hoisting.unwrap_or(true))
.build();
let jest_entry_source = FileSource::new(jest_entry_path);
......
error - [bindings] [project]/turbopack/crates/turbopack-tests/tests/execution/turbopack/cycle/reexport-cycle/input/a.js Export a is a circular re-export
The export
a of module [project]/turbopack/crates/turbopack-tests/tests/execution/turbopack/cycle/reexport-cycle/input/a.js [test] (ecmascript)
is a re-export of the export
a of module [project]/turbopack/crates/turbopack-tests/tests/execution/turbopack/cycle/reexport-cycle/input/b.js [test] (ecmascript).
Example import trace:
./turbopack/crates/turbopack-tests/tests/execution/turbopack/cycle/reexport-cycle/input/a.js
./turbopack/crates/turbopack-tests/tests/execution/turbopack/cycle/reexport-cycle/input/index.js
\ No newline at end of file
error - [bindings] [project]/turbopack/crates/turbopack-tests/tests/execution/turbopack/cycle/reexport-cycle/input/b.js Export a is a circular re-export
The export
a of module [project]/turbopack/crates/turbopack-tests/tests/execution/turbopack/cycle/reexport-cycle/input/b.js [test] (ecmascript)
is a re-export of the export
a of module [project]/turbopack/crates/turbopack-tests/tests/execution/turbopack/cycle/reexport-cycle/input/a.js [test] (ecmascript).
Example import trace:
./turbopack/crates/turbopack-tests/tests/execution/turbopack/cycle/reexport-cycle/input/b.js
./turbopack/crates/turbopack-tests/tests/execution/turbopack/cycle/reexport-cycle/input/a.js
./turbopack/crates/turbopack-tests/tests/execution/turbopack/cycle/reexport-cycle/input/index.js
\ No newline at end of file
import { a } from './reexport.js'
it('should work', () => {
expect(a).toBe(123)
})
import { A } from './reexport.js'
it('should work', () => {
expect(A).toBe(1)
})
warning - [analysis] [project]/turbopack/crates/turbopack-tests/tests/execution/turbopack/scope-hoisting/reexport-dynamic-cjs/input/a.js unexpected export *
export * used with module [project]/turbopack/crates/turbopack-tests/tests/execution/turbopack/scope-hoisting/reexport-dynamic-cjs/input/a.js [test] (ecmascript) which is a CommonJS module with exports only available at runtime
List all export names manually (`export { a, b, c } from "...") or rewrite the module to ESM, to avoid the additional runtime code.`
Example import trace:
./turbopack/crates/turbopack-tests/tests/execution/turbopack/scope-hoisting/reexport-dynamic-cjs/input/a.js
./turbopack/crates/turbopack-tests/tests/execution/turbopack/scope-hoisting/reexport-dynamic-cjs/input/reexport.js
./turbopack/crates/turbopack-tests/tests/execution/turbopack/scope-hoisting/reexport-dynamic-cjs/input/index.js
\ No newline at end of file
warning - [analysis] [project]/turbopack/crates/turbopack-tests/tests/execution/turbopack/scope-hoisting/reexport-dynamic-cjs/input/b.js unexpected export *
export * used with module [project]/turbopack/crates/turbopack-tests/tests/execution/turbopack/scope-hoisting/reexport-dynamic-cjs/input/b.js [test] (ecmascript) which is a CommonJS module with exports only available at runtime
List all export names manually (`export { a, b, c } from "...") or rewrite the module to ESM, to avoid the additional runtime code.`
Example import trace:
./turbopack/crates/turbopack-tests/tests/execution/turbopack/scope-hoisting/reexport-dynamic-cjs/input/b.js
./turbopack/crates/turbopack-tests/tests/execution/turbopack/scope-hoisting/reexport-dynamic-cjs/input/reexport.js
./turbopack/crates/turbopack-tests/tests/execution/turbopack/scope-hoisting/reexport-dynamic-cjs/input/index.js
\ No newline at end of file
import { useComputed } from './use-computed.js'
const increment = (i) => i + 1
it('should correctly handle variable collisions', () => {
let i = 123
expect(i).toBe(123)
expect(useComputed).toBe('abc')
expect(increment(1)).toBe(2)
})
import { env } from './env.js'
const i = env
export { i as useComputed }
{
"treeShakingMode": "reexports-only"
"treeShakingMode": "reexports-only",
"scopeHoisting": false
}
{
"treeShakingMode": "reexports-only"
"treeShakingMode": "reexports-only",
"scopeHoisting": false
}
......@@ -22,7 +22,7 @@ use turbo_tasks_fs::{
};
use turbopack::{
ModuleAssetContext,
ecmascript::{EcmascriptInputTransform, TreeShakingMode},
ecmascript::{EcmascriptInputTransform, TreeShakingMode, chunk::EcmascriptChunkType},
module_options::{
CssOptionsContext, EcmascriptOptionsContext, JsxTransformOptions, ModuleOptionsContext,
ModuleRule, ModuleRuleEffect, RuleCondition,
......@@ -32,7 +32,7 @@ use turbopack_browser::BrowserChunkingContext;
use turbopack_core::{
asset::Asset,
chunk::{
ChunkingContext, ChunkingContextExt, EvaluatableAsset, EvaluatableAssetExt,
ChunkingConfig, ChunkingContext, ChunkingContextExt, EvaluatableAsset, EvaluatableAssetExt,
EvaluatableAssets, MinifyType, availability_info::AvailabilityInfo,
},
compile_time_defines,
......@@ -97,6 +97,10 @@ struct SnapshotOptions {
tree_shaking_mode: Option<TreeShakingMode>,
#[serde(default)]
remove_unused_exports: bool,
#[serde(default)]
scope_hoisting: bool,
#[serde(default)]
production_chunking: bool,
}
#[derive(Debug, Deserialize, Default)]
......@@ -124,6 +128,8 @@ impl Default for SnapshotOptions {
environment: Default::default(),
tree_shaking_mode: Default::default(),
remove_unused_exports: false,
scope_hoisting: false,
production_chunking: false,
}
}
}
......@@ -351,8 +357,8 @@ async fn run_test_operation(resource: RcStr) -> Result<Vc<FileSystemPath>> {
let static_root_path = project_path.join(rcstr!("static")).to_resolved().await?;
let chunking_context: Vc<Box<dyn ChunkingContext>> = match options.runtime {
Runtime::Browser => Vc::upcast(
BrowserChunkingContext::builder(
Runtime::Browser => {
let mut builder = BrowserChunkingContext::builder(
project_root,
project_path,
project_path_to_project_root,
......@@ -362,10 +368,23 @@ async fn run_test_operation(resource: RcStr) -> Result<Vc<FileSystemPath>> {
env,
options.runtime_type,
)
.build(),
),
Runtime::NodeJs => Vc::upcast(
NodeJsChunkingContext::builder(
.module_merging(options.scope_hoisting);
if options.production_chunking {
builder = builder.chunking_config(
Vc::<EcmascriptChunkType>::default().to_resolved().await?,
ChunkingConfig {
min_chunk_size: 2_000,
max_chunk_count_per_group: 40,
max_merge_chunk_size: 200_000,
..Default::default()
},
)
}
Vc::upcast(builder.build())
}
Runtime::NodeJs => {
let mut builder = NodeJsChunkingContext::builder(
project_root,
project_path,
project_path_to_project_root,
......@@ -376,8 +395,21 @@ async fn run_test_operation(resource: RcStr) -> Result<Vc<FileSystemPath>> {
options.runtime_type,
)
.minify_type(options.minify_type)
.build(),
),
.module_merging(options.scope_hoisting);
if options.production_chunking {
builder = builder.chunking_config(
Vc::<EcmascriptChunkType>::default().to_resolved().await?,
ChunkingConfig {
min_chunk_size: 2_000,
max_chunk_count_per_group: 40,
max_merge_chunk_size: 200_000,
..Default::default()
},
)
}
Vc::upcast(builder.build())
}
};
let expected_paths = expected(*chunk_root_path)
......
......@@ -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$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) <internal part 0>");
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) <internal part 4>");
......@@ -88,10 +88,10 @@ const dogRef = {
"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) <internal part 5>");
;
......@@ -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) <internal part 0>");
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) <internal part 5>");
......@@ -138,7 +138,7 @@ function getChimera() {
"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) <internal part 5>");
;
......@@ -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) <internal part 3>");
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) <internal part 6>");
......@@ -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) <internal part 2>");
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) <exports>");
......
......@@ -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) <internal part 5>");
;
......@@ -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) <internal part 2>");
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) <internal part 8>");
......
......@@ -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) <internal part 0>");
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) <internal part 4>");
......@@ -88,10 +88,10 @@ const dogRef = {
"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) <internal part 5>");
;
......@@ -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) <internal part 0>");
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) <internal part 5>");
......@@ -138,7 +138,7 @@ function getChimera() {
"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) <internal part 5>");
;
......@@ -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) <internal part 3>");
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) <internal part 6>");
......@@ -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) <internal part 2>");
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) <exports>");
......
......@@ -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) <internal part 5>");
;
......
......@@ -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) <internal part 5>");
;
......
......@@ -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) <internal part 0>");
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) <internal part 4>");
......@@ -88,10 +88,10 @@ const dogRef = {
"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) <internal part 5>");
;
......@@ -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) <internal part 0>");
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) <internal part 5>");
......@@ -138,7 +138,7 @@ function getChimera() {
"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) <internal part 5>");
;
......@@ -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) <internal part 3>");
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) <internal part 6>");
......
......@@ -4,10 +4,10 @@
"use strict";
__turbopack_context__.s({
"a": ([
"a": [
()=>dog,
(new_dog)=>dog = new_dog
])
]
});
let dog = 'dog';
;
......
......@@ -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) <internal part 0>");
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) <internal part 4>");
......@@ -88,10 +88,10 @@ const dogRef = {
"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) <internal part 5>");
;
......@@ -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) <internal part 0>");
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) <internal part 5>");
......@@ -138,7 +138,7 @@ function getChimera() {
"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) <internal part 5>");
;
......@@ -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) <internal part 3>");
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) <internal part 6>");
......@@ -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) <internal part 2>");
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) <exports>");
......
......@@ -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) <internal part 0>");
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) <internal part 4>");
......@@ -88,10 +88,10 @@ const dogRef = {
"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) <internal part 5>");
;
......@@ -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) <internal part 0>");
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) <internal part 5>");
......@@ -138,7 +138,7 @@ function getChimera() {
"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) <internal part 5>");
;
......@@ -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) <internal part 3>");
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) <internal part 6>");
......@@ -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) <internal part 2>");
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) <exports>");
......
......@@ -23,7 +23,7 @@ __turbopack_context__.r("[project]/turbopack/crates/turbopack-tests/tests/snapsh
"use strict";
__turbopack_context__.s({
"bar": (()=>bar)
"bar": ()=>bar
});
function bar(value) {
console.assert(value);
......
......@@ -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);
......
......@@ -23,7 +23,7 @@ __turbopack_context__.r("[project]/turbopack/crates/turbopack-tests/tests/snapsh
"use strict";
__turbopack_context__.s({
"bar": (()=>bar)
"bar": ()=>bar
});
function bar(value) {
console.assert(value);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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)=>{
......
......@@ -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}`;
......
......@@ -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) {
......
......@@ -27,20 +27,26 @@ function ClassNameButton({ children }) {
}
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__;
......
......@@ -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 <button\n className={css`\n background: blue;\n `}\n >\n {children}\n </button>\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;IACnC,qBACE,uOAAC;QACC,WAAW,GAAG,CAAC;;MAEf,CAAC;kBAEA;;;;;;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;IACd,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;IACd,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
......@@ -4,7 +4,7 @@
"use strict";
__turbopack_context__.s({
"Table": (()=>Table)
"Table": ()=>Table
});
const Table = ()=>{
return 'table';
......@@ -14,7 +14,7 @@ const 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)");
;
......
......@@ -4,7 +4,7 @@
"use strict";
__turbopack_context__.s({
"default": (()=>__TURBOPACK__default__export__)
"default": ()=>__TURBOPACK__default__export__
});
const __TURBOPACK__default__export__ = 'turbopack';
}),
......
......@@ -4,7 +4,7 @@
"use strict";
__turbopack_context__.s({
"default": (()=>__TURBOPACK__default__export__)
"default": ()=>__TURBOPACK__default__export__
});
const __TURBOPACK__default__export__ = 'turbopack';
}),
......
......@@ -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 () {
......
......@@ -4,7 +4,7 @@
"use strict";
__turbopack_context__.s({
"default": (()=>__TURBOPACK__default__export__)
"default": ()=>__TURBOPACK__default__export__
});
const __TURBOPACK__default__export__ = {
js: true
......
......@@ -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
......@@ -4,7 +4,7 @@
"use strict";
__turbopack_context__.s({
"default": (()=>__TURBOPACK__default__export__)
"default": ()=>__TURBOPACK__default__export__
});
const __TURBOPACK__default__export__ = 'turbopack';
}),
......
......@@ -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)");
;
......
......@@ -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';
}),
......
......@@ -12,7 +12,7 @@ console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$
"use strict";
__turbopack_context__.s({
"a": (()=>a)
"a": ()=>a
});
const a = 'a';
const a_unused = 'a_unused';
......@@ -21,7 +21,7 @@ const a_unused = 'a_unused';
"use strict";
__turbopack_context__.s({
"a0": (()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$intermediate$2d$tree$2d$shake$2f$rename$2d$side$2d$effect$2d$free$2d$facade$2f$input$2f$node_modules$2f$lib$2f$a$2e$js__$5b$test$5d$__$28$ecmascript$29$__["a"])
"a0": ()=>__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$intermediate$2d$tree$2d$shake$2f$rename$2d$side$2d$effect$2d$free$2d$facade$2f$input$2f$node_modules$2f$lib$2f$a$2e$js__$5b$test$5d$__$28$ecmascript$29$__["a"]
});
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$intermediate$2d$tree$2d$shake$2f$rename$2d$side$2d$effect$2d$free$2d$facade$2f$input$2f$node_modules$2f$lib$2f$a$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/intermediate-tree-shake/rename-side-effect-free-facade/input/node_modules/lib/a.js [test] (ecmascript)");
}),
......
......@@ -12,7 +12,7 @@ console.log(`I like ${(0, __TURBOPACK__imported__module__$5b$project$5d2f$turbop
"use strict";
__turbopack_context__.s({
"getCat": (()=>getCat)
"getCat": ()=>getCat
});
let cat = "cat";
let dog = "dog";
......
......@@ -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) {
//
......
......@@ -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) {
//
......
"purposefully empty stub";
"@emtion/react/index.js";
export function jsx() {
return 'purposefully empty stub for @emotion/react/index.js'
}
"purposefully empty stub";
"@emtion/react/jsx-dev-runtime.js";
export function jsxDEV() {
return 'purposefully empty stub for @emotion/react/jsx-dev-runtime.js'
}
"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'
}
"purposefully empty stub";
"@swc/helpers/_/_class_call_check.js";
export function _() {
return 'purposefully empty stub for @swc/helpers/_/_class_call_check.js'
}
"purposefully empty stub";
"react/index.js";
export function jsx() {
return 'purposefully empty stub for react/index.js'
}
"purposefully empty stub";
"react/jsx-dev-runtime.js";
export function jsxDEV() {
return 'purposefully empty stub for react/jsx-dev-runtime.js'
}
"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'
}
......@@ -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 invoked 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 @@ function defineProp(obj, name, options) {
}
/**
* 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 @@ function ensureDynamicExports(module, exports) {
}
/**
* 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 @@ function loadChunkPath(chunkPath, source) {
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 @@ async function loadChunkAsync(source, chunkData) {
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 @@ function instantiateModule(id, source) {
}
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 @@ function instantiateModule(id, source) {
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,
......
......@@ -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/// <reference path=\"./runtime-types.d.ts\" />\n\ntype EsmNamespaceObject = Record<string, any>\n\n// @ts-ignore Defined in `dev-base.ts`\ndeclare function getOrInstantiateModuleFromParent<M>(\n id: ModuleId,\n sourceModule: M\n): M\n\nconst REEXPORTED_OBJECTS = Symbol('reexported objects')\n\ntype ModuleContextMap = Record<ModuleId, ModuleContextEntry>\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<Exports | EsmNamespaceObject>\n\n keys(): ModuleId[]\n\n resolve(moduleId: ModuleId): ModuleId\n}\n\ntype GetOrInstantiateModuleFromParent<M> = (\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<any>\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<string, (() => 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<string, () => 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<string, any>\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<string | symbol, any>, 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<Module['namespaceObject'], undefined> {\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<Exports>)\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<T = any>(maybePromise: any): maybePromise is Promise<T> {\n return (\n maybePromise != null &&\n typeof maybePromise === 'object' &&\n 'then' in maybePromise &&\n typeof maybePromise.then === 'function'\n )\n}\n\nfunction isAsyncModuleExt<T extends {}>(obj: T): obj is AsyncModuleExt & T {\n return turbopackQueues in obj\n}\n\nfunction createPromise<T>() {\n let resolve: (value: T | PromiseLike<T>) => void\n let reject: (reason?: any) => void\n\n const promise = new Promise<T>((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<Exports>\n\ntype AsyncModuleExt = {\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => void\n [turbopackExports]: Exports\n [turbopackError]?: any\n}\n\ntype AsyncModulePromise<T = Exports> = Promise<T> & 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<AsyncQueue> = new Set()\n\n const { resolve, reject, promise: rawPromise } = createPromise<Exports>()\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<string, any> = {}\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<any>) => 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;IAE3C,IAAI,CAAC,eAAe,IAAI,CAAC,KAAK,OAAO,OAAO,cAAc,CAAC,KAAK,MAAM;AACxE;AAEA;;CAEC,GACD,SAAS,IACP,OAAgB,EAChB,OAAoE;IAEpE,WAAW,SAAS,cAAc;QAAE,OAAO;IAAK;IAChD,IAAI,aAAa,WAAW,SAAS,aAAa;QAAE,OAAO;IAAS;IACpE,IAAK,MAAM,OAAO,QAAS;QACzB,MAAM,OAAO,OAAO,CAAC,IAAI;QACzB,IAAI,MAAM,OAAO,CAAC,OAAO;YACvB,WAAW,SAAS,KAAK;gBACvB,KAAK,IAAI,CAAC,EAAE;gBACZ,KAAK,IAAI,CAAC,EAAE;gBACZ,YAAY;YACd;QACF,OAAO;YACL,WAAW,SAAS,KAAK;gBAAE,KAAK;gBAAM,YAAY;YAAK;QACzD;IACF;IACA,OAAO,IAAI,CAAC;AACd;AAEA;;CAEC,GACD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A,aAAa;IACf;IAEA,KAAK,yBAAyB;IAE9B,IAAI,SAAS,MAAM,MAAM,SAA0B;QACjD,MAAM,MAAM;IACd;AACF;AAEA;;;;;;;;;CASC,GACD,MAAM,cAAc,SAAS,YAAuB,QAAgB;IAClE,MAAM,UAAU,IAAI,IAAI,UAAU;IAClC,MAAM,SAA8B,CAAC;IACrC,IAAK,MAAM,OAAO,QAAS,MAAM,CAAC,IAAI,GAAG,AAAC,OAAe,CAAC,IAAI;IAC9D,OAAO,IAAI,GAAG;IACd,OAAO,QAAQ,GAAG,SAAS,OAAO,CAAC,UAAU;IAC7C,OAAO,MAAM,GAAG,OAAO,QAAQ,GAAG;IAClC,OAAO,QAAQ,GAAG,OAAO,MAAM,GAAG,CAAC,GAAG,QAAsB;IAC5D,IAAK,MAAM,OAAO,OAChB,OAAO,cAAc,CAAC,IAAI,EAAE,KAAK;QAC/B,YAAY;QACZ,cAAc;QACd,OAAO,MAAM,CAAC,IAAI;IACpB;AACJ;AAEA,YAAY,SAAS,GAAG,IAAI,SAAS;AAErC;;CAEC,GACD,SAAS,UAAU,KAAY,EAAE,cAAoC;IACnE,MAAM,IAAI,MAAM,CAAC,WAAW,EAAE,eAAe,QAAQ;AACvD;AAEA;;CAEC,GACD,SAAS,YAAY,SAAmB;IACtC,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/// <reference path=\"../shared/runtime-utils.ts\" />\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;IACxC,IAAI;IACJ,IAAI;QACF,MAAM,MAAM,MAAM,CAAC;IACrB,EAAE,OAAO,KAAK;QACZ,0EAA0E;QAC1E,0EAA0E;QAC1E,qEAAqE;QACrE,qBAAqB;QACrB,MAAM,IAAI,MAAM,CAAC,+BAA+B,EAAE,GAAG,EAAE,EAAE,KAAK;IAChE;IAEA,IAAI,OAAO,IAAI,UAAU,IAAI,IAAI,OAAO,IAAI,aAAa,IAAI,OAAO,EAAE;QACpE,OAAO,WAAW,IAAI,OAAO,EAAE,SAAS,MAAM;IAChD;IAEA,OAAO;AACT;AAEA,SAAS,gBACP,EAAY,EACZ,KAAgB,EAChB,MAAe,KAAK;IAEpB,IAAI;IACJ,IAAI;QACF,MAAM;IACR,EAAE,OAAO,KAAK;QACZ,0EAA0E;QAC1E,0EAA0E;QAC1E,qEAAqE;QACrE,qBAAqB;QACrB,MAAM,IAAI,MAAM,CAAC,+BAA+B,EAAE,GAAG,EAAE,EAAE,KAAK;IAChE;IAEA,IAAI,CAAC,OAAO,IAAI,UAAU,EAAE;QAC1B,OAAO;IACT;IAEA,OAAO,WAAW,KAAK,SAAS,MAAM;AACxC;AAEA,gBAAgB,OAAO,GAAG,CACxB,IACA;IAIA,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;IAC9C,IAAI,YAAY;QACd,OAAO,KAAK,IAAI,CAAC,eAAe;IAClC;IACA,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/// <reference path=\"../shared/runtime-utils.ts\" />\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<WebAssembly.Module> {\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<Exports> {\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;IAC7C,MAAM,EAAE,gBAAgB,EAAE,GAAG,QAAQ;IACrC,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ;IAE7B,MAAM,SAAS,iBAAiB;IAEhC,2EAA2E;IAC3E,OAAO,IAAI,SAAS,SAAS,KAAK,CAAC,SAAS;QAC1C,SAAS;YACP,gBAAgB;QAClB;IACF;AACF;AAEA,eAAe,2BACb,IAAY;IAEZ,MAAM,WAAW,0BAA0B;IAE3C,OAAO,MAAM,YAAY,gBAAgB,CAAC;AAC5C;AAEA,eAAe,+BACb,IAAY,EACZ,UAA+B;IAE/B,MAAM,WAAW,0BAA0B;IAE3C,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,YAAY,oBAAoB,CACzD,UACA;IAGF,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/// <reference path=\"../shared/runtime-utils.ts\" />\n/// <reference path=\"../shared-node/base-externals-utils.ts\" />\n/// <reference path=\"../shared-node/node-externals-utils.ts\" />\n/// <reference path=\"../shared-node/node-wasm-utils.ts\" />\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<Exports | EsmNamespaceObject>\n\ninterface TurbopackNodeBuildContext extends TurbopackBaseContext<Module> {\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<Module> = 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<ChunkPath>()\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<any> {\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;IACH;;;GAGC;IAED;;GAEC;WARE;EAAA;AAsBL,QAAQ,GAAG,CAAC,SAAS,GAAG;AAExB,SAAS,oBAAoB,MAAkB;IAC7C,OAAQ,OAAO,IAAI;QACjB;YACE,OAAO,CAAC,kBAAkB,EAAE,OAAO,SAAS,EAAE;QAChD;YACE,OAAO,CAAC,cAAc,EAAE,OAAO,QAAQ,EAAE;QAC3C;YACE,UAAU,QAAQ,CAAC,SAAW,CAAC,qBAAqB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ACpC,IAAI,SAAQ;QACV,IAAI,QAAO,KAAK,EAAE;YAChB,MAAM,QAAO,KAAK;QACpB;QACA,OAAO;IACT;IAEA,OAAO,yBAAyB,UAAU;AAC5C;AAEA,MAAM,aAAa;AACnB;;CAEC,GACD,SAAS,KAAK,cAAoC;IAChD,OAAO,WAAW,IAAI,CAAC;AACzB;AAEA,OAAO,OAAO,GAAG;IACf;IACA;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/// <reference path=\"./runtime-types.d.ts\" />\n\ntype EsmNamespaceObject = Record<string, any>\n\n// @ts-ignore Defined in `dev-base.ts`\ndeclare function getOrInstantiateModuleFromParent<M>(\n id: ModuleId,\n sourceModule: M\n): M\n\nconst REEXPORTED_OBJECTS = Symbol('reexported objects')\n\ntype ModuleContextMap = Record<ModuleId, ModuleContextEntry>\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<Exports | EsmNamespaceObject>\n\n keys(): ModuleId[]\n\n resolve(moduleId: ModuleId): ModuleId\n}\n\ntype GetOrInstantiateModuleFromParent<M> = (\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<any>\n) {\n if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options)\n}\n\nfunction getOverwrittenModule(\n moduleCache: ModuleCache<Module>,\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 invoked 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<string, (() => 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<Module>,\n getters: Record<string, () => 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<Module>,\n object: Record<string, any>,\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<Module>,\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<Module>,\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<string | symbol, any>, 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<Module['namespaceObject'], undefined> {\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<Exports>)\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<T = any>(maybePromise: any): maybePromise is Promise<T> {\n return (\n maybePromise != null &&\n typeof maybePromise === 'object' &&\n 'then' in maybePromise &&\n typeof maybePromise.then === 'function'\n )\n}\n\nfunction isAsyncModuleExt<T extends {}>(obj: T): obj is AsyncModuleExt & T {\n return turbopackQueues in obj\n}\n\nfunction createPromise<T>() {\n let resolve: (value: T | PromiseLike<T>) => void\n let reject: (reason?: any) => void\n\n const promise = new Promise<T>((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<Exports>\n\ntype AsyncModuleExt = {\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => void\n [turbopackExports]: Exports\n [turbopackError]?: any\n}\n\ntype AsyncModulePromise<T = Exports> = Promise<T> & 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<AsyncQueue> = new Set()\n\n const { resolve, reject, promise: rawPromise } = createPromise<Exports>()\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<string, any> = {}\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<any>) => 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;IAE3C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,MAAM,MAAM,SAA0B;QACjD,MAAM,MAAM;IACd;AACF;AAEA;;;;;;;;;CASC,GACD,MAAM,cAAc,SAAS,YAAuB,QAAgB;IAClE,MAAM,UAAU,IAAI,IAAI,UAAU;IAClC,MAAM,SAA8B,CAAC;IACrC,IAAK,MAAM,OAAO,QAAS,MAAM,CAAC,IAAI,GAAG,AAAC,OAAe,CAAC,IAAI;IAC9D,OAAO,IAAI,GAAG;IACd,OAAO,QAAQ,GAAG,SAAS,OAAO,CAAC,UAAU;IAC7C,OAAO,MAAM,GAAG,OAAO,QAAQ,GAAG;IAClC,OAAO,QAAQ,GAAG,OAAO,MAAM,GAAG,CAAC,GAAG,QAAsB;IAC5D,IAAK,MAAM,OAAO,OAChB,OAAO,cAAc,CAAC,IAAI,EAAE,KAAK;QAC/B,YAAY;QACZ,cAAc;QACd,OAAO,MAAM,CAAC,IAAI;IACpB;AACJ;AAEA,YAAY,SAAS,GAAG,IAAI,SAAS;AAErC;;CAEC,GACD,SAAS,UAAU,KAAY,EAAE,cAAoC;IACnE,MAAM,IAAI,MAAM,CAAC,WAAW,EAAE,eAAe,QAAQ;AACvD;AAEA;;CAEC,GACD,SAAS,YAAY,SAAmB;IACtC,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/// <reference path=\"../shared/runtime-utils.ts\" />\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;IACxC,IAAI;IACJ,IAAI;QACF,MAAM,MAAM,MAAM,CAAC;IACrB,EAAE,OAAO,KAAK;QACZ,0EAA0E;QAC1E,0EAA0E;QAC1E,qEAAqE;QACrE,qBAAqB;QACrB,MAAM,IAAI,MAAM,CAAC,+BAA+B,EAAE,GAAG,EAAE,EAAE,KAAK;IAChE;IAEA,IAAI,OAAO,IAAI,UAAU,IAAI,IAAI,OAAO,IAAI,aAAa,IAAI,OAAO,EAAE;QACpE,OAAO,WAAW,IAAI,OAAO,EAAE,SAAS,MAAM;IAChD;IAEA,OAAO;AACT;AAEA,SAAS,gBACP,EAAY,EACZ,KAAgB,EAChB,MAAe,KAAK;IAEpB,IAAI;IACJ,IAAI;QACF,MAAM;IACR,EAAE,OAAO,KAAK;QACZ,0EAA0E;QAC1E,0EAA0E;QAC1E,qEAAqE;QACrE,qBAAqB;QACrB,MAAM,IAAI,MAAM,CAAC,+BAA+B,EAAE,GAAG,EAAE,EAAE,KAAK;IAChE;IAEA,IAAI,CAAC,OAAO,IAAI,UAAU,EAAE;QAC1B,OAAO;IACT;IAEA,OAAO,WAAW,KAAK,SAAS,MAAM;AACxC;AAEA,gBAAgB,OAAO,GAAG,CACxB,IACA;IAIA,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;IAC9C,IAAI,YAAY;QACd,OAAO,KAAK,IAAI,CAAC,eAAe;IAClC;IACA,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/// <reference path=\"../shared/runtime-utils.ts\" />\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<WebAssembly.Module> {\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<Exports> {\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;IAC7C,MAAM,EAAE,gBAAgB,EAAE,GAAG,QAAQ;IACrC,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ;IAE7B,MAAM,SAAS,iBAAiB;IAEhC,2EAA2E;IAC3E,OAAO,IAAI,SAAS,SAAS,KAAK,CAAC,SAAS;QAC1C,SAAS;YACP,gBAAgB;QAClB;IACF;AACF;AAEA,eAAe,2BACb,IAAY;IAEZ,MAAM,WAAW,0BAA0B;IAE3C,OAAO,MAAM,YAAY,gBAAgB,CAAC;AAC5C;AAEA,eAAe,+BACb,IAAY,EACZ,UAA+B;IAE/B,MAAM,WAAW,0BAA0B;IAE3C,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,YAAY,oBAAoB,CACzD,UACA;IAGF,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/// <reference path=\"../shared/runtime-utils.ts\" />\n/// <reference path=\"../shared-node/base-externals-utils.ts\" />\n/// <reference path=\"../shared-node/node-externals-utils.ts\" />\n/// <reference path=\"../shared-node/node-wasm-utils.ts\" />\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<Exports | EsmNamespaceObject>\n\ninterface TurbopackNodeBuildContext extends TurbopackBaseContext<Module> {\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<Module> = 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<ChunkPath>()\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<any> {\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;IACH;;;GAGC;IAED;;GAEC;WARE;EAAA;AAsBL,QAAQ,GAAG,CAAC,SAAS,GAAG;AAExB,SAAS,oBAAoB,MAAkB;IAC7C,OAAQ,OAAO,IAAI;QACjB;YACE,OAAO,CAAC,kBAAkB,EAAE,OAAO,SAAS,EAAE;QAChD;YACE,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AAO;IACT;IAEA,OAAO,kBAAkB,IAAI;QAC3B,IAAI;QACJ,UAAU,aAAa,EAAE;IAC3B;AACF;AAEA;;CAEC,GACD,SAAS,yBACP,QAAkB,EAClB,SAAoB;IAEpB,OAAO,kBAAkB,UAAU;QAAE,IAAI;QAAsB;IAAU;AAC3E;AAEA;;CAEC,GACD,oFAAoF;AACpF,SAAS,8BACP,QAAkB,EAClB,SAAoB;IAEpB,MAAM,UAAS,WAAW,CAAC,SAAS;IACpC,IAAI,SAAQ;QACV,IAAI,QAAO,KAAK,EAAE;YAChB,MAAM,QAAO,KAAK;QACpB;QACA,OAAO;IACT;IAEA,OAAO,yBAAyB,UAAU;AAC5C;AAEA,MAAM,aAAa;AACnB;;CAEC,GACD,SAAS,KAAK,cAAoC;IAChD,OAAO,WAAW,IAAI,CAAC;AACzB;AAEA,OAAO,OAAO,GAAG;IACf;IACA;AACF","ignoreList":[0]}}]
}
\ No newline at end of file
......@@ -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 invoked 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 @@ function defineProp(obj, name, options) {
}
/**
* 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 @@ function ensureDynamicExports(module, exports) {
}
/**
* 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 @@ function instantiateModule(id, source) {
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,
......
import './a.js'
import shared from './shared.js'
console.log('a', shared)
import './b.js'
import shared from './shared.js'
console.log('c', shared)
(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push([
"output/4c35f_tests_snapshot_scope-hoisting_duplicate-imports_input_index_4c947fd6.js",
{},
{"otherChunks":["output/b1abf_turbopack-tests_tests_snapshot_scope-hoisting_duplicate-imports_input_739fb2d3._.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/duplicate-imports/input/index.js [test] (ecmascript)"]}
]);
// Dummy runtime
\ No newline at end of file
(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push(["output/b1abf_turbopack-tests_tests_snapshot_scope-hoisting_duplicate-imports_input_739fb2d3._.js", {
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/duplicate-imports/input/shared.js [test] (ecmascript)": (function(__turbopack_context__) {
var { m: module, e: exports } = __turbopack_context__;
{
module.exports = 'shared';
}}),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/duplicate-imports/input/index.js [test] (ecmascript)": ((__turbopack_context__) => {
"use strict";
// MERGED MODULE: [project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/duplicate-imports/input/index.js [test] (ecmascript)
;
__turbopack_context__.s({}, "[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/duplicate-imports/input/index.js [test] (ecmascript)");
// MERGED MODULE: [project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/duplicate-imports/input/c.js [test] (ecmascript)
;
// MERGED MODULE: [project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/duplicate-imports/input/b.js [test] (ecmascript)
;
// MERGED MODULE: [project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/duplicate-imports/input/a.js [test] (ecmascript)
;
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$duplicate$2d$imports$2f$input$2f$shared$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/duplicate-imports/input/shared.js [test] (ecmascript)");
;
console.log('a', __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$duplicate$2d$imports$2f$input$2f$shared$2e$js__$5b$test$5d$__$28$ecmascript$29$__["default"]);
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$duplicate$2d$imports$2f$input$2f$shared$2e$js__$5b$test$5d$__$28$ecmascript$29$__1 = __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$duplicate$2d$imports$2f$input$2f$shared$2e$js__$5b$test$5d$__$28$ecmascript$29$__;
;
;
console.log('a', __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$duplicate$2d$imports$2f$input$2f$shared$2e$js__$5b$test$5d$__$28$ecmascript$29$__1["default"]);
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$duplicate$2d$imports$2f$input$2f$shared$2e$js__$5b$test$5d$__$28$ecmascript$29$__2 = __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$duplicate$2d$imports$2f$input$2f$shared$2e$js__$5b$test$5d$__$28$ecmascript$29$__;
;
;
console.log('c', __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$duplicate$2d$imports$2f$input$2f$shared$2e$js__$5b$test$5d$__$28$ecmascript$29$__2["default"]);
;
}),
}]);
//# sourceMappingURL=b1abf_turbopack-tests_tests_snapshot_scope-hoisting_duplicate-imports_input_739fb2d3._.js.map
\ No newline at end of file
{
"version": 3,
"sources": [],
"sections": [
{"offset": {"line": 6, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/duplicate-imports/input/shared.js"],"sourcesContent":["module.exports = 'shared'\n"],"names":[],"mappings":"AAAA,OAAO,OAAO,GAAG"}},
{"offset": {"line": 11, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/duplicate-imports/input/a.js","turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/duplicate-imports/input/b.js","turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/duplicate-imports/input/c.js"],"sourcesContent":["import shared from './shared.js'\n\nconsole.log('a', shared)\n","import './a.js'\nimport shared from './shared.js'\n\nconsole.log('a', shared)\n","import './b.js'\nimport shared from './shared.js'\n\nconsole.log('c', shared)\n"],"names":[],"mappings":";;;;;;;;;AAAA;;AAEA,QAAQ,GAAG,CAAC,KAAK,wNAAA,CAAA,UAAM;;;;ACCvB,QAAQ,GAAG,CAAC,KAAK,yNAAA,CAAA,UAAM;;;;ACAvB,QAAQ,GAAG,CAAC,KAAK,yNAAA,CAAA,UAAM"}}]
}
\ No newline at end of file
export default `
v8XyDjNBXwWR6pNaTwYLp5bfUJ1P8nN4Yigyk9c9S9Xt5JHt28veqF0SRPGEmShfRPTn2LnHWZbPWw5FDmaTfLPdX4NfEzJYzehn
T6Qw1dW8tnJ3VJUHHE0QUch181CwhbSHbRvzCzwJ66gJ5PWLzpCit6mZ2ZaGuM3kg6Gmmj301bwKWvY0EhFLW26YiDJYyFeb8uR6
NqBFFqm409pvFhfRdyZWWdBuEdd2TTdQxUgpBd6d147SKeRDj0HyrXKZNc0gd5Cj9pX8grD16fThjEE1uvkn3vPS8HkB7VXcC2Vq
UebF0aQGxrMnWffrjvxme63giD0ZTxeVGtmC5ZqeLyPEeCb2Lm2zuBdRnGNSk3JTNgM71FA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HM5GTneXyW3MALDbVN2e1eD4gUuMiKMxnQ8A51a7yZpQT9GYiUCE2cS2wD7S5idyfXBNkVVZ4hBGiW0
cWRPQpfP9YGZxvmvGd9aZfWQGUj2FY2MEQbF8PvGUd3bmW4dcr8ja0GLEFYgzjU5AXdfGjxz8ZdwSK1PuU75h7VvAmXeLg8KPmxc
UFkNShRQQKaptdCXBfUmueYuMnDT9w7XW2jkjp6gTRJ0CbFPmknEuuXNbLWjTqUnYmgFJAbdU67qJUvApdwa057TQSPekf4X6S8a
x6yvtGeCzq8138FqLwZ4DCNHS63mA2LMZAq0BDn1UdMyv2TLcDzTC7c7C1qntkfC978cDjXcqHqfyyHuw1eKEHxXn78vtAGhV9Ba
EDvvH3ZX5z8a39n5qBnwYe5uNdMWrG3Z3RWSurZL2TKKgz2383Gdx1nwfQVd3jJinZBwKt3KRWDghSRtfcyFwLmhwhK9QHRwDn4N
FG6adF1kPdxcnQ9rUk0b1jaemDjUwXJRycSSrmUPKiA6MTt8YVMx3Xf4NTZvmTugEE9pXSLyFeQQzEx36QZhdd7jC880YEdjzWbx
`
(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push(["output/4c35f_tests_snapshot_scope-hoisting_split-shared_input_big_index_6f69a308.js", {
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/big/index.js [test] (ecmascript)": ((__turbopack_context__) => {
"use strict";
// MERGED MODULE: [project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/big/index.js [test] (ecmascript)
;
__turbopack_context__.s({
"default": ()=>__TURBOPACK__default__export__1
}, "[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/big/index.js [test] (ecmascript)");
// MERGED MODULE: [project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/big/other.js [test] (ecmascript)
;
const __TURBOPACK__default__export__ = `
v8XyDjNBXwWR6pNaTwYLp5bfUJ1P8nN4Yigyk9c9S9Xt5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U9
6am33nyXF7GLJQ9HDAwMU9eM5rg4w08n3zkkn7zE8RCuApiEr5AUEmnhQuiK9JLUdQ2CJrvrFUCk0reTkSRYa7S5UpwK5nLupDRc
jDt7BzfYuKm4e2FKrGWZ3RRAHbQdFDqXJGLcZvTpBhqqNjc4NALmeD1NyFxTmdFPqH4FJhyP1SBY5hmdC7VxWnhS9aSCAJ4cqNZX
046GNThxFabYy5Ww7evnqbTdeVRG8p4nNM1HmGmzu0jX2U0AqNAZiD07qE1nHzTwAJy2z4Ec2bfM9gtTrYuTyr3bg4M3dqP34AB4
ewefKc9rcn19WSzWutjMeHM5GTneXyW3MALDbVN2e1eD4gUuMiKMxnQ8A51a7yZpQT9GYiUCE2cS2wD7S5idyfXBNkVVZ4hBGiW0
cWRPQpfP9YGZxvmvGd9aZfWQGUj2FY2MEQbF8PvGUd3bmW4dcr8ja0GLEFYgzjU5AXdfGjxz8ZdwSK1PuU75h7VvAmXeLg8KPmxc
UFkNShRQQKaptdCXBfUmueYuMnDT9w7XW2jkjp6gTRJ0CbFPmknEuuXNbLWjTqUnYmgFJAbdU67qJUvApdwa057TQSPekf4X6S8a
x6yvtGeCzq8138FqLwZ4DCNHS63mA2LMZAq0BDn1UdMyv2TLcDzTC7c7C1qntkfC978cDjXcqHqfyyHuw1eKEHxXn78vtAGhV9Ba
EDvvH3ZX5z8a39n5qBnwYe5uNdMWrG3Z3RWSurZL2TKKgz2383Gdx1nwfQVd3jJinZBwKt3KRWDghSRtfcyFwLmhwhK9QHRwDn4N
FG6adF1kPdxcnQ9rUk0b1jaemDjUwXJRycSSrmUPKiA6MTt8YVMx3Xf4NTZvmTugEE9pXSLyFeQQzEx36QZhdd7jC880YEdjzWbx
`;
;
const __TURBOPACK__default__export__1 = __TURBOPACK__default__export__.length;
}),
}]);
//# sourceMappingURL=4c35f_tests_snapshot_scope-hoisting_split-shared_input_big_index_6f69a308.js.map
\ No newline at end of file
{
"version": 3,
"sources": [],
"sections": [
{"offset": {"line": 5, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/big/other.js","turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/big/index.js"],"sourcesContent":["export default `\nv8XyDjNBXwWR6pNaTwYLp5bfUJ1P8nN4Yigyk9c9S9Xt5JHt28veqF0SRPGEmShfRPTn2LnHWZbPWw5FDmaTfLPdX4NfEzJYzehn\nT6Qw1dW8tnJ3VJUHHE0QUch181CwhbSHbRvzCzwJ66gJ5PWLzpCit6mZ2ZaGuM3kg6Gmmj301bwKWvY0EhFLW26YiDJYyFeb8uR6\nNqBFFqm409pvFhfRdyZWWdBuEdd2TTdQxUgpBd6d147SKeRDj0HyrXKZNc0gd5Cj9pX8grD16fThjEE1uvkn3vPS8HkB7VXcC2Vq\nUebF0aQGxrMnWffrjvxme63giD0ZTxeVGtmC5ZqeLyPEeCb2Lm2zuBdRnGNSk3JTNgM71FA7xTGyZZunNFS4bNkcJi5RB9AiteZE\nNz718p8qXRG1iZKnQZ8em8dwn1kb5qgggB2qqywKBXupBz3ebCWVMvE15AeDUNZaMuWZvQFMvBykkACHF6keYBEHVJtAyHndnEdp\nTpihHzavvY0UEfqeRjQvQm0Y8FXWZqbEmz6j4EjBSX5KdARxhbALan4QCKSRYNxpxMk1UxZf4rakhFitehV2WE3NX7pPdbVhXdza\ngxTa9m7KazYVnR5E9NkuJDvPL1STLyhZeP96pGZcR0QRpqUN3r9AMMaSec4Hir5b4PJu4UKtwXZxvm6dZ7KFLn3Rf4fe4yCCrREa\nLpmSKuP2JpbqCgc3ewnhkD87TRu1rEaXfFFgvw6ZhwGHf2bAJKJ7GA9QGzGBmrmRPHprjUnfzGMaSxUCxHmftAPTm2L644neCXuj\n3f8z9EY7Bqa1nagKyPi9DpZyDAGe2i0NzugGhB8xbW3K7xAKCEmhf5wZJ6RnQZDa4mqiLSxSz8gqGBu8Q5ALg4ybkbK6McwgR5QV\nA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PdxcnQ9rUk0b1jaemDjUwXJRycSSrmUPKiA6MTt8YVMx3Xf4NTZvmTugEE9pXSLyFeQQzEx36QZhdd7jC880YEdjzWbx\n`\n","import big from './other.js'\n\nexport default big.length\n"],"names":[],"mappings":";;;;;;;uCAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDhB,CAAC;;wCCnDc,+BAAI,MAAM"}}]
}
\ No newline at end of file
(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push(["output/4c35f_tests_snapshot_scope-hoisting_split-shared_input_x_inner_9793feec.js", {
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/x/inner.js [test] (ecmascript)": ((__turbopack_context__) => {
"use strict";
__turbopack_context__.s({});
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$split$2d$shared$2f$input$2f$big$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/big/index.js [test] (ecmascript)");
;
console.log('x', __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$split$2d$shared$2f$input$2f$big$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__["default"]);
}),
}]);
//# sourceMappingURL=4c35f_tests_snapshot_scope-hoisting_split-shared_input_x_inner_9793feec.js.map
\ No newline at end of file
{
"version": 3,
"sources": [],
"sections": [
{"offset": {"line": 5, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/x/inner.js"],"sourcesContent":["import big from '../big'\nconsole.log('x', big)\n"],"names":[],"mappings":";AAAA;;AACA,QAAQ,GAAG,CAAC,KAAK,yNAAA,CAAA,UAAG"}}]
}
\ No newline at end of file
(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push(["output/4c35f_tests_snapshot_scope-hoisting_split-shared_input_y_middle_aa5cba2d.js", {
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/middle.js [test] (ecmascript)": ((__turbopack_context__) => {
"use strict";
// MERGED MODULE: [project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/middle.js [test] (ecmascript)
;
__turbopack_context__.s({}, "[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/middle.js [test] (ecmascript)");
// MERGED MODULE: [project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/inner.js [test] (ecmascript)
;
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$split$2d$shared$2f$input$2f$big$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/big/index.js [test] (ecmascript)");
;
console.log('y', __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$split$2d$shared$2f$input$2f$big$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__["default"]);
;
}),
}]);
//# sourceMappingURL=4c35f_tests_snapshot_scope-hoisting_split-shared_input_y_middle_aa5cba2d.js.map
\ No newline at end of file
{
"version": 3,
"sources": [],
"sections": [
{"offset": {"line": 5, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/inner.js"],"sourcesContent":["import big from '../big'\nconsole.log('y', big)\n"],"names":[],"mappings":";;;;;AAAA;;AACA,QAAQ,GAAG,CAAC,KAAK,yNAAA,CAAA,UAAG"}}]
}
\ No newline at end of file
(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push(["output/b1abf_turbopack-tests_tests_snapshot_scope-hoisting_split-shared_input_d89f123b._.js", {
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/x/index.js [test] (ecmascript)": (function(__turbopack_context__) {
var { m: module, e: exports } = __turbopack_context__;
{
setTimeout(()=>__turbopack_context__.r("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/x/inner.js [test] (ecmascript, async loader)")(__turbopack_context__.i), 500);
}}),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/index.js [test] (ecmascript)": (function(__turbopack_context__) {
var { m: module, e: exports } = __turbopack_context__;
{
setTimeout(()=>__turbopack_context__.r("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/middle.js [test] (ecmascript, async loader)")(__turbopack_context__.i), 1000);
}}),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/index.js [test] (ecmascript)": ((__turbopack_context__) => {
"use strict";
__turbopack_context__.s({});
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$split$2d$shared$2f$input$2f$x$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/x/index.js [test] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$scope$2d$hoisting$2f$split$2d$shared$2f$input$2f$y$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/index.js [test] (ecmascript)");
;
;
}),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/x/inner.js [test] (ecmascript, async loader)": ((__turbopack_context__) => {
__turbopack_context__.v((parentImport) => {
return Promise.all([
"output/4c35f_tests_snapshot_scope-hoisting_split-shared_input_x_inner_9793feec.js",
"output/4c35f_tests_snapshot_scope-hoisting_split-shared_input_big_index_6f69a308.js"
].map((chunk) => __turbopack_context__.l(chunk))).then(() => {
return parentImport("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/x/inner.js [test] (ecmascript)");
});
});
}),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/middle.js [test] (ecmascript, async loader)": ((__turbopack_context__) => {
__turbopack_context__.v((parentImport) => {
return Promise.all([
"output/4c35f_tests_snapshot_scope-hoisting_split-shared_input_y_middle_aa5cba2d.js",
"output/4c35f_tests_snapshot_scope-hoisting_split-shared_input_big_index_6f69a308.js"
].map((chunk) => __turbopack_context__.l(chunk))).then(() => {
return parentImport("[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/middle.js [test] (ecmascript)");
});
});
}),
}]);
//# sourceMappingURL=b1abf_turbopack-tests_tests_snapshot_scope-hoisting_split-shared_input_d89f123b._.js.map
\ No newline at end of file
{
"version": 3,
"sources": [],
"sections": [
{"offset": {"line": 6, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/x/index.js"],"sourcesContent":["setTimeout(() => import('./inner'), 500)\n"],"names":[],"mappings":"AAAA,WAAW,kMAAyB"}},
{"offset": {"line": 12, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/y/index.js"],"sourcesContent":["setTimeout(() => import('./middle'), 1000)\n"],"names":[],"mappings":"AAAA,WAAW,mMAA0B"}},
{"offset": {"line": 17, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/index.js"],"sourcesContent":["import './x/index'\nimport './y/index'\n"],"names":[],"mappings":";AAAA;AACA"}}]
}
\ No newline at end of file
(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push([
"output/b1abf_turbopack-tests_tests_snapshot_scope-hoisting_split-shared_input_index_3e6a4369.js",
{},
{"otherChunks":["output/b1abf_turbopack-tests_tests_snapshot_scope-hoisting_split-shared_input_d89f123b._.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/scope-hoisting/split-shared/input/index.js [test] (ecmascript)"]}
]);
// Dummy runtime
\ No newline at end of file
import { runExternalSourceMapped } from './sourcemapped.js'
runExternalSourceMapped()
export function runExternalSourceMapped(fn) {
return fn();
}
//# sourceMappingURL=sourcemapped.js.map
\ No newline at end of file
{"version":3,"file":"sourcemapped.js","sourceRoot":"","sources":["sourcemapped.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,uBAAuB,CAAI,EAAS;IAClD,OAAO,EAAE,EAAE,CAAA;AACb,CAAC","sourcesContent":["// Compile with pnpm tsc turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/sourcemapped.ts --sourceMap --inlineSources --target esnext\n// tsc compile errors can be ignored\ntype Fn<T> = () => T\nexport function runExternalSourceMapped<T>(fn: Fn<T>): T {\n return fn()\n}\n"]}
\ No newline at end of file
// Compile with pnpm tsc turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/sourcemapped.ts --sourceMap --inlineSources --target esnext
// tsc compile errors can be ignored
type Fn<T> = () => T
export function runExternalSourceMapped<T>(fn: Fn<T>): T {
return fn()
}
(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push(["output/4c35f_tests_snapshot_source_maps_input-source-map-merged_input_index_e9baadb1.js", {
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/index.js [test] (ecmascript)": (function(__turbopack_context__) {
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/index.js [test] (ecmascript)": ((__turbopack_context__) => {
"use strict";
var { m: module, e: exports } = __turbopack_context__;
{
const e = new Error("Could not parse module '[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/index.js'");
e.code = 'MODULE_UNPARSEABLE';
throw e;
}}),
// MERGED MODULE: [project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/index.js [test] (ecmascript)
;
__turbopack_context__.s({}, "[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/index.js [test] (ecmascript)");
// MERGED MODULE: [project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/sourcemapped.js [test] (ecmascript)
;
function runExternalSourceMapped(fn) {
return fn();
} //# sourceMappingURL=sourcemapped.js.map
;
runExternalSourceMapped();
}),
}]);
//# sourceMappingURL=4c35f_tests_snapshot_source_maps_input-source-map-merged_input_index_e9baadb1.js.map
\ No newline at end of file
{
"version": 3,
"sources": [],
"sections": []
"sections": [
{"offset": {"line": 5, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/sourcemapped.ts","turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/index.js"],"sourcesContent":["// Compile with pnpm tsc turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/sourcemapped.ts --sourceMap --inlineSources --target esnext\n// tsc compile errors can be ignored\ntype Fn<T> = () => T\nexport function runExternalSourceMapped<T>(fn: Fn<T>): T {\n return fn()\n}\n","import { runExternalSourceMapped } from './sourcemapped.js'\n\nrunExternalSourceMapped()\n"],"names":[],"mappings":";;;;;AAGM,SAAU,uBAAuB,CAAI,EAAS;IAClD,OAAO,EAAE,EAAE,CAAA;;;ACFb"}}]
}
\ No newline at end of file
import { runExternalSourceMapped } from './sourcemapped.js'
runExternalSourceMapped()
export function runExternalSourceMapped(fn) {
return fn();
}
//# sourceMappingURL=sourcemapped.js.map
\ No newline at end of file
{"version":3,"file":"sourcemapped.js","sourceRoot":"","sources":["sourcemapped.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,uBAAuB,CAAI,EAAS;IAClD,OAAO,EAAE,EAAE,CAAA;AACb,CAAC","sourcesContent":["// Compile with pnpm tsc turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/sourcemapped.ts --sourceMap --inlineSources --target esnext\n// tsc compile errors can be ignored\ntype Fn<T> = () => T\nexport function runExternalSourceMapped<T>(fn: Fn<T>): T {\n return fn()\n}\n"]}
\ No newline at end of file
// Compile with pnpm tsc turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/sourcemapped.ts --sourceMap --inlineSources --target esnext
// tsc compile errors can be ignored
type Fn<T> = () => T
export function runExternalSourceMapped<T>(fn: Fn<T>): T {
return fn()
}
(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push(["output/4c35f_tests_snapshot_source_maps_input-source-map_input_index_17c28edc.js", {
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/index.js [test] (ecmascript)": (function(__turbopack_context__) {
var { m: module, e: exports } = __turbopack_context__;
{
const e = new Error("Could not parse module '[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/index.js'");
e.code = 'MODULE_UNPARSEABLE';
throw e;
}}),
}]);
\ No newline at end of file
(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push([
"output/4c35f_tests_snapshot_source_maps_input-source-map_input_index_317b2307.js",
"output/4c35f_tests_snapshot_source_maps_input-source-map_input_index_99ebe5b0.js",
{},
{"otherChunks":["output/4c35f_tests_snapshot_source_maps_input-source-map_input_index_17c28edc.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/index.js [test] (ecmascript)"]}
{"otherChunks":["output/b1abf_turbopack-tests_tests_snapshot_source_maps_input-source-map_input_965ec6d6._.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/index.js [test] (ecmascript)"]}
]);
// Dummy runtime
\ No newline at end of file
(globalThis.TURBOPACK = globalThis.TURBOPACK || []).push(["output/b1abf_turbopack-tests_tests_snapshot_source_maps_input-source-map_input_965ec6d6._.js", {
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/sourcemapped.js [test] (ecmascript)": ((__turbopack_context__) => {
"use strict";
__turbopack_context__.s({
"runExternalSourceMapped": ()=>runExternalSourceMapped
});
function runExternalSourceMapped(fn) {
return fn();
} //# sourceMappingURL=sourcemapped.js.map
}),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/index.js [test] (ecmascript)": ((__turbopack_context__) => {
"use strict";
__turbopack_context__.s({});
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$source_maps$2f$input$2d$source$2d$map$2f$input$2f$sourcemapped$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/sourcemapped.js [test] (ecmascript)");
;
(0, __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$source_maps$2f$input$2d$source$2d$map$2f$input$2f$sourcemapped$2e$js__$5b$test$5d$__$28$ecmascript$29$__["runExternalSourceMapped"])();
}),
}]);
//# sourceMappingURL=b1abf_turbopack-tests_tests_snapshot_source_maps_input-source-map_input_965ec6d6._.js.map
\ No newline at end of file
{
"version": 3,
"sources": [],
"sections": [
{"offset": {"line": 5, "column": 0}, "map": {"version":3,"file":"turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/sourcemapped.js","sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/sourcemapped.ts"],"sourceRoot":"","sourcesContent":["// Compile with pnpm tsc turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/sourcemapped.ts --sourceMap --inlineSources --target esnext\n// tsc compile errors can be ignored\ntype Fn<T> = () => T\nexport function runExternalSourceMapped<T>(fn: Fn<T>): T {\n return fn()\n}\n"],"names":[],"mappings":";;;AAGM,SAAU,uBAAuB,CAAI,EAAS;IAClD,OAAO,EAAE,EAAE,CAAA;AACb,CAAC"}},
{"offset": {"line": 15, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/index.js"],"sourcesContent":["import { runExternalSourceMapped } from './sourcemapped.js'\n\nrunExternalSourceMapped()\n"],"names":[],"mappings":";AAAA;;AAEA,CAAA,GAAA,0NAAA,CAAA,0BAAuB,AAAD"}}]
}
\ No newline at end of file
......@@ -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 <div>Should not be transformed</div>;
......
......@@ -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 <div>App</div>\n}\n"],"names":[],"mappings":";;;;;AAAe,SAAS;IACtB,qBAAO,0NAAC;kBAAI;;;;;;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 <div>Should not be transformed</div>;\n}\n"],"names":[],"mappings":";;;AAAe,SAAS;IACtB,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;IACd,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 <div>Should not be transformed</div>;\n}\n"],"names":[],"mappings":";;;AAAe,SAAS;IACtB,QAAQ,IAAI,yBAAyB,EAAE;AACzC","ignoreList":[0]}}]
}
\ No newline at end of file
......@@ -11,13 +11,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
......@@ -3,5 +3,5 @@
"sources": [],
"sections": [
{"offset": {"line": 6, "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;;8BAAA;;AAEN,QAAQ,GAAG,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC"}},
{"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":["\"purposefully empty stub\";\n\"@swc/helpers/_/_class_call_check.js\";\n"],"names":[],"mappings":"AAAA;AACA","ignoreList":[0]}}]
{"offset": {"line": 16, "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;IACd,OAAO;AACT","ignoreList":[0]}}]
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
"use strict";
__turbopack_context__.s({
"prop": (()=>prop)
"prop": ()=>prop
});
const prop = 1;
}),
......
......@@ -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';
}),
......
......@@ -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;
}),
......
......@@ -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;
}),
......
......@@ -4,7 +4,7 @@
"use strict";
__turbopack_context__.s({
"prop": (()=>prop)
"prop": ()=>prop
});
const prop = 1;
}),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment