Skip to content

NetAppLabs/wasmin

Repository files navigation

wasmin

Wasmin a contains a collection of packages and building blocks for running WASI WebAssembly applications on top of JavaScript Runtimes.

Main package implementing the WASI layer is @netapplabs/wasi-js with support for Preview 1 and experimental support for Preview 2 and component mode.

About

This repo is structured as a monorepo using Yarn and turborepo.

Each package/app written in TypeScript. It includes the following packages and apps:

Packages

Apps

Following applications are provided as examples for self contained executables built with the packages above.

  • @netapplabs/node-shell: a shell for wasm/wasi based on node.js
  • @netapplabs/bun-shell: a shell for wasm/wasi based on bun.sh
  • @netapplabs/deno-shell: a shell for wasm/wasi based on deno
  • @netapplabs/web-shell: a Web shell for wasm/wasi runnable in a Browser.

Using Packages

Make sure you have in your ~/.npmrc

@netapplabs:registry=https://npm.pkg.github.com/

or if you have a GITHUB_TOKEN

//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
@netapplabs:registry=https://npm.pkg.github.com/

Then add a package e.g. with

yarn add @netapplabs/wasi-js

or

bun add @netapplabs/wasi-js

Running Apps

wasmin contains pre-built executables as an example built from the apps above in different formats:

Container

Start up a default shell:

docker run -it ghcr.io/netapplabs/wasmin:latest

Type in something like

help commands

to see available commands

For running with /Users/shared from local machine mounted into it:

docker run -it --mount type=bind,source=/Users/shared,target=/mount ghcr.io/netapplabs/wasmin:latest -p

Executable

For prebuilt with bun on macOS Apple Silicon:

wget https://github.com/NetAppLabs/wasmin/releases/download/latest/wasmin-bun-macos-arm64 -O wasmin
chmod +x wasmin
./wasmin -h

For prebuilt with bun on Linux Intel:

wget https://github.com/NetAppLabs/wasmin/releases/download/latest/wasmin-bun-linux-amd64 -O wasmin
chmod +x wasmin
./wasmin -h

For prebuilt with Node on macOS Apple Silicon:

wget https://github.com/NetAppLabs/wasmin/releases/download/latest/wasmin-node-macos-arm64 -O wasmin
chmod +x wasmin
./wasmin -h

For prebuilt with Node on Linux Intel:

wget https://github.com/NetAppLabs/wasmin/releases/download/latest/wasmin-node-linux-amd64 -O wasmin
chmod +x wasmin
./wasmin -h

For prebuilt with Deno on macOS Apple Silicon:

wget https://github.com/NetAppLabs/wasmin/releases/download/latest/wasmin-deno-macos-arm64 -O wasmin
chmod +x wasmin
./wasmin -h

For prebuilt with Deno on Linux Intel:

wget https://github.com/NetAppLabs/wasmin/releases/download/latest/wasmin-deno-linux-amd64 -O wasmin
chmod +x wasmin
./wasmin -h

Development

Clone from github:

git clone git@github.com:NetAppLabs/wasmin.git

Build

To build all apps and packages, run the following command:

cd wasmin
yarn
yarn build

Test

To test all packages, run the following command:

cd wasmin
yarn test

License

Apache-2.0

Disclaimer: This is not an officially supported NetApp product.

Contributing

See Contributing.md