Commit c4f43e45 authored by Tobias Koppers's avatar Tobias Koppers

Turbopack: add resolve_export property to ChunkingType

parent ec4c08a8
......@@ -153,6 +153,7 @@ impl ModuleReference for HmrEntryModuleReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
}))
}
}
......
......@@ -264,6 +264,8 @@ pub enum ChunkingType {
/// Whether the referenced module is executed always immediately before the parent module
/// (corresponding to ESM import semantics).
hoisted: bool,
/// Resolve the specified export to get the inner modules.
resolve_export: Option<RcStr>,
},
/// An async loader is placed into the referencing chunk and loads the
/// separate chunk group in which the module is placed.
......@@ -292,10 +294,12 @@ impl Display for ChunkingType {
ChunkingType::Parallel {
inherit_async,
hoisted,
resolve_export,
} => {
write!(
f,
"Parallel(inherit_async: {inherit_async}, hoisted: {hoisted})",
"Parallel(inherit_async: {inherit_async}, hoisted: {hoisted}, resolve_export: \
{resolve_export:?})",
)
}
ChunkingType::Async => write!(f, "Async"),
......@@ -364,9 +368,14 @@ impl ChunkingType {
pub fn without_inherit_async(&self) -> Self {
match self {
ChunkingType::Parallel { hoisted, .. } => ChunkingType::Parallel {
ChunkingType::Parallel {
hoisted,
resolve_export,
..
} => ChunkingType::Parallel {
hoisted: *hoisted,
inherit_async: false,
resolve_export: resolve_export.clone(),
},
ChunkingType::Async => ChunkingType::Async,
ChunkingType::Isolated { _ty, merge_tag } => ChunkingType::Isolated {
......
......@@ -1672,6 +1672,7 @@ impl Visit<SingleModuleGraphBuilderNode, RefData> for SingleModuleGraphBuilder<'
ChunkingType::Parallel {
inherit_async: _,
hoisted: _,
resolve_export: _,
} => {}
ChunkingType::Traced => {
let _span = span.entered();
......
......@@ -296,6 +296,7 @@ impl PreBatches {
&ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
},
|(_, ty)| &ty.chunking_type,
);
......@@ -682,6 +683,7 @@ pub async fn compute_module_batches(
ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
},
module,
)
......@@ -843,6 +845,7 @@ pub async fn compute_module_batches(
ty: ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
},
module: None,
},
......
......@@ -132,6 +132,7 @@ impl ModuleReference for SingleChunkableModuleReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: true,
hoisted: false,
resolve_export: None,
}))
}
......
......@@ -48,6 +48,7 @@ impl ModuleReference for CssModuleComposeReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
}))
}
}
......
......@@ -147,6 +147,7 @@ impl ModuleReference for ImportAssetReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
}))
}
}
......
......@@ -36,6 +36,7 @@ impl ModuleReference for InternalCssAssetReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
}))
}
}
......
......@@ -90,6 +90,7 @@ impl ModuleReference for UrlAssetReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
}))
}
}
......
......@@ -79,6 +79,7 @@ impl ModuleReference for AmdDefineAssetReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
}))
}
}
......
......@@ -73,6 +73,7 @@ impl ModuleReference for CjsAssetReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
}))
}
}
......@@ -130,6 +131,7 @@ impl ModuleReference for CjsRequireAssetReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
}))
}
}
......@@ -262,6 +264,7 @@ impl ModuleReference for CjsRequireResolveAssetReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
}))
}
}
......
......@@ -516,6 +516,7 @@ impl ModuleReference for EsmAssetReference {
Some(ChunkingType::Parallel {
inherit_async: true,
hoisted: true,
resolve_export: None,
})
} else if chunking_type == "none" {
None
......@@ -529,6 +530,7 @@ impl ModuleReference for EsmAssetReference {
Some(ChunkingType::Parallel {
inherit_async: true,
hoisted: true,
resolve_export: None,
})
},
))
......
......@@ -103,6 +103,7 @@ impl ModuleReference for UrlAssetReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
}))
}
}
......
......@@ -292,6 +292,7 @@ impl ModuleReference for RequireContextAssetReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
}))
}
}
......@@ -383,6 +384,7 @@ impl ModuleReference for ResolvedModuleReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
}))
}
}
......
......@@ -261,6 +261,7 @@ impl ModuleReference for WorkerAssetReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: false,
hoisted: false,
resolve_export: None,
}))
}
}
......
......@@ -139,6 +139,7 @@ impl ModuleReference for EcmascriptModulePartReference {
Vc::cell(Some(ChunkingType::Parallel {
inherit_async: true,
hoisted: true,
resolve_export: None,
}))
}
......
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