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
8818b373
Commit
8818b373
authored
Apr 14, 2025
by
Niklas Mischkulnig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
process(original_source, source)
parent
f907f242
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
98 additions
and
42 deletions
+98
-42
app.rs
crates/next-api/src/app.rs
+42
-9
pages.rs
crates/next-api/src/pages.rs
+3
-2
base_loader_tree.rs
crates/next-core/src/base_loader_tree.rs
+1
-1
css_client_reference_transition.rs
...e/css_client_reference/css_client_reference_transition.rs
+7
-4
ecmascript_client_reference_transition.rs
...lient_reference/ecmascript_client_reference_transition.rs
+8
-5
dynamic_transition.rs
crates/next-core/src/next_dynamic/dynamic_transition.rs
+7
-3
lib.rs
turbopack/crates/turbopack/src/lib.rs
+14
-6
full_context_transition.rs
...rates/turbopack/src/transition/full_context_transition.rs
+5
-5
mod.rs
turbopack/crates/turbopack/src/transition/mod.rs
+11
-7
No files found.
crates/next-api/src/app.rs
View file @
8818b373
...
@@ -49,7 +49,7 @@ use turbopack::{
...
@@ -49,7 +49,7 @@ use turbopack::{
ModuleAssetContext
,
ModuleAssetContext
,
module_options
::{
ModuleOptionsContext
,
RuleCondition
,
transition_rule
::
TransitionRule
},
module_options
::{
ModuleOptionsContext
,
RuleCondition
,
transition_rule
::
TransitionRule
},
resolve_options_context
::
ResolveOptionsContext
,
resolve_options_context
::
ResolveOptionsContext
,
transition
::{
FullContextTransition
,
Transition
,
TransitionOptions
},
transition
::{
Transition
,
TransitionOptions
},
};
};
use
turbopack_core
::{
use
turbopack_core
::{
asset
::
AssetContent
,
asset
::
AssetContent
,
...
@@ -116,6 +116,39 @@ impl AppProject {
...
@@ -116,6 +116,39 @@ impl AppProject {
}
}
}
}
#[turbo_tasks
::
value(shared)]
pub
struct
ContextOriginalTransition
{
module_context
:
ResolvedVc
<
ModuleAssetContext
>
,
}
#[turbo_tasks
::
value_impl]
impl
ContextOriginalTransition
{
#[turbo_tasks
::
function]
pub
fn
new
(
module_context
:
ResolvedVc
<
ModuleAssetContext
>
)
->
Vc
<
ContextOriginalTransition
>
{
ContextOriginalTransition
{
module_context
}
.cell
()
}
}
#[turbo_tasks
::
value_impl]
impl
Transition
for
ContextOriginalTransition
{
#[turbo_tasks
::
function]
fn
process_source
(
self
:
Vc
<
Self
>
,
original_source
:
Vc
<
Box
<
dyn
Source
>>
,
_source
:
Vc
<
Box
<
dyn
Source
>>
,
)
->
Vc
<
Box
<
dyn
Source
>>
{
original_source
}
#[turbo_tasks
::
function]
fn
process_context
(
&
self
,
_module_asset_context
:
Vc
<
ModuleAssetContext
>
,
)
->
Vc
<
ModuleAssetContext
>
{
*
self
.module_context
}
}
#[turbo_tasks
::
value_impl]
#[turbo_tasks
::
value_impl]
impl
AppProject
{
impl
AppProject
{
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
...
@@ -212,9 +245,9 @@ impl AppProject {
...
@@ -212,9 +245,9 @@ impl AppProject {
}
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
fn
client_transition
(
self
:
Vc
<
Self
>
)
->
Vc
<
FullContextTransition
>
{
fn
client_transition
(
self
:
Vc
<
Self
>
)
->
Vc
<
Box
<
dyn
Transition
>
>
{
let
module_context
=
self
.client_module_context
();
let
module_context
=
self
.client_module_context
();
FullContextTransition
::
new
(
module_context
)
Vc
::
upcast
(
ContextOriginalTransition
::
new
(
module_context
)
)
}
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
...
@@ -664,9 +697,9 @@ impl AppProject {
...
@@ -664,9 +697,9 @@ impl AppProject {
}
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
fn
ssr_transition
(
self
:
Vc
<
Self
>
)
->
Vc
<
FullContext
Transition
>
{
fn
ssr_transition
(
self
:
Vc
<
Self
>
)
->
Vc
<
ContextOriginal
Transition
>
{
let
module_context
=
self
.ssr_module_context
();
let
module_context
=
self
.ssr_module_context
();
FullContext
Transition
::
new
(
module_context
)
ContextOriginal
Transition
::
new
(
module_context
)
}
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
...
@@ -685,7 +718,7 @@ impl AppProject {
...
@@ -685,7 +718,7 @@ impl AppProject {
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
fn
shared_transition
(
self
:
Vc
<
Self
>
)
->
Vc
<
Box
<
dyn
Transition
>>
{
fn
shared_transition
(
self
:
Vc
<
Self
>
)
->
Vc
<
Box
<
dyn
Transition
>>
{
Vc
::
upcast
(
FullContext
Transition
::
new
(
self
.shared_module_context
()))
Vc
::
upcast
(
ContextOriginal
Transition
::
new
(
self
.shared_module_context
()))
}
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
...
@@ -727,9 +760,9 @@ impl AppProject {
...
@@ -727,9 +760,9 @@ impl AppProject {
}
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
fn
edge_ssr_transition
(
self
:
Vc
<
Self
>
)
->
Vc
<
FullContext
Transition
>
{
fn
edge_ssr_transition
(
self
:
Vc
<
Self
>
)
->
Vc
<
ContextOriginal
Transition
>
{
let
module_context
=
self
.edge_ssr_module_context
();
let
module_context
=
self
.edge_ssr_module_context
();
FullContext
Transition
::
new
(
module_context
)
ContextOriginal
Transition
::
new
(
module_context
)
}
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
...
@@ -748,7 +781,7 @@ impl AppProject {
...
@@ -748,7 +781,7 @@ impl AppProject {
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
fn
edge_shared_transition
(
self
:
Vc
<
Self
>
)
->
Vc
<
Box
<
dyn
Transition
>>
{
fn
edge_shared_transition
(
self
:
Vc
<
Self
>
)
->
Vc
<
Box
<
dyn
Transition
>>
{
Vc
::
upcast
(
FullContext
Transition
::
new
(
Vc
::
upcast
(
ContextOriginal
Transition
::
new
(
self
.edge_shared_module_context
(),
self
.edge_shared_module_context
(),
))
))
}
}
...
...
crates/next-api/src/pages.rs
View file @
8818b373
...
@@ -39,7 +39,7 @@ use turbopack::{
...
@@ -39,7 +39,7 @@ use turbopack::{
ModuleAssetContext
,
ModuleAssetContext
,
module_options
::
ModuleOptionsContext
,
module_options
::
ModuleOptionsContext
,
resolve_options_context
::
ResolveOptionsContext
,
resolve_options_context
::
ResolveOptionsContext
,
transition
::{
FullContextTransition
,
Transition
,
TransitionOptions
},
transition
::{
Transition
,
TransitionOptions
},
};
};
use
turbopack_core
::{
use
turbopack_core
::{
asset
::
AssetContent
,
asset
::
AssetContent
,
...
@@ -65,6 +65,7 @@ use turbopack_ecmascript::resolve::esm_resolve;
...
@@ -65,6 +65,7 @@ use turbopack_ecmascript::resolve::esm_resolve;
use
turbopack_nodejs
::
NodeJsChunkingContext
;
use
turbopack_nodejs
::
NodeJsChunkingContext
;
use
crate
::{
use
crate
::{
app
::
ContextOriginalTransition
,
dynamic_imports
::{
dynamic_imports
::{
DynamicImportedChunks
,
NextDynamicChunkAvailability
,
collect_next_dynamic_chunks
,
DynamicImportedChunks
,
NextDynamicChunkAvailability
,
collect_next_dynamic_chunks
,
},
},
...
@@ -327,7 +328,7 @@ impl PagesProject {
...
@@ -327,7 +328,7 @@ impl PagesProject {
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
fn
client_transition
(
self
:
Vc
<
Self
>
)
->
Vc
<
Box
<
dyn
Transition
>>
{
fn
client_transition
(
self
:
Vc
<
Self
>
)
->
Vc
<
Box
<
dyn
Transition
>>
{
Vc
::
upcast
(
FullContext
Transition
::
new
(
self
.client_module_context
()))
Vc
::
upcast
(
ContextOriginal
Transition
::
new
(
self
.client_module_context
()))
}
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
...
...
crates/next-core/src/base_loader_tree.rs
View file @
8818b373
...
@@ -78,7 +78,7 @@ impl BaseLoaderTreeBuilder {
...
@@ -78,7 +78,7 @@ impl BaseLoaderTreeBuilder {
ReferenceType
::
EcmaScriptModules
(
EcmaScriptModulesReferenceSubType
::
Undefined
);
ReferenceType
::
EcmaScriptModules
(
EcmaScriptModulesReferenceSubType
::
Undefined
);
self
.server_component_transition
self
.server_component_transition
.process
(
source
,
*
self
.module_asset_context
,
reference_type
)
.process
(
source
,
source
,
*
self
.module_asset_context
,
reference_type
)
.module
()
.module
()
}
}
...
...
crates/next-core/src/next_client_reference/css_client_reference/css_client_reference_transition.rs
View file @
8818b373
...
@@ -23,14 +23,17 @@ impl Transition for NextCssClientReferenceTransition {
...
@@ -23,14 +23,17 @@ impl Transition for NextCssClientReferenceTransition {
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
async
fn
process
(
async
fn
process
(
self
:
Vc
<
Self
>
,
self
:
Vc
<
Self
>
,
original_source
:
Vc
<
Box
<
dyn
Source
>>
,
source
:
Vc
<
Box
<
dyn
Source
>>
,
source
:
Vc
<
Box
<
dyn
Source
>>
,
rsc_module_asset_context
:
Vc
<
ModuleAssetContext
>
,
rsc_module_asset_context
:
Vc
<
ModuleAssetContext
>
,
reference_type
:
ReferenceType
,
reference_type
:
ReferenceType
,
)
->
Result
<
Vc
<
ProcessResult
>>
{
)
->
Result
<
Vc
<
ProcessResult
>>
{
let
module
=
let
module
=
self
.await
?
.client_transition
.process
(
self
.await
?
original_source
,
.client_transition
source
,
.process
(
source
,
rsc_module_asset_context
,
reference_type
);
rsc_module_asset_context
,
reference_type
,
);
let
ProcessResult
::
Module
(
module
)
=
*
module
.await
?
else
{
let
ProcessResult
::
Module
(
module
)
=
*
module
.await
?
else
{
return
Ok
(
ProcessResult
::
Ignore
.cell
());
return
Ok
(
ProcessResult
::
Ignore
.cell
());
...
...
crates/next-core/src/next_client_reference/ecmascript_client_reference/ecmascript_client_reference_transition.rs
View file @
8818b373
...
@@ -37,7 +37,8 @@ impl Transition for NextEcmascriptClientReferenceTransition {
...
@@ -37,7 +37,8 @@ impl Transition for NextEcmascriptClientReferenceTransition {
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
async
fn
process
(
async
fn
process
(
self
:
Vc
<
Self
>
,
self
:
Vc
<
Self
>
,
source
:
Vc
<
Box
<
dyn
Source
>>
,
original_source
:
Vc
<
Box
<
dyn
Source
>>
,
_source
:
Vc
<
Box
<
dyn
Source
>>
,
module_asset_context
:
Vc
<
ModuleAssetContext
>
,
module_asset_context
:
Vc
<
ModuleAssetContext
>
,
reference_type
:
ReferenceType
,
reference_type
:
ReferenceType
,
)
->
Result
<
Vc
<
ProcessResult
>>
{
)
->
Result
<
Vc
<
ProcessResult
>>
{
...
@@ -53,8 +54,8 @@ impl Transition for NextEcmascriptClientReferenceTransition {
...
@@ -53,8 +54,8 @@ impl Transition for NextEcmascriptClientReferenceTransition {
let
this
=
self
.await
?
;
let
this
=
self
.await
?
;
let
ident
=
match
part
{
let
ident
=
match
part
{
Some
(
part
)
=>
source
.ident
()
.with_part
(
part
.clone
()),
Some
(
part
)
=>
original_
source
.ident
()
.with_part
(
part
.clone
()),
None
=>
source
.ident
(),
None
=>
original_
source
.ident
(),
};
};
let
ident_ref
=
ident
.await
?
;
let
ident_ref
=
ident
.await
?
;
let
ident_path
=
ident_ref
.path
.clone
();
let
ident_path
=
ident_ref
.path
.clone
();
...
@@ -70,9 +71,10 @@ impl Transition for NextEcmascriptClientReferenceTransition {
...
@@ -70,9 +71,10 @@ impl Transition for NextEcmascriptClientReferenceTransition {
ident_ref
.fragment
.clone
(),
ident_ref
.fragment
.clone
(),
))
))
}
else
{
}
else
{
source
original_
source
};
};
let
client_module
=
this
.client_transition
.process
(
let
client_module
=
this
.client_transition
.process
(
client_source
,
client_source
,
client_source
,
module_asset_context
,
module_asset_context
,
ReferenceType
::
Entry
(
EntryReferenceSubType
::
AppClientComponent
),
ReferenceType
::
Entry
(
EntryReferenceSubType
::
AppClientComponent
),
...
@@ -82,7 +84,8 @@ impl Transition for NextEcmascriptClientReferenceTransition {
...
@@ -82,7 +84,8 @@ impl Transition for NextEcmascriptClientReferenceTransition {
};
};
let
ssr_module
=
this
.ssr_transition
.process
(
let
ssr_module
=
this
.ssr_transition
.process
(
source
,
original_source
,
original_source
,
module_asset_context
,
module_asset_context
,
ReferenceType
::
Entry
(
EntryReferenceSubType
::
AppClientComponent
),
ReferenceType
::
Entry
(
EntryReferenceSubType
::
AppClientComponent
),
);
);
...
...
crates/next-core/src/next_dynamic/dynamic_transition.rs
View file @
8818b373
...
@@ -47,15 +47,19 @@ impl Transition for NextDynamicTransition {
...
@@ -47,15 +47,19 @@ impl Transition for NextDynamicTransition {
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
async
fn
process
(
async
fn
process
(
self
:
Vc
<
Self
>
,
self
:
Vc
<
Self
>
,
original_source
:
Vc
<
Box
<
dyn
Source
>>
,
source
:
Vc
<
Box
<
dyn
Source
>>
,
source
:
Vc
<
Box
<
dyn
Source
>>
,
module_asset_context
:
Vc
<
ModuleAssetContext
>
,
module_asset_context
:
Vc
<
ModuleAssetContext
>
,
_reference_type
:
ReferenceType
,
_reference_type
:
ReferenceType
,
)
->
Result
<
Vc
<
ProcessResult
>>
{
)
->
Result
<
Vc
<
ProcessResult
>>
{
let
module_asset_context
=
self
.process_context
(
module_asset_context
);
let
module_asset_context
=
self
.process_context
(
module_asset_context
);
let
module
=
match
self
.await
?
.client_transition
{
let
module
=
match
self
.await
?
.client_transition
{
Some
(
client_transition
)
=>
{
Some
(
client_transition
)
=>
client_transition
.process
(
client_transition
.process
(
source
,
module_asset_context
,
ReferenceType
::
Undefined
)
original_source
,
}
source
,
module_asset_context
,
ReferenceType
::
Undefined
,
),
None
=>
module_asset_context
.process
(
source
,
ReferenceType
::
Undefined
),
None
=>
module_asset_context
.process
(
source
,
ReferenceType
::
Undefined
),
};
};
...
...
turbopack/crates/turbopack/src/lib.rs
View file @
8818b373
...
@@ -425,6 +425,7 @@ impl ModuleAssetContext {
...
@@ -425,6 +425,7 @@ impl ModuleAssetContext {
impl
ModuleAssetContext
{
impl
ModuleAssetContext
{
async
fn
process_with_transition_rules
(
async
fn
process_with_transition_rules
(
self
:
Vc
<
Self
>
,
self
:
Vc
<
Self
>
,
original_source
:
ResolvedVc
<
Box
<
dyn
Source
>>
,
source
:
ResolvedVc
<
Box
<
dyn
Source
>>
,
source
:
ResolvedVc
<
Box
<
dyn
Source
>>
,
reference_type
:
ReferenceType
,
reference_type
:
ReferenceType
,
)
->
Result
<
Vc
<
ProcessResult
>>
{
)
->
Result
<
Vc
<
ProcessResult
>>
{
...
@@ -436,24 +437,27 @@ impl ModuleAssetContext {
...
@@ -436,24 +437,27 @@ impl ModuleAssetContext {
.get_by_rules
(
source
,
&
reference_type
)
.get_by_rules
(
source
,
&
reference_type
)
.await
?
.await
?
{
{
transition
.process
(
*
source
,
self
,
reference_type
)
transition
.process
(
*
original_source
,
*
source
,
self
,
reference_type
)
}
else
{
}
else
{
self
.process_default
(
source
,
reference_type
)
.await
?
self
.process_default
(
original_source
,
source
,
reference_type
)
.await
?
},
},
)
)
}
}
async
fn
process_default
(
async
fn
process_default
(
self
:
Vc
<
Self
>
,
self
:
Vc
<
Self
>
,
original_source
:
ResolvedVc
<
Box
<
dyn
Source
>>
,
source
:
ResolvedVc
<
Box
<
dyn
Source
>>
,
source
:
ResolvedVc
<
Box
<
dyn
Source
>>
,
reference_type
:
ReferenceType
,
reference_type
:
ReferenceType
,
)
->
Result
<
Vc
<
ProcessResult
>>
{
)
->
Result
<
Vc
<
ProcessResult
>>
{
process_default
(
self
,
source
,
reference_type
,
Vec
::
new
())
.await
process_default
(
self
,
original_source
,
source
,
reference_type
,
Vec
::
new
())
.await
}
}
}
}
async
fn
process_default
(
async
fn
process_default
(
module_asset_context
:
Vc
<
ModuleAssetContext
>
,
module_asset_context
:
Vc
<
ModuleAssetContext
>
,
original_source
:
ResolvedVc
<
Box
<
dyn
Source
>>
,
source
:
ResolvedVc
<
Box
<
dyn
Source
>>
,
source
:
ResolvedVc
<
Box
<
dyn
Source
>>
,
reference_type
:
ReferenceType
,
reference_type
:
ReferenceType
,
processed_rules
:
Vec
<
usize
>
,
processed_rules
:
Vec
<
usize
>
,
...
@@ -471,6 +475,7 @@ async fn process_default(
...
@@ -471,6 +475,7 @@ async fn process_default(
}
}
process_default_internal
(
process_default_internal
(
module_asset_context
,
module_asset_context
,
original_source
,
source
,
source
,
reference_type
,
reference_type
,
processed_rules
,
processed_rules
,
...
@@ -481,6 +486,7 @@ async fn process_default(
...
@@ -481,6 +486,7 @@ async fn process_default(
async
fn
process_default_internal
(
async
fn
process_default_internal
(
module_asset_context
:
Vc
<
ModuleAssetContext
>
,
module_asset_context
:
Vc
<
ModuleAssetContext
>
,
original_source
:
ResolvedVc
<
Box
<
dyn
Source
>>
,
source
:
ResolvedVc
<
Box
<
dyn
Source
>>
,
source
:
ResolvedVc
<
Box
<
dyn
Source
>>
,
reference_type
:
ReferenceType
,
reference_type
:
ReferenceType
,
processed_rules
:
Vec
<
usize
>
,
processed_rules
:
Vec
<
usize
>
,
...
@@ -544,6 +550,7 @@ async fn process_default_internal(
...
@@ -544,6 +550,7 @@ async fn process_default_internal(
.await
?
.await
?
{
{
return
Ok
(
transition
.process
(
return
Ok
(
transition
.process
(
*
original_source
,
*
current_source
,
*
current_source
,
module_asset_context
,
module_asset_context
,
reference_type
,
reference_type
,
...
@@ -553,6 +560,7 @@ async fn process_default_internal(
...
@@ -553,6 +560,7 @@ async fn process_default_internal(
processed_rules
.push
(
i
);
processed_rules
.push
(
i
);
return
Box
::
pin
(
process_default
(
return
Box
::
pin
(
process_default
(
module_asset_context
,
module_asset_context
,
original_source
,
current_source
,
current_source
,
reference_type
,
reference_type
,
processed_rules
,
processed_rules
,
...
@@ -853,15 +861,15 @@ impl AssetContext for ModuleAssetContext {
...
@@ -853,15 +861,15 @@ impl AssetContext for ModuleAssetContext {
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
async
fn
process
(
async
fn
process
(
self
:
Vc
<
Self
>
,
self
:
Vc
<
Self
>
,
asset
:
ResolvedVc
<
Box
<
dyn
Source
>>
,
source
:
ResolvedVc
<
Box
<
dyn
Source
>>
,
reference_type
:
ReferenceType
,
reference_type
:
ReferenceType
,
)
->
Result
<
Vc
<
ProcessResult
>>
{
)
->
Result
<
Vc
<
ProcessResult
>>
{
let
this
=
self
.await
?
;
let
this
=
self
.await
?
;
if
let
Some
(
transition
)
=
this
.transition
{
if
let
Some
(
transition
)
=
this
.transition
{
Ok
(
transition
.process
(
*
asset
,
self
,
reference_type
))
Ok
(
transition
.process
(
*
source
,
*
source
,
self
,
reference_type
))
}
else
{
}
else
{
Ok
(
self
Ok
(
self
.process_with_transition_rules
(
asset
,
reference_type
)
.process_with_transition_rules
(
source
,
source
,
reference_type
)
.await
?
)
.await
?
)
}
}
}
}
...
...
turbopack/crates/turbopack/src/transition/full_context_transition.rs
View file @
8818b373
...
@@ -4,20 +4,20 @@ use crate::{ModuleAssetContext, transition::Transition};
...
@@ -4,20 +4,20 @@ use crate::{ModuleAssetContext, transition::Transition};
/// A transition that only affects the asset context.
/// A transition that only affects the asset context.
#[turbo_tasks
::
value(shared)]
#[turbo_tasks
::
value(shared)]
pub
struct
FullContext
Transition
{
pub
struct
ContextOriginal
Transition
{
module_context
:
ResolvedVc
<
ModuleAssetContext
>
,
module_context
:
ResolvedVc
<
ModuleAssetContext
>
,
}
}
#[turbo_tasks
::
value_impl]
#[turbo_tasks
::
value_impl]
impl
FullContext
Transition
{
impl
ContextOriginal
Transition
{
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
pub
fn
new
(
module_context
:
ResolvedVc
<
ModuleAssetContext
>
)
->
Vc
<
FullContext
Transition
>
{
pub
fn
new
(
module_context
:
ResolvedVc
<
ModuleAssetContext
>
)
->
Vc
<
ContextOriginal
Transition
>
{
FullContext
Transition
{
module_context
}
.cell
()
ContextOriginal
Transition
{
module_context
}
.cell
()
}
}
}
}
#[turbo_tasks
::
value_impl]
#[turbo_tasks
::
value_impl]
impl
Transition
for
FullContext
Transition
{
impl
Transition
for
ContextOriginal
Transition
{
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
fn
process_context
(
fn
process_context
(
&
self
,
&
self
,
...
...
turbopack/crates/turbopack/src/transition/mod.rs
View file @
8818b373
pub
(
crate
)
mod
full_context_transition
;
pub
(
crate
)
mod
full_context_transition
;
use
anyhow
::
Result
;
use
anyhow
::
Result
;
pub
use
full_context_transition
::
FullContextTransition
;
use
rustc_hash
::
FxHashMap
;
use
rustc_hash
::
FxHashMap
;
use
turbo_rcstr
::
RcStr
;
use
turbo_rcstr
::
RcStr
;
use
turbo_tasks
::{
ResolvedVc
,
ValueDefault
,
Vc
};
use
turbo_tasks
::{
ResolvedVc
,
ValueDefault
,
Vc
};
...
@@ -23,8 +22,12 @@ use crate::{
...
@@ -23,8 +22,12 @@ use crate::{
pub
trait
Transition
{
pub
trait
Transition
{
/// Apply modifications/wrapping to the source asset
/// Apply modifications/wrapping to the source asset
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
fn
process_source
(
self
:
Vc
<
Self
>
,
asset
:
Vc
<
Box
<
dyn
Source
>>
)
->
Vc
<
Box
<
dyn
Source
>>
{
fn
process_source
(
asset
self
:
Vc
<
Self
>
,
_original_source
:
Vc
<
Box
<
dyn
Source
>>
,
source
:
Vc
<
Box
<
dyn
Source
>>
,
)
->
Vc
<
Box
<
dyn
Source
>>
{
source
}
}
/// Apply modifications to the compile-time information
/// Apply modifications to the compile-time information
...
@@ -102,16 +105,17 @@ pub trait Transition {
...
@@ -102,16 +105,17 @@ pub trait Transition {
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
async
fn
process
(
async
fn
process
(
self
:
Vc
<
Self
>
,
self
:
Vc
<
Self
>
,
asset
:
Vc
<
Box
<
dyn
Source
>>
,
original_source
:
Vc
<
Box
<
dyn
Source
>>
,
source
:
Vc
<
Box
<
dyn
Source
>>
,
module_asset_context
:
Vc
<
ModuleAssetContext
>
,
module_asset_context
:
Vc
<
ModuleAssetContext
>
,
reference_type
:
ReferenceType
,
reference_type
:
ReferenceType
,
)
->
Result
<
Vc
<
ProcessResult
>>
{
)
->
Result
<
Vc
<
ProcessResult
>>
{
let
asset
=
self
.process_source
(
asset
);
let
source
=
self
.process_source
(
original_source
,
source
);
let
module_asset_context
=
self
.process_context
(
module_asset_context
);
let
module_asset_context
=
self
.process_context
(
module_asset_context
);
let
asset
=
asset
.to_resolved
()
.await
?
;
let
source
=
source
.to_resolved
()
.await
?
;
Ok
(
match
&*
module_asset_context
Ok
(
match
&*
module_asset_context
.process_default
(
asset
,
reference_type
)
.process_default
(
original_source
.to_resolved
()
.await
?
,
source
,
reference_type
)
.await
?
.await
?
.await
?
.await
?
{
{
...
...
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