Skip to content

Commit

Permalink
put app code into a separate layer
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Oct 13, 2023
1 parent a40a350 commit 8daf3af
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/next-swc/crates/next-api/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ impl AppEndpoint {
.ident()
.with_modifier(Vc::cell("client_shared_chunks".to_string())),
this.app_project.client_runtime_entries(),
this.app_project.project().client_chunking_context(),
this.app_project.project().app_client_chunking_context(),
);

let mut client_shared_chunks_paths = vec![];
Expand Down Expand Up @@ -570,8 +570,8 @@ impl AppEndpoint {
if ssr_and_client {
let client_references_chunks = get_app_client_references_chunks(
client_reference_types,
this.app_project.project().client_chunking_context(),
this.app_project.project().ssr_chunking_context(),
this.app_project.project().app_client_chunking_context(),
this.app_project.project().app_ssr_chunking_context(),
);
let client_references_chunks_ref = client_references_chunks.await?;

Expand Down Expand Up @@ -642,8 +642,8 @@ impl AppEndpoint {
app_entry.original_name.clone(),
client_references,
client_references_chunks,
this.app_project.project().client_chunking_context(),
Vc::upcast(this.app_project.project().ssr_chunking_context()),
this.app_project.project().app_client_chunking_context(),
Vc::upcast(this.app_project.project().app_ssr_chunking_context()),
this.app_project
.project()
.next_config()
Expand Down
13 changes: 13 additions & 0 deletions packages/next-swc/crates/next-api/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,13 @@ impl Project {
))
}

#[turbo_tasks::function]
pub(super) fn app_client_chunking_context(
self: Vc<Self>,
) -> Vc<Box<dyn EcmascriptChunkingContext>> {
self.client_chunking_context().with_layer("app".to_string())
}

#[turbo_tasks::function]
fn server_chunking_context(self: Vc<Self>) -> Vc<BuildChunkingContext> {
get_server_chunking_context(
Expand Down Expand Up @@ -609,6 +616,12 @@ impl Project {
self.server_chunking_context().with_layer("ssr".to_string())
}

#[turbo_tasks::function]
pub(super) fn app_ssr_chunking_context(self: Vc<Self>) -> Vc<BuildChunkingContext> {
self.server_chunking_context()
.with_layer("app ssr".to_string())
}

#[turbo_tasks::function]
pub(super) fn edge_ssr_chunking_context(
self: Vc<Self>,
Expand Down

0 comments on commit 8daf3af

Please sign in to comment.