Files
zeekay 7009fb5f38 initial release v0.1.0
Rust crate for writing zip-mounted wasm handlers per HIP-0105.

- zip-rs lib: #[handler] proc macro, __base_alloc/__base_free allocator
  exports, JSON envelope helpers, Error/Result types.
- zip-rs-macros: proc macro implementation (syn 2 + quote).
- Three end-to-end examples: hello, validate-email (port of canonical
  AssemblyScript fixture), policy-eval.
- CI workflow builds wasm32-wasip1 artifacts and verifies them against
  the production wasmvm host in hanzoai/base.

12 unit tests pass. Wasm sizes: hello 87 KB, validate-email 91 KB,
policy-eval 100 KB. validate-email emits byte-equivalent JSON output
to the AS reference fixture.
2026-05-18 21:19:17 -07:00

25 lines
671 B
Bash
Executable File

#!/usr/bin/env bash
# Build the hello handler to wasm32-wasip1.
#
# Usage: ./build.sh
# Output: ../../target/wasm32-wasip1/release/hello.wasm
# Also copies the artifact next to extension.json as hello.wasm so the
# directory is a ready-to-mount HIP-0105 extension.
set -euo pipefail
cd "$(dirname "$0")"
cargo build --release --target wasm32-wasip1 -p zip-rs-example-hello
WASM_SRC="../../target/wasm32-wasip1/release/hello.wasm"
cp "$WASM_SRC" ./hello.wasm
# Try to shrink with wasm-opt if available. Optional; raw build is
# already production-grade.
if command -v wasm-opt >/dev/null 2>&1; then
wasm-opt -Oz -o ./hello.wasm ./hello.wasm
fi
ls -lh ./hello.wasm