Skip to main content
node__module.d.ts - Node documentation

Usage in Deno

```typescript import * as mod from "node:node__module.d.ts"; ```

Classes

c
Module.SourceMap
No documentation available

Functions

f
Module.findSourceMap
`path` is the resolved path for the file for which a corresponding source map should be fetched.
f
Module.syncBuiltinESMExports
The `module.syncBuiltinESMExports()` method updates all the live bindings for builtin `ES Modules` to match the properties of the `CommonJS` exports. It does not add or remove exported names from the `ES Modules`. ```js import fs from 'node:fs'; import assert from 'node:assert'; import { syncBuiltinESMExports } from 'node:module'; fs.readFile = newAPI; delete fs.readFileSync; function newAPI() { // ... } fs.newAPI = newAPI; syncBuiltinESMExports(); import('node:fs').then((esmFS) => { // It syncs the existing readFile property with the new value assert.strictEqual(esmFS.readFile, newAPI); // readFileSync has been deleted from the required fs assert.strictEqual('readFileSync' in fs, false); // syncBuiltinESMExports() does not remove readFileSync from esmFS assert.strictEqual('readFileSync' in esmFS, true); // syncBuiltinESMExports() does not add names assert.strictEqual(esmFS.newAPI, undefined); }); ```

Interfaces

Namespaces

c
I
N
Module
> [!WARNING] Deno compatibility > The `register` method is a non-functional stub.

Type Aliases

T
Module.InitializeHook
The `initialize` hook provides a way to define a custom function that runs in the hooks thread when the hooks module is initialized. Initialization happens when the hooks module is registered via `register`. This hook can receive data from a `register` invocation, including ports and other transferrable objects. The return value of `initialize` can be a `Promise`, in which case it will be awaited before the main application thread execution resumes.
T
Module.LoadHook
The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed. It is also in charge of validating the import assertion.
T
Module.ModuleFormat
No documentation available
T
Module.ModuleSource
No documentation available
T
Module.ResolveHook
The `resolve` hook chain is responsible for resolving file URL for a given module specifier and parent URL, and optionally its format (such as `'module'`) as a hint to the `load` hook. If a format is specified, the load hook is ultimately responsible for providing the final `format` value (and it is free to ignore the hint provided by `resolve`); if `resolve` provides a format, a custom `load` hook is required even if only to pass the value to the Node.js default `load` hook.
T
Module.GlobalPreloadHook
No documentation available