Wasmnizer-ts
utilizes WasmGC to compile TypeScript source code into WebAssembly bytecode, and support dynamic type (such as any) through host APIs. The Wasmnizer-ts
now supports a strict subset of TypeScript and continuously strives to accommodate more semantics.
There are three components in Wasmnizer-ts
:
ts2wasm-compiler
: a compiler for compiling TypeScript source code into WasmGC bytecode.ts2wasm-stdlib
: standard library implemented in ts source code, will be compiled with application together. See standard library.ts2wasm-runtime-library
: runtime libraries for exposing host APIs required for running the generated wasm module, including:
libdyntype
: support dynamic objects, see API spec here. We have proposed a WASI proposal.libstruct-indirect
: access WasmGC struct fields through index calculated during runtime, see API spec here. These APIs are used to emulate the behaviour of the proposed struct.get/set_indirect opcode.libstd
: standard library implemented in native, such as console.log
, see standard library.Note: This project is highly experimental and under active development, DO NOT use in production
ts2wasm-compiler
leverage WebAssembly GC proposal, which can benefit from runtime's GC capability.ts2wasm-compiler
uses binaryen as backend, which can benefit from binaryen's powerful optimization capabilities.memory allocator
and garbage collector
inside wasm module.any
and other dynamic types in TypeScript source code are supported by host APIs.The wasm module generated by ts2wasm-compiler
is designed to be executed in a WasmGC runtime environment. The runtime should provide the following capabilities:
Note: the GC opcode generated by binaryen is slightly different than GC MVP, please see here for details.
interface
type): APIs for accessing WasmGC struct fields through index calculated during runtime.Wasmnizer-ts
currently implemented host APIs on multiple environments:
libdyntype API
, libstruct-indirect API
and libstd API
libdyntype API
implemented with JavaScriptPlease see feature list for supporting status of each feature.
Please goto Getting Started for how to use the project and Introduction for more details.
We welcome contributions to Wasmnizer-ts. You can find more details in CONTRIBUTING.md .
Wasmnizer-ts
uses the same license as LLVM: the Apache 2.0 license with the LLVM exception. See the LICENSE file for details. Any contributions you make will be under the same license.