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
5e478e9f
Commit
5e478e9f
authored
Sep 18, 2025
by
Niklas Mischkulnig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrap link_shallow
parent
cdcf73e1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
185 additions
and
120 deletions
+185
-120
analyzer.rs
turbopack/crates/turbopack-ecmascript/benches/analyzer.rs
+1
-0
linker.rs
turbopack/crates/turbopack-ecmascript/src/analyzer/linker.rs
+169
-116
mod.rs
turbopack/crates/turbopack-ecmascript/src/analyzer/mod.rs
+1
-0
mod.rs
turbopack/crates/turbopack-ecmascript/src/references/mod.rs
+14
-4
No files found.
turbopack/crates/turbopack-ecmascript/benches/analyzer.rs
View file @
5e478e9f
...
@@ -117,6 +117,7 @@ fn bench_link(b: &mut Bencher, input: &BenchInput) {
...
@@ -117,6 +117,7 @@ fn bench_link(b: &mut Bencher, input: &BenchInput) {
link
(
link
(
&
input
.var_graph
,
&
input
.var_graph
,
val
.clone
(),
val
.clone
(),
&
|
v
|
v
,
&
early_visitor
,
&
early_visitor
,
&
(|
val
|
visitor
(
val
,
compile_time_info
,
ImportAttributes
::
empty_ref
())),
&
(|
val
|
visitor
(
val
,
compile_time_info
,
ImportAttributes
::
empty_ref
())),
&
Default
::
default
(),
&
Default
::
default
(),
...
...
turbopack/crates/turbopack-ecmascript/src/analyzer/linker.rs
View file @
5e478e9f
This diff is collapsed.
Click to expand it.
turbopack/crates/turbopack-ecmascript/src/analyzer/mod.rs
View file @
5e478e9f
...
@@ -4199,6 +4199,7 @@ mod tests {
...
@@ -4199,6 +4199,7 @@ mod tests {
link
(
link
(
var_graph
,
var_graph
,
val
,
val
,
&
|
v
|
v
,
&
super
::
test_utils
::
early_visitor
,
&
super
::
test_utils
::
early_visitor
,
&
(|
val
|
{
&
(|
val
|
{
Box
::
pin
(
super
::
test_utils
::
visitor
(
Box
::
pin
(
super
::
test_utils
::
visitor
(
...
...
turbopack/crates/turbopack-ecmascript/src/references/mod.rs
View file @
5e478e9f
...
@@ -136,7 +136,6 @@ use crate::{
...
@@ -136,7 +136,6 @@ use crate::{
builtin
::
early_replace_builtin
,
builtin
::
early_replace_builtin
,
graph
::{
ConditionalKind
,
EffectArg
,
EvalContext
,
VarGraph
},
graph
::{
ConditionalKind
,
EffectArg
,
EvalContext
,
VarGraph
},
imports
::{
ImportAnnotations
,
ImportAttributes
,
ImportedSymbol
,
Reexport
},
imports
::{
ImportAnnotations
,
ImportAttributes
,
ImportedSymbol
,
Reexport
},
linker
::
link_shallow
,
parse_require_context
,
parse_require_context
,
top_level_await
::
has_top_level_await
,
top_level_await
::
has_top_level_await
,
},
},
...
@@ -450,6 +449,7 @@ impl AnalysisState<'_> {
...
@@ -450,6 +449,7 @@ impl AnalysisState<'_> {
Ok
(
link
(
Ok
(
link
(
self
.var_graph
,
self
.var_graph
,
value
,
value
,
&
|
v
|
v
,
&
early_value_visitor
,
&
early_value_visitor
,
&
|
value
|
{
&
|
value
|
{
value_visitor
(
value_visitor
(
...
@@ -474,10 +474,12 @@ impl AnalysisState<'_> {
...
@@ -474,10 +474,12 @@ impl AnalysisState<'_> {
&
self
,
&
self
,
value
:
JsValue
,
value
:
JsValue
,
attributes
:
&
ImportAttributes
,
attributes
:
&
ImportAttributes
,
earliest_toplevel_visitor
:
&
impl
Fn
(
JsValue
)
->
JsValue
,
)
->
Result
<
JsValue
>
{
)
->
Result
<
JsValue
>
{
link
_shallow
(
link
(
self
.var_graph
,
self
.var_graph
,
value
,
value
,
earliest_toplevel_visitor
,
&
early_value_visitor
,
&
early_value_visitor
,
&
|
value
|
{
&
|
value
|
{
value_visitor
(
value_visitor
(
...
@@ -493,7 +495,8 @@ impl AnalysisState<'_> {
...
@@ -493,7 +495,8 @@ impl AnalysisState<'_> {
&
self
.fun_args_values
,
&
self
.fun_args_values
,
&
self
.var_cache
,
&
self
.var_cache
,
)
)
.await
.await
?
.
0
)
}
}
async
fn
link_truthy
(
&
self
,
value
:
JsValue
,
attributes
:
&
ImportAttributes
)
->
Result
<
JsValue
>
{
async
fn
link_truthy
(
&
self
,
value
:
JsValue
,
attributes
:
&
ImportAttributes
)
->
Result
<
JsValue
>
{
...
@@ -508,7 +511,14 @@ impl AnalysisState<'_> {
...
@@ -508,7 +511,14 @@ impl AnalysisState<'_> {
// We are only interested in well-known functions, the only JsValues that can evaluated to
// We are only interested in well-known functions, the only JsValues that can evaluated to
// that are WellKnownFunction-s, and Variables that point to them. Anything else can be
// that are WellKnownFunction-s, and Variables that point to them. Anything else can be
// short circuited.
// short circuited.
let
value
=
self
.unsafe_link_value_shallow
(
value
,
attributes
)
.await
?
;
let
value
=
self
.unsafe_link_value_shallow
(
value
,
attributes
,
&
|
v
|
match
v
{
JsValue
::
Alternatives
{
..
}
|
JsValue
::
FreeVar
{
..
}
|
JsValue
::
Member
{
..
}
=>
{
v
}
_
=>
JsValue
::
unknown
(
v
,
false
,
"earliest visitor well known function"
),
})
.await
?
;
Ok
(
match
value
{
Ok
(
match
value
{
JsValue
::
WellKnownFunction
(
kind
)
=>
vec!
[
kind
],
JsValue
::
WellKnownFunction
(
kind
)
=>
vec!
[
kind
],
JsValue
::
Alternatives
{
values
,
..
}
=>
values
JsValue
::
Alternatives
{
values
,
..
}
=>
values
...
...
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