Skip to content

Commit 4a074a9

Browse files
committed
feat(pack): add request-driven lazy compilation
1 parent 7648f3c commit 4a074a9

21 files changed

Lines changed: 1294 additions & 13 deletions

File tree

.github/workflows/pack-integration.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ jobs:
6464
# Build packages
6565
npm run build --workspace @utoo/pack-shared
6666
npm run build:local --workspace @utoo/pack
67+
npm exec --workspace @utoo/pack -- vitest run src/__test__/serveLazyCompilation.test.ts
6768
npm run build --workspace @utoo/pack-cli
6869
6970
# Verify examples

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/pack-core/src/client/context.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,8 @@ pub async fn get_client_chunking_context(
718718
let dev_server = config.dev_server().await?;
719719
if matches!(runtime_type, RuntimeType::Development)
720720
&& dev_server.hot.unwrap_or_default()
721-
&& dev_server.dynamic_hmr_chunk_lists.unwrap_or_default()
721+
&& (dev_server.dynamic_hmr_chunk_lists.unwrap_or_default()
722+
|| dev_server.lazy_compilation.unwrap_or_default())
722723
{
723724
builder = builder.dynamic_hmr_chunk_lists();
724725
}

crates/pack-core/src/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ pub struct Entries(Vec<EntryOptions>);
136136
pub struct DevServer {
137137
pub hot: Option<bool>,
138138
pub dynamic_hmr_chunk_lists: Option<bool>,
139+
pub lazy_compilation: Option<bool>,
139140
}
140141

141142
/// Provider configuration item - can be a module name string or [module, export] tuple.

crates/pack-napi/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ serde_json = { workspace = true }
5757
vergen-gitcl = { version = "1.0.8", features = ["cargo"] }
5858

5959
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
60+
hyper = { version = "0.14", features = ["full"] }
61+
mime_guess = "2.0.4"
6062
pack-api = { workspace = true, features = ["process_pool"] }
6163
pack-core = { workspace = true, features = ["process_pool"] }
6264
tokio = { workspace = true, features = ["full"] }
@@ -68,6 +70,7 @@ turbo-tasks-malloc = { workspace = true, default-features = false
6870
turbo-unix-path = { workspace = true }
6971
turbopack = { workspace = true }
7072
turbopack-core = { workspace = true }
73+
turbopack-dev-server = { workspace = true }
7174
turbopack-ecmascript-hmr-protocol = { workspace = true }
7275
turbopack-ecmascript-plugins = { workspace = true, optional = true }
7376
turbopack-node = { workspace = true, default-features = false, features = ["worker_pool_napi"] }

0 commit comments

Comments
 (0)