Tool to create and deploy WASM WASI-based browser service workers

Installation

cargo install wasi-worker-cli

Usage

Build and deploy 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

Install wasiworker template considering current directory is a crate root

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.

Acknowledgements

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.

Code structure:

Install the cli package from the crate manually

cargo install --path . --force

It will also embed whaever version of JS glue was placed under the ./dist subfolder.

Build JS glue for development

npm install npm run build:dev

Build JS glue for distribution

npm install npm run build

TODO