An experimental from-scratch AOT JavaScript/TypeScript compiler that compiles to WebAssembly or native binaries. Current version 0.61.13, with rapid development. Unlike JIT-based engines, it is fully ahead-of-time compiled with zero runtime prelude, and generates Wasm without using Binaryen. It supports limited JS features and is a research project not intended for production use. Key differentiators: custom Wasm binary generation, sub- and super-set of JavaScript, and ability to compile to C via its 2c sub-engine.
npm install porfforNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates programmatic compilation of a JavaScript snippet to WebAssembly using Porffor's API.
Check the source or benchmarks for supported patterns; avoid unsupported features.
Pin to exact version if reproducibility is needed.
Explicitly specify parser via options if you rely on behavior of a specific parser.
Prefer compiling to Wasm; test native binaries thoroughly.
Use CLI (npx porf) instead of programmatic imports.
Rewrite code to use only supported subset (e.g., no eval, no generators, limited async).
Use ESM import: `import Porffor from 'porffor'`
Ensure acorn is installed, or specify a different parser with --parser.