diff --git a/doc/api/module.md b/doc/api/module.md index 04b4d00c04b372..1c1ba0715c8c9e 100644 --- a/doc/api/module.md +++ b/doc/api/module.md @@ -80,15 +80,27 @@ isBuiltin('fs'); // true isBuiltin('wss'); // false ``` -### `module.register()` +### `module.register(specifier[, parentURL[, options]])` -In addition to using the `--experimental-loader` option in the CLI, -loaders can be registered programmatically using the -`module.register()` method. +* `specifier` {string} customization hooks to be registered; this should be the + same string that would be passed to `import()`, except that if it is relative, + it is resolved relative to `process.cwd()` +* `parentURL` {string} if you want to resolve `specifier` relative to a + different base than `process.cwd()`, such as `import.meta.url`, you can pass + that URL here +* `options` {Object} + * `data` {any} Any arbitrary, cloneable JavaScript value to pass into the + [`initialize`][] hook + * `transferList` {Object\[]} \[transferrable objects]\[] to be passed into the + `initialize` hook +* Returns: {any} returns whatever was returned by the `initialize` hook + +Register a module that exports hooks that customize Node.js’ module resolution +and loading behavior. ```mjs import { register } from 'node:module';