This devcontainer is configured to provide you a WasmEdge installation equipped with wasmedge_rustls
plugin and a Rust
toolchain with wasm32-wasi
target to compile the latest WasmEdge-QuickJS.
Tested with WasmEdge-QuickJS commit f4a4f884, Rustc 1.74.1.
- Open this repo in devcontainer, e.g. using Github Codespaces. Type or copy/paste following commands to devcontainer's terminal.
- Clone WasmEdge-QuickJS repo:
git clone --depth=1 https://github.com/second-state/wasmedge-quickjs.git
cd
into the folder of WasmEdge-QuickJS sources:
cd wasmedge-quickjs
- Compile the WasmEdge-QuickJS interpreter:
cargo build --target wasm32-wasi --release
- Copy
wasmedge_quickjs.wasm
file to current directory, thus it requires pure JS modules frommodules
directory in this source distribution to run:
cp target/wasm32-wasi/release/wasmedge_quickjs.wasm ./
- Optionally you can optimize the WASM file to run faster with
wasmedgec
"compiler":
wasmedgec wasmedge_quickjs.wasm wasmedge_quickjs.wasm
This will override the original copy with optimized (and a 1.5 times larger) one.
wasmedge --dir .:. wasmedge_quickjs.wasm example_js/wasi_https_fetch.js
This test may take about 20 seconds. You can also try lots of other examples in example_js
directory, especially
wasi_http_fetch.js
and
wasi_http_server.js
.
Perform your own experiments if desired.
Created for (wannabe-awesome) list