@rindle/wasm 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build.sh CHANGED
@@ -32,6 +32,20 @@ esac
32
32
  wasm-bindgen --target web --out-dir "$OUT" --out-name rindle "$WASM"
33
33
 
34
34
  if command -v wasm-opt >/dev/null 2>&1 && [ "$PROFILE" != "dev" ]; then
35
+ # Guard the binaryen version. Since Rust 1.82, wasm32 enables the `reference-types` feature by
36
+ # default, so wasm-bindgen emits a second (externref) table that `__wbindgen_init_externref_table`
37
+ # grows by 4 at startup. binaryen < 110 has a multi-table export bug (WebAssembly/binaryen#4711,
38
+ # fixed in v110) that corrupts that table — the optimized wasm then dies at runtime with
39
+ # "WebAssembly.Table.grow(): failed to grow table by 4" (wasm-bindgen#4528). Ubuntu's apt ships an
40
+ # old binaryen (22.04 -> 105, 24.04 -> 108), so fail loudly rather than ship a broken wasm.
41
+ wo_ver="$(wasm-opt --version 2>/dev/null | grep -oE '[0-9]+' | head -1 || true)"
42
+ if [ -n "$wo_ver" ] && [ "$wo_ver" -lt 110 ]; then
43
+ echo "error: wasm-opt (binaryen) version $wo_ver is too old; need >= 110." >&2
44
+ echo " binaryen < 110 corrupts the reference-types externref table, so the wasm fails at" >&2
45
+ echo " runtime with 'WebAssembly.Table.grow(): failed to grow table by 4'." >&2
46
+ echo " Install a newer binaryen: https://github.com/WebAssembly/binaryen/releases" >&2
47
+ exit 1
48
+ fi
35
49
  wasm-opt -Oz "$OUT/rindle_bg.wasm" -o "$OUT/rindle_bg.wasm"
36
50
  echo "wasm-opt -Oz applied"
37
51
  fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rindle/wasm",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,7 +27,7 @@
27
27
  "README.md"
28
28
  ],
29
29
  "dependencies": {
30
- "@rindle/client": "0.1.1"
30
+ "@rindle/client": "0.1.2"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^22.10.0",
Binary file