This is an experimental fork of AssemblyScript maintained by btc-vision. It includes features that are not yet available in the official AssemblyScript release:
- Closures - Full closure support with captured variables
- Try-Catch-Finally - Exception handling with try-catch-finally blocks
- Binaryen 125 - Updated to the latest Binaryen version (125.0.0)
- Enhanced Shadow Stack - Improved shadow stack pass for better GC integration
-
Closure Support
- Closure capture analysis and recompilation logic
-
Exception Handling
- Try-catch-finally statement support
- Enforced Error type in throw statements
-
Binaryen Upgrade (123 → 125)
- Updated ExpressionId enum values to match Binaryen 125
- Fixed shadow stack pass timing to handle lazy function compilation
- Moved
compileVisitGlobals/compileVisitMembersafter shadow stack pass - Added iterative shadow stack transformation for newly compiled functions
npm install @btc-vision/assemblyscriptThis fork is a drop-in replacement for AssemblyScript. Simply replace your import:
{
"dependencies": {
"@btc-vision/assemblyscript": "^0.29.0"
}
}Or if migrating from official AssemblyScript:
npm uninstall assemblyscript
npm install @btc-vision/assemblyscriptThe CLI commands remain the same:
npx asc your-file.ts --outFile output.wasmAssemblyScript compiles a variant of TypeScript (basically JavaScript with types) to WebAssembly using Binaryen. It generates lean and mean WebAssembly modules while being just an npm install away.
Most of the maintainers and contributors do this open source work in their free time. If you use AssemblyScript for a serious task or plan to do so, and you'd like us to invest more time on it, please donate to our OpenCollective. By sponsoring this project, your logo will show up below. Thank you so much for your support!
A development environment can be set up by cloning the repository:
git clone https://github.com/btc-vision/assemblyscript.git
cd assemblyscript
npm install
npm linkThe link step is optional and makes the development instance available globally. The full process is documented as part of the repository: