Skip to main content

Module modules

Module modules 

Source
Expand description

The Node / web modules this crate serves, and the one table a host registers them from.

Each entry carries its specifiers, the ModuleDef the ES loader declares, and the object require() hands back — so a host cannot wire up the import form and forget the CommonJS one, and cannot serve a module this crate does not know about.

Re-exports§

pub use crate::crypto::CryptoModule;
pub use crate::buffer::BufferModule;
pub use crate::url::UrlModule;

Structs§

AssertModule
import assert from 'node:assert', and its always-strict twin.
AssertStrictModule
import assert from 'node:assert/strict'.
EventsModule
import { EventEmitter } from 'node:events' — the vendored llrt emitter, which the EventTarget globals already share.
NodeModule
One module, under every specifier it answers to.
OsModule
import os from 'node:os' — host introspection, served by the vendored llrt_os.
PathModule
import path from 'node:path' — pure-computation POSIX-style subset (the sandbox is always a unix-style path space).
ProcessModule
import process from 'node:process' — the module form of the global.
StreamWebModule
TimersModule
import { setTimeout } from 'node:timers', and the promise twin.
TimersPromisesModule
import { setTimeout } from 'node:timers/promises'.
UtilModule
import util from 'node:util' — formatting, the promise/callback wrappers and util.types.

Functions§

modules
Every module this crate serves. A host registers all of them or none: the ES loader, the require table and the bundler’s external list all read this one place.

Type Aliases§

DeclareFn
How a host declares one of these modules to the ES loader.
NamespaceFn
How a host builds the object require('<specifier>') returns.