mirror of
https://github.com/gorules/zen.git
synced 2026-11-28 08:06:20 +00:00
* feat(nodejs): replace the threaded wasm build with threadless wasm32-wasip1 The browser binding no longer needs SharedArrayBuffer or cross-origin isolation. napi moves to 3.14 / cli 3.10.8 with emnapi 2.0.0-alpha.6; the wasm build registers napi-async-runtime's current-thread backend and spawns each evaluation as a runtime task. console.sleep goes through a sleep provider so the wasm build waits on the host timer instead of tokio. CI and the Makefile build and publish @gorules/zen-engine-wasm32-wasip1 in place of the threaded package. * ci(nodejs): test the wasm32-wasip1 binding and load test binaries in place cli 3.10 rejects napi artifacts when any configured target is missing, so test jobs download their binary next to index.js instead of building npm dirs. A wasm test job runs the suite against the threadless binding and gates the release. * chore(nodejs): stop tracking generated wasip1 loaders napi build writes them alongside the wasm and CI ships them through the wasm artifact, like index.d.ts. * ci(nodejs): build the glibc legs with cargo zigbuild directly cli 3.10 runs cargo metadata with the requested target, which rejects the zigbuild glibc suffix. Matches the go and uniffi workflows. * build(nodejs): keep dev dependencies installable on node 20 @octokit/request 10.0.16 (via @napi-rs/cli) pulls content-type 3, which requires node 22; pin the cli's copy to 10.0.14.
30 lines
1.2 KiB
Makefile
30 lines
1.2 KiB
Makefile
REGISTRY := "http://localhost:4873"
|
|
WASI_SDK ?= $(HOME)/.cache/wasi/wasi-sdk-27.0-arm64-macos
|
|
|
|
wasm:
|
|
cargo clean -p napi-async-runtime --target wasm32-wasip1 --release
|
|
RUSTC=$$(rustup which rustc) \
|
|
CC_wasm32_wasip1=$(WASI_SDK)/bin/clang \
|
|
AR_wasm32_wasip1=$(WASI_SDK)/bin/llvm-ar \
|
|
CFLAGS_wasm32_wasip1="--target=wasm32-wasip1 --sysroot=$(WASI_SDK)/share/wasi-sysroot -mllvm -wasm-enable-sjlj" \
|
|
CARGO_TARGET_WASM32_WASIP1_RUSTFLAGS="-C link-arg=$(WASI_SDK)/share/wasi-sysroot/lib/wasm32-wasip1/libsetjmp.a" \
|
|
npx napi build --platform --release --target wasm32-wasip1
|
|
mkdir -p npm/wasm32-wasip1
|
|
cp zen-engine.wasm32-wasip1.wasm zen-engine.wasip1* npm/wasm32-wasip1/
|
|
|
|
darwinArm:
|
|
yarn build -- --target aarch64-apple-darwin
|
|
mkdir -p npm/darwin-arm64
|
|
cp zen-engine.darwin-arm64.node npm/darwin-arm64/
|
|
|
|
prepareLocalPublish:
|
|
yarn napi prepublish --skip-optional-publish
|
|
yarn createNpmDirs
|
|
|
|
publish:
|
|
cd npm/wasm32-wasip1 && npm publish --registry $(REGISTRY) --ignore-scripts --tag latest
|
|
cd npm/darwin-arm64 && npm publish --registry $(REGISTRY) --ignore-scripts --tag latest
|
|
npm publish --registry $(REGISTRY) --ignore-scripts --tag latest
|
|
|
|
publishLocal: prepareLocalPublish wasm darwinArm publish
|