1.1.12 • Published 5 years ago

walt-loader v1.1.12

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Walt Alternative WebAssembly Syntax Loader for Webpack

:zap: The most efficient way to experiment with WebAssembly to date. No need to learn C/C++ or Rust, hand roll your wasm modules and use them within minutes with familiar JavaScript-like syntax!

This loader is for Walt, an alternative syntax for wasm. Allowing you to write JavaScript-like .walt scripts and import the compiled wasm binary directly into your JS Application.

Install

npm install --save-dev walt-compiler walt-loader

Usage

The loader user wasm-loader under the hood and has the same API. Resolving to a factory function which returns a promise for the WebAssembly module.

With Webpack

Make sure you have a working Webpack config and that the walt-compiler package is installed and ready to use. Then update your wepback config:

Resolve the .walt file extensions

resolve: {
  extensions: [".walt"]
}

and append the walt-loader to loaders config option

module: {
  loaders: {
    {
      test: /\.walt$/,
      loader: "walt-loader"
    }
  }
}

Importing Walt Modules directly

Fire up your favorite editor and create a simple .walt Module file. Here is a counter module example:

counter.walt:

let counter: i32 = 0;

export function decrement(): i32 {
  counter -= 1;
  return counter;
}

export function increment(): i32 {
  counter += 1;
  return counter;
}

Once you have your module written, then you can import it into your existing JavaScript Application.

example.js:

import makeCounter from './walt/counter';

makeCounter().then(wasmModule => {
  console.log(wasmModule.instance.exports.increment()); // 1
  console.log(wasmModule.instance.exports.increment()); // 2
  console.log(wasmModule.instance.exports.decrement()); // 1
});

That's it. You can now write your wasm binaries and import them directly into your Webpack App!

1.1.12

5 years ago

1.1.11

5 years ago

1.1.10

5 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.33

6 years ago

1.0.31

6 years ago

1.0.30

6 years ago

1.0.29

6 years ago

1.0.28

6 years ago

1.0.27

6 years ago

1.0.26

6 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago