quickjs-wasi
3.7.0 · 13 Nov 2026MIT14.3M / weekRepositoryHomepagenpmAtom feed
In short
1 security11 new3 fixed
- 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.
Release note
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.
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.