Packages

quickjs-wasi

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

Your version

2.2.0

6 Apr 2026Where it was published

In short

1 security11 new3 fixed

  • Security

    Add intrinsics option to QuickJS.create() for controlling which built-in JavaScript features are available in the VM. Pass a bitmask of Intrinsics.* flags to create a minimal sandbox — for example, omit Intrinsics.PROXY to disallow Proxy, or omit Intrinsics.DATE to remove Date. Useful for security hardening or reducing memory usage. Note: Intrinsics.EVAL must be included for vm.evalCode() to work; without it, only pre-compiled bytecode via vm.evalBytecode() can be executed.

Release note

Minor Changes

  • Add vm.compile() and vm.evalBytecode() for bytecode compilation. Compile JavaScript source to a portable Uint8Array bytecode without executing it, then execute it later — even in a different VM instance. Also adds CompileFlags.STRIP_SOURCE and CompileFlags.STRIP_DEBUG for smaller bytecode output.

  • Add timezoneOffset option to QuickJS.create() for configuring the timezone used by Date inside 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 Crypto and SubtleCrypto as global constructors in the crypto extension, matching the Web Crypto API spec. All three crypto constructors (Crypto, SubtleCrypto, CryptoKey) now throw TypeError: Illegal constructor when called with new, and support instanceof checks (e.g. crypto instanceof Crypto).

  • Add vm.gcThreshold getter/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 JSValueHandle for 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 intrinsics option to QuickJS.create() for controlling which built-in JavaScript features are available in the VM. Pass a bitmask of Intrinsics.* flags to create a minimal sandbox — for example, omit Intrinsics.PROXY to disallow Proxy, or omit Intrinsics.DATE to remove Date. Useful for security hardening or reducing memory usage. Note: Intrinsics.EVAL must be included for vm.evalCode() to work; without it, only pre-compiled bytecode via vm.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 moduleLoader option for ES module support. Provides normalize and load callbacks that enable import statements to resolve and load modules. The callbacks are synchronous — for async module resolution, pre-fetch sources before creating the VM. Works with QuickJS.create() and QuickJS.restore(), and is compatible with snapshots (loaded modules survive, but the loader must be re-provided on restore for future imports).

  • Add onUnhandledRejection option for tracking unhandled promise rejections. The callback receives the promise, rejection reason, and whether a handler was just attached. Works with both QuickJS.create() and QuickJS.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.versions property returning version information for the runtime and loaded native libraries. Always includes quickjs-wasi (package version) and quickjs (engine version). Extensions can contribute additional entries by exporting a qjs_ext_<name>_versions() function — the built-in URL extension reports ada and the crypto extension reports mbedtls.

Patch Changes

  • Make prototype.constructor non-enumerable on all extension classes (URL, URLSearchParams, Headers, TextEncoder, TextDecoder), matching the Web IDL spec. The property remains writable and configurable.

  • Make JSValueHandle.vm a public readonly property, allowing external code to access the QuickJS VM instance from any handle.

  • Make Constructor.prototype non-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.iterator to URLSearchParams.prototype, aliased to entries() per the WHATWG URL spec. This makes URLSearchParams instances iterable with for...of and 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.