Registry / devops / porffor

porffor

JSON →
library0.61.13jsnpmunverified

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 porffor
INSTALL
IMPORT
SIG · PORFFOR
P
porffor
devopsjavascriptv0.61.13
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Porffor (default)
import Porffor from 'porffor'
const Porffor = require('porffor')
Package is ESM-only. No named export 'Porffor'; use default import.
cli (via programmatic API)
import { compile } from 'porffor'
import porffor from 'porffor'
Programmatic API exports 'compile' and other functions. Not documented; check source.
Types (TypeScript)
import type { CompileOptions } from 'porffor'
import { CompileOptions } from 'porffor'
Types are exported as type-only; use import type or keyof.

Demonstrates programmatic compilation of a JavaScript snippet to WebAssembly using Porffor's API.

import Porffor from 'porffor'; const compiler = new Porffor(); const code = 'console.log("Hello, world!");'; try { const wasmBytes = await compiler.compile(code, { target: 'wasm' }); // wasmBytes is Uint8Array console.log('Compilation succeeded, wasm size:', wasmBytes.length); } catch (err) { console.error('Compilation failed:', err); }
porffor --version
Debug
Known issues
gotchaPorffor supports only a limited subset of JavaScript. Many language features (e.g., classes, generators, full async) are not implemented or have bugs.
fix
Check the source or benchmarks for supported patterns; avoid unsupported features.
affects: *
breakingVersioning is unique: minor version equals Test262 pass percentage. No semantic versioning guarantees.
fix
Pin to exact version if reproducibility is needed.
affects: *
deprecatedThe `--parser` option default may change in future versions. Currently defaults to 'acorn'.
fix
Explicitly specify parser via options if you rely on behavior of a specific parser.
affects: >=0.0.0, <1.0.0
gotchaCompiling to native binaries requires the experimental 2c sub-engine, which is unstable and may produce incorrect output.
fix
Prefer compiling to Wasm; test native binaries thoroughly.
affects: *
gotchaThe programmatic API is not documented and may change without notice. Use the CLI for stability.
fix
Use CLI (npx porf) instead of programmatic imports.
affects: *
Errors
Common errors & fixes
Error: Unsupported syntax: ...
Porffor does not support the given JavaScript syntax
fix
Rewrite code to use only supported subset (e.g., no eval, no generators, limited async).
TypeError: Porffor is not a constructor
Importing the package incorrectly (e.g., using CommonJS require)
fix
Use ESM import: `import Porffor from 'porffor'`
Error: No parser was found for the given file type
Parser not installed or unsupported file extension
fix
Ensure acorn is installed, or specify a different parser with --parser.
Upgrade
Version history
0.61.13latest on npm
Audit
Dependencies
acornrequiredDefault parser for JavaScript source code
Agent activity
4 hits · last 30 days
node
4
Resources
porffor — npm install porffor · libregistry