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
9d91d913
Commit
9d91d913
authored
Aug 20, 2025
by
Tobias Koppers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: Tree Shaking imports only internal
parent
2f24574a
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
73 additions
and
116 deletions
+73
-116
imports.rs
...opack/crates/turbopack-ecmascript/src/analyzer/imports.rs
+3
-6
graph.rs
...opack/crates/turbopack-ecmascript/src/tree_shake/graph.rs
+20
-64
merge.rs
...opack/crates/turbopack-ecmascript/src/tree_shake/merge.rs
+2
-2
mod.rs
turbopack/crates/turbopack-ecmascript/src/tree_shake/mod.rs
+33
-29
bf321_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_a280e616.js
...hot_basic-tree-shake_dynamic-import_input_lib_a280e616.js
+5
-5
bf321_tests_snapshot_basic-tree-shake_require-side-effect_input_341cf5f1._.js
..._basic-tree-shake_require-side-effect_input_341cf5f1._.js
+5
-5
bf321_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_18e65124.js
...asic-tree-shake_tree-shake-test-1_input_index_18e65124.js
+5
-5
No files found.
turbopack/crates/turbopack-ecmascript/src/analyzer/imports.rs
View file @
9d91d913
...
@@ -20,7 +20,7 @@ use crate::{
...
@@ -20,7 +20,7 @@ use crate::{
SpecifiedModuleType
,
SpecifiedModuleType
,
analyzer
::{
ConstantValue
,
ObjectPart
},
analyzer
::{
ConstantValue
,
ObjectPart
},
magic_identifier
,
magic_identifier
,
tree_shake
::
{
PartId
,
find_turbopack_part_id_in_asserts
}
,
tree_shake
::
find_turbopack_part_id_in_asserts
,
};
};
#[turbo_tasks
::
value]
#[turbo_tasks
::
value]
...
@@ -819,11 +819,8 @@ pub(crate) fn orig_name(n: &ModuleExportName) -> Atom {
...
@@ -819,11 +819,8 @@ pub(crate) fn orig_name(n: &ModuleExportName) -> Atom {
fn
parse_with
(
with
:
Option
<&
ObjectLit
>
)
->
Option
<
ImportedSymbol
>
{
fn
parse_with
(
with
:
Option
<&
ObjectLit
>
)
->
Option
<
ImportedSymbol
>
{
find_turbopack_part_id_in_asserts
(
with
?
)
.map
(|
v
|
match
v
{
find_turbopack_part_id_in_asserts
(
with
?
)
.map
(|
v
|
match
v
{
PartId
::
Internal
(
index
,
true
)
=>
ImportedSymbol
::
PartEvaluation
(
index
),
(
index
,
true
)
=>
ImportedSymbol
::
PartEvaluation
(
index
),
PartId
::
Internal
(
index
,
false
)
=>
ImportedSymbol
::
Part
(
index
),
(
index
,
false
)
=>
ImportedSymbol
::
Part
(
index
),
PartId
::
ModuleEvaluation
=>
ImportedSymbol
::
ModuleEvaluation
,
PartId
::
Export
(
e
)
=>
ImportedSymbol
::
Symbol
(
e
.as_str
()
.into
()),
PartId
::
Exports
=>
ImportedSymbol
::
Exports
,
})
})
}
}
...
...
turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs
View file @
9d91d913
...
@@ -24,7 +24,6 @@ use swc_core::{
...
@@ -24,7 +24,6 @@ use swc_core::{
utils
::{
ExprCtx
,
ExprExt
,
find_pat_ids
,
quote_ident
},
utils
::{
ExprCtx
,
ExprExt
,
find_pat_ids
,
quote_ident
},
},
},
};
};
use
turbo_rcstr
::
RcStr
;
use
turbo_tasks
::
FxIndexSet
;
use
turbo_tasks
::
FxIndexSet
;
use
super
::{
use
super
::{
...
@@ -254,7 +253,7 @@ pub(super) struct SplitModuleResult {
...
@@ -254,7 +253,7 @@ pub(super) struct SplitModuleResult {
pub
entrypoints
:
FxHashMap
<
Key
,
u32
>
,
pub
entrypoints
:
FxHashMap
<
Key
,
u32
>
,
/// Dependency between parts.
/// Dependency between parts.
pub
part_deps
:
FxHashMap
<
u32
,
Vec
<
PartId
>>
,
pub
part_deps
:
FxHashMap
<
u32
,
Vec
<
(
u32
,
bool
)
>>
,
pub
modules
:
Vec
<
Module
>
,
pub
modules
:
Vec
<
Module
>
,
pub
star_reexports
:
Vec
<
ExportAll
>
,
pub
star_reexports
:
Vec
<
ExportAll
>
,
...
@@ -295,7 +294,7 @@ impl DepGraph {
...
@@ -295,7 +294,7 @@ impl DepGraph {
)
->
SplitModuleResult
{
)
->
SplitModuleResult
{
let
groups
=
self
.finalize
(
data
);
let
groups
=
self
.finalize
(
data
);
let
mut
outputs
=
FxHashMap
::
default
();
let
mut
outputs
=
FxHashMap
::
default
();
let
mut
part_deps
=
FxHashMap
::
<
_
,
Vec
<
PartId
>>
::
default
();
let
mut
part_deps
=
FxHashMap
::
<
_
,
Vec
<
(
u32
,
bool
)
>>
::
default
();
let
star_reexports
:
Vec
<
_
>
=
data
let
star_reexports
:
Vec
<
_
>
=
data
.values
()
.values
()
...
@@ -396,10 +395,7 @@ impl DepGraph {
...
@@ -396,10 +395,7 @@ impl DepGraph {
&&
*
dep
!=
ix
as
u32
&&
*
dep
!=
ix
as
u32
&&
part_deps_done
.insert
(
*
dep
)
&&
part_deps_done
.insert
(
*
dep
)
{
{
part_deps
part_deps
.entry
(
ix
as
u32
)
.or_default
()
.push
((
*
dep
,
true
));
.entry
(
ix
as
u32
)
.or_default
()
.push
(
PartId
::
Internal
(
*
dep
,
true
));
chunk
chunk
.body
.body
...
@@ -408,9 +404,7 @@ impl DepGraph {
...
@@ -408,9 +404,7 @@ impl DepGraph {
specifiers
:
vec!
[],
specifiers
:
vec!
[],
src
:
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
()),
src
:
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
()),
type_only
:
false
,
type_only
:
false
,
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
*
dep
,
true
))),
PartId
::
Internal
(
*
dep
,
true
),
))),
phase
:
Default
::
default
(),
phase
:
Default
::
default
(),
})));
})));
}
}
...
@@ -439,7 +433,7 @@ impl DepGraph {
...
@@ -439,7 +433,7 @@ impl DepGraph {
src
:
Some
(
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
())),
src
:
Some
(
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
())),
type_only
:
false
,
type_only
:
false
,
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
PartId
::
Export
(
export
.as_str
()
.into
())
,
ix
as
u32
,
false
,
))),
))),
}),
}),
));
));
...
@@ -477,7 +471,6 @@ impl DepGraph {
...
@@ -477,7 +471,6 @@ impl DepGraph {
required_vars
.swap_remove
(
var
);
required_vars
.swap_remove
(
var
);
let
dep_part_id
=
PartId
::
Export
(
export
.as_str
()
.into
());
let
specifiers
=
vec!
[
ImportSpecifier
::
Named
(
ImportNamedSpecifier
{
let
specifiers
=
vec!
[
ImportSpecifier
::
Named
(
ImportNamedSpecifier
{
span
:
DUMMY_SP
,
span
:
DUMMY_SP
,
local
:
var
.clone
()
.into
(),
local
:
var
.clone
()
.into
(),
...
@@ -485,10 +478,7 @@ impl DepGraph {
...
@@ -485,10 +478,7 @@ impl DepGraph {
is_type_only
:
false
,
is_type_only
:
false
,
})];
})];
part_deps
part_deps
.entry
(
ix
as
u32
)
.or_default
()
.push
((
dep
,
true
));
.entry
(
ix
as
u32
)
.or_default
()
.push
(
dep_part_id
.clone
());
chunk
chunk
.body
.body
...
@@ -497,7 +487,7 @@ impl DepGraph {
...
@@ -497,7 +487,7 @@ impl DepGraph {
specifiers
,
specifiers
,
src
:
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
()),
src
:
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
()),
type_only
:
false
,
type_only
:
false
,
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
dep
_part_id
))),
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
dep
,
true
))),
phase
:
Default
::
default
(),
phase
:
Default
::
default
(),
})));
})));
}
}
...
@@ -537,7 +527,7 @@ impl DepGraph {
...
@@ -537,7 +527,7 @@ impl DepGraph {
part_deps
part_deps
.entry
(
ix
as
u32
)
.entry
(
ix
as
u32
)
.or_default
()
.or_default
()
.push
(
PartId
::
Internal
(
*
import_dep
,
true
));
.push
((
*
import_dep
,
true
));
chunk
.body
.push
(
ModuleItem
::
ModuleDecl
(
ModuleDecl
::
Import
(
chunk
.body
.push
(
ModuleItem
::
ModuleDecl
(
ModuleDecl
::
Import
(
ImportDecl
{
ImportDecl
{
...
@@ -546,7 +536,8 @@ impl DepGraph {
...
@@ -546,7 +536,8 @@ impl DepGraph {
src
:
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
()),
src
:
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
()),
type_only
:
false
,
type_only
:
false
,
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
PartId
::
Internal
(
*
import_dep
,
true
),
*
import_dep
,
true
,
))),
))),
phase
:
Default
::
default
(),
phase
:
Default
::
default
(),
},
},
...
@@ -581,10 +572,7 @@ impl DepGraph {
...
@@ -581,10 +572,7 @@ impl DepGraph {
is_type_only
:
false
,
is_type_only
:
false
,
})];
})];
part_deps
part_deps
.entry
(
ix
as
u32
)
.or_default
()
.push
((
dep
,
false
));
.entry
(
ix
as
u32
)
.or_default
()
.push
(
PartId
::
Internal
(
dep
,
false
));
chunk
chunk
.body
.body
...
@@ -593,9 +581,7 @@ impl DepGraph {
...
@@ -593,9 +581,7 @@ impl DepGraph {
specifiers
,
specifiers
,
src
:
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
()),
src
:
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
()),
type_only
:
false
,
type_only
:
false
,
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
PartId
::
Internal
(
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
dep
,
false
))),
dep
,
false
,
)))),
phase
:
Default
::
default
(),
phase
:
Default
::
default
(),
})));
})));
}
}
...
@@ -613,10 +599,7 @@ impl DepGraph {
...
@@ -613,10 +599,7 @@ impl DepGraph {
continue
;
continue
;
}
}
part_deps
part_deps
.entry
(
ix
as
u32
)
.or_default
()
.push
((
dep
,
true
));
.entry
(
ix
as
u32
)
.or_default
()
.push
(
PartId
::
Internal
(
dep
,
true
));
chunk
chunk
.body
.body
...
@@ -625,9 +608,7 @@ impl DepGraph {
...
@@ -625,9 +608,7 @@ impl DepGraph {
specifiers
:
vec!
[],
specifiers
:
vec!
[],
src
:
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
()),
src
:
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
()),
type_only
:
false
,
type_only
:
false
,
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
PartId
::
Internal
(
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
dep
,
true
))),
dep
,
true
,
)))),
phase
:
Default
::
default
(),
phase
:
Default
::
default
(),
})));
})));
}
}
...
@@ -1646,54 +1627,29 @@ impl DepGraph {
...
@@ -1646,54 +1627,29 @@ impl DepGraph {
const
ASSERT_CHUNK_KEY
:
&
str
=
"__turbopack_part__"
;
const
ASSERT_CHUNK_KEY
:
&
str
=
"__turbopack_part__"
;
#[derive(Debug,
Clone)]
pub
(
crate
)
fn
create_turbopack_part_id_assert
(
dep
:
u32
,
is_for_eval
:
bool
)
->
ObjectLit
{
pub
(
crate
)
enum
PartId
{
ModuleEvaluation
,
Exports
,
Export
(
RcStr
),
/// `(part_id, is_for_eval)`
Internal
(
u32
,
bool
),
}
pub
(
crate
)
fn
create_turbopack_part_id_assert
(
dep
:
PartId
)
->
ObjectLit
{
// We can't use quote! as `with` is not standard yet
// We can't use quote! as `with` is not standard yet
ObjectLit
{
ObjectLit
{
span
:
DUMMY_SP
,
span
:
DUMMY_SP
,
props
:
vec!
[
PropOrSpread
::
Prop
(
Box
::
new
(
Prop
::
KeyValue
(
KeyValueProp
{
props
:
vec!
[
PropOrSpread
::
Prop
(
Box
::
new
(
Prop
::
KeyValue
(
KeyValueProp
{
key
:
PropName
::
Ident
(
IdentName
::
new
(
ASSERT_CHUNK_KEY
.into
(),
DUMMY_SP
)),
key
:
PropName
::
Ident
(
IdentName
::
new
(
ASSERT_CHUNK_KEY
.into
(),
DUMMY_SP
)),
value
:
match
dep
{
value
:
{
PartId
::
ModuleEvaluation
=>
"module evaluation"
.into
(),
PartId
::
Exports
=>
"exports"
.into
(),
PartId
::
Export
(
e
)
=>
format!
(
"export {e}"
)
.into
(),
PartId
::
Internal
(
dep
,
is_for_eval
)
=>
{
let
v
=
dep
as
f64
;
let
v
=
dep
as
f64
;
if
is_for_eval
{
v
}
else
{
-
v
}
if
is_for_eval
{
v
}
else
{
-
v
}
.into
()
}
.into
(),
},
},
})))],
})))],
}
}
}
}
pub
(
crate
)
fn
find_turbopack_part_id_in_asserts
(
asserts
:
&
ObjectLit
)
->
Option
<
PartId
>
{
pub
(
crate
)
fn
find_turbopack_part_id_in_asserts
(
asserts
:
&
ObjectLit
)
->
Option
<
(
u32
,
bool
)
>
{
asserts
.props
.iter
()
.find_map
(|
prop
|
match
prop
{
asserts
.props
.iter
()
.find_map
(|
prop
|
match
prop
{
PropOrSpread
::
Prop
(
box
Prop
::
KeyValue
(
KeyValueProp
{
PropOrSpread
::
Prop
(
box
Prop
::
KeyValue
(
KeyValueProp
{
key
:
PropName
::
Ident
(
key
),
key
:
PropName
::
Ident
(
key
),
value
:
box
Expr
::
Lit
(
Lit
::
Num
(
chunk_id
)),
value
:
box
Expr
::
Lit
(
Lit
::
Num
(
chunk_id
)),
}))
if
&*
key
.sym
==
ASSERT_CHUNK_KEY
=>
Some
(
PartId
::
Internal
(
}))
if
&*
key
.sym
==
ASSERT_CHUNK_KEY
=>
Some
((
chunk_id
.value
.abs
()
as
u32
,
chunk_id
.value
.abs
()
as
u32
,
chunk_id
.value
.is_sign_positive
(),
chunk_id
.value
.is_sign_positive
(),
)),
)),
PropOrSpread
::
Prop
(
box
Prop
::
KeyValue
(
KeyValueProp
{
key
:
PropName
::
Ident
(
key
),
value
:
box
Expr
::
Lit
(
Lit
::
Str
(
s
)),
}))
if
&*
key
.sym
==
ASSERT_CHUNK_KEY
=>
match
&*
s
.value
{
"module evaluation"
=>
Some
(
PartId
::
ModuleEvaluation
),
"exports"
=>
Some
(
PartId
::
Exports
),
_
if
s
.value
.starts_with
(
"export "
)
=>
Some
(
PartId
::
Export
(
s
.value
[
7
..
]
.into
())),
_
=>
None
,
},
_
=>
None
,
_
=>
None
,
})
})
}
}
...
...
turbopack/crates/turbopack-ecmascript/src/tree_shake/merge.rs
View file @
9d91d913
...
@@ -5,7 +5,7 @@ use swc_core::ecma::{
...
@@ -5,7 +5,7 @@ use swc_core::ecma::{
atoms
::
Atom
,
atoms
::
Atom
,
};
};
use
super
::
{
PartId
,
graph
::
find_turbopack_part_id_in_asserts
}
;
use
super
::
graph
::
find_turbopack_part_id_in_asserts
;
/// A loader used to merge module items after splitting.
/// A loader used to merge module items after splitting.
pub
trait
Load
{
pub
trait
Load
{
...
@@ -53,7 +53,7 @@ where
...
@@ -53,7 +53,7 @@ where
.as_deref
()
.as_deref
()
.and_then
(
find_turbopack_part_id_in_asserts
);
.and_then
(
find_turbopack_part_id_in_asserts
);
if
let
Some
(
PartId
::
Internal
(
part_id
,
_
))
=
part_id
{
if
let
Some
((
part_id
,
_
))
=
part_id
{
if
self
.done
.insert
((
import
.src.value
.clone
(),
part_id
))
{
if
self
.done
.insert
((
import
.src.value
.clone
(),
part_id
))
{
if
let
Some
(
dep
)
=
self
.loader
.load
(
&
import
.src.value
,
part_id
)
?
{
if
let
Some
(
dep
)
=
self
.loader
.load
(
&
import
.src.value
,
part_id
)
?
{
let
mut
dep
=
self
.merge_recursively
(
dep
)
?
;
let
mut
dep
=
self
.merge_recursively
(
dep
)
?
;
...
...
turbopack/crates/turbopack-ecmascript/src/tree_shake/mod.rs
View file @
9d91d913
...
@@ -17,9 +17,7 @@ use turbo_tasks::{FxIndexSet, ResolvedVc, ValueToString, Vc};
...
@@ -17,9 +17,7 @@ use turbo_tasks::{FxIndexSet, ResolvedVc, ValueToString, Vc};
use
turbopack_core
::{
ident
::
AssetIdent
,
resolve
::
ModulePart
,
source
::
Source
};
use
turbopack_core
::{
ident
::
AssetIdent
,
resolve
::
ModulePart
,
source
::
Source
};
use
self
::
graph
::{
DepGraph
,
ItemData
,
ItemId
,
ItemIdGroupKind
,
Mode
,
SplitModuleResult
};
use
self
::
graph
::{
DepGraph
,
ItemData
,
ItemId
,
ItemIdGroupKind
,
Mode
,
SplitModuleResult
};
pub
(
crate
)
use
self
::
graph
::{
pub
(
crate
)
use
self
::
graph
::{
create_turbopack_part_id_assert
,
find_turbopack_part_id_in_asserts
};
PartId
,
create_turbopack_part_id_assert
,
find_turbopack_part_id_in_asserts
,
};
use
crate
::{
use
crate
::{
EcmascriptModuleAsset
,
EcmascriptParsable
,
analyzer
::
graph
::
EvalContext
,
parse
::
ParseResult
,
EcmascriptModuleAsset
,
EcmascriptParsable
,
analyzer
::
graph
::
EvalContext
,
parse
::
ParseResult
,
};
};
...
@@ -450,7 +448,7 @@ pub(crate) enum SplitResult {
...
@@ -450,7 +448,7 @@ pub(crate) enum SplitResult {
modules
:
Vec
<
ResolvedVc
<
ParseResult
>>
,
modules
:
Vec
<
ResolvedVc
<
ParseResult
>>
,
#[turbo_tasks(trace_ignore)]
#[turbo_tasks(trace_ignore)]
deps
:
FxHashMap
<
u32
,
Vec
<
PartId
>>
,
deps
:
FxHashMap
<
u32
,
Vec
<
(
u32
,
bool
)
>>
,
#[turbo_tasks(debug_ignore,
trace_ignore)]
#[turbo_tasks(debug_ignore,
trace_ignore)]
star_reexports
:
Vec
<
ExportAll
>
,
star_reexports
:
Vec
<
ExportAll
>
,
...
@@ -641,6 +639,7 @@ pub(crate) async fn part_of_module(
...
@@ -641,6 +639,7 @@ pub(crate) async fn part_of_module(
.collect
::
<
Vec
<
_
>>
();
.collect
::
<
Vec
<
_
>>
();
export_names
.sort
();
export_names
.sort
();
if
let
Some
(
evaluation_id
)
=
entrypoints
.get
(
&
Key
::
ModuleEvaluation
)
{
module
module
.body
.body
.push
(
ModuleItem
::
ModuleDecl
(
ModuleDecl
::
Import
(
ImportDecl
{
.push
(
ModuleItem
::
ModuleDecl
(
ModuleDecl
::
Import
(
ImportDecl
{
...
@@ -649,10 +648,12 @@ pub(crate) async fn part_of_module(
...
@@ -649,10 +648,12 @@ pub(crate) async fn part_of_module(
src
:
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
()),
src
:
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
()),
type_only
:
false
,
type_only
:
false
,
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
PartId
::
ModuleEvaluation
,
*
evaluation_id
,
true
,
))),
))),
phase
:
Default
::
default
(),
phase
:
Default
::
default
(),
})));
})));
}
let
specifiers
=
export_names
let
specifiers
=
export_names
.into_iter
()
.into_iter
()
...
@@ -670,6 +671,7 @@ pub(crate) async fn part_of_module(
...
@@ -670,6 +671,7 @@ pub(crate) async fn part_of_module(
})
})
.collect
::
<
Vec
<
_
>>
();
.collect
::
<
Vec
<
_
>>
();
if
let
Some
(
exports_id
)
=
entrypoints
.get
(
&
Key
::
Exports
)
{
module
module
.body
.body
.push
(
ModuleItem
::
ModuleDecl
(
ModuleDecl
::
ExportNamed
(
.push
(
ModuleItem
::
ModuleDecl
(
ModuleDecl
::
ExportNamed
(
...
@@ -679,10 +681,12 @@ pub(crate) async fn part_of_module(
...
@@ -679,10 +681,12 @@ pub(crate) async fn part_of_module(
src
:
Some
(
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
())),
src
:
Some
(
Box
::
new
(
TURBOPACK_PART_IMPORT_SOURCE
.into
())),
type_only
:
false
,
type_only
:
false
,
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
with
:
Some
(
Box
::
new
(
create_turbopack_part_id_assert
(
PartId
::
Exports
,
*
exports_id
,
false
,
))),
))),
},
},
)));
)));
}
module
.body
.extend
(
star_reexports
.iter
()
.map
(|
export_all
|
{
module
.body
.extend
(
star_reexports
.iter
()
.map
(|
export_all
|
{
ModuleItem
::
ModuleDecl
(
ModuleDecl
::
ExportAll
(
export_all
.clone
()))
ModuleItem
::
ModuleDecl
(
ModuleDecl
::
ExportAll
(
export_all
.clone
()))
...
...
turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/output/bf321_tests_snapshot_basic-tree-shake_dynamic-import_input_lib_a280e616.js
View file @
9d91d913
...
@@ -167,16 +167,16 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo
...
@@ -167,16 +167,16 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo
__turbopack_context__
.
s
([
__turbopack_context__
.
s
([
"cat"
,
"cat"
,
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports
$3e$__
[
"cat"
],
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9
$3e$__
[
"cat"
],
"dogRef"
,
"dogRef"
,
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports
$3e$__
[
"dogRef"
],
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9
$3e$__
[
"dogRef"
],
"getChimera"
,
"getChimera"
,
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports
$3e$__
[
"getChimera"
],
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9
$3e$__
[
"getChimera"
],
"initialCat"
,
"initialCat"
,
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports
$3e$__
[
"initialCat"
]
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9
$3e$__
[
"initialCat"
]
]);
]);
var
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__2$3e$__
=
__turbopack_context__
.
i
(
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) <internal part 2>"
);
var
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__2$3e$__
=
__turbopack_context__
.
i
(
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) <internal part 2>"
);
var
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports$3e$__
=
__turbopack_context__
.
i
(
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) <exports
>"
);
var
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$dynamic$2d$import$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9$3e$__
=
__turbopack_context__
.
i
(
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/dynamic-import/input/lib.js [test] (ecmascript) <internal part 9
>"
);
;
;
;
;
}),
}),
...
...
turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/output/bf321_tests_snapshot_basic-tree-shake_require-side-effect_input_341cf5f1._.js
View file @
9d91d913
...
@@ -167,16 +167,16 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo
...
@@ -167,16 +167,16 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo
__turbopack_context__
.
s
([
__turbopack_context__
.
s
([
"cat"
,
"cat"
,
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports
$3e$__
[
"cat"
],
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9
$3e$__
[
"cat"
],
"dogRef"
,
"dogRef"
,
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports
$3e$__
[
"dogRef"
],
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9
$3e$__
[
"dogRef"
],
"getChimera"
,
"getChimera"
,
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports
$3e$__
[
"getChimera"
],
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9
$3e$__
[
"getChimera"
],
"initialCat"
,
"initialCat"
,
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports
$3e$__
[
"initialCat"
]
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9
$3e$__
[
"initialCat"
]
]);
]);
var
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__2$3e$__
=
__turbopack_context__
.
i
(
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) <internal part 2>"
);
var
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__2$3e$__
=
__turbopack_context__
.
i
(
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) <internal part 2>"
);
var
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports$3e$__
=
__turbopack_context__
.
i
(
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) <exports
>"
);
var
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$require$2d$side$2d$effect$2f$input$2f$lib$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9$3e$__
=
__turbopack_context__
.
i
(
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/require-side-effect/input/lib.js [test] (ecmascript) <internal part 9
>"
);
;
;
;
;
}),
}),
...
...
turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/output/bf321_tests_snapshot_basic-tree-shake_tree-shake-test-1_input_index_18e65124.js
View file @
9d91d913
...
@@ -167,16 +167,16 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo
...
@@ -167,16 +167,16 @@ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbo
__turbopack_context__
.
s
([
__turbopack_context__
.
s
([
"cat"
,
"cat"
,
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports
$3e$__
[
"cat"
],
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9
$3e$__
[
"cat"
],
"dogRef"
,
"dogRef"
,
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports
$3e$__
[
"dogRef"
],
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9
$3e$__
[
"dogRef"
],
"getChimera"
,
"getChimera"
,
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports
$3e$__
[
"getChimera"
],
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9
$3e$__
[
"getChimera"
],
"initialCat"
,
"initialCat"
,
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports
$3e$__
[
"initialCat"
]
()
=>
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9
$3e$__
[
"initialCat"
]
]);
]);
var
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__2$3e$__
=
__turbopack_context__
.
i
(
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) <internal part 2>"
);
var
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$internal__part__2$3e$__
=
__turbopack_context__
.
i
(
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) <internal part 2>"
);
var
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
exports$3e$__
=
__turbopack_context__
.
i
(
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) <exports
>"
);
var
__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$basic$2d$tree$2d$shake$2f$tree$2d$shake$2d$test$2d$1$2f$input$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__$3c$
internal__part__9$3e$__
=
__turbopack_context__
.
i
(
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic-tree-shake/tree-shake-test-1/input/index.js [test] (ecmascript) <internal part 9
>"
);
;
;
;
;
}),
}),
...
...
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