@@ -7,8 +7,8 @@ use serde::{Deserialize, Serialize};
7
7
use tracing:: Instrument ;
8
8
use turbo_rcstr:: RcStr ;
9
9
use turbo_tasks:: {
10
- debug:: ValueDebugFormat , fxindexmap, trace:: TraceRawVcs , FxIndexMap , ResolvedVc , TaskInput ,
11
- TryJoinIterExt , ValueDefault , ValueToString , Vc ,
10
+ debug:: ValueDebugFormat , fxindexmap, trace:: TraceRawVcs , FxIndexMap , NonLocalValue , ResolvedVc ,
11
+ TaskInput , TryJoinIterExt , ValueDefault , ValueToString , Vc ,
12
12
} ;
13
13
use turbo_tasks_fs:: { DirectoryContent , DirectoryEntry , FileSystemEntryType , FileSystemPath } ;
14
14
use turbopack_core:: issue:: {
@@ -27,7 +27,7 @@ use crate::{
27
27
} ;
28
28
29
29
/// A final route in the app directory.
30
- #[ turbo_tasks:: value( local ) ]
30
+ #[ turbo_tasks:: value]
31
31
#[ derive( Default , Debug , Clone ) ]
32
32
pub struct AppDirModules {
33
33
#[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -76,24 +76,34 @@ impl AppDirModules {
76
76
}
77
77
78
78
/// A single metadata file plus an optional "alt" text file.
79
- #[ derive( Copy , Clone , Debug , Serialize , Deserialize , PartialEq , Eq , TraceRawVcs ) ]
79
+ #[ derive( Copy , Clone , Debug , Serialize , Deserialize , PartialEq , Eq , TraceRawVcs , NonLocalValue ) ]
80
80
pub enum MetadataWithAltItem {
81
81
Static {
82
- path : Vc < FileSystemPath > ,
83
- alt_path : Option < Vc < FileSystemPath > > ,
82
+ path : ResolvedVc < FileSystemPath > ,
83
+ alt_path : Option < ResolvedVc < FileSystemPath > > ,
84
84
} ,
85
85
Dynamic {
86
- path : Vc < FileSystemPath > ,
86
+ path : ResolvedVc < FileSystemPath > ,
87
87
} ,
88
88
}
89
89
90
90
/// A single metadata file.
91
91
#[ derive(
92
- Copy , Clone , Debug , Hash , Serialize , Deserialize , PartialEq , Eq , TaskInput , TraceRawVcs ,
92
+ Copy ,
93
+ Clone ,
94
+ Debug ,
95
+ Hash ,
96
+ Serialize ,
97
+ Deserialize ,
98
+ PartialEq ,
99
+ Eq ,
100
+ TaskInput ,
101
+ TraceRawVcs ,
102
+ NonLocalValue ,
93
103
) ]
94
104
pub enum MetadataItem {
95
- Static { path : Vc < FileSystemPath > } ,
96
- Dynamic { path : Vc < FileSystemPath > } ,
105
+ Static { path : ResolvedVc < FileSystemPath > } ,
106
+ Dynamic { path : ResolvedVc < FileSystemPath > } ,
97
107
}
98
108
99
109
#[ turbo_tasks:: function]
@@ -120,7 +130,7 @@ pub async fn get_metadata_route_name(meta: MetadataItem) -> Result<Vc<RcStr>> {
120
130
}
121
131
122
132
impl MetadataItem {
123
- pub fn into_path ( self ) -> Vc < FileSystemPath > {
133
+ pub fn into_path ( self ) -> ResolvedVc < FileSystemPath > {
124
134
match self {
125
135
MetadataItem :: Static { path } => path,
126
136
MetadataItem :: Dynamic { path } => path,
@@ -138,7 +148,9 @@ impl From<MetadataWithAltItem> for MetadataItem {
138
148
}
139
149
140
150
/// Metadata file that can be placed in any segment of the app directory.
141
- #[ derive( Default , Clone , Debug , Serialize , Deserialize , PartialEq , Eq , TraceRawVcs ) ]
151
+ #[ derive(
152
+ Default , Clone , Debug , Serialize , Deserialize , PartialEq , Eq , TraceRawVcs , NonLocalValue ,
153
+ ) ]
142
154
pub struct Metadata {
143
155
#[ serde( skip_serializing_if = "Vec::is_empty" , default ) ]
144
156
pub icon : Vec < MetadataWithAltItem > ,
@@ -338,17 +350,17 @@ async fn get_directory_tree_internal(
338
350
"opengraph-image" => & mut metadata_open_graph,
339
351
"sitemap" => {
340
352
if dynamic {
341
- modules. metadata . sitemap = Some ( MetadataItem :: Dynamic { path : * file } ) ;
353
+ modules. metadata . sitemap = Some ( MetadataItem :: Dynamic { path : file } ) ;
342
354
} else {
343
- modules. metadata . sitemap = Some ( MetadataItem :: Static { path : * file } ) ;
355
+ modules. metadata . sitemap = Some ( MetadataItem :: Static { path : file } ) ;
344
356
}
345
357
continue ;
346
358
}
347
359
_ => continue ,
348
360
} ;
349
361
350
362
if dynamic {
351
- entry. push ( ( number, MetadataWithAltItem :: Dynamic { path : * file } ) ) ;
363
+ entry. push ( ( number, MetadataWithAltItem :: Dynamic { path : file } ) ) ;
352
364
continue ;
353
365
}
354
366
@@ -357,14 +369,18 @@ async fn get_directory_tree_internal(
357
369
let basename = file_name
358
370
. rsplit_once ( '.' )
359
371
. map_or ( file_name, |( basename, _) | basename) ;
360
- let alt_path = file. parent ( ) . join ( format ! ( "{}.alt.txt" , basename) . into ( ) ) ;
372
+ let alt_path = file
373
+ . parent ( )
374
+ . join ( format ! ( "{}.alt.txt" , basename) . into ( ) )
375
+ . to_resolved ( )
376
+ . await ?;
361
377
let alt_path = matches ! ( & * alt_path. get_type( ) . await ?, FileSystemEntryType :: File )
362
378
. then_some ( alt_path) ;
363
379
364
380
entry. push ( (
365
381
number,
366
382
MetadataWithAltItem :: Static {
367
- path : * file,
383
+ path : file,
368
384
alt_path,
369
385
} ,
370
386
) ) ;
@@ -1401,9 +1417,9 @@ pub async fn get_global_metadata(
1401
1417
} ;
1402
1418
1403
1419
if dynamic {
1404
- * entry = Some ( MetadataItem :: Dynamic { path : * file } ) ;
1420
+ * entry = Some ( MetadataItem :: Dynamic { path : file } ) ;
1405
1421
} else {
1406
- * entry = Some ( MetadataItem :: Static { path : * file } ) ;
1422
+ * entry = Some ( MetadataItem :: Static { path : file } ) ;
1407
1423
}
1408
1424
// TODO(WEB-952) handle symlinks in app dir
1409
1425
}
0 commit comments