Skip to content

Commit

Permalink
Turbopack: Chunking Refactoring (#56756)
Browse files Browse the repository at this point in the history
### What?

see vercel/turborepo#6160

### Turbopack Changes

* vercel/turborepo#6116 
* vercel/turborepo#6140 
* vercel/turborepo#6118 
* vercel/turborepo#6128 
* vercel/turborepo#6129 
* vercel/turborepo#6160 


Closes WEB-1772

Co-authored-by: Justin Ridgewell <112982+jridgewell@users.noreply.github.com>
  • Loading branch information
sokra and jridgewell authored Oct 13, 2023
1 parent e8a92a9 commit 04bad16
Show file tree
Hide file tree
Showing 20 changed files with 91 additions and 89 deletions.
68 changes: 35 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ swc_core = { version = "0.83.28", features = [
testing = { version = "0.34.1" }

# Turbo crates
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-231006.4" }
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-231013.2" }
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-231006.4" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-231013.2" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-231006.4" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-231013.2" }

# General Deps

Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/next-api/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ impl AppEndpoint {
.app_project
.project()
.rsc_chunking_context()
.entry_chunk(
.entry_chunk_group(
server_path.join(format!(
"app{original_name}.js",
original_name = app_entry.original_name
Expand Down
7 changes: 5 additions & 2 deletions packages/next-swc/crates/next-api/src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,11 @@ impl PageEndpoint {

let ssr_entry_chunk_path_string = format!("pages{asset_path}");
let ssr_entry_chunk_path = node_path.join(ssr_entry_chunk_path_string);
let ssr_entry_chunk =
chunking_context.entry_chunk(ssr_entry_chunk_path, ssr_module, runtime_entries);
let ssr_entry_chunk = chunking_context.entry_chunk_group(
ssr_entry_chunk_path,
ssr_module,
runtime_entries,
);

Ok(SsrChunk::NodeJs {
entry: ssr_entry_chunk,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ pub async fn compute_app_entries_chunks(
.entry(Vc::upcast(app_entry.rsc_entry))
.await?;

let rsc_chunk = rsc_chunking_context.entry_chunk(
let rsc_chunk = rsc_chunking_context.entry_chunk_group(
node_root.join(format!(
"server/app/{original_name}.js",
original_name = app_entry.original_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ pub async fn compute_page_entries_chunks(
let pathname = page_entry.pathname.await?;
let asset_path: String = get_asset_path_from_pathname(&pathname, ".js");

let ssr_entry_chunk = ssr_chunking_context.entry_chunk(
let ssr_entry_chunk = ssr_chunking_context.entry_chunk_group(
node_root.join(format!("server/pages/{asset_path}")),
Vc::upcast(page_entry.ssr_module),
page_entries.ssr_runtime_entries,
Expand Down
1 change: 1 addition & 0 deletions packages/next-swc/crates/next-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ allsorts = { workspace = true }
futures = { workspace = true }
lazy_static = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }
turbopack-binding = { workspace = true, features = [
"__swc_transform_modularize_imports",
"__swc_transform_relay",
Expand Down
1 change: 0 additions & 1 deletion packages/next-swc/crates/next-core/src/loader_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ impl LoaderTreeBuilder {
)?;
self.imports.push(formatdoc!(
r#"
("TURBOPACK {{ chunking-type: isolatedParallel }}");
import {}, {{ chunks as {} }} from "COMPONENT_{}";
"#,
identifier,
Expand Down
Loading

0 comments on commit 04bad16

Please sign in to comment.