A TypeScript to JavaScript compiler in AssemblyScript. A fork of https://github.com/alangpierce/sucrase
Converting 40K lines of TypeScript.
Tool | Time * |
---|---|
esbuild | 31 ms |
this | 318 ms |
sucrase | 979 ms |
* times are collected from the shell. So include full time from the OS process start to exit. Device: M1 MacBook Pro.
Stripped back to only remove TypeScript types, (and compile TypeScript enums into objects).
No support for classes, module transforms, JSX, Flow.
Requires a WASI compliant WebAssembly runner to execute.
cat './input.ts' | wasmtime ./build/out.wasm > './output.js'
Node.js has (currently experimental) support. https://nodejs.org/api/wasi.html
cat './input.ts' | node --experimental-wasi-unstable-preview1 ./bench/node-wasi.js > './output.js'
Node, Npm
npm install
npm run asbuild
Found in ./bench/benchmarks.md