Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
ahabhgk committed Oct 17, 2023
1 parent c5bf4fa commit cde0b1f
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions crates/rspack_core/src/external_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ impl Module for ExternalModule {
"this" => build_result.build_info.strict = false,
"system" => build_result.build_meta.exports_type = BuildMetaExportsType::Namespace,
"module" => build_result.build_meta.exports_type = BuildMetaExportsType::Namespace,
"script" | "promise" => build_result.build_meta.has_await = true,
"script" | "promise" => build_result.build_meta.has_top_level_await = true,
"import" => {
build_result.build_meta.has_await = true;
build_result.build_meta.has_top_level_await = true;
build_result.build_meta.exports_type = BuildMetaExportsType::Namespace;
}
_ => build_result.build_meta.exports_type = BuildMetaExportsType::Dynamic,
Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_core/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl Display for ExportsArgument {
pub struct BuildMeta {
pub strict: bool,
pub strict_harmony_module: bool,
pub has_await: bool,
pub has_top_level_await: bool,
pub esm: bool,
pub exports_type: BuildMetaExportsType,
pub default_object: BuildMetaDefaultObject,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl DependencyTemplate for HarmonyCompatibilityDependency {
InitFragmentStage::StageAsyncBoundary,
0,
InitFragmentKey::uniqie(),
Some(format!("\n__webpack_async_result__();\n}} catch(e) {{ __webpack_async_result__(e); }} }}{});", if matches!(mgm.build_meta.as_ref().map(|meta| meta.has_await), Some(true)) { ", 1" } else { "" })),
Some(format!("\n__webpack_async_result__();\n}} catch(e) {{ __webpack_async_result__(e); }} }}{});", if matches!(mgm.build_meta.as_ref().map(|meta| meta.has_top_level_await), Some(true)) { ", 1" } else { "" })),
)));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl Plugin for InferAsyncModulesPlugin {
.values()
.filter(|m| {
if let Some(meta) = &m.build_meta {
meta.has_await
meta.has_top_level_await
} else {
false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Visit for HarmonyDetectionScanner<'_> {
if !self.top_level_await {
self.errors.push(internal_error!("The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it)"));
} else if is_harmony || strict_harmony_module {
self.build_meta.has_await = true;
self.build_meta.has_top_level_await = true;
} else {
self.errors.push(internal_error!(
"Top-level-await is only supported in EcmaScript Modules: {}",
Expand Down
2 changes: 1 addition & 1 deletion crates/rspack_plugin_wasm/src/parser_and_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl ParserAndGenerator for AsyncWasmParserAndGenerator {

fn parse(&mut self, parse_context: ParseContext) -> Result<TWithDiagnosticArray<ParseResult>> {
parse_context.build_info.strict = true;
parse_context.build_meta.has_await = true;
parse_context.build_meta.has_top_level_await = true;
parse_context.build_meta.exports_type = BuildMetaExportsType::Namespace;

let source = parse_context.source;
Expand Down

0 comments on commit cde0b1f

Please sign in to comment.