wat4wasm
v1.1.4
Published
<p align="center"> <br /> <strong><code>wat4wasm</code></strong><br /> is a pre-compiler for <strong><code>wat</code></strong> files which <em><strong>WebAssembly</strong></em> uses<br /> and designed to make you faster, smarter and aesthetica
Readme
wat4wasm
Purpose of wat4wasm
Writing WebAssembly Text (WAT) often feels like stepping back in time. While the performance is futuristic, the developer experience is archaic. You manually manage indices, define every single import, and struggle with basic tasks like string handling or asynchronous flows.
wat4wasm changes the game.
It is a pre-compiler that treats WebAssembly as a first-class citizen of the JavaScript ecosystem. It introduces "syntactic sugars" and powerful macros that allow you to write WASM with the expressiveness of a high-level language.
Core Philosophies:
- The Magic
$self: Access the entire JavaScript host environment (window,console,DOM, etc.) directly from WASM without writing a single manual import. - Modern Syntax: Use
async/await,newconstructors, and dot-notation for property access. - Seamless Integration: Embed files, compile other WAT modules inline, and auto-generate boilerplate.
It's not just a compiler; it's the bridge that makes WebAssembly fun to write.
usage screenshot:
API
- (text/string ...) (examples-01)
- (include ...) (examples-02)
- (ref.extern ...) (examples-03)
- (ref.func ...) (examples-04)
- (global.get ...) (examples-05)
- (async ...) (examples-06)
- (data.size/view ...) (examples-07)
Reflectors (examples-08)
- (reflect $...)
- (array $...)
- (object $...)
- (string $...)
- (number $...)
- (math $...)
- (url $...)
- (console $...)
Example for a few code transformations:
License
This project is licensed under the MIT License - see the LICENSE file for details.
