Commit 0944df74 authored by Tobias Koppers's avatar Tobias Koppers

expose evaluation as `get_evaluation`

parent 7af2a39e
...@@ -21,7 +21,7 @@ use turbopack_ecmascript::{ ...@@ -21,7 +21,7 @@ use turbopack_ecmascript::{
EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkItemOptions, EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkItemOptions,
EcmascriptChunkPlaceable, EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType, EcmascriptChunkPlaceable, EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType,
}, },
references::esm::EsmEvaluation, references::esm::EcmascriptEvaluation,
runtime_functions::TURBOPACK_REQUIRE, runtime_functions::TURBOPACK_REQUIRE,
utils::StringifyJs, utils::StringifyJs,
}; };
...@@ -105,7 +105,7 @@ impl EcmascriptChunkPlaceable for HmrEntryModule { ...@@ -105,7 +105,7 @@ impl EcmascriptChunkPlaceable for HmrEntryModule {
fn get_exports(self: Vc<Self>) -> Vc<EcmascriptExports> { fn get_exports(self: Vc<Self>) -> Vc<EcmascriptExports> {
EcmascriptExports { EcmascriptExports {
ty: EcmascriptExportsType::None, ty: EcmascriptExportsType::None,
evaluation: EsmEvaluation::SideEffects, evaluation: EcmascriptEvaluation::SideEffects,
} }
.cell() .cell()
} }
......
...@@ -18,7 +18,7 @@ use turbopack_ecmascript::{ ...@@ -18,7 +18,7 @@ use turbopack_ecmascript::{
EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable, EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable,
EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType, EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType,
}, },
references::esm::{EsmEvaluation, EsmExport, EsmExports}, references::esm::{EcmascriptEvaluation, EsmExport, EsmExports},
runtime_functions::{TURBOPACK_EXPORT_NAMESPACE, TURBOPACK_IMPORT}, runtime_functions::{TURBOPACK_EXPORT_NAMESPACE, TURBOPACK_IMPORT},
utils::StringifyJs, utils::StringifyJs,
}; };
...@@ -121,7 +121,7 @@ impl EcmascriptChunkPlaceable for NextDynamicEntryModule { ...@@ -121,7 +121,7 @@ impl EcmascriptChunkPlaceable for NextDynamicEntryModule {
} }
.resolved_cell(), .resolved_cell(),
), ),
evaluation: EsmEvaluation::DelegatedSideEffects(module_reference), evaluation: EcmascriptEvaluation::DelegatedSideEffects(module_reference),
} }
.cell()) .cell())
} }
......
...@@ -18,7 +18,7 @@ use turbopack_ecmascript::{ ...@@ -18,7 +18,7 @@ use turbopack_ecmascript::{
EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable, EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable,
EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType, EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType,
}, },
references::esm::{EsmEvaluation, EsmExport, EsmExports}, references::esm::{EcmascriptEvaluation, EsmExport, EsmExports},
runtime_functions::{TURBOPACK_EXPORT_NAMESPACE, TURBOPACK_IMPORT}, runtime_functions::{TURBOPACK_EXPORT_NAMESPACE, TURBOPACK_IMPORT},
utils::StringifyJs, utils::StringifyJs,
}; };
...@@ -114,7 +114,7 @@ impl EcmascriptChunkPlaceable for NextServerComponentModule { ...@@ -114,7 +114,7 @@ impl EcmascriptChunkPlaceable for NextServerComponentModule {
} }
.resolved_cell(), .resolved_cell(),
), ),
evaluation: EsmEvaluation::DelegatedSideEffects(module_reference), evaluation: EcmascriptEvaluation::DelegatedSideEffects(module_reference),
} }
.cell()) .cell())
} }
......
...@@ -18,7 +18,7 @@ use turbopack_ecmascript::{ ...@@ -18,7 +18,7 @@ use turbopack_ecmascript::{
EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable, EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable,
EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType, EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType,
}, },
references::esm::{EsmEvaluation, EsmExport, EsmExports}, references::esm::{EcmascriptEvaluation, EsmExport, EsmExports},
runtime_functions::{TURBOPACK_EXPORT_NAMESPACE, TURBOPACK_IMPORT}, runtime_functions::{TURBOPACK_EXPORT_NAMESPACE, TURBOPACK_IMPORT},
utils::StringifyJs, utils::StringifyJs,
}; };
...@@ -114,7 +114,7 @@ impl EcmascriptChunkPlaceable for NextServerUtilityModule { ...@@ -114,7 +114,7 @@ impl EcmascriptChunkPlaceable for NextServerUtilityModule {
} }
.resolved_cell(), .resolved_cell(),
), ),
evaluation: EsmEvaluation::DelegatedSideEffects(module_reference), evaluation: EcmascriptEvaluation::DelegatedSideEffects(module_reference),
} }
.cell()) .cell())
} }
......
...@@ -29,7 +29,7 @@ use turbopack_ecmascript::{ ...@@ -29,7 +29,7 @@ use turbopack_ecmascript::{
EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType, EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType,
}, },
parse::generate_js_source_map, parse::generate_js_source_map,
references::esm::EsmEvaluation, references::esm::EcmascriptEvaluation,
runtime_functions::{TURBOPACK_EXPORT_VALUE, TURBOPACK_IMPORT}, runtime_functions::{TURBOPACK_EXPORT_VALUE, TURBOPACK_IMPORT},
utils::StringifyJs, utils::StringifyJs,
}; };
...@@ -266,7 +266,7 @@ impl EcmascriptChunkPlaceable for ModuleCssAsset { ...@@ -266,7 +266,7 @@ impl EcmascriptChunkPlaceable for ModuleCssAsset {
fn get_exports(&self) -> Vc<EcmascriptExports> { fn get_exports(&self) -> Vc<EcmascriptExports> {
EcmascriptExports { EcmascriptExports {
ty: EcmascriptExportsType::Value, ty: EcmascriptExportsType::Value,
evaluation: EsmEvaluation::SideEffects, evaluation: EcmascriptEvaluation::SideEffects,
} }
.cell() .cell()
} }
......
...@@ -21,7 +21,7 @@ use turbopack_core::{ ...@@ -21,7 +21,7 @@ use turbopack_core::{
use crate::references::{ use crate::references::{
async_module::OptionAsyncModule, async_module::OptionAsyncModule,
esm::{EsmEvaluation, EsmExport, EsmExports}, esm::{EcmascriptEvaluation, EsmExport, EsmExports},
}; };
#[turbo_tasks::value_trait] #[turbo_tasks::value_trait]
...@@ -33,6 +33,10 @@ pub trait EcmascriptChunkPlaceable: ChunkableModule + Module + Asset { ...@@ -33,6 +33,10 @@ pub trait EcmascriptChunkPlaceable: ChunkableModule + Module + Asset {
Vc::cell(None) Vc::cell(None)
} }
#[turbo_tasks::function] #[turbo_tasks::function]
async fn get_evaluation(self: Vc<Self>) -> Result<Vc<EcmascriptEvaluation>> {
Ok(self.get_exports().await?.evaluation.cell())
}
#[turbo_tasks::function]
async fn is_marked_as_side_effect_free( async fn is_marked_as_side_effect_free(
self: Vc<Self>, self: Vc<Self>,
side_effect_free_packages: Vc<Glob>, side_effect_free_packages: Vc<Glob>,
...@@ -222,7 +226,7 @@ pub async fn is_marked_as_side_effect_free( ...@@ -222,7 +226,7 @@ pub async fn is_marked_as_side_effect_free(
#[turbo_tasks::value(shared)] #[turbo_tasks::value(shared)]
pub struct EcmascriptExports { pub struct EcmascriptExports {
pub ty: EcmascriptExportsType, pub ty: EcmascriptExportsType,
pub evaluation: EsmEvaluation, pub evaluation: EcmascriptEvaluation,
} }
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, TraceRawVcs, NonLocalValue)] #[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, TraceRawVcs, NonLocalValue)]
......
...@@ -18,6 +18,7 @@ use crate::{ ...@@ -18,6 +18,7 @@ use crate::{
EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable, EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable,
EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType, EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType,
}, },
export::EcmascriptEvaluation,
runtime_functions::TURBOPACK_EXPORT_VALUE, runtime_functions::TURBOPACK_EXPORT_VALUE,
utils::StringifyJs, utils::StringifyJs,
}; };
...@@ -74,6 +75,7 @@ impl EcmascriptChunkPlaceable for InlinedBytesJsModule { ...@@ -74,6 +75,7 @@ impl EcmascriptChunkPlaceable for InlinedBytesJsModule {
fn get_exports(&self) -> Vc<EcmascriptExports> { fn get_exports(&self) -> Vc<EcmascriptExports> {
EcmascriptExports { EcmascriptExports {
ty: EcmascriptExportsType::Value, ty: EcmascriptExportsType::Value,
evaluation: EcmascriptEvaluation::SideEffects,
} }
.cell() .cell()
} }
......
...@@ -124,7 +124,7 @@ use crate::{ ...@@ -124,7 +124,7 @@ use crate::{
references::{ references::{
analyse_ecmascript_module, analyse_ecmascript_module,
async_module::OptionAsyncModule, async_module::OptionAsyncModule,
esm::{base::EsmAssetReferences, export}, esm::{EcmascriptEvaluation, base::EsmAssetReferences, export},
}, },
side_effect_optimization::reference::EcmascriptModulePartReference, side_effect_optimization::reference::EcmascriptModulePartReference,
swc_comments::{CowComments, ImmutableComments}, swc_comments::{CowComments, ImmutableComments},
...@@ -640,6 +640,18 @@ impl EcmascriptModuleAsset { ...@@ -640,6 +640,18 @@ impl EcmascriptModuleAsset {
pub fn options(&self) -> Vc<EcmascriptOptions> { pub fn options(&self) -> Vc<EcmascriptOptions> {
*self.options *self.options
} }
#[turbo_tasks::function]
async fn check_package_json_side_effect_free(self: Vc<Self>) -> Result<Vc<bool>> {
Ok(is_marked_as_side_effect_free(
self.ident().path().owned().await?,
self.await?
.options
.await?
.side_effect_free_packages
.map(|g| *g),
))
}
} }
impl EcmascriptModuleAsset { impl EcmascriptModuleAsset {
...@@ -725,6 +737,15 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleAsset { ...@@ -725,6 +737,15 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleAsset {
Ok(*self.analyze().await?.exports) Ok(*self.analyze().await?.exports)
} }
#[turbo_tasks::function]
async fn get_evaluation(self: Vc<Self>) -> Result<Vc<EcmascriptEvaluation>> {
if *self.check_package_json_side_effect_free().await? {
Ok(EcmascriptEvaluation::SideEffectFree.cell())
} else {
Ok(self.get_exports().await?.evaluation.cell())
}
}
#[turbo_tasks::function] #[turbo_tasks::function]
async fn get_async_module(self: Vc<Self>) -> Result<Vc<OptionAsyncModule>> { async fn get_async_module(self: Vc<Self>) -> Result<Vc<OptionAsyncModule>> {
Ok(*self.analyze().await?.async_module) Ok(*self.analyze().await?.async_module)
...@@ -733,13 +754,10 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleAsset { ...@@ -733,13 +754,10 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleAsset {
#[turbo_tasks::function] #[turbo_tasks::function]
async fn is_marked_as_side_effect_free( async fn is_marked_as_side_effect_free(
self: Vc<Self>, self: Vc<Self>,
side_effect_free_packages: Vc<Glob>, _side_effect_free_packages: Vc<Glob>,
) -> Result<Vc<bool>> { ) -> Result<Vc<bool>> {
// Check package.json first, so that we can skip parsing the module if it's marked that way. // Check package.json first, so that we can skip parsing the module if it's marked that way.
let pkg_side_effect_free = is_marked_as_side_effect_free( let pkg_side_effect_free = self.check_package_json_side_effect_free();
self.ident().path().owned().await?,
Some(side_effect_free_packages),
);
Ok(if *pkg_side_effect_free.await? { Ok(if *pkg_side_effect_free.await? {
pkg_side_effect_free pkg_side_effect_free
} else { } else {
......
...@@ -18,7 +18,7 @@ use turbopack_core::{ ...@@ -18,7 +18,7 @@ use turbopack_core::{
use super::chunk_item::ManifestChunkItem; use super::chunk_item::ManifestChunkItem;
use crate::{ use crate::{
chunk::{EcmascriptChunkPlaceable, EcmascriptExports, EcmascriptExportsType}, chunk::{EcmascriptChunkPlaceable, EcmascriptExports, EcmascriptExportsType},
references::esm::EsmEvaluation, references::esm::EcmascriptEvaluation,
}; };
/// The manifest module is deferred until requested by the manifest loader /// The manifest module is deferred until requested by the manifest loader
...@@ -177,7 +177,7 @@ impl EcmascriptChunkPlaceable for ManifestAsyncModule { ...@@ -177,7 +177,7 @@ impl EcmascriptChunkPlaceable for ManifestAsyncModule {
fn get_exports(&self) -> Vc<EcmascriptExports> { fn get_exports(&self) -> Vc<EcmascriptExports> {
EcmascriptExports { EcmascriptExports {
ty: EcmascriptExportsType::Value, ty: EcmascriptExportsType::Value,
evaluation: EsmEvaluation::SideEffects, evaluation: EcmascriptEvaluation::SideEffects,
} }
.cell() .cell()
} }
......
...@@ -14,7 +14,7 @@ use swc_core::{ ...@@ -14,7 +14,7 @@ use swc_core::{
use turbo_rcstr::{RcStr, rcstr}; use turbo_rcstr::{RcStr, rcstr};
use turbo_tasks::{ use turbo_tasks::{
FxIndexMap, NonLocalValue, ResolvedVc, TryFlatJoinIterExt, ValueToString, Vc, FxIndexMap, NonLocalValue, ResolvedVc, TryFlatJoinIterExt, ValueToString, Vc,
debug::ValueDebugFormat, trace::TraceRawVcs, trace::TraceRawVcs,
}; };
use turbo_tasks_fs::glob::Glob; use turbo_tasks_fs::glob::Glob;
use turbopack_core::{ use turbopack_core::{
...@@ -526,21 +526,9 @@ async fn emit_star_exports_issue(source_ident: Vc<AssetIdent>, message: RcStr) - ...@@ -526,21 +526,9 @@ async fn emit_star_exports_issue(source_ident: Vc<AssetIdent>, message: RcStr) -
Ok(()) Ok(())
} }
#[derive( #[turbo_tasks::value(shared)]
Debug, #[derive(Default, Copy, Clone)]
Default, pub enum EcmascriptEvaluation {
Clone,
Copy,
PartialEq,
Eq,
Hash,
ValueDebugFormat,
Serialize,
Deserialize,
TraceRawVcs,
NonLocalValue,
)]
pub enum EsmEvaluation {
/// The module has module evaluation side effects. /// The module has module evaluation side effects.
#[default] #[default]
SideEffects, SideEffects,
......
...@@ -11,7 +11,7 @@ pub use self::{ ...@@ -11,7 +11,7 @@ pub use self::{
base::EsmAssetReference, base::EsmAssetReference,
binding::EsmBinding, binding::EsmBinding,
dynamic::EsmAsyncAssetReference, dynamic::EsmAsyncAssetReference,
export::{EsmEvaluation, EsmExport, EsmExports, FoundExportType, Liveness}, export::{EcmascriptEvaluation, EsmExport, EsmExports, FoundExportType, Liveness},
meta::{ImportMetaBinding, ImportMetaRef}, meta::{ImportMetaBinding, ImportMetaRef},
module_item::EsmModuleItem, module_item::EsmModuleItem,
url::{UrlAssetReference, UrlRewriteBehavior}, url::{UrlAssetReference, UrlRewriteBehavior},
......
...@@ -28,7 +28,7 @@ use crate::{ ...@@ -28,7 +28,7 @@ use crate::{
}, },
references::{ references::{
async_module::{AsyncModule, OptionAsyncModule}, async_module::{AsyncModule, OptionAsyncModule},
esm::EsmEvaluation, esm::EcmascriptEvaluation,
}, },
runtime_functions::{ runtime_functions::{
TURBOPACK_EXPORT_NAMESPACE, TURBOPACK_EXPORT_VALUE, TURBOPACK_EXTERNAL_IMPORT, TURBOPACK_EXPORT_NAMESPACE, TURBOPACK_EXPORT_VALUE, TURBOPACK_EXTERNAL_IMPORT,
...@@ -324,13 +324,13 @@ impl EcmascriptChunkPlaceable for CachedExternalModule { ...@@ -324,13 +324,13 @@ impl EcmascriptChunkPlaceable for CachedExternalModule {
if self.external_type == CachedExternalType::CommonJs { if self.external_type == CachedExternalType::CommonJs {
EcmascriptExports { EcmascriptExports {
ty: EcmascriptExportsType::CommonJs, ty: EcmascriptExportsType::CommonJs,
evaluation: EsmEvaluation::SideEffects, evaluation: EcmascriptEvaluation::SideEffects,
} }
.cell() .cell()
} else { } else {
EcmascriptExports { EcmascriptExports {
ty: EcmascriptExportsType::DynamicNamespace, ty: EcmascriptExportsType::DynamicNamespace,
evaluation: EsmEvaluation::SideEffects, evaluation: EcmascriptEvaluation::SideEffects,
} }
.cell() .cell()
} }
......
...@@ -140,7 +140,7 @@ use crate::{ ...@@ -140,7 +140,7 @@ use crate::{
}, },
chunk::{EcmascriptExports, EcmascriptExportsType, placeable::is_marked_as_side_effect_free}, chunk::{EcmascriptExports, EcmascriptExportsType, placeable::is_marked_as_side_effect_free},
code_gen::{CodeGen, CodeGens, IntoCodeGenReference}, code_gen::{CodeGen, CodeGens, IntoCodeGenReference},
export::{EsmEvaluation, Liveness}, export::{EcmascriptEvaluation, Liveness},
magic_identifier, magic_identifier,
references::{ references::{
async_module::{AsyncModule, OptionAsyncModule}, async_module::{AsyncModule, OptionAsyncModule},
...@@ -227,7 +227,7 @@ pub struct AnalyzeEcmascriptModuleResultBuilder { ...@@ -227,7 +227,7 @@ pub struct AnalyzeEcmascriptModuleResultBuilder {
code_gens: Vec<CodeGen>, code_gens: Vec<CodeGen>,
exports: EcmascriptExportsType, exports: EcmascriptExportsType,
evaluation: EsmEvaluation, evaluation: EcmascriptEvaluation,
async_module: ResolvedVc<OptionAsyncModule>, async_module: ResolvedVc<OptionAsyncModule>,
successful: bool, successful: bool,
source_map: Option<ResolvedVc<Box<dyn GenerateSourceMap>>>, source_map: Option<ResolvedVc<Box<dyn GenerateSourceMap>>>,
...@@ -246,7 +246,7 @@ impl AnalyzeEcmascriptModuleResultBuilder { ...@@ -246,7 +246,7 @@ impl AnalyzeEcmascriptModuleResultBuilder {
esm_references_free_var: Default::default(), esm_references_free_var: Default::default(),
code_gens: Default::default(), code_gens: Default::default(),
exports: EcmascriptExportsType::Unknown, exports: EcmascriptExportsType::Unknown,
evaluation: EsmEvaluation::SideEffects, evaluation: EcmascriptEvaluation::SideEffects,
async_module: ResolvedVc::cell(None), async_module: ResolvedVc::cell(None),
successful: false, successful: false,
source_map: None, source_map: None,
...@@ -308,7 +308,7 @@ impl AnalyzeEcmascriptModuleResultBuilder { ...@@ -308,7 +308,7 @@ impl AnalyzeEcmascriptModuleResultBuilder {
} }
/// Sets the analysis result evaluation. /// Sets the analysis result evaluation.
pub fn set_evaluation(&mut self, evaluation: EsmEvaluation) { pub fn set_evaluation(&mut self, evaluation: EcmascriptEvaluation) {
self.evaluation = evaluation; self.evaluation = evaluation;
} }
...@@ -593,13 +593,15 @@ pub async fn analyse_ecmascript_module_internal( ...@@ -593,13 +593,15 @@ pub async fn analyse_ecmascript_module_internal(
else { else {
// Even a file that failed parsing can be side effect free. // Even a file that failed parsing can be side effect free.
// That's important as // That's important as
let marked_as_side_effect_free = let marked_as_side_effect_free = *is_marked_as_side_effect_free(
*is_marked_as_side_effect_free(path, options.side_effect_free_packages.map(|l| *l)) path.clone(),
options.side_effect_free_packages.map(|l| *l),
)
.await?; .await?;
let evaluation = if marked_as_side_effect_free { let evaluation = if marked_as_side_effect_free {
EsmEvaluation::SideEffectFree EcmascriptEvaluation::SideEffectFree
} else { } else {
EsmEvaluation::SideEffects EcmascriptEvaluation::SideEffects
}; };
analysis.set_evaluation(evaluation); analysis.set_evaluation(evaluation);
...@@ -825,9 +827,9 @@ pub async fn analyse_ecmascript_module_internal( ...@@ -825,9 +827,9 @@ pub async fn analyse_ecmascript_module_internal(
) )
.await?; .await?;
let evaluation = if marked_as_side_effect_free { let evaluation = if marked_as_side_effect_free {
EsmEvaluation::SideEffectFree EcmascriptEvaluation::SideEffectFree
} else { } else {
EsmEvaluation::SideEffects EcmascriptEvaluation::SideEffects
}; };
analysis.set_evaluation(evaluation); analysis.set_evaluation(evaluation);
......
...@@ -47,7 +47,7 @@ use crate::{ ...@@ -47,7 +47,7 @@ use crate::{
create_visitor, create_visitor,
references::{ references::{
AstPath, AstPath,
esm::EsmEvaluation, esm::EcmascriptEvaluation,
pattern_mapping::{PatternMapping, ResolveType}, pattern_mapping::{PatternMapping, ResolveType},
}, },
runtime_functions::{TURBOPACK_EXPORT_VALUE, TURBOPACK_MODULE_CONTEXT, TURBOPACK_REQUIRE}, runtime_functions::{TURBOPACK_EXPORT_VALUE, TURBOPACK_MODULE_CONTEXT, TURBOPACK_REQUIRE},
...@@ -459,7 +459,7 @@ impl EcmascriptChunkPlaceable for RequireContextAsset { ...@@ -459,7 +459,7 @@ impl EcmascriptChunkPlaceable for RequireContextAsset {
fn get_exports(&self) -> Vc<EcmascriptExports> { fn get_exports(&self) -> Vc<EcmascriptExports> {
EcmascriptExports { EcmascriptExports {
ty: EcmascriptExportsType::Value, ty: EcmascriptExportsType::Value,
evaluation: EsmEvaluation::SideEffects, evaluation: EcmascriptEvaluation::SideEffects,
} }
.cell() .cell()
} }
......
...@@ -22,7 +22,7 @@ use crate::{ ...@@ -22,7 +22,7 @@ use crate::{
EcmascriptModuleContentOptions, EcmascriptOptions, MergedEcmascriptModule, SpecifiedModuleType, EcmascriptModuleContentOptions, EcmascriptOptions, MergedEcmascriptModule, SpecifiedModuleType,
chunk::{EcmascriptChunkPlaceable, EcmascriptExports, EcmascriptExportsType}, chunk::{EcmascriptChunkPlaceable, EcmascriptExports, EcmascriptExportsType},
code_gen::CodeGens, code_gen::CodeGens,
export::{EsmEvaluation, Liveness}, export::{EcmascriptEvaluation, Liveness},
references::{ references::{
async_module::{AsyncModule, OptionAsyncModule}, async_module::{AsyncModule, OptionAsyncModule},
esm::{EsmExport, EsmExports, base::EsmAssetReferences}, esm::{EsmExport, EsmExports, base::EsmAssetReferences},
...@@ -290,7 +290,7 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleFacadeModule { ...@@ -290,7 +290,7 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleFacadeModule {
} }
} }
star_exports.extend(esm_exports.star_exports.iter().copied()); star_exports.extend(esm_exports.star_exports.iter().copied());
evaluation = EsmEvaluation::DelegatedSideEffects(ResolvedVc::upcast( evaluation = EcmascriptEvaluation::DelegatedSideEffects(ResolvedVc::upcast(
EcmascriptModulePartReference::new_part( EcmascriptModulePartReference::new_part(
*self.module, *self.module,
ModulePart::locals(), ModulePart::locals(),
...@@ -320,7 +320,7 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleFacadeModule { ...@@ -320,7 +320,7 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleFacadeModule {
false, false,
), ),
); );
evaluation = EsmEvaluation::SideEffectFree; evaluation = EcmascriptEvaluation::SideEffectFree;
} }
ModulePart::RenamedNamespace { export } => { ModulePart::RenamedNamespace { export } => {
exports.insert( exports.insert(
...@@ -335,7 +335,7 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleFacadeModule { ...@@ -335,7 +335,7 @@ impl EcmascriptChunkPlaceable for EcmascriptModuleFacadeModule {
.await?, .await?,
)), )),
); );
evaluation = EsmEvaluation::SideEffectFree; evaluation = EcmascriptEvaluation::SideEffectFree;
} }
_ => bail!("Unexpected ModulePart for EcmascriptModuleFacadeModule"), _ => bail!("Unexpected ModulePart for EcmascriptModuleFacadeModule"),
} }
......
...@@ -28,7 +28,7 @@ use turbopack_ecmascript::{ ...@@ -28,7 +28,7 @@ use turbopack_ecmascript::{
EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable, EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable,
EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType, EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType,
}, },
references::esm::EsmEvaluation, references::esm::EcmascriptEvaluation,
runtime_functions::TURBOPACK_EXPORT_VALUE, runtime_functions::TURBOPACK_EXPORT_VALUE,
}; };
...@@ -82,7 +82,7 @@ impl EcmascriptChunkPlaceable for JsonModuleAsset { ...@@ -82,7 +82,7 @@ impl EcmascriptChunkPlaceable for JsonModuleAsset {
fn get_exports(&self) -> Vc<EcmascriptExports> { fn get_exports(&self) -> Vc<EcmascriptExports> {
EcmascriptExports { EcmascriptExports {
ty: EcmascriptExportsType::Value, ty: EcmascriptExportsType::Value,
evaluation: EsmEvaluation::SideEffects, evaluation: EcmascriptEvaluation::SideEffects,
} }
.cell() .cell()
} }
......
...@@ -15,7 +15,7 @@ use turbopack_ecmascript::{ ...@@ -15,7 +15,7 @@ use turbopack_ecmascript::{
EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable, EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable,
EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType, EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType,
}, },
references::esm::EsmEvaluation, references::esm::EcmascriptEvaluation,
runtime_functions::TURBOPACK_EXPORT_VALUE, runtime_functions::TURBOPACK_EXPORT_VALUE,
utils::StringifyJs, utils::StringifyJs,
}; };
...@@ -89,7 +89,7 @@ impl EcmascriptChunkPlaceable for StaticUrlJsModule { ...@@ -89,7 +89,7 @@ impl EcmascriptChunkPlaceable for StaticUrlJsModule {
fn get_exports(&self) -> Vc<EcmascriptExports> { fn get_exports(&self) -> Vc<EcmascriptExports> {
EcmascriptExports { EcmascriptExports {
ty: EcmascriptExportsType::Value, ty: EcmascriptExportsType::Value,
evaluation: EsmEvaluation::SideEffects, evaluation: EcmascriptEvaluation::SideEffects,
} }
.cell() .cell()
} }
......
...@@ -16,7 +16,7 @@ use turbopack_ecmascript::{ ...@@ -16,7 +16,7 @@ use turbopack_ecmascript::{
EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable, EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable,
EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType, EcmascriptChunkType, EcmascriptExports, EcmascriptExportsType,
}, },
references::esm::EsmEvaluation, references::esm::EcmascriptEvaluation,
runtime_functions::TURBOPACK_EXPORT_VALUE, runtime_functions::TURBOPACK_EXPORT_VALUE,
utils::StringifyJs, utils::StringifyJs,
}; };
...@@ -95,7 +95,7 @@ impl EcmascriptChunkPlaceable for RawWebAssemblyModuleAsset { ...@@ -95,7 +95,7 @@ impl EcmascriptChunkPlaceable for RawWebAssemblyModuleAsset {
fn get_exports(self: Vc<Self>) -> Vc<EcmascriptExports> { fn get_exports(self: Vc<Self>) -> Vc<EcmascriptExports> {
EcmascriptExports { EcmascriptExports {
ty: EcmascriptExportsType::Value, ty: EcmascriptExportsType::Value,
evaluation: EsmEvaluation::SideEffects, evaluation: EcmascriptEvaluation::SideEffects,
} }
.cell() .cell()
} }
......
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