From 3406a1be00e8ec6943fc51acea659b7b33baa176 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 23 Apr 2026 12:23:43 +0000 Subject: [PATCH 1/4] perf: optimize `generateFileSystemTree` to traverse concurrently This replaces a sequential `for...of` loop with `Promise.all` + `.map`, allowing file I/O operations (like `fs.stat` and `fs.readFile`) to be performed concurrently for children within a directory. This fixes an N+1 query pattern and provides significant performance improvements when traversing large directories. Co-authored-by: megawron <52606827+megawron@users.noreply.github.com> --- WebContainerGitService.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/WebContainerGitService.js b/WebContainerGitService.js index 166b15f..30ffbee 100644 --- a/WebContainerGitService.js +++ b/WebContainerGitService.js @@ -243,8 +243,9 @@ export class WebContainerGitService { const tree = {}; const entries = await this.fs.readdir(dir); - for (const entry of entries) { - if (entry === '.git' || entry === 'node_modules') continue; + await Promise.all(entries.map(async (entry) => { + if (entry === '.git' || entry === 'node_modules') return; + const path = `${dir}/${entry}`; const stat = await this.fs.stat(path); @@ -258,7 +259,8 @@ export class WebContainerGitService { file: { contents } }; } - } + })); + return tree; } From e42a0e6d749284e1d335f140b362578003ac96c7 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 23 Apr 2026 13:00:20 +0000 Subject: [PATCH 2/4] fix: correct build script to copy directories and ensure tagger wasm logic works This fixes build failures in CI: 1. `build.mjs` was using `Bun.write` in a loop that hit a directory inside `lib/` (like `lib/services`), causing an `EISDIR` error. Replaced it with Node's `cp(..., { recursive: true })` which correctly copies nested directories. 2. The Wasm tagger's build script `lib/frameworks/engines/tagger-rs/build_wasm.sh` only copied the `.wasm` file to `lib/` and failed to copy the JS glue code `zerocms_tagger.js`, which was being imported in `lib/frameworks/engines/WasmEngine.js`. Updated the script to copy `zerocms_tagger.js` as well, resolving the missing import during the build. Co-authored-by: megawron <52606827+megawron@users.noreply.github.com> --- build.mjs | 3 ++- lib/frameworks/engines/tagger-rs/build_wasm.sh | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build.mjs b/build.mjs index 26ae01c..514309d 100644 --- a/build.mjs +++ b/build.mjs @@ -31,11 +31,12 @@ async function build() { // 3. Copy Static Libraries console.log("📂 Copying libraries..."); + const { cp } = await import("node:fs/promises"); const libs = await readdir("lib"); for (const lib of libs) { const src = join("lib", lib); const dest = join(DIST, "lib", lib); - await Bun.write(dest, Bun.file(src)); + await cp(src, dest, { recursive: true }); } // Extract the generated hashed file name from Bun's output diff --git a/lib/frameworks/engines/tagger-rs/build_wasm.sh b/lib/frameworks/engines/tagger-rs/build_wasm.sh index e6437e1..7be8a5b 100644 --- a/lib/frameworks/engines/tagger-rs/build_wasm.sh +++ b/lib/frameworks/engines/tagger-rs/build_wasm.sh @@ -39,5 +39,6 @@ wasm-pack build --target web --release # 4. Copy to lib echo -e "${GREEN}📦 Copying binary to dashboard library...${NC}" cp pkg/zerocms_tagger_bg.wasm ../../../../lib/zerocms_tagger_bg.wasm +cp pkg/zerocms_tagger.js ../../../../lib/zerocms_tagger.js echo -e "${GREEN}✨ Success! High-performance tagger is now active.${NC}" From af424155cd3c5619b836063462e3e3bdb5763258 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 23 Apr 2026 13:05:24 +0000 Subject: [PATCH 3/4] fix: correct build script to copy directories and ensure tagger wasm logic works This fixes build failures in CI: 1. `build.mjs` was using `Bun.write` in a loop that hit a directory inside `lib/` (like `lib/services`), causing an `EISDIR` error. Replaced it with Node's `cp(..., { recursive: true })` which correctly copies nested directories. 2. The Wasm tagger's build script `lib/frameworks/engines/tagger-rs/build_wasm.sh` only copied the `.wasm` file to `lib/` and failed to copy the JS glue code `zerocms_tagger.js`, which was being imported in `lib/frameworks/engines/WasmEngine.js`. Updated the script to copy `zerocms_tagger.js` as well, resolving the missing import during the build. Co-authored-by: megawron <52606827+megawron@users.noreply.github.com> From 32c3259acdbfa47bf9fd28971edc52e6b6477b42 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 23 Apr 2026 13:12:09 +0000 Subject: [PATCH 4/4] fix: update build tools and copy logic Ensures that directories in `lib` are fully copied during build. Ensures that the JS glue script for the Wasm tagger is accurately copied into `lib`. Co-authored-by: megawron <52606827+megawron@users.noreply.github.com>