mirror of
https://github.com/hanzoai/zip-js.git
synced 2026-10-30 18:17:04 +00:00
Three end-to-end examples mirroring zip-rs:
- hello — minimal name → greeting handler (1.5 KB built)
- validate-email — port of the canonical validate fixture, byte-equivalent
JSON output to base/plugins/extbench/fixtures/goja-js (1.9 KB)
- policy-eval — realistic IAM/gateway authz decision handler (2.0 KB)
Built JS is committed so test harnesses + downstream consumers don't
depend on the toolchain. scripts/build-example.mjs is the monorepo
build driver (aliases @hanzo/zip to the local dist); end users use
the published npx zip-js build instead.
scripts/verify-examples.mjs loads each built bundle into a fresh V8
context and asserts byte-for-byte JSON output matches the canonical
reference strings — the same shape extbench compares.
306 B
306 B
hello
Smallest possible zip-js handler — reads name, returns a greeting.
npm install
npm run build # writes ./hello.js next to extension.json
Drop hello.js + extension.json into a hz_routes/hello/ directory
on any zip-mounted Hanzo service and the goja runtime picks it up.