From afd5aec69497d9893deb81bb17791e0fbcda254c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Wed, 27 Nov 2024 12:02:58 +0900 Subject: [PATCH 1/8] `ResolvedVc` --- crates/next-api/src/pages.rs | 28 ++++++++++++++-------------- crates/next-api/src/project.rs | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/crates/next-api/src/pages.rs b/crates/next-api/src/pages.rs index 313cef1caef88..0148c788fd6be 100644 --- a/crates/next-api/src/pages.rs +++ b/crates/next-api/src/pages.rs @@ -80,7 +80,7 @@ use crate::{ #[turbo_tasks::value] pub struct PagesProject { - project: Vc, + project: ResolvedVc, } #[turbo_tasks::value_impl] @@ -598,11 +598,11 @@ impl PagesProject { #[turbo_tasks::value] struct PageEndpoint { ty: PageEndpointType, - pages_project: Vc, - pathname: Vc, - original_name: Vc, - page: Vc, - pages_structure: Vc, + pages_project: ResolvedVc, + pathname: ResolvedVc, + original_name: ResolvedVc, + page: ResolvedVc, + pages_structure: ResolvedVc, } #[derive( @@ -1359,13 +1359,13 @@ impl Endpoint for PageEndpoint { enum PageEndpointOutput { NodeJs { entry_chunk: ResolvedVc>, - server_assets: Vc, - client_assets: Vc, + server_assets: ResolvedVc, + client_assets: ResolvedVc, }, Edge { - files: Vc, - server_assets: Vc, - client_assets: Vc, + files: ResolvedVc, + server_assets: ResolvedVc, + client_assets: ResolvedVc, }, } @@ -1405,11 +1405,11 @@ impl PageEndpointOutput { pub enum SsrChunk { NodeJs { entry: ResolvedVc>, - dynamic_import_entries: Vc, + dynamic_import_entries: ResolvedVc, server_asset_trace_file: ResolvedVc, }, Edge { - files: Vc, - dynamic_import_entries: Vc, + files: ResolvedVc, + dynamic_import_entries: ResolvedVc, }, } diff --git a/crates/next-api/src/project.rs b/crates/next-api/src/project.rs index be1fbc00b6056..49e4442c2b7a8 100644 --- a/crates/next-api/src/project.rs +++ b/crates/next-api/src/project.rs @@ -197,7 +197,7 @@ pub struct Instrumentation { pub struct ProjectContainer { name: RcStr, options_state: State>, - versioned_content_map: Option>, + versioned_content_map: Option>, } #[turbo_tasks::value_impl] From 26d29278593831faf74964347c34264cd4d6fb0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Wed, 27 Nov 2024 12:10:04 +0900 Subject: [PATCH 2/8] Fix more --- crates/next-api/src/app.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/next-api/src/app.rs b/crates/next-api/src/app.rs index a8362eb28e3af..ed925689f8479 100644 --- a/crates/next-api/src/app.rs +++ b/crates/next-api/src/app.rs @@ -1149,7 +1149,7 @@ impl AppEndpoint { ) .await?; server_assets.insert(server_action_manifest.manifest); - Some(server_action_manifest.loader) + Some(server_action_manifest.loader.to_resolved().await?) } else { None }; @@ -1157,7 +1157,7 @@ impl AppEndpoint { let (app_entry_chunks, app_entry_chunks_availability) = &*self .app_entry_chunks( client_references, - server_action_manifest_loader, + server_action_manifest_loader.map(|v| *v), server_path, process_client_assets, ) From 3c896bd339062bf410135a55264f9ff5e7854699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Wed, 27 Nov 2024 12:10:11 +0900 Subject: [PATCH 3/8] Fix more --- crates/next-api/src/pages.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/next-api/src/pages.rs b/crates/next-api/src/pages.rs index 0148c788fd6be..7dfe47fb104bf 100644 --- a/crates/next-api/src/pages.rs +++ b/crates/next-api/src/pages.rs @@ -86,7 +86,7 @@ pub struct PagesProject { #[turbo_tasks::value_impl] impl PagesProject { #[turbo_tasks::function] - pub fn new(project: Vc) -> Vc { + pub fn new(project: ResolvedVc) -> Vc { PagesProject { project }.cell() } @@ -234,7 +234,7 @@ impl PagesProject { #[turbo_tasks::function] fn project(&self) -> Vc { - self.project + *self.project } #[turbo_tasks::function] From 4d2c3c09ac38fc63478f9f00af1b1b78cc366604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Wed, 27 Nov 2024 12:13:00 +0900 Subject: [PATCH 4/8] Fix more --- crates/next-api/src/pages.rs | 41 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/crates/next-api/src/pages.rs b/crates/next-api/src/pages.rs index 7dfe47fb104bf..815d9f553bbac 100644 --- a/crates/next-api/src/pages.rs +++ b/crates/next-api/src/pages.rs @@ -629,11 +629,11 @@ impl PageEndpoint { #[turbo_tasks::function] fn new( ty: PageEndpointType, - pages_project: Vc, - pathname: Vc, - original_name: Vc, - page: Vc, - pages_structure: Vc, + pages_project: ResolvedVc, + pathname: ResolvedVc, + original_name: ResolvedVc, + page: ResolvedVc, + pages_structure: ResolvedVc, ) -> Vc { PageEndpoint { ty, @@ -657,7 +657,7 @@ impl PageEndpoint { let page_loader = create_page_loader_entry_module( this.pages_project.client_module_context(), self.source(), - this.pathname, + *this.pathname, ); if matches!( *this.pages_project.project().next_mode().await?, @@ -721,7 +721,7 @@ impl PageEndpoint { let client_relative_path = self.client_relative_path(); let page_loader = PageLoaderAsset::new( node_root, - this.pathname, + *this.pathname, client_relative_path, client_chunks, ); @@ -762,13 +762,13 @@ impl PageEndpoint { let ssr_module = if is_edge { create_page_ssr_entry_module( - this.pathname, + *this.pathname, reference_type, project_root, Vc::upcast(edge_module_context), self.source(), - this.original_name, - this.pages_structure, + *this.original_name, + *this.pages_structure, config.runtime, this.pages_project.project().next_config(), ) @@ -781,13 +781,13 @@ impl PageEndpoint { ssr_module } else { create_page_ssr_entry_module( - this.pathname, + *this.pathname, reference_type, project_root, Vc::upcast(module_context), self.source(), - this.original_name, - this.pages_structure, + *this.original_name, + *this.pages_structure, config.runtime, this.pages_project.project().next_config(), ) @@ -836,11 +836,14 @@ impl PageEndpoint { .context("could not process page loader entry module")?; evaluatable_assets.push(evaluatable); - let edge_files = edge_chunking_context.evaluated_chunk_group_assets( - ssr_module.ident(), - Vc::cell(evaluatable_assets), - Value::new(AvailabilityInfo::Root), - ); + let edge_files = edge_chunking_context + .evaluated_chunk_group_assets( + ssr_module.ident(), + Vc::cell(evaluatable_assets), + Value::new(AvailabilityInfo::Root), + ) + .to_resolved() + .await?; let client_chunking_context = this.pages_project.project().client_chunking_context(); @@ -848,6 +851,8 @@ impl PageEndpoint { Vc::upcast(client_chunking_context), dynamic_import_modules, ) + .await? + .to_resolved() .await?; Ok(SsrChunk::Edge { From fea8947c885fe7c3b48028d34c2ee8bb5e3d1a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Wed, 27 Nov 2024 12:13:35 +0900 Subject: [PATCH 5/8] Fix more --- crates/next-api/src/pages.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/next-api/src/pages.rs b/crates/next-api/src/pages.rs index 815d9f553bbac..81ff69e69e28d 100644 --- a/crates/next-api/src/pages.rs +++ b/crates/next-api/src/pages.rs @@ -887,6 +887,8 @@ impl PageEndpoint { dynamic_import_modules, Value::new(AvailabilityInfo::Root), ) + .await? + .to_resolved() .await?; let server_asset_trace_file = if this @@ -1069,7 +1071,7 @@ impl PageEndpoint { let pathname = this.pathname.await?; let original_name = &*this.original_name.await?; - let client_assets = OutputAssets::new(client_assets); + let client_assets = OutputAssets::new(client_assets).to_resolved().await?; let manifest_path_prefix = get_asset_prefix_from_pathname(&pathname); let node_root = this.pages_project.project().node_root(); @@ -1122,13 +1124,13 @@ impl PageEndpoint { server_assets.push(pages_manifest); let loadable_manifest_output = - self.react_loadable_manifest(dynamic_import_entries); + self.react_loadable_manifest(*dynamic_import_entries); server_assets.extend(loadable_manifest_output.await?.iter().copied()); } PageEndpointOutput::NodeJs { entry_chunk: entry, - server_assets: Vc::cell(server_assets), + server_assets: ResolvedVc::cell(server_assets), client_assets, } } From fb141b7d67dba690390bd9629bb67851657516b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Wed, 27 Nov 2024 12:14:04 +0900 Subject: [PATCH 6/8] Fix more --- crates/next-api/src/pages.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/next-api/src/pages.rs b/crates/next-api/src/pages.rs index 81ff69e69e28d..c6378cb7315ba 100644 --- a/crates/next-api/src/pages.rs +++ b/crates/next-api/src/pages.rs @@ -1082,7 +1082,7 @@ impl PageEndpoint { original_name, &manifest_path_prefix, &pathname, - client_assets, + *client_assets, false, ) .await?; @@ -1164,7 +1164,7 @@ impl PageEndpoint { file_paths_from_root .extend(get_js_paths_from_root(&node_root_value, &files_value).await?); - let all_output_assets = all_assets_from_entries(files).await?; + let all_output_assets = all_assets_from_entries(*files).await?; wasm_paths_from_root.extend( get_wasm_paths_from_root(&node_root_value, &all_output_assets).await?, From ac8e87bf4f45eacd6f4ef2364ca4a908bc3d5b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Wed, 27 Nov 2024 12:15:01 +0900 Subject: [PATCH 7/8] Fix more --- crates/next-api/src/pages.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/next-api/src/pages.rs b/crates/next-api/src/pages.rs index c6378cb7315ba..09e9c5a145229 100644 --- a/crates/next-api/src/pages.rs +++ b/crates/next-api/src/pages.rs @@ -1216,12 +1216,13 @@ impl PageEndpoint { server_assets.push(ResolvedVc::upcast(middleware_manifest_v2)); } - let loadable_manifest_output = self.react_loadable_manifest(dynamic_import_entries); + let loadable_manifest_output = + self.react_loadable_manifest(*dynamic_import_entries); server_assets.extend(loadable_manifest_output.await?.iter().copied()); PageEndpointOutput::Edge { files, - server_assets: Vc::cell(server_assets), + server_assets: ResolvedVc::cell(server_assets), client_assets, } } @@ -1395,7 +1396,7 @@ impl PageEndpointOutput { pub fn server_assets(&self) -> Vc { match *self { PageEndpointOutput::NodeJs { server_assets, .. } - | PageEndpointOutput::Edge { server_assets, .. } => server_assets, + | PageEndpointOutput::Edge { server_assets, .. } => *server_assets, } } @@ -1403,7 +1404,7 @@ impl PageEndpointOutput { pub fn client_assets(&self) -> Vc { match *self { PageEndpointOutput::NodeJs { client_assets, .. } - | PageEndpointOutput::Edge { client_assets, .. } => client_assets, + | PageEndpointOutput::Edge { client_assets, .. } => *client_assets, } } } From 85e44c390108c2624f80ee27f750cc4467d0c37f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Wed, 27 Nov 2024 12:15:44 +0900 Subject: [PATCH 8/8] Fix more --- crates/next-api/src/project.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/crates/next-api/src/project.rs b/crates/next-api/src/project.rs index 49e4442c2b7a8..5bc6efd558f4d 100644 --- a/crates/next-api/src/project.rs +++ b/crates/next-api/src/project.rs @@ -203,15 +203,19 @@ pub struct ProjectContainer { #[turbo_tasks::value_impl] impl ProjectContainer { #[turbo_tasks::function] - pub fn new(name: RcStr, dev: bool) -> Vc { - ProjectContainer { + pub async fn new(name: RcStr, dev: bool) -> Result> { + Ok(ProjectContainer { name, // we only need to enable versioning in dev mode, since build // is assumed to be operating over a static snapshot - versioned_content_map: dev.then(VersionedContentMap::new), + versioned_content_map: if dev { + Some(VersionedContentMap::new().to_resolved().await?) + } else { + None + }, options_state: State::new(None), } - .cell() + .cell()) } } @@ -384,7 +388,7 @@ impl ProjectContainer { } else { NextMode::Build.cell() }, - versioned_content_map: self.versioned_content_map, + versioned_content_map: self.versioned_content_map.map(|v| *v), build_id, encryption_key, preview_props,