quickjs-wasi
3.7.0 · 13 Nov 2026MIT14.3M / weekRepositoryHomepagenpmAtom feed
27 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 3.x · latest line
3.7.0
13 Nov 2026Summary· from the note as AI read it
Read before upgrading: 1 change to make.
Minor Changes
Add
vm.getAllocatedSize(), a constant-time read of the bytes the runtime has allocated: the valuememoryLimitis enforced against. Unlikevm.getMemoryUsage(), which walks the whole heap, its cost doesn't grow with heap size, so it suits frequent sampling.getMemoryUsage()also reports the same value as a newallocatedSizefield.Update QuickJS-NG from v0.17.0 to v0.18.0. Out-of-memory errors (
InternalError: out of memory) can no longer be caught by guest code: guestcatch/finallyblocks are skipped and the error propagates to the host as aJSException, leaving the VM usable. The release also includes fixes forString.prototype.repeat,Reflect.set, computed property assignment order, template literal conversion,Date.parsewith Unicode spaces, and several memory leaks.
3.6.4
6 Nov 2026Summary· from the note as AI read it
Read before upgrading: 1 change to make.
Patch Changes
Preserve native exceptions instead of dispatching a host callback when callback-name encoding fails.
Surface native Deferred resolver failures and release both resolvers even when invocation fails, while preserving one-shot settlement.
Reject failed host-function construction without retaining callbacks, preserve earlier pending exceptions on success, and roll back incomplete Promise subscriptions.
Propagate guest allocation and property write exceptions from host data construction instead of returning exception handles or partially populated values. Release partial conversions and preserve native exceptions across host callbacks, module loaders, and handle-scope boundaries.
Throw on failed host Promise construction before publishing a Deferred, release partial resolver ownership, and preserve earlier pending exceptions on success.
Terminate the VM and reject its host Promise observers when automatic host-Promise settlement or draining fails. Preserve the original host failure, ignore late completions after disposal, and keep private resolver handles alive across scope exit. Ordinary guest rejection remains a resolved error result; synchronous failures and
interruptHandlerinterrupts remain recoverable.executePendingJobs()now throws the job's original exception as aJSException(for example, messageinterrupted) instead of a plainErrorwith aJob execution error: ...message.
3.6.3
19 Oct 2026Release both deferred promise resolvers after the first settlement so the unused resolver does not retain the promise and its payload until VM disposal.
3.6.2
19 Sep 2026Update QuickJS-NG to v0.17.0, replacing the unreleased commit pin with an upstream release that includes WASI stack overflow protection.
3.6.1
17 Sep 2026Settle synchronous module namespace promises without draining unrelated guest jobs. Preserve deferred resolution for asynchronous modules and namespaces exporting
then.Include the wrapper's MIT license and copyright notice in the npm package.
3.6.0
25 Aug 2026Add the
maxStackSizeoption andMAX_STACK_SIZEceiling so WASI stack
overflow can be caught by guest JavaScript without exhausting the physical
WebAssembly stack.
3.5.0
20 Aug 2026- Security
Update quickjs-ng from v0.15.1 to v0.16.2: brings the iterator chunking/includes/join proposals, the
Error.prototype.stackaccessor proposal, a faster register-based regexp engine, a new arena allocator, and many correctness/security fixes. Add
handle.className: the engine-level class name of a value (e.g."Map","Date","URL") read trap-free from the class table — unlikeconstructorName, it executes no guest code and cannot be spoofed by prototype/constructor reassignment.Add
vm.markPromiseHandled(promise): suppress theonUnhandledRejectioncallback for a promise whose rejection the host observes through other means.
Minor Changes
Add
handle.className: the engine-level class name of a value (e.g."Map","Date","URL") read trap-free from the class table — unlikeconstructorName, it executes no guest code and cannot be spoofed by prototype/constructor reassignment.Add
vm.markPromiseHandled(promise): suppress theonUnhandledRejectioncallback for a promise whose rejection the host observes through other means.- Security
Update quickjs-ng from v0.15.1 to v0.16.2: brings the iterator chunking/includes/join proposals, the
Error.prototype.stackaccessor proposal, a faster register-based regexp engine, a new arena allocator, and many correctness/security fixes.
Patch Changes
resolvePromise(),Deferred.settled, and module namespace resolution now subscribe via quickjs-ng's engine-levelJS_PromiseTheninstead of a capturedPromise.prototype.then, so guest code that patchesthenorSymbol.speciescan no longer intercept or observe host promise subscriptions.Exceeding
memoryLimitthrowsInternalError: out of memoryagain instead of a barenull(regression in 3.3.1): the limit is now enforced in the WASI malloc layer, which reserves headroom below the limit so the OOM error object can always be constructed.
3.4.0
6 Aug 2026Strings now cross the WASM boundary losslessly in both directions — embedded NULs and lone surrogates survive
toString(),newString(),evalCode()sources, property keys, and enumeration.Add
vm.exportHandle()/vm.importHandle()for snapshot-portable handle tokens, enabling pre-snapshot captures to be re-materialized in restored VMs without executing guest code.
3.3.1
4 Aug 2026Host-callback
this/argument handles are now "borrowed": exempt fromwithScope()tracking anddispose()is a no-op. Their pointers are owned by the C trampoline (which frees them after the call returns), so a scope active around guest execution — or an explicit dispose inside a callback — previously double-freed the guest values and corrupted the heap. Callbacks retain arguments past their invocation viadup(), which takes an owned reference and behaves normally.Calling a guest function whose host callback is not registered now throws inside the guest (catchable, or surfaced as a host exception when uncaught), as the
newEphemeralFunctionandunregisterHostCallbackdocs already promised — previously it silently returnedundefined, masking bugs like un-re-registered callbacks after a snapshot restore.memoryLimitnow actually bounds retained memory: the runtime is created with malloc functions that use wasi-libc'smalloc_usable_size, replacing quickjs-ng's default usable-size which returns 0 on wasm32-wasi. Previously every allocation was accounted as overhead only, so retained ArrayBuffers/TypedArrays (and all other allocations) grew real memory without bound under any limit — reaching GiB under an 8 MiBmemoryLimit— andgetMemoryUsage().mallocSizestayed near zero. Workloads near their configured limit may now throw where they silently over-allocated before; raisememoryLimitto match actual usage.
3.3.0
31 Jul 2026Add
handle.disposed: whetherdispose()has been called on a handle.Add
handle.identity: a numeric identity for the underlying heap value, for deduplication and cycle detection across handles.Add
handle.toBoolean(): extract a value as a boolean, applying JavaScript truthiness.
Minor Changes
Add
handle.disposed: whetherdispose()has been called on a handle.Add
handle.identity: a numeric identity for the underlying heap value, for deduplication and cycle detection across handles.Add
handle.toBoolean(): extract a value as a boolean, applying JavaScript truthiness.Add
vm.construct(ctor, ...args): invoke a QuickJS constructor withnewfrom the host.Add
vm.newEphemeralFunction(fn): a host-backed function whose callback registration is unregistered when the handle is disposed, for short-lived callbacks.Add
vm.unregisterHostCallback(name): remove a host callback registered withnewFunction()orregisterHostCallback(), freeing the name for reuse.Add
vm.withScope(fn): batch handle disposal for every handle created during the call, withscope.escape(handle)to keep specific handles alive.
Patch Changes
resolvePromise()now subscribes via a capturedPromise.prototype.theninstead of reading.thenoff the value, so a proxy trap or shadowed accessor can no longer intercept it.
3.2.0
23 Jul 2026Add trap-free introspection primitives:
isProxy,isMap,isSet,isDate,isRegExp,isWeakRef,isWeakMap,isWeakSet,isDataView, andclassIdbrand checks;getProxyTarget()/getProxyHandler()for trap-free Proxy internals access;getOwnPropertyKeys()(Reflect.ownKeys semantics, string + symbol keys); andgetOwnPropertyDescriptor()which reads property descriptors without invoking getters. All primitives are engine-level checks that never execute guest code and cannot be spoofed by prototype/constructor mutation.
3.1.0
21 Jul 2026- Security
Resolve Dependabot security advisories by updating dev/demo dependencies and
adding pnpmoverridesfor transitive packages pinned to vulnerable versions.
Also move the repo-only pnpm configuration (overrides,onlyBuiltDependencies)
out ofpackage.jsonand intopnpm-workspace.yamlso it is no longer included
in the published package. The published artifact has no JS dependencies, so this
does not affect consumers at runtime. Module evaluation now resolves to the module namespace object (its exports).
Previously, evaluating code with
EvalFlags.TYPE_MODULE(viaevalCode()orevalBytecode()) returned a promise that resolved toundefined, making it
impossible to access a module's exports from the host. The evaluation promise
is now chained so it resolves to the module's namespace object instead
matching quickjs-emscripten's behavior:using promise = vm.evalCode('export default 42', '<eval>', EvalFlags.TYPE_MODULE); vm.executePendingJobs(); const result = await vm.resolvePromise(promise); if ('value' in result) { result.value.getProp('default').consume(h => h.toNumber()); // 42 }Rejections (a throw during module evaluation) propagate through the returned
promise unchanged. Fixes #22.Improve module loader error handling:
3.0.2
27 Jun 2026Optimize WASM binary sizes. The build now compiles with
-Oz, strips debug
info at link time, and runsbinaryen'swasm-opt -Ozas a post-link pass
applied to bothquickjs.wasmand all extension.sofiles. Total shipped
binary size drops from 2.61 MB to 1.10 MB (-58%);quickjs.wasmspecifically
goes from 1.52 MB to 597 KB (-62%). Override the optimization level withmake OPT=-O2to favor runtime speed over size.
3.0.1
17 Jun 2026Fix value corruption when transferring objects/arrays containing
false,true,null, orundefinedinto the VM viahostToHandle. These primitives resolve to cached singleton handles, and the object/array conversion disposed each value handle aftersetProp, freeing the singleton's shared heapJSValueand corrupting later reads (e.g.falseshowing up asNaN). Disposing a cached singleton handle is now a no-op.Update QuickJS-ng from v0.15.0 to v0.15.1. This is an upstream bug-fix release: uncaught error dumps now walk the
causechain, and growableSharedArrayBuffers are rejected when no SAB hooks are configured. No public API changes.
3.0.0
24 May 2026- Breaking
Stop performing implicit filesystem I/O. The caller is now always responsible for providing the WASM bytes (or a pre-compiled
WebAssembly.Module) for both the main runtime and any native extensions, using whichever loading mechanism is appropriate for their environment (fetch(),node:fs/promises, bundler imports, etc.).Main runtime
The
wasmoption onQuickJS.create()/QuickJS.restore()is now required — the previousnode:fs/promisesfallback has been removed. A newquickjs-wasi/quickjs.wasmsubpath export points to the published.wasmbinary so callers can resolve it through their bundler or runtime.Extensions
The Node-only convenience wrappers (
quickjs-wasi/url,quickjs-wasi/encoding,quickjs-wasi/base64,quickjs-wasi/headers,quickjs-wasi/crypto,quickjs-wasi/structured-clone) have been removed. Each extension's compiled.sois now exposed directly viaquickjs-wasi/<name>.so(e.g.quickjs-wasi/url.so,quickjs-wasi/crypto.so) so it can be loaded the same way as the main runtime.Migration
// Before import { QuickJS } from "quickjs-wasi"; import { urlExtension } from "quickjs-wasi/url"; const vm = await QuickJS.create({ extensions: [urlExtension] }); // After (Node) import { readFile } from "node:fs/promises"; import { QuickJS } from "quickjs-wasi"; const wasm = await readFile( new URL(import.meta.resolve("quickjs-wasi/quickjs.wasm")) ); const urlSo = await readFile( new URL(import.meta.resolve("quickjs-wasi/url.so")) ); const vm = await QuickJS.create({ wasm, extensions: [{ name: "url", wasm: urlSo }], }); // After (Vite / bundlers) import wasmUrl from "quickjs-wasi/quickjs.wasm?url"; import urlSoUrl from "quickjs-wasi/url.so?url"; const wasm = await WebAssembly.compileStreaming(fetch(wasmUrl)); const urlSo = await fetch(urlSoUrl).then((r) => r.arrayBuffer()); const vm = await QuickJS.create({ wasm, extensions: [{ name: "url", wasm: urlSo }], }); Update QuickJS-ng from v0.13.0 to v0.15.0 (bumps through v0.14.0). Highlights:
Breaking —
base64extension removed. Thequickjs-wasi/base64.sosubpath export has been deleted because every feature it provided is now native in the runtime. To migrate, drop the extension from yourextensionsarray —atob,btoa, and theUint8Arraybase64/hex methods are available unconditionally (assuming you have not disabledIntrinsics.ATOB_BTOAorIntrinsics.TYPED_ARRAYS).The WASM toolchain also bumps to wasi-sdk 32 (clang 22.1.0).
- 2.x
2.2.0
6 Apr 2026- Security
Add
intrinsicsoption toQuickJS.create()for controlling which built-in JavaScript features are available in the VM. Pass a bitmask ofIntrinsics.*flags to create a minimal sandbox — for example, omitIntrinsics.PROXYto disallowProxy, or omitIntrinsics.DATEto removeDate. Useful for security hardening or reducing memory usage. Note:Intrinsics.EVALmust be included forvm.evalCode()to work; without it, only pre-compiled bytecode viavm.evalBytecode()can be executed. Add
vm.compile()andvm.evalBytecode()for bytecode compilation. Compile JavaScript source to a portableUint8Arraybytecode without executing it, then execute it later — even in a different VM instance. Also addsCompileFlags.STRIP_SOURCEandCompileFlags.STRIP_DEBUGfor smaller bytecode output.Add
timezoneOffsetoption toQuickJS.create()for configuring the timezone used byDateinside the sandbox. Defaults to'host'which mirrors the host environment's timezone. Can also be set to a fixed offset in minutes or a callback for DST-aware logic.
Minor Changes
Add
vm.compile()andvm.evalBytecode()for bytecode compilation. Compile JavaScript source to a portableUint8Arraybytecode without executing it, then execute it later — even in a different VM instance. Also addsCompileFlags.STRIP_SOURCEandCompileFlags.STRIP_DEBUGfor smaller bytecode output.Add
timezoneOffsetoption toQuickJS.create()for configuring the timezone used byDateinside the sandbox. Defaults to'host'which mirrors the host environment's timezone. Can also be set to a fixed offset in minutes or a callback for DST-aware logic.Expose
CryptoandSubtleCryptoas global constructors in the crypto extension, matching the Web Crypto API spec. All three crypto constructors (Crypto,SubtleCrypto,CryptoKey) now throwTypeError: Illegal constructorwhen called withnew, and supportinstanceofchecks (e.g.crypto instanceof Crypto).Add
vm.gcThresholdgetter/setter for controlling when automatic garbage collection triggers. When allocated memory exceeds the threshold, GC runs automatically. Set to 0 to disable.Add introspection methods to
JSValueHandlefor inspecting QuickJS values without dumping them to host values. New type-checking getters:isBool,isNumber,isString,isSymbol,isBigInt,isObject,isArray,isFunction,isError,isPromise,isArrayBuffer. New convenience properties:typeof,length,constructorName. New methods:keys(),getOwnPropertyNames(),hasOwnProperty(),propertyIsEnumerable(),getPrototypeOf().- Security
Add
intrinsicsoption toQuickJS.create()for controlling which built-in JavaScript features are available in the VM. Pass a bitmask ofIntrinsics.*flags to create a minimal sandbox — for example, omitIntrinsics.PROXYto disallowProxy, or omitIntrinsics.DATEto removeDate. Useful for security hardening or reducing memory usage. Note:Intrinsics.EVALmust be included forvm.evalCode()to work; without it, only pre-compiled bytecode viavm.evalBytecode()can be executed. Add
vm.getMemoryUsage()method returning detailed memory statistics from the QuickJS runtime, including counts and sizes for atoms, strings, objects, properties, shapes, functions, arrays, and binary objects.Add
moduleLoaderoption for ES module support. Providesnormalizeandloadcallbacks that enableimportstatements to resolve and load modules. The callbacks are synchronous — for async module resolution, pre-fetch sources before creating the VM. Works withQuickJS.create()andQuickJS.restore(), and is compatible with snapshots (loaded modules survive, but the loader must be re-provided on restore for future imports).Add
onUnhandledRejectionoption for tracking unhandled promise rejections. The callback receives the promise, rejection reason, and whether a handler was just attached. Works with bothQuickJS.create()andQuickJS.restore().Add
vm.runGC()method for explicitly triggering garbage collection. QuickJS runs GC automatically, but this is useful for reclaiming memory at a known point or before taking a snapshot.Add
vm.versionsproperty returning version information for the runtime and loaded native libraries. Always includesquickjs-wasi(package version) andquickjs(engine version). Extensions can contribute additional entries by exporting aqjs_ext_<name>_versions()function — the built-in URL extension reportsadaand the crypto extension reportsmbedtls.
Patch Changes
Make
prototype.constructornon-enumerable on all extension classes (URL,URLSearchParams,Headers,TextEncoder,TextDecoder), matching the Web IDL spec. The property remains writable and configurable.Make
JSValueHandle.vma public readonly property, allowing external code to access the QuickJS VM instance from any handle.Make
Constructor.prototypenon-writable, non-enumerable, and non-configurable on all extension constructors (URL,URLSearchParams,Headers,TextEncoder,TextDecoder,CryptoKey), matching the Web IDL spec for built-in interface objects.Add
Symbol.iteratortoURLSearchParams.prototype, aliased toentries()per the WHATWG URL spec. This makesURLSearchParamsinstances iterable withfor...ofand spread syntax.
2.1.0
30 Mar 2026Add
EvalFlagsconstants export and an optionalflagsparameter toevalCode(). TheEvalFlags.ASYNCflag enables native top-levelawaitsupport in evaluated scripts — the result is a Promise that resolves to the script's completion value. This is cleaner than wrapping code in an async IIFE, as it preserves last-expression-value semantics and avoids regex-basedawaitdetection.Add Uint8Array base64/hex methods to the base64 extension per the TC39 proposal-arraybuffer-base64 (Stage 4):
Uint8Array.prototype.toBase64(),Uint8Array.prototype.toHex(),Uint8Array.fromBase64(),Uint8Array.fromHex(),Uint8Array.prototype.setFromBase64(), andUint8Array.prototype.setFromHex().Update QuickJS-ng from v0.12.1 to v0.13.0. Includes bug fixes for FinalizationRegistry, async generators, regex engine, Iterator, and TypedArray, as well as performance improvements for String.prototype.concat, Promise creation, regexp operations, and context creation.
2.0.1
19 Mar 2026Add
./package.jsonsub-export to the exports mapReplace
-with_in extension name when deriving the defaultinitFn, since hyphens are not valid in C function names
2.0.0
17 Mar 2026- Breaking
Replace opaque integer callback IDs with string names for host callbacks.
registerHostCallback()now takes the function name instead of a numeric ID, making restore order-independent and self-documenting.newFunction()enforces unique names to prevent silent conflicts. Use
new URL(import.meta.url)pattern in extension files for consistent@vercel/nftasset tracingRebuild WASM artifacts with wasi-sdk 32 (clang 22.1.0), upgraded from wasi-sdk 30 (clang 21.1.4).
- 1.x
1.3.0
16 Mar 2026Add Web Crypto API extension (
quickjs-wasi/crypto) backed by mbedTLS 4.0 PSA CryptoFix
resolveModule()to usenew URL()pattern recognized by@vercel/nft, ensuringquickjs.wasmis included in traced file lists
1.2.0
12 Mar 2026Add
defineProp()method on bothQuickJSandJSValueHandlefor defining properties with explicit descriptor flags (writable,enumerable,configurable), similar toObject.defineProperty(). Accepts string orJSValueHandlekeys, supporting symbols.Add native WASM
Headersextension implementing the WHATWG Fetch Standard Headers API. Supports constructor (record, sequence, or Headers init),append,delete,get,getSetCookie,has,set,entries,keys,values,forEach, andSymbol.iteratorwith spec-compliant case-insensitive name matching, value normalization, sorted iteration, and Set-Cookie handling.Fix native extension global property descriptors to match web browser behavior.
TextEncoder,TextDecoder,URL, andURLSearchParamsare now defined as writable and configurable but not enumerable onglobalThis, matching how browsers define them.btoa,atob, andstructuredClonewere already correct.
1.1.0
11 Mar 2026Add
quickjs-wasi/base64sub-export with WHATWG-compliant atob and btoaAdd
quickjs-wasi/encodingsub-export with WHATWG-compliant TextEncoder and TextDecoderAdd
quickjs-wasi/structured-clonesub-export with WHATWG-compliant structuredClone
Minor Changes
Add
quickjs-wasi/base64sub-export with WHATWG-compliant atob and btoaNative WASM extension implementing the HTML Standard's Base64 utility methods
btoa(data): encode binary string to base64, throws for characters > U+00FFatob(data): forgiving-base64 decode (strips whitespace, allows missing padding)Throws
InvalidCharacterErrorDOMException (built into QuickJS-ng)~85x faster than core-js-pure polyfill, +41 bytes snapshot vs +512KB
Add
quickjs-wasi/encodingsub-export with WHATWG-compliant TextEncoder and TextDecoderNative WASM extension implementing the Encoding Standard (pure C, no C++ dependencies)
TextEncoder:
encode(),encodeInto(), USVString semantics (lone surrogates → U+FFFD)TextDecoder: UTF-8, UTF-16LE, UTF-16BE decoding with streaming, BOM handling, fatal mode
Accepts ArrayBuffer, TypedArray, and DataView inputs
quickjs-wasi/encodingpackage sub-export for ergonomic opt-in231 tests passing (67 unit + 164 WPT-based compliance tests)
~20x faster than fast-text-encoding JS polyfill, +45 bytes snapshot overhead vs +64KB
Add
quickjs-wasi/structured-clonesub-export with WHATWG-compliant structuredCloneNative WASM extension implementing the Structured Clone algorithm
Deep clones: primitives, Date, RegExp, ArrayBuffer, TypedArrays, DataView, Map, Set, Array, Error, plain objects
Circular reference detection and preservation of shared references
Throws DataCloneError for non-cloneable types (functions, symbols, proxies, promises)
Add
quickjs-wasi/urlsub-export with WHATWG-compliant URL and URLSearchParams backed by ada-urlReplace hand-written URL parser with ada-url v3.4.3 for full WHATWG URL Standard compliance
Add
quickjs-wasi/urlpackage sub-export for ergonomic opt-in:import { urlExtension } from 'quickjs-wasi/url'URL class: constructor with base URL support, all property getters/setters,
toString(),toJSON(), staticURL.canParse()URLSearchParams class:
get(),getAll(),set(),has(),delete(),append(),sort(),toString(),forEach(),entries(),keys(),values(),sizeExtension loader: support C++ shared library self-resolution and graceful handling of unresolved symbols
100% pass rate on 877 Web Platform Tests (urltestdata.json)
1.0.0
9 Mar 2026- Breaking
evalCode()andcallFunction()now throw aJSExceptiondirectly when the evaluated code or called function throws, matching standard JavaScript semantics. TheunwrapResult()method andisExceptionproperty have been removed — exceptions propagate naturally via try/catch. Add
JSExceptionclass that extendsErrorand is thrown byunwrapResult(). It exposes ahandleproperty — a liveJSValueHandleto the QuickJS exception value — allowing direct inspection of custom properties on the thrown error. Also fixes a bug where errors thrown from host callbacks were returned as regular values instead of being propagated as QuickJS exceptions.Add native WASM extension support via dynamic linking. Extensions are C-based WASM shared libraries that link directly against the QuickJS C API with zero marshalling overhead. Extensions are fully compatible with snapshot/restore. Includes a proof-of-concept URL and URLSearchParams extension.
Major Changes
- Breaking
evalCode()andcallFunction()now throw aJSExceptiondirectly when the evaluated code or called function throws, matching standard JavaScript semantics. TheunwrapResult()method andisExceptionproperty have been removed — exceptions propagate naturally via try/catch.
Minor Changes
Add
JSExceptionclass that extendsErrorand is thrown byunwrapResult(). It exposes ahandleproperty — a liveJSValueHandleto the QuickJS exception value — allowing direct inspection of custom properties on the thrown error. Also fixes a bug where errors thrown from host callbacks were returned as regular values instead of being propagated as QuickJS exceptions.Add native WASM extension support via dynamic linking. Extensions are C-based WASM shared libraries that link directly against the QuickJS C API with zero marshalling overhead. Extensions are fully compatible with snapshot/restore. Includes a proof-of-concept URL and URLSearchParams extension.
Patch Changes
Increase WASM stack size to 1MB to prevent stack overflow traps. The default wasi-sdk stack (~173KB) was too small for QuickJS, causing hard WASM traps instead of catchable JS exceptions during recursive operations like JSON.stringify or devalue serialization at moderate depths.
- 0.2.x
0.2.0
7 Mar 2026- Breaking
HostFunctiontype now uses TypeScript'sthisparameter instead of a leading_thisargument. Thethisvalue from QuickJS is bound as the nativethisof the callback.Before:
vm.newFunction("add", (_this, ...args) => { return vm.newNumber(args[0].toNumber() + args[1].toNumber()); });After:
vm.newFunction("add", (...args) => { return vm.newNumber(args[0].toNumber() + args[1].toNumber()); });To access
this, use a regular function declaration:vm.newFunction("method", function (...args) { // `this` is the JSValueHandle for the QuickJS `this` value return this.getProp("name"); }); Add
QuickJS.serializeSnapshot()andQuickJS.deserializeSnapshot()for converting snapshots to/from a versioned binary format suitable for persistent storage (S3, databases, etc.). The format includes a magic header and version number for forward compatibility. Apply your own compression (gzip, zstd) on top for best results.Add Symbol support:
This enables the Workflow DevKit
globalThis[Symbol.for("WORKFLOW_USE_STEP")]pattern.
- 0.1.x
0.1.0
7 Mar 2026Add ArrayBuffer and typed array marshalling:
vm.newArrayBuffer(),vm.newUint8Array(),handle.toArrayBuffer(),handle.toUint8Array().dump()returns properArrayBuffer/Uint8Array/ typed array types.hostToHandle()convertsArrayBuffer,Uint8Array, and other typed arrays.Add
Promisesupport tohostToHandle(). Host Promises are automatically bridged to QuickJS promises viaDeferred, withexecutePendingJobs()called on resolution/rejection.Add
interruptHandleroption toQuickJSOptions. Called periodically during JS execution — returntrueto interrupt with an exception. Useful for implementing execution timeouts or step limits to prevent infinite loops. The VM remains usable after an interrupt.
Minor Changes
Add ArrayBuffer and typed array marshalling:
vm.newArrayBuffer(),vm.newUint8Array(),handle.toArrayBuffer(),handle.toUint8Array().dump()returns properArrayBuffer/Uint8Array/ typed array types.hostToHandle()convertsArrayBuffer,Uint8Array, and other typed arrays.Add
Promisesupport tohostToHandle(). Host Promises are automatically bridged to QuickJS promises viaDeferred, withexecutePendingJobs()called on resolution/rejection.Add
interruptHandleroption toQuickJSOptions. Called periodically during JS execution — returntrueto interrupt with an exception. Useful for implementing execution timeouts or step limits to prevent infinite loops. The VM remains usable after an interrupt.Add
memoryLimitoption toQuickJSOptions. Restricts how much memory the QuickJS runtime can allocate — when exceeded, allocations fail and surface as JS exceptions. The limit is re-applied afterQuickJS.restore().Add configurable WASI clock via
QuickJSOptions.wasi. Thewasi.now(clockId)option controls bothDate.now()/new Date()and theMath.random()PRNG seed at the engine level — no need to patch JS globals. QuickJS seeds its internal xorshift64* PRNG from the clock value during context creation, so two VMs created with the samenow()value produce identicalMath.random()sequences.
Patch Changes
dispose()now releases all references to the WASM module, instance, and internal state so the WASM linear memory can be garbage collected.JSValueHandle.dispose()is safe to call after the VM has been disposed (becomes a no-op).Fix handle leaks on VM dispose: free cached singleton handles and internally-owned handles (unresolved promise resolve/reject functions). Make
Deferred.settledlazy to avoid unnecessary QuickJS object allocation.Replace JSON.stringify hack in
dump()with native property enumeration viaJS_GetOwnPropertyNames. Handles circular references gracefully (returnsundefined). Functions now dump asundefinedinstead of empty objects.Preserve circular and shared references in
dump(). Instead of returningundefinedfor circular references,dump()now returns the same host object — preserving the reference structure on the host side.Simplify
dispose()to just mark the VM as unusable. The WASM instance and its linear memory are garbage collected by the host JS engine — no need to explicitly callJS_FreeRuntime. RemovesleakCheckparameter fromdispose().
- 0.0.x
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.