Skip to main content

Module node_module

Module node_module 

Source
Expand description

Node module core module — require('module') (a.k.a. require('node:module')).

This is DISTINCT from src/module.rs (the CommonJS loader that actually reads and runs files). This file is the user-facing module namespace: isBuiltin, builtinModules, createRequire, Module.wrap, etc. The heavy lifting reuses the loader’s own machinery — createRequire mints a real dir-bound require closure through the same __cjs_require/__cjs_resolve global dispatch the loader’s per-module require uses (see src/module.rs).

require('module').Module is the Module class namespace; its statics (Module.isBuiltin, Module.wrap, Module.createRequire, Module.builtinModules) delegate to the same implementations as the module-level exports (Node’s Module.<x> === module.<x> for these).

Constants§

METHODS
Free functions exported by require('module').
MODULE_STATIC_METHODS
Static method names on the Module class (same surface as the module-level exports — Node aliases them).

Functions§

call
Module free-function dispatch (module.isBuiltin, module.createRequire, …).
constant
Non-function exports of require('module'): builtinModules (array) and the Module class namespace.
static_call
Module.<method> static dispatch — same implementations as the module-level exports.
static_constant
Non-function statics on the Module class: Module.builtinModules and the self-referential Module.Module (Node’s Module.Module === Module).