Tool to create and package WASM WASI-based browser service workers
This tool provides JavaScript glue for browser service workers built with wasi-worker library.
cargo install wasi-worker-cli
```shell % wasiworker wasi-worker-cli 0.1.1 Install JavaScript glue code and WASI toolset for WASI worker to function.
USAGE:
wasiworker
FLAGS: -h, --help Prints help information -V, --version Prints version information
SUBCOMMANDS:
deploy Build with --bin worker
and deploy with glue code under ./dist
help Prints this message or the help of the given subcommand(s)
install Not available yet: Install static files and worker.rs template
```
worker
under ./dist with all depencies
wasiworker deploy
It will run cargo build --release --target wasm32-wasi --bin worker
, then it will take resulting wasm file and optimize it with
wasiworker install
It will create bin/worker.rs
and place relevant target and dependencies in current Cargo.toml
. Will panic if Cargo.toml was not found.
Code structure:
cargo install --path . --force
It will also embed whaever version of JS glue was placed under the ./dist subfolder.
npm install
npm run build:dev
npm install
npm run build
JavaScript glue code is built on top of following great packages. Thanks https://wasmer.io/ for their great work on making WASI easy to use.