1.0.10 • Published 7 years ago

@intuicio/wasm-compiler v1.0.10

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

WASM Compiler

Node.js and browser WASM compiler (using Wabbit - official WebAssembly WAT-to-WASM parser)

Travis CI

Install

npm install --save @intuicio/wasm-compiler
npm install -g @intuicio/wasm-compiler

CLI Usage

wasmc -i test.wast -o test.wasm
Usage: wasmc [options]

Options:
  -i, --input    Input file path                             [string] [required]
  -o, --output   Output file path                            [string] [required]
  -s, --silent   Silent                                                [boolean]
  -p, --pretty   Pretty output                                         [boolean]
  -m, --mode     Compilation mode                          [default: "wat-wasm"]
  -t, --trace    Print error stack trace                               [boolean]
  -e, --explain  Log explained WASM output                             [boolean]
  -d, --debug    Debug symbols                                         [boolean]
  -h, --help     Show help                                             [boolean]
  -v, --version  Show version number                                   [boolean]

Copyright (c) 2018

API Usage

import { wat2wasm } from '@intuicio/wasm-compiler';

const script = `(module
  (func $add (export "add") (param $a i32) (param $b i32) (result i32)
    (i32.add (get_local $a) (get_local $b))
  )
)`;
wat2wasm('test.wast', script, { explain: true, debug: true })
  .then(bytes => console.log(bytes))
  .catch(e => console.error(e));

Browser Usage

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <script src="https://unpkg.com/@intuicio/wasm-compiler/bin/wasm-compiler.min.js"></script>
  </head>
  <body>
    <script>
    const script = `(module
      (func $add (export "add") (param $a i32) (param $b i32) (result i32)
        (i32.add (get_local $a) (get_local $b))
      )
    )`;
    WasmCompiler.wat2wasm('test.wast', script, { explain: true, debug: true })
      .then(bytes => console.log(bytes))
      .catch(e => console.error(e));
    </script>
  </body>
</html>
1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago