@@ -2,12 +2,13 @@ use std::iter::once;
2
2
3
3
use anyhow:: { bail, Context , Result } ;
4
4
use tracing:: Instrument ;
5
- use turbo_tasks:: { RcStr , Value , ValueToString , Vc } ;
5
+ use turbo_tasks:: { debug :: ValueDebug , RcStr , Value , ValueToString , Vc } ;
6
6
use turbo_tasks_fs:: FileSystemPath ;
7
7
use turbopack_core:: {
8
8
chunk:: {
9
9
availability_info:: AvailabilityInfo ,
10
10
chunk_group:: { make_chunk_group, MakeChunkGroupResult } ,
11
+ global_information:: OptionGlobalInformation ,
11
12
Chunk , ChunkGroupResult , ChunkItem , ChunkableModule , ChunkingContext ,
12
13
EntryChunkGroupResult , EvaluatableAssets , MinifyType , ModuleId ,
13
14
} ,
@@ -84,6 +85,8 @@ pub struct NodeJsChunkingContext {
84
85
minify_type : MinifyType ,
85
86
/// Whether to use manifest chunks for lazy compilation
86
87
manifest_chunks : bool ,
88
+ /// Global information
89
+ global_information : Vc < OptionGlobalInformation > ,
87
90
}
88
91
89
92
impl NodeJsChunkingContext {
@@ -96,6 +99,7 @@ impl NodeJsChunkingContext {
96
99
asset_root_path : Vc < FileSystemPath > ,
97
100
environment : Vc < Environment > ,
98
101
runtime_type : RuntimeType ,
102
+ global_information : Vc < OptionGlobalInformation > ,
99
103
) -> NodeJsChunkingContextBuilder {
100
104
NodeJsChunkingContextBuilder {
101
105
chunking_context : NodeJsChunkingContext {
@@ -109,6 +113,7 @@ impl NodeJsChunkingContext {
109
113
runtime_type,
110
114
minify_type : MinifyType :: NoMinify ,
111
115
manifest_chunks : false ,
116
+ global_information,
112
117
} ,
113
118
}
114
119
}
@@ -131,6 +136,16 @@ impl NodeJsChunkingContext {
131
136
132
137
#[ turbo_tasks:: value_impl]
133
138
impl NodeJsChunkingContext {
139
+ #[ turbo_tasks:: function]
140
+ async fn chunk_item_id_from_ident (
141
+ self : Vc < Self > ,
142
+ ident : Vc < AssetIdent > ,
143
+ ) -> Result < Vc < ModuleId > > {
144
+ let this = self . await ?;
145
+ dbg ! ( this. global_information. dbg( ) . await ?) ;
146
+ Ok ( ModuleId :: String ( ident. to_string ( ) . await ?. clone_value ( ) ) . cell ( ) )
147
+ }
148
+
134
149
#[ turbo_tasks:: function]
135
150
fn new ( this : Value < NodeJsChunkingContext > ) -> Vc < Self > {
136
151
this. into_value ( ) . cell ( )
0 commit comments