https://github.com/emnudge/rollup-plugin-wat
Import WAT files with Rollup
https://github.com/emnudge/rollup-plugin-wat
Last synced: about 1 month ago
JSON representation
Import WAT files with Rollup
- Host: GitHub
- URL: https://github.com/emnudge/rollup-plugin-wat
- Owner: EmNudge
- Created: 2023-07-17T22:15:46.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-20T03:55:31.000Z (almost 3 years ago)
- Last Synced: 2025-09-01T07:53:48.197Z (10 months ago)
- Language: TypeScript
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rollup-plugin-wat
A Rollup plugin for directly importing "[WebAssembly Text Format](https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format)" files.
Imports are dynamically typed via creation of a local `.d.ts` file next to the `.wat` source.
https://github.com/EmNudge/rollup-plugin-wat/assets/24513691/324ab107-8969-4e3d-8553-aeacdd028e9a
## Install
using npm
```sh
npm install --save-dev @emnudge/rollup-plugin-wat
```
## Usage
Add the plugin to your `plugins` array in your `rollup.config.js` file.
```js
import { wat } from '@emnudge/rollup-plugin-wat';
export default {
// ...some other config
plugins: [wat()]
}
```
## Credits
* General package setup copied from [@rollup/plugin-wasm](https://github.com/rollup/plugins/tree/master/packages/wasm).
* [wat2wasm](https://github.com/WebAssembly/wabt) npm package from [AssemblyScript](https://github.com/AssemblyScript/wabt.js) for creating wasm from wat files
* [webassembly.js](https://github.com/xtuc/webassemblyjs) for the AST used for extracting type information