Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7f234ad

Browse filesBrowse files
GeoffreyBoothaduh95
authored andcommitted
doc: deprecate module.register() (DEP0205)
PR-URL: #62395 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 12fc3c6 commit 7f234ad
Copy full SHA for 7f234ad

3 files changed

+28-2Lines changed: 28 additions & 2 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/deprecations.md‎

Copy file name to clipboardExpand all lines: doc/api/deprecations.md
+25Lines changed: 25 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -4417,6 +4417,28 @@ Type: Documentation-only
44174417
Passing a non-extractable [`CryptoKey`][] to [`KeyObject.from()`][] is
44184418
deprecated and will throw an error in a future version.
44194419
4420+
### DEP0205: `module.register()`
4421+
4422+
<!-- YAML
4423+
changes:
4424+
- version: REPLACEME
4425+
pr-url: https://github.com/nodejs/node/pull/62395
4426+
description: Documentation-only deprecation.
4427+
-->
4428+
4429+
Type: Documentation-only
4430+
4431+
[`module.register()`][] is deprecated. Use [`module.registerHooks()`][]
4432+
instead.
4433+
4434+
The `module.register()` API provides off-thread async hooks for customizing ES modules;
4435+
the `module.registerHooks()` API provides similar hooks that are synchronous, in-thread, and
4436+
work for all types of modules.
4437+
Supporting async hooks has proven to be complex, involving worker threads orchestration, and there are issues
4438+
that have proven unresolveable. See [caveats of asynchronous customization hooks][]. Please migrate to
4439+
`module.registerHooks()` as soon as possible as `module.register()` will be
4440+
removed in a future version of Node.js.
4441+
44204442
[DEP0142]: #dep0142-repl_builtinlibs
44214443
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
44224444
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
@@ -4524,6 +4546,8 @@ deprecated and will throw an error in a future version.
45244546
[`message.trailers`]: http.md#messagetrailers
45254547
[`mock`]: test.md#mocking
45264548
[`module.createRequire()`]: module.md#modulecreaterequirefilename
4549+
[`module.register()`]: module.md#moduleregisterspecifier-parenturl-options
4550+
[`module.registerHooks()`]: module.md#moduleregisterhooksoptions
45274551
[`os.networkInterfaces()`]: os.md#osnetworkinterfaces
45284552
[`os.tmpdir()`]: os.md#ostmpdir
45294553
[`process.env`]: process.md#processenv
@@ -4577,6 +4601,7 @@ deprecated and will throw an error in a future version.
45774601
[`zlib.bytesWritten`]: zlib.md#zlibbyteswritten
45784602
[alloc]: buffer.md#static-method-bufferallocsize-fill-encoding
45794603
[alloc_unsafe_size]: buffer.md#static-method-bufferallocunsafesize
4604+
[caveats of asynchronous customization hooks]: module.md#caveats-of-asynchronous-customization-hooks
45804605
[from_arraybuffer]: buffer.md#static-method-bufferfromarraybuffer-byteoffset-length
45814606
[from_string_encoding]: buffer.md#static-method-bufferfromstring-encoding
45824607
[legacy URL API]: url.md#legacy-url-api
Collapse file

‎doc/api/module.md‎

Copy file name to clipboardExpand all lines: doc/api/module.md
+2-1Lines changed: 2 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ isBuiltin('wss'); // false
178178
added:
179179
- v20.6.0
180180
- v18.19.0
181+
deprecated: REPLACEME
181182
changes:
182183
- version:
183184
- v23.6.1
@@ -193,7 +194,7 @@ changes:
193194
description: Add support for WHATWG URL instances.
194195
-->
195196
196-
> Stability: 1.1 - Active development
197+
> Stability: 0 - Deprecated: Use [`module.registerHooks()`][] instead.
197198
198199
* `specifier` {string|URL} Customization hooks to be registered; this should be
199200
the same string that would be passed to `import()`, except that if it is
Collapse file

‎test/doctool/test-doc-api-json.mjs‎

Copy file name to clipboardExpand all lines: test/doctool/test-doc-api-json.mjs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,5 @@ for await (const dirent of await fs.opendir(new URL('../../out/doc/api/', import
159159
assert.partialDeepStrictEqual(allExpectedKeys, findAllKeys(json));
160160
}
161161

162-
assert.strictEqual(numberOfDeprecatedSections, 41); // Increase this number every time a new API is deprecated.
162+
assert.strictEqual(numberOfDeprecatedSections, 42); // Increase this number every time a new API is deprecated.
163163
assert.strictEqual(numberOfRemovedAPIs, 46); // Increase this number every time a section is marked as removed.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.