Skip to content

runtime: implement WebAssembly/ESM integration for .wasm imports - #35587

Open
robobun wants to merge 9 commits into
mainfrom
farm/dd4bd17b/wasm-esm-integration
Open

runtime: implement WebAssembly/ESM integration for .wasm imports#35587
robobun wants to merge 9 commits into
mainfrom
farm/dd4bd17b/wasm-esm-integration

runtime: implement WebAssembly/ESM integration for .wasm imports

a481197
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 25, 2026 in 11m 13s

Code review found 2 potential issues

Found 5 candidates, confirmed 2. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 2
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/runtime/jsc_hooks.rs:3340-3348 Duplicated auto_watch block; macOS-only fd-close guard leaks on FreeBSD
🟡 Nit src/runtime/jsc_hooks.rs:3271-3294 Error messages hand-roll path quoting instead of bun_core::fmt::quote

Annotations

Check warning on line 3348 in src/runtime/jsc_hooks.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

Duplicated auto_watch block; macOS-only fd-close guard leaks on FreeBSD

This ~50-line `'auto_watch:` block is a near-verbatim copy of the one in the `.file` arm at lines 3434–3487 (only the loader argument differs) — per REVIEW.md's dedup rule, extract a shared `fn auto_watch(jsc_vm, args, path, loader)` and call it from both sites. That also lets you fix the fd-close guard once: `#[cfg(target_os = "macos")]` here (and at line 3481) should also cover FreeBSD, since `bun_watcher::REQUIRES_FILE_DESCRIPTORS` is `true` on both kqueue platforms (src/watcher/Watcher.rs:30

Check warning on line 3294 in src/runtime/jsc_hooks.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

Error messages hand-roll path quoting instead of bun_core::fmt::quote

The two new error messages hand-roll path quoting with `\"{}\"` around `bstr::BStr::new(path.text)`; REVIEW.md ("Error messages are reviewed word-for-word as code") calls for `bun.fmt.quote`, and the existing `add_error_fmt` calls in this file (lines 745-763) use `bun_core::fmt::format_json_string_latin1(...)` for the same purpose. Consider `bun_core::fmt::quote(path.text)` so paths with quotes/newlines/non-ASCII escape consistently.