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
7d82b682
Unverified
Commit
7d82b682
authored
Mar 27, 2024
by
Tobias Koppers
Committed by
GitHub
Mar 27, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: parallelize app structure (#63707)
### What? Allow to scan app structure in parallel Closes PACK-2845
parent
93aac0e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
32 deletions
+57
-32
app_structure.rs
packages/next-swc/crates/next-core/src/app_structure.rs
+57
-32
No files found.
packages/next-swc/crates/next-core/src/app_structure.rs
View file @
7d82b682
...
@@ -9,8 +9,8 @@ use indexmap::{
...
@@ -9,8 +9,8 @@ use indexmap::{
use
serde
::{
Deserialize
,
Serialize
};
use
serde
::{
Deserialize
,
Serialize
};
use
tracing
::
Instrument
;
use
tracing
::
Instrument
;
use
turbo_tasks
::{
use
turbo_tasks
::{
debug
::
ValueDebugFormat
,
trace
::
TraceRawVcs
,
Completion
,
Completions
,
TaskInput
,
ValueToString
,
debug
::
ValueDebugFormat
,
trace
::
TraceRawVcs
,
Completion
,
Completions
,
TaskInput
,
Vc
,
TryJoinIterExt
,
ValueToString
,
Vc
,
};
};
use
turbopack_binding
::{
use
turbopack_binding
::{
turbo
::
tasks_fs
::{
DirectoryContent
,
DirectoryEntry
,
FileSystemEntryType
,
FileSystemPath
},
turbo
::
tasks_fs
::{
DirectoryContent
,
DirectoryEntry
,
FileSystemEntryType
,
FileSystemPath
},
...
@@ -1076,50 +1076,75 @@ async fn directory_tree_to_entrypoints_internal_untraced(
...
@@ -1076,50 +1076,75 @@ async fn directory_tree_to_entrypoints_internal_untraced(
}
}
}
}
for
(
subdir_name
,
&
subdirectory
)
in
subdirectories
.iter
()
{
let
app_page
=
&
app_page
;
let
mut
child_app_page
=
app_page
.clone
();
let
directory_name
=
&
directory_name
;
let
mut
illegal_path
=
None
;
let
subdirectories
=
subdirectories
.iter
()
// When constructing the app_page fails (e. g. due to limitations of the order),
.map
(|(
subdir_name
,
&
subdirectory
)|
async
move
{
// we only want to emit the error when there are actual pages below that
let
mut
child_app_page
=
app_page
.clone
();
// directory.
let
mut
illegal_path
=
None
;
if
let
Err
(
e
)
=
child_app_page
.push_str
(
subdir_name
)
{
illegal_path
=
Some
(
e
);
// When constructing the app_page fails (e. g. due to limitations of the order),
}
// we only want to emit the error when there are actual pages below that
// directory.
let
map
=
directory_tree_to_entrypoints_internal
(
if
let
Err
(
e
)
=
child_app_page
.push_str
(
subdir_name
)
{
app_dir
,
illegal_path
=
Some
(
e
);
global_metadata
,
}
subdir_name
.to_string
(),
subdirectory
,
child_app_page
.clone
(),
)
.await
?
;
if
let
Some
(
illegal_path
)
=
illegal_path
{
let
map
=
directory_tree_to_entrypoints_internal
(
if
!
map
.is_empty
()
{
app_dir
,
return
Err
(
illegal_path
);
global_metadata
,
subdir_name
.to_string
(),
subdirectory
,
child_app_page
.clone
(),
)
.await
?
;
if
let
Some
(
illegal_path
)
=
illegal_path
{
if
!
map
.is_empty
()
{
return
Err
(
illegal_path
);
}
}
}
}
for
(
_
,
entrypoint
)
in
map
.iter
()
{
let
mut
loader_trees
=
Vec
::
new
();
match
*
entrypoint
{
Entrypoint
::
AppPage
{
for
(
_
,
entrypoint
)
in
map
.iter
()
{
if
let
Entrypoint
::
AppPage
{
ref
pages
,
ref
pages
,
loader_tree
:
_
,
loader_tree
:
_
,
}
=>
{
}
=
*
entrypoint
{
for
page
in
pages
{
for
page
in
pages
{
let
app_path
=
AppPath
::
from
(
page
.clone
());
let
app_path
=
AppPath
::
from
(
page
.clone
());
let
loader_tree
=
*
directory_tree_to_loader_tree
(
let
loader_tree
=
directory_tree_to_loader_tree
(
app_dir
,
app_dir
,
global_metadata
,
global_metadata
,
directory_name
.clone
(),
directory_name
.clone
(),
directory_tree_vc
,
directory_tree_vc
,
app_page
.clone
(),
app_page
.clone
(),
app_path
,
app_path
,
)
);
.await
?
;
loader_trees
.push
(
loader_tree
);
}
}
}
Ok
((
map
,
loader_trees
))
})
.try_join
()
.await
?
;
for
(
map
,
loader_trees
)
in
subdirectories
.iter
()
{
let
mut
i
=
0
;
for
(
_
,
entrypoint
)
in
map
.iter
()
{
match
*
entrypoint
{
Entrypoint
::
AppPage
{
ref
pages
,
loader_tree
:
_
,
}
=>
{
for
page
in
pages
{
let
loader_tree
=
*
loader_trees
[
i
]
.await
?
;
i
+=
1
;
add_app_page
(
add_app_page
(
app_dir
,
app_dir
,
...
...
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