Skip to content

btc-vision/assemblyscript

 
 

Repository files navigation

AssemblyScript logo

npm version GitHub release


WARNING: EXPERIMENTAL FORK

This is an experimental fork of AssemblyScript maintained by btc-vision. It includes features that are not yet available in the official AssemblyScript release:

Experimental Features

  • 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

Changes from Upstream

  1. Closure Support

    • Closure capture analysis and recompilation logic
  2. Exception Handling

    • Try-catch-finally statement support
    • Enforced Error type in throw statements
  3. Binaryen Upgrade (123 → 125)

    • Updated ExpressionId enum values to match Binaryen 125
    • Fixed shadow stack pass timing to handle lazy function compilation
    • Moved compileVisitGlobals/compileVisitMembers after shadow stack pass
    • Added iterative shadow stack transformation for newly compiled functions

Installation

npm install @btc-vision/assemblyscript

Usage

This 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/assemblyscript

The CLI commands remain the same:

npx asc your-file.ts --outFile output.wasm

Original README

AssemblyScript 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.


Contributors

Contributor logos

Thanks to our sponsors!

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!

Sponsor logos

Development instructions

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 link

The link step is optional and makes the development instance available globally. The full process is documented as part of the repository:

About

A TypeScript-like language for WebAssembly.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • WebAssembly 89.4%
  • TypeScript 9.5%
  • JavaScript 1.1%