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