@@ -10,8 +10,8 @@ use rustc_hash::FxHashMap;
10
10
use serde:: { Deserialize , Serialize } ;
11
11
use tracing:: Instrument ;
12
12
use turbo_tasks:: {
13
- debug:: ValueDebugFormat , trace:: TraceRawVcs , RcStr , TaskInput , TryJoinIterExt , ValueToString ,
14
- Vc ,
13
+ debug:: ValueDebugFormat , trace:: TraceRawVcs , RcStr , ResolvedVc , TaskInput , TryJoinIterExt ,
14
+ ValueToString , Vc ,
15
15
} ;
16
16
use turbo_tasks_fs:: { DirectoryContent , DirectoryEntry , FileSystemEntryType , FileSystemPath } ;
17
17
use turbopack_core:: issue:: {
@@ -296,23 +296,22 @@ async fn get_directory_tree_internal(
296
296
let entry = entry. resolve_symlink ( ) . await ?;
297
297
match entry {
298
298
DirectoryEntry :: File ( file) => {
299
- let file = file. resolve ( ) . await ?;
300
299
// Do not process .d.ts files as routes
301
300
if basename. ends_with ( ".d.ts" ) {
302
301
continue ;
303
302
}
304
303
if let Some ( ( stem, ext) ) = basename. split_once ( '.' ) {
305
304
if page_extensions_value. iter ( ) . any ( |e| e == ext) {
306
305
match stem {
307
- "page" => modules. page = Some ( file) ,
308
- "layout" => modules. layout = Some ( file) ,
309
- "error" => modules. error = Some ( file) ,
310
- "global-error" => modules. global_error = Some ( file) ,
311
- "loading" => modules. loading = Some ( file) ,
312
- "template" => modules. template = Some ( file) ,
313
- "not-found" => modules. not_found = Some ( file) ,
314
- "default" => modules. default = Some ( file) ,
315
- "route" => modules. route = Some ( file) ,
306
+ "page" => modules. page = Some ( * file) ,
307
+ "layout" => modules. layout = Some ( * file) ,
308
+ "error" => modules. error = Some ( * file) ,
309
+ "global-error" => modules. global_error = Some ( * file) ,
310
+ "loading" => modules. loading = Some ( * file) ,
311
+ "template" => modules. template = Some ( * file) ,
312
+ "not-found" => modules. not_found = Some ( * file) ,
313
+ "default" => modules. default = Some ( * file) ,
314
+ "route" => modules. route = Some ( * file) ,
316
315
_ => { }
317
316
}
318
317
}
@@ -334,17 +333,17 @@ async fn get_directory_tree_internal(
334
333
"opengraph-image" => & mut metadata_open_graph,
335
334
"sitemap" => {
336
335
if dynamic {
337
- modules. metadata . sitemap = Some ( MetadataItem :: Dynamic { path : file } ) ;
336
+ modules. metadata . sitemap = Some ( MetadataItem :: Dynamic { path : * file } ) ;
338
337
} else {
339
- modules. metadata . sitemap = Some ( MetadataItem :: Static { path : file } ) ;
338
+ modules. metadata . sitemap = Some ( MetadataItem :: Static { path : * file } ) ;
340
339
}
341
340
continue ;
342
341
}
343
342
_ => continue ,
344
343
} ;
345
344
346
345
if dynamic {
347
- entry. push ( ( number, MetadataWithAltItem :: Dynamic { path : file } ) ) ;
346
+ entry. push ( ( number, MetadataWithAltItem :: Dynamic { path : * file } ) ) ;
348
347
continue ;
349
348
}
350
349
@@ -360,16 +359,15 @@ async fn get_directory_tree_internal(
360
359
entry. push ( (
361
360
number,
362
361
MetadataWithAltItem :: Static {
363
- path : file,
362
+ path : * file,
364
363
alt_path,
365
364
} ,
366
365
) ) ;
367
366
}
368
367
DirectoryEntry :: Directory ( dir) => {
369
- let dir = dir. resolve ( ) . await ?;
370
368
// appDir ignores paths starting with an underscore
371
369
if !basename. starts_with ( '_' ) {
372
- let result = get_directory_tree ( dir, page_extensions) ;
370
+ let result = get_directory_tree ( * dir, page_extensions) ;
373
371
subdirectories. insert ( basename. clone ( ) , result) ;
374
372
}
375
373
}
@@ -484,12 +482,12 @@ impl AppPageLoaderTree {
484
482
pub enum Entrypoint {
485
483
AppPage {
486
484
pages : Vec < AppPage > ,
487
- loader_tree : Vc < AppPageLoaderTree > ,
485
+ loader_tree : ResolvedVc < AppPageLoaderTree > ,
488
486
} ,
489
487
AppRoute {
490
488
page : AppPage ,
491
- path : Vc < FileSystemPath > ,
492
- root_layouts : Vc < Vec < Vc < FileSystemPath > > > ,
489
+ path : ResolvedVc < FileSystemPath > ,
490
+ root_layouts : ResolvedVc < Vec < Vc < FileSystemPath > > > ,
493
491
} ,
494
492
AppMetadata {
495
493
page : AppPage ,
@@ -557,7 +555,7 @@ fn add_app_page(
557
555
app_dir : Vc < FileSystemPath > ,
558
556
result : & mut IndexMap < AppPath , Entrypoint > ,
559
557
page : AppPage ,
560
- loader_tree : Vc < AppPageLoaderTree > ,
558
+ loader_tree : ResolvedVc < AppPageLoaderTree > ,
561
559
) {
562
560
let mut e = match result. entry ( page. clone ( ) . into ( ) ) {
563
561
Entry :: Occupied ( e) => e,
@@ -616,8 +614,8 @@ fn add_app_route(
616
614
app_dir : Vc < FileSystemPath > ,
617
615
result : & mut IndexMap < AppPath , Entrypoint > ,
618
616
page : AppPage ,
619
- path : Vc < FileSystemPath > ,
620
- root_layouts : Vc < Vec < Vc < FileSystemPath > > > ,
617
+ path : ResolvedVc < FileSystemPath > ,
618
+ root_layouts : ResolvedVc < Vec < Vc < FileSystemPath > > > ,
621
619
) {
622
620
let e = match result. entry ( page. clone ( ) . into ( ) ) {
623
621
Entry :: Occupied ( e) => e,
@@ -1046,7 +1044,7 @@ async fn directory_tree_to_entrypoints_internal(
1046
1044
directory_name : RcStr ,
1047
1045
directory_tree : Vc < DirectoryTree > ,
1048
1046
app_page : AppPage ,
1049
- root_layouts : Vc < Vec < Vc < FileSystemPath > > > ,
1047
+ root_layouts : ResolvedVc < Vec < Vc < FileSystemPath > > > ,
1050
1048
) -> Result < Vc < Entrypoints > > {
1051
1049
let span = tracing:: info_span!( "build layout trees" , name = display( & app_page) ) ;
1052
1050
directory_tree_to_entrypoints_internal_untraced (
@@ -1067,7 +1065,7 @@ async fn directory_tree_to_entrypoints_internal_untraced(
1067
1065
directory_name : RcStr ,
1068
1066
directory_tree : Vc < DirectoryTree > ,
1069
1067
app_page : AppPage ,
1070
- root_layouts : Vc < Vec < Vc < FileSystemPath > > > ,
1068
+ root_layouts : ResolvedVc < Vec < Vc < FileSystemPath > > > ,
1071
1069
) -> Result < Vc < Entrypoints > > {
1072
1070
let mut result = IndexMap :: new ( ) ;
1073
1071
@@ -1082,7 +1080,7 @@ async fn directory_tree_to_entrypoints_internal_untraced(
1082
1080
let root_layouts = if let Some ( layout) = modules. layout {
1083
1081
let mut layouts = ( * root_layouts. await ?) . clone ( ) ;
1084
1082
layouts. push ( layout) ;
1085
- Vc :: cell ( layouts)
1083
+ ResolvedVc :: cell ( layouts)
1086
1084
} else {
1087
1085
root_layouts
1088
1086
} ;
@@ -1104,7 +1102,10 @@ async fn directory_tree_to_entrypoints_internal_untraced(
1104
1102
app_dir,
1105
1103
& mut result,
1106
1104
app_page. complete ( PageType :: Page ) ?,
1107
- loader_tree. context ( "loader tree should be created for a page/default" ) ?,
1105
+ loader_tree
1106
+ . context ( "loader tree should be created for a page/default" ) ?
1107
+ . to_resolved ( )
1108
+ . await ?,
1108
1109
) ;
1109
1110
}
1110
1111
@@ -1113,7 +1114,7 @@ async fn directory_tree_to_entrypoints_internal_untraced(
1113
1114
app_dir,
1114
1115
& mut result,
1115
1116
app_page. complete ( PageType :: Route ) ?,
1116
- route,
1117
+ route. to_resolved ( ) . await ? ,
1117
1118
root_layouts,
1118
1119
) ;
1119
1120
}
@@ -1191,7 +1192,7 @@ async fn directory_tree_to_entrypoints_internal_untraced(
1191
1192
} ,
1192
1193
modules : modules. without_leafs ( ) ,
1193
1194
global_metadata,
1194
- } . cell ( ) ;
1195
+ } . resolved_cell ( ) ;
1195
1196
1196
1197
{
1197
1198
let app_page = app_page
@@ -1223,7 +1224,7 @@ async fn directory_tree_to_entrypoints_internal_untraced(
1223
1224
subdir_name. clone ( ) ,
1224
1225
subdirectory,
1225
1226
child_app_page. clone ( ) ,
1226
- root_layouts,
1227
+ * root_layouts,
1227
1228
)
1228
1229
. await ?;
1229
1230
@@ -1278,7 +1279,9 @@ async fn directory_tree_to_entrypoints_internal_untraced(
1278
1279
& mut result,
1279
1280
page. clone ( ) ,
1280
1281
loader_tree
1281
- . context ( "loader tree should be created for a page/default" ) ?,
1282
+ . context ( "loader tree should be created for a page/default" ) ?
1283
+ . to_resolved ( )
1284
+ . await ?,
1282
1285
) ;
1283
1286
}
1284
1287
}
0 commit comments