walt-link

0.5.0 • Public • Published

walt-link

Linker for walt WebAssembly Programs.

About

Wraps .walt file with a JavaScript module, with all the dependencies linked.

Intented to be used in a node environment. Not yet implemented in a loader.

Still under development, but the API wont change.

Notes

  • Any import with a leading dot(.) will be linked into the final binary
  • Anything without a leading dot(.) will be treated as an environment import and is left up to the user to implement.
  • The top-level function returns a factory method which returns a function taking an import object. Every call to the method returns a brand new module
  • importObj used in the factory method is shared accross all modules.
  • Walt Dependencies are shared within a single WebAssembly module instance. Each import is a stand alone module linked by the linker. This is useful if you want shared module state across imports, similar to node modules.

TODOs

Usage

const { link } = require("walt-link");
const path = require("path");
 
const factory = link(path.resolve(__dirname, "./index.walt"));
 
factory({
  env: {
    memory,
  },
}).then(wasmModule => {
  /* run your code here */
});

Package Sidebar

Install

npm i walt-link

Weekly Downloads

29

Version

0.5.0

License

MIT

Unpacked Size

699 kB

Total Files

10

Last publish

Collaborators

  • abuldauskas