Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
0944df74
Commit
0944df74
authored
Aug 13, 2025
by
Tobias Koppers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expose evaluation as `get_evaluation`
parent
7af2a39e
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
77 additions
and
63 deletions
+77
-63
hmr_entry.rs
crates/next-core/src/hmr_entry.rs
+2
-2
dynamic_module.rs
crates/next-core/src/next_dynamic/dynamic_module.rs
+2
-2
server_component_module.rs
...core/src/next_server_component/server_component_module.rs
+2
-2
server_utility_module.rs
...ext-core/src/next_server_utility/server_utility_module.rs
+2
-2
module_asset.rs
turbopack/crates/turbopack-css/src/module_asset.rs
+2
-2
placeable.rs
turbopack/crates/turbopack-ecmascript/src/chunk/placeable.rs
+6
-2
inlined_bytes_module.rs
...k/crates/turbopack-ecmascript/src/inlined_bytes_module.rs
+2
-0
lib.rs
turbopack/crates/turbopack-ecmascript/src/lib.rs
+24
-6
chunk_asset.rs
...k/crates/turbopack-ecmascript/src/manifest/chunk_asset.rs
+2
-2
export.rs
.../crates/turbopack-ecmascript/src/references/esm/export.rs
+4
-16
mod.rs
...ack/crates/turbopack-ecmascript/src/references/esm/mod.rs
+1
-1
external_module.rs
...es/turbopack-ecmascript/src/references/external_module.rs
+3
-3
mod.rs
turbopack/crates/turbopack-ecmascript/src/references/mod.rs
+13
-11
require_context.rs
...es/turbopack-ecmascript/src/references/require_context.rs
+2
-2
module.rs
...-ecmascript/src/side_effect_optimization/facade/module.rs
+4
-4
lib.rs
turbopack/crates/turbopack-json/src/lib.rs
+2
-2
ecma.rs
turbopack/crates/turbopack-static/src/ecma.rs
+2
-2
raw.rs
turbopack/crates/turbopack-wasm/src/raw.rs
+2
-2
No files found.
crates/next-core/src/hmr_entry.rs
View file @
0944df74
...
@@ -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
::
E
sm
Evaluation
,
references
::
esm
::
E
cmascript
Evaluation
,
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
:
E
sm
Evaluation
::
SideEffects
,
evaluation
:
E
cmascript
Evaluation
::
SideEffects
,
}
}
.cell
()
.cell
()
}
}
...
...
crates/next-core/src/next_dynamic/dynamic_module.rs
View file @
0944df74
...
@@ -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
::{
E
sm
Evaluation
,
EsmExport
,
EsmExports
},
references
::
esm
::{
E
cmascript
Evaluation
,
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
:
E
sm
Evaluation
::
DelegatedSideEffects
(
module_reference
),
evaluation
:
E
cmascript
Evaluation
::
DelegatedSideEffects
(
module_reference
),
}
}
.cell
())
.cell
())
}
}
...
...
crates/next-core/src/next_server_component/server_component_module.rs
View file @
0944df74
...
@@ -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
::{
E
sm
Evaluation
,
EsmExport
,
EsmExports
},
references
::
esm
::{
E
cmascript
Evaluation
,
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
:
E
sm
Evaluation
::
DelegatedSideEffects
(
module_reference
),
evaluation
:
E
cmascript
Evaluation
::
DelegatedSideEffects
(
module_reference
),
}
}
.cell
())
.cell
())
}
}
...
...
crates/next-core/src/next_server_utility/server_utility_module.rs
View file @
0944df74
...
@@ -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
::{
E
sm
Evaluation
,
EsmExport
,
EsmExports
},
references
::
esm
::{
E
cmascript
Evaluation
,
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
:
E
sm
Evaluation
::
DelegatedSideEffects
(
module_reference
),
evaluation
:
E
cmascript
Evaluation
::
DelegatedSideEffects
(
module_reference
),
}
}
.cell
())
.cell
())
}
}
...
...
turbopack/crates/turbopack-css/src/module_asset.rs
View file @
0944df74
...
@@ -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
::
E
sm
Evaluation
,
references
::
esm
::
E
cmascript
Evaluation
,
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
:
E
sm
Evaluation
::
SideEffects
,
evaluation
:
E
cmascript
Evaluation
::
SideEffects
,
}
}
.cell
()
.cell
()
}
}
...
...
turbopack/crates/turbopack-ecmascript/src/chunk/placeable.rs
View file @
0944df74
...
@@ -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
::{
E
sm
Evaluation
,
EsmExport
,
EsmExports
},
esm
::{
E
cmascript
Evaluation
,
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
:
E
sm
Evaluation
,
pub
evaluation
:
E
cmascript
Evaluation
,
}
}
#[derive(Debug,
Clone,
Eq,
PartialEq,
Serialize,
Deserialize,
TraceRawVcs,
NonLocalValue)]
#[derive(Debug,
Clone,
Eq,
PartialEq,
Serialize,
Deserialize,
TraceRawVcs,
NonLocalValue)]
...
...
turbopack/crates/turbopack-ecmascript/src/inlined_bytes_module.rs
View file @
0944df74
...
@@ -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
()
}
}
...
...
turbopack/crates/turbopack-ecmascript/src/lib.rs
View file @
0944df74
...
@@ -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
{
...
...
turbopack/crates/turbopack-ecmascript/src/manifest/chunk_asset.rs
View file @
0944df74
...
@@ -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
::
E
sm
Evaluation
,
references
::
esm
::
E
cmascript
Evaluation
,
};
};
/// 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
:
E
sm
Evaluation
::
SideEffects
,
evaluation
:
E
cmascript
Evaluation
::
SideEffects
,
}
}
.cell
()
.cell
()
}
}
...
...
turbopack/crates/turbopack-ecmascript/src/references/esm/export.rs
View file @
0944df74
...
@@ -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
,
...
...
turbopack/crates/turbopack-ecmascript/src/references/esm/mod.rs
View file @
0944df74
...
@@ -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
::{
E
sm
Evaluation
,
EsmExport
,
EsmExports
,
FoundExportType
,
Liveness
},
export
::{
E
cmascript
Evaluation
,
EsmExport
,
EsmExports
,
FoundExportType
,
Liveness
},
meta
::{
ImportMetaBinding
,
ImportMetaRef
},
meta
::{
ImportMetaBinding
,
ImportMetaRef
},
module_item
::
EsmModuleItem
,
module_item
::
EsmModuleItem
,
url
::{
UrlAssetReference
,
UrlRewriteBehavior
},
url
::{
UrlAssetReference
,
UrlRewriteBehavior
},
...
...
turbopack/crates/turbopack-ecmascript/src/references/external_module.rs
View file @
0944df74
...
@@ -28,7 +28,7 @@ use crate::{
...
@@ -28,7 +28,7 @@ use crate::{
},
},
references
::{
references
::{
async_module
::{
AsyncModule
,
OptionAsyncModule
},
async_module
::{
AsyncModule
,
OptionAsyncModule
},
esm
::
E
sm
Evaluation
,
esm
::
E
cmascript
Evaluation
,
},
},
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
:
E
sm
Evaluation
::
SideEffects
,
evaluation
:
E
cmascript
Evaluation
::
SideEffects
,
}
}
.cell
()
.cell
()
}
else
{
}
else
{
EcmascriptExports
{
EcmascriptExports
{
ty
:
EcmascriptExportsType
::
DynamicNamespace
,
ty
:
EcmascriptExportsType
::
DynamicNamespace
,
evaluation
:
E
sm
Evaluation
::
SideEffects
,
evaluation
:
E
cmascript
Evaluation
::
SideEffects
,
}
}
.cell
()
.cell
()
}
}
...
...
turbopack/crates/turbopack-ecmascript/src/references/mod.rs
View file @
0944df74
...
@@ -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
::{
E
sm
Evaluation
,
Liveness
},
export
::{
E
cmascript
Evaluation
,
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
:
E
sm
Evaluation
,
evaluation
:
E
cmascript
Evaluation
,
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
:
E
sm
Evaluation
::
SideEffects
,
evaluation
:
E
cmascript
Evaluation
::
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
:
E
sm
Evaluation
)
{
pub
fn
set_evaluation
(
&
mut
self
,
evaluation
:
E
cmascript
Evaluation
)
{
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
(),
.await
?
;
options
.side_effect_free_packages
.map
(|
l
|
*
l
),
)
.await
?
;
let
evaluation
=
if
marked_as_side_effect_free
{
let
evaluation
=
if
marked_as_side_effect_free
{
E
sm
Evaluation
::
SideEffectFree
E
cmascript
Evaluation
::
SideEffectFree
}
else
{
}
else
{
E
sm
Evaluation
::
SideEffects
E
cmascript
Evaluation
::
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
{
E
sm
Evaluation
::
SideEffectFree
E
cmascript
Evaluation
::
SideEffectFree
}
else
{
}
else
{
E
sm
Evaluation
::
SideEffects
E
cmascript
Evaluation
::
SideEffects
};
};
analysis
.set_evaluation
(
evaluation
);
analysis
.set_evaluation
(
evaluation
);
...
...
turbopack/crates/turbopack-ecmascript/src/references/require_context.rs
View file @
0944df74
...
@@ -47,7 +47,7 @@ use crate::{
...
@@ -47,7 +47,7 @@ use crate::{
create_visitor
,
create_visitor
,
references
::{
references
::{
AstPath
,
AstPath
,
esm
::
E
sm
Evaluation
,
esm
::
E
cmascript
Evaluation
,
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
:
E
sm
Evaluation
::
SideEffects
,
evaluation
:
E
cmascript
Evaluation
::
SideEffects
,
}
}
.cell
()
.cell
()
}
}
...
...
turbopack/crates/turbopack-ecmascript/src/side_effect_optimization/facade/module.rs
View file @
0944df74
...
@@ -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
::{
E
sm
Evaluation
,
Liveness
},
export
::{
E
cmascript
Evaluation
,
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
=
E
sm
Evaluation
::
DelegatedSideEffects
(
ResolvedVc
::
upcast
(
evaluation
=
E
cmascript
Evaluation
::
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
=
E
sm
Evaluation
::
SideEffectFree
;
evaluation
=
E
cmascript
Evaluation
::
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
=
E
sm
Evaluation
::
SideEffectFree
;
evaluation
=
E
cmascript
Evaluation
::
SideEffectFree
;
}
}
_
=>
bail!
(
"Unexpected ModulePart for EcmascriptModuleFacadeModule"
),
_
=>
bail!
(
"Unexpected ModulePart for EcmascriptModuleFacadeModule"
),
}
}
...
...
turbopack/crates/turbopack-json/src/lib.rs
View file @
0944df74
...
@@ -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
::
E
sm
Evaluation
,
references
::
esm
::
E
cmascript
Evaluation
,
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
:
E
sm
Evaluation
::
SideEffects
,
evaluation
:
E
cmascript
Evaluation
::
SideEffects
,
}
}
.cell
()
.cell
()
}
}
...
...
turbopack/crates/turbopack-static/src/ecma.rs
View file @
0944df74
...
@@ -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
::
E
sm
Evaluation
,
references
::
esm
::
E
cmascript
Evaluation
,
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
:
E
sm
Evaluation
::
SideEffects
,
evaluation
:
E
cmascript
Evaluation
::
SideEffects
,
}
}
.cell
()
.cell
()
}
}
...
...
turbopack/crates/turbopack-wasm/src/raw.rs
View file @
0944df74
...
@@ -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
::
E
sm
Evaluation
,
references
::
esm
::
E
cmascript
Evaluation
,
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
:
E
sm
Evaluation
::
SideEffects
,
evaluation
:
E
cmascript
Evaluation
::
SideEffects
,
}
}
.cell
()
.cell
()
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment