Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebastianspeitel/rollup-plugin-assemblyscript-loader
https://github.com/sebastianspeitel/rollup-plugin-assemblyscript-loader
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/sebastianspeitel/rollup-plugin-assemblyscript-loader
- Owner: SebastianSpeitel
- License: agpl-3.0
- Created: 2020-08-26T07:31:03.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-10T18:28:59.000Z (about 4 years ago)
- Last Synced: 2024-10-29T00:50:44.327Z (18 days ago)
- Language: TypeScript
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @sebastianspeitel/rollup-plugin-assemblyscript-loader
🍣 A Rollup plugin to import, compile and load assemblyscript using @assemblyscript/loader
## Install
Using npm:
```console
npm install @sebastianspeitel/rollup-plugin-assemblyscript-loader --save-dev
```## Usage
To compile and import an assemblyscript module import the entry file of the module.
```ts
import {} from "assemblyscript:./assembly/main.ts";
```### Exports
The imported module exports the following values:
#### wasmUrl
The relative URL to the .wasm file.
```ts
import { wasmUrl } from "assemblyscript:./assembly/main.ts";
```#### modulePromise
A Promise resolving with with the compiled `Webassembly.Module`.
```ts
import { modulePromise } from "assemblyscript:./assembly/main.ts";
```#### instancePromise
A Promise resolving with a `WebAssembly.Instance`.
```ts
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`.
```ts
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](https://github.com/isaacs/minimatch), 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](https://github.com/isaacs/minimatch), 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.