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
29524c1e
Unverified
Commit
29524c1e
authored
Dec 02, 2025
by
Niklas Mischkulnig
Committed by
GitHub
Dec 02, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: improve eventual consistency (#86724)
as always...
parent
420c6114
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
11 deletions
+30
-11
merged_modules.rs
.../crates/turbopack-core/src/module_graph/merged_modules.rs
+30
-11
No files found.
turbopack/crates/turbopack-core/src/module_graph/merged_modules.rs
View file @
29524c1e
...
@@ -342,14 +342,16 @@ pub async fn compute_merged_modules(module_graph: Vc<ModuleGraph>) -> Result<Vc<
...
@@ -342,14 +342,16 @@ pub async fn compute_merged_modules(module_graph: Vc<ModuleGraph>) -> Result<Vc<
let
module
=
node
;
let
module
=
node
;
let
bitmap
=
module_merged_groups
let
bitmap
=
module_merged_groups
.get
(
&
module
)
.get
(
&
module
)
.context
(
"every module should have a bitmap
at this point
"
)
?
;
.context
(
"every module should have a bitmap"
)
?
;
if
mergeable
.contains
(
&
module
)
{
if
mergeable
.contains
(
&
module
)
{
let
mergeable_module
=
let
mergeable_module
=
ResolvedVc
::
try_downcast
::
<
Box
<
dyn
MergeableModule
>>
(
ResolvedVc
::
try_downcast
::
<
Box
<
dyn
MergeableModule
>>
(
module
,
module
,
)
)
.unwrap
();
.context
(
"found mergeable module which is not a MergeableModule"
,
)
?
;
match
chunk_lists
.entry
(
bitmap
)
{
match
chunk_lists
.entry
(
bitmap
)
{
Entry
::
Vacant
(
e
)
=>
{
Entry
::
Vacant
(
e
)
=>
{
// New list, insert the module
// New list, insert the module
...
@@ -382,8 +384,12 @@ pub async fn compute_merged_modules(module_graph: Vc<ModuleGraph>) -> Result<Vc<
...
@@ -382,8 +384,12 @@ pub async fn compute_merged_modules(module_graph: Vc<ModuleGraph>) -> Result<Vc<
}
}
if
let
Some
((
parent
,
_
))
=
parent_info
{
if
let
Some
((
parent
,
_
))
=
parent_info
{
let
same_bitmap
=
module_merged_groups
.get
(
&
parent
)
.unwrap
()
let
same_bitmap
=
module_merged_groups
==
module_merged_groups
.get
(
&
module
)
.unwrap
();
.get
(
&
parent
)
.context
(
"every module should have a bitmap"
)
?
==
module_merged_groups
.get
(
&
module
)
.context
(
"every module should have a bitmap"
)
?
;
if
same_bitmap
{
if
same_bitmap
{
intra_group_references_rev
intra_group_references_rev
...
@@ -470,8 +476,12 @@ pub async fn compute_merged_modules(module_graph: Vc<ModuleGraph>) -> Result<Vc<
...
@@ -470,8 +476,12 @@ pub async fn compute_merged_modules(module_graph: Vc<ModuleGraph>) -> Result<Vc<
let
module
=
node
;
let
module
=
node
;
if
let
Some
((
parent
,
_
))
=
parent_info
{
if
let
Some
((
parent
,
_
))
=
parent_info
{
let
same_bitmap
=
module_merged_groups
.get
(
&
parent
)
.unwrap
()
let
same_bitmap
=
module_merged_groups
==
module_merged_groups
.get
(
&
module
)
.unwrap
();
.get
(
&
parent
)
.context
(
"every module should have a bitmap"
)
?
==
module_merged_groups
.get
(
&
module
)
.context
(
"every module should have a bitmap"
)
?
;
if
same_bitmap
{
if
same_bitmap
{
intra_group_references
intra_group_references
...
@@ -481,10 +491,17 @@ pub async fn compute_merged_modules(module_graph: Vc<ModuleGraph>) -> Result<Vc<
...
@@ -481,10 +491,17 @@ pub async fn compute_merged_modules(module_graph: Vc<ModuleGraph>) -> Result<Vc<
}
}
}
}
if
parent_info
.is_none_or
(|(
parent
,
_
)|
{
if
match
parent_info
{
module_merged_groups
.get
(
&
parent
)
.unwrap
()
None
=>
true
,
!=
module_merged_groups
.get
(
&
module
)
.unwrap
()
Some
((
parent
,
_
))
=>
{
})
{
module_merged_groups
.get
(
&
parent
)
.context
(
"every module should have a bitmap"
)
?
!=
module_merged_groups
.get
(
&
module
)
.context
(
"every module should have a bitmap"
)
?
}
}
{
// This module needs to be exposed:
// This module needs to be exposed:
// - referenced from another group or
// - referenced from another group or
// - an entry module (TODO assume it will be required for Node/Edge, but not
// - an entry module (TODO assume it will be required for Node/Edge, but not
...
@@ -553,7 +570,9 @@ pub async fn compute_merged_modules(module_graph: Vc<ModuleGraph>) -> Result<Vc<
...
@@ -553,7 +570,9 @@ pub async fn compute_merged_modules(module_graph: Vc<ModuleGraph>) -> Result<Vc<
// Insert occurrences for the "common" list, skip the first because that is now
// Insert occurrences for the "common" list, skip the first because that is now
// guaranteed to exist only once
// guaranteed to exist only once
for
(
i
,
&
m
)
in
common_list
.iter
()
.enumerate
()
.skip
(
1
)
{
for
(
i
,
&
m
)
in
common_list
.iter
()
.enumerate
()
.skip
(
1
)
{
let
occurrences
=
lists_reverse_indices
.get_mut
(
&
m
)
.unwrap
();
let
occurrences
=
lists_reverse_indices
.get_mut
(
&
m
)
.context
(
"every module should have occurrences"
)
?
;
for
common_occurrence
in
&
common_occurrences
{
for
common_occurrence
in
&
common_occurrences
{
let
removed
=
occurrences
.swap_remove
(
&
ListOccurrence
{
let
removed
=
occurrences
.swap_remove
(
&
ListOccurrence
{
chunk_group
:
common_occurrence
.chunk_group
,
chunk_group
:
common_occurrence
.chunk_group
,
...
...
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