{ } qjs-modules

node

Source: lib/node.js (pure JS, qjsm only) — no exports; qjsm imports it before the script runs, -N (--no-node) turns it off. bun imports it and adds the Bun global; -B loads node alone.

Makes qjsm resolve modules and see the globals the way Node does:

PartWhatFrom
loadersnode:fs and the other node: nameslib/loaders/node.js, see qjsm
bare names in node_modules, package.json exports/imports/mainloaders/packages
.cjs, and .js by package.json "type" or syntax, as CommonJS (sets globalThis.require)loaders/commonjs
a bare Node name (util, events, buffer, ...) imported below node_modules is Node's modulelib/loaders/node.js
globals, at startupURL, URLSearchParams, AbortController, AbortSignal, EventTarget, TextEncoder, TextDecoder, Blob, the WHATWG streams, atob, btoa, queueMicrotask, structuredClone, crypto, performance, Performance*, setImmediate, Intlglobals
global (enumerable, as in Node)here
globals, on first readfetch (enumerable), Request, Response, Headers, FormData, WebSocketqjs-lws, when it is in the module path
Buffernode/buffer
Filefile
Event, CustomEvent, DOMExceptiondom
WebAssemblywebassembly
// no imports needed under qjsm
Buffer.from('hi').toString('hex');                   // '6869'
global === globalThis;                               // true
const res = await fetch('https://example.com/');     // with qjs-lws installed
  • A global that already exists is never replaced, and assigning one replaces it.
  • The globals read on first use cost nothing at startup: qjsm only checks that the module is a builtin or found by locateModule() (qjs-lws costs ~50 ms to load). Without the module the global is absent: typeof fetch is 'undefined'.
  • process is not part of it: qjsm installs that one itself (-P turns it off).

Missing compared with Node

Node globalHere
MessageChannel, MessagePort, MessageEvent, BroadcastChannelabsent
CompressionStream, DecompressionStreamabsent
navigator, localStorage, sessionStorage, Storageabsent
crypto.subtle, Crypto, CryptoKey, SubtleCryptoabsent (crypto has getRandomValues() and randomUUID())
URLPattern, DisposableStack, AsyncDisposableStack, SuppressedErrorabsent
require in an ES modulepresent, set by the CommonJS loader; Node has it only in CommonJS

Export list

Generated by utilities/doc-api.js from the loaders_nodeNames dump of utilities/api-surface.sh: 1 members. Edit the text above this block, not the block.

Values: default