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
29e6b0e3
Unverified
Commit
29e6b0e3
authored
Nov 21, 2025
by
Niklas Mischkulnig
Committed by
GitHub
Nov 21, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: refactor tuple variant into struct (#86374)
The list was getting long...
parent
d6735683
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
18 deletions
+39
-18
mod.rs
turbopack/crates/turbopack-core/src/resolve/mod.rs
+1
-1
options.rs
turbopack/crates/turbopack-core/src/resolve/options.rs
+38
-17
No files found.
turbopack/crates/turbopack-core/src/resolve/mod.rs
View file @
29e6b0e3
...
@@ -2721,7 +2721,7 @@ async fn resolve_import_map_result(
...
@@ -2721,7 +2721,7 @@ async fn resolve_import_map_result(
))
))
}
}
}
}
ImportMapResult
::
External
(
name
,
ty
,
traced
)
=>
{
ImportMapResult
::
External
{
name
,
ty
,
traced
}
=>
{
Some
(
*
ResolveResult
::
primary
(
ResolveResultItem
::
External
{
Some
(
*
ResolveResult
::
primary
(
ResolveResultItem
::
External
{
name
:
name
.clone
(),
name
:
name
.clone
(),
ty
:
*
ty
,
ty
:
*
ty
,
...
...
turbopack/crates/turbopack-core/src/resolve/options.rs
View file @
29e6b0e3
...
@@ -134,7 +134,11 @@ pub enum ImportMapping {
...
@@ -134,7 +134,11 @@ pub enum ImportMapping {
#[turbo_tasks
::
value(shared)]
#[turbo_tasks
::
value(shared)]
#[derive(Clone)]
#[derive(Clone)]
pub
enum
ReplacedImportMapping
{
pub
enum
ReplacedImportMapping
{
External
(
Option
<
RcStr
>
,
ExternalType
,
ExternalTraced
),
External
{
name_override
:
Option
<
RcStr
>
,
ty
:
ExternalType
,
traced
:
ExternalTraced
,
},
PrimaryAlternativeExternal
{
PrimaryAlternativeExternal
{
name
:
Option
<
RcStr
>
,
name
:
Option
<
RcStr
>
,
ty
:
ExternalType
,
ty
:
ExternalType
,
...
@@ -190,9 +194,11 @@ impl AliasTemplate for Vc<ImportMapping> {
...
@@ -190,9 +194,11 @@ impl AliasTemplate for Vc<ImportMapping> {
Box
::
pin
(
async
move
{
Box
::
pin
(
async
move
{
let
this
=
&*
self
.await
?
;
let
this
=
&*
self
.await
?
;
Ok
(
match
this
{
Ok
(
match
this
{
ImportMapping
::
External
(
name
,
ty
,
traced
)
=>
{
ImportMapping
::
External
(
name
,
ty
,
traced
)
=>
ReplacedImportMapping
::
External
{
ReplacedImportMapping
::
External
(
name
.clone
(),
*
ty
,
*
traced
)
name_override
:
name
.clone
(),
}
ty
:
*
ty
,
traced
:
*
traced
,
},
ImportMapping
::
PrimaryAlternativeExternal
{
ImportMapping
::
PrimaryAlternativeExternal
{
name
,
name
,
ty
,
ty
,
...
@@ -233,13 +239,20 @@ impl AliasTemplate for Vc<ImportMapping> {
...
@@ -233,13 +239,20 @@ impl AliasTemplate for Vc<ImportMapping> {
Ok
(
match
this
{
Ok
(
match
this
{
ImportMapping
::
External
(
name
,
ty
,
traced
)
=>
{
ImportMapping
::
External
(
name
,
ty
,
traced
)
=>
{
if
let
Some
(
name
)
=
name
{
if
let
Some
(
name
)
=
name
{
ReplacedImportMapping
::
External
(
ReplacedImportMapping
::
External
{
capture
.spread_into_star
(
name
)
.as_constant_string
()
.cloned
(),
name_override
:
capture
*
ty
,
.spread_into_star
(
name
)
*
traced
,
.as_constant_string
()
)
.cloned
(),
ty
:
*
ty
,
traced
:
*
traced
,
}
}
else
{
}
else
{
ReplacedImportMapping
::
External
(
None
,
*
ty
,
*
traced
)
ReplacedImportMapping
::
External
{
name_override
:
None
,
ty
:
*
ty
,
traced
:
*
traced
,
}
}
}
}
}
ImportMapping
::
PrimaryAlternativeExternal
{
ImportMapping
::
PrimaryAlternativeExternal
{
...
@@ -393,7 +406,11 @@ pub struct ResolvedMap {
...
@@ -393,7 +406,11 @@ pub struct ResolvedMap {
#[derive(Clone)]
#[derive(Clone)]
pub
enum
ImportMapResult
{
pub
enum
ImportMapResult
{
Result
(
ResolvedVc
<
ResolveResult
>
),
Result
(
ResolvedVc
<
ResolveResult
>
),
External
(
RcStr
,
ExternalType
,
ExternalTraced
),
External
{
name
:
RcStr
,
ty
:
ExternalType
,
traced
:
ExternalTraced
,
},
AliasExternal
{
AliasExternal
{
name
:
RcStr
,
name
:
RcStr
,
ty
:
ExternalType
,
ty
:
ExternalType
,
...
@@ -412,8 +429,12 @@ async fn import_mapping_to_result(
...
@@ -412,8 +429,12 @@ async fn import_mapping_to_result(
)
->
Result
<
ImportMapResult
>
{
)
->
Result
<
ImportMapResult
>
{
Ok
(
match
&*
mapping
.await
?
{
Ok
(
match
&*
mapping
.await
?
{
ReplacedImportMapping
::
Direct
(
result
)
=>
ImportMapResult
::
Result
(
*
result
),
ReplacedImportMapping
::
Direct
(
result
)
=>
ImportMapResult
::
Result
(
*
result
),
ReplacedImportMapping
::
External
(
name
,
ty
,
traced
)
=>
ImportMapResult
::
External
(
ReplacedImportMapping
::
External
{
if
let
Some
(
name
)
=
name
{
name_override
,
ty
,
traced
,
}
=>
ImportMapResult
::
External
{
name
:
if
let
Some
(
name
)
=
name_override
{
name
.clone
()
name
.clone
()
}
else
if
let
Some
(
request
)
=
request
.await
?
.request
()
{
}
else
if
let
Some
(
request
)
=
request
.await
?
.request
()
{
request
request
...
@@ -423,9 +444,9 @@ async fn import_mapping_to_result(
...
@@ -423,9 +444,9 @@ async fn import_mapping_to_result(
request
.request_pattern
()
.await
?
.describe_as_string
()
request
.request_pattern
()
.await
?
.describe_as_string
()
)
)
},
},
*
ty
,
ty
:
*
ty
,
*
traced
,
traced
:
*
traced
,
)
,
}
,
ReplacedImportMapping
::
PrimaryAlternativeExternal
{
ReplacedImportMapping
::
PrimaryAlternativeExternal
{
name
,
name
,
ty
,
ty
,
...
@@ -480,7 +501,7 @@ impl ValueToString for ImportMapResult {
...
@@ -480,7 +501,7 @@ impl ValueToString for ImportMapResult {
async
fn
to_string
(
&
self
)
->
Result
<
Vc
<
RcStr
>>
{
async
fn
to_string
(
&
self
)
->
Result
<
Vc
<
RcStr
>>
{
match
self
{
match
self
{
ImportMapResult
::
Result
(
_
)
=>
Ok
(
Vc
::
cell
(
rcstr!
(
"Resolved by import map"
))),
ImportMapResult
::
Result
(
_
)
=>
Ok
(
Vc
::
cell
(
rcstr!
(
"Resolved by import map"
))),
ImportMapResult
::
External
(
_
,
_
,
_
)
=>
Ok
(
Vc
::
cell
(
rcstr!
(
"TODO external"
))),
ImportMapResult
::
External
{
..
}
=>
Ok
(
Vc
::
cell
(
rcstr!
(
"TODO external"
))),
ImportMapResult
::
AliasExternal
{
..
}
=>
Ok
(
Vc
::
cell
(
rcstr!
(
"TODO external"
))),
ImportMapResult
::
AliasExternal
{
..
}
=>
Ok
(
Vc
::
cell
(
rcstr!
(
"TODO external"
))),
ImportMapResult
::
Alias
(
request
,
context
)
=>
{
ImportMapResult
::
Alias
(
request
,
context
)
=>
{
let
s
=
if
let
Some
(
path
)
=
context
{
let
s
=
if
let
Some
(
path
)
=
context
{
...
...
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