0.4.10 • Published 5 years ago

walt-cli v0.4.10

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

walt-cli

Line wrapper around the Walt WebAssembly Compiler. Intended to be used to build and package node modules utilizing WebAssembly/Walt. For browser integration use the webpack-loader.

Install

npm install --save-dev walt-cli

In your package.json

{
  "scripts": {
    "walt": "walt-cli"
  }
}

Usage

Compiling a single walt file to wasm

For one to one transforms point the cli at a single Walt file to get a single wasm result file.

npm run walt -- index.walt -o index.wasm

Compiling a walt program

For walt programs which has imports use the wrap flag -w. Wrap option will link and compile all dependencies starting from the entry file. The result is a self contained JavaScript module which exports a factory function. Use it to generate the WebAssembly instance of your walt program.

npm run walt -- src/walt/entry.walt -o walt-program.js -w

Once compiled the module can be imported just like any other JS module

const makeProgram = require("./walt-program");
// Factory takes an imports object
makeProgram({
  env: {
    memory: new WebAssembly.Memory({ initial: 1 })
  }
}).then(result => {
  result.instance.exports.run();
});

Note on imports:

All walt imports starting with a relative path ./paht-to-something is treated as a walt module import. All absolute imports are left to you to provide and are shared between all modules. Every module will get the same version of the import object provided.

0.4.10

5 years ago

0.4.9

5 years ago

0.4.8

5 years ago

0.4.7

6 years ago

0.4.6

6 years ago

0.4.5

6 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.15

6 years ago

0.2.13

6 years ago

0.2.12

6 years ago

0.2.11

6 years ago

0.2.10

6 years ago

0.2.9

6 years ago

0.2.8

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago