magic/toolchains
Darryl L. Miles 752d80ba01 wasm: pin INCOMING_MODULE_JS_API (fixes wasmBinary abort on emsdk 6.x)
Emscripten's default INCOMING_MODULE_JS_API list dropped `wasmBinary`
(present through ~4.x, gone by 6.0.x).  With -sASSERTIONS=1 a caller that
sets Module.wasmBinary — as the npm harness and the documented API do —
then aborts at instantiation:

  Aborted(`Module.wasmBinary` was supplied but `wasmBinary` not included
          in INCOMING_MODULE_JS_API)

Set the list explicitly so the build no longer depends on Emscripten's
default (which drifts between emsdk versions).  Allow the properties that
matter for embedding/consuming the .wasm across node/web/worker:

  print, printErr             stdout/stderr callbacks
  wasmBinary, wasm            supply the module as bytes / a compiled Module
  instantiateWasm, locateFile custom instantiation (streaming/caching/
                              bundlers) and .wasm URL resolution

`arguments` is intentionally omitted: main() is defined but never run
(magic is driven through the magic_wasm_* exports), so argv is inert here.

Verified on emsdk 6.0.2 and 6.0.3: the wasmBinary abort is gone and the
module instantiates (0 INCOMING aborts in the smoke run on either).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-26 14:54:11 -04:00
..
emscripten wasm: pin INCOMING_MODULE_JS_API (fixes wasmBinary abort on emsdk 6.x) 2026-07-26 14:54:11 -04:00