Skip to main content

Module node

Module node 

Source
Expand description

Node modules this crate implements itself, because upstream llrt has none or only a stub. Written to the repo’s style, but compiled under this crate’s relaxed lints: pedantic’s needless_pass_by_value is unsatisfiable for rquickjs callback signatures, which must take owned JS values. Node modules with no usable upstream in llrt, written here so the runtime has exactly one implementation of each.

Modules§

assert
node:assert.
bytes
Byte extraction: the one place a JS value becomes Vec<u8>.
deep_equal
Structural equality, in Node’s two flavours.
inspect
util.inspect / util.format: the one value renderer this runtime has.
path
node:path — POSIX-style pure string operations.
process
A deliberately small, sandbox-safe process, and the node:process module form of it.
require_resolve
Node’s require.resolve: a specifier plus the directory it was written in, answered as an absolute path.
timers
node:timers and node:timers/promises.
util
node:util.

Functions§

throw_named
Throw an Error carrying a specific name (TypeError, RangeError, …). QuickJS’s own constructors are used so the thrown value is a real Error with a stack.