You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AOT: defer .wasm imports to throw-on-use stubs (shared notice + strict) so the build proceeds #5235
Context: after #5230 (defer dynamic import), compiling opencode's real source reaches a .wasm import — @silvia-odwyer/photon-node/photon_rs_bg.wasm (a transitive image dep). perry reads the .wasm as UTF-8 and hard-fails:
Error: Failed to read .../photon_rs_bg.wasm: stream did not contain valid UTF-8
When an import resolves to a .wasm file, don't read it as UTF-8/TS. Instead:
Parse the WebAssembly export section (trivial binary walk: magic+version, section id 7) for export names.
Synthesize a module that exports each name as a throw-on-call stub (descriptive: wasm module <file> cannot run in an ahead-of-time compiled binary — full .wasm ESM instantiation is #5234). Member calls (wasm.add(...)) throw only if reached.
Reuse: the text-asset synthesis path (#5223) as the file-handling model, and the deferred-site sink + notice + strict from #5230. Build proceeds; the wasm feature degrades unless reached.
Why
Keeps real apps compiling past peripheral .wasm deps (leaf features), consistent with the eval/dynamic-import deferral policy. Full instantiation that makes the wasm actually run is the companion #5234.
Wall chain: new Function ✅ → @/ ✅ → require ✅ → text ✅ → dynamic import ✅ → .wasm (this: defer; #5234: real).
Activity
feat(compile): defer `.wasm` ESM imports to throw-on-call stubs (#5235)…
proggeramlug commentedon Jul 13, 2026
Shipped in #5236 (
5258a6073). Verified end-to-end against the issue's own base64add.wasm:.wasmexport section is parsed (id-7 binary walk) and named exports become throw-on-call stubs — importing is fine, only calling throwsnotice: 1 ahead-of-time-unsupported site compiled to a deferred runtime error--strict-dynamic-import/perry.strictmakes it a hard compile-time errorFull
.wasmESM instantiation remains tracked in #5234 (which is the half that did not ship — worth noting, since the two are easy to confuse).