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
1df81bce
Unverified
Commit
1df81bce
authored
Jan 13, 2025
by
Benjamin Woodruff
Committed by
GitHub
Jan 13, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(turbopack/next-core): Use ResolvedVc in VisitClientReferenceNodeState (#74710)
parent
0098b4f8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
22 deletions
+31
-22
visit_client_reference.rs
...-core/src/next_client_reference/visit_client_reference.rs
+31
-22
No files found.
crates/next-core/src/next_client_reference/visit_client_reference.rs
View file @
1df81bce
...
...
@@ -95,7 +95,7 @@ impl Default for ClientReferenceGraphResult {
}
}
#[turbo_tasks
::
value(shared
,
local
)]
#[turbo_tasks
::
value(shared)]
pub
struct
VisitedClientReferenceGraphNodes
(
HashSet
<
VisitClientReferenceNode
>
);
#[turbo_tasks
::
value_impl]
...
...
@@ -169,11 +169,11 @@ pub async fn client_reference_graph(
.await
?
{
VisitClientReferenceNodeState
::
InServerComponent
{
server_component
:
*
server_component
,
server_component
,
}
}
else
{
VisitClientReferenceNodeState
::
Entry
{
entry_path
:
module
.ident
()
.path
()
.
resolve
()
.await
?
,
entry_path
:
module
.ident
()
.path
()
.
to_resolved
()
.await
?
,
}
},
ty
:
VisitClientReferenceNodeType
::
Internal
(
...
...
@@ -244,7 +244,7 @@ pub struct ServerEntries {
#[turbo_tasks
::
function]
pub
async
fn
find_server_entries
(
entry
:
ResolvedVc
<
Box
<
dyn
Module
>>
)
->
Result
<
Vc
<
ServerEntries
>>
{
let
entry_path
=
entry
.ident
()
.path
()
.
resolve
()
.await
?
;
let
entry_path
=
entry
.ident
()
.path
()
.
to_resolved
()
.await
?
;
let
graph
=
AdjacencyMap
::
new
()
.skip_duplicates
()
.visit
(
...
...
@@ -288,7 +288,16 @@ struct VisitClientReference {
}
#[derive(
Clone,
Eq,
PartialEq,
Hash,
Serialize,
Deserialize,
Debug,
ValueDebugFormat,
TraceRawVcs,
Clone,
Eq,
PartialEq,
Hash,
Serialize,
Deserialize,
Debug,
ValueDebugFormat,
TraceRawVcs,
NonLocalValue,
)]
struct
VisitClientReferenceNode
{
state
:
VisitClientReferenceNodeState
,
...
...
@@ -296,19 +305,29 @@ struct VisitClientReferenceNode {
}
#[derive(
Clone,
Copy,
Eq,
PartialEq,
Hash,
Serialize,
Deserialize,
Debug,
ValueDebugFormat,
TraceRawVcs,
Clone,
Copy,
Eq,
PartialEq,
Hash,
Serialize,
Deserialize,
Debug,
ValueDebugFormat,
TraceRawVcs,
NonLocalValue,
)]
enum
VisitClientReferenceNodeState
{
Entry
{
entry_path
:
Vc
<
FileSystemPath
>
,
entry_path
:
Resolved
Vc
<
FileSystemPath
>
,
},
InServerComponent
{
server_component
:
Vc
<
NextServerComponentModule
>
,
server_component
:
Resolved
Vc
<
NextServerComponentModule
>
,
},
InServerUtil
,
}
impl
VisitClientReferenceNodeState
{
fn
server_component
(
&
self
)
->
Option
<
Vc
<
NextServerComponentModule
>>
{
fn
server_component
(
&
self
)
->
Option
<
Resolved
Vc
<
NextServerComponentModule
>>
{
match
self
{
VisitClientReferenceNodeState
::
Entry
{
..
}
=>
None
,
VisitClientReferenceNodeState
::
InServerComponent
{
server_component
}
=>
{
...
...
@@ -389,12 +408,7 @@ impl Visit<VisitClientReferenceNode> for VisitClientReference {
state
:
node
.state
,
ty
:
VisitClientReferenceNodeType
::
ClientReference
(
ClientReference
{
server_component
:
match
node
.state
.server_component
()
{
Some
(
server_component
)
=>
{
Some
(
server_component
.to_resolved
()
.await
?
)
}
None
=>
None
,
},
server_component
:
node
.state
.server_component
(),
ty
:
ClientReferenceType
::
EcmascriptClientReference
{
parent_module
,
module
:
client_reference_module
,
...
...
@@ -412,12 +426,7 @@ impl Visit<VisitClientReferenceNode> for VisitClientReference {
state
:
node
.state
,
ty
:
VisitClientReferenceNodeType
::
ClientReference
(
ClientReference
{
server_component
:
match
node
.state
.server_component
()
{
Some
(
server_component
)
=>
{
Some
(
server_component
.to_resolved
()
.await
?
)
}
None
=>
None
,
},
server_component
:
node
.state
.server_component
(),
ty
:
ClientReferenceType
::
CssClientReference
(
css_client_reference_asset
,
),
...
...
@@ -432,7 +441,7 @@ impl Visit<VisitClientReferenceNode> for VisitClientReference {
{
return
Ok
(
VisitClientReferenceNode
{
state
:
VisitClientReferenceNodeState
::
InServerComponent
{
server_component
:
*
server_component_asset
,
server_component
:
server_component_asset
,
},
ty
:
VisitClientReferenceNodeType
::
ServerComponentEntry
(
server_component_asset
,
...
...
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