Skip to content

suborbital/javy

 
 

Repository files navigation

Javy: A Jav aScript to WebAssembl y toolchain

Build status

About this repo | How to use this repo

About this repo

Introduction: Run your JavaScript on WebAssembly. Javy takes your JavaScript code, and executes it in a WebAssebmly embedded JavaScript runtime.

Javy is currently used for the beta Shopify Scripts platform. We intend on supporting and improving this runtime in that context. Eventually this project should be a good general purpose JavaScript runtime but that is not the current goal.

Contributing

Javy is a beta project and will be under major development. We welcome feedback, bug reports and bug fixes. We're also happy to discuss feature development but please discuss the features in an issue before contributing. All contributors will be prompted to sign our CLA.

Build

  • Rust v1.53.0
  • rustup
  • wasm32-wasi, can be installed via rustup target add wasm32-wasi

Development

  • wasmtime-cli, can be installed via cargo install wasmtime-cli (required for cargo-wasi)
  • cargo-wasi, can be installed via cargo install cargo-wasi

Building

After all the dependencies are installed, run make. You should now have access to the executable in target/release/javy

Alternatively you can run make && cargo install --path crates/cli. After running the previous command you'll have a global installation of the executable.

Compiling to WebAssembly

You can create a WebAssembly binary from JavaScript by:

javy index.js -o destination/index.wasm

For more information on the commands you can run javy --help

Reactr Examples

You can check out the examples in the examples directory. After running the steps above and having javy on your PATH, cd to any example folder and run npm install && npm run build to build a Reactr-compatible wasm file.

Languages

  • C 89.3%
  • JavaScript 6.7%
  • Rust 3.4%
  • Makefile 0.4%
  • Shell 0.1%
  • TypeScript 0.1%