API Compatibility & Standards Compliance
This document catalogs every API in qjs-modules and its relationship to established standards.
Goals
- Be the standard library QuickJS deserves - WHATWG-spec'd web APIs and Deno/Bun-like runtime APIs
- Compatibility layer - scripts from browser, Node, Deno, Bun should execute with minimal changes
- No qjs-modules-isms - avoid custom APIs that lock users into this implementation
- Standards first - prefer WHATWG > Browser > Bun > Node > Deno when implementing similar functionality
Classification
- Standard - Matches a published spec (WHATWG, W3C, ECMA-262, Node.js, Bun.js)
- Compatible - Similar to a standard but with minor differences
- Custom - qjs-modules specific API with no standard equivalent
- Internal - Private implementation detail, not part of public API surface
- Deprecated - Should be removed or replaced with standard alternative
Research Status
Complete: all C native module exports (quickjs-.c) and JS module exports (lib/.js) are classified below with spec/doc URLs.
For live spec-conformance testing, the WHATWG/W3C test suite is checked out out-of-tree at ~/Projects/wpt (https://github.com/web-platform-tests/wpt, shallow clone) - relevant for cross-checking stream, blob, url, abort, dom, and textcode against upstream.
C Native Modules
quickjs-archive.c
Module: archive
Classification: Custom (libarchive wrapper)
Exports:
Archiveclass - Read/write compressed archives (tar, zip, cpio, etc.)ArchiveEntryclass - Entry metadataArchiveMatchclass - Pattern matching for entries
Notes: Wraps libarchive for reading/writing compressed archive formats. Not a standard API, but follows established archive format specifications. Useful for file management and distribution.
quickjs-arraybuffer-sink.c
Module: arraybuffer-sink
Classification: Compatible (Bun.js)
Spec: https://bun.com/reference/bun/ArrayBufferSink
Exports:
ArrayBufferSinkclass - Writable buffer sink backed by resizable ArrayBuffer
Runtime Compatibility: Bun (Bun.ArrayBufferSink)
Notes: Matches the shape of Bun's ArrayBufferSink; used internally by other modules for buffer accumulation.
quickjs-bcrypt.c
Module: bcrypt
Classification: Custom (libbcrypt wrapper) - see lib/password.js for the Bun.password-compatible surface
Spec: https://bun.com/docs/runtime/hashing#bcrypt-modular-crypt-format
Exports:
genSalt(rounds)- Generate a bcrypt salthash(password, salt)- Hash a passwordcompare(password, hash)- Verify a password against a hashHASHSIZE,SALTSIZE- Buffer size constants
Notes: Low-level bcrypt primitives; lib/password.js wraps these into Bun.password's
hash()/hashSync()/verify()/verifySync() shape - use that module instead of this one
directly for Bun-compatible code.
Notes: Currently a thin, synchronous libbcrypt wrapper with its own genSalt/hash/compare shape. Bun's Bun.password API (async hash/verify, {algorithm: "bcrypt", cost} options, modular crypt format output) is the closest JS-runtime precedent; aligning with it (async, verify() naming, options object) would need C-level changes in quickjs-bcrypt.c, not just a JS wrapper.
quickjs-bjson.c
Module: bjson
Classification: Internal (QuickJS-specific serialization)
Exports:
read(buffer, offset, length, flags)- Deserialize a value from QuickJS's native binary object formatwrite(value, flags)- Serialize a value to that format
Notes: Exposes QuickJS's own JS_ReadObject/JS_WriteObject bytecode/value serialization (not a standard like structuredClone or v8.serialize) - engine-specific by nature, not portable to other runtimes.
quickjs-blob.c
Module: blob
Classification: Standard (WHATWG)
Spec: https://w3c.github.io/FileAPI/#blob-section
Exports:
Blobclass - Binary large object containerBlob.prototype.size- Size in bytesBlob.prototype.type- MIME typeBlob.prototype.slice(start, end, type)- Returns a new BlobBlob.prototype.text()- Returns Promise<string>Blob.prototype.arrayBuffer()- Returns Promise<ArrayBuffer>Blob.prototype.stream()- Returns ReadableStream (implemented 2026-08-12)
Browser Compatibility: Chrome 5+, Firefox 4+, Safari 5.1+, Edge 12+
Notes: Fully implements WHATWG File API spec. The stream() method was recently fixed to return a proper ReadableStream.
quickjs-child-process.c
Module: child-process
Classification: Compatible (Node.js)
Spec: https://nodejs.org/api/child_process.html
Exports:
ChildProcessclass - spawned process handle (wait(),kill(),pid,exitcode,stdio, ...)exec(command, options)/execSync- run via shellspawn(file, args, options)/spawnSync- run without shellkill(pid, signal)- signal a process
Notes: Node child_process-flavored API; see doc/native/child-process.md for full member list.
quickjs-deep.c
Module: deep
Classification: Internal
Exports:
deep.equal(a, b)- Deep equality comparisondeep.clone(value)- Deep clone objectdeep.merge(target, source)- Deep merge objectsdeep.diff(a, b)- Compute differencesdeep.patch(target, patch)- Apply diff patch
Notes: Internal implementation detail used by lib/deep.js and test infrastructure. Provides low-level deep comparison and cloning. Not intended for direct use in user code - use lib/deep.js wrapper instead.
quickjs-directory.c
Module: directory
Classification: Custom (POSIX opendir/readdir wrapper)
Exports:
Directoryclass - iterable wrapper overopendir/readdir(open,close,next,[Symbol.iterator])- Entry-shape flags (
NAME/TYPE/BOTH) andTYPE_*dirent type constants
Notes: Thin POSIX dirent binding, not a Node/WHATWG API; closest thing to a "standard" here is the POSIX readdir() semantics it mirrors.
quickjs-gpio.c
Module: gpio
Classification: Custom (Linux memory-mapped GPIO)
Exports:
GPIOclass -initPin,setPin,getPin,buffer- Constants:
INPUT,OUTPUT,LOW,HIGH
Notes: Hardware-specific (Linux GPIO register mmap), no cross-runtime standard exists; kernel GPIO docs are the closest reference.
quickjs-inspect.c
Module: inspect
Classification: Compatible (Node.js util.inspect)
Spec: https://nodejs.org/api/util.html#utilinspectobject-options
Exports:
inspect(value, options)- Format value for displayinspect(value, depth)- Format with depth limitinspect.compact- Control whitespace (positive = entry limit, negative = leaf-relative compaction)inspect.colors- Enable/disable ANSI colorsinspect.maxArrayLength- Limit array displayinspect.maxStringLength- Limit string displayinspect.depth- Recursion depth limitinspect.getters- Show getter valuesinspect.showHidden- Show non-enumerable propertiesinspect.custom- Symbol for custom inspect methods
Runtime Compatibility: Node.js util.inspect Notes: Enhanced Node.js util.inspect with negative compact values for leaf-relative object compaction (see doc/native/inspect.md). Used by console.dir() and deep.equal() for formatting.
quickjs-json.c
Module: json
Classification: Compatible (ECMA-262 JSON) + Custom (streaming extensions)
Spec: https://tc39.es/ecma262/#sec-json-object
Exports:
read(input, inputName?)/write(value, indent?)- Whole-document parse/serialize, likeJSON.parse/JSON.stringifyJsonParser- Incremental pull tokenizer (no standard equivalent; closest analogue is a hand-rolled SAX-style JSON reader)JsonPushParser- Incremental push parser (callback- or builder-mode), akin in spirit to Node'sstream-json/clarinetuserland packagesJsonWriter- Push-based incremental writer (event-driven, like a JSON equivalent of an XMLWriter)JsonSerializer- Pull-based lazy serializer (chunked.read())
Notes: read/write are drop-in for JSON.parse/JSON.stringify; the Json*Parser/JsonWriter/JsonSerializer classes are qjs-modules-specific streaming additions with no WHATWG/Node standard - closest prior art is third-party streaming JSON libraries, not a spec.
quickjs-lexer.c
Module: lexer
Classification: Custom
Exports:
Lexerclass - Rule-based, regex-driven tokenizer with named states (peek/next/lex,addRule/pushState/popState)Tokenclass - A scanned tokenLocation- see location
Notes: No standard/browser/Node equivalent; closest prior art is hand-rolled lexer generators (e.g. moo, lex.js) in the npm ecosystem, not a spec-backed API.
quickjs-list.c
Module: list
Classification: Custom (Array-like doubly-linked list)
Exports:
Listclass - Doubly-linked list with anArray-like API (push/pop/shift/unshift/splice/sort/reverse/clear,values()/keys()/entries())ListIterator,ListNodeclasses
Notes: Deliberately omits Array's O(n) convenience methods (indexOf, find, map, etc. - see doc/native/list.md) since a linked list can't provide them in O(1); no ECMA-262/WHATWG equivalent, as JS has no built-in linked-list type.
quickjs-location.c
Module: location
Classification: Internal (source-position tracking)
Exports:
Locationclass - line/column/char-offset/filename position in source text
Notes: Not the browser window.location/WHATWG URL Location object (that's dom.js's Location) - this is an internal position type used by lexer/json/parsers to report where in a source text/stream they are.
quickjs-magic.c
Module: magic
Classification: Custom (libmagic wrapper)
Exports:
Magicclass (also callable) - content-type detection vialibmagic/file(1).descriptor(fd),.file(path),.buffer(data)- identify content by fd, path, or in-memory buffer
Notes: Wraps the same libmagic used by the Unix file command; closest standard analogue is the browser's Blob.type/File.type (sniffed from extension/headers) or Node's file-type npm package, but there's no formal spec - MIME sniffing itself is standardized (https://mimesniff.spec.whatwg.org/) though this module doesn't implement that algorithm, it defers to libmagic's own signature database.
quickjs-misc.c
Module: misc
Classification: Custom (POSIX syscall grab-bag)
Exports: Large flat list of raw POSIX bindings grouped by theme - filesystem (fnmatch, glob, wordexp, chmod, access, fcntl, …), process/user (fork, exec, kill, setsid, getpid, …), plus buffer/QuickJS-internals utilities (see doc/native/misc.md for the full list).
Notes: Direct 1:1 POSIX bindings, not wrapped in a Node-style fs/process API (those higher-level wrappers live in lib/fs.js/lib/process.js); no single spec covers the whole surface, each function maps to its own POSIX man page. Fixed 2026-09: the inotify-event watch(buffer, offset, length) parser computed each event's name length via byte_chr(ev->name, '\0', ev->len) - swapped arguments (every other byte_chr call site in this codebase uses (ptr, len, char)), so it always searched a zero-length region and name was silently dropped from every event.
quickjs-mmap.c
Module: mmap
Classification: Custom (POSIX mmap wrapper)
Exports:
mmap(length, prot, flags, fd, offset)- Map memory, returned as anArrayBuffermunmap(buffer),msync(buffer, flags),mprotect(buffer, prot)- Unmap/flush/reprotect a mappingfilename(buffer),toString(buffer)- Introspect a mapping
Notes: Thin POSIX syscall binding; no browser/Node/WHATWG equivalent (Node has no public mmap binding in core, only via npm packages like mmap-io).
quickjs-mysql.c
Module: mysql
Classification: Custom (libmysqlclient wrapper)
Exports:
MySQLclass -connect,query/execute,close,escapeString, staticinsertQuery/valueStringhelpersMySQLResultclass - iterable result set (fetchRow,fetchAssoc,fetchFields)MySQLError-Errorsubclass
Notes: Async wrapper around the MySQL/MariaDB C client; no JS-runtime-standard MySQL API exists to align with this native module's own shape directly, but see lib/sql.js (doc/js/sql.md) for a Bun bun:sql-flavored JS-facing layer unifying this with pgsql/sqlite.
quickjs-path.c
Module: path
Classification: Compatible (Node.js, extended with POSIX helpers)
Spec: https://nodejs.org/api/path.html
Exports:
- Node-style:
basename,dirname,extname,join,parse,format,resolve,relative,normalize,sep,delimiter posixand the default export: the same functions (path.posix === path); nowin32;join()as Node; Node'sTypeError [ERR_INVALID_ARG_TYPE]is thrown by every Node function of the module (Function.lengthas Node too);toNamespacedPath/_makeLongand thepath/posixsubpath exist;win32is planned, see api-interface-path.md- Extra POSIX-flavored helpers:
components,at,right,skip,fnmatch,realpath,canonical,getcwd,gethome, theis*type tests
Notes: Superset of Node's path module; the extra component/query helpers have no Node equivalent (Custom within an otherwise Compatible module).
quickjs-pgsql.c
Module: pgsql
Classification: Custom (libpq wrapper)
Exports:
PGconnclass -connect,query/execute,close,escapeLiteral/escapeIdentifier/escapeBytea, staticinsertQueryhelpersPGresultclass - iterable result set (fetchRow,fetchAssoc,fetchFields)PGerror-Errorsubclass
Notes: Async wrapper around libpq; mirrors libpq's own escaping/identifier vocabulary rather than any JS-ecosystem pg client. See lib/sql.js (doc/js/sql.md) for a Bun bun:sql-flavored JS-facing layer unifying this with mysql/sqlite.
quickjs-pointer.c
Module: pointer
Classification: Compatible (RFC 6901 JSON Pointer, via toRFC6901())
Spec: https://www.rfc-editor.org/rfc/rfc6901
Exports:
Pointerclass - a deep-property path for JS Object/Array trees, backed by an array ofJSAtom(not a JSArray) so each path segment resolves via a fastJS_GetProperty(ctx, obj, atom)C-level lookup instead of a JS property-name string comparison;deref,toString,toRFC6901,push/pop/shift/unshift,up/down, staticfrom/ofDereferenceError-Errorsubclass for failedderef
Notes: The default string format (toString()/new Pointer(str)/console inspection) is this module's own dot/bracket path syntax (foo.bar[1]), not RFC 6901 - but new Pointer(str)'s parser also accepts RFC 6901 slash syntax (/foo/bar/1, with ~0/~1 escaping) as an input format, chosen automatically when a / precedes any ./[, and toRFC6901() serializes back to spec-conformant slash syntax; round-trips exactly against every example in RFC 6901 §5's table.
quickjs-predicate.c
Module: predicate
Classification: Internal
Exports:
Predicateclass - a callable, combinable boolean-test object: takes any number of arguments of any type and returns true/false (.call()/.eval())- Factory functions for leaf predicates:
type,charset,string,regexp,instanceOf,prototypeIs,equal,property,has,member,index,function,some,every - Combinators:
and,or,xor,not,notnot, plus arithmetic-style combinators (add,sub,mul,div,mod,pow,atan2,bor,band,bnot,sqrt) for numeric predicates - Optional operator sugar via
Symbol.operatorSet(+ - * / % | & **) so predicates can be combined with operators instead of combinator calls - a QuickJS-only extension, not used elsewhere in this project
Notes: Distinct from (and lower-level than) lib/predicate.js, a separate, simpler type-predicate wrapper used by lib/parser.js for >> operator dispatch. The module's purpose is generating composable boolean predicates, not "operator overloading" - the operator-overload sugar is an optional QuickJS-specific convenience on top of the (already callable/combinable) Predicate objects, not the module's reason for existing.
quickjs-queue.c
Module: queue
Classification: Custom
Exports:
Queueclass - chunked byte FIFO (write,read,peek,skip,clear, iterable over chunks)QueueIterator- iterator over buffered chunks
Notes: No standard equivalent; closest analog is Node's internal BufferList/readable-stream internals, but this is a public, directly-iterable byte queue.
quickjs-repeater.c
Module: repeater
Classification: Compatible (@repeaterjs/repeater)
Spec: https://repeater.js.org/
Exports:
Repeaterclass - async-iterable push stream (new Repeater(executor),next(),[Symbol.asyncIterator])- Static combinators:
race,merge,zip,latest
Notes: Explicitly modeled on the @repeaterjs/repeater npm package's API and combinator set, not a WHATWG/Node standard.
quickjs-serial.c
Module: serial
Classification: Compatible (Web Serial API)
Spec: https://wicg.github.io/serial/
Exports:
Serialstatic namespace -getPorts(),requestPort(filter)SerialPortclass -open(),close(),getInfo(),getSignals(),setSignals(),read(),write(),drain(),flush(), plusfd/name/transport/inputWaiting/outputWaitinggettersSerialError-Errorsubclass for serial I/O failures
Notes: Web Serial-flavored API layered over POSIX termios; not the browser's exact spec (extra low-level termios controls like signals/drain/flush), hence Compatible not Standard.
quickjs-sockets.c
Module: sockets
Classification: Custom (POSIX sockets(2) wrapper)
Exports:
Socket/AsyncSocketclasses -bind(),connect(),listen(),accept(),send()/recv(),sendto()/recvfrom(),sendmsg/recvmsg,sendmmsg/recvmmsg,shutdown(),getsockopt/setsockopt,close()SockAddrclass - address family/addr/port/path wrapper- Module functions:
socketpair(),select(),poll() SOCK_*/AF_*/SOL_*/SO_*/IPPROTO_*/MSG_*/SHUT_*/POLL*constants
Notes: Direct 1:1 BSD-socket binding, much lower-level than Node's net/dgram or WHATWG WebSocket; no standard JS equivalent at this level of granularity.
quickjs-sqlite.c
Module: sqlite
Classification: Custom (SQLite3 wrapper)
Spec: https://bun.sh/docs/api/sqlite (see also https://nodejs.org/api/sqlite.html)
Exports:
SQLiteconnection class -open(),query(),exec(),close(), value/query string helpers (escapeString,quoteString,insertQuery, etc.)SQLiteResult- prepared-statement result wrapperSQLiteError-Errorsubclass
Notes: Custom binding around libsqlite3; API shape (query/exec/close) is closer to Bun's bun:sqlite and Node's newer node:sqlite than to any WHATWG spec — cite those as the closest runtime precedent. See also lib/sql.js (doc/js/sql.md), which layers Bun's newer unified bun:sql tagged-template shape on top of this driver alongside mysql/pgsql.
quickjs-syscallerror.c
Module: syscallerror
Classification: Compatible (Node.js SystemError-style)
Spec: https://nodejs.org/api/errors.html#class-systemerror
Exports:
SyscallErrorclass (Errorsubclass) -.syscall,.errno,.messageerrnoconstants (EAGAIN,ENOENT, etc.)
Notes: Thrown by the POSIX-style bindings (sockets, misc, mmap, …); shape mirrors Node's internal SystemError (syscall/errno/code) though it isn't a public Node class users import directly.
quickjs-textcode.c
Module: textcode
Classification: Compatible (WHATWG Encoding, with extensions)
Spec: https://encoding.spec.whatwg.org/
Exports:
TextDecoderclass -.decode(input),.encoding, plus non-standard.endianand.buffered(incremental decode)TextEncoderclass -.encode(input),.encodeInto(source, dest)
Browser Compatibility: Chrome 38+, Firefox 19+, Safari 10.1+, Edge 79+
Notes: Matches the WHATWG Encoding Standard's core TextDecoder/TextEncoder surface; adds endianness control and buffered/incremental decoding beyond the spec.
quickjs-tree-walker.c
Module: tree-walker
Classification: Compatible (DOM TreeWalker shape, generalized)
Spec: https://dom.spec.whatwg.org/#treewalker
Exports:
TreeWalkerclass -firstChild(),lastChild(),nextNode(),nextSibling(),parentNode(),previousNode(),previousSibling(), plusroot/currentNode/currentPath/depth/tagMask/filter/flagsTreeIteratorclass - iterable wrapper (next(),Symbol.iterator)
Notes: Mirrors the DOM TreeWalker method names/semantics but walks arbitrary nested JS values (objects/arrays), not actual DOM nodes — Compatible rather than Standard.
quickjs-virtual.c
Module: virtual
Classification: Custom
Exports:
VirtualPropertiesclass - wraps an arbitrary backing store (array, map, plain object) behind a uniform get/set/has/delete property interface- Static
array(target),map(target),object(target),from(target)factories
Notes: Not a virtual filesystem despite the name — see doc/native/virtual.md. No standard equivalent; closest prior art is JS Proxy traps, but this is a concrete class rather than a trap-based proxy.
quickjs-wasm.c
Module: wasm
Classification: Standard (W3C WebAssembly JS API; subset)
Spec: https://webassembly.github.io/spec/js-api/
Exports:
validate,Module(+ staticimports,exports,customSections),Instance,Memory,Table,GlobalCompileError,LinkError,RuntimeErrorbackend- name of the linked engine ("wasm3"or"wamr"), the only non-standard export
Runtime Compatibility: browsers, Node.js, Bun, Deno expose the same classes as the WebAssembly global (see lib/webassembly.js)
Notes: Engine chosen at configure time (-DWASM_BACKEND=wasm3|wamr, exactly one linked); see doc/native/wasm.md for the per-engine feature table. Missing: Tag/Exception/JSTag, externref, shared memories, legacy exception handling, one function object per wasm function.
quickjs-xml.c
Module: xml
Classification: Custom (XML/HTML parser+serializer, DOMParser-adjacent)
Spec: https://developer.mozilla.org/en-US/docs/Web/API/DOMParser (closest precedent; no exact WHATWG spec for this API shape)
Exports:
read(input, inputName?, options?)/write(value, maxDepth?)module functionsXMLParser- incremental pull parser:next()/for..ofgive typed events,pump(sink)runs it into a sink (a flat list isXmlBuilder({flat: true}))XMLPushParser- push-style parser fed via.write()XMLTreeSerializer- lazy pull serializer of a{tagName, attributes, children}tree (.read(n)); named apart from the WHATWGXMLSerializer(.serializeToString(node)), whichlib/dom.jsis to provideXMLWriter- event-driven writer with manualelementStart/attribute/text/elementEndcalls
Notes: Produces/consumes plain {tagName, attributes, children} objects rather than DOM nodes; XMLSerializer name collides with the WHATWG XMLSerializer interface but the API is unrelated (pull-based, not serializeToString) — worth flagging as a naming trap for portability, not a real compatibility win.
JavaScript Modules
lib/abort.js
Module: abort
Classification: Standard (WHATWG)
Spec: https://dom.spec.whatwg.org/#interface-abortcontroller
Exports:
AbortControllerclass -signal,abort(reason)AbortSignalclass -aborted,reason,onabort,throwIfAborted()AbortSignal.timeout(ms)- static, aborts after timeoutAbortSignal.any(iterable)- static, composite signalAbortSignal.abort(reason)- static, pre-aborted signal
Browser Compatibility: Chrome 66+, Firefox 57+, Safari 12.1+, Edge 16+
Notes: Pure-JS WHATWG AbortController/AbortSignal polyfill built on lib/events.js's EventTarget; includes the newer static helpers (timeout, any, abort).
lib/assert.js
Module: assert
Classification: Compatible (Node.js)
Spec: https://nodejs.org/api/assert.html
Exports:
assert(value, message)- Truthiness assertionassert.ok(value, message)- Truthiness assertionassert.equal(actual, expected, message)- Loose equalityassert.notEqual(actual, expected, message)- Loose inequalityassert.strictEqual(actual, expected, message)- Strict equalityassert.notStrictEqual(actual, expected, message)- Strict inequalityassert.deepEqual(actual, expected, message)- Deep loose equalityassert.notDeepEqual(actual, expected, message)- Deep loose inequalityassert.deepStrictEqual(actual, expected, message)- Deep strict equalityassert.notDeepStrictEqual(actual, expected, message)- Deep strict inequalityassert.throws(fn, error, message)- Expect exceptionassert.doesNotThrow(fn, error, message)- Expect no exceptionassert.rejects(asyncFn, error, message)- Expect promise rejectionassert.doesNotReject(asyncFn, error, message)- Expect no rejectionassert.ifError(value)- Throw if truthyassert.fail(message)- Always failassert.match(string, regexp, message)- RegExp matchassert.doesNotMatch(string, regexp, message)- RegExp non-match
Runtime Compatibility: Node.js, Bun, Deno Notes: Comprehensive Node.js assert API. Used extensively in test suite.
Gaps (2026-10 audit, differential battery vs. node 22; doc/api-compatibility-nodejs.md, assert): throws plain Error (message assert.fn(): …) instead of AssertionError with code: 'ERR_ASSERTION', actual/expected/operator/generatedMessage; new AssertionError(options) takes (fn, message); no diff output in messages; deepStrictEqual wrong for Map/Set/Date/RegExp/typed-array types; throws/rejects ignore RegExp/object validators; missing assert.strict (+ assert/strict), assert.Assert, assert.CallTracker.
lib/asyncIterator.js
Module: asyncIterator
Classification: Compatible (TC39 Iterator Helpers)
Spec: https://tc39.es/proposal-iterator-helpers/
Exports:
AsyncIteratorclass -drop,takeWhile,dropWhile,every,filter,find,forEach,map,reduce,some,take,flatMap,toArray,AsyncIterator.from(iter)
Notes: Polyfills the built-in AsyncIterator helper methods from the TC39 Iterator Helpers proposal (now Baseline in modern engines); from() and reduce() reference undeclared variables in a couple of code paths — a latent bug, not fixed here (out of scope for this research task, flagging for follow-up).
lib/console.js
Module: console
Classification: Standard (WHATWG)
Spec: https://console.spec.whatwg.org/
Exports:
console.log(...args)- Log messageconsole.error(...args)- Log errorconsole.warn(...args)- Log warningconsole.info(...args)- Log infoconsole.debug(...args)- Log debugconsole.dir(obj, options)- Inspect objectconsole.time(label)- Start timerconsole.timeEnd(label)- End timerconsole.trace(...args)- Stack traceconsole.assert(condition, ...args)- Assertionconsole.table(data)- Table formatconsole.group(label)- Group logsconsole.groupEnd()- End group
Browser Compatibility: Universal
Notes: Implements core WHATWG Console API. Uses inspect module for console.dir() formatting.
Gaps (2026-10 audit; doc/api-compatibility-nodejs.md, console): the classification above overstates it: only log info error warn debug time timeLog timeEnd exist. assert, clear, count, countReset, dir, dirxml, group*, table, trace, profile*, timeStamp and the static console.Console are missing (also on the global console of qjsm); format specifiers (%s %d %i %f %j %o %O %c) are not substituted; new Console({ stdout, stderr, … }) options form is ignored; object formatting differs from Node's util.inspect (always expanded, no class names, [loop] for cycles).
lib/css3-selectors.js
Module: css3-selectors
Classification: Standard (W3C)
Spec: https://www.w3.org/TR/selectors-4/
Exports:
TypeSelector,ClassSelector,IdSelector,AttributeSelector,PseudoClassSelector- selector-node constructorsLogicPredicate(pred, ...args)- combine selectors with Predicate and/orparseSelectors(s)- generator yielding parsed selector groups
Notes: Selector-matching engine backing querySelector/querySelectorAll in lib/dom.js.
lib/database.js
Module: database
Classification: Compatible (Bun bun:sqlite)
Spec: https://bun.sh/docs/api/sqlite
Exports:
Databaseclass -constructor(filename, opts),run(sql, ...bindings),prepare(sql),query(sql),close()Statementclass -all(...params),get(...params),iterate(...params),run(...params),toString()
Notes: Thin ?-placeholder query builder over the native sqlite module (SQLite3), matching Bun's Database/Statement shape (query() caches, prepare() doesn't).
lib/db.js
Module: db
Classification: Compatible (node-postgres pg)
Spec: https://node-postgres.com/apis/pool
Exports:
Poolclass -constructor(construct, size, lazy),connect(),end(),list(),available,sizePoolClientclass -query(...args),release()
Notes: Generic connection-pool matching the shape of node-postgres's Pool/PoolClient (pool.connect() → client with .release()), but driver-agnostic via an injected construct factory rather than being pg-specific.
lib/dbi.js
Module: dbi
Classification: Custom
Exports:
Databaseclass -Database.register(name, AdapterClass),Database.connect(driver, options),query(sql),exec(sql),close(),insertId,affectedRows,quote(value),insertQuery(table, fields, values)Resultclass -numFields,fetchFields(),all(), async-iterable rows
Notes: Explicitly modeled on Perl DBI / libdbi (per file's own header comment) as a driver-agnostic layer over the native sqlite/mysql/pgsql bindings; intentionally custom, no JS-ecosystem standard for this. Result's row iteration now always goes through fetchAssoc() (fixed 2026-09) rather than each driver's own default Symbol.iterator/Symbol.asyncIterator, since the latter's returned iterator is a distinct object from the result it came from and never saw a resultType flag set on the result itself — sqlite/pgsql silently gave positional arrays instead of row objects through plain iteration, unlike mysql. See lib/sql.js.
lib/deep.js
Module: deep
Classification: Custom
Exports:
- Type/flag constants (
TYPE_*,FILTER_*,RETURN_*, etc.) clone,equals,extend,select,find,forEach,get,set,delegate,transform,unset,unflatten
Notes: Pure-JS reimplementation of the native deep module's recursive traversal/comparison API for use in runtimes without the C binding; per CLAUDE.md's overlap-resolution decision it's documented only under doc/native/deep.md (C is authoritative) to avoid duplication.
lib/describe.js
Module: describe
Classification: Custom
Exports:
describeClass(Ctor, opts)- introspects a constructor's static/prototype chains (methods, getters, setters, fields) into a plain-object descriptiondescribeObject(obj, opts)- the same for a plain object or functiondescribeFunction,describeMembers,describeAny,paramNames,lookup,load- helpers of the command-line tool (qjsm lib/describe.js [--json] [--class] <module>)
Notes: Reflection/introspection helper with no standard JS equivalent; used for tooling/debugging (e.g. generating docs or REPL help from a class definition).
lib/dom.js
Module: dom
Classification: Standard (W3C)
Spec: https://dom.spec.whatwg.org/
Exports:
Documentclass - HTML/XML documentElementclass - DOM elementNodeclass - Base DOM nodeNodeListclass - Collection of nodesHTMLCollectionclass - Live collection of elementsEventclass - DOM eventEventTargetclass - Event dispatch baseHTMLElement+ 50+ subclasses (Input, Button, Form, etc.)MutationObserverclass - DOM mutation trackingRangeclass - Document range selectionSelectionclass - User selectionDOMRectclass - Element geometryHistoryclass - Browser history APINavigatorclass - Browser environment infoLocationclass - URL/location APIStorageclass - localStorage/sessionStorageWindowclass - Global window objectFileclass - File API (in lib/file.js)DOMStringMapclass - dataset APICSSStyleDeclarationclass - Inline styles
Browser Compatibility: Universal (DOM Level 4)
Notes: Comprehensive DOM implementation covering 90%+ of browser DOM APIs. See TODO Tier 9 for remaining gaps: CSSOM, IntersectionObserver, ResizeObserver, Web Workers. (Fetch, FormData, and WebSocket are intentionally out of scope here - implemented separately in ../qjs-lws/; Canvas likewise in ../qjs-nanovg/ + ../qjs-glfw/.)
lib/events.js
Module: events
Classification: Compatible (Node.js)
Spec: https://nodejs.org/api/events.html
Exports:
EventEmitterclass (default export) - Node-conformant: handlers receive only theemit()arguments;on/once/off/addListener/prependListener/prependOnceListener/removeListener/removeAllListenersreturn the emitter;emit()returns a boolean; unhandled'error'throws;newListener/removeListenerevents;listeners,rawListeners,listenerCount,eventNames,setMaxListeners,getMaxListeners,defaultMaxListenersonce(emitter, type),on(emitter, type),getEventListeners,listenerCount,getMaxListeners,setMaxListeners- theeventsmodule functionsEventTargetclass - WHATWG-style
Runtime Compatibility: Node.js, Bun, Deno (with --unstable) Notes: Compatible with Node.js EventEmitter API. Different from browser EventTarget/Event API (which is in lib/dom.js). For browser-style events, use the DOM module instead.
lib/extendArray.js
Module: extendArray
Classification: Custom (mostly qjs-modules-specific; a few methods overlap partially with ECMA-262/TC39)
Spec: https://tc39.es/ecma262/#sec-array.prototype.at (partial overlap only)
Exports:
front/back/head/tailgetters+setters,at(i),clear(),findLastIndex/findLast(native since ES2023, reimplemented here),unique(),add(),search(),pushIf(),pushUnique(),unshiftUnique(),insert(),inserter(),delete(),remove(),removeIf(),rotateRight()/rotateLeft(),match(),group()/groupToMap()(cf. TC39Object.groupBy/Map.groupBybut on Array),equal(),partition()
Notes: at/findLast/findLastIndex duplicate now-native ES2023 methods; the rest (rotate, unique, group, partition, pushUnique, etc.) are qjs-modules-isms with no standard equivalent — candidates for reduction per project goal of minimizing custom APIs.
lib/extendArrayBuffer.js
Module: extendArrayBuffer
Classification: Custom
Exports:
search()/searchAll()(byte-pattern search),view(offset, length)(buffer-view slice via nativedupArrayBuffer),addressgetter (pointer value via nativetoPointer), staticfromString()/fromAddress()(via nativetoArrayBuffer)
Notes: No WHATWG/ECMA-262 equivalent — native-pointer-aware extension (address, fromAddress) specific to embedding ArrayBuffer in native memory; inherently non-portable/custom by design.
lib/extendAsyncFunction.js
Module: extendAsyncFunction
Classification: Custom
Exports:
catch(),then(),finally()(Promise-like combinators applied to the function itself, not its return value),indirect(),bindArguments(),bindArray(),bindThis()
Notes: No standard equivalent — treats an async function as a thenable/catchable object, a qjs-modules-ism. bindThis/bindArguments overlap conceptually with Function.prototype.bind but with different semantics (returns a metadata-carrying wrapper, not a native bound function).
lib/extendAsyncGenerator.js
Module: extendAsyncGenerator
Classification: Compatible (TC39 Iterator Helpers, adapted for async)
Spec: https://tc39.es/proposal-iterator-helpers/
Exports:
includes()(viasome),enumerate()(viamap),chain(),chainAll(),range(); sets[[Prototype]]toAsyncIterator.prototypefrom lib/asyncIterator.js
Notes: Builds on the project's own AsyncIterator — includes/map are native async-iterator-helper names; enumerate/chain/chainAll/range are additional qjs-modules-isms not in the TC39 proposal.
lib/extendFunction.js
Module: extendFunction
Classification: Custom
Exports:
catch(),then(),finally(),indirect(),bindArguments(),bindArray(),bindThis()
Notes: Same combinator pattern as extendAsyncFunction.js applied to plain Function.prototype; no standard equivalent.
lib/extendGenerator.js
Module: extendGenerator
Classification: Compatible (TC39 Iterator Helpers)
Spec: https://tc39.es/proposal-iterator-helpers/
Exports:
includes()(viaIteratorPrototype.some),enumerate(),chain(),chainAll(),range(); sets[[Prototype]]toIterator.prototypefrom lib/iterator.js
Notes: Sync counterpart of extendAsyncGenerator.js; same mix of native-helper-backed (includes) and custom (enumerate/chain/chainAll/range) methods.
lib/extendMap.js
Module: extendMap
Classification: Standard (TC39 "Map upsert" proposal, shipped ES2026)
Spec: https://tc39.es/proposal-upsert/
Exports:
getOrInsert(k, v),getOrInsertComputed(k, fn)
Notes: Names and semantics match the TC39 Map upsert proposal (Map.prototype.getOrInsert/getOrInsertComputed) exactly — a polyfill for a real, now-standard API.
lib/extendSet.js
Module: extendSet
Classification: Standard (TC39 Set methods proposal, shipped ES2025)
Spec: https://tc39.es/proposal-set-methods/
Exports:
difference(),symmetricDifference(),isDisjointFrom(),union(),intersection(),isSubsetOf(),isSupersetOf(); staticfrom(),of()
Notes: Instance methods are a correct-shaped polyfill for the now-native ES2025 Set methods proposal. Static from/of have no Set-specific standard counterpart (Array has Array.from/Array.of, Set does not) — those two are custom.
lib/file.js
Module: file
Classification: Standard (WHATWG/W3C)
Spec: https://w3c.github.io/FileAPI/#file-section
Exports:
Fileclass (extendsBlob) -name,lastModified,webkitRelativePath
Browser Compatibility: Universal
Notes: Thin File API extension over the blob module's Blob class.
lib/fs.js
Module: fs
Classification: Compatible (Node.js)
Spec: https://nodejs.org/api/fs.html
Exports:
readFile(path, options, callback)- Read file asyncreadFileSync(path, options)- Read file syncwriteFile(path, data, options, callback)- Write file asyncwriteFileSync(path, data, options)- Write file syncmkdir(path, options, callback)- Create directorymkdirSync(path, options)- Create directory syncreaddir(path, options, callback)- List directoryreaddirSync(path, options)- List directory syncstat(path, callback)- File stats asyncstatSync(path)- File stats syncunlink(path, callback)- Delete fileunlinkSync(path)- Delete file syncexists(path, callback)- Check existenceexistsSync(path)- Check existence syncchmod(path, mode, callback)- Change permissionschmodSync(path, mode)- Change permissions syncchown(path, uid, gid, callback)- Change ownershipchownSync(path, uid, gid)- Change ownership synccopyFile(src, dest, callback)- Copy filecopyFileSync(src, dest)- Copy file syncrename(oldPath, newPath, callback)- Rename filerenameSync(oldPath, newPath)- Rename file synclink(existingPath, newPath, callback)- Create hard linklinkSync(existingPath, newPath)- Create hard link syncsymlink(target, path, callback)- Create symlinksymlinkSync(target, path)- Create symlink syncreadlink(path, callback)- Read symlinkreadlinkSync(path)- Read symlink syncrealpath(path, callback)- Resolve pathrealpathSync(path)- Resolve path synctruncate(path, len, callback)- Truncate filetruncateSync(path, len)- Truncate file syncopen(path, flags, mode, callback)- Open fileopenSync(path, flags, mode)- Open file syncclose(fd, callback)- Close filecloseSync(fd)- Close file syncread(fd, buffer, offset, length, position, callback)- Read from fdreadSync(fd, buffer, offset, length, position)- Read from fd syncwrite(fd, buffer, offset, length, position, callback)- Write to fdwriteSync(fd, buffer, offset, length, position)- Write to fd syncfstat(fd, callback)- File stats by fdfstatSync(fd)- File stats by fd syncftruncate(fd, len, callback)- Truncate by fdftruncateSync(fd, len)- Truncate by fd syncwatch(filename, options, listener)- Watch filewatchFile(filename, options, listener)- Watch file (polling)unwatchFile(filename, listener)- Stop watchingcreateReadStream(path, options)- Create read streamcreateWriteStream(path, options)- Create write streampromises- Promise-based API (see fsPromises.js)
Added 2026-10: Node callback API (readFile, writeFile, stat, ... read, write, exists) derived from the *Sync functions, fs.promises, fstatSync/ftruncateSync/fsyncSync/fdatasyncSync, readSync/writeSync position; existsSync returns false for a missing path; watch() emits 'change' with (eventType, filename) as Node does; no ReadStream/WriteStream.
Runtime Compatibility: Node.js, Bun, Deno (with --unstable)
Notes: Comprehensive Node.js fs API implementation; pure JS (lib/fs.js), built on QuickJS's std/os plus the native misc module's inotify bindings, not a dedicated native fs binding. watch() (fixed 2026-09) now correctly emits Node's 'change'/'rename' events with the affected filename, supports options.signal, and throws synchronously for an invalid path - see doc/js/fs.md.
lib/fsPromises.js
Module: fsPromises
Classification: Compatible (Node.js)
Spec: https://nodejs.org/api/fs.html#fs_promises_api
Exports:
fsPromises.readFile(path, options)- Read file (Promise)fsPromises.writeFile(path, data, options)- Write file (Promise)fsPromises.appendFile(path, data, options)- Append to file (Promise)fsPromises.mkdir(path, options)- Create directory (Promise)fsPromises.readdir(path, options)- List directory (Promise)fsPromises.stat(path)- File stats (Promise)fsPromises.lstat(path)- Symlink stats (Promise)fsPromises.unlink(path)- Delete file (Promise)fsPromises.rmdir(path, options)- Remove directory (Promise)fsPromises.rm(path, options)- Remove file/dir (Promise)fsPromises.rename(oldPath, newPath)- Rename (Promise)fsPromises.copyFile(src, dest, mode)- Copy file (Promise)fsPromises.chmod(path, mode)- Change permissions (Promise)fsPromises.chown(path, uid, gid)- Change ownership (Promise)fsPromises.link(existingPath, newPath)- Create hard link (Promise)fsPromises.symlink(target, path, type)- Create symlink (Promise)fsPromises.readlink(path)- Read symlink (Promise)fsPromises.realpath(path, options)- Resolve path (Promise)fsPromises.truncate(path, len)- Truncate file (Promise)fsPromises.utimes(path, atime, mtime)- Change timestamps (Promise)fsPromises.access(path, mode)- Check access (Promise)fsPromises.open(path, flags, mode)- Open file handle (Promise)fsPromises.cp(src, dest, options)- Copy file/dir (Promise)fsPromises.glob(pattern, options)- Glob pattern match (Promise)fsPromises.watch(filename, options)- Watch file (AsyncIterator)
Added 2026-10: also reachable as fs/promises / node:fs/promises and as fs.promises.
Runtime Compatibility: Node.js 10+, Bun, Deno (with --unstable)
Notes: Almost every export besides open/read/write and watch() is an empty stub (see BUGS: fspromises-mostly-stubs). watch() (added/fixed 2026-09) is now a real async generator over fs.js's watch(), yielding {eventType, filename} and honoring options.signal - see doc/js/fsPromises.md.
lib/html.js
Module: html
Classification: Custom
Spec: https://html.spec.whatwg.org/multipage/parsing.html (nearest precedent; not compliant)
Exports:
HTMLParserclass - SAX-style pull parser built on thexmlmodule'sXMLParserHTMLParser.prototype.parse()- Advance parser, returns event objectHTMLParser.prototype.attributes/.tag- Current element accessorsstreamSrcHrefAndText(source, options)- Generator yieldingsrc/href/text events
Notes: Reuses the XML tokenizer rather than implementing the full WHATWG HTML parsing algorithm (no full tree-construction/tag-soup insertion-mode state machine), so it's not standards-compliant HTML parsing — a lightweight custom SAX layer. As of 2026-09, src/xml.c's tokenizer (the actual engine behind XMLParser, despite the name quickjs-xml.c suggesting otherwise) now handles the HTML5-relevant raw-text elements (<script>, <style>, <textarea>, <title> — content never tokenized as markup; was hardcoded to <script> only), and HTMLParser now enables XMLParser's .tolerant closing-tag-mismatch recovery by default and lowercases tag/attribute names (HTML is case-insensitive; XML isn't) — narrowing, not closing, the gap to a real HTML5 tokenizer.
lib/inotify.js
Module: inotify
Classification: Custom (Linux syscall wrapper)
Exports:
inotify_init(flags),inotify_add_watch(fd, pathname, mask),inotify_rm_watch(fd, wd),inotify_close(fd)- Direct syscall-style wrappersIN_*flag constants (re-exported from nativemiscmodule)inotifyclass - Higher-level watcher withadd()/remove()/watch()/close()andonread/onclose/onerrorhooks
Runtime Compatibility: Linux-only; nearest cross-platform analogue is Node's fs.watch
Notes: Direct binding to Linux inotify(7), not a portable/standard API by nature. fs.watch()/fsPromises.watch() (see lib/fs.js/lib/fsPromises.js) now provide the actual Node-fs.watch-shaped JS API on top of the same native inotify plumbing this module and lib/fs.js share. Fixed 2026-09: this class's read handler never advanced its byte counter (bytes += r) after os.read(), so onread never fired for any event; a stray, undefined-reference EWOULDBLOCK; expression statement in the same branch would also have thrown as soon as an event did arrive. Both are fixed.
lib/io.js
Module: io
Classification: Custom
Exports:
Multiplexerclass - Per-fd read/write callback registry (on,once,fds,close)HandlerEntry,DescriptorMapclasses - Internal storage for the multiplexersetReadHandler(fd, cb)/setWriteHandler(fd, cb)- Register on the defaultMultiplexer.instanceIOReadDecorator/IOWriteDecorator- Mixin objects addingreadAsString,getline,puts,printf, etc.
Notes: qjs-modules-specific fd event multiplexer; no standard/runtime equivalent (closest conceptually is libuv's poll handles used internally by Node, but there's no public Node API match).
lib/iterator.js
Module: iterator
Classification: Compatible (TC39 proposal)
Spec: https://github.com/tc39/proposal-iterator-helpers
Exports:
Iteratorclass -Iterator.from(iterable),.drop(),.take(),.takeWhile(),.dropWhile(),.map(),.filter(),.flatMap(),.reduce(),.every(),.some(),.find(),.forEach(),.toArray()IteratorPrototype- Shared prototype object
Notes: Polyfills the TC39 Iterator Helpers proposal (now Stage 4 / shipped in modern engines) for QuickJS, which lacks a native Iterator.prototype helper set.
lib/misc.js
Module: misc
Classification: Internal
Notes: JS-side helper wrapper around the native misc module's POSIX grab-bag (see quickjs-misc.c above); not a public standard API surface, used internally by other lib/*.js wrappers.
lib/module.js
Module: module (node:module)
Classification: Compatible (Node.js node:module, partial)
Spec: https://nodejs.org/api/module.html
Exports:
builtinModules- sorted names fromglobalThis.builtins(this engine's own builtin registry)isBuiltin(name)- accepts anode:-prefixed or bare namecreateRequire(filename)-require()from the compiled-inrequirebuiltin bound tofilename(fullnode_modules/package.jsonlookup)
Notes: Backed by this engine's own builtin-module registry rather than a hand-maintained list, matching how Bun/Deno alias node:module to their own module systems. registerHooks() (synchronous customization hooks) is implemented; Node's Module class, async register() hooks, syncBuiltinESMExports() and SourceMap are not (see TODO.md).
lib/parser.js
Module: parser
Classification: Custom
Exports:
Rulebase class and combinators:Terminal,Literal,CharClass,Sequence,Alternative,Optional,OneOrMore,ZeroOrMore,Expect,Capture- Helper constructors:
_char,_lit,_charPred,_charRange,_charSet,_capture Parserclass - Top-level driver combining rules into a grammarExpectationError- Parse failure exception
Notes: Custom parser-combinator toolkit (PEG-style), used together with predicate for building small recursive-descent grammars (e.g. css-selectors/css3-selectors); no standard equivalent.
lib/password.js
Module: password
Classification: Compatible (Bun Bun.password, bcrypt-only)
Spec: https://bun.com/docs/api/hashing, https://bun.com/guides/util/hash-a-password
Exports:
hash(password, options?)/hashSync(password, options?)-options: { algorithm: "bcrypt", cost }verify(password, hash)/verifySync(password, hash)- default export:
{ hash, hashSync, verify, verifySync }
Notes: Matches Bun.password's method names/shapes on top of the native bcrypt module.
Bun also supports Argon2 (its default algorithm) - this engine has no Argon2 binding, so
algorithm here only ever accepts "bcrypt" and throws for anything else, rather than
silently hashing with an unavailable algorithm.
lib/perf_hooks.js
Module: perf_hooks
Classification: Compatible (Node.js perf_hooks / W3C High Resolution Time)
Spec: https://nodejs.org/api/perf_hooks.html
Exports:
performanceobject (default export) -now(),timeOriginnow()- High-resolution timestamp in ms since module load
Notes: Minimal subset of Node's perf_hooks.performance (just now()/timeOrigin, no PerformanceObserver/marks/measures).
Update (2026-10 audit; doc/api-compatibility-nodejs.md, perf_hooks): the "minimal subset" note above is outdated. mark(), measure(), getEntries*, clearMarks/clearMeasures, PerformanceEntry/Mark/Measure/Observer(EntryList) work and match node 22. Missing: createHistogram/RecordableHistogram, monitorEventLoopDelay, eventLoopUtilization, timerify, performance.nodeTiming, constants, PerformanceResourceTiming, performance.toJSON() content, PerformanceObserver.supportedEntryTypes beyond mark/measure.
lib/pointer.js
Module: pointer
Classification: Compatible (RFC 6901 JSON Pointer, via toRFC6901())
Spec: https://www.rfc-editor.org/rfc/rfc6901
Exports:
Pointerclass - JSON-Pointer-like path object (JS polyfill counterpart of the native module)Pointer.fromArray/fromString/from(...)- constructors;fromString/the constructor accept both this module's dot/bracket syntax and RFC 6901 slash syntax (same auto-detection as the native module)Pointer.prototype.toString()(dot/bracket, e.g.foo.bar[1]),toRFC6901()(slash syntax),hier(),deref(obj),[Symbol.iterator]- Array-style methods borrowed from
Array.prototype(push,slice,shift,keys,values,map,reduce,forEach,concat)
Notes: Per CLAUDE.md's overlap-resolution policy, quickjs-pointer.c (documented above) is authoritative; this is a thinner JS-only alternative for other runtimes, missing most of the native module's methods. deref(obj) is still an empty stub, unrelated to this RFC 6901 work (tracked in BUGS as lib-pointer-deref-stub).
lib/predicate.js
Module: predicate
Classification: Internal
Exports:
Predicateclass - a callable, combinable boolean-test object: takes any number of arguments of any type and returns true/falsePredicate.prototype.call(value)- Test value against predicatePredicate.prototype.and(other)- Logical AND combinatorPredicate.prototype.or(other)- Logical OR combinatorPredicate.prototype.not()- Logical NOT combinatorPredicate.type(typeCode)- Create type predicatePredicate.instance(class)- Create instanceof predicatePredicate.value(val)- Create equality predicate
Notes: JS-only, simpler counterpart to quickjs-predicate.c (documented above), used by lib/parser.js for >> operator dispatch. The module's purpose is generating composable boolean predicates - not operator overloading.
Notes: Internal implementation detail used by lib/parser.js for cross-type operator dispatch. Enables terminalA >> terminalB syntax. Not intended for direct use in user code. See doc/js/predicate.md for implementation details.
lib/process.js
Module: process
Classification: Compatible (Node.js)
Spec: https://nodejs.org/api/process.html
Exports:
process.argv- Command-line argumentsprocess.argv0- Original argv[0]process.env- Environment variablesprocess.cwd()- Current working directoryprocess.chdir(dir)- Change working directoryprocess.exit(code)- Exit processprocess.exitCode- Exit codeprocess.pid- Process IDprocess.ppid- Parent process IDprocess.platform- Platform stringprocess.arch- Architecture stringprocess.version- Node.js version (compatibility shim)process.versions- Version infoprocess.release- Release metadataprocess.title- Process titleprocess.stdout- Standard output streamprocess.stderr- Standard error streamprocess.stdin- Standard input streamprocess.nextTick(callback, ...args)- Queue callbackprocess.hrtime()- High-resolution timeprocess.hrtime.bigint()- High-resolution time as BigIntprocess.memoryUsage()- Memory usage statsprocess.cpuUsage()- CPU usage statsprocess.uptime()- Process uptimeprocess.kill(pid, signal)- Send signal to processprocess.on(event, listener)- Add event listenerprocess.once(event, listener)- Add one-time listenerprocess.emit(event, ...args)- Emit eventprocess.removeListener(event, listener)- Remove listenerprocess.removeAllListeners(event)- Remove all listeners
Updated 2026-10 (doc/api-compatibility-nodejs.md, process): inherits EventEmitter.prototype; events exit, beforeExit, uncaughtException, uncaughtExceptionMonitor, unhandledRejection, rejectionHandled, warning and SIG* are emitted; argv[1] is absolute, argv0 the original argv[0]; implements the whole node:process export list (identity/groups/umask, cpuUsage/threadCpuUsage/resourceUsage, availableMemory/constrainedMemory, execve, dlopen, loadEnvFile, getBuiltinModule, finalization, capture callbacks, version(s), release, config, features, report) with named exports; env writes through to the environment; exitCode is validated; kill() accepts signal names. Stubs/limits: getActiveResourcesInfo() returns [], no IPC (send/channel), no permission, exceptions inside timer callbacks bypass uncaughtException, nextTick is a promise job.
Runtime Compatibility: Node.js, Bun, Deno (with --unstable)
Notes: Comprehensive Node.js process API. Some features may have limitations vs Node.js (e.g., process.fork(), cluster support). The process.argv issue with -e mode has been fixed (see commit 72c0364d).
lib/repl.js
Module: repl
Classification: Compatible (Node.js)
Spec: https://nodejs.org/api/repl.html
Exports:
REPLclass - prompt, line editing, history, completion, evaluation, outputREPLServerclass - Noderepl-style session wrapperloadModule(moduleName)- dynamic import helper
Notes: Derived from the original QuickJS qjscalc/repl.js (Bellard/Gordon copyright header retained); mirrors Node's repl module shape (REPLServer) rather than reimplementing it exactly.
lib/require.js
Module: require
Classification: Compatible (Node.js)
Spec: https://nodejs.org/api/modules.html
Exports:
require(m)(default export) - resolves and loads modulemsynchronously, returningexports(orexports.default)
Notes: CommonJS-style loader for use in an ESM-first runtime; mirrors Node's require() semantics closely enough for drop-in compatibility with simple CJS modules.
lib/socklen_t.js
Module: socklen_t
Classification: Custom (POSIX helper)
Exports:
socklen_tclass (default export) - 4-byteArrayBuffersubclass representing a Csocklen_t, for in/out length params togetsockopt/accept-style socket APIs
Notes: No JS standard equivalent; mirrors the POSIX socklen_t type for FFI-style interop with the sockets native bindings.
lib/sql.js
Module: sql
Classification: Compatible (Bun bun:sql)
Spec: https://bun.com/docs/runtime/sql
Exports:
SQLclass - callable tagged-template query client (sql`...`,.values(),.unsafe(text, params),.begin(fn),.close(),.driver), unifyingsqlite/pgsql/mysqlviadbi.js'sDatabaseSQLError- thrown for a bad connection string/options object
Notes: Single-connection (no pooling, unlike Bun's own bun:sql); interpolated values are escaped via the underlying driver's own quote()/valueString() and inlined into the query text, since none of the three native drivers expose real prepared-statement/placeholder binding — injection-safe, but not sent as separate wire-protocol parameters the way Bun's own Zig-native drivers do. See doc/js/sql.md.
lib/stack.js
Module: stack
Classification: Compatible (V8 stack trace convention)
Spec: https://v8.dev/docs/stack-trace-api
Exports:
Stack(st, pred)- parses a raw stack string/array intoStackFrames, filtered bypredStackFrameclass (default export) - one parsed frame (function name, file, line, column, etc.)Location- re-exported fromlocationmodule
Notes: Modeled on the de facto V8 Error.stack/CallSite conventions (also resembles the popular stackframe/error-stack-parser npm packages) rather than a formal spec.
lib/stream.js
Module: stream
Classification: Standard (WHATWG)
Spec: https://streams.spec.whatwg.org/
Exports:
ReadableStreamclass - Asynchronous data sourceWritableStreamclass - Asynchronous data sinkTransformStreamclass - Readable + Writable pairByteLengthQueuingStrategy- Queue based on byte lengthCountQueuingStrategy- Queue based on chunk count
Browser Compatibility: Chrome 52+, Firefox 65+, Safari 10.1+, Edge 16+
Notes: Implements core WHATWG Streams spec. Missing: respondWithNewView() safety checks for BYOB (Bring Your Own Buffer) readers - this is a known spec compliance gap tracked in TODO Tier 3.
lib/streams.js
Module: streams
Classification: Compatible (builds on WHATWG Streams)
Exports:
export * from 'stream'- re-exports all native/JS stream classesFileSystemReadableStream/FileSystemReadableFileStream/FileSystemWritableFileStream- file-backed streamsStreamReadIterator/LineStreamIterator- async iteration helpersByLineStream- line-splitting transformTextEncoderStream/TextDecoderStream-TransformStreamsubclasses (WHATWG Encoding spec: https://encoding.spec.whatwg.org/#interface-textencoderstream)
Notes: Higher-level convenience layer over the WHATWG stream module, closer in spirit to Node's fs-stream/readline helpers than to any single spec.
lib/terminal.js
Module: terminal
Classification: Custom (ANSI/VT escape sequences)
Exports: cursor movement, screen/line editing, Screen backbuffer class, color, mouse/device/tabs, low-level escape-sequence builders - see doc/js/terminal.md for full list
Notes: Implements de facto ANSI/VT100-family terminal control sequences; not a WHATWG/Node/Bun API, closest analogue is Node's readline/tty escape helpers or the ansi-escapes npm package.
lib/timers.js
Module: timers
Classification: Standard (HTML5)
Spec: https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html
Exports:
setTimeout(callback, delay, ...args)- Delayed executionclearTimeout(id)- Cancel timeoutsetInterval(callback, delay, ...args)- Repeated executionclearInterval(id)- Cancel intervalsetImmediate(callback, ...args)- Immediate execution (Node.js)clearImmediate(id)- Cancel immediate (Node.js)queueMicrotask(callback)- Queue microtask
Browser Compatibility: Universal
Notes: Implements HTML5 Timers API plus Node's setImmediate/clearImmediate; queueMicrotask is installed by lib/globals.js. timers/promises (lib/timersPromises.js) resolves through a flat-module alias in qjsm.
Gaps (2026-10 audit; doc/api-compatibility-nodejs.md, timers): the globals are os.setTimeout/clearTimeout, which drop extra ...args; setInterval ignores ...args and default delay; delays > 2**31-1/NaN are not clamped to 1; timers are plain numbers, so Timeout/Immediate (ref, unref, hasRef, refresh, close, [Symbol.toPrimitive], [Symbol.dispose]) do not exist; callback validation lacks ERR_INVALID_ARG_TYPE.
lib/tree_walker.js
Module: tree_walker
Classification: Standard (WHATWG DOM)
Spec: https://dom.spec.whatwg.org/#interface-treewalker
Exports:
TreeWalkerclass - DOM4 TreeWalker polyfill (parentNode/firstChild/nextSibling traversal with NodeFilter)NodeFilterconstants - FILTER_ACCEPT/REJECT/SKIP, SHOW_* bitmask constants
Notes: Cross-browser polyfill for TreeWalker, distinct from the native quickjs-tree-walker.c binding (documented above, C is primary per project convention).
lib/tty.js
Module: tty
Classification: Compatible (Node.js)
Spec: https://nodejs.org/api/tty.html
Exports:
ReadStream(fd)/WriteStream(fd)- TTY stream constructorsWriteStream.prototype.clearLine(dir)- Clear current lineWriteStream.prototype.clearScreenDown()- Clear screen from cursor downWriteStream.prototype.cursorTo(x, y)- Move cursor to positionWriteStream.prototype.moveCursor(dx, dy)- Move cursor relativeWriteStream.prototype.getWindowSize()-[columns, rows]isatty(fd)- Check if fd is a TTY
Notes: Node.js tty module shape (ANSI escape codes under the hood), built on os/std primitives; auto-updates columns/rows on SIGWINCH.
Gaps (2026-10 audit; doc/api-compatibility-nodejs.md, tty): the module does not load (import 'tty' fails: std has no fdopenSync, util has no SIGWINCH); once fixed the streams are std FILE objects without on()/isTTY/setRawMode()/getColorDepth()/hasColors()/'resize', and cursorTo/moveCursor/clearLine need review against Node's escape sequences.
lib/url.js
Module: url
Classification: Standard (WHATWG)
Spec: https://url.spec.whatwg.org/
Exports:
URLclass - URL parser and serializerURL.prototype.href- Full URL stringURL.prototype.origin- Origin (scheme + host + port)URL.prototype.protocol- URL schemeURL.prototype.host- Host + portURL.prototype.hostname- Host without portURL.prototype.port- Port numberURL.prototype.pathname- Path componentURL.prototype.search- Query stringURL.prototype.searchParams- URLSearchParams objectURL.prototype.hash- Fragment identifierURLSearchParamsclass - Query string parserURL.createObjectURL(blob)- Create object URL (not yet implemented)URL.revokeObjectURL(url)- Revoke object URL (not yet implemented)
Added 2026-10: fileURLToPath, pathToFileURL; no legacy url.parse/format/resolve.
Browser Compatibility: Chrome 32+, Firefox 19+, Safari 7+, Edge 12+
Notes: Core URL parsing is implemented. Missing: createObjectURL() and revokeObjectURL() for Blob/File references (tracked in TODO Tier 9.6).
Gaps (2026-10 audit; doc/api-compatibility-nodejs.md, url): the classification "Standard (WHATWG)" is aspirational: lib/url.js is a string-splitting parser. URLSearchParams.toString() throws ('replace' is not defined), which breaks search/href after any searchParams change and all URL setters; no dot-segment removal, relative resolution against a base, default-port stripping, IDNA, IPv4/IPv6 normalisation, percent-encode sets or non-special-scheme origins; toJSON, Symbol.iterator, Symbol.toStringTag, createObjectURL/revokeObjectURL missing; no legacy url.parse/format/resolve, domainToASCII/Unicode, urlToHttpOptions, URLPattern; fileURLToPath/pathToFileURL do not percent-decode/encode.
lib/util.js
Module: util
Classification: Compatible (Node.js util) + Custom (reflection extras)
Spec: https://nodejs.org/api/util.html
Exports: Large grab-bag re-exporting/wrapping ECMA-262 Object/Reflect statics (getPrototypeOf, defineProperty, assign, ...), Node-style helpers (setImmediate/clearImmediate, queueMicrotask, inherits), plus custom additions (memoize, chain, TypeIds, types type-check table, POSIX errno name table) - see file for full list (2500+ lines).
Added 2026-10: Node's format, formatWithOptions, promisify (+custom), callbackify, deprecate, debuglog, isDeepStrictEqual, parseArgs (no tokens), TextEncoder/TextDecoder.
Notes: Mixes thin ECMA-262 Object/Reflect pass-throughs with Node.js util-style helpers and qjs-modules-specific utilities (memoize, type tables); no single spec covers it, closest is Node's util module for the parts that overlap.
lib/vfs.js
Module: vfs
Classification: Node.js (node:vfs, 26.4+, experimental)
Exports:
create(provider?),VirtualFileSystem- fs-like API (sync, callback,.promises, fds) over a providerVirtualProvider,MemoryProvider,RealFSProvider,ComposableProvider- as innode:vfsArchiveProvider- extra: read-only tar/zip/... view over the nativearchivemodule
Notes: Mirrors node:vfs; node:vfs resolves to it via loaders/node. Provider primitives differ from Node's (whole-file read/write instead of open). Missing: mount()/unmount(), streams, watch, opendir, openAsBlob, registerProvider. Distinct from quickjs-virtual.c's VirtualProperties, which wraps a plain Object/Array/Map, not a filesystem.
lib/xml.js
Module: xml
Classification: Custom (low-level XML tokenizer)
Exports:
parse(s)- Tokenize/parse XML stringread(generator)- Build tree from token generatorwrite(obj, level)- Serialize object tree back to XML
Notes: Pure-JS XML lexer/parser polyfill; a different shape from DOM's DOMParser/XMLSerializer (no Document/Element objects). The native quickjs-xml.c binding (documented above) is authoritative per project convention.
lib/xpath.js
Module: xpath
Classification: Compatible (W3C DOM XPath)
Spec: https://www.w3.org/TR/DOM-Level-3-XPath/xpath.html
Exports:
XPathclass (aliased asImmutableXPath,MutableXPath,XPathExpression) - Path-segment array/string handlingXPathEvaluatorclass - Evaluates XPath expressionsXPathResultclass - Result wrapperXPathExceptionclass - Error typeparseXPath(str)- Parse XPath string to segmentsbuildXPath(ptr, root)/getSiblings(ptr, root)- Build/query paths from aPointer(seepointermodule)DereferenceErrorclass - Custom error for failed dereferences
Notes: Mirrors DOM XPath class names (XPathEvaluator/XPathResult/XPathException) but is built on the project's own Pointer/Predicate addressing scheme rather than operating over dom.js Node trees directly — a compatible-shape, not a spec-literal implementation.
lib/webassembly.js
Module: webassembly
Classification: Standard (W3C WebAssembly JS API)
Spec: https://webassembly.github.io/spec/js-api/
Exports: default and named WebAssembly namespace: compile, instantiate (bytes or Module), validate, compileStreaming, instantiateStreaming, Module, Instance, Memory, Table, Global, CompileError, LinkError, RuntimeError
Runtime Compatibility: the global exists natively in browsers, Node.js, Bun, Deno; here importing the module installs it (opt-in)
Notes: Property descriptors, rejection-instead-of-throw behaviour and validate() errors were probed against Node, Bun and Deno. See doc/js/webassembly.md.
lib/loaders/wasm.js
Module: loaders/wasm
Classification: Standard (WebAssembly ESM integration, instance phase)
Spec: https://github.com/WebAssembly/esm-integration
Exports: installWasmLoader() (default and named) - registers registerHooks() resolve/load hooks for .wasm
Runtime Compatibility: Node.js (22.19+/24.5+) and Deno (2.1+) import .wasm natively; qjsm only here, opt-in
Notes: No import source, no with { type: 'wasm' }. See doc/js/loaders/wasm.md.
lib/wasi.js
Module: wasi
Classification: Compatible (Node.js node:wasi, WASI preview1)
Spec: https://nodejs.org/api/wasi.html
Exports: WASI (getImportObject(), wasiImport, start(), initialize(), finalizeBindings()), errno
Runtime Compatibility: qjsm, Node.js, Bun, Deno (uses only fs, process, Atomics, crypto)
Notes: Sockets are not implemented. See doc/js/wasi.md.
lib/globals.js
Module: globals
Classification: Standard (installs WHATWG/Node globals)
Exports: structuredClone; side effect: installs URL, URLSearchParams, TextEncoder/TextDecoder, AbortController/AbortSignal, EventTarget, Blob, the streams classes, atob/btoa, queueMicrotask, structuredClone, setTimeout/setInterval/setImmediate, crypto (getRandomValues, randomUUID) where absent
Notes: Opt-in, qjsm only. No Buffer, Worker, crypto.subtle. See doc/js/globals.md.
Gaps (2026-10 audit; doc/api-compatibility-nodejs.md, globals): none of the globals exist unless the script runs import 'globals' (71 of 78 documented names are missing in a plain qjsm script). Still absent afterwards: Buffer, File, Event, CustomEvent, DOMException, MessageChannel/MessagePort/MessageEvent/BroadcastChannel, navigator, global, WebAssembly, Compression/DecompressionStream, crypto.subtle, the stream reader/writer/controller classes, PerformanceResourceTiming. Behaviour: AbortSignal.any()/timeout() and the default abort reason are not Node-compatible, abort() twice re-fires listeners, TextDecoder ignores fatal and reports UTF-8 not utf-8.
lib/timersPromises.js
Module: timersPromises (import as timers/promises)
Classification: Compatible (Node.js timers/promises)
Spec: https://nodejs.org/api/timers.html#timers-promises-api
Exports: setTimeout, setImmediate, setInterval (async iterator), scheduler.wait/yield
Gaps (2026-10 audit; doc/api-compatibility-nodejs.md, timers): options.ref is ignored; signal works only with an AbortController imported explicitly (not global in qjsm); setInterval() does not validate its arguments.
Roadmap
Once research is complete, prioritize:
- Deprecate custom APIs that have standard equivalents
- Fix incompatible APIs to match standards more closely
- Document gaps where standards exist but aren't implemented
- Keep internal APIs that are implementation details (predicate, deep, etc.)
- Stop adding non-standard APIs unless absolutely necessary
Notes
- APIs like
deepandpredicateare internal implementation details used by other modules inspectis similar to Node.jsutil.inspectbut with additional features (negative compact values)streammodule implements WHATWG Streams specblobmodule implements WHATWG Blob specdommodule implements W3C DOM spec