Crates.io | wasi-worker-cli |
lib.rs | wasi-worker-cli |
version | 0.6.0 |
source | src |
created_at | 2019-10-30 18:54:31.177535 |
updated_at | 2020-08-30 14:24:17.27352 |
description | Tool to create and deploy WASM WASI-based browser service workers |
homepage | |
repository | https://github.com/dunnock/wasi-worker/tree/master/wasi-worker-cli |
max_upload_size | |
id | 177006 |
size | 498,926 |
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.
Note: wasi-worker-cli 0.5+ requires rustc 1.41+ as it bases on wasi-snapshot-preview1 now
cargo install wasi-worker-cli
% wasiworker help
wasi-worker-cli 0.2.0
Install JavaScript glue code and WASI toolset for WASI worker to function.
USAGE:
wasiworker <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
deploy Executes `cargo build --bin worker` and deploys with glue code under ./dist
help Prints this message or the help of the given subcommand(s)
install Install static files and worker.rs template in current crate
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.
worker
under ./dist with all depencieswasiworker deploy
It will run cargo build --release --target wasm32-wasi --bin worker
, copy resulting worker.wasm under ./dist and copy JavaScript glue code under ./dist/worker.js. It will also add wasm_transformer to be able to run in browser.
Note: currently it uses wasm-gc tool to significantly cut resulting wasm file size.
Look at converting to cargo wasi
subcommand
Code structure:
cargo install --path . --force
It will also embed whaever version of JS glue was placed under the ./dist subfolder.
cd js
npm install
npm run build:dev
cd js
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.