Skip to content

Tool for building Rust functions for Node.js. Combine the performance of Rust, safety and portability of WebAssembly, and ease of use of JavaScript.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

rivy-t/ssvmup

 
 

ssvmup

The Second State VM ready tool

npm npm GitHub language count GitHub top language

Developers: Getting started building Rust + JavaScript hybrid apps for Node.js using the ssvmup tool.

About

A one-stop tool for building Rust functions into WebAssembly (the Second State VM, or SSVM) and then accessing these functions from Node.js JavaScript.

Install

From Linux command line

curl https://raw.githubusercontent.com/second-state/ssvmup/master/installer/init.sh -sSf | sh

From NPM and Node.js

npm i -g ssvmup

Usage

To build Rust functions for Node.js applications, use the following command. See a template application. The ssvmup compiles and generates the wasm file, and the corresponding JavaScript file to call wasm functions from JavaScript. If the rust package contains only binary crate(s) and there are no library crate, the build command will only generate the wasm(wasi) file for running with ssvm.

$ ssvmup build

In most cases, you will want to enable AOT optimization in order to improve performance.

$ ssvmup build --enable-aot

If you would like to use SSVM's extended WASI APIs including the Tensorflow WASI, enable the extensions. Make sure that you install the ssvm-extensions NPM module in this case.

$ ssvmup build --enable-aot --enable-ext

To build Rust functions for Deno applications, use the following command. See a template application.

$ ssvmup build --target deno

By default, ssvmup will generate a directory for it's build output called pkg. If you'd like to customize this you can use the --out-dir flag.

$ ssvmup build --out-dir out

Use clean subcommand to remove pkg and target directories.

$ ssvmup clean

Logging

ssvmup uses env_logger to produce logs when ssvmup runs.

To configure your log level, use the RUST_LOG environment variable. For example:

RUST_LOG=info ssvmup build

Acknowledgment

This project is derived from the open source wasm-pack.

About

Tool for building Rust functions for Node.js. Combine the performance of Rust, safety and portability of WebAssembly, and ease of use of JavaScript.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 93.4%
  • Shell 5.1%
  • JavaScript 1.5%