@sebastianspeitel/rollup-plugin-assemblyscript-loader

0.1.1 • Public • Published

@sebastianspeitel/rollup-plugin-assemblyscript-loader

🍣 A Rollup plugin to import, compile and load assemblyscript using @assemblyscript/loader

Install

Using npm:

npm install @sebastianspeitel/rollup-plugin-assemblyscript-loader --save-dev

Usage

To compile and import an assemblyscript module import the entry file of the module.

import {} from "assemblyscript:./assembly/main.ts";

Exports

The imported module exports the following values:

wasmUrl

The relative URL to the .wasm file.

import { wasmUrl } from "assemblyscript:./assembly/main.ts";

modulePromise

A Promise resolving with with the compiled Webassembly.Module.

import { modulePromise } from "assemblyscript:./assembly/main.ts";

instancePromise

A Promise resolving with a WebAssembly.Instance.

import { instancePromise } from "assemblyscript:./assembly/main.ts";

instantiate

A function to start compiling and instantiating with a given import object resolving with a WebAssembly.Instance.

import { instantiate } from "assemblyscript:./assembly/main.ts";

const instance = await instantiate({ log: console.log });

Options

compilerOptions

Type: CompilerOptions
Default: {}

CompilerOptions passed to asc to compile the assemblyscript module.

emitText

Type: bool
Default: true

Whether to emit the .wat file of the compiled module.

exclude

Type: RegExp | string | string[]
Default: null

A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should ignore. By default no files are ignored.

include

Type: RegExp | string | string[]
Default: /^assemblyscript:.*/

A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should operate on. By default all files prefixed with assemblyscript: are targeted.

Readme

Keywords

Package Sidebar

Install

npm i @sebastianspeitel/rollup-plugin-assemblyscript-loader

Weekly Downloads

4

Version

0.1.1

License

AGPL-3.0-or-later

Unpacked Size

46.9 kB

Total Files

5

Last publish

Collaborators

  • sebastianspeitel