Command line tool and library to generate a Rust crate wrapping JavaScript code into a WebAssembly Component using the QuickJS engine.
Generated components use QuickJS-ng 0.16.2 through rquickjs 0.14.0, including
Unicode v-flag regular expression sets, intersections and subtraction.
The engine automatically collects unreachable reference cycles. Each runtime starts
with a 32 MiB GC threshold, which the engine then adapts to its retained heap.
Collection makes freed space reusable; WebAssembly linear memory keeps its high-water
size. Explicit gc() remains optional and schedules collection after the current
JavaScript execution completes.
Disposal uses the engine's well-known Symbol.dispose and Symbol.asyncDispose,
including for generated WIT resources. These symbols are not in the global symbol
registry, unlike Node.js 22.14. Their properties are read-only in both runtimes.
ComponentizeJS achieves the same goal of wrapping JavaScript code into a WebAssembly Component, but it does it using a modified version of the SpiderMonkey engine.
Advantages of wasm-rquickjs over ComponentizeJS:
- At the time of writing, there are known bugs in ComponentizeJS (or one of its underlying modules) that prevents it from being used in production.
- Much simpler to develop and debug, as everything exposed for JavaScript is implemented in async Rust using the rquickjs library
- The WIT-JS mapping rules and the set of available JavaScript APIs are well defined
- Smaller WASM binary size
Advantages of ComponentizeJS over wasm-rquickjs:
- Faster runtime (due to the SpiderMonkey engine)
- Faster startup time (it does pre-initialization with Wizer)
- No need for the Rust toolchain for end users
The project is similar to wasmedge-quickjs in using te QuickJS engine compiled to WASM to run JavaScript code, but it is different in the following ways:
- It does not provide support for using the component model from JS (defining imports and exports using WIT)
- The imports the resulting WASM component has are WasmEdge specific
The tool can be used as a command line tool or as a library. The command line tool has two top level commands:
generate-wrapper-crate Generate the wrapper crate for a JavaScript module
generate-dts Generate TypeScript module definitions
This is the primary command that generates the Rust crate embedding the JavaScript code into a WebAssembly Component.
Usage: wasm-rquickjs generate-wrapper-crate --js <JS> --wit <WIT> --output <OUTPUT>
- The
--jsarguments is the path to the JavaScript file to be wrapped. There can be only one JavaScript file, containing an ES6 module exporting the necessary functions and classes as described below. - The
--witargument is the path to the WIT root containing a single world that describes the imports and exports of the component - The
--outputargument is the path to the output directory where the generated Rust crate will be created.
The output directory is going to contain a self-contained Rust crate that can be compiled into a WASM component using
cargo build --target wasm32-wasip2.
Every generated crate also contains a target-specific THIRD_PARTY_COMPONENT_LICENSES.txt for the
locked Cargo dependency union of the standard normal / normal-p3 TypeScript runtime and
transform profiles. It is deliberately a superset for crates that enable fewer features.
Distributors must ship that notice with the compiled component and separately audit application
code, custom feature combinations, bundled JavaScript in the skeleton (including third-party code
adapted from Node.js, Deno, and web-streams-polyfill), toolchain and WASI sysroot components,
vendored native sources, and upstream NOTICE obligations. Maintainers can regenerate and verify
the retained notices with
tools/check-component-licenses.sh --write and --check, respectively, using the pinned
cargo-about version named by the script.
The generated crate has some features that control what imports the component will have beside the ones defined in the user's WIT world:
logging: enables thewasi:loggingimport to be used for the JavaScriptconsoleAPIhttp: enables thewasi:httpimport to be used for the JavaScriptfetchAPIsqlite: enables thenode:sqlitemodule with an embedded SQLite database engine
By default logging and http are enabled. The sqlite feature must be explicitly enabled.
The --target option selects which WASI generation mode is used:
--target wasi-p2(default): the historical WASI Preview 2 mode. Component exports are synchronous WIT functions and the full Node.js-compatible builtin set is available. This is the stable, production path.--target wasi-p3: the opt-in WASI Preview 3 mode. WITasync funcexports and imports use the Component Model async ABI, while plain functions remain synchronous. WITfuture<T>/stream<T>values are supported at function boundaries, including inside composite types. See WASI Preview 3 target below for the current status and limitations.
Both targets generate a crate that is still compiled with cargo build --target wasm32-wasip2
(a dedicated wasm32-wasip3 rustc target does not exist yet; the Preview 3 crate uses the
wasip3 bindings on top of the Preview 2 target).
A host application can give JavaScript its own Rust modules without editing the generated crate:
wasm-rquickjs generate-wrapper-crate ... \
--native-module my-native=my_native::Module \
--dependency 'my-native={ path = "../my-native" }'
--native-module <name>=<rust path>registers a type implementingrquickjs::module::ModuleDefso that JavaScript canimport ... from '<name>'. The name must not be a JavaScript module name, an imported WIT interface, or in the reservednode:and__wasm_rquickjs_builtin/namespaces. Like an embedded JavaScript module, a native module named after a schemeless builtin alias, such asfs, takes precedence over the alias for the component's own modules;node:fsstill resolves to the builtin.--dependency <key>=<TOML value>adds a[dependencies]entry, a version string or an inline table, and replaces an entry of the skeleton with the same key as a whole. A relativepathis resolved against the current directory and written relative to the generated crate. With any--dependency, the skeleton'sCargo.lockis not copied: it was resolved for the unmodified dependencies. A fresh output directory then has no lock and Cargo resolves one on the first build; aCargo.lockalready in the output directory is kept.
Both options can be repeated and work with both targets. The native module's crate must use the
same rquickjs version as the generated crate; the crate's [patch.crates-io] applies to it.
The generate-dts command generates TypeScript module definitions for all the exported and imported interfaces:
Usage: wasm-rquickjs generate-dts --wit <WIT> --output <OUTPUT>
- The
--witargument is the path to the WIT root containing a single world that describes the imports and exports of the component. - The
--outputargument is the path to the output directory where the generated TypeScript module definitions (.d.ts) will be created.
wasm-rquickjs is integrated into Golem's command line interface, so it can be directly used
using Golem app templates.
Note: Golem's Preview 3 SDK/template builds pin the
wasi-p3generator branch and pass--target wasi-p3when building their JavaScript guest images. Preview 2 remains the default for callers that do not select a target explicitly.
Passing --target wasi-p3 to generate-wrapper-crate selects the opt-in, asynchronous WASI
Preview 3 generation mode. It is intended for hosts that support the Component Model async ABI.
How it differs from Preview 2:
- WIT
async funcexports and imports use the Component Model async ABI (task.return); plain functions remain synchronous. - The JavaScript event loop is driven by the Component Model async executor instead of Preview 2
wasi:io/pollpollables — there are nowstd/wasip2/pollable dependencies in the Preview 3 code path. - WIT
future<T>andstream<T>are mapped to JavaScriptPromise<T>andAsyncIterable<T>respectively, both directly and when nested in composite parameter/result types. fetch/ HTTP uses thewasi:httpPreview 3 (wasi:http/handler) async client.
Building and running:
The generated crate is still built with cargo build --target wasm32-wasip2. Running the resulting
component requires a host with Preview 3 and Component Model async support. For example, with the
wasmtime CLI (version 46.x):
wasmtime run -S p3=y -S http=y --wasm component-model=y --wasm component-model-async=y \
--invoke 'my-export()' path/to/component.wasm
The Node.js-compatible builtin set is available on Preview 3 as well. Working end-to-end examples
live under examples/p3, covering async exports/imports, future<T>/stream<T>
values, exported resources, and HTTP fetch.
Current limitations (Preview 3):
- Composition (
--js-modules name=@composition) is not supported yet. - An exported result containing
future<T>orstream<T>must come from anasync func; a synchronous export cannot return its reader before a backpressured writer starts. - The error arm of an exported top-level
result<T, E>cannot containfuture<T>orstream<T>.
Wizer pre-initialization (optimize) supports Preview 3 components. As with Preview 2, module
initialization must become quiescent before the snapshot and cannot leave timers or tasks pending.
Runtime arguments and environment variables are restored before the first export runs; modules
must not capture their values or immutable aliases during top-level initialization.
External I/O during pre-initialization is rejected. Top-level filesystem
probes (including existsSync and module/package lookup), socket/DNS/HTTP/WebSocket
acquisition, SQLite opens (including :memory:), execution-job creation, and
process.chdir() fail the
build immediately. Catching a JavaScript exception cannot suppress this failure.
The diagnostic identifies the operation and recommends moving it into an exported
function or lazy initialization after restoration. This avoids saving unavailable
build-time capabilities or false filesystem results in the snapshot. The optimizer
also traps filesystem preopens, network acquisition and outgoing HTTP for older
templates and custom initializers. Rebuild templates to get native guards,
restore-safe pre-init stdio and guest diagnostics.
Importing these builtins, embedded/data modules and explicitly supplied module
sources remains supported. Logging and pure computation remain available.
process.cwd() is the logical / during pre-initialization and refreshes from the
runtime environment after restoration. wasm-rquickjs:execution may be imported,
but runJavaScript() and startJavaScript() are runtime-only, including for pure
computation. Create jobs from an exported function or lazy runtime initialization.
On cold start and after
restoration, the main runtime honors wasi:cli/environment's initial cwd. Hosts
must implement this standard WASI import; none retains /. A supplied cwd must
be an accessible directory, or runtime initialization fails. Owned jobs retain
their separate cwd.
Supplied CommonJS reexports that require filesystem analysis are still rejected
during pre-initialization, even if a loader could supply the child at runtime.
Defer those chains to runtime until loader-aware reexport analysis is supported.
Defer SQLite connections with new DatabaseSync(path, { open: false }), then call .open() after restoration.
Applications that require top-level external I/O should skip optimize and
initialize at runtime instead.
Host exception diagnostics recognize native Errors and legacy Error-prototype
objects and use bounded native stack
frames without invoking application getters, coercion, toJSON, or
Error.prepareStackTrace. Ordinary records and arrays show own data with a
two-level depth limit, a shared 16-property budget and a 4096-byte summary limit;
accessors, cycles and omitted entries are marked explicitly. Proxies and exotic
objects remain opaque. Array inspection reads only a bounded prefix, while native
record key discovery allocates a native table per visited record and may sort
integer keys. Its cost grows with record size, including repeated visits to shared
records; allocation failure falls back to an unavailable marker. Oversized strings receive
bounded descriptions. When the engine supplies no usable position, the
diagnostic explicitly says that the source location is unavailable. Existing
source maps and wrapper offsets are read through guarded data lookup; unsafe,
missing or overly expensive mappings fall back to generated code locations.
Previously prepared stack text is reused within the same bounds without running
its hook again. Readable bundles and source map configuration remain the
responsibility of the build tooling. Public
JavaScript .stack and prepareStackTrace behavior is unchanged.
Deterministic pre-initialization: newly generated P2 and P3 templates export
wasm-rquickjs-wizer-restore-v1. When optimizing their wizer-initialize export,
the optimizer supplies fixed-seed entropy, Unix-epoch wall time, and a zero
monotonic clock, with empty arguments/environment. These services exist only in
the optimizer store. Before any restored application JS runs, the guest reseeds
its crypto RNG from runtime host entropy (failure traps) and refreshes its
performance/uptime origin. Captured Math.random functions, including functions
from node:vm contexts, use that reseeded RNG. Runtime clock reads still use the
deployment host. Determinism is for identical input with the same optimizer and
dependencies, not a cross-version artifact format guarantee. Initialization must
also avoid external I/O and application-owned sources of nondeterminism; the
optimizer does not make arbitrary application code reproducible.
Application initialization is still snapshotted. Values already computed at
module top level—timestamps, random IDs, keys, library-owned PRNG state, performance
marks, and copies of environment values—remain frozen. Internal-service refresh
cannot undo those computations. Generate secrets and per-instance IDs after
restoration, inside an exported function; do not generate them at module top level.
Initialization must not depend on clocks advancing. Applications that need live
top-level entropy/time should skip optimize and initialize at runtime instead.
Old/unmarked components and other initializer names retain legacy real entropy and clocks, with a warning: output is not guaranteed reproducible, and cached RNG state may still be shared by restored instances. Update both the optimizer and rebuild guest templates to enable the deterministic path safely. Updating the optimizer alone does not repair a published template or existing snapshots. The capability export is a template producer's declaration of this restore contract, not a guarantee that arbitrary application state or composed code is snapshot-safe.
Library callers using the optimize feature can configure the guest-to-host copy budget for
initialization and Wizer snapshot memory extraction:
use wasm_rquickjs::{OptimizeOptions, optimize_component_with_options};
# async fn example(input: &camino::Utf8Path, output: &camino::Utf8Path) -> anyhow::Result<()> {
optimize_component_with_options(
input,
output,
"wizer-initialize",
&OptimizeOptions {
hostcall_fuel: Some(512 * 1024 * 1024), // 512 MiB per hostcall
},
).await?;
# Ok(())
# }An explicit budget requires use-golem-wasmtime and Cargo patches selecting Golem's
compatible Wasmtime 46.0.1 fork (see the commented patches in Cargo.toml); the feature alone
does not select the fork. Stock Wasmtime does not expose this setting, and an explicit budget
without the feature returns an error. optimize_component and OptimizeOptions::default()
leave the engine default unchanged (128 MiB in Golem's fork). This limits bytes copied per
hostcall, not Wasm instruction fuel or the total snapshot size. Raising it allows larger
copies and increases potential host memory use; insufficient fuel can still trigger Wizer's
existing snapshot-extraction panic.
Preview 3 is opt-in and evolving; Preview 2 (--target wasi-p2) remains the default and stable
path.
The following WIT code:
package demo:pkg;
world example {
export hello: func() -> string;
}must be implemented in JavaScript as:
export const hello = () => {
return "Hello, world!";
};The this is bound to the module object. The JS function name is always in camelCase.
Exported interfaces has to be exported from JavaScript as objects:
The following WIT example:
package demo:pkg;
interface sample-api {
get-string-length: func(value: string) -> u64;
}
world example {
export sample-api;
}has to be implemented in JavaScript as:
export const sampleApi = {
getStringLength: (value) => {
return value.length;
}
};All names are converted to camelCase. The JavaScript this is bound to object representing the exporter interface, in
the above example it is sampleApi.
If two exported interfaces in the same world map to the same JavaScript object name, the colliding interfaces are
exported with a qualified name derived from their full WIT interface id. For example, test:a/guest@1.0.0 and
test:b/guest@1.0.0 both have the short interface name guest, so they must be exported as:
export const testA100Guest = {
invoke: (a, b, c) => `${a}:${b}:${c}`,
};
export const testB100Guest = {
invoke: (a, b, c, d, e) => `${a}:${b}:${c}:${d}:${e}`,
};Interfaces whose JavaScript object names do not collide keep the short camelCase export shape.
Exported resources are implemented as classes in JS:
The following WIT example:
package demo:pkg;
interface iface {
resource example-resource {
constructor(name: string);
get-name: func() -> string;
compare: static func(h1: borrow<example-resource>, h2: borrow<example-resource>) -> s32;
merge: static func(h1: own<example-resource>, h2: own<example-resource>) -> hello;
}
}
world example {
export iface;
}Must be exported from JavaScript in the following way:
class Hello {
constructor(name) {
this.name = name;
}
// async to demonstrate it is possible
async getName() {
return this.name;
}
static compare(h1, h2) {
if (h1.name === h2.name) {
return 0;
} else if h1.name < h2.name) {
return -1;
} else {
return 1;
}
}
static merge(h1, h2) {
return new Hello(`${h1.name} & ${h2.name}`);
}
}
export const iface = {
Hello: Hello,
};The classes have a UpperCamelCase name and their methods are in camelCase. All methods and static methods can be either sync or async.
| Name | WIT | JS | Notes |
|---|---|---|---|
| Character | char |
string |
- |
| String | string |
string |
- |
| Signed 8-bit integer | s8 |
number |
- |
| Unsigned 8-bit integer | u8 |
number |
- |
| Signed 16-bit integer | s16 |
number |
- |
| Unsigned 16-bit integer | u16 |
number |
- |
| Signed 32-bit integer | s32 |
number |
- |
| Unsigned 32-bit integer | u32 |
number |
- |
| Signed 64-bit integer | s64 |
bigint |
- |
| Unsigned 64-bit integer | u64 |
bigint |
- |
| 32-bit float | f32 |
number |
- |
| 64-bit float | f64 |
number |
- |
| Optional type | option<T> |
T | undefined |
Nested options are encoded differently |
| List | list<T> |
T[] |
- |
| Result | result<T, E> |
{ tag: "ok": val: T } | { tag: "err", val: E } |
- |
| Tuple | tuple<A, B, C> |
Array | - |
| Enum | enum { a, b, c} |
"a" | "b" | "c" |
The strings match the WIT enum cases |
| Flags | flags { a, b, c } |
{ a: boolean, b: boolean, c: boolean } |
The object keys are camelCase |
| Record | record { .. } |
Object | Field names are camelCase |
| Variant | variant { .. } |
{ tag: "x", val: X } |
Tag names match the WIT variant case names; val is undefined for unit cases |
| Future | future<T> |
Promise<T> |
WASI Preview 3 (--target wasi-p3) only |
| Stream | stream<T> |
AsyncIterable<T> |
WASI Preview 3 (--target wasi-p3) only |
An imported function that returns result<T, E> returns T on success and throws
E on failure. Async imports reject with the same error value.
Structured error values retain their WIT representation. String(error), template
interpolation, and new Error(error).message render the payload as JSON instead of
[object Object]. For example, a permission error renders as
{"tag":"permission-denied"}, and a backend error renders as
{"tag":"backend-error","val":"service unavailable"}. Bigint fields render as
decimal strings without changing the original values.
The coercion methods are non-enumerable. The original fields, object identity, enumerable keys, and typed catch-and-rethrow behavior remain unchanged. Primitive errors and successful values are not decorated. This rendering applies to error string coercion; it does not replace the runtime's uncaught-exception formatter.
- Maximum number of function parameters is 26
- Anonymous interface exports/imports are not supported
- Imported individual functions into the world are not supported (only whole interfaces)
- Preview 3 synchronous exports cannot return
future<T>orstream<T>, directly or nested; useasync func - Preview 3 exported top-level
result<T, E>error arms cannot containfuture<T>orstream<T>
Console
If the logging feature flag is enabled in the generated crate, it depends on wasi:logging, otherwise just on the core WASI interfaces.
assert,clear,count,countReset,debug,dir,dirXml,error,group,groupCollapsed,groupEnd,info,log,table,time,timeEnd,timeLog,trace,warn
HTTP (fetch)
Only if the http feature flag is enabled in the generated crate. It depends on wasi:http.
fetch,Headers,Request,Response,FormData,Blob,File
URL
URL(createObjectURL,revokeObjectURL)URLSearchParams
Streams
Implemented by https://github.com/MattiasBuelens/web-streams-polyfill
ByteLengthQueuingStrategy,CountQueuingStrategyReadableStream,ReadableStreamDefaultReader,ReadableStreamBYOBReader,ReadableStreamDefaultController,ReadableByteStreamController,ReadableStreamBYOBRequestWritableStream,WritableStreamDefaultControllerTransformStream,TransformStreamDefaultController
Timers
setTimeout,clearTimeout,setInterval,clearInterval,setImmediate
Abort Controller
AbortController,AbortSignal,DOMException
Encoding
TextEncoder,TextDecoder,TextDecoderStream,TextEncoderStream
Messaging
MessageChannel,MessagePort
Events
Event,EventTarget,CustomEvent
Intl (Internationalization)
Minimal en-US implementation for library compatibility. All locale inputs are accepted but resolved to en-US.
Intl.DateTimeFormat—format(),formatToParts(),resolvedOptions(),supportedLocalesOf()Intl.NumberFormat—format(),formatToParts(),resolvedOptions(),supportedLocalesOf()Intl.Collator—compare(),resolvedOptions(),supportedLocalesOf()Intl.PluralRules—select(),selectRange(),resolvedOptions(),supportedLocalesOf()Intl.getCanonicalLocales(),Intl.supportedValuesOf()
When the timezone feature is enabled (default), DateTimeFormat supports all ~590 IANA timezones via chrono-tz.
Crypto (global)
crypto.randomUUID,crypto.getRandomValues
Performance (global)
performance.now()uses the WASI monotonic clock and is not affected by wall-clock adjustments.performance.timeOriginis the deployment wall-clock origin paired with that monotonic timeline.- The global object is shared with
node:perf_hooks.
Structured Clone
structuredClone preserves object graphs, ArrayBuffer/view aliases and genuine in-memory Blob data.
The runtime-owned process.env clones into an ordinary, independent environment snapshot; application-created proxies remain uncloneable.
CryptoKey metadata participates in the same graph, including aliases and cycles.
Transfer buffers detach only after the complete graph and host metadata validate; unlike Node.js,
a rejected CryptoKey metadata graph leaves these buffers attached.
ArrayBuffer transfer and runtime-local transferable AbortSignals are supported. Transferred signal reasons
are copied before local abort listeners run; target abort delivery is queued. Clone/transfer markers
are enforced by the same private policy used by MessageChannel; nonstandard json/lossy options
cannot disable rejection. Blob clones own independent byte data. File-backed/foreign Blob backing,
SharedArrayBuffer or immutable ArrayBuffer cloning, resizable-ArrayBuffer-backed views, and stream/MessagePort/FileHandle transfer are unsupported and rejected.
FileHandle and web-stream payloads also reject without a transfer list; their ownership transfer is unavailable.
Execution-job results reject Blob and other host values rather than transporting opaque resources.
The serializer is adapted from https://github.com/ungap/structured-clone.
node:assert
ok,equal,notEqual,strictEqual,notStrictEqualdeepEqual,notDeepEqual,deepStrictEqual,notDeepStrictEqual,partialDeepStrictEqualthrows,doesNotThrow,rejects,doesNotRejectifError,match,doesNotMatch,failAssertionError,CallTrackerstrict— strict mode variant (re-mapsequal→strictEqual,deepEqual→deepStrictEqual, etc.)
node:async_hooks
AsyncLocalStorage—run,exit,getStore,enterWith,disable,snapshot,bindAsyncResource—runInAsyncScope,asyncId,triggerAsyncId,bindcreateHook— stub (returns enable/disable no-ops)executionAsyncId,triggerAsyncId,executionAsyncResource— stubs
Context propagation works through Promise.prototype.then/catch/finally and setTimeout/setInterval. Limitation: QuickJS await uses internal C-level perform_promise_then which bypasses JS-visible Promise.prototype.then, so context is not propagated across await boundaries.
node:buffer
Buffer,Blob,File,SlowBufferresolveObjectURL,isAscii,isUtf8INSPECT_MAX_BYTES,kMaxLength,kStringMaxLength,constants
node:child_process
WASI cannot create host processes. JavaScript commands targeting process.execPath and executable
Node shebang files run in the component. On Preview 3, each local child has a fresh runtime,
argv, environment, cwd and module cache. Synchronous calls pause parent JavaScript while the child
drains its referenced work. Local spawn and execFile expose live output and let the parent run
while the child waits for timers or I/O. JavaScript execution is cooperative on the shared WASM
thread: a CPU-bound child needs its own timeout; parent timers cannot preempt it to call kill().
Nested children inherit the outer child's deadline. The constrained local exec and fork
adapters still execute synchronously before delivering their events.
Preview 2 retains inline execution and does not join asynchronous local-child work.
The constrained compatibility adapter also recognizes npm's literal sh -c form for plain Node
commands. Unsupported shells, shell syntax, external executables and unsupported shebangs fail
explicitly with ENOSYS, unless an embedding handles them through a registered backend.
ChildProcess,exec,execFile,fork,spawn,execSync,execFileSync,spawnSync
An embedding may register command fallbacks through wasm-rquickjs:child-process (below).
Without a backend, the unsupported-command behavior is unchanged.
exec and execFile collect the asynchronous backend child's output, preserve its
error or exit status, and enforce their output limits and timeout. They do not use
the synchronous backend when an asynchronous command is accepted.
Promisified exec and execFile return both output channels and expose their child
through the promise's child property.
Preview 3 local children capture exit status and uncaught failures, preserve piped bytes, and
support timeout, cancellation and bounded output. Fixed input is available through process.stdin,
fs.readFile(0) / fs.readFileSync(0) and /dev/stdin. Live writes to child.stdin, interactive
stdin, extra file descriptors and IPC are not provided; unsupported stdio requests fail with ENOSYS.
Inherited output passes through the parent's stream adapter and has a 64 MiB per-channel transfer
limit. Fresh children do not provide hard JavaScript termination after process.exit().
Native embedding modules must compose their child work explicitly rather than spawning unrelated
wit-bindgen tasks across the synchronous child boundary. Runtime-init hooks must stay lazy.
node:cluster (stub)
Compatibility stubs — clustering is not supported in WASM.
isPrimary,isMaster,isWorker,fork,disconnect,setupPrimary
node:constants
Merged constants from os.constants, fs.constants, and crypto.constants (signal numbers, errno values, file flags, etc.)
node:crypto
- Hashing:
createHash,createHmac,hash,getHashes - Ciphers:
createCipheriv,createDecipheriv,getCiphers- Supported: aes-128/256-cbc, aes-128/256-ctr, aes-128/256-gcm, aes-128/192/256-wrap, id-aes128/192/256-wrap, id-aes128/192/256-wrap-pad, des-ede3-cbc, des3-wrap, chacha20-poly1305
- Signing:
createSign,createVerify(Ed25519, ECDSA with P-256, P-384, secp256k1) - Keys:
createPublicKey,createPrivateKey,createSecretKey,KeyObject,generateKeyPairSync,generateKeyPair - ECDH:
createECDH,ECDH,diffieHellman,getCurves - Certificate:
Certificate(verifySpkac,exportPublicKey,exportChallenge) - Random:
randomBytes,randomFillSync,randomFill,randomInt,randomUUID,pseudoRandomBytes,prng,rng - KDF:
pbkdf2,pbkdf2Sync,scrypt,scryptSync,hkdf,hkdfSync - Primes:
generatePrime,generatePrimeSync,checkPrime,checkPrimeSync - Other:
timingSafeEqual,getFips,setFips,secureHeapUsed
node:dgram
UDP datagram sockets built on WASI sockets.
dgram.createSocket(type[, listener])— create a UDP socket (udp4orudp6)socket.bind,socket.send,socket.sendto,socket.connect,socket.disconnect,socket.closesocket.address(),socket.remoteAddress()socket.setTTL,socket.setRecvBufferSize/getRecvBufferSize,socket.setSendBufferSize/getSendBufferSizesocket.ref()/socket.unref()— no-op- Events:
message,listening,close,error,connect
Not supported: multicast operations (setBroadcast, setMulticastTTL, addMembership, etc.) throw ENOSYS.
node:diagnostics_channel
Publish/subscribe diagnostic messaging and tracing.
Subscriber and store-transform errors are delivered through uncaughtException on the next tick, without interrupting other subscribers.
channel(name),subscribe(name, onMessage),unsubscribe(name, onMessage),hasSubscribers(name),tracingChannel(name)Channel—subscribe,unsubscribe,publish,bindStore,unbindStore,runStores,hasSubscribers,nameTracingChannel—subscribe,unsubscribe,hasSubscribers,traceSync,tracePromise,traceCallback
Built-in HTTP diagnostics channels: http.client.request.created, http.client.request.start, http.client.request.error, http.client.response.finish.
node:dns
DNS resolution via WASI sockets.
lookup,lookupService,resolve,resolve4,resolve6resolveAny,resolveCname,resolveCaa,resolveMx,resolveNaptr,resolveNs,resolvePtr,resolveSoa,resolveSrv,resolveTxt,resolveTlsareverse,setServers,getServers,setDefaultResultOrder,getDefaultResultOrderResolverclasspromises— promise-based API- Error constants:
NODATA,FORMERR,SERVFAIL,NOTFOUND,NOTIMP,REFUSED,BADQUERY,BADNAME,BADFAMILY,BADRESP,CONNREFUSED,TIMEOUT,EOF,FILE,NOMEM,DESTRUCTION,BADSTR,BADFLAGS,NONAME,BADHINTS,NOTINITIALIZED,LOADIPHLPAPI,ADDRGETNETWORKPARAMS,CANCELLED,ADDRCONFIG,V4MAPPED,ALL
node:domain
Deprecated error-handling domains (sync-only).
domain.create()/domain.createDomain(),domain.active,domain._stackDomainclass (extendsEventEmitter):run,add,remove,bind,intercept,enter,exit,dispose,members,parentprocess.domain— reflects active domain- Error decoration:
error.domain,error.domainEmitter,error.domainBound,error.domainThrown - EventEmitter integration and async propagation via
process.nextTick,setTimeout,setInterval
Limitation: No async context propagation via async_hooks — only synchronous errors and explicitly bound callbacks are captured.
node:events
EventEmitter—on,once,off,addListener,removeListener,removeAllListeners,emit,listenerCount,eventNames,listeners,rawListeners,prependListener,prependOnceListener,setMaxListeners,getMaxListeners- Static:
once,on,getEventListeners,getMaxListeners,setMaxListeners,addAbortListener,errorMonitor,captureRejections Event,EventTarget,CustomEvent
node:fs
Comprehensive filesystem API built on WASI filesystem.
Symbolic links are persistent WASI filesystem objects, so linked package trees
remain visible to later fresh execution runtimes. Link targets must be relative:
Rooted targets cannot be resolved within a WASI preopen, so symlink fails with
EINVAL without creating an object when given one. Production Golem and
macOS/Linux local development support these links. Windows local development
currently requires Developer Mode or an equivalent symlink privilege; non-link
filesystem and npm workflows are unaffected.
- Sync:
readFileSync,writeFileSync,appendFileSync,openSync,closeSync,readSync,writeSync,ftruncateSync,fsyncSync,fdatasyncSync,statSync,lstatSync,fstatSync,statfsSync,readdirSync,accessSync,existsSync,realpathSync,truncateSync,copyFileSync,linkSync,symlinkSync,readlinkSync,chmodSync,fchmodSync,lchmodSync,chownSync,fchownSync,lchownSync,utimesSync,futimesSync,lutimesSync,unlinkSync,renameSync,mkdirSync,rmdirSync,rmSync,mkdtempSync,opendirSync,readvSync,writevSync,cpSync - Async (callback):
readFile,writeFile,appendFile,open,close,read,write,stat,lstat,fstat,statfs,ftruncate,fsync,fdatasync,readdir,access,exists,realpath,truncate,copyFile,link,symlink,readlink,chmod,fchmod,lchmod,chown,fchown,lchown,utimes,futimes,lutimes,unlink,rename,mkdir,rmdir,rm,mkdtemp,opendir,watch,watchFile,unwatchFile,readv,writev,cp,openAsBlob - Streams:
createReadStream,createWriteStream - Classes:
Stats,Dirent,Dir,FSWatcher,StatWatcher,ReadStream,WriteStream - Constants:
F_OK,R_OK,W_OK,X_OK,O_RDONLY,O_WRONLY,O_RDWR,O_CREAT,O_EXCL,O_TRUNC,O_APPEND, etc.
node:fs/promises
Promise-based filesystem API.
FileHandle,open,readFile,writeFile,appendFile,unlink,rename,mkdir,rmdir,rm,stat,lstat,readdir,opendir,access,realpath,truncate,copyFile,link,symlink,readlink,chmod,lchmod,chown,lchown,utimes,lutimes,mkdtemp,cp,watch,statfs,constants
node:http / node:https
Requires the http feature flag. Client requests use wasi:http (TLS handled transparently). Server support uses wasi:sockets for TCP-level HTTP/1.1 serving.
http.request(url|options[, callback]),http.get(url|options[, callback])http.METHODS,http.STATUS_CODES,http.maxHeaderSizehttp.validateHeaderName,http.validateHeaderValuehttp.Agent,http.globalAgenthttp.OutgoingMessage— base class for writable HTTP message objectshttp.ClientRequest—write,end,setHeader,getHeader,removeHeader,hasHeader,getHeaderNames,getHeaders,getRawHeaderNames,flushHeaders,setNoDelay,setSocketKeepAlive,abort,destroy,setTimeouthttp.IncomingMessage—statusCode,statusMessage,headers,rawHeaders,httpVersionhttps.request/https.get— delegates tohttp(WASI-HTTP handles TLS transparently)http.createServer([options][, requestListener])— create an HTTP/1.1 server (requireswasi:sockets)http.Server(extendsnet.Server):listen,close,closeAllConnections,closeIdleConnections,setTimeout,maxRequestsPerSocket; emitsdropRequestwhen the per-socket limit is exceededhttp.ServerResponse(extendsEventEmitter):writeHead,setHeader,getHeader,removeHeader,hasHeader,getHeaders,getHeaderNames,getRawHeaderNames,write,end,flushHeaders,writeContinue,writeProcessing,writeEarlyHints,cork,uncork- Server-side
IncomingMessage(extendsstream.Readable):method,url,headers,headersDistinct,rawHeaders,httpVersion,socket,client,complete,aborted,trailers,trailersDistinct,rawTrailers node:_http_common—_checkIsHttpToken,_checkInvalidHeaderChar- Supported features: keep-alive connections, chunked transfer encoding, content-length bodies, ordered pipelined responses, server-side 100/102/103 informational responses, per-socket request limits, idle connection cleanup
Not yet supported: HTTP Upgrade and CONNECT tunnels, client-side 1xx informational events
through wasi:http, server-side timeout enforcement, https.createServer() / HTTPS server, client
lookup / autoSelectFamily options, and custom per-request createConnection transports. Custom
Agent createConnection hooks are ignored with a warning so Agent metadata and scheduling remain
usable, but they cannot route or isolate traffic; every outbound request still uses wasi:http.
node:http2 (stub)
Compatibility stubs — HTTP/2 is not supported.
connect,createServer,createSecureServer,Http2ServerRequest,Http2ServerResponse
wasm-rquickjs:child-process
setProcessBackend({ spawn?, spawnSync? }) installs runtime-local command fallbacks; pass null
or undefined to clear them. Methods receive (command, args, options) and return undefined
when they do not handle a command. Local Node and executable Node-shebang targets retain priority.
The optional-argv forms spawn(command, options) and spawnSync(command, options) are
normalized before dispatch, so adapters always receive an argv array and a separate options object.
spawn returns a ChildProcess-compatible object. spawnSync returns a synchronous Node-style
result with byte stdout/stderr, or null for unpiped channels; the wrapper applies the requested output encoding. A Promise
from spawnSync is rejected. execFileSync uses that fallback; execSync delegates with the
shell option set. This hook does not itself execute host processes or implement a
tool registry, permissions, or shell policy.
Embeddings can supply an additional JS module named wasm-rquickjs-runtime-init using
--js-modules. It is imported after builtin wiring and before entry code in both the main
runtime and every fresh execution job. Use it to register adapters independently in each runtime.
It also runs during Wizer initialization: registration must not discover tools, capture invocation
authority, perform host I/O, or start background work. Do that lazily in backend methods instead.
This configuration hook is not a security boundary; host capability checks remain authoritative.
wasm-rquickjs:execution
Runs JavaScript asynchronously in a fresh QuickJS runtime. startJavaScript(options) returns live
stdout/stderr readable streams, a result promise resolving to { value, overflowed }, and
cancel(). Jobs are runtime-only; importing this module during pre-initialization
is safe. runJavaScript(options) collects the streams and resolves to
{ value, overflowed, stdout, stderr }. value crosses the runtime boundary through structured
clone.
Options accept exactly one of entry: string or inline source: string, plus cwd, argv,
env, timeoutMs, maxBytes (1 MiB per stream by default, 64 MiB maximum), and overflow
(terminate by default or truncate). language: "javascript" | "typescript" applies only to
inline source and defaults to JavaScript. With the generated crate's typescript-runtime
feature enabled, TypeScript entry files are selected by their .ts, .mts, or .cts extension,
and inline jobs can select language: "typescript".
Output and completion wake the parent without periodic polling. Timeout budgets start
after child-runtime initialization. An async wait observes deadlines while jobs yield; for
non-yielding JavaScript, the QuickJS interrupt handler samples the clock at an adaptive stride
targeting one check per 10% of timeoutMs during steady CPU work. This is a best-effort budget,
not an exact cutoff or a maximum-overrun guarantee. A job that finishes between checks can
succeed after its literal deadline; no extra clock check occurs at completion. Entry modules run
for their side effects; an exported
default function (or run function when there is no default function) is invoked and awaited.
Relative entry paths and imports resolve from cwd. Inline source is an async function body:
top-level await and return are supported, while static import/export declarations are not.
env is an explicit allowlist and defaults to an empty environment; jobs never merge or inherit
the enclosing component's environment variables. When argv is omitted, entry jobs receive
["wasm-rquickjs-execution", resolvedEntryPath] and inline jobs receive
["wasm-rquickjs-execution"].
With overflow: "terminate", exceeding either stream's bound rejects the job. With
overflow: "truncate", execution continues, captured output is bounded, and overflowed is
true when either stream exceeded the bound.
Cancellation is cooperative for queued or yielding code and cannot preempt a tight loop already
running on the same thread; a positive timeoutMs is the best-effort escape mechanism for such a
loop. Cancellation remains a guest-local flag check on every QuickJS interrupt. A job that
never settles must be cancelled or given a timeout before the enclosing component invocation can
finish. A runtime accepts at
most eight active jobs, and child executions cannot recursively create more execution jobs.
Fresh-runtime execution means fresh JavaScript globals, process state, timers, module caches, and
other mutable QuickJS runtime state. Results cross the runtime boundary through structured clone.
It is not a security sandbox: execution code inherits the component's filesystem, network, clocks,
randomness, and other available host capabilities, and cwd is only a resolution base—not a
filesystem boundary. Failed jobs are
currently returned as parent-realm Error messages rather than structured-cloned thrown values.
This API is distinct from node:vm. The node:vm module provides synchronous Node-compatible
contexts within one QuickJS runtime, including live-object behavior required by its API.
wasm-rquickjs:execution provides asynchronous jobs in fresh runtimes with structured-clone
results. Neither API is a security sandbox, and both share the enclosing component's capabilities
and filesystem access.
node:inspector (stub)
Compatibility stubs — no V8 inspector in WASM.
Session,open,close,url,waitForDebugger,console,Network
node:module
Builtin ESM export names are fixed by the runtime, including aliases. Changing builtin properties before the first ESM import does not add or remove named exports; syncBuiltinESMExports() updates their values.
require,require.resolve,createRequire,builtinModules,isBuiltin,runMain,_nodeModulePathsstripTypeScriptTypes(code[, options])with Node-compatible strip and transform modes when the generated crate enablestypescript-runtime- Package resolution supports
package.jsonmain,exportsroot/subpath maps, wildcardexportspatterns,importsmaps, and wildcardimportspatterns. CJS resolution recognizesgolem,node,require,module-sync, anddefaultconditions; ESM resolution recognizesgolem,node,import,module-sync, anddefault. Packageimportscan target relative files, external packages, andnode:builtins. - With
typescript-runtime,.mtsis always ESM,.ctsis always CommonJS, and.tsfollows the nearest package type and Node-style syntax classification. ESM imports require explicit file extensions. Type stripping insidenode_modulesis rejected, matching Node's built-in support. The runtime does not type-check, readtsconfig.json, or support.tsx; enabletypescript-transform-runtimeinstead oftypescript-runtimefor enums, runtime namespaces, and other transform-required syntax in module files or inlinelanguage: "typescript"execution source.
node:net
TCP sockets and servers built on WASI sockets.
net.createServer([options][, connectionListener]),net.createConnection(options[, connectListener]),net.connect(...)net.isIP(input)/net.isIPv4(input)/net.isIPv6(input)net.getDefaultAutoSelectFamily()/net.setDefaultAutoSelectFamily(value)— stubsnet.Socket(extendsstream.Duplex):connect,write,end,destroy,resetAndDestroy,setTimeout,setNoDelay,setKeepAlive,address,ref,unref- Properties:
remoteAddress,remotePort,remoteFamily,localAddress,localPort,localFamily,bytesRead,bytesWritten,connecting,pending,readyState - Events:
connect,ready,data,end,close,error,timeout,drain,lookup
- Properties:
net.Server(extendsEventEmitter):listen,close,address,getConnections,ref,unref- Properties:
listening,maxConnections - Events:
listening,connection,close,error,drop
- Properties:
net.BlockList,net.SocketAddress,net.Stream
Not supported: IPC/Unix domain sockets, Happy Eyeballs/autoSelectFamily (stubbed), cluster integration.
node:os
arch,platform,type,release,version,machine,hostname,homedir,tmpdir,endiannesscpus,loadavg,freemem,totalmem,uptime,availableParallelismnetworkInterfaces,userInfo,getPriority,setPriorityEOL,devNull,constants(signals, errno, priority)
node:path
sep,delimiter,basename,dirname,extname,isAbsolute,join,normalize,relative,resolve,parse,format,matchesGlob,toNamespacedPath,posix
node:perf_hooks
performance— monotonicnow(), deploymenttimeOrigin,mark(),measure(),getEntries(),getEntriesByName(),getEntriesByType(),clearMarks(),clearMeasures(),toJSON()PerformanceEntry,PerformanceObservermonitorEventLoopDelay,createHistogram,constants
node:process
- Properties:
argv,argv0,env,pid,ppid,platform('wasi'),arch('wasm32'),version,versions,config,features,execArgv,execPath,exitCode,stdout,stderr - Methods:
exit(code),cwd(),nextTick(callback, ...args),getBuiltinModule(id),hrtime(),hrtime.bigint(),uptime(),cpuUsage(),memoryUsage(),kill(pid, signal),abort(),emitWarning() getBuiltinModule(id)returns the existing object for builtins registered by this runtime, andundefinedfor unavailable IDs. The supported set is smaller than Node.js:node:sea,node:test/reporters,node:inspector/promises,node:wasi,_stream_wrap, and unimplemented_http_*/_tls_*wrappers are unavailable.- User/Group:
getuid,getgid,geteuid,getegid,getgroups,setuid,setgid - Inherits from
EventEmitter— supportson('uncaughtException'),on('unhandledRejection'), etc.
node:punycode
decode,encode,toASCII,toUnicode,ucs2,version
node:querystring
stringify/encode,parse/decode,escape,unescape,unescapeBuffer
node:readline
createInterface,Interface,clearLine,clearScreenDown,cursorTo,moveCursor,emitKeypressEventsreadline/promises— promise-based API
node:repl (stub)
start,REPLServer,Recoverable,builtinModules
node:sqlite
Requires the sqlite feature flag. Provides a synchronous SQLite database API with an embedded SQLite engine.
DatabaseSync—prepare,exec,close,open,isOpen,isTransaction,createSession,applyChangeset,enableLoadExtension,function,aggregate,backupStatementSync—run,get,all,iterate,columns,setReadBigInts,setAllowBareNamedParameters,sourceSQL,expandedSQLSession—changeset,patchset,close- Constants:
SQLITE_CHANGESET_OMIT,SQLITE_CHANGESET_REPLACE,SQLITE_CHANGESET_ABORT
Not supported: loadExtension() (throws — native extensions cannot be loaded in WASM).
node:stream
-
Legacy
_stream_readable,_stream_writable,_stream_duplex,_stream_transformand_stream_passthroughaliases support CommonJS and ESM, with the same constructor defaults. -
Readable(withfrom,fromWeb,toWeb,wrap, and functional methods:map,filter,flatMap,take,drop,toArray,forEach,reduce,some,every,find) -
Writable,Duplex,Transform,PassThrough,Stream -
pipeline,finished,compose,duplexPair,addAbortSignal -
getDefaultHighWaterMark,setDefaultHighWaterMark,isDisturbed,destroy -
stream/consumers(arrayBuffer,blob,buffer,json,text) -
stream/promises— promise-basedpipelineandfinished
node:string_decoder
StringDecoder
node:test
Built-in test runner.
test,describe/suite,it,before,after,beforeEach,afterEachmock— function mocking utilitiesrun— programmatic test execution
node:timers
setTimeout,setInterval,setImmediate,clearTimeout,clearIntervaltimers/promises— promise-basedsetTimeout,setInterval,setImmediate
node:tls (stub)
Compatibility stubs — TLS is handled transparently by the WASI-HTTP layer.
SecureContext,TLSSocket,Server,connect,createServer,createSecureContext,checkServerIdentity,getCiphers,rootCertificatesDEFAULT_MIN_VERSION,DEFAULT_MAX_VERSION,DEFAULT_ECDH_CURVE
node:trace_events
Partial compatibility API to unblock modules that inspect tracing state.
createTracing({ categories: string[] })— creates aTracinghandleTracing#enable()/Tracing#disable()— toggles local tracing stateTracing#enabled/Tracing#categories— read tracing configurationgetEnabledCategories()— returns currently enabled categories as a comma-separated string
Limitation: No native trace sink; API-surface compatibility only.
node:tty
isatty,ReadStream,WriteStream
node:url
URL,URLSearchParamsparse,resolve,format(legacy API)domainToASCII,domainToUnicodefileURLToPath,pathToFileURL,urlToHttpOptions
node:util
-
sys/node:sysaliases share the util object and support CommonJS and ESM. -
format,inspect,deprecate,debugLog,log -
Type checks:
isArray,isBoolean,isNull,isNullOrUndefined,isNumber,isString,isSymbol,isUndefined,isRegExp,isObject,isDate,isError,isFunction,isPrimitive,isBuffer -
promisify,callbackify -
parseEnv,styleText,getCallSite,getCallSites,toUSVString,_extend -
TextEncoder,TextDecoder
node:v8
getHeapStatistics,getHeapSpaceStatistics,getHeapSnapshot,getHeapCodeStatisticssetFlagsFromString,writeHeapSnapshot,takeCoverage,stopCoverageserialize,deserialize,Serializer,Deserializer,DefaultSerializer,DefaultDeserializer
node:vm
runInNewContext,runInContext,runInThisContext,createContext,isContext,compileFunctionScript,createScriptSourceTextModule(experimental, limitedexport const/export let/export varsupport)
These contexts are synchronous compatibility contexts within one QuickJS runtime. For asynchronous
jobs in fresh runtimes with structured-clone results, use wasm-rquickjs:execution. Neither API is
a security sandbox; both share the enclosing component's capabilities and filesystem access.
node:worker_threads (runtime-local messaging)
MessageChannel and MessagePort work within one runtime. Worker and BroadcastChannel construction throws immediately. Environment-data APIs are unavailable.
isMainThread,parentPort,workerData,threadId,resourceLimitsMessagePort,MessageChannel,receiveMessageOnPortmarkAsUncloneable,markAsUntransferable,isMarkedAsUntransferablemoveMessagePortToContext(limited compatibility API; no external execution context)- Unsupported compatibility exports:
Worker,BroadcastChannel,getEnvironmentData,setEnvironmentData
node:zlib
- Classes:
Deflate,Inflate,Gzip,Gunzip,DeflateRaw,InflateRaw,Unzip,BrotliCompress,BrotliDecompress - Factory:
createGzip,createGunzip,createDeflate,createInflate,createDeflateRaw,createInflateRaw,createUnzip,createBrotliCompress,createBrotliDecompress - Async:
gzip,gunzip,deflate,inflate,deflateRaw,inflateRaw,unzip,brotliCompress,brotliDecompress - Sync:
gzipSync,gunzipSync,deflateSync,inflateSync,deflateRawSync,inflateRawSync,unzipSync,brotliCompressSync,brotliDecompressSync crc32,constants,codes
Additional internal modules
internal/url—isURLinternal/http—kOutHeaderssymbolbase64-js—byteLength,toByteArray,fromByteArrayieee754—read,write
- NPM Library Compatibility Tracker — test results for popular npm packages
- Node.js v22 Compatibility Report — per-test results for vendored Node.js test suite
-
Global:
parseIntparseFloatisNaNisFinitequickMicrotaskdecodeURIdecodeURIComponentencodeURIencodeURIComponentescapeunescapeInfinityNaNundefined[Symbol.toStringTag]
-
Object- static methods and properties:
creategetPrototypeOfsetPrototypeOfdefinePropertydefinePropertiesgetOwnPropertyNamesgetOwnPropertySymbolsgroupBykeysvaluesentriesisExtensiblepreventExtensionsgetOwnPropertyDescriptorgetOwnPropertyDescriptorsisassignsealfreezeisSealedisFrozenfromEntrieshasOwn
- methods and properties:
toStringtoLocaleStringvalueOfhasOwnPropertyisPrototypeOfpropertyIsEnumerable__proto____defineGetter____defineSetter____lookupGetter____lookupSetter__
- static methods and properties:
-
Function- methods and properties:
callapplybindtoString[Symbol.hasInstance]fileNamelineNumbercolumnNumber
- methods and properties:
-
Error- methods and properties:
namemessagetoString
- static methods and properties:
isErrorcaptureStackTracestackTraceLimitprepareStackTrace
- methods and properties:
-
Generator- methods and properties:
nextreturnthrow[Symbol.toStringTag]
- static methods and properties:
from
- methods and properties:
-
Iterator- static methods and properties:
from
- methods and properties:
dropfilterflatMapmaptakeeveryfindforEachsomereducetoArray[Symbol.iterator][Symbol.toStringTag]
- static methods and properties:
-
Array- static methods and properties:
isArrayfromof[Symbol.species]
- methods and properties:
atwithconcateverysomeforEachmapfilterreducereduceRightfillfindfindIndexfindLastfindLastIndexindexOflastIndexOfincludesjointoStringtoLocaleStringpoppushshiftunshiftreversetoReversedsorttoSortedslicesplicetoSplicedcopyWithinflatMapflatvalues[Symbol.iterator]keysentries
- static methods and properties:
-
Number- static methods and properties:
parseIntparseFloatisNaNisFiniteisIntegerisSafeIntegerMAX_VALUEMIN_VALUENaNNEGATIVE_INFINITYPOSITIVE_INFINITYEPSILONMAX_SAFE_INTEGERMIN_SAFE_INTEGER
- methods and properties:
toExponentialtoFixedtoPrecisiontoStringtoLocaleStringvalueOf
- static methods and properties:
-
Boolean- methods and properties:
toStringvalueOf
- methods and properties:
-
String- static methods and properties:
fromCharCodefromCodePointraw
- methods and properties:
lengthatcharCodeAtcharAtconcatcodePointAtisWellFormedtoWellFormedindexOflastIndexOfincludesendsWithstartsWithmatchmatchAllsearchsplitsubstringsubstrslicerepeatreplacereplaceAllpadEndpadStarttrimtrimEndtrimRighttrimStarttrimLefttoStringvalueOflocaleComparenormalizetoLowerCasetoUpperCasetoLocaleLowerCasetoLocaleUpperCase[Symbol.iterator]anchorbigblinkboldfixedfontcolorfontsizeitalicslinksmallstrikesubsup
- static methods and properties:
-
Symbol- static methods and properties:
forkeyFor
- methods and properties:
toStringvalueOfdescription[Symbol.toPrimitive][Symbol.toStringTag]
- static methods and properties:
-
Map- static methods and properties:
groupBy[Symbol.species]
- methods and properties:
setgethasdeleteclearsizeforEachvalueskeysentries[Symbol.iterator][Symbol.toStringTag]
- static methods and properties:
-
Set- static methods and properties:
[Symbol.species]
- methods and properties:
addhasdeleteclearsizeforEachisDisjointFromisSubsetOfisSupersetOfintersectiondifferencesymmetricDifferenceunionvalueskeys[Symbol.iterator]entries[Symbol.toStringTag]
- static methods and properties:
-
WeakMap- methods and properties:
setgethasdelete[Symbol.toStringTag]
- methods and properties:
-
WeakSet- methods and properties:
addhasdelete[Symbol.toStringTag]
- methods and properties:
-
GeneratorFunction- methods and properties:
[Symbol.toStringTag]
- methods and properties:
-
Math- static methods and properties:
minmaxabsfloorceilroundsqrtacosasinatanatan2cosexplogpowsintantruncsigncoshsinhtanhacoshasinhatanhexpm1log1plog2log10cbrthypotrandomf16roundfroundimulclz32sumPrecise[Symbol.toStringTag]ELN10LN2LOG2ELOG10EPISQRT1_2SQRT2
- static methods and properties:
-
Reflect- static methods and properties:
applyconstructdefinePropertydeletePropertygetgetOwnPropertyDescriptorgetPrototypeOfhasisExtensibleownKeyspreventExtensionssetsetPrototypeOf[Symbol.toStringTag]
- static methods and properties:
-
RegExp- static methods and properties:
escape[Symbol.species]
- methods and properties:
flagssourceglobalignoreCasemultilinedotAllunicodeunicodeSetsstickyhasIndicesexeccompiletesttoString[Symbol.replace][Symbol.match][Symbol.matchAll][Symbol.search][Symbol.split]
- static methods and properties:
-
JSON- static methods and properties:
parsestringify[Symbol.toStringTag]
- static methods and properties:
-
Promise- static methods and properties:
resolverejectallallSettledanytryracewithResolvers[Symbol.species]
- methods and properties:
thencatchfinally[Symbol.toStringTag]
- static methods and properties:
-
AsyncFunction- methods and properties:
[Symbol.toStringTag]
- methods and properties:
-
AsyncIterator- methods and properties:
nextreturnthrow
- methods and properties:
-
AsyncGeneratorFunction- methods and properties:
[Symbol.toStringTag]
- methods and properties:
-
AsyncGenerator- methods and properties:
nextreturnthrow[Symbol.toStringTag]
- methods and properties:
-
Date- static methods and properties:
nowparseUTC
- methods and properties:
valueOftoString[Symbol.toPrimitive]toUTCStringtoGMTStringtoISOStringtoDateStringtoTimeStringtoLocaleStringtoLocaleDateStringtoLocaleTimeStringgetTimezoneOffsetgetTimegetYeargetFullYeargetUTCFullYeargetMonthgetUTCMonthgetDategetUTCDategetHoursgetUTCHoursgetMinutesgetUTCMinutesgetSecondsgetUTCSecondsgetMillisecondsgetUTCMillisecondsgetDaygetUTCDaysetTimesetMillisecondssetUTCMillisecondssetSecondssetUTCSecondssetMinutessetUTCMinutessetHourssetUTCHourssetDatesetUTCDatesetMonthsetUTCMonthsetYearsetFullYearsetUTCFullYeartoJSON
- static methods and properties:
-
BigInt- static methods and properties:
asIntNasUintN
- methods and properties:
toStringvalueOf[Symbol.toStringTag]
- static methods and properties:
-
ArrayBuffer- static methods and properties:
isView[Symbol.species
- methods and properties:
byteLengthmaxByteLengthresizeabledetachedresizeslicetransfertransferToFixedLength[Symbol.toStringTag]
- static methods and properties:
-
SharedArrayBuffer- static methods and properties:
[Symbol.species]
- methods and properties:
byteLengthmaxByteLengthgrowablegrowslice[Symbol.toStringTag]
- static methods and properties:
-
Typed arrays (
Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,BigInt64Array,BigUint64Array,Float32Array,Float64Array,Float16Array)- static methods and properties:
fromof[Symbol.species]
- methods and properties:
lengthatwithbufferbyteLengthsetbyteOffsetvalues[Symbol.iterator]keysentries[Symbol.toStringTag]copyWithineverysomeforEachmapfilterreducereduceRightfillfindfindIndexfindLastfindLastIndexreversetoReversedslicesubarraysorttoSortedjointoLocaleStringindexOflastIndexOfincludes
- static methods and properties:
-
DataView- methods and properties:
bufferbyteLengthbyteOffsetgetInt8getUint8getInt16getUint16getInt32getUint32getBigInt64getBigUint64getFloat16getFloat32getFloat64setInt8setUint8setInt16setUint16setInt32setUint32setBigInt64setBigUint64setFloat16setFloat32setFloat64[Symbol.toStringTag]
- methods and properties:
-
Atomics- static methods and properties:
addandorsubxorexchangecompareExchangeloadstoreisLockFreepausewaitnotify[Symbol.toStringTag]
- static methods and properties:
-
Performance- methods and properties:
now
- methods and properties:
-
WeakRef- methods and properties:
deref[Symbol.toStringTag]
- methods and properties:
-
FinalizationRegistry- methods and properties:
registerunregister[Symbol.toStringTag]
- methods and properties:
-
Callsite- methods and properties:
-
isNativegetFileNamegetFunctiongetFunctionNamegetColumnNumbergetLineNumber[Symbol.toStringTag]
- methods and properties:
-
-
Proxy
There are a few important things to keep in mind when working on the project:
-
The
skeletoncrate can be opened and compiled separately when working on the APIs provided for JavaScript. Unfortunately we cannot use theCargo.tomlfile name in it because that breaks Rust packaging - so before working on it, it has to be renamed toCargo.tomland before committing back it has to be renamed back toCargo.toml_. -
If the
skeletoncrate was compiled for testing, and thenwasm-rquickjsis compiled, theinclude_dir!macro is embedding everything from theskeletondirectory including thetargetdirectory, resulting in slow compilation times and huge resulting binaries. Use thecleanup-skeleton.shscript to quickly remove thetargetdirectory from theskeletoncrate. -
Run
tools/check-skeleton-clippy.shto lint the supported Preview 2 and Preview 3 skeleton feature matrix. The helper temporarily symlinksCargo.tomlto the checked-inCargo.toml_, directs output to the workspace-roottarget/cache, preserves that cache, and removes the symlink on exit. If a skeleton-localtarget/already exists, continue to usecleanup-skeleton.shbefore embedding the skeleton. -
Runtime and node compatibility tests support opt-in caches for faster local iteration. Select Node with
nvm use 22.14.0, then use the artifact and Wasmtime caches explicitly:WASM_RQUICKJS_TEST_ARTIFACT_CACHE=1 \ WASM_RQUICKJS_TEST_WASMTIME_CACHE=1 \ cargo test --test runtime --features use-golem-wasmtime -- module_resolution --report-timeThese caches may reuse generated wrapper, optimized component, and compiled Wasmtime artifacts. Every test still creates fresh wasm memory, a fresh Wasmtime
Storeand component instance, a fresh WASI context and temporary directory, and fresh QuickJS runtime state. Do not group compatibility cases into one wasm instance.WASM_RQUICKJS_TEST_DROP_CACHE=1forces generated artifacts to be rebuilt and bypasses Wasmtime's filesystem cache.WASM_RQUICKJS_TEST_UNOPTIMIZED=1skips Wizer pre-initialization for a shorter compile/test loop.WASM_RQUICKJS_TEST_PREPARED_COMPONENT_CACHE=1reuses immutable preparedEngine/Linker/Componentstate on the normalTestInstance::newpath.For skeleton development, select a local performance profile:
tools/dev-test.sh p2 fast-start runtime <exact_test_filter> tools/dev-test.sh p2 fast-run node_compat <test_filter> tools/dev-test.sh p2 fast-run node_compat <test_filter> --test-threads 4 tools/dev-test.sh p3 standard runtime ':tag:group3'
fast-startskips Wizer and uses one worker to minimize latency to the first result.fast-runruns Wizer, precompiles a changed component once before parallel workers start, reuses prepared components, and uses eight workers. Both accelerated profiles read the skeleton externally, reuse generated artifacts and Wasmtime's filesystem cache, and use locked Cargo builds.standarduses the embedded skeleton with optional caches and parent precompilation disabled, normal Wizer optimization, and default test-runner behavior.fast-rundefaults to eight workers andfast-startto one; pass test-r's--test-threads Nafter the filter to override either default. The eight-worker default was measured on a 14-core Apple M3 Max MacBook Pro (10 performance cores, 4 efficiency cores, 36 GB RAM, macOS 26.5.1). Performance comparisons must report preparation time, test execution time, and total wall time separately: precompilation makes the execution phase much faster but adds preparation that is only recovered by a sufficiently large or repeated filter.
The builtin JS modules are based on the work of several other projects: