Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/validated-worker-artifacts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@crab-dev/wake": patch
---

开发服务在启动复扫及后续增量构建中复用输入保持一致的原生 Worker 产物,减少重复打包。

可通过 `wake dev --worker-cache` 或 Node API 的 `workerCache: true` 在开发服务重启时复用 Worker 模块编译结果。每个项目最多保留 256 MiB 快照,损坏的快照会在构建时自动修复。
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ jobs:
os: ubuntu-24.04
rust_target: x86_64-unknown-linux-gnu
browser_evidence: reviewed-major-conformance
browser_majors: '151,152,155,156,157'
browser_majors: '151,152,155,156,157,158'
browser_path: /usr/bin/google-chrome
- target: linux-arm64-gnu
os: ubuntu-24.04-arm
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ jobs:
- platform: linux-x64-gnu
runner: ubuntu-24.04
browser_evidence: reviewed-major-conformance
browser_majors: '151,152,155,156,157'
browser_majors: '151,152,155,156,157,158'
browser_path: /usr/bin/google-chrome
- platform: linux-arm64-gnu
runner: ubuntu-24.04-arm
Expand Down Expand Up @@ -745,7 +745,7 @@ jobs:
- platform: linux-x64-gnu
runner: ubuntu-24.04
browser_evidence: reviewed-major-conformance
browser_majors: '151,152,155,156,157'
browser_majors: '151,152,155,156,157,158'
browser_path: /usr/bin/google-chrome
- platform: linux-arm64-gnu
runner: ubuntu-24.04-arm
Expand Down
7 changes: 7 additions & 0 deletions crates/wake_app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5456,6 +5456,8 @@ pub struct DevServerOptions {
pub host: Option<String>,
pub port: Option<u16>,
pub open: Option<bool>,
/// Persist native Worker module compilation results across application dev server restarts.
pub worker_cache: bool,
/// Programmatic federation override. `None` uses `wake.config.toml`.
pub federation: Option<FederationOptions>,
}
Expand Down Expand Up @@ -5937,6 +5939,9 @@ pub fn start_dev_server(options: DevServerOptions) -> Result<DevServer, WakeErro
let serve_options = wake_dev_server::ServeOptions {
html_template: config.html.template.as_ref().map(PathBuf::from),
entry: dev_federation.entry,
worker_cache_dir: options
.worker_cache
.then(|| prepared.root.join(".wake").join("worker-cache")),
base_path: config.public_path().to_string(),
resolve_options: ResolveOptions {
alias: dev_aliases,
Expand Down Expand Up @@ -7396,6 +7401,7 @@ fn start_docs_dev_server_leaf(
html_template: config.html.template.as_ref().map(PathBuf::from),
entry: prepared.entry,
base_path: docs_base_path,
worker_cache_dir: None,
resolve_options: ResolveOptions {
alias: prepared.aliases,
conditions: ["browser", "development", "import", "module", "default"]
Expand Down Expand Up @@ -7617,6 +7623,7 @@ fn start_aggregated_docs_dev_server(
html_template: config.html.template.as_ref().map(PathBuf::from),
entry: prepared.entry,
base_path: site_docs.base_path,
worker_cache_dir: None,
resolve_options: ResolveOptions {
alias: prepared.aliases,
conditions: ["browser", "development", "import", "module", "default"]
Expand Down
8 changes: 4 additions & 4 deletions crates/wake_bundler/src/generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl<T> CachedIo<T> {
fn capture(result: io::Result<T>) -> Self {
match result {
Ok(value) => Self::Ok(value),
Err(error) => Self::Err(IoErrorSnapshot::capture(error)),
Err(error) => Self::Err(IoErrorSnapshot::capture(&error)),
}
}
}
Expand All @@ -248,15 +248,15 @@ impl<T: Clone> CachedIo<T> {
}
}

#[derive(Clone)]
struct IoErrorSnapshot {
#[derive(Clone, PartialEq, Eq)]
pub(super) struct IoErrorSnapshot {
kind: io::ErrorKind,
raw_os_error: Option<i32>,
message: String,
}

impl IoErrorSnapshot {
fn capture(error: io::Error) -> Self {
pub(super) fn capture(error: &io::Error) -> Self {
Self {
kind: error.kind(),
raw_os_error: error.raw_os_error(),
Expand Down
Loading
Loading