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
53757f3e
Commit
53757f3e
authored
Dec 11, 2025
by
Benjamin Woodruff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: Turbopack: Replace SliceMap with FrozenMap
parent
c15f8ecd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
166 additions
and
175 deletions
+166
-175
Cargo.lock
Cargo.lock
+3
-0
lib.rs
turbopack/crates/turbo-tasks/src/lib.rs
+0
-2
Cargo.toml
turbopack/crates/turbopack-core/Cargo.toml
+1
-0
mod.rs
turbopack/crates/turbopack-core/src/resolve/mod.rs
+148
-162
Cargo.toml
turbopack/crates/turbopack-ecmascript/Cargo.toml
+1
-0
base.rs
...ck/crates/turbopack-ecmascript/src/references/esm/base.rs
+3
-2
pattern_mapping.rs
...es/turbopack-ecmascript/src/references/pattern_mapping.rs
+1
-1
Cargo.toml
turbopack/crates/turbopack-resolve/Cargo.toml
+2
-1
node_native_binding.rs
...opack/crates/turbopack-resolve/src/node_native_binding.rs
+1
-1
typescript.rs
turbopack/crates/turbopack-resolve/src/typescript.rs
+6
-6
No files found.
Cargo.lock
View file @
53757f3e
...
@@ -9673,6 +9673,7 @@ dependencies = [
...
@@ -9673,6 +9673,7 @@ dependencies = [
"tokio",
"tokio",
"tracing",
"tracing",
"turbo-bincode",
"turbo-bincode",
"turbo-frozenmap",
"turbo-prehash",
"turbo-prehash",
"turbo-rcstr",
"turbo-rcstr",
"turbo-tasks",
"turbo-tasks",
...
@@ -9796,6 +9797,7 @@ dependencies = [
...
@@ -9796,6 +9797,7 @@ dependencies = [
"tracing",
"tracing",
"turbo-bincode",
"turbo-bincode",
"turbo-esregex",
"turbo-esregex",
"turbo-frozenmap",
"turbo-rcstr",
"turbo-rcstr",
"turbo-tasks",
"turbo-tasks",
"turbo-tasks-backend",
"turbo-tasks-backend",
...
@@ -10014,6 +10016,7 @@ dependencies = [
...
@@ -10014,6 +10016,7 @@ dependencies = [
"serde",
"serde",
"serde_json",
"serde_json",
"tracing",
"tracing",
"turbo-frozenmap",
"turbo-rcstr",
"turbo-rcstr",
"turbo-tasks",
"turbo-tasks",
"turbo-tasks-fs",
"turbo-tasks-fs",
...
...
turbopack/crates/turbo-tasks/src/lib.rs
View file @
53757f3e
...
@@ -138,8 +138,6 @@ pub use crate::{
...
@@ -138,8 +138,6 @@ pub use crate::{
},
},
};
};
pub
type
SliceMap
<
K
,
V
>
=
Box
<
[(
K
,
V
)]
>
;
pub
type
FxIndexSet
<
T
>
=
indexmap
::
IndexSet
<
T
,
BuildHasherDefault
<
FxHasher
>>
;
pub
type
FxIndexSet
<
T
>
=
indexmap
::
IndexSet
<
T
,
BuildHasherDefault
<
FxHasher
>>
;
pub
type
FxIndexMap
<
K
,
V
>
=
indexmap
::
IndexMap
<
K
,
V
,
BuildHasherDefault
<
FxHasher
>>
;
pub
type
FxIndexMap
<
K
,
V
>
=
indexmap
::
IndexMap
<
K
,
V
,
BuildHasherDefault
<
FxHasher
>>
;
pub
type
FxDashMap
<
K
,
V
>
=
dashmap
::
DashMap
<
K
,
V
,
BuildHasherDefault
<
FxHasher
>>
;
pub
type
FxDashMap
<
K
,
V
>
=
dashmap
::
DashMap
<
K
,
V
,
BuildHasherDefault
<
FxHasher
>>
;
...
...
turbopack/crates/turbopack-core/Cargo.toml
View file @
53757f3e
...
@@ -39,6 +39,7 @@ swc_sourcemap = { workspace = true }
...
@@ -39,6 +39,7 @@ swc_sourcemap = { workspace = true }
swc_core
=
{
workspace
=
true
,
features
=
[
"ecma_preset_env"
,
"common"
]
}
swc_core
=
{
workspace
=
true
,
features
=
[
"ecma_preset_env"
,
"common"
]
}
tracing
=
{
workspace
=
true
}
tracing
=
{
workspace
=
true
}
turbo-bincode
=
{
workspace
=
true
}
turbo-bincode
=
{
workspace
=
true
}
turbo-frozenmap
=
{
workspace
=
true
}
turbo-prehash
=
{
workspace
=
true
}
turbo-prehash
=
{
workspace
=
true
}
turbo-rcstr
=
{
workspace
=
true
}
turbo-rcstr
=
{
workspace
=
true
}
turbo-tasks
=
{
workspace
=
true
}
turbo-tasks
=
{
workspace
=
true
}
...
...
turbopack/crates/turbopack-core/src/resolve/mod.rs
View file @
53757f3e
This diff is collapsed.
Click to expand it.
turbopack/crates/turbopack-ecmascript/Cargo.toml
View file @
53757f3e
...
@@ -48,6 +48,7 @@ tokio = { workspace = true }
...
@@ -48,6 +48,7 @@ tokio = { workspace = true }
tracing
=
{
workspace
=
true
}
tracing
=
{
workspace
=
true
}
turbo-bincode
=
{
workspace
=
true
}
turbo-bincode
=
{
workspace
=
true
}
turbo-esregex
=
{
workspace
=
true
}
turbo-esregex
=
{
workspace
=
true
}
turbo-frozenmap
=
{
workspace
=
true
}
turbo-rcstr
=
{
workspace
=
true
}
turbo-rcstr
=
{
workspace
=
true
}
turbo-tasks
=
{
workspace
=
true
}
turbo-tasks
=
{
workspace
=
true
}
turbo-tasks-fs
=
{
workspace
=
true
}
turbo-tasks-fs
=
{
workspace
=
true
}
...
...
turbopack/crates/turbopack-ecmascript/src/references/esm/base.rs
View file @
53757f3e
...
@@ -9,6 +9,7 @@ use swc_core::{
...
@@ -9,6 +9,7 @@ use swc_core::{
},
},
quote
,
quote
,
};
};
use
turbo_frozenmap
::
FrozenMap
;
use
turbo_rcstr
::{
RcStr
,
rcstr
};
use
turbo_rcstr
::{
RcStr
,
rcstr
};
use
turbo_tasks
::{
ResolvedVc
,
ValueToString
,
Vc
};
use
turbo_tasks
::{
ResolvedVc
,
ValueToString
,
Vc
};
use
turbo_tasks_fs
::
FileSystemPath
;
use
turbo_tasks_fs
::
FileSystemPath
;
...
@@ -434,10 +435,10 @@ impl ModuleReference for EsmAssetReference {
...
@@ -434,10 +435,10 @@ impl ModuleReference for EsmAssetReference {
.await
?
.await
?
{
{
return
Ok
(
ModuleResolveResult
{
return
Ok
(
ModuleResolveResult
{
primary
:
Box
::
new
([(
primary
:
FrozenMap
::
from_unique_sorted_box
(
Box
::
new
([(
RequestKey
::
default
(),
RequestKey
::
default
(),
ModuleResolveResultItem
::
Ignore
,
ModuleResolveResultItem
::
Ignore
,
)]),
)])
)
,
affecting_sources
:
Default
::
default
(),
affecting_sources
:
Default
::
default
(),
}
}
.cell
());
.cell
());
...
...
turbopack/crates/turbopack-ecmascript/src/references/pattern_mapping.rs
View file @
53757f3e
...
@@ -419,7 +419,7 @@ impl PatternMapping {
...
@@ -419,7 +419,7 @@ impl PatternMapping {
))
))
.cell
()),
.cell
()),
1
if
!
request
.request_pattern
()
.await
?
.has_dynamic_parts
()
=>
{
1
if
!
request
.request_pattern
()
.await
?
.has_dynamic_parts
()
=>
{
let
resolve_item
=
&
result
.primary
.first
()
.unwrap
()
.
1
;
let
resolve_item
=
&
result
.primary
.first
_key_value
()
.unwrap
()
.
1
;
let
single_pattern_mapping
=
let
single_pattern_mapping
=
to_single_pattern_mapping
(
origin
,
chunking_context
,
resolve_item
,
resolve_type
)
to_single_pattern_mapping
(
origin
,
chunking_context
,
resolve_item
,
resolve_type
)
.await
?
;
.await
?
;
...
...
turbopack/crates/turbopack-resolve/Cargo.toml
View file @
53757f3e
...
@@ -14,13 +14,14 @@ workspace = true
...
@@ -14,13 +14,14 @@ workspace = true
[dependencies]
[dependencies]
anyhow
=
{
workspace
=
true
}
anyhow
=
{
workspace
=
true
}
next-taskless
=
{
workspace
=
true
}
regex
=
{
workspace
=
true
}
regex
=
{
workspace
=
true
}
serde
=
{
workspace
=
true
}
serde
=
{
workspace
=
true
}
serde_json
=
{
workspace
=
true
}
serde_json
=
{
workspace
=
true
}
tracing
=
{
workspace
=
true
}
tracing
=
{
workspace
=
true
}
turbo-frozenmap
=
{
workspace
=
true
}
turbo-rcstr
=
{
workspace
=
true
}
turbo-rcstr
=
{
workspace
=
true
}
turbo-tasks
=
{
workspace
=
true
}
turbo-tasks
=
{
workspace
=
true
}
turbo-tasks-fs
=
{
workspace
=
true
}
turbo-tasks-fs
=
{
workspace
=
true
}
turbopack-core
=
{
workspace
=
true
}
turbopack-core
=
{
workspace
=
true
}
next-taskless
=
{
workspace
=
true
}
turbopack/crates/turbopack-resolve/src/node_native_binding.rs
View file @
53757f3e
...
@@ -317,7 +317,7 @@ async fn resolve_node_gyp_build_files(
...
@@ -317,7 +317,7 @@ async fn resolve_node_gyp_build_files(
)
)
.await
?
;
.await
?
;
if
let
Some
((
_
,
ResolveResultItem
::
Source
(
source
)))
=
if
let
Some
((
_
,
ResolveResultItem
::
Source
(
source
)))
=
resolved_prebuilt_file
.primary
.first
()
resolved_prebuilt_file
.primary
.first
_key_value
()
{
{
resolved
.insert
(
format!
(
"build/Release/{name}.node"
)
.into
(),
*
source
);
resolved
.insert
(
format!
(
"build/Release/{name}.node"
)
.into
(),
*
source
);
if
collect_affecting_sources
{
if
collect_affecting_sources
{
...
...
turbopack/crates/turbopack-resolve/src/typescript.rs
View file @
53757f3e
...
@@ -2,6 +2,7 @@ use std::mem::take;
...
@@ -2,6 +2,7 @@ use std::mem::take;
use
anyhow
::
Result
;
use
anyhow
::
Result
;
use
serde_json
::
Value
as
JsonValue
;
use
serde_json
::
Value
as
JsonValue
;
use
turbo_frozenmap
::
FrozenMap
;
use
turbo_rcstr
::{
RcStr
,
rcstr
};
use
turbo_rcstr
::{
RcStr
,
rcstr
};
use
turbo_tasks
::{
FxIndexMap
,
ResolvedVc
,
ValueDefault
,
Vc
,
fxindexset
};
use
turbo_tasks
::{
FxIndexMap
,
ResolvedVc
,
ValueDefault
,
Vc
,
fxindexset
};
use
turbo_tasks_fs
::{
FileContent
,
FileJsonContent
,
FileSystemPath
,
FileSystemPathOption
};
use
turbo_tasks_fs
::{
FileContent
,
FileJsonContent
,
FileSystemPath
,
FileSystemPathOption
};
...
@@ -478,12 +479,11 @@ pub async fn type_resolve(
...
@@ -478,12 +479,11 @@ pub async fn type_resolve(
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
pub
async
fn
as_typings_result
(
result
:
Vc
<
ModuleResolveResult
>
)
->
Result
<
Vc
<
ModuleResolveResult
>>
{
pub
async
fn
as_typings_result
(
result
:
Vc
<
ModuleResolveResult
>
)
->
Result
<
Vc
<
ModuleResolveResult
>>
{
let
mut
result
=
result
.owned
()
.await
?
;
let
mut
result
=
result
.owned
()
.await
?
;
result
.primary
=
IntoIterator
::
into_iter
(
take
(
&
mut
result
.primary
))
let
mut
primary
=
Box
::
<
[
_
]
>
::
from
(
take
(
&
mut
result
.primary
));
.map
(|(
mut
k
,
v
)|
{
for
(
request_key
,
_v
)
in
&
mut
primary
{
k
.conditions
.insert
(
"types"
.to_string
(),
true
);
request_key
.conditions
.insert
(
"types"
.to_string
(),
true
);
(
k
,
v
)
}
})
result
.primary
=
FrozenMap
::
from_overlapping_vec
(
primary
.into_vec
());
.collect
();
Ok
(
result
.cell
())
Ok
(
result
.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