@@ -21,6 +21,7 @@ use next_api::{
2121 ProjectOptions , WatchOptions ,
2222 } ,
2323 route:: Endpoint ,
24+ routes_hashes_manifest:: routes_hashes_manifest_asset_if_enabled,
2425} ;
2526use next_core:: tracing_presets:: {
2627 TRACING_NEXT_OVERVIEW_TARGETS , TRACING_NEXT_TARGETS , TRACING_NEXT_TURBO_TASKS_TARGETS ,
@@ -137,8 +138,8 @@ pub struct NapiProjectOptions {
137138 /// Unix path. E.g. `apps/my-app`
138139 pub project_path : RcStr ,
139140
140- /// A path where to emit the build outputs, relative to [`Project::project_path`], always Unix
141- /// path. Corresponds to next.config.js's `distDir` .
141+ /// A path where tracing output will be written to and/or cache is read/written.
142+ /// Usually equal to the `distDir` in next.config.js.
142143 /// E.g. `.next`
143144 pub dist_dir : RcStr ,
144145
@@ -192,11 +193,6 @@ pub struct NapiPartialProjectOptions {
192193 /// E.g. `apps/my-app`
193194 pub project_path : Option < RcStr > ,
194195
195- /// A path where to emit the build outputs, relative to [`Project::project_path`], always a
196- /// Unix path. Corresponds to next.config.js's `distDir`.
197- /// E.g. `.next`
198- pub dist_dir : Option < Option < RcStr > > ,
199-
200196 /// Filesystem watcher options.
201197 pub watch : Option < NapiWatchOptions > ,
202198
@@ -267,43 +263,70 @@ impl From<NapiWatchOptions> for WatchOptions {
267263
268264impl From < NapiProjectOptions > for ProjectOptions {
269265 fn from ( val : NapiProjectOptions ) -> Self {
266+ let NapiProjectOptions {
267+ root_path,
268+ project_path,
269+ // Only used for initializing cache and tracing
270+ dist_dir : _,
271+ watch,
272+ next_config,
273+ env,
274+ define_env,
275+ dev,
276+ encryption_key,
277+ build_id,
278+ preview_props,
279+ browserslist_query,
280+ no_mangling,
281+ current_node_js_version,
282+ } = val;
270283 ProjectOptions {
271- root_path : val. root_path ,
272- project_path : val. project_path ,
273- watch : val. watch . into ( ) ,
274- next_config : val. next_config ,
275- env : val
276- . env
277- . into_iter ( )
278- . map ( |var| ( var. name , var. value ) )
279- . collect ( ) ,
280- define_env : val. define_env . into ( ) ,
281- dev : val. dev ,
282- encryption_key : val. encryption_key ,
283- build_id : val. build_id ,
284- preview_props : val. preview_props . into ( ) ,
285- browserslist_query : val. browserslist_query ,
286- no_mangling : val. no_mangling ,
287- current_node_js_version : val. current_node_js_version ,
284+ root_path,
285+ project_path,
286+ watch : watch. into ( ) ,
287+ next_config,
288+ env : env. into_iter ( ) . map ( |var| ( var. name , var. value ) ) . collect ( ) ,
289+ define_env : define_env. into ( ) ,
290+ dev,
291+ encryption_key,
292+ build_id,
293+ preview_props : preview_props. into ( ) ,
294+ browserslist_query,
295+ no_mangling,
296+ current_node_js_version,
288297 }
289298 }
290299}
291300
292301impl From < NapiPartialProjectOptions > for PartialProjectOptions {
293302 fn from ( val : NapiPartialProjectOptions ) -> Self {
303+ let NapiPartialProjectOptions {
304+ root_path,
305+ project_path,
306+ watch,
307+ next_config,
308+ env,
309+ define_env,
310+ dev,
311+ encryption_key,
312+ build_id,
313+ preview_props,
314+ browserslist_query,
315+ no_mangling,
316+ } = val;
294317 PartialProjectOptions {
295- root_path : val . root_path ,
296- project_path : val . project_path ,
297- watch : val . watch . map ( From :: from) ,
298- next_config : val . next_config ,
299- env : val
300- . env
301- . map ( |env| env . into_iter ( ) . map ( |var| ( var . name , var . value ) ) . collect ( ) ) ,
302- define_env : val . define_env . map ( |env| env . into ( ) ) ,
303- dev : val . dev ,
304- encryption_key : val . encryption_key ,
305- build_id : val . build_id ,
306- preview_props : val . preview_props . map ( |props| props . into ( ) ) ,
318+ root_path,
319+ project_path,
320+ watch : watch. map ( From :: from) ,
321+ next_config,
322+ env : env . map ( |env| env . into_iter ( ) . map ( |var| ( var . name , var . value ) ) . collect ( ) ) ,
323+ define_env : define_env . map ( | env| env . into ( ) ) ,
324+ dev ,
325+ encryption_key ,
326+ build_id ,
327+ preview_props : preview_props . map ( |props| props . into ( ) ) ,
328+ browserslist_query ,
329+ no_mangling ,
307330 }
308331 }
309332}
@@ -1035,12 +1058,15 @@ async fn output_assets_operation(
10351058
10361059 let nft = next_server_nft_assets ( project) . await ?;
10371060
1061+ let routes_hashes_manifest = routes_hashes_manifest_asset_if_enabled ( project) . await ?;
1062+
10381063 whole_app_module_graphs. as_side_effect ( ) . await ?;
10391064
10401065 Ok ( Vc :: cell (
10411066 output_assets
10421067 . into_iter ( )
10431068 . chain ( nft. iter ( ) . copied ( ) )
1069+ . chain ( routes_hashes_manifest. iter ( ) . copied ( ) )
10441070 . collect ( ) ,
10451071 ) )
10461072}
0 commit comments