1
1
use std:: {
2
2
env:: current_dir,
3
3
mem:: forget,
4
- path:: { PathBuf , MAIN_SEPARATOR } ,
4
+ path:: { MAIN_SEPARATOR , PathBuf } ,
5
5
sync:: Arc ,
6
6
} ;
7
7
8
- use anyhow:: { bail , Context , Result } ;
8
+ use anyhow:: { Context , Result , bail } ;
9
9
use rustc_hash:: FxHashSet ;
10
10
use turbo_rcstr:: RcStr ;
11
11
use turbo_tasks:: {
12
- apply_effects , ReadConsistency , ResolvedVc , TransientInstance , TryJoinIterExt , TurboTasks ,
13
- Value , Vc ,
12
+ ReadConsistency , ResolvedVc , TransientInstance , TryJoinIterExt , TurboTasks , Value , Vc ,
13
+ apply_effects ,
14
14
} ;
15
15
use turbo_tasks_backend:: {
16
- noop_backing_storage , BackendOptions , NoopBackingStorage , TurboTasksBackend ,
16
+ BackendOptions , NoopBackingStorage , TurboTasksBackend , noop_backing_storage ,
17
17
} ;
18
18
use turbo_tasks_fs:: FileSystem ;
19
19
use turbopack:: global_module_ids:: get_global_module_id_strategy;
@@ -22,16 +22,16 @@ use turbopack_cli_utils::issue::{ConsoleUi, LogOptions};
22
22
use turbopack_core:: {
23
23
asset:: Asset ,
24
24
chunk:: {
25
- availability_info :: AvailabilityInfo , ChunkingConfig , ChunkingContext , EvaluatableAsset ,
26
- EvaluatableAssets , MinifyType , SourceMapsType ,
25
+ ChunkingConfig , ChunkingContext , EvaluatableAsset , EvaluatableAssets , MinifyType ,
26
+ SourceMapsType , availability_info :: AvailabilityInfo ,
27
27
} ,
28
28
environment:: { BrowserEnvironment , Environment , ExecutionEnvironment , NodeJsEnvironment } ,
29
29
ident:: AssetIdent ,
30
- issue:: { handle_issues , IssueReporter , IssueSeverity } ,
30
+ issue:: { IssueReporter , IssueSeverity , handle_issues } ,
31
31
module:: Module ,
32
32
module_graph:: {
33
- chunk_group_info:: { ChunkGroup , ChunkGroupEntry } ,
34
33
ModuleGraph ,
34
+ chunk_group_info:: { ChunkGroup , ChunkGroupEntry } ,
35
35
} ,
36
36
output:: { OutputAsset , OutputAssets } ,
37
37
reference:: all_assets_from_entries,
@@ -48,9 +48,9 @@ use turbopack_nodejs::NodeJsChunkingContext;
48
48
49
49
use crate :: {
50
50
arguments:: { BuildArguments , Target } ,
51
- contexts:: { get_client_asset_context , get_client_compile_time_info , NodeEnv } ,
51
+ contexts:: { NodeEnv , get_client_asset_context , get_client_compile_time_info } ,
52
52
util:: {
53
- normalize_dirs , normalize_entries , output_fs , project_fs , EntryRequest , NormalizedDirs ,
53
+ EntryRequest , NormalizedDirs , normalize_dirs , normalize_entries , output_fs , project_fs ,
54
54
} ,
55
55
} ;
56
56
@@ -149,7 +149,9 @@ impl TurbopackBuildBuilder {
149
149
// Await the result to propagate any errors.
150
150
build_result_op. read_strongly_consistent ( ) . await ?;
151
151
152
- apply_effects ( build_result_op) . await ?;
152
+ apply_effects ( build_result_op)
153
+ . instrument ( tracing:: info_span!( "apply effects" ) )
154
+ . await ?;
153
155
154
156
let issue_reporter: Vc < Box < dyn IssueReporter > > =
155
157
Vc :: upcast ( ConsoleUi :: new ( TransientInstance :: new ( LogOptions {
@@ -270,26 +272,30 @@ async fn build_internal(
270
272
271
273
let origin = PlainResolveOrigin :: new ( asset_context, project_fs. root ( ) . join ( "_" . into ( ) ) ) ;
272
274
let project_dir = & project_dir;
273
- let entries = entry_requests
274
- . into_iter ( )
275
- . map ( |request_vc| async move {
276
- let ty = Value :: new ( ReferenceType :: Entry ( EntryReferenceSubType :: Undefined ) ) ;
277
- let request = request_vc. await ?;
278
- origin
279
- . resolve_asset ( request_vc, origin. resolve_options ( ty. clone ( ) ) , ty)
280
- . await ?
281
- . first_module ( )
282
- . await ?
283
- . with_context ( || {
284
- format ! (
285
- "Unable to resolve entry {} from directory {}." ,
286
- request. request( ) . unwrap( ) ,
287
- project_dir
288
- )
289
- } )
290
- } )
291
- . try_join ( )
292
- . await ?;
275
+ let entries = async move {
276
+ entry_requests
277
+ . into_iter ( )
278
+ . map ( |request_vc| async move {
279
+ let ty = Value :: new ( ReferenceType :: Entry ( EntryReferenceSubType :: Undefined ) ) ;
280
+ let request = request_vc. await ?;
281
+ origin
282
+ . resolve_asset ( request_vc, origin. resolve_options ( ty. clone ( ) ) , ty)
283
+ . await ?
284
+ . first_module ( )
285
+ . await ?
286
+ . with_context ( || {
287
+ format ! (
288
+ "Unable to resolve entry {} from directory {}." ,
289
+ request. request( ) . unwrap( ) ,
290
+ project_dir
291
+ )
292
+ } )
293
+ } )
294
+ . try_join ( )
295
+ . await
296
+ }
297
+ . instrument ( tracing:: info_span!( "resolve entries" ) )
298
+ . await ?;
293
299
294
300
let module_graph =
295
301
ModuleGraph :: from_modules ( Vc :: cell ( vec ! [ ChunkGroupEntry :: Entry ( entries. clone( ) ) ] ) ) ;
@@ -445,7 +451,11 @@ async fn build_internal(
445
451
446
452
let mut chunks: FxHashSet < ResolvedVc < Box < dyn OutputAsset > > > = FxHashSet :: default ( ) ;
447
453
for chunk_group in entry_chunk_groups {
448
- chunks. extend ( & * all_assets_from_entries ( * chunk_group) . await ?) ;
454
+ chunks. extend (
455
+ & * async move { all_assets_from_entries ( * chunk_group) . await }
456
+ . instrument ( tracing:: info_span!( "list chunks" ) )
457
+ . await ?,
458
+ ) ;
449
459
}
450
460
451
461
chunks
0 commit comments