Packages

quickjs-wasi

3.7.0 · 13 Nov 2026MIT14.3M / weekRepositoryHomepagenpmAtom feed

Your version

0.1.0

7 Mar 2026Where it was published

0.2.0 is the newest release of 0.1.x.

In short

5 new5 fixed

Release note

Minor Changes

  • Add ArrayBuffer and typed array marshalling: vm.newArrayBuffer(), vm.newUint8Array(), handle.toArrayBuffer(), handle.toUint8Array(). dump() returns proper ArrayBuffer / Uint8Array / typed array types. hostToHandle() converts ArrayBuffer, Uint8Array, and other typed arrays.

  • Add Promise support to hostToHandle(). Host Promises are automatically bridged to QuickJS promises via Deferred, with executePendingJobs() called on resolution/rejection.

  • Add interruptHandler option to QuickJSOptions. Called periodically during JS execution — return true to interrupt with an exception. Useful for implementing execution timeouts or step limits to prevent infinite loops. The VM remains usable after an interrupt.

  • Add memoryLimit option to QuickJSOptions. Restricts how much memory the QuickJS runtime can allocate — when exceeded, allocations fail and surface as JS exceptions. The limit is re-applied after QuickJS.restore().

  • Add configurable WASI clock via QuickJSOptions.wasi. The wasi.now(clockId) option controls both Date.now() / new Date() and the Math.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 same now() value produce identical Math.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.settled lazy to avoid unnecessary QuickJS object allocation.

  • Replace JSON.stringify hack in dump() with native property enumeration via JS_GetOwnPropertyNames. Handles circular references gracefully (returns undefined). Functions now dump as undefined instead of empty objects.

  • Preserve circular and shared references in dump(). Instead of returning undefined for 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 call JS_FreeRuntime. Removes leakCheck parameter from dispose().

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.