@@ -78,15 +78,29 @@ isBuiltin('fs'); // true
7878isBuiltin (' wss' ); // false
7979` ` `
8080
81- ### ` module .register ()`
81+ ### ` module .register (specifier[, parentURL][, options] )`
8282
8383<!-- YAML
8484added: REPLACEME
8585-->
8686
87- In addition to using the ` -- experimental- loader` option in the CLI,
88- loaders can be registered programmatically using the
89- ` module .register ()` method.
87+ > Stability: 1.1 - Active development
88+
89+ * ` specifier` {string} Customization hooks to be registered; this should be the
90+ same string that would be passed to ` import ()` , except that if it is relative,
91+ it is resolved relative to ` parentURL` .
92+ * ` parentURL` {string} If you want to resolve ` specifier` relative to a base
93+ URL, such as ` import .meta.url` , you can pass that URL here. **Default:**
94+ ` ' data:' `
95+ * ` options` {Object}
96+ * ` data` {any} Any arbitrary, cloneable JavaScript value to pass into the
97+ [` initialize` ][] hook.
98+ * ` transferList` {Object\[ ]} [transferrable objects][] to be passed into the
99+ ` initialize` hook.
100+ * Returns: {any} returns whatever was returned by the ` initialize` hook.
101+
102+ Register a module that exports hooks that customize Node.js module resolution
103+ and loading behavior.
90104
91105` ` ` mjs
92106import { register } from ' node:module' ;
@@ -384,3 +398,4 @@ returned object contains the following keys:
384398[` module ` ]: modules.md#the-module-object
385399[module wrapper]: modules.md#the-module-wrapper
386400[source map include directives]: https://sourcemaps.info/spec.html#h.lmz475t4mvbx
401+ [transferrable objects]: worker_threads.md#portpostmessagevalue-transferlist
0 commit comments