Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module: add support for node:‑prefixed require(…) calls #37246

Merged
merged 2 commits into from Mar 19, 2021

Conversation

ExE-Boss
Copy link
Contributor

@ExE-Boss ExE-Boss commented Feb 6, 2021

Fixes: #36098 (applies only to commit 1d8c8b7)
Refs: #37178 (applies only to commit b0fbc91)

@aduh95
Copy link
Contributor

aduh95 commented Feb 6, 2021

You read my mind, I was precisely working on this. I noticed it produces an arguably better error when trying to load internal modules:

$ node -p "require('internal/test/binding')"
Error: Cannot find module 'internal/test/binding'
$ node -p "require('node:internal/test/binding')"
Error: Should not compile internal/test/binding for public use

Can you add tests in test/parallel/test-require-node-prefix.js to make sure requiring internal modules still throws please?

doc/api/esm.md Outdated Show resolved Hide resolved
@benjamingr
Copy link
Member

cc @nodejs/modules

);
}

// `node:`-prefixed `require(...)` calls bypass the require cache:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this differs from other builtins, I love it, but want to be sure it is intentional.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this actually seems like an issue - it means someone who replaces a builtin intentionally can’t replace one of these (altho presumably mutating a builtin would be visible in both). That could cause an issue where someone wants to use a package to instrument or lock down fs (and thus, policies are not an ergonomic option, unless I’m misunderstanding how policies work), but accidentally leaves a gaping security hole when an attacker requires node:fs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

policies should intercept before any of the resolution helpers even get called

, if any module redirection is in place (including complete shutdown) then it would never call out to module.require and get here without some kind of opt-in to the behavior (like dependencies:true).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the very least this needs documentation and probably a strong indication people using policies + instrumenting fs now need to update the policy.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point was that policies aren’t currently required to ensure this for CJS - a package (not the app itself) can do it. Forcing policies to be the mechanism means packages are no longer capable of abstracting this for users.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally understood. Given that policies are the superior mechanism for app developers to lock things down, what's the benefit of adding special, inconsistent, cache-bypassing behavior for require with a node: prefix?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ljharb i have no strong opinion on if we should diverge, but cache first behavior of CJS isn't shared by ESM and isn't robust against things like core destructuring the original impls. My like is just that it isn't a confusing situation like with fs/.

Copy link
Contributor Author

@ExE-Boss ExE-Boss Feb 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but cache first behavior of CJS isn't shared by ESM and isn't robust against things like core destructuring the original impls.

This is demonstrated by:

const fs = require('fs');

const fakeModule = {};
require.cache.fs = { exports: fakeModule };

assert.strictEqual((await import('fs')).default, fs);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, but that doesn’t mean it’s a good idea to make CJS inconsistent with itself.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think CJS is able to be claimed as consistent with itself since in general the natives don't normally populate the cache. I think it was just ad-hoc written together and the cache behavior is evolutionary not intentional or well understood (even by me).

@jasnell jasnell added the module Issues and PRs related to the module subsystem. label Feb 6, 2021
lib/internal/modules/cjs/helpers.js Outdated Show resolved Hide resolved
lib/internal/modules/cjs/helpers.js Outdated Show resolved Hide resolved
@@ -837,7 +850,8 @@ Module._load = function(request, parent, isMain) {
};

Module._resolveFilename = function(request, parent, isMain, options) {
if (NativeModule.canBeRequiredByUsers(request)) {
if (StringPrototypeStartsWith(request, 'node:') ||
NativeModule.canBeRequiredByUsers(request)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bifurcation will have implications for mocking, but I can appreciate the benefit too.

I'd still prefer a more convergent path here eg, to return node:fs for both node:fs and fs inputs, and then to still populate a cache['fs'] entry in the node:fs case as the same object for backwards compatibility. Such a change would hopefully be mostly compatible but would probably need to be a separate major nontheless. Worth thinking about at least.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing mocking tools (such as Jest) provide their own require(…) implementation, since they need to be able to bypass the mocked module using jest.requireActual(…).

lib/internal/modules/esm/translators.js Outdated Show resolved Hide resolved
doc/api/esm.md Outdated Show resolved Hide resolved
lib/internal/modules/esm/translators.js Outdated Show resolved Hide resolved
Comment on lines +770 to +784
if (StringPrototypeStartsWith(filename, 'node:')) {
// Slice 'node:' prefix
const id = StringPrototypeSlice(filename, 5);

const module = loadNativeModule(id, request);
if (!module?.canBeRequiredByUsers) {
throw new ERR_UNKNOWN_BUILTIN_MODULE(filename);
}

return module.exports;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the motivation for short-circuiting the cache here, something that has never been done previously for native modules?

I don't see why this scheme should be any different to any other in this regard.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On this topic, should we throw or defer to cache on unknown builtins?

doc/api/modules.md Outdated Show resolved Hide resolved
doc/api/modules.md Outdated Show resolved Hide resolved
Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@benjamingr benjamingr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making sure #37246 (comment) is addressed before landing :) (namely the caveat) - I'm appreciative of the work put in, thanks!

Also would like more @nodejs/modules and @nodejs/tsc eyes on this.

(The actual changes LGTM)

targos pushed a commit to targos/node that referenced this pull request Aug 8, 2021
Fixes: nodejs#36098

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Guy Bedford <guybedford@gmail.com>
Co-authored-by: Darshan Sen <raisinten@gmail.com>

PR-URL: nodejs#37246
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos pushed a commit to targos/node that referenced this pull request Aug 8, 2021
Refs: nodejs#37178

PR-URL: nodejs#37246
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos pushed a commit to targos/node that referenced this pull request Aug 8, 2021
Refs: nodejs#37178

PR-URL: nodejs#37246
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos pushed a commit that referenced this pull request Sep 1, 2021
Fixes: #36098

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Guy Bedford <guybedford@gmail.com>
Co-authored-by: Darshan Sen <raisinten@gmail.com>

PR-URL: #37246
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos pushed a commit that referenced this pull request Sep 1, 2021
Refs: #37178

PR-URL: #37246
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos added a commit that referenced this pull request Sep 4, 2021
Notable changes:

assert:
  * change status of legacy asserts (James M Snell) #38113
async_hooks:
  * (SEMVER-MINOR) use new v8::Context PromiseHook API (Stephen Belanger) #36394
buffer:
  * (SEMVER-MINOR) introduce Blob (James M Snell) #36811
  * (SEMVER-MINOR) add base64url encoding option (Filip Skokan) #36952
child_process:
  * (SEMVER-MINOR) allow `options.cwd` receive a URL (Khaidi Chu) #38862
  * (SEMVER-MINOR) add timeout to spawn and fork (Nitzan Uziely) #37256
  * (SEMVER-MINOR) allow promisified exec to be cancel (Carlos Fuentes) #34249
  * (SEMVER-MINOR) add 'overlapped' stdio flag (Thiago Padilha) #29412
cli:
  * (SEMVER-MINOR) add -C alias for --conditions flag (Guy Bedford) #38755
  * (SEMVER-MINOR) add --node-memory-debug option (Anna Henningsen) #35537
deps:
  * (SEMVER-MINOR) V8: cherry-pick fa4cb172cde2 (Stephen Belanger) #38577
  * (SEMVER-MINOR) V8: cherry-pick 4c074516397b (Stephen Belanger) #36394
  * (SEMVER-MINOR) V8: cherry-pick 5f4413194480 (Stephen Belanger) #36394
  * (SEMVER-MINOR) V8: cherry-pick 272445f10927 (Stephen Belanger) #36394
  * (SEMVER-MINOR) V8: backport c0fceaa0669b (Stephen Belanger) #36394
dns:
  * (SEMVER-MINOR) add "tries" option to Resolve options (Luan Devecchi) #39610
  * (SEMVER-MINOR) allow `--dns-result-order` to change default dns verbatim (Ouyang Yadong) #38099
doc:
  * (SEMVER-MINOR) add missing change to resolver ctor (Luan Devecchi) #39610
  * refactor fs docs structure (Michaël Zasso) #37170
errors:
  * (SEMVER-MINOR) remove experimental from --enable-source-maps (Benjamin Coe) #37362
esm:
  * deprecate legacy main lookup for modules (Guy Bedford) #36918
fs:
  * (SEMVER-MINOR) allow empty string for temp directory prefix (Voltrex) #39028
  * (SEMVER-MINOR) allow no-params fsPromises fileHandle read (Nitzan Uziely) #38287
  * (SEMVER-MINOR) add support for async iterators to `fsPromises.writeFile` (HiroyukiYagihashi) #37490
  * improve fsPromises readFile performance (Nitzan Uziely) #37608
  * (SEMVER-MINOR) add fsPromises.watch() (James M Snell) #37179
  * (SEMVER-MINOR) allow `position` parameter to be a `BigInt` in read and readSync (Darshan Sen) #36190
http2:
  * (SEMVER-MINOR) add support for sensitive headers (Anna Henningsen) #34145
  * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978
inspector:
  * mark as stable (Gireesh Punathil) #37748
module:
  * (SEMVER-MINOR) add support for `URL` to `import.meta.resolve` (Antoine du Hamel) #38587
  * (SEMVER-MINOR) add support for `node:`‑prefixed `require(…)` calls (ExE Boss) #37246
net:
  * (SEMVER-MINOR) allow net.BlockList to use net.SocketAddress objects (James M Snell) #37917
  * (SEMVER-MINOR) add SocketAddress class (James M Snell) #37917
  * (SEMVER-MINOR) make net.BlockList cloneable (James M Snell) #37917
  * (SEMVER-MINOR) make blocklist family case insensitive (James M Snell) #34864
  * (SEMVER-MINOR) introduce net.BlockList (James M Snell) #34625
node-api:
  * (SEMVER-MINOR) allow retrieval of add-on file name (Gabriel Schulhof) #37195
os:
  * (SEMVER-MINOR) add os.devNull (Luigi Pinca) #38569
perf_hooks:
  * (SEMVER-MINOR) introduce createHistogram (James M Snell) #37155
process:
  * (SEMVER-MINOR) add api to enable source-maps programmatically (legendecas) #39085
  * (SEMVER-MINOR) add `'worker'` event (James M Snell) #38659
  * (SEMVER-MINOR) add direct access to rss without iterating pages (Adrien Maret) #34291
readline:
  * (SEMVER-MINOR) add AbortSignal support to interface (Nitzan Uziely) #37932
  * (SEMVER-MINOR) add support for the AbortController to the question method (Mattias Runge-Broberg) #33676
  * (SEMVER-MINOR) add history event and option to set initial history (Mattias Runge-Broberg) #33662
repl:
  * (SEMVER-MINOR) add auto‑completion for `node:`‑prefixed `require(…)` calls (ExE Boss) #37246
src:
  * (SEMVER-MINOR) call overload ctor from the original ctor (Darshan Sen) #39768
  * (SEMVER-MINOR) add a constructor overload for CallbackScope (Darshan Sen) #39768
  * (SEMVER-MINOR) fix align in cares_wrap.h (Luan) #39610
  * (SEMVER-MINOR) allow to negate boolean CLI flags (Michaël Zasso) #39023
  * (SEMVER-MINOR) add --heapsnapshot-near-heap-limit option (Joyee Cheung) #33010
  * (SEMVER-MINOR) move node_binding to modern THROW_ERR* (James M Snell) #35469
  * (SEMVER-MINOR) add way to get IsolateData and allocator from Environment (Anna Henningsen) #36441
  * (SEMVER-MINOR) allow preventing SetPrepareStackTraceCallback (Shelley Vohr) #36447
  * (SEMVER-MINOR) add maybe versions of EmitExit and EmitBeforeExit (Anna Henningsen) #35486
stream:
  * (SEMVER-MINOR) add readableDidRead if has been read from (Robert Nagy) #39589
  * (SEMVER-MINOR) pipeline accept Buffer as a valid first argument (Nitzan Uziely) #37739
test:
  * (SEMVER-MINOR) add wpt tests for Blob (Michaël Zasso) #36811
tls:
  * (SEMVER-MINOR) allow reading data into a static buffer (Andrey Pechkurov) #35753
tools:
  * (SEMVER-MINOR) add `Worker` to type-parser (James M Snell) #38659
url:
  * (SEMVER-MINOR) expose urlToHttpOptions utility (Yongsheng Zhang) #35960
util:
  * (SEMVER-MINOR) expose toUSVString (Robert Nagy) #39814
v8:
  * (SEMVER-MINOR) implement v8.stopCoverage() (Joyee Cheung) #33807
  * (SEMVER-MINOR) implement v8.takeCoverage() (Joyee Cheung) #33807
worker:
  * (SEMVER-MINOR) add setEnvironmentData/getEnvironmentData (James M Snell) #37486

PR-URL: TODO
targos added a commit that referenced this pull request Sep 4, 2021
Notable changes:

assert:
  * change status of legacy asserts (James M Snell) #38113
buffer:
  * (SEMVER-MINOR) introduce Blob (James M Snell) #36811
  * (SEMVER-MINOR) add base64url encoding option (Filip Skokan) #36952
child_process:
  * (SEMVER-MINOR) allow `options.cwd` receive a URL (Khaidi Chu) #38862
  * (SEMVER-MINOR) add timeout to spawn and fork (Nitzan Uziely) #37256
  * (SEMVER-MINOR) allow promisified exec to be cancel (Carlos Fuentes) #34249
  * (SEMVER-MINOR) add 'overlapped' stdio flag (Thiago Padilha) #29412
cli:
  * (SEMVER-MINOR) add -C alias for --conditions flag (Guy Bedford) #38755
  * (SEMVER-MINOR) add --node-memory-debug option (Anna Henningsen) #35537
dns:
  * (SEMVER-MINOR) add "tries" option to Resolve options (Luan Devecchi) #39610
  * (SEMVER-MINOR) allow `--dns-result-order` to change default dns verbatim (Ouyang Yadong) #38099
doc:
  * (SEMVER-MINOR) add missing change to resolver ctor (Luan Devecchi) #39610
  * refactor fs docs structure (James M Snell) #37170
errors:
  * (SEMVER-MINOR) remove experimental from --enable-source-maps (Benjamin Coe) #37362
esm:
  * deprecate legacy main lookup for modules (Guy Bedford) #36918
fs:
  * (SEMVER-MINOR) allow empty string for temp directory prefix (Voltrex) #39028
  * (SEMVER-MINOR) allow no-params fsPromises fileHandle read (Nitzan Uziely) #38287
  * (SEMVER-MINOR) add support for async iterators to `fsPromises.writeFile` (HiroyukiYagihashi) #37490
  * improve fsPromises readFile performance (Nitzan Uziely) #37608
  * (SEMVER-MINOR) add fsPromises.watch() (James M Snell) #37179
  * (SEMVER-MINOR) allow `position` parameter to be a `BigInt` in read and readSync (Darshan Sen) #36190
http2:
  * (SEMVER-MINOR) add support for sensitive headers (Anna Henningsen) #34145
  * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978
inspector:
  * mark as stable (Gireesh Punathil) #37748
module:
  * (SEMVER-MINOR) add support for `URL` to `import.meta.resolve` (Antoine du Hamel) #38587
  * (SEMVER-MINOR) add support for `node:`‑prefixed `require(…)` calls (ExE Boss) #37246
net:
  * (SEMVER-MINOR) introduce net.BlockList (James M Snell) #34625
node-api:
  * (SEMVER-MINOR) allow retrieval of add-on file name (Gabriel Schulhof) #37195
os:
  * (SEMVER-MINOR) add os.devNull (Luigi Pinca) #38569
perf_hooks:
  * (SEMVER-MINOR) introduce createHistogram (James M Snell) #37155
process:
  * (SEMVER-MINOR) add api to enable source-maps programmatically (legendecas) #39085
  * (SEMVER-MINOR) add `'worker'` event (James M Snell) #38659
  * (SEMVER-MINOR) add direct access to rss without iterating pages (Adrien Maret) #34291
readline:
  * (SEMVER-MINOR) add AbortSignal support to interface (Nitzan Uziely) #37932
  * (SEMVER-MINOR) add support for the AbortController to the question method (Mattias Runge-Broberg) #33676
  * (SEMVER-MINOR) add history event and option to set initial history (Mattias Runge-Broberg) #33662
repl:
  * (SEMVER-MINOR) add auto‑completion for `node:`‑prefixed `require(…)` calls (ExE Boss) #37246
src:
  * (SEMVER-MINOR) call overload ctor from the original ctor (Darshan Sen) #39768
  * (SEMVER-MINOR) add a constructor overload for CallbackScope (Darshan Sen) #39768
  * (SEMVER-MINOR) allow to negate boolean CLI flags (Michaël Zasso) #39023
  * (SEMVER-MINOR) add --heapsnapshot-near-heap-limit option (Joyee Cheung) #33010
  * (SEMVER-MINOR) add way to get IsolateData and allocator from Environment (Anna Henningsen) #36441
  * (SEMVER-MINOR) allow preventing SetPrepareStackTraceCallback (Shelley Vohr) #36447
  * (SEMVER-MINOR) add maybe versions of EmitExit and EmitBeforeExit (Anna Henningsen) #35486
stream:
  * (SEMVER-MINOR) add readableDidRead if has been read from (Robert Nagy) #39589
  * (SEMVER-MINOR) pipeline accept Buffer as a valid first argument (Nitzan Uziely) #37739
tls:
  * (SEMVER-MINOR) allow reading data into a static buffer (Andrey Pechkurov) #35753
tools:
  * (SEMVER-MINOR) add `Worker` to type-parser (James M Snell) #38659
url:
  * (SEMVER-MINOR) expose urlToHttpOptions utility (Yongsheng Zhang) #35960
util:
  * (SEMVER-MINOR) expose toUSVString (Robert Nagy) #39814
v8:
  * (SEMVER-MINOR) implement v8.stopCoverage() (Joyee Cheung) #33807
  * (SEMVER-MINOR) implement v8.takeCoverage() (Joyee Cheung) #33807
worker:
  * (SEMVER-MINOR) add setEnvironmentData/getEnvironmentData (James M Snell) #37486

PR-URL: #39990
targos added a commit that referenced this pull request Sep 7, 2021
Notable changes:

assert:
  * change status of legacy asserts (James M Snell) #38113
buffer:
  * (SEMVER-MINOR) introduce Blob (James M Snell) #36811
  * (SEMVER-MINOR) add base64url encoding option (Filip Skokan) #36952
child_process:
  * (SEMVER-MINOR) allow `options.cwd` receive a URL (Khaidi Chu) #38862
  * (SEMVER-MINOR) add timeout to spawn and fork (Nitzan Uziely) #37256
  * (SEMVER-MINOR) allow promisified exec to be cancel (Carlos Fuentes) #34249
  * (SEMVER-MINOR) add 'overlapped' stdio flag (Thiago Padilha) #29412
cli:
  * (SEMVER-MINOR) add -C alias for --conditions flag (Guy Bedford) #38755
  * (SEMVER-MINOR) add --node-memory-debug option (Anna Henningsen) #35537
dns:
  * (SEMVER-MINOR) add "tries" option to Resolve options (Luan Devecchi) #39610
  * (SEMVER-MINOR) allow `--dns-result-order` to change default dns verbatim (Ouyang Yadong) #38099
doc:
  * (SEMVER-MINOR) add missing change to resolver ctor (Luan Devecchi) #39610
  * refactor fs docs structure (James M Snell) #37170
errors:
  * (SEMVER-MINOR) remove experimental from --enable-source-maps (Benjamin Coe) #37362
esm:
  * deprecate legacy main lookup for modules (Guy Bedford) #36918
fs:
  * (SEMVER-MINOR) allow empty string for temp directory prefix (Voltrex) #39028
  * (SEMVER-MINOR) allow no-params fsPromises fileHandle read (Nitzan Uziely) #38287
  * (SEMVER-MINOR) add support for async iterators to `fsPromises.writeFile` (HiroyukiYagihashi) #37490
  * improve fsPromises readFile performance (Nitzan Uziely) #37608
  * (SEMVER-MINOR) add fsPromises.watch() (James M Snell) #37179
  * (SEMVER-MINOR) allow `position` parameter to be a `BigInt` in read and readSync (Darshan Sen) #36190
http2:
  * (SEMVER-MINOR) add support for sensitive headers (Anna Henningsen) #34145
  * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978
inspector:
  * mark as stable (Gireesh Punathil) #37748
module:
  * (SEMVER-MINOR) add support for `URL` to `import.meta.resolve` (Antoine du Hamel) #38587
  * (SEMVER-MINOR) add support for `node:`‑prefixed `require(…)` calls (ExE Boss) #37246
net:
  * (SEMVER-MINOR) introduce net.BlockList (James M Snell) #34625
node-api:
  * (SEMVER-MINOR) allow retrieval of add-on file name (Gabriel Schulhof) #37195
os:
  * (SEMVER-MINOR) add os.devNull (Luigi Pinca) #38569
perf_hooks:
  * (SEMVER-MINOR) introduce createHistogram (James M Snell) #37155
process:
  * (SEMVER-MINOR) add api to enable source-maps programmatically (legendecas) #39085
  * (SEMVER-MINOR) add `'worker'` event (James M Snell) #38659
  * (SEMVER-MINOR) add direct access to rss without iterating pages (Adrien Maret) #34291
readline:
  * (SEMVER-MINOR) add AbortSignal support to interface (Nitzan Uziely) #37932
  * (SEMVER-MINOR) add support for the AbortController to the question method (Mattias Runge-Broberg) #33676
  * (SEMVER-MINOR) add history event and option to set initial history (Mattias Runge-Broberg) #33662
repl:
  * (SEMVER-MINOR) add auto‑completion for `node:`‑prefixed `require(…)` calls (ExE Boss) #37246
src:
  * (SEMVER-MINOR) call overload ctor from the original ctor (Darshan Sen) #39768
  * (SEMVER-MINOR) add a constructor overload for CallbackScope (Darshan Sen) #39768
  * (SEMVER-MINOR) allow to negate boolean CLI flags (Michaël Zasso) #39023
  * (SEMVER-MINOR) add --heapsnapshot-near-heap-limit option (Joyee Cheung) #33010
  * (SEMVER-MINOR) add way to get IsolateData and allocator from Environment (Anna Henningsen) #36441
  * (SEMVER-MINOR) allow preventing SetPrepareStackTraceCallback (Shelley Vohr) #36447
  * (SEMVER-MINOR) add maybe versions of EmitExit and EmitBeforeExit (Anna Henningsen) #35486
stream:
  * (SEMVER-MINOR) add readableDidRead if has been read from (Robert Nagy) #39589
  * (SEMVER-MINOR) pipeline accept Buffer as a valid first argument (Nitzan Uziely) #37739
tls:
  * (SEMVER-MINOR) allow reading data into a static buffer (Andrey Pechkurov) #35753
tools:
  * (SEMVER-MINOR) add `Worker` to type-parser (James M Snell) #38659
url:
  * (SEMVER-MINOR) expose urlToHttpOptions utility (Yongsheng Zhang) #35960
util:
  * (SEMVER-MINOR) expose toUSVString (Robert Nagy) #39814
v8:
  * (SEMVER-MINOR) implement v8.stopCoverage() (Joyee Cheung) #33807
  * (SEMVER-MINOR) implement v8.takeCoverage() (Joyee Cheung) #33807
worker:
  * (SEMVER-MINOR) add setEnvironmentData/getEnvironmentData (James M Snell) #37486

PR-URL: #39990
targos added a commit that referenced this pull request Sep 28, 2021
Notable changes:

assert:
  * change status of legacy asserts (James M Snell) #38113
buffer:
  * (SEMVER-MINOR) introduce Blob (James M Snell) #36811
  * (SEMVER-MINOR) add base64url encoding option (Filip Skokan) #36952
child_process:
  * (SEMVER-MINOR) allow `options.cwd` receive a URL (Khaidi Chu) #38862
  * (SEMVER-MINOR) add timeout to spawn and fork (Nitzan Uziely) #37256
  * (SEMVER-MINOR) allow promisified exec to be cancel (Carlos Fuentes) #34249
  * (SEMVER-MINOR) add 'overlapped' stdio flag (Thiago Padilha) #29412
cli:
  * (SEMVER-MINOR) add -C alias for --conditions flag (Guy Bedford) #38755
  * (SEMVER-MINOR) add --node-memory-debug option (Anna Henningsen) #35537
dns:
  * (SEMVER-MINOR) add "tries" option to Resolve options (Luan Devecchi) #39610
  * (SEMVER-MINOR) allow `--dns-result-order` to change default dns verbatim (Ouyang Yadong) #38099
doc:
  * (SEMVER-MINOR) add missing change to resolver ctor (Luan Devecchi) #39610
  * refactor fs docs structure (James M Snell) #37170
errors:
  * (SEMVER-MINOR) remove experimental from --enable-source-maps (Benjamin Coe) #37362
esm:
  * deprecate legacy main lookup for modules (Guy Bedford) #36918
fs:
  * (SEMVER-MINOR) allow empty string for temp directory prefix (Voltrex) #39028
  * (SEMVER-MINOR) allow no-params fsPromises fileHandle read (Nitzan Uziely) #38287
  * (SEMVER-MINOR) add support for async iterators to `fsPromises.writeFile` (HiroyukiYagihashi) #37490
  * improve fsPromises readFile performance (Nitzan Uziely) #37608
  * (SEMVER-MINOR) add fsPromises.watch() (James M Snell) #37179
  * (SEMVER-MINOR) allow `position` parameter to be a `BigInt` in read and readSync (Darshan Sen) #36190
http2:
  * (SEMVER-MINOR) add support for sensitive headers (Anna Henningsen) #34145
  * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978
inspector:
  * mark as stable (Gireesh Punathil) #37748
module:
  * (SEMVER-MINOR) add support for `URL` to `import.meta.resolve` (Antoine du Hamel) #38587
  * (SEMVER-MINOR) add support for `node:`‑prefixed `require(…)` calls (ExE Boss) #37246
net:
  * (SEMVER-MINOR) introduce net.BlockList (James M Snell) #34625
node-api:
  * (SEMVER-MINOR) allow retrieval of add-on file name (Gabriel Schulhof) #37195
os:
  * (SEMVER-MINOR) add os.devNull (Luigi Pinca) #38569
perf_hooks:
  * (SEMVER-MINOR) introduce createHistogram (James M Snell) #37155
process:
  * (SEMVER-MINOR) add api to enable source-maps programmatically (legendecas) #39085
  * (SEMVER-MINOR) add `'worker'` event (James M Snell) #38659
  * (SEMVER-MINOR) add direct access to rss without iterating pages (Adrien Maret) #34291
readline:
  * (SEMVER-MINOR) add AbortSignal support to interface (Nitzan Uziely) #37932
  * (SEMVER-MINOR) add support for the AbortController to the question method (Mattias Runge-Broberg) #33676
  * (SEMVER-MINOR) add history event and option to set initial history (Mattias Runge-Broberg) #33662
repl:
  * (SEMVER-MINOR) add auto‑completion for `node:`‑prefixed `require(…)` calls (ExE Boss) #37246
src:
  * (SEMVER-MINOR) call overload ctor from the original ctor (Darshan Sen) #39768
  * (SEMVER-MINOR) add a constructor overload for CallbackScope (Darshan Sen) #39768
  * (SEMVER-MINOR) allow to negate boolean CLI flags (Michaël Zasso) #39023
  * (SEMVER-MINOR) add --heapsnapshot-near-heap-limit option (Joyee Cheung) #33010
  * (SEMVER-MINOR) add way to get IsolateData and allocator from Environment (Anna Henningsen) #36441
  * (SEMVER-MINOR) allow preventing SetPrepareStackTraceCallback (Shelley Vohr) #36447
  * (SEMVER-MINOR) add maybe versions of EmitExit and EmitBeforeExit (Anna Henningsen) #35486
stream:
  * (SEMVER-MINOR) add readableDidRead if has been read from (Robert Nagy) #39589
  * (SEMVER-MINOR) pipeline accept Buffer as a valid first argument (Nitzan Uziely) #37739
tls:
  * (SEMVER-MINOR) allow reading data into a static buffer (Andrey Pechkurov) #35753
tools:
  * (SEMVER-MINOR) add `Worker` to type-parser (James M Snell) #38659
url:
  * (SEMVER-MINOR) expose urlToHttpOptions utility (Yongsheng Zhang) #35960
util:
  * (SEMVER-MINOR) expose toUSVString (Robert Nagy) #39814
v8:
  * (SEMVER-MINOR) implement v8.stopCoverage() (Joyee Cheung) #33807
  * (SEMVER-MINOR) implement v8.takeCoverage() (Joyee Cheung) #33807
worker:
  * (SEMVER-MINOR) add setEnvironmentData/getEnvironmentData (James M Snell) #37486

PR-URL: #39990
mwalbeck pushed a commit to mwalbeck/docker-jellyfin-livestream that referenced this pull request Oct 6, 2021
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [node](https://github.com/nodejs/node) | stage | minor | `14.17.6-buster` -> `14.18.0-buster` |

---

### Release Notes

<details>
<summary>nodejs/node</summary>

### [`v14.18.0`](https://github.com/nodejs/node/releases/v14.18.0)

[Compare Source](https://github.com/nodejs/node/compare/v14.17.6...v14.18.0)

##### Notable Changes

-   \[[`3a60de0135`](https://github.com/nodejs/node/commit/3a60de0135)] - **assert**: change status of legacy asserts (James M Snell) [#&#8203;38113](https://github.com/nodejs/node/pull/38113)
-   \[[`df37c106a7`](https://github.com/nodejs/node/commit/df37c106a7)] - **(SEMVER-MINOR)** **buffer**: introduce Blob (James M Snell) [#&#8203;36811](https://github.com/nodejs/node/pull/36811)
-   \[[`223494c548`](https://github.com/nodejs/node/commit/223494c548)] - **(SEMVER-MINOR)** **buffer**: add base64url encoding option (Filip Skokan) [#&#8203;36952](https://github.com/nodejs/node/pull/36952)
-   \[[`14fc4ddabc`](https://github.com/nodejs/node/commit/14fc4ddabc)] - **(SEMVER-MINOR)** **child_process**: allow `options.cwd` receive a URL (Khaidi Chu) [#&#8203;38862](https://github.com/nodejs/node/pull/38862)
-   \[[`b68b13acb3`](https://github.com/nodejs/node/commit/b68b13acb3)] - **(SEMVER-MINOR)** **child_process**: add timeout to spawn and fork (Nitzan Uziely) [#&#8203;37256](https://github.com/nodejs/node/pull/37256)
-   \[[`da98c9f99b`](https://github.com/nodejs/node/commit/da98c9f99b)] - **(SEMVER-MINOR)** **child_process**: allow promisified exec to be cancel (Carlos Fuentes) [#&#8203;34249](https://github.com/nodejs/node/pull/34249)
-   \[[`779310ac87`](https://github.com/nodejs/node/commit/779310ac87)] - **(SEMVER-MINOR)** **child_process**: add 'overlapped' stdio flag (Thiago Padilha) [#&#8203;29412](https://github.com/nodejs/node/pull/29412)
-   \[[`40eb3b79f1`](https://github.com/nodejs/node/commit/40eb3b79f1)] - **(SEMVER-MINOR)** **cli**: add -C alias for --conditions flag (Guy Bedford) [#&#8203;38755](https://github.com/nodejs/node/pull/38755)
-   \[[`39eba0a2e1`](https://github.com/nodejs/node/commit/39eba0a2e1)] - **(SEMVER-MINOR)** **cli**: add --node-memory-debug option (Anna Henningsen) [#&#8203;35537](https://github.com/nodejs/node/pull/35537)
-   \[[`d8d9a9628a`](https://github.com/nodejs/node/commit/d8d9a9628a)] - **(SEMVER-MINOR)** **dns**: add "tries" option to Resolve options (Luan Devecchi) [#&#8203;39610](https://github.com/nodejs/node/pull/39610)
-   \[[`15ba19b020`](https://github.com/nodejs/node/commit/15ba19b020)] - **(SEMVER-MINOR)** **dns**: allow `--dns-result-order` to change default dns verbatim (Ouyang Yadong) [#&#8203;38099](https://github.com/nodejs/node/pull/38099)
-   \[[`307c1d817f`](https://github.com/nodejs/node/commit/307c1d817f)] - **doc**: refactor fs docs structure (James M Snell) [#&#8203;37170](https://github.com/nodejs/node/pull/37170)
-   \[[`9ee3f77e32`](https://github.com/nodejs/node/commit/9ee3f77e32)] - **(SEMVER-MINOR)** **errors**: remove experimental from --enable-source-maps (Benjamin Coe) [#&#8203;37362](https://github.com/nodejs/node/pull/37362)
-   \[[`e73bfed2f4`](https://github.com/nodejs/node/commit/e73bfed2f4)] - **esm**: deprecate legacy main lookup for modules (Guy Bedford) [#&#8203;36918](https://github.com/nodejs/node/pull/36918)
-   \[[`989c204a58`](https://github.com/nodejs/node/commit/989c204a58)] - **(SEMVER-MINOR)** **fs**: allow empty string for temp directory prefix (Voltrex) [#&#8203;39028](https://github.com/nodejs/node/pull/39028)
-   \[[`ef72490cde`](https://github.com/nodejs/node/commit/ef72490cde)] - **(SEMVER-MINOR)** **fs**: allow no-params fsPromises fileHandle read (Nitzan Uziely) [#&#8203;38287](https://github.com/nodejs/node/pull/38287)
-   \[[`cad9d20f64`](https://github.com/nodejs/node/commit/cad9d20f64)] - **(SEMVER-MINOR)** **fs**: add support for async iterators to `fsPromises.writeFile` (HiroyukiYagihashi) [#&#8203;37490](https://github.com/nodejs/node/pull/37490)
-   \[[`2b0e2706c0`](https://github.com/nodejs/node/commit/2b0e2706c0)] - **fs**: improve fsPromises readFile performance (Nitzan Uziely) [#&#8203;37608](https://github.com/nodejs/node/pull/37608)
-   \[[`fe12cc07b3`](https://github.com/nodejs/node/commit/fe12cc07b3)] - **(SEMVER-MINOR)** **fs**: add fsPromises.watch() (James M Snell) [#&#8203;37179](https://github.com/nodejs/node/pull/37179)
-   \[[`2459c115a8`](https://github.com/nodejs/node/commit/2459c115a8)] - **(SEMVER-MINOR)** **fs**: allow `position` parameter to be a `BigInt` in read and readSync (Darshan Sen) [#&#8203;36190](https://github.com/nodejs/node/pull/36190)
-   \[[`6544cfb4b9`](https://github.com/nodejs/node/commit/6544cfb4b9)] - **(SEMVER-MINOR)** **http2**: add support for sensitive headers (Anna Henningsen) [#&#8203;34145](https://github.com/nodejs/node/pull/34145)
-   \[[`a6c6cbb4e6`](https://github.com/nodejs/node/commit/a6c6cbb4e6)] - **(SEMVER-MINOR)** **http2**: allow setting the local window size of a session (Yongsheng Zhang) [#&#8203;35978](https://github.com/nodejs/node/pull/35978)
-   \[[`1e5aca550c`](https://github.com/nodejs/node/commit/1e5aca550c)] - **inspector**: mark as stable (Gireesh Punathil) [#&#8203;37748](https://github.com/nodejs/node/pull/37748)
-   \[[`93af04afbb`](https://github.com/nodejs/node/commit/93af04afbb)] - **(SEMVER-MINOR)** **module**: add support for `URL` to `import.meta.resolve` (Antoine du Hamel) [#&#8203;38587](https://github.com/nodejs/node/pull/38587)
-   \[[`f9f9389d83`](https://github.com/nodejs/node/commit/f9f9389d83)] - **(SEMVER-MINOR)** **module**: add support for `node:`‑prefixed `require(…)` calls (ExE Boss) [#&#8203;37246](https://github.com/nodejs/node/pull/37246)
-   \[[`87c71065eb`](https://github.com/nodejs/node/commit/87c71065eb)] - **(SEMVER-MINOR)** **net**: introduce net.BlockList (James M Snell) [#&#8203;34625](https://github.com/nodejs/node/pull/34625)
-   \[[`b421d99a48`](https://github.com/nodejs/node/commit/b421d99a48)] - **(SEMVER-MINOR)** **node-api**: allow retrieval of add-on file name (Gabriel Schulhof) [#&#8203;37195](https://github.com/nodejs/node/pull/37195)
-   \[[`6a4811df8a`](https://github.com/nodejs/node/commit/6a4811df8a)] - **(SEMVER-MINOR)** **os**: add os.devNull (Luigi Pinca) [#&#8203;38569](https://github.com/nodejs/node/pull/38569)
-   \[[`4a88ddeeca`](https://github.com/nodejs/node/commit/4a88ddeeca)] - **(SEMVER-MINOR)** **perf_hooks**: introduce createHistogram (James M Snell) [#&#8203;37155](https://github.com/nodejs/node/pull/37155)
-   \[[`1a6bf1c4a3`](https://github.com/nodejs/node/commit/1a6bf1c4a3)] - **(SEMVER-MINOR)** **process**: add api to enable source-maps programmatically (legendecas) [#&#8203;39085](https://github.com/nodejs/node/pull/39085)
-   \[[`99735a6fe8`](https://github.com/nodejs/node/commit/99735a6fe8)] - **(SEMVER-MINOR)** **process**: add `'worker'` event (James M Snell) [#&#8203;38659](https://github.com/nodejs/node/pull/38659)
-   \[[`3982919317`](https://github.com/nodejs/node/commit/3982919317)] - **(SEMVER-MINOR)** **process**: add direct access to rss without iterating pages (Adrien Maret) [#&#8203;34291](https://github.com/nodejs/node/pull/34291)
-   \[[`526e6c7bde`](https://github.com/nodejs/node/commit/526e6c7bde)] - **(SEMVER-MINOR)** **readline**: add AbortSignal support to interface (Nitzan Uziely) [#&#8203;37932](https://github.com/nodejs/node/pull/37932)
-   \[[`e6eee08692`](https://github.com/nodejs/node/commit/e6eee08692)] - **(SEMVER-MINOR)** **readline**: add support for the AbortController to the question method (Mattias Runge-Broberg) [#&#8203;33676](https://github.com/nodejs/node/pull/33676)
-   \[[`32de361d70`](https://github.com/nodejs/node/commit/32de361d70)] - **(SEMVER-MINOR)** **readline**: add history event and option to set initial history (Mattias Runge-Broberg) [#&#8203;33662](https://github.com/nodejs/node/pull/33662)
-   \[[`797f7f8a38`](https://github.com/nodejs/node/commit/797f7f8a38)] - **(SEMVER-MINOR)** **repl**: add auto‑completion for `node:`‑prefixed `require(…)` calls (ExE Boss) [#&#8203;37246](https://github.com/nodejs/node/pull/37246)
-   \[[`abfd71b64c`](https://github.com/nodejs/node/commit/abfd71b64c)] - **(SEMVER-MINOR)** **src**: call overload ctor from the original ctor (Darshan Sen) [#&#8203;39768](https://github.com/nodejs/node/pull/39768)
-   \[[`1efae01b18`](https://github.com/nodejs/node/commit/1efae01b18)] - **(SEMVER-MINOR)** **src**: add a constructor overload for CallbackScope (Darshan Sen) [#&#8203;39768](https://github.com/nodejs/node/pull/39768)
-   \[[`f7933804ba`](https://github.com/nodejs/node/commit/f7933804ba)] - **(SEMVER-MINOR)** **src**: allow to negate boolean CLI flags (Michaël Zasso) [#&#8203;39023](https://github.com/nodejs/node/pull/39023)
-   \[[`6d06ac2202`](https://github.com/nodejs/node/commit/6d06ac2202)] - **(SEMVER-MINOR)** **src**: add --heapsnapshot-near-heap-limit option (Joyee Cheung) [#&#8203;33010](https://github.com/nodejs/node/pull/33010)
-   \[[`577d228ca0`](https://github.com/nodejs/node/commit/577d228ca0)] - **(SEMVER-MINOR)** **src**: add way to get IsolateData and allocator from Environment (Anna Henningsen) [#&#8203;36441](https://github.com/nodejs/node/pull/36441)
-   \[[`658a266cd4`](https://github.com/nodejs/node/commit/658a266cd4)] - **(SEMVER-MINOR)** **src**: allow preventing SetPrepareStackTraceCallback (Shelley Vohr) [#&#8203;36447](https://github.com/nodejs/node/pull/36447)
-   \[[`f421422ea4`](https://github.com/nodejs/node/commit/f421422ea4)] - **(SEMVER-MINOR)** **src**: add maybe versions of EmitExit and EmitBeforeExit (Anna Henningsen) [#&#8203;35486](https://github.com/nodejs/node/pull/35486)
-   \[[`a62d4d60f4`](https://github.com/nodejs/node/commit/a62d4d60f4)] - **(SEMVER-MINOR)** **stream**: add readableDidRead if has been read from (Robert Nagy) [#&#8203;39589](https://github.com/nodejs/node/pull/39589)
-   \[[`63502131a3`](https://github.com/nodejs/node/commit/63502131a3)] - **(SEMVER-MINOR)** **stream**: pipeline accept Buffer as a valid first argument (Nitzan Uziely) [#&#8203;37739](https://github.com/nodejs/node/pull/37739)
-   \[[`68bbebd42c`](https://github.com/nodejs/node/commit/68bbebd42c)] - **(SEMVER-MINOR)** **tls**: allow reading data into a static buffer (Andrey Pechkurov) [#&#8203;35753](https://github.com/nodejs/node/pull/35753)
-   \[[`1cbb74d63d`](https://github.com/nodejs/node/commit/1cbb74d63d)] - **(SEMVER-MINOR)** **url**: expose urlToHttpOptions utility (Yongsheng Zhang) [#&#8203;35960](https://github.com/nodejs/node/pull/35960)
-   \[[`8eb11356dd`](https://github.com/nodejs/node/commit/8eb11356dd)] - **(SEMVER-MINOR)** **util**: expose toUSVString (Robert Nagy) [#&#8203;39814](https://github.com/nodejs/node/pull/39814)
-   \[[`84fcdc3074`](https://github.com/nodejs/node/commit/84fcdc3074)] - **(SEMVER-MINOR)** **v8**: implement v8.stopCoverage() (Joyee Cheung) [#&#8203;33807](https://github.com/nodejs/node/pull/33807)
-   \[[`b238b6bf17`](https://github.com/nodejs/node/commit/b238b6bf17)] - **(SEMVER-MINOR)** **v8**: implement v8.takeCoverage() (Joyee Cheung) [#&#8203;33807](https://github.com/nodejs/node/pull/33807)
-   \[[`9f6bc58da8`](https://github.com/nodejs/node/commit/9f6bc58da8)] - **(SEMVER-MINOR)** **worker**: add setEnvironmentData/getEnvironmentData (James M Snell) [#&#8203;37486](https://github.com/nodejs/node/pull/37486)

##### Commits

##### Semver-minor commits

-   \[[`f3563d3197`](https://github.com/nodejs/node/commit/f3563d3197)] - **(SEMVER-MINOR)** **async_hooks**: use new v8::Context PromiseHook API (Stephen Belanger) [#&#8203;36394](https://github.com/nodejs/node/pull/36394)
-   \[[`df37c106a7`](https://github.com/nodejs/node/commit/df37c106a7)] - **(SEMVER-MINOR)** **buffer**: introduce Blob (James M Snell) [#&#8203;36811](https://github.com/nodejs/node/pull/36811)
-   \[[`223494c548`](https://github.com/nodejs/node/commit/223494c548)] - **(SEMVER-MINOR)** **buffer**: add base64url encoding option (Filip Skokan) [#&#8203;36952](https://github.com/nodejs/node/pull/36952)
-   \[[`14fc4ddabc`](https://github.com/nodejs/node/commit/14fc4ddabc)] - **(SEMVER-MINOR)** **child_process**: allow `options.cwd` receive a URL (Khaidi Chu) [#&#8203;38862](https://github.com/nodejs/node/pull/38862)
-   \[[`b68b13acb3`](https://github.com/nodejs/node/commit/b68b13acb3)] - **(SEMVER-MINOR)** **child_process**: add timeout to spawn and fork (Nitzan Uziely) [#&#8203;37256](https://github.com/nodejs/node/pull/37256)
-   \[[`da98c9f99b`](https://github.com/nodejs/node/commit/da98c9f99b)] - **(SEMVER-MINOR)** **child_process**: allow promisified exec to be cancel (Carlos Fuentes) [#&#8203;34249](https://github.com/nodejs/node/pull/34249)
-   \[[`779310ac87`](https://github.com/nodejs/node/commit/779310ac87)] - **(SEMVER-MINOR)** **child_process**: add 'overlapped' stdio flag (Thiago Padilha) [#&#8203;29412](https://github.com/nodejs/node/pull/29412)
-   \[[`40eb3b79f1`](https://github.com/nodejs/node/commit/40eb3b79f1)] - **(SEMVER-MINOR)** **cli**: add -C alias for --conditions flag (Guy Bedford) [#&#8203;38755](https://github.com/nodejs/node/pull/38755)
-   \[[`39eba0a2e1`](https://github.com/nodejs/node/commit/39eba0a2e1)] - **(SEMVER-MINOR)** **cli**: add --node-memory-debug option (Anna Henningsen) [#&#8203;35537](https://github.com/nodejs/node/pull/35537)
-   \[[`d9b58a0262`](https://github.com/nodejs/node/commit/d9b58a0262)] - **(SEMVER-MINOR)** **deps**: V8: cherry-pick [`fa4cb17`](https://github.com/nodejs/node/commit/fa4cb172cde2) (Stephen Belanger) [#&#8203;38577](https://github.com/nodejs/node/pull/38577)
-   \[[`9d7177c152`](https://github.com/nodejs/node/commit/9d7177c152)] - **(SEMVER-MINOR)** **deps**: V8: cherry-pick [`4c07451`](https://github.com/nodejs/node/commit/4c074516397b) (Stephen Belanger) [#&#8203;36394](https://github.com/nodejs/node/pull/36394)
-   \[[`ec0f0ef8ef`](https://github.com/nodejs/node/commit/ec0f0ef8ef)] - **(SEMVER-MINOR)** **deps**: V8: cherry-pick [`5f44131`](https://github.com/nodejs/node/commit/5f4413194480) (Stephen Belanger) [#&#8203;36394](https://github.com/nodejs/node/pull/36394)
-   \[[`3e7238e45a`](https://github.com/nodejs/node/commit/3e7238e45a)] - **(SEMVER-MINOR)** **deps**: V8: cherry-pick [`272445f`](https://github.com/nodejs/node/commit/272445f10927) (Stephen Belanger) [#&#8203;36394](https://github.com/nodejs/node/pull/36394)
-   \[[`214e568597`](https://github.com/nodejs/node/commit/214e568597)] - **(SEMVER-MINOR)** **deps**: V8: backport [`c0fceaa`](https://github.com/nodejs/node/commit/c0fceaa0669b) (Stephen Belanger) [#&#8203;36394](https://github.com/nodejs/node/pull/36394)
-   \[[`d8d9a9628a`](https://github.com/nodejs/node/commit/d8d9a9628a)] - **(SEMVER-MINOR)** **dns**: add "tries" option to Resolve options (Luan Devecchi) [#&#8203;39610](https://github.com/nodejs/node/pull/39610)
-   \[[`15ba19b020`](https://github.com/nodejs/node/commit/15ba19b020)] - **(SEMVER-MINOR)** **dns**: allow `--dns-result-order` to change default dns verbatim (Ouyang Yadong) [#&#8203;38099](https://github.com/nodejs/node/pull/38099)
-   \[[`defb77cac9`](https://github.com/nodejs/node/commit/defb77cac9)] - **(SEMVER-MINOR)** **doc**: add missing change to resolver ctor (Luan Devecchi) [#&#8203;39610](https://github.com/nodejs/node/pull/39610)
-   \[[`9ee3f77e32`](https://github.com/nodejs/node/commit/9ee3f77e32)] - **(SEMVER-MINOR)** **errors**: remove experimental from --enable-source-maps (Benjamin Coe) [#&#8203;37362](https://github.com/nodejs/node/pull/37362)
-   \[[`989c204a58`](https://github.com/nodejs/node/commit/989c204a58)] - **(SEMVER-MINOR)** **fs**: allow empty string for temp directory prefix (Voltrex) [#&#8203;39028](https://github.com/nodejs/node/pull/39028)
-   \[[`ef72490cde`](https://github.com/nodejs/node/commit/ef72490cde)] - **(SEMVER-MINOR)** **fs**: allow no-params fsPromises fileHandle read (Nitzan Uziely) [#&#8203;38287](https://github.com/nodejs/node/pull/38287)
-   \[[`cad9d20f64`](https://github.com/nodejs/node/commit/cad9d20f64)] - **(SEMVER-MINOR)** **fs**: add support for async iterators to `fsPromises.writeFile` (HiroyukiYagihashi) [#&#8203;37490](https://github.com/nodejs/node/pull/37490)
-   \[[`fe12cc07b3`](https://github.com/nodejs/node/commit/fe12cc07b3)] - **(SEMVER-MINOR)** **fs**: add fsPromises.watch() (James M Snell) [#&#8203;37179](https://github.com/nodejs/node/pull/37179)
-   \[[`2459c115a8`](https://github.com/nodejs/node/commit/2459c115a8)] - **(SEMVER-MINOR)** **fs**: allow `position` parameter to be a `BigInt` in read and readSync (Darshan Sen) [#&#8203;36190](https://github.com/nodejs/node/pull/36190)
-   \[[`6544cfb4b9`](https://github.com/nodejs/node/commit/6544cfb4b9)] - **(SEMVER-MINOR)** **http2**: add support for sensitive headers (Anna Henningsen) [#&#8203;34145](https://github.com/nodejs/node/pull/34145)
-   \[[`a6c6cbb4e6`](https://github.com/nodejs/node/commit/a6c6cbb4e6)] - **(SEMVER-MINOR)** **http2**: allow setting the local window size of a session (Yongsheng Zhang) [#&#8203;35978](https://github.com/nodejs/node/pull/35978)
-   \[[`93af04afbb`](https://github.com/nodejs/node/commit/93af04afbb)] - **(SEMVER-MINOR)** **module**: add support for `URL` to `import.meta.resolve` (Antoine du Hamel) [#&#8203;38587](https://github.com/nodejs/node/pull/38587)
-   \[[`f9f9389d83`](https://github.com/nodejs/node/commit/f9f9389d83)] - **(SEMVER-MINOR)** **module**: add support for `node:`‑prefixed `require(…)` calls (ExE Boss) [#&#8203;37246](https://github.com/nodejs/node/pull/37246)
-   \[[`76d4f22bab`](https://github.com/nodejs/node/commit/76d4f22bab)] - **(SEMVER-MINOR)** **net**: allow net.BlockList to use net.SocketAddress objects (James M Snell) [#&#8203;37917](https://github.com/nodejs/node/pull/37917)
-   \[[`82363d864d`](https://github.com/nodejs/node/commit/82363d864d)] - **(SEMVER-MINOR)** **net**: add SocketAddress class (James M Snell) [#&#8203;37917](https://github.com/nodejs/node/pull/37917)
-   \[[`0202ba46b8`](https://github.com/nodejs/node/commit/0202ba46b8)] - **(SEMVER-MINOR)** **net**: make net.BlockList cloneable (James M Snell) [#&#8203;37917](https://github.com/nodejs/node/pull/37917)
-   \[[`a41a3e3b3f`](https://github.com/nodejs/node/commit/a41a3e3b3f)] - **(SEMVER-MINOR)** **net**: make blocklist family case insensitive (James M Snell) [#&#8203;34864](https://github.com/nodejs/node/pull/34864)
-   \[[`87c71065eb`](https://github.com/nodejs/node/commit/87c71065eb)] - **(SEMVER-MINOR)** **net**: introduce net.BlockList (James M Snell) [#&#8203;34625](https://github.com/nodejs/node/pull/34625)
-   \[[`b421d99a48`](https://github.com/nodejs/node/commit/b421d99a48)] - **(SEMVER-MINOR)** **node-api**: allow retrieval of add-on file name (Gabriel Schulhof) [#&#8203;37195](https://github.com/nodejs/node/pull/37195)
-   \[[`6a4811df8a`](https://github.com/nodejs/node/commit/6a4811df8a)] - **(SEMVER-MINOR)** **os**: add os.devNull (Luigi Pinca) [#&#8203;38569](https://github.com/nodejs/node/pull/38569)
-   \[[`4a88ddeeca`](https://github.com/nodejs/node/commit/4a88ddeeca)] - **(SEMVER-MINOR)** **perf_hooks**: introduce createHistogram (James M Snell) [#&#8203;37155](https://github.com/nodejs/node/pull/37155)
-   \[[`1a6bf1c4a3`](https://github.com/nodejs/node/commit/1a6bf1c4a3)] - **(SEMVER-MINOR)** **process**: add api to enable source-maps programmatically (legendecas) [#&#8203;39085](https://github.com/nodejs/node/pull/39085)
-   \[[`99735a6fe8`](https://github.com/nodejs/node/commit/99735a6fe8)] - **(SEMVER-MINOR)** **process**: add `'worker'` event (James M Snell) [#&#8203;38659](https://github.com/nodejs/node/pull/38659)
-   \[[`3982919317`](https://github.com/nodejs/node/commit/3982919317)] - **(SEMVER-MINOR)** **process**: add direct access to rss without iterating pages (Adrien Maret) [#&#8203;34291](https://github.com/nodejs/node/pull/34291)
-   \[[`526e6c7bde`](https://github.com/nodejs/node/commit/526e6c7bde)] - **(SEMVER-MINOR)** **readline**: add AbortSignal support to interface (Nitzan Uziely) [#&#8203;37932](https://github.com/nodejs/node/pull/37932)
-   \[[`e6eee08692`](https://github.com/nodejs/node/commit/e6eee08692)] - **(SEMVER-MINOR)** **readline**: add support for the AbortController to the question method (Mattias Runge-Broberg) [#&#8203;33676](https://github.com/nodejs/node/pull/33676)
-   \[[`32de361d70`](https://github.com/nodejs/node/commit/32de361d70)] - **(SEMVER-MINOR)** **readline**: add history event and option to set initial history (Mattias Runge-Broberg) [#&#8203;33662](https://github.com/nodejs/node/pull/33662)
-   \[[`797f7f8a38`](https://github.com/nodejs/node/commit/797f7f8a38)] - **(SEMVER-MINOR)** **repl**: add auto‑completion for `node:`‑prefixed `require(…)` calls (ExE Boss) [#&#8203;37246](https://github.com/nodejs/node/pull/37246)
-   \[[`abfd71b64c`](https://github.com/nodejs/node/commit/abfd71b64c)] - **(SEMVER-MINOR)** **src**: call overload ctor from the original ctor (Darshan Sen) [#&#8203;39768](https://github.com/nodejs/node/pull/39768)
-   \[[`1efae01b18`](https://github.com/nodejs/node/commit/1efae01b18)] - **(SEMVER-MINOR)** **src**: add a constructor overload for CallbackScope (Darshan Sen) [#&#8203;39768](https://github.com/nodejs/node/pull/39768)
-   \[[`1aa2080d29`](https://github.com/nodejs/node/commit/1aa2080d29)] - **(SEMVER-MINOR)** **src**: fix align in cares_wrap.h (Luan) [#&#8203;39610](https://github.com/nodejs/node/pull/39610)
-   \[[`f7933804ba`](https://github.com/nodejs/node/commit/f7933804ba)] - **(SEMVER-MINOR)** **src**: allow to negate boolean CLI flags (Michaël Zasso) [#&#8203;39023](https://github.com/nodejs/node/pull/39023)
-   \[[`6d06ac2202`](https://github.com/nodejs/node/commit/6d06ac2202)] - **(SEMVER-MINOR)** **src**: add --heapsnapshot-near-heap-limit option (Joyee Cheung) [#&#8203;33010](https://github.com/nodejs/node/pull/33010)
-   \[[`4091eb9db7`](https://github.com/nodejs/node/commit/4091eb9db7)] - **(SEMVER-MINOR)** **src**: move node_binding to modern THROW_ERR\* (James M Snell) [#&#8203;35469](https://github.com/nodejs/node/pull/35469)
-   \[[`577d228ca0`](https://github.com/nodejs/node/commit/577d228ca0)] - **(SEMVER-MINOR)** **src**: add way to get IsolateData and allocator from Environment (Anna Henningsen) [#&#8203;36441](https://github.com/nodejs/node/pull/36441)
-   \[[`658a266cd4`](https://github.com/nodejs/node/commit/658a266cd4)] - **(SEMVER-MINOR)** **src**: allow preventing SetPrepareStackTraceCallback (Shelley Vohr) [#&#8203;36447](https://github.com/nodejs/node/pull/36447)
-   \[[`f421422ea4`](https://github.com/nodejs/node/commit/f421422ea4)] - **(SEMVER-MINOR)** **src**: add maybe versions of EmitExit and EmitBeforeExit (Anna Henningsen) [#&#8203;35486](https://github.com/nodejs/node/pull/35486)
-   \[[`a62d4d60f4`](https://github.com/nodejs/node/commit/a62d4d60f4)] - **(SEMVER-MINOR)** **stream**: add readableDidRead if has been read from (Robert Nagy) [#&#8203;39589](https://github.com/nodejs/node/pull/39589)
-   \[[`63502131a3`](https://github.com/nodejs/node/commit/63502131a3)] - **(SEMVER-MINOR)** **stream**: pipeline accept Buffer as a valid first argument (Nitzan Uziely) [#&#8203;37739](https://github.com/nodejs/node/pull/37739)
-   \[[`72ef41c72b`](https://github.com/nodejs/node/commit/72ef41c72b)] - **(SEMVER-MINOR)** **test**: add wpt tests for Blob (Michaël Zasso) [#&#8203;36811](https://github.com/nodejs/node/pull/36811)
-   \[[`68bbebd42c`](https://github.com/nodejs/node/commit/68bbebd42c)] - **(SEMVER-MINOR)** **tls**: allow reading data into a static buffer (Andrey Pechkurov) [#&#8203;35753](https://github.com/nodejs/node/pull/35753)
-   \[[`587deacad9`](https://github.com/nodejs/node/commit/587deacad9)] - **(SEMVER-MINOR)** **tools**: add `Worker` to type-parser (James M Snell) [#&#8203;38659](https://github.com/nodejs/node/pull/38659)
-   \[[`1cbb74d63d`](https://github.com/nodejs/node/commit/1cbb74d63d)] - **(SEMVER-MINOR)** **url**: expose urlToHttpOptions utility (Yongsheng Zhang) [#&#8203;35960](https://github.com/nodejs/node/pull/35960)
-   \[[`8eb11356dd`](https://github.com/nodejs/node/commit/8eb11356dd)] - **(SEMVER-MINOR)** **util**: expose toUSVString (Robert Nagy) [#&#8203;39814](https://github.com/nodejs/node/pull/39814)
-   \[[`84fcdc3074`](https://github.com/nodejs/node/commit/84fcdc3074)] - **(SEMVER-MINOR)** **v8**: implement v8.stopCoverage() (Joyee Cheung) [#&#8203;33807](https://github.com/nodejs/node/pull/33807)
-   \[[`b238b6bf17`](https://github.com/nodejs/node/commit/b238b6bf17)] - **(SEMVER-MINOR)** **v8**: implement v8.takeCoverage() (Joyee Cheung) [#&#8203;33807](https://github.com/nodejs/node/pull/33807)
-   \[[`9f6bc58da8`](https://github.com/nodejs/node/commit/9f6bc58da8)] - **(SEMVER-MINOR)** **worker**: add setEnvironmentData/getEnvironmentData (James M Snell) [#&#8203;37486](https://github.com/nodejs/node/pull/37486)

##### Semver-patch commits

-   \[[`3a60de0135`](https://github.com/nodejs/node/commit/3a60de0135)] - **assert**: change status of legacy asserts (James M Snell) [#&#8203;38113](https://github.com/nodejs/node/pull/38113)
-   \[[`5a42be9719`](https://github.com/nodejs/node/commit/5a42be9719)] - **async_hooks**: use resource stack for AsyncLocalStorage run (Stephen Belanger) [#&#8203;39890](https://github.com/nodejs/node/pull/39890)
-   \[[`fc29ddb38e`](https://github.com/nodejs/node/commit/fc29ddb38e)] - **async_hooks**: emit promise trace events from JS (Stephen Belanger) [#&#8203;39135](https://github.com/nodejs/node/pull/39135)
-   \[[`13296d1abf`](https://github.com/nodejs/node/commit/13296d1abf)] - **async_hooks**: eliminate native PromiseHook (Stephen Belanger) [#&#8203;39135](https://github.com/nodejs/node/pull/39135)
-   \[[`48e5971e51`](https://github.com/nodejs/node/commit/48e5971e51)] - **async_hooks**: check for empty contexts before removing (Bryan English) [#&#8203;39095](https://github.com/nodejs/node/pull/39095)
-   \[[`691c00c48b`](https://github.com/nodejs/node/commit/691c00c48b)] - **async_hooks**: switch between native and context hooks correctly (Stephen Belanger) [#&#8203;38912](https://github.com/nodejs/node/pull/38912)
-   \[[`8484ab2a6c`](https://github.com/nodejs/node/commit/8484ab2a6c)] - **buffer**: avoid creating the backing store in the thread (James M Snell) [#&#8203;37052](https://github.com/nodejs/node/pull/37052)
-   \[[`c8d039a872`](https://github.com/nodejs/node/commit/c8d039a872)] - **buffer**: make Blob's constructor more spec-compliant (Michaël Zasso) [#&#8203;37361](https://github.com/nodejs/node/pull/37361)
-   \[[`05d73ac286`](https://github.com/nodejs/node/commit/05d73ac286)] - **buffer**: make Blob's slice method more spec-compliant (Michaël Zasso) [#&#8203;37361](https://github.com/nodejs/node/pull/37361)
-   \[[`e7cf2efc60`](https://github.com/nodejs/node/commit/e7cf2efc60)] - **buffer**: add @&#8203;[@&#8203;toStringTag](https://github.com/toStringTag) to Blob (Colin Ihrig) [#&#8203;37336](https://github.com/nodejs/node/pull/37336)
-   \[[`d99deeaf97`](https://github.com/nodejs/node/commit/d99deeaf97)] - **build**: fix update authors commit (Mestery) [#&#8203;39858](https://github.com/nodejs/node/pull/39858)
-   \[[`5e1cba81bf`](https://github.com/nodejs/node/commit/5e1cba81bf)] - **build**: add authors.yml (Tierney Cyren) [#&#8203;35831](https://github.com/nodejs/node/pull/35831)
-   \[[`ed3c332089`](https://github.com/nodejs/node/commit/ed3c332089)] - **build**: add option to hide console window (Cheng Zhao) [#&#8203;39712](https://github.com/nodejs/node/pull/39712)
-   \[[`c696f97c5e`](https://github.com/nodejs/node/commit/c696f97c5e)] - **build**: exclude markdown files from some GitHub Actions (Rich Trott) [#&#8203;39565](https://github.com/nodejs/node/pull/39565)
-   \[[`0bd6dd1ee2`](https://github.com/nodejs/node/commit/0bd6dd1ee2)] - **build**: use lts shorthand in GitHub Actions (Rich Trott) [#&#8203;39538](https://github.com/nodejs/node/pull/39538)
-   \[[`3482bca643`](https://github.com/nodejs/node/commit/3482bca643)] - **build**: override python executable path on configure (legendecas) [#&#8203;39465](https://github.com/nodejs/node/pull/39465)
-   \[[`61261cdb8e`](https://github.com/nodejs/node/commit/61261cdb8e)] - **build**: use Node.js 14 in commit-lint.yml (Rich Trott) [#&#8203;39506](https://github.com/nodejs/node/pull/39506)
-   \[[`719f1563c1`](https://github.com/nodejs/node/commit/719f1563c1)] - **build**: fix `host_arch_cc()` for AIX/IBM i (Richard Lau) [#&#8203;39481](https://github.com/nodejs/node/pull/39481)
-   \[[`6e06b2ff9d`](https://github.com/nodejs/node/commit/6e06b2ff9d)] - **build**: update coverage Makefile target comments (Richard Lau) [#&#8203;39365](https://github.com/nodejs/node/pull/39365)
-   \[[`4e28d2b2c0`](https://github.com/nodejs/node/commit/4e28d2b2c0)] - **build**: run workflows when a PR is ready for review (Michaël Zasso) [#&#8203;39405](https://github.com/nodejs/node/pull/39405)
-   \[[`0da5d74da4`](https://github.com/nodejs/node/commit/0da5d74da4)] - **build**: update to setup-node@v2 (Rich Trott) [#&#8203;39366](https://github.com/nodejs/node/pull/39366)
-   \[[`f2e1c2267e`](https://github.com/nodejs/node/commit/f2e1c2267e)] - **build**: update gcovr for gcc 8 compatibility (Richard Lau) [#&#8203;39326](https://github.com/nodejs/node/pull/39326)
-   \[[`131dd6ec4d`](https://github.com/nodejs/node/commit/131dd6ec4d)] - **build**: remove unused comment in Makefile (LitoMore) [#&#8203;39171](https://github.com/nodejs/node/pull/39171)
-   \[[`40e46321b0`](https://github.com/nodejs/node/commit/40e46321b0)] - **build**: uvwasi honours node_shared_libuv (Jérémy Lal) [#&#8203;39260](https://github.com/nodejs/node/pull/39260)
-   \[[`5c6ab719f2`](https://github.com/nodejs/node/commit/5c6ab719f2)] - **build**: shorten path used in tarball build workflow (Richard Lau) [#&#8203;39192](https://github.com/nodejs/node/pull/39192)
-   \[[`870526374c`](https://github.com/nodejs/node/commit/870526374c)] - **build**: add `library_files` to gyp variables (himself65) [#&#8203;39293](https://github.com/nodejs/node/pull/39293)
-   \[[`0e221156aa`](https://github.com/nodejs/node/commit/0e221156aa)] - **build**: pass directory instead of list of files to js2c.py (Joyee Cheung) [#&#8203;39069](https://github.com/nodejs/node/pull/39069)
-   \[[`8d8415415b`](https://github.com/nodejs/node/commit/8d8415415b)] - **build**: don't pass `--mode` argument to V8 test-runner (Richard Lau) [#&#8203;39055](https://github.com/nodejs/node/pull/39055)
-   \[[`2d50217634`](https://github.com/nodejs/node/commit/2d50217634)] - **build**: fix commit linter on unrebased PRs (Mary Marchini) [#&#8203;39121](https://github.com/nodejs/node/pull/39121)
-   \[[`c93d5e006e`](https://github.com/nodejs/node/commit/c93d5e006e)] - **build**: use Actions to validate commit message (Mary Marchini) [#&#8203;32417](https://github.com/nodejs/node/pull/32417)
-   \[[`0bcaf9c4d1`](https://github.com/nodejs/node/commit/0bcaf9c4d1)] - **child_process**: fix spawn and fork abort behavior (Nitzan Uziely) [#&#8203;37325](https://github.com/nodejs/node/pull/37325)
-   \[[`8010c83180`](https://github.com/nodejs/node/commit/8010c83180)] - **child_process**: fix bad abort signal leak (Nitzan Uziely) [#&#8203;37257](https://github.com/nodejs/node/pull/37257)
-   \[[`32aff2f5a0`](https://github.com/nodejs/node/commit/32aff2f5a0)] - **console**: refactor to avoid unsafe array iteration (Antoine du Hamel) [#&#8203;36753](https://github.com/nodejs/node/pull/36753)
-   \[[`f46e8cdf79`](https://github.com/nodejs/node/commit/f46e8cdf79)] - **debugger**: remove undefined parameter (Rich Trott) [#&#8203;39570](https://github.com/nodejs/node/pull/39570)
-   \[[`482459edd4`](https://github.com/nodejs/node/commit/482459edd4)] - **debugger**: validate sec-websocket-accept response header (Chris Opperwall) [#&#8203;39357](https://github.com/nodejs/node/pull/39357)
-   \[[`e9c46107d7`](https://github.com/nodejs/node/commit/e9c46107d7)] - **debugger**: rename internal module (Rich Trott) [#&#8203;39378](https://github.com/nodejs/node/pull/39378)
-   \[[`49e0883c75`](https://github.com/nodejs/node/commit/49e0883c75)] - **debugger**: indicate server is ending (Rich Trott) [#&#8203;39334](https://github.com/nodejs/node/pull/39334)
-   \[[`72a3419510`](https://github.com/nodejs/node/commit/72a3419510)] - **debugger**: rename inspector-cli test module to debugger (Rich Trott) [#&#8203;38530](https://github.com/nodejs/node/pull/38530)
-   \[[`b3352cfba4`](https://github.com/nodejs/node/commit/b3352cfba4)] - **debugger**: prevent simultaneous heap snapshots (Rich Trott) [#&#8203;39638](https://github.com/nodejs/node/pull/39638)
-   \[[`e5826ab1c2`](https://github.com/nodejs/node/commit/e5826ab1c2)] - **debugger**: remove final lint exceptions in inspect_repl.js (Rich Trott) [#&#8203;39078](https://github.com/nodejs/node/pull/39078)
-   \[[`34c0701952`](https://github.com/nodejs/node/commit/34c0701952)] - **deps**: V8: cherry-pick [`00bb1a7`](https://github.com/nodejs/node/commit/00bb1a77c03e) (Darshan Sen) [#&#8203;39829](https://github.com/nodejs/node/pull/39829)
-   \[[`42359ab582`](https://github.com/nodejs/node/commit/42359ab582)] - **deps**: upgrade to libuv 1.42.0 (Luigi Pinca) [#&#8203;39525](https://github.com/nodejs/node/pull/39525)
-   \[[`d863a9db68`](https://github.com/nodejs/node/commit/d863a9db68)] - **deps**: bump HdrHistogram_C to 0.11.2 (Matteo Collina) [#&#8203;39462](https://github.com/nodejs/node/pull/39462)
-   \[[`4c93968a62`](https://github.com/nodejs/node/commit/4c93968a62)] - **deps**: extract gtest source files to deps/googletest (legendecas) [#&#8203;39386](https://github.com/nodejs/node/pull/39386)
-   \[[`fcae391fed`](https://github.com/nodejs/node/commit/fcae391fed)] - **deps**: update Acorn to v8.4.1 (Michaël Zasso) [#&#8203;39166](https://github.com/nodejs/node/pull/39166)
-   \[[`327838dd96`](https://github.com/nodejs/node/commit/327838dd96)] - **deps**: V8: backport [`c922458`](https://github.com/nodejs/node/commit/c9224589cf53) (Stephen Belanger) [#&#8203;39743](https://github.com/nodejs/node/pull/39743)
-   \[[`89c1bbd7b2`](https://github.com/nodejs/node/commit/89c1bbd7b2)] - **deps**: V8: cherry-pick [`81814ed`](https://github.com/nodejs/node/commit/81814ed44574) (Stephen Belanger) [#&#8203;39719](https://github.com/nodejs/node/pull/39719)
-   \[[`8b9215d07c`](https://github.com/nodejs/node/commit/8b9215d07c)] - **deps**: update to cjs-module-lexer@1.2.2 (Guy Bedford) [#&#8203;39402](https://github.com/nodejs/node/pull/39402)
-   \[[`e201293ddb`](https://github.com/nodejs/node/commit/e201293ddb)] - **dgram**: use simplified validator (Voltrex) [#&#8203;39753](https://github.com/nodejs/node/pull/39753)
-   \[[`6fdac38f91`](https://github.com/nodejs/node/commit/6fdac38f91)] - **doc,fs**: remove experimental status for WHATWG URL as path (Antoine du Hamel) [#&#8203;38870](https://github.com/nodejs/node/pull/38870)
-   \[[`d56e8268f9`](https://github.com/nodejs/node/commit/d56e8268f9)] - **doc,lib**: prepare for stricter multi-line array linting (Rich Trott) [#&#8203;37088](https://github.com/nodejs/node/pull/37088)
-   \[[`5500ae9236`](https://github.com/nodejs/node/commit/5500ae9236)] - **domain**: do not add domain to promise from other context (Stephen Belanger) [#&#8203;39135](https://github.com/nodejs/node/pull/39135)
-   \[[`dc855af18e`](https://github.com/nodejs/node/commit/dc855af18e)] - **errors**: don't throw TypeError on missing export (Benjamin Coe) [#&#8203;39017](https://github.com/nodejs/node/pull/39017)
-   \[[`c13eadc218`](https://github.com/nodejs/node/commit/c13eadc218)] - **errors**: eliminate all overhead for hidden calls (Momtchil Momtchev) [#&#8203;35644](https://github.com/nodejs/node/pull/35644)
-   \[[`d42bbe48c5`](https://github.com/nodejs/node/commit/d42bbe48c5)] - **esm**: use correct URL for error decoration (Bradley Farias) [#&#8203;37854](https://github.com/nodejs/node/pull/37854)
-   \[[`9db3304368`](https://github.com/nodejs/node/commit/9db3304368)] - **esm**: update to correct deprecation code (Colin Ihrig) [#&#8203;37147](https://github.com/nodejs/node/pull/37147)
-   \[[`e73bfed2f4`](https://github.com/nodejs/node/commit/e73bfed2f4)] - **esm**: deprecate legacy main lookup for modules (Guy Bedford) [#&#8203;36918](https://github.com/nodejs/node/pull/36918)
-   \[[`c1782ea1f5`](https://github.com/nodejs/node/commit/c1782ea1f5)] - **events**: allow the options argument to be null (Luigi Pinca) [#&#8203;39486](https://github.com/nodejs/node/pull/39486)
-   \[[`d2834fb97f`](https://github.com/nodejs/node/commit/d2834fb97f)] - **fs**: improve fsPromises writeFile performance (Nitzan Uziely) [#&#8203;37610](https://github.com/nodejs/node/pull/37610)
-   \[[`ee1d13c90d`](https://github.com/nodejs/node/commit/ee1d13c90d)] - **fs**: use byteLength to handle ArrayBuffer views (Michaël Zasso) [#&#8203;38187](https://github.com/nodejs/node/pull/38187)
-   \[[`b38d6b475b`](https://github.com/nodejs/node/commit/b38d6b475b)] - **fs**: fixup negative length in fs.truncate (James M Snell) [#&#8203;37483](https://github.com/nodejs/node/pull/37483)
-   \[[`fe28128f3c`](https://github.com/nodejs/node/commit/fe28128f3c)] - **fs**: add docs and tests for `AsyncIterable` support in `fh.writeFile` (Antoine du Hamel) [#&#8203;39836](https://github.com/nodejs/node/pull/39836)
-   \[[`2b0e2706c0`](https://github.com/nodejs/node/commit/2b0e2706c0)] - **fs**: improve fsPromises readFile performance (Nitzan Uziely) [#&#8203;37608](https://github.com/nodejs/node/pull/37608)
-   \[[`a4d6f78619`](https://github.com/nodejs/node/commit/a4d6f78619)] - **fs**: move constants to internal/fs/utils.js (Darshan Sen) [#&#8203;38061](https://github.com/nodejs/node/pull/38061)
-   \[[`402f7722ce`](https://github.com/nodejs/node/commit/402f7722ce)] - **fs**: add validatePosition and use in read and readSync (Darshan Sen) [#&#8203;37051](https://github.com/nodejs/node/pull/37051)
-   \[[`2bc301dcff`](https://github.com/nodejs/node/commit/2bc301dcff)] - **http**: decodes url.username and url.password for authorization header (Lew Gordon) [#&#8203;39310](https://github.com/nodejs/node/pull/39310)
-   \[[`5459f4af33`](https://github.com/nodejs/node/commit/5459f4af33)] - **http**: clean up HttpParser correctly (Tobias Koppers) [#&#8203;39292](https://github.com/nodejs/node/pull/39292)
-   \[[`8b3feee148`](https://github.com/nodejs/node/commit/8b3feee148)] - **http,https**: align server option of https with http (Qingyu Deng) [#&#8203;38992](https://github.com/nodejs/node/pull/38992)
-   \[[`cf59e87c8b`](https://github.com/nodejs/node/commit/cf59e87c8b)] - **inspector**: update inspector_protocol to [`89c4adf`](https://github.com/nodejs/node/commit/89c4adf) (Rich Trott) [#&#8203;39650](https://github.com/nodejs/node/pull/39650)
-   \[[`ea5f2047a2`](https://github.com/nodejs/node/commit/ea5f2047a2)] - **inspector**: update inspector_protocol to [`8ec18cf`](https://github.com/nodejs/node/commit/8ec18cf) (Rich Trott) [#&#8203;39614](https://github.com/nodejs/node/pull/39614)
-   \[[`1e5aca550c`](https://github.com/nodejs/node/commit/1e5aca550c)] - **inspector**: mark as stable (Gireesh Punathil) [#&#8203;37748](https://github.com/nodejs/node/pull/37748)
-   \[[`8a2ce5dae6`](https://github.com/nodejs/node/commit/8a2ce5dae6)] - **inspector**: move inspector async hooks to environment (Joyee Cheung) [#&#8203;39112](https://github.com/nodejs/node/pull/39112)
-   \[[`338189ff6f`](https://github.com/nodejs/node/commit/338189ff6f)] - **lib**: simplify validators (Voltrex) [#&#8203;39753](https://github.com/nodejs/node/pull/39753)
-   \[[`e1019351e8`](https://github.com/nodejs/node/commit/e1019351e8)] - **lib**: cleanup validation (Voltrex) [#&#8203;39652](https://github.com/nodejs/node/pull/39652)
-   \[[`dbaf4988bc`](https://github.com/nodejs/node/commit/dbaf4988bc)] - **lib**: use validators (Voltrex) [#&#8203;39663](https://github.com/nodejs/node/pull/39663)
-   \[[`9c33e4bfb2`](https://github.com/nodejs/node/commit/9c33e4bfb2)] - **lib**: use validator (Voltrex) [#&#8203;39547](https://github.com/nodejs/node/pull/39547)
-   \[[`5b1104291d`](https://github.com/nodejs/node/commit/5b1104291d)] - **lib**: use `validateObject` (Voltrex) [#&#8203;39605](https://github.com/nodejs/node/pull/39605)
-   \[[`1ce81079df`](https://github.com/nodejs/node/commit/1ce81079df)] - **lib**: remove use of array destructuring (Antoine du Hamel) [#&#8203;36818](https://github.com/nodejs/node/pull/36818)
-   \[[`b24b34effd`](https://github.com/nodejs/node/commit/b24b34effd)] - **lib**: add `bound apply` variants of varargs `primordials` (ExE Boss) [#&#8203;37005](https://github.com/nodejs/node/pull/37005)
-   \[[`7cdff9a6a8`](https://github.com/nodejs/node/commit/7cdff9a6a8)] - **lib**: refactor `primordials.makeSafe` to use more primordials (ExE Boss) [#&#8203;36865](https://github.com/nodejs/node/pull/36865)
-   \[[`1737352580`](https://github.com/nodejs/node/commit/1737352580)] - **lib**: comment explaining special-case handling of promises (Stephen Belanger) [#&#8203;39135](https://github.com/nodejs/node/pull/39135)
-   \[[`7f54cccb6c`](https://github.com/nodejs/node/commit/7f54cccb6c)] - **lib**: refactor to use validateString (ZiJian Liu) [#&#8203;37006](https://github.com/nodejs/node/pull/37006)
-   \[[`98259dc527`](https://github.com/nodejs/node/commit/98259dc527)] - **module**: improve support of data: URLs (Antoine du Hamel) [#&#8203;37392](https://github.com/nodejs/node/pull/37392)
-   \[[`9aba2888a1`](https://github.com/nodejs/node/commit/9aba2888a1)] - **net**: throw ERR_OUT_OF_RANGE if blockList.addSubnet prefix is NaN (ZiJian Liu) [#&#8203;36732](https://github.com/nodejs/node/pull/36732)
-   \[[`2ca12c83b4`](https://github.com/nodejs/node/commit/2ca12c83b4)] - **node-api**: handle pending exception in cb wrapper (Michael Dawson) [#&#8203;39476](https://github.com/nodejs/node/pull/39476)
-   \[[`9e5edf2158`](https://github.com/nodejs/node/commit/9e5edf2158)] - **node-api**: cctest on v8impl::Reference (legendecas) [#&#8203;38970](https://github.com/nodejs/node/pull/38970)
-   \[[`a74032a490`](https://github.com/nodejs/node/commit/a74032a490)] - **node-api**: rtn pending excep on napi_new_instance (legendecas) [#&#8203;38798](https://github.com/nodejs/node/pull/38798)
-   \[[`bcb85adee6`](https://github.com/nodejs/node/commit/bcb85adee6)] - **policy**: canonicalize before resolving specifiers (Bradley Farias) [#&#8203;37863](https://github.com/nodejs/node/pull/37863)
-   \[[`0ff520cf02`](https://github.com/nodejs/node/commit/0ff520cf02)] - **policy**: fix integrity when DEFAULT_ENCODING is set (Tobias Nießen) [#&#8203;39750](https://github.com/nodejs/node/pull/39750)
-   \[[`6c87b591d9`](https://github.com/nodejs/node/commit/6c87b591d9)] - **readline**: allow completer to rewrite existing input (Anna Henningsen) [#&#8203;39178](https://github.com/nodejs/node/pull/39178)
-   \[[`37b4708b19`](https://github.com/nodejs/node/commit/37b4708b19)] - **repl**: fix tla function hoisting (Don Jayamanne) [#&#8203;39745](https://github.com/nodejs/node/pull/39745)
-   \[[`9264caeafe`](https://github.com/nodejs/node/commit/9264caeafe)] - **repl**: do not include legacy getter/setter methods in completion (Anna Henningsen) [#&#8203;39576](https://github.com/nodejs/node/pull/39576)
-   \[[`50c5e71e22`](https://github.com/nodejs/node/commit/50c5e71e22)] - **repl**: correctly hoist top level await declarations (ejose19) [#&#8203;39265](https://github.com/nodejs/node/pull/39265)
-   \[[`1e065a0a43`](https://github.com/nodejs/node/commit/1e065a0a43)] - **repl**: processTopLevelAwait fallback error handling (ejose19) [#&#8203;39290](https://github.com/nodejs/node/pull/39290)
-   \[[`99664494ff`](https://github.com/nodejs/node/commit/99664494ff)] - **repl**: ensure correct syntax err for await parsing (Guy Bedford) [#&#8203;39154](https://github.com/nodejs/node/pull/39154)
-   \[[`761dafafde`](https://github.com/nodejs/node/commit/761dafafde)] - **repl**: fix Ctrl+C on top level await (Antoine du Hamel) [#&#8203;38656](https://github.com/nodejs/node/pull/38656)
-   \[[`88b02cbb08`](https://github.com/nodejs/node/commit/88b02cbb08)] - **repl**: add auto‑completion for dynamic import calls (ExE Boss) [#&#8203;37178](https://github.com/nodejs/node/pull/37178)
-   \[[`8f3a8830ba`](https://github.com/nodejs/node/commit/8f3a8830ba)] - **repl**: refactor to avoid unsafe array iteration (Antoine du Hamel) [#&#8203;37188](https://github.com/nodejs/node/pull/37188)
-   \[[`a48e2d6ec7`](https://github.com/nodejs/node/commit/a48e2d6ec7)] - **repl**: refactor to avoid unsafe array iteration (Darshan Sen) [#&#8203;36663](https://github.com/nodejs/node/pull/36663)
-   \[[`20ffadf437`](https://github.com/nodejs/node/commit/20ffadf437)] - **repl**: refactor to use more primordials (Antoine du Hamel) [#&#8203;36264](https://github.com/nodejs/node/pull/36264)
-   \[[`f69c934ad4`](https://github.com/nodejs/node/commit/f69c934ad4)] - **report**: generates report on threads with no isolates (legendecas) [#&#8203;38994](https://github.com/nodejs/node/pull/38994)
-   \[[`c4686fa5a7`](https://github.com/nodejs/node/commit/c4686fa5a7)] - **src**: fix TextDecoder final flush size calculation (James M Snell) [#&#8203;39737](https://github.com/nodejs/node/pull/39737)
-   \[[`495cd02c20`](https://github.com/nodejs/node/commit/495cd02c20)] - **src**: add cosmetic space character to `async_wrap.h` file (Juan José Arboleda) [#&#8203;39459](https://github.com/nodejs/node/pull/39459)
-   \[[`985ec48975`](https://github.com/nodejs/node/commit/985ec48975)] - **src**: print native module id on native module not found (legendecas) [#&#8203;39460](https://github.com/nodejs/node/pull/39460)
-   \[[`e6ff7e648e`](https://github.com/nodejs/node/commit/e6ff7e648e)] - **src**: close HandleWraps instead of deleting them in OnGCCollect() (Anna Henningsen) [#&#8203;39441](https://github.com/nodejs/node/pull/39441)
-   \[[`5c473bdc12`](https://github.com/nodejs/node/commit/5c473bdc12)] - **src**: remove unused guards around node-api reference (legendecas) [#&#8203;38334](https://github.com/nodejs/node/pull/38334)
-   \[[`41213bd507`](https://github.com/nodejs/node/commit/41213bd507)] - **src**: add JSDoc typings for v8 (Voltrex) [#&#8203;38944](https://github.com/nodejs/node/pull/38944)
-   \[[`02b1df9fac`](https://github.com/nodejs/node/commit/02b1df9fac)] - **src**: fix crash in AfterGetAddrInfo (Anna Henningsen) [#&#8203;39735](https://github.com/nodejs/node/pull/39735)
-   \[[`99493b07d4`](https://github.com/nodejs/node/commit/99493b07d4)] - **src**: fix fatal errors when a current isolate not exist (legendecas) [#&#8203;38624](https://github.com/nodejs/node/pull/38624)
-   \[[`9433c28c14`](https://github.com/nodejs/node/commit/9433c28c14)] - **src**: remove more extra semis from member fns (Shelley Vohr) [#&#8203;38744](https://github.com/nodejs/node/pull/38744)
-   \[[`bad990c934`](https://github.com/nodejs/node/commit/bad990c934)] - **src**: use BaseObject::kInteralFieldCount in Blob (Joyee Cheung) [#&#8203;36991](https://github.com/nodejs/node/pull/36991)
-   \[[`0a759dff52`](https://github.com/nodejs/node/commit/0a759dff52)] - **src**: compare IPv4 addresses in host byte order (Colin Ihrig) [#&#8203;39096](https://github.com/nodejs/node/pull/39096)
-   \[[`d73181f243`](https://github.com/nodejs/node/commit/d73181f243)] - **src**: reduce duplicated boilerplate with new env utility fn (James M Snell) [#&#8203;36536](https://github.com/nodejs/node/pull/36536)
-   \[[`85af15a8b6`](https://github.com/nodejs/node/commit/85af15a8b6)] - **src**: allow instances of net.BlockList to be created internally (James M Snell) [#&#8203;34741](https://github.com/nodejs/node/pull/34741)
-   \[[`1008c80176`](https://github.com/nodejs/node/commit/1008c80176)] - **src**: add SocketAddressLRU Utility (James M Snell) [#&#8203;34618](https://github.com/nodejs/node/pull/34618)
-   \[[`e404841a9c`](https://github.com/nodejs/node/commit/e404841a9c)] - **src**: set PromiseHooks by Environment (Bryan English) [#&#8203;38821](https://github.com/nodejs/node/pull/38821)
-   \[[`c8c290ae8f`](https://github.com/nodejs/node/commit/c8c290ae8f)] - **src,zlib**: tighten up Z_\*\_WINDOWBITS macros (Khaidi Chu) [#&#8203;39115](https://github.com/nodejs/node/pull/39115)
-   \[[`de171177b4`](https://github.com/nodejs/node/commit/de171177b4)] - **stream**: clean `endWritableNT` (Mestery) [#&#8203;39645](https://github.com/nodejs/node/pull/39645)
-   \[[`32a5b8f59b`](https://github.com/nodejs/node/commit/32a5b8f59b)] - **stream**: move duplicated code to an internal module (Rich Trott) [#&#8203;37508](https://github.com/nodejs/node/pull/37508)
-   \[[`f90b22d351`](https://github.com/nodejs/node/commit/f90b22d351)] - **util**: add internal createDeferredPromise() (Colin Ihrig) [#&#8203;37095](https://github.com/nodejs/node/pull/37095)
-   \[[`61b4a98480`](https://github.com/nodejs/node/commit/61b4a98480)] - **zlib**: avoid converting `Uint8Array` instances to `Buffer` (Antoine du Hamel) [#&#8203;39492](https://github.com/nodejs/node/pull/39492)

##### Documentation commits

-   \[[`8efd559347`](https://github.com/nodejs/node/commit/8efd559347)] - **doc**: add duplicate CVE check in sec. release doc (Daniel Bevenius) [#&#8203;39845](https://github.com/nodejs/node/pull/39845)
-   \[[`7b123ec78d`](https://github.com/nodejs/node/commit/7b123ec78d)] - **doc**: improve description of the triagers team (Michaël Zasso) [#&#8203;39833](https://github.com/nodejs/node/pull/39833)
-   \[[`615477f67b`](https://github.com/nodejs/node/commit/615477f67b)] - **doc**: update instructions for cc (Michael Dawson) [#&#8203;39674](https://github.com/nodejs/node/pull/39674)
-   \[[`1a8a26d92e`](https://github.com/nodejs/node/commit/1a8a26d92e)] - **doc**: fix malformed changelog entries (Rich Trott) [#&#8203;39791](https://github.com/nodejs/node/pull/39791)
-   \[[`9e772ca9a1`](https://github.com/nodejs/node/commit/9e772ca9a1)] - **doc**: fix lint errors in packages.md (Rich Trott) [#&#8203;39792](https://github.com/nodejs/node/pull/39792)
-   \[[`2624c98207`](https://github.com/nodejs/node/commit/2624c98207)] - **doc**: add example of self-reference in scoped packages (Jesús Leganés-Combarro 'piranna) [#&#8203;37630](https://github.com/nodejs/node/pull/37630)
-   \[[`00f2cee26c`](https://github.com/nodejs/node/commit/00f2cee26c)] - **doc**: add himadriganguly as a triager (Himadri Ganguly) [#&#8203;39757](https://github.com/nodejs/node/pull/39757)
-   \[[`95b9cc78d2`](https://github.com/nodejs/node/commit/95b9cc78d2)] - **doc**: fix YAML comment opening tags (Jayden Seric) [#&#8203;38324](https://github.com/nodejs/node/pull/38324)
-   \[[`49a7962d58`](https://github.com/nodejs/node/commit/49a7962d58)] - **doc**: fix `fs.rmdir` `recursive` option deprecation history (Antoine du Hamel) [#&#8203;39728](https://github.com/nodejs/node/pull/39728)
-   \[[`53300d33c7`](https://github.com/nodejs/node/commit/53300d33c7)] - **doc**: fixed variable names in queueMicrotask example (ashish maurya) [#&#8203;39634](https://github.com/nodejs/node/pull/39634)
-   \[[`df1e20aaf1`](https://github.com/nodejs/node/commit/df1e20aaf1)] - **doc**: update debugger.md description and examples (Rich Trott) [#&#8203;39661](https://github.com/nodejs/node/pull/39661)
-   \[[`9672bbf01c`](https://github.com/nodejs/node/commit/9672bbf01c)] - **doc**: fix color contrast issue in light mode (Rich Trott) [#&#8203;39660](https://github.com/nodejs/node/pull/39660)
-   \[[`48281ecfcd`](https://github.com/nodejs/node/commit/48281ecfcd)] - **doc**: add code examples to `Writable.destroy()` and `Writable.destroyed` (Juan José Arboleda) [#&#8203;39491](https://github.com/nodejs/node/pull/39491)
-   \[[`8799a134e4`](https://github.com/nodejs/node/commit/8799a134e4)] - **doc**: move `NODE_MODULE_VERSION` in release guide (Richard Lau) [#&#8203;39544](https://github.com/nodejs/node/pull/39544)
-   \[[`89c8afcf48`](https://github.com/nodejs/node/commit/89c8afcf48)] - **doc**: remove outdated ARM information from release guide (Richard Lau) [#&#8203;39544](https://github.com/nodejs/node/pull/39544)
-   \[[`a718b26f28`](https://github.com/nodejs/node/commit/a718b26f28)] - **doc**: fence command examples in release guide (Richard Lau) [#&#8203;39544](https://github.com/nodejs/node/pull/39544)
-   \[[`42669bb049`](https://github.com/nodejs/node/commit/42669bb049)] - **doc**: update backport labels in release guide (Richard Lau) [#&#8203;39544](https://github.com/nodejs/node/pull/39544)
-   \[[`a437de3c5f`](https://github.com/nodejs/node/commit/a437de3c5f)] - **doc**: add code example to `http.createServer` method (Juan José Arboleda) [#&#8203;39455](https://github.com/nodejs/node/pull/39455)
-   \[[`695569fc17`](https://github.com/nodejs/node/commit/695569fc17)] - **doc**: move lball@redhat.com to emeritus (Lance Ball) [#&#8203;39501](https://github.com/nodejs/node/pull/39501)
-   \[[`c7523da86c`](https://github.com/nodejs/node/commit/c7523da86c)] - **doc**: update AUTHORS (Rich Trott) [#&#8203;39488](https://github.com/nodejs/node/pull/39488)
-   \[[`e826109d5c`](https://github.com/nodejs/node/commit/e826109d5c)] - **doc**: update strategic initiative champion (Rich Trott) [#&#8203;39487](https://github.com/nodejs/node/pull/39487)
-   \[[`39da842051`](https://github.com/nodejs/node/commit/39da842051)] - **doc**: simplify unnecessarily specific .mailmap entries (Rich Trott) [#&#8203;39430](https://github.com/nodejs/node/pull/39430)
-   \[[`6a4c6ce4d7`](https://github.com/nodejs/node/commit/6a4c6ce4d7)] - **doc**: update checkbox label in backporting guide (Darshan Sen) [#&#8203;39420](https://github.com/nodejs/node/pull/39420)
-   \[[`d17afa08bd`](https://github.com/nodejs/node/commit/d17afa08bd)] - **doc**: remove \_Addenda\_ from headers (Rich Trott) [#&#8203;39427](https://github.com/nodejs/node/pull/39427)
-   \[[`ae97a96d9e`](https://github.com/nodejs/node/commit/ae97a96d9e)] - **doc**: simplify .mailmap file (Rich Trott) [#&#8203;39418](https://github.com/nodejs/node/pull/39418)
-   \[[`a3dee70f66`](https://github.com/nodejs/node/commit/a3dee70f66)] - **doc**: fix broken internal link in http.md (Rich Trott) [#&#8203;39425](https://github.com/nodejs/node/pull/39425)
-   \[[`ca947ac524`](https://github.com/nodejs/node/commit/ca947ac524)] - **doc**: remove outdated step in onboarding exercise (Rich Trott) [#&#8203;39410](https://github.com/nodejs/node/pull/39410)
-   \[[`86e12607f0`](https://github.com/nodejs/node/commit/86e12607f0)] - **doc**: revise strategic initiatives text (Rich Trott) [#&#8203;39417](https://github.com/nodejs/node/pull/39417)
-   \[[`cd8e773d28`](https://github.com/nodejs/node/commit/cd8e773d28)] - **doc**: update mailmap and AUTHORS (Rich Trott) [#&#8203;39393](https://github.com/nodejs/node/pull/39393)
-   \[[`8376b07ae8`](https://github.com/nodejs/node/commit/8376b07ae8)] - **doc**: use a details tag for completed initiatves (Rich Trott) [#&#8203;39416](https://github.com/nodejs/node/pull/39416)
-   \[[`43d28f5f00`](https://github.com/nodejs/node/commit/43d28f5f00)] - **doc**: update commit-queue.md to indicate GitHub Actions are checked (Rich Trott) [#&#8203;39411](https://github.com/nodejs/node/pull/39411)
-   \[[`63b0603e95`](https://github.com/nodejs/node/commit/63b0603e95)] - **doc**: use \_pull request\_ instead of \_PR\_ in onboarding doc (Rich Trott) [#&#8203;39409](https://github.com/nodejs/node/pull/39409)
-   \[[`73f784f764`](https://github.com/nodejs/node/commit/73f784f764)] - **doc**: add strategic initiatives from TSC repo (Rich Trott) [#&#8203;39394](https://github.com/nodejs/node/pull/39394)
-   \[[`1a494d51dc`](https://github.com/nodejs/node/commit/1a494d51dc)] - **doc**: standardize on \_pull request\_ (Rich Trott) [#&#8203;39384](https://github.com/nodejs/node/pull/39384)
-   \[[`eb12e4ccfb`](https://github.com/nodejs/node/commit/eb12e4ccfb)] - **doc**: make minor edits to pull request text (Rich Trott) [#&#8203;39383](https://github.com/nodejs/node/pull/39383)
-   \[[`ab0bf4fa1a`](https://github.com/nodejs/node/commit/ab0bf4fa1a)] - **doc**: add docker-node and build-wg issue contents (Daniel Bevenius) [#&#8203;39215](https://github.com/nodejs/node/pull/39215)
-   \[[`8438e8bf33`](https://github.com/nodejs/node/commit/8438e8bf33)] - **doc**: add instructions for core vuln files (Daniel Bevenius) [#&#8203;39220](https://github.com/nodejs/node/pull/39220)
-   \[[`c3cfefc2d3`](https://github.com/nodejs/node/commit/c3cfefc2d3)] - **doc**: standardize on not capitalizing \_collaborator\_ (Rich Trott) [#&#8203;39379](https://github.com/nodejs/node/pull/39379)
-   \[[`672023f9f2`](https://github.com/nodejs/node/commit/672023f9f2)] - **doc**: update mailmap and deduplicate AUTHORS entry (Rich Trott) [#&#8203;39391](https://github.com/nodejs/node/pull/39391)
-   \[[`baaa397e39`](https://github.com/nodejs/node/commit/baaa397e39)] - **doc**: update AUTHORS (Rich Trott) [#&#8203;39367](https://github.com/nodejs/node/pull/39367)
-   \[[`f39d93a428`](https://github.com/nodejs/node/commit/f39d93a428)] - **doc**: move jdalton to emeritus (Rich Trott) [#&#8203;39380](https://github.com/nodejs/node/pull/39380)
-   \[[`0b1ce72d64`](https://github.com/nodejs/node/commit/0b1ce72d64)] - **doc**: edit guide on pull requests (Rich Trott) [#&#8203;39359](https://github.com/nodejs/node/pull/39359)
-   \[[`6f0b3a20d1`](https://github.com/nodejs/node/commit/6f0b3a20d1)] - **doc**: add text about moving long commit lists out of PR description (Danielle Adams) [#&#8203;39186](https://github.com/nodejs/node/pull/39186)
-   \[[`9d43ce3b80`](https://github.com/nodejs/node/commit/9d43ce3b80)] - **doc**: do not use & for "and" in text (Rich Trott) [#&#8203;39345](https://github.com/nodejs/node/pull/39345)
-   \[[`25c104f21f`](https://github.com/nodejs/node/commit/25c104f21f)] - **doc**: update AUTHORS (Rich Trott) [#&#8203;39277](https://github.com/nodejs/node/pull/39277)
-   \[[`b47b47930c`](https://github.com/nodejs/node/commit/b47b47930c)] - **doc**: put information about the past in details tags (Rich Trott) [#&#8203;39321](https://github.com/nodejs/node/pull/39321)
-   \[[`5eafc3afa8`](https://github.com/nodejs/node/commit/5eafc3afa8)] - **doc**: move AndreasMadsen to emeritus (Rich Trott) [#&#8203;39315](https://github.com/nodejs/node/pull/39315)
-   \[[`fbf658f1d5`](https://github.com/nodejs/node/commit/fbf658f1d5)] - **doc**: move ofrobots to collaborator emeritus (Rich Trott) [#&#8203;39307](https://github.com/nodejs/node/pull/39307)
-   \[[`fc7d714149`](https://github.com/nodejs/node/commit/fc7d714149)] - **doc**: simplify CRAN mirror text in benchmark guide (Rich Trott) [#&#8203;39287](https://github.com/nodejs/node/pull/39287)
-   \[[`22f0b7e0d0`](https://github.com/nodejs/node/commit/22f0b7e0d0)] - **doc**: use "repository" instead of "repo" in onboarding.md (Rich Trott) [#&#8203;39286](https://github.com/nodejs/node/pull/39286)
-   \[[`f46ae3ffb6`](https://github.com/nodejs/node/commit/f46ae3ffb6)] - **doc**: update collaborator email address (Rich Trott) [#&#8203;39263](https://github.com/nodejs/node/pull/39263)
-   \[[`8c569cef88`](https://github.com/nodejs/node/commit/8c569cef88)] - **doc**: remove GitHub mark (Rich Trott) [#&#8203;39251](https://github.com/nodejs/node/pull/39251)
-   \[[`b4a0c5a384`](https://github.com/nodejs/node/commit/b4a0c5a384)] - **doc**: remove emailing the TSC from offboarding doc (Rich Trott) [#&#8203;39280](https://github.com/nodejs/node/pull/39280)
-   \[[`a4d70ff0cc`](https://github.com/nodejs/node/commit/a4d70ff0cc)] - **doc**: use "repository" in guides versus repo (Michael Dawson) [#&#8203;39198](https://github.com/nodejs/node/pull/39198)
-   \[[`31163ed9ee`](https://github.com/nodejs/node/commit/31163ed9ee)] - **doc**: update Node-api version matrix (Michael Dawson) [#&#8203;39197](https://github.com/nodejs/node/pull/39197)
-   \[[`9357547519`](https://github.com/nodejs/node/commit/9357547519)] - **doc**: update node-api support matrix (Michael Dawson) [#&#8203;38424](https://github.com/nodejs/node/pull/38424)
-   \[[`f08e9d5230`](https://github.com/nodejs/node/commit/f08e9d5230)] - **doc**: remove onboarding-extras (Rich Trott) [#&#8203;39252](https://github.com/nodejs/node/pull/39252)
-   \[[`6466faf26d`](https://github.com/nodejs/node/commit/6466faf26d)] - **doc**: move Sam Ruby to emeritus (Rich Trott) [#&#8203;39264](https://github.com/nodejs/node/pull/39264)
-   \[[`06acbf6453`](https://github.com/nodejs/node/commit/06acbf6453)] - **doc**: update AUTHORS file (Rich Trott) [#&#8203;39250](https://github.com/nodejs/node/pull/39250)
-   \[[`9178805653`](https://github.com/nodejs/node/commit/9178805653)] - **doc**: fix color contrast for anchor marks in dark mode (Rich Trott) [#&#8203;39168](https://github.com/nodejs/node/pull/39168)
-   \[[`c6118b23f7`](https://github.com/nodejs/node/commit/c6118b23f7)] - **doc**: rename datatypes to data types (FrankEntriken) [#&#8203;39209](https://github.com/nodejs/node/pull/39209)
-   \[[`fdd315918f`](https://github.com/nodejs/node/commit/fdd315918f)] - **doc**: normalize CSS variable names and indentation (Rich Trott) [#&#8203;39199](https://github.com/nodejs/node/pull/39199)
-   \[[`9c7c44781c`](https://github.com/nodejs/node/commit/9c7c44781c)] - **doc**: use more consistent formatting for deprecations (Rich Trott) [#&#8203;39218](https://github.com/nodejs/node/pull/39218)
-   \[[`c97ebd7905`](https://github.com/nodejs/node/commit/c97ebd7905)] - **doc**: update AUTHORS (Rich Trott) [#&#8203;39217](https://github.com/nodejs/node/pull/39217)
-   \[[`c4a3a24848`](https://github.com/nodejs/node/commit/c4a3a24848)] - **doc**: use "pull request" instead of "PR" in packages.md (Rich Trott) [#&#8203;39213](https://github.com/nodejs/node/pull/39213)
-   \[[`0d098bfaf0`](https://github.com/nodejs/node/commit/0d098bfaf0)] - **doc**: move v8.stopCoverage() to expected location in doc (Rich Trott) [#&#8203;39212](https://github.com/nodejs/node/pull/39212)
-   \[[`bd6af78749`](https://github.com/nodejs/node/commit/bd6af78749)] - **doc**: move vm.measureMemory() to expected location in doc (Rich Trott) [#&#8203;39211](https://github.com/nodejs/node/pull/39211)
-   \[[`7378b84bb8`](https://github.com/nodejs/node/commit/7378b84bb8)] - **doc**: add missing deprecation code (Colin Ihrig) [#&#8203;37147](https://github.com/nodejs/node/pull/37147)
-   \[[`2f6861ca51`](https://github.com/nodejs/node/commit/2f6861ca51)] - **doc**: use ASCII order for md refs (Antoine du Hamel) [#&#8203;39170](https://github.com/nodejs/node/pull/39170)
-   \[[`fa3909504f`](https://github.com/nodejs/node/commit/fa3909504f)] - **doc**: add cc oss-security@lists.openwall.com (Daniel Bevenius) [#&#8203;39191](https://github.com/nodejs/node/pull/39191)
-   \[[`52105acd5f`](https://github.com/nodejs/node/commit/52105acd5f)] - **doc**: remove instructions for unsupported Node.js versions (Rich Trott) [#&#8203;39185](https://github.com/nodejs/node/pull/39185)
-   \[[`eb2d75da16`](https://github.com/nodejs/node/commit/eb2d75da16)] - **doc**: remove obsolete cc recommendations (Rich Trott) [#&#8203;39181](https://github.com/nodejs/node/pull/39181)
-   \[[`4cf17edd03`](https://github.com/nodejs/node/commit/4cf17edd03)] - **doc**: use "repository" in maintaining-V8 doc (Rich Trott) [#&#8203;39179](https://github.com/nodejs/node/pull/39179)
-   \[[`d6a4f8aac9`](https://github.com/nodejs/node/commit/d6a4f8aac9)] - **doc**: fix broken link in errors.md (Rich Trott) [#&#8203;39200](https://github.com/nodejs/node/pull/39200)
-   \[[`82458b30fe`](https://github.com/nodejs/node/commit/82458b30fe)] - **doc**: correct JavaScript primitive value names in n-api.md (legendecas) [#&#8203;39129](https://github.com/nodejs/node/pull/39129)
-   \[[`2629979fd0`](https://github.com/nodejs/node/commit/2629979fd0)] - **doc**: apply logical ordering to CSS variables (Rich Trott) [#&#8203;39169](https://github.com/nodejs/node/pull/39169)
-   \[[`1996580b06`](https://github.com/nodejs/node/commit/1996580b06)] - **doc**: use repository instead of repo (Rich Trott) [#&#8203;39157](https://github.com/nodejs/node/pull/39157)
-   \[[`74ba115ab6`](https://github.com/nodejs/node/commit/74ba115ab6)] - **doc**: fix `EventTarget.dispatchEvent` docs (Rohan Sharma) [#&#8203;39127](https://github.com/nodejs/node/pull/39127)
-   \[[`2884d9094d`](https://github.com/nodejs/node/commit/2884d9094d)] - **doc**: update AUTHORS file (Rich Trott) [#&#8203;39082](https://github.com/nodejs/node/pull/39082)
-   \[[`d069c725b1`](https://github.com/nodejs/node/commit/d069c725b1)] - **doc**: fix napi_default_property name (Davidson Francis) [#&#8203;39104](https://github.com/nodejs/node/pull/39104)
-   \[[`1b74d3f775`](https://github.com/nodejs/node/commit/1b74d3f775)] - **doc**: fix dead links in packages.md (Michaël Zasso) [#&#8203;39113](https://github.com/nodejs/node/pull/39113)
-   \[[`0c2b5a048d`](https://github.com/nodejs/node/commit/0c2b5a048d)] - **doc**: clearify that http does chunked encoding itself (Mao Wtm) [#&#8203;28379](https://github.com/nodejs/node/pull/28379)
-   \[[`d0d731e271`](https://github.com/nodejs/node/commit/d0d731e271)] - **doc**: add descriptions about when `options.mode` is ignored (Ray) [#&#8203;39881](https://github.com/nodejs/node/pull/39881)
-   \[[`898db5a570`](https://github.com/nodejs/node/commit/898db5a570)] - **doc**: add code example to `fs.truncate` method (Juan José Arb…
calbearox added a commit to calbearox/calbearox that referenced this pull request Feb 15, 2022
# Modules: ECMAScript modules <!--introduced_in=v8.5.0--> <!-- type=misc --> <!-- YAML added: v8.5.0 changes: - version: v17.1.0 pr-url: https://github.com/nodejs/node/pull/40250 description: Add support for import assertions. - version: - v17.0.0 pr-url: https://github.com/nodejs/node/pull/37468 description: Consolidate loader hooks, removed `getFormat`, `getSource`, `transformSource`, and `getGlobalPreloadCode` hooks added `load` and `globalPreload` hooks allowed returning `format` from either `resolve` or `load` hooks. - version: - v15.3.0 - v14.17.0 - v12.22.0 pr-url: https://github.com/nodejs/node/pull/35781 description: Stabilize modules implementation. - version: - v14.13.0 - v12.20.0 pr-url: https://github.com/nodejs/node/pull/35249 description: Support for detection of CommonJS named exports. - version: v14.8.0 pr-url: https://github.com/nodejs/node/pull/34558 description: Unflag Top-Level Await. - version: - v14.0.0 - v13.14.0 - v12.20.0 pr-url: https://github.com/nodejs/node/pull/31974 description: Remove experimental modules warning. - version: - v13.2.0 - v12.17.0 pr-url: https://github.com/nodejs/node/pull/29866 description: Loading ECMAScript modules no longer requires a command-line flag. - version: v12.0.0 pr-url: https://github.com/nodejs/node/pull/26745 description: Add support for ES modules using `.js` file extension via `package.json` `"type"` field. --> > Stability: 2 - Stable ## Introduction <!--name=esm--> ECMAScript modules are [the official standard format][] to package JavaScript code for reuse. Modules are defined using a variety of [`import`][] and [`export`][] statements. The following example of an ES module exports a function: ```js // addTwo.mjs function addTwo(num) { return num + 2; } export { addTwo }; ``` The following example of an ES module imports the function from `addTwo.mjs`: ```js // app.mjs import { addTwo } from './addTwo.mjs'; // Prints: 6 console.log(addTwo(4)); ``` Node.js fully supports ECMAScript modules as they are currently specified and provides interoperability between them and its original module format, [CommonJS][]. <!-- Anchors to make sure old links find a target --> <i id="esm_package_json_type_field"></i><i id="esm_package_scope_and_file_extensions"></i><i id="esm_input_type_flag"></i> ## Enabling <!-- type=misc --> Node.js has two module systems: [CommonJS][] modules and ECMAScript modules. Authors can tell Node.js to use the ECMAScript modules loader via the `.mjs` file extension, the `package.json` [`"type"`][] field, or the [`--input-type`][] flag. Outside of those cases, Node.js will use the CommonJS module loader. See [Determining module system][] for more details. <!-- Anchors to make sure old links find a target --> <i id="esm_package_entry_points"></i><i id="esm_main_entry_point_export"></i><i id="esm_subpath_exports"></i><i id="esm_package_exports_fallbacks"></i><i id="esm_exports_sugar"></i><i id="esm_conditional_exports"></i><i id="esm_nested_conditions"></i><i id="esm_self_referencing_a_package_using_its_name"></i><i id="esm_internal_package_imports"></i><i id="esm_dual_commonjs_es_module_packages"></i><i id="esm_dual_package_hazard"></i><i id="esm_writing_dual_packages_while_avoiding_or_minimizing_hazards"></i><i id="esm_approach_1_use_an_es_module_wrapper"></i><i id="esm_approach_2_isolate_state"></i> ## Packages This section was moved to [Modules: Packages](packages.md). ## `import` Specifiers ### Terminology The _specifier_ of an `import` statement is the string after the `from` keyword, e.g. `'path'` in `import { sep } from 'path'`. Specifiers are also used in `export from` statements, and as the argument to an `import()` expression. There are three types of specifiers: * _Relative specifiers_ like `'./startup.js'` or `'../config.mjs'`. They refer to a path relative to the location of the importing file. _The file extension is always necessary for these._ * _Bare specifiers_ like `'some-package'` or `'some-package/shuffle'`. They can refer to the main entry point of a package by the package name, or a specific feature module within a package prefixed by the package name as per the examples respectively. _Including the file extension is only necessary for packages without an [`"exports"`][] field._ * _Absolute specifiers_ like `'file:///opt/nodejs/config.js'`. They refer directly and explicitly to a full path. Bare specifier resolutions are handled by the [Node.js module resolution algorithm][]. All other specifier resolutions are always only resolved with the standard relative [URL][] resolution semantics. Like in CommonJS, module files within packages can be accessed by appending a path to the package name unless the package’s [`package.json`][] contains an [`"exports"`][] field, in which case files within packages can only be accessed via the paths defined in [`"exports"`][]. For details on these package resolution rules that apply to bare specifiers in the Node.js module resolution, see the [packages documentation](packages.md). ### Mandatory file extensions A file extension must be provided when using the `import` keyword to resolve relative or absolute specifiers. Directory indexes (e.g. `'./startup/index.js'`) must also be fully specified. This behavior matches how `import` behaves in browser environments, assuming a typically configured server. ### URLs ES modules are resolved and cached as URLs. This means that special characters must be [percent-encoded][], such as `#` with `%23` and `?` with `%3F`. `file:`, `node:`, and `data:` URL schemes are supported. A specifier like `'https://example.com/app.js'` is not supported natively in Node.js unless using a [custom HTTPS loader][]. #### `file:` URLs Modules are loaded multiple times if the `import` specifier used to resolve them has a different query or fragment. ```js import './foo.mjs?query=1'; // loads ./foo.mjs with query of "?query=1" import './foo.mjs?query=2'; // loads ./foo.mjs with query of "?query=2" ``` The volume root may be referenced via `/`, `//` or `file:///`. Given the differences between [URL][] and path resolution (such as percent encoding details), it is recommended to use [url.pathToFileURL][] when importing a path. #### `data:` Imports <!-- YAML added: v12.10.0 --> [`data:` URLs][] are supported for importing with the following MIME types: * `text/javascript` for ES Modules * `application/json` for JSON * `application/wasm` for Wasm `data:` URLs only resolve [_Bare specifiers_][Terminology] for builtin modules and [_Absolute specifiers_][Terminology]. Resolving [_Relative specifiers_][Terminology] does not work because `data:` is not a [special scheme][]. For example, attempting to load `./foo` from `data:text/javascript,import "./foo";` fails to resolve because there is no concept of relative resolution for `data:` URLs. An example of a `data:` URLs being used is: ```js import 'data:text/javascript,console.log("hello!");'; import _ from 'data:application/json,"world!"'; ``` #### `node:` Imports <!-- YAML added: - v14.13.1 - v12.20.0 changes: - version: - v16.0.0 - v14.18.0 pr-url: https://github.com/nodejs/node/pull/37246 description: Added `node:` import support to `require(...)`. --> `node:` URLs are supported as an alternative means to load Node.js builtin modules. This URL scheme allows for builtin modules to be referenced by valid absolute URL strings. ```js import fs from 'node:fs/promises'; ``` ## Import assertions <!-- YAML added: v17.1.0 --> > Stability: 1 - Experimental The [Import Assertions proposal][] adds an inline syntax for module import statements to pass on more information alongside the module specifier. ```js import fooData from './foo.json' assert { type: 'json' }; const { default: barData } = await import('./bar.json', { assert: { type: 'json' } }); ``` Node.js supports the following `type` values, for which the assertion is mandatory: | Assertion `type` | Needed for | | ---------------- | ---------------- | | `'json'` | [JSON modules][] | ## Builtin modules [Core modules][] provide named exports of their public API. A default export is also provided which is the value of the CommonJS exports. The default export can be used for, among other things, modifying the named exports. Named exports of builtin modules are updated only by calling [`module.syncBuiltinESMExports()`][]. ```js import EventEmitter from 'events'; const e = new EventEmitter(); ``` ```js import { readFile } from 'fs'; readFile('./foo.txt', (err, source) => { if (err) { console.error(err); } else { console.log(source); } }); ``` ```js import fs, { readFileSync } from 'fs'; import { syncBuiltinESMExports } from 'module'; import { Buffer } from 'buffer'; fs.readFileSync = () => Buffer.from('Hello, ESM'); syncBuiltinESMExports(); fs.readFileSync === readFileSync; ``` ## `import()` expressions [Dynamic `import()`][] is supported in both CommonJS and ES modules. In CommonJS modules it can be used to load ES modules. ## `import.meta` * {Object} The `import.meta` meta property is an `Object` that contains the following properties. ### `import.meta.url` * {string} The absolute `file:` URL of the module. This is defined exactly the same as it is in browsers providing the URL of the current module file. This enables useful patterns such as relative file loading: ```js import { readFileSync } from 'fs'; const buffer = readFileSync(new URL('./data.proto', import.meta.url)); ``` ### `import.meta.resolve(specifier[, parent])` <!-- added: - v13.9.0 - v12.16.2 changes: - version: - v16.2.0 - v14.18.0 pr-url: https://github.com/nodejs/node/pull/38587 description: Add support for WHATWG `URL` object to `parentURL` parameter. --> > Stability: 1 - Experimental This feature is only available with the `--experimental-import-meta-resolve` command flag enabled. * `specifier` {string} The module specifier to resolve relative to `parent`. * `parent` {string|URL} The absolute parent module URL to resolve from. If none is specified, the value of `import.meta.url` is used as the default. * Returns: {Promise} Provides a module-relative resolution function scoped to each module, returning the URL string. <!-- eslint-skip --> ```js const dependencyAsset = await import.meta.resolve('component-lib/asset.css'); ``` `import.meta.resolve` also accepts a second argument which is the parent module from which to resolve from: <!-- eslint-skip --> ```js await import.meta.resolve('./dep', import.meta.url); ``` This function is asynchronous because the ES module resolver in Node.js is allowed to be asynchronous. ## Interoperability with CommonJS ### `import` statements An `import` statement can reference an ES module or a CommonJS module. `import` statements are permitted only in ES modules, but dynamic [`import()`][] expressions are supported in CommonJS for loading ES modules. When importing [CommonJS modules](#commonjs-namespaces), the `module.exports` object is provided as the default export. Named exports may be available, provided by static analysis as a convenience for better ecosystem compatibility. ### `require` The CommonJS module `require` always treats the files it references as CommonJS. Using `require` to load an ES module is not supported because ES modules have asynchronous execution. Instead, use [`import()`][] to load an ES module from a CommonJS module. ### CommonJS Namespaces CommonJS modules consist of a `module.exports` object which can be of any type. When importing a CommonJS module, it can be reliably imported using the ES module default import or its corresponding sugar syntax: <!-- eslint-disable no-duplicate-imports --> ```js import { default as cjs } from 'cjs'; // The following import statement is "syntax sugar" (equivalent but sweeter) // for `{ default as cjsSugar }` in the above import statement: import cjsSugar from 'cjs'; console.log(cjs); console.log(cjs === cjsSugar); // Prints: // <module.exports> // true ``` The ECMAScript Module Namespace representation of a CommonJS module is always a namespace with a `default` export key pointing to the CommonJS `module.exports` value. This Module Namespace Exotic Object can be directly observed either when using `import * as m from 'cjs'` or a dynamic import: <!-- eslint-skip --> ```js import * as m from 'cjs'; console.log(m); console.log(m === await import('cjs')); // Prints: // [Module] { default: <module.exports> } // true ``` For better compatibility with existing usage in the JS ecosystem, Node.js in addition attempts to determine the CommonJS named exports of every imported CommonJS module to provide them as separate ES module exports using a static analysis process. For example, consider a CommonJS module written: ```cjs // cjs.cjs exports.name = 'exported'; ``` The preceding module supports named imports in ES modules: <!-- eslint-disable no-duplicate-imports --> ```js import { name } from './cjs.cjs'; console.log(name); // Prints: 'exported' import cjs from './cjs.cjs'; console.log(cjs); // Prints: { name: 'exported' } import * as m from './cjs.cjs'; console.log(m); // Prints: [Module] { default: { name: 'exported' }, name: 'exported' } ``` As can be seen from the last example of the Module Namespace Exotic Object being logged, the `name` export is copied off of the `module.exports` object and set directly on the ES module namespace when the module is imported. Live binding updates or new exports added to `module.exports` are not detected for these named exports. The detection of named exports is based on common syntax patterns but does not always correctly detect named exports. In these cases, using the default import form described above can be a better option. Named exports detection covers many common export patterns, reexport patterns and build tool and transpiler outputs. See [cjs-module-lexer][] for the exact semantics implemented. ### Differences between ES modules and CommonJS #### No `require`, `exports` or `module.exports` In most cases, the ES module `import` can be used to load CommonJS modules. If needed, a `require` function can be constructed within an ES module using [`module.createRequire()`][]. #### No `__filename` or `__dirname` These CommonJS variables are not available in ES modules. `__filename` and `__dirname` use cases can be replicated via [`import.meta.url`][]. #### No Native Module Loading Native modules are not currently supported with ES module imports. They can instead be loaded with [`module.createRequire()`][] or [`process.dlopen`][]. #### No `require.resolve` Relative resolution can be handled via `new URL('./local', import.meta.url)`. For a complete `require.resolve` replacement, there is a flagged experimental [`import.meta.resolve`][] API. Alternatively `module.createRequire()` can be used. #### No `NODE_PATH` `NODE_PATH` is not part of resolving `import` specifiers. Please use symlinks if this behavior is desired. #### No `require.extensions` `require.extensions` is not used by `import`. The expectation is that loader hooks can provide this workflow in the future. #### No `require.cache` `require.cache` is not used by `import` as the ES module loader has its own separate cache. <i id="esm_experimental_json_modules"></i> ## JSON modules > Stability: 1 - Experimental JSON files can be referenced by `import`: ```js import packageConfig from './package.json' assert { type: 'json' }; ``` The `assert { type: 'json' }` syntax is mandatory; see [Import Assertions][]. The imported JSON only exposes a `default` export. There is no support for named exports. A cache entry is created in the CommonJS cache to avoid duplication. The same object is returned in CommonJS if the JSON module has already been imported from the same path. <i id="esm_experimental_wasm_modules"></i> ## Wasm modules > Stability: 1 - Experimental Importing WebAssembly modules is supported under the `--experimental-wasm-modules` flag, allowing any `.wasm` files to be imported as normal modules while also supporting their module imports. This integration is in line with the [ES Module Integration Proposal for WebAssembly][]. For example, an `index.mjs` containing: ```js import * as M from './module.wasm'; console.log(M); ``` executed under: ```bash node --experimental-wasm-modules index.mjs ``` would provide the exports interface for the instantiation of `module.wasm`. <i id="esm_experimental_top_level_await"></i> ## Top-level `await` <!-- YAML added: v14.8.0 --> > Stability: 1 - Experimental The `await` keyword may be used in the top level body of an ECMAScript module. Assuming an `a.mjs` with ```js export const five = await Promise.resolve(5); ``` And a `b.mjs` with ```js import { five } from './a.mjs'; console.log(five); // Logs `5` ``` ```bash node b.mjs # works ``` If a top level `await` expression never resolves, the `node` process will exit with a `13` [status code][]. ```js import { spawn } from 'child_process'; import { execPath } from 'process'; spawn(execPath, [ '--input-type=module', '--eval', // Never-resolving Promise: 'await new Promise(() => {})', ]).once('exit', (code) => { console.log(code); // Logs `13` }); ``` <i id="esm_experimental_loaders"></i> ## Loaders > Stability: 1 - Experimental **Note: This API is currently being redesigned and will still change.** <!-- type=misc --> To customize the default module resolution, loader hooks can optionally be provided via a `--experimental-loader ./loader-name.mjs` argument to Node.js. When hooks are used they apply to the entry point and all `import` calls. They won't apply to `require` calls; those still follow [CommonJS][] rules. ### Hooks #### `resolve(specifier, context, defaultResolve)` <!-- YAML changes: - version: v17.1.0 pr-url: https://github.com/nodejs/node/pull/40250 description: Add support for import assertions. --> > Note: The loaders API is being redesigned. This hook may disappear or its > signature may change. Do not rely on the API described below. * `specifier` {string} * `context` {Object} * `conditions` {string\[]} * `importAssertions` {Object} * `parentURL` {string|undefined} * `defaultResolve` {Function} The Node.js default resolver. * Returns: {Object} * `format` {string|null|undefined} `'builtin' | 'commonjs' | 'json' | 'module' | 'wasm'` * `url` {string} The absolute url to the import target (such as `file://…`) The `resolve` hook returns the resolved 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. The module specifier is the string in an `import` statement or `import()` expression, and the parent URL is the URL of the module that imported this one, or `undefined` if this is the main entry point for the application. The `conditions` property in `context` is an array of conditions for [package exports conditions][Conditional Exports] that apply to this resolution request. They can be used for looking up conditional mappings elsewhere or to modify the list when calling the default resolution logic. The current [package exports conditions][Conditional Exports] are always in the `context.conditions` array passed into the hook. To guarantee _default Node.js module specifier resolution behavior_ when calling `defaultResolve`, the `context.conditions` array passed to it _must_ include _all_ elements of the `context.conditions` array originally passed into the `resolve` hook. ```js /** * @param {string} specifier * @param {{ * conditions: string[], * parentURL: string | undefined, * }} context * @param {Function} defaultResolve * @returns {Promise<{ url: string }>} */ export async function resolve(specifier, context, defaultResolve) { const { parentURL = null } = context; if (Math.random() > 0.5) { // Some condition. // For some or all specifiers, do some custom logic for resolving. // Always return an object of the form {url: <string>}. return { url: parentURL ? new URL(specifier, parentURL).href : new URL(specifier).href, }; } if (Math.random() < 0.5) { // Another condition. // When calling `defaultResolve`, the arguments can be modified. In this // case it's adding another value for matching conditional exports. return defaultResolve(specifier, { ...context, conditions: [...context.conditions, 'another-condition'], }); } // Defer to Node.js for all other specifiers. return defaultResolve(specifier, context, defaultResolve); } ``` #### `load(url, context, defaultLoad)` > Note: The loaders API is being redesigned. This hook may disappear or its > signature may change. Do not rely on the API described below. > Note: In a previous version of this API, this was split across 3 separate, now > deprecated, hooks (`getFormat`, `getSource`, and `transformSource`). * `url` {string} * `context` {Object} * `format` {string|null|undefined} The format optionally supplied by the `resolve` hook. * `importAssertions` {Object} * `defaultLoad` {Function} * Returns: {Object} * `format` {string} * `source` {string|ArrayBuffer|TypedArray} 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. The final value of `format` must be one of the following: | `format` | Description | Acceptable types for `source` returned by `load` | | ------------ | ------------------------------ | ----------------------------------------------------- | | `'builtin'` | Load a Node.js builtin module | Not applicable | | `'commonjs'` | Load a Node.js CommonJS module | Not applicable | | `'json'` | Load a JSON file | { [`string`][], [`ArrayBuffer`][], [`TypedArray`][] } | | `'module'` | Load an ES module | { [`string`][], [`ArrayBuffer`][], [`TypedArray`][] } | | `'wasm'` | Load a WebAssembly module | { [`ArrayBuffer`][], [`TypedArray`][] } | The value of `source` is ignored for type `'builtin'` because currently it is not possible to replace the value of a Node.js builtin (core) module. The value of `source` is ignored for type `'commonjs'` because the CommonJS module loader does not provide a mechanism for the ES module loader to override the [CommonJS module return value](#commonjs-namespaces). This limitation might be overcome in the future. > **Caveat**: The ESM `load` hook and namespaced exports from CommonJS modules > are incompatible. Attempting to use them together will result in an empty > object from the import. This may be addressed in the future. > Note: These types all correspond to classes defined in ECMAScript. * The specific [`ArrayBuffer`][] object is a [`SharedArrayBuffer`][]. * The specific [`TypedArray`][] object is a [`Uint8Array`][]. If the source value of a text-based format (i.e., `'json'`, `'module'`) is not a string, it is converted to a string using [`util.TextDecoder`][]. The `load` hook provides a way to define a custom method for retrieving the source code of an ES module specifier. This would allow a loader to potentially avoid reading files from disk. It could also be used to map an unrecognized format to a supported one, for example `yaml` to `module`. ```js /** * @param {string} url * @param {{ format: string, }} context If resolve settled with a `format`, that value is included here. * @param {Function} defaultLoad * @returns {Promise<{ format: string, source: string | ArrayBuffer | SharedArrayBuffer | Uint8Array, }>} */ export async function load(url, context, defaultLoad) { const { format } = context; if (Math.random() > 0.5) { // Some condition. /* For some or all URLs, do some custom logic for retrieving the source. Always return an object of the form { format: <string>, source: <string|buffer>, }. */ return { format, source: '...', }; } // Defer to Node.js for all other URLs. return defaultLoad(url, context, defaultLoad); } ``` In a more advanced scenario, this can also be used to transform an unsupported source to a supported one (see [Examples](#examples) below). #### `globalPreload()` > Note: The loaders API is being redesigned. This hook may disappear or its > signature may change. Do not rely on the API described below. > Note: In a previous version of this API, this hook was named > `getGlobalPreloadCode`. * Returns: {string} Sometimes it might be necessary to run some code inside of the same global scope that the application runs in. This hook allows the return of a string that is run as a sloppy-mode script on startup. Similar to how CommonJS wrappers work, the code runs in an implicit function scope. The only argument is a `require`-like function that can be used to load builtins like "fs": `getBuiltin(request: string)`. If the code needs more advanced `require` features, it has to construct its own `require` using `module.createRequire()`. ```js /** * @param {{ port: MessagePort, }} utilities Things that preload code might find useful * @returns {string} Code to run before application startup */ export function globalPreload(utilities) { return `\ globalThis.someInjectedProperty = 42; console.log('I just set some globals!'); const { createRequire } = getBuiltin('module'); const { cwd } = getBuiltin('process'); const require = createRequire(cwd() + '/<preload>'); // [...] `; } ``` In order to allow communication between the application and the loader, another argument is provided to the preload code: `port`. This is available as a parameter to the loader hook and inside of the source text returned by the hook. Some care must be taken in order to properly call [`port.ref()`][] and [`port.unref()`][] to prevent a process from being in a state where it won't close normally. ```js /** * This example has the application context send a message to the loader * and sends the message back to the application context * @param {{ port: MessagePort, }} utilities Things that preload code might find useful * @returns {string} Code to run before application startup */ export function globalPreload({ port }) { port.onmessage = (evt) => { port.postMessage(evt.data); }; return `\ port.postMessage('console.log("I went to the Loader and back");'); port.onmessage = (evt) => { eval(evt.data); }; `; } ``` ### Examples The various loader hooks can be used together to accomplish wide-ranging customizations of Node.js’ code loading and evaluation behaviors. #### HTTPS loader In current Node.js, specifiers starting with `https://` are unsupported. The loader below registers hooks to enable rudimentary support for such specifiers. While this may seem like a significant improvement to Node.js core functionality, there are substantial downsides to actually using this loader: performance is much slower than loading files from disk, there is no caching, and there is no security. ```js // https-loader.mjs import { get } from 'https'; export function resolve(specifier, context, defaultResolve) { const { parentURL = null } = context; // Normally Node.js would error on specifiers starting with 'https://', so // this hook intercepts them and converts them into absolute URLs to be // passed along to the later hooks below. if (specifier.startsWith('https://')) { return { url: specifier }; } else if (parentURL && parentURL.startsWith('https://')) { return { url: new URL(specifier, parentURL).href }; } // Let Node.js handle all other specifiers. return defaultResolve(specifier, context, defaultResolve); } export function load(url, context, defaultLoad) { // For JavaScript to be loaded over the network, we need to fetch and // return it. if (url.startsWith('https://')) { return new Promise((resolve, reject) => { get(url, (res) => { let data = ''; res.on('data', (chunk) => data += chunk); res.on('end', () => resolve({ // This example assumes all network-provided JavaScript is ES module // code. format: 'module', source: data, })); }).on('error', (err) => reject(err)); }); } // Let Node.js handle all other URLs. return defaultLoad(url, context, defaultLoad); } ``` ```js // main.mjs import { VERSION } from 'https://coffeescript.org/browser-compiler-modern/coffeescript.js'; console.log(VERSION); ``` With the preceding loader, running `node --experimental-loader ./https-loader.mjs ./main.mjs` prints the current version of CoffeeScript per the module at the URL in `main.mjs`. #### Transpiler loader Sources that are in formats Node.js doesn’t understand can be converted into JavaScript using the [`load` hook][load hook]. Before that hook gets called, however, a [`resolve` hook][resolve hook] hook needs to tell Node.js not to throw an error on unknown file types. This is less performant than transpiling source files before running Node.js; a transpiler loader should only be used for development and testing purposes. ```js // coffeescript-loader.mjs import { readFile } from 'node:fs/promises'; import { dirname, extname, resolve as resolvePath } from 'node:path'; import { cwd } from 'node:process'; import { fileURLToPath, pathToFileURL } from 'node:url'; import CoffeeScript from 'coffeescript'; const baseURL = pathToFileURL(`${cwd()}/`).href; // CoffeeScript files end in .coffee, .litcoffee or .coffee.md. const extensionsRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/; export async function resolve(specifier, context, defaultResolve) { const { parentURL = baseURL } = context; // Node.js normally errors on unknown file extensions, so return a URL for // specifiers ending in the CoffeeScript file extensions. if (extensionsRegex.test(specifier)) { return { url: new URL(specifier, parentURL).href }; } // Let Node.js handle all other specifiers. return defaultResolve(specifier, context, defaultResolve); } export async function load(url, context, defaultLoad) { // Now that we patched resolve to let CoffeeScript URLs through, we need to // tell Node.js what format such URLs should be interpreted as. Because // CoffeeScript transpiles into JavaScript, it should be one of the two // JavaScript formats: 'commonjs' or 'module'. if (extensionsRegex.test(url)) { // CoffeeScript files can be either CommonJS or ES modules, so we want any // CoffeeScript file to be treated by Node.js the same as a .js file at the // same location. To determine how Node.js would interpret an arbitrary .js // file, search up the file system for the nearest parent package.json file // and read its "type" field. const format = await getPackageType(url); // When a hook returns a format of 'commonjs', `source` is be ignored. // To handle CommonJS files, a handler needs to be registered with // `require.extensions` in order to process the files with the CommonJS // loader. Avoiding the need for a separate CommonJS handler is a future // enhancement planned for ES module loaders. if (format === 'commonjs') { return { format }; } const { source: rawSource } = await defaultLoad(url, { format }); // This hook converts CoffeeScript source code into JavaScript source code // for all imported CoffeeScript files. const transformedSource = CoffeeScript.compile(rawSource.toString(), { bare: true, filename: url, }); return { format, source: transformedSource, }; } // Let Node.js handle all other URLs. return defaultLoad(url, context, defaultLoad); } async function getPackageType(url) { // `url` is only a file path during the first iteration when passed the // resolved url from the load() hook // an actual file path from load() will contain a file extension as it's // required by the spec // this simple truthy check for whether `url` contains a file extension will // work for most projects but does not cover some edge-cases (such as // extension-less files or a url ending in a trailing space) const isFilePath = !!extname(url); // If it is a file path, get the directory it's in const dir = isFilePath ? dirname(fileURLToPath(url)) : url; // Compose a file path to a package.json in the same directory, // which may or may not exist const packagePath = resolvePath(dir, 'package.json'); // Try to read the possibly nonexistent package.json const type = await readFile(packagePath, { encoding: 'utf8' }) .then((filestring) => JSON.parse(filestring).type) .catch((err) => { if (err?.code !== 'ENOENT') console.error(err); }); // Ff package.json existed and contained a `type` field with a value, voila if (type) return type; // Otherwise, (if not at the root) continue checking the next directory up // If at the root, stop and return false return dir.length > 1 && getPackageType(resolvePath(dir, '..')); } ``` ```coffee # main.coffee import { scream } from './scream.coffee' console.log scream 'hello, world' import { version } from 'process' console.log "Brought to you by Node.js version #{version}" ``` ```coffee # scream.coffee export scream = (str) -> str.toUpperCase() ``` With the preceding loader, running `node --experimental-loader ./coffeescript-loader.mjs main.coffee` causes `main.coffee` to be turned into JavaScript after its source code is loaded from disk but before Node.js executes it; and so on for any `.coffee`, `.litcoffee` or `.coffee.md` files referenced via `import` statements of any loaded file. ## Resolution algorithm ### Features The resolver has the following properties: * FileURL-based resolution as is used by ES modules * Support for builtin module loading * Relative and absolute URL resolution * No default extensions * No folder mains * Bare specifier package resolution lookup through node\_modules ### Resolver algorithm The algorithm to load an ES module specifier is given through the **ESM\_RESOLVE** method below. It returns the resolved URL for a module specifier relative to a parentURL. The algorithm to determine the module format of a resolved URL is provided by **ESM\_FORMAT**, which returns the unique module format for any file. The _"module"_ format is returned for an ECMAScript Module, while the _"commonjs"_ format is used to indicate loading through the legacy CommonJS loader. Additional formats such as _"addon"_ can be extended in future updates. In the following algorithms, all subroutine errors are propagated as errors of these top-level routines unless stated otherwise. _defaultConditions_ is the conditional environment name array, `["node", "import"]`. The resolver can throw the following errors: * _Invalid Module Specifier_: Module specifier is an invalid URL, package name or package subpath specifier. * _Invalid Package Configuration_: package.json configuration is invalid or contains an invalid configuration. * _Invalid Package Target_: Package exports or imports define a target module for the package that is an invalid type or string target. * _Package Path Not Exported_: Package exports do not define or permit a target subpath in the package for the given module. * _Package Import Not Defined_: Package imports do not define the specifier. * _Module Not Found_: The package or module requested does not exist. * _Unsupported Directory Import_: The resolved path corresponds to a directory, which is not a supported target for module imports. ### Resolver Algorithm Specification **ESM\_RESOLVE**(_specifier_, _parentURL_) > 1. Let _resolved_ be **undefined**. > 2. If _specifier_ is a valid URL, then > 1. Set _resolved_ to the result of parsing and reserializing > _specifier_ as a URL. > 3. Otherwise, if _specifier_ starts with _"/"_, _"./"_ or _"../"_, then > 1. Set _resolved_ to the URL resolution of _specifier_ relative to > _parentURL_. > 4. Otherwise, if _specifier_ starts with _"#"_, then > 1. Set _resolved_ to the result of > **PACKAGE\_IMPORTS\_RESOLVE**(_specifier_, > _parentURL_, _defaultConditions_). > 5. Otherwise, > 1. Note: _specifier_ is now a bare specifier. > 2. Set _resolved_ the result of > **PACKAGE\_RESOLVE**(_specifier_, _parentURL_). > 6. Let _format_ be **undefined**. > 7. If _resolved_ is a _"file:"_ URL, then > 1. If _resolved_ contains any percent encodings of _"/"_ or _"\\"_ (_"%2F"_ > and _"%5C"_ respectively), then > 1. Throw an _Invalid Module Specifier_ error. > 2. If the file at _resolved_ is a directory, then > 1. Throw an _Unsupported Directory Import_ error. > 3. If the file at _resolved_ does not exist, then > 1. Throw a _Module Not Found_ error. > 4. Set _resolved_ to the real path of _resolved_, maintaining the > same URL querystring and fragment components. > 5. Set _format_ to the result of **ESM\_FILE\_FORMAT**(_resolved_). > 8. Otherwise, > 1. Set _format_ the module format of the content type associated with the > URL _resolved_. > 9. Load _resolved_ as module format, _format_. **PACKAGE\_RESOLVE**(_packageSpecifier_, _parentURL_) > 1. Let _packageName_ be **undefined**. > 2. If _packageSpecifier_ is an empty string, then > 1. Throw an _Invalid Module Specifier_ error. > 3. If _packageSpecifier_ is a Node.js builtin module name, then > 1. Return the string _"node:"_ concatenated with _packageSpecifier_. > 4. If _packageSpecifier_ does not start with _"@"_, then > 1. Set _packageName_ to the substring of _packageSpecifier_ until the first > _"/"_ separator or the end of the string. > 5. Otherwise, > 1. If _packageSpecifier_ does not contain a _"/"_ separator, then > 1. Throw an _Invalid Module Specifier_ error. > 2. Set _packageName_ to the substring of _packageSpecifier_ > until the second _"/"_ separator or the end of the string. > 6. If _packageName_ starts with _"."_ or contains _"\\"_ or _"%"_, then > 1. Throw an _Invalid Module Specifier_ error. > 7. Let _packageSubpath_ be _"."_ concatenated with the substring of > _packageSpecifier_ from the position at the length of _packageName_. > 8. If _packageSubpath_ ends in _"/"_, then > 1. Throw an _Invalid Module Specifier_ error. > 9. Let _selfUrl_ be the result of > **PACKAGE\_SELF\_RESOLVE**(_packageName_, _packageSubpath_, _parentURL_). > 10. If _selfUrl_ is not **undefined**, return _selfUrl_. > 11. While _parentURL_ is not the file system root, > 1. Let _packageURL_ be the URL resolution of _"node\_modules/"_ > concatenated with _packageSpecifier_, relative to _parentURL_. > 2. Set _parentURL_ to the parent folder URL of _parentURL_. > 3. If the folder at _packageURL_ does not exist, then > 1. Continue the next loop iteration. > 4. Let _pjson_ be the result of **READ\_PACKAGE\_JSON**(_packageURL_). > 5. If _pjson_ is not **null** and _pjson_._exports_ is not **null** or > **undefined**, then > 1. Return the result of **PACKAGE\_EXPORTS\_RESOLVE**(_packageURL_, > _packageSubpath_, _pjson.exports_, _defaultConditions_). > 6. Otherwise, if _packageSubpath_ is equal to _"."_, then > 1. If _pjson.main_ is a string, then > 1. Return the URL resolution of _main_ in _packageURL_. > 7. Otherwise, > 1. Return the URL resolution of _packageSubpath_ in _packageURL_. > 12. Throw a _Module Not Found_ error. **PACKAGE\_SELF\_RESOLVE**(_packageName_, _packageSubpath_, _parentURL_) > 1. Let _packageURL_ be the result of **LOOKUP\_PACKAGE\_SCOPE**(_parentURL_). > 2. If _packageURL_ is **null**, then > 1. Return **undefined**. > 3. Let _pjson_ be the result of **READ\_PACKAGE\_JSON**(_packageURL_). > 4. If _pjson_ is **null** or if _pjson_._exports_ is **null** or > **undefined**, then > 1. Return **undefined**. > 5. If _pjson.name_ is equal to _packageName_, then > 1. Return the result of **PACKAGE\_EXPORTS\_RESOLVE**(_packageURL_, > _packageSubpath_, _pjson.exports_, _defaultConditions_). > 6. Otherwise, return **undefined**. **PACKAGE\_EXPORTS\_RESOLVE**(_packageURL_, _subpath_, _exports_, _conditions_) > 1. If _exports_ is an Object with both a key starting with _"."_ and a key not > starting with _"."_, throw an _Invalid Package Configuration_ error. > 2. If _subpath_ is equal to _"."_, then > 1. Let _mainExport_ be **undefined**. > 2. If _exports_ is a String or Array, or an Object containing no keys > starting with _"."_, then > 1. Set _mainExport_ to _exports_. > 3. Otherwise if _exports_ is an Object containing a _"."_ property, then > 1. Set _mainExport_ to _exports_\[_"."_]. > 4. If _mainExport_ is not **undefined**, then > 1. Let _resolved_ be the result of **PACKAGE\_TARGET\_RESOLVE**( > _packageURL_, _mainExport_, _""_, **false**, **false**, > _conditions_). > 2. If _resolved_ is not **null** or **undefined**, return _resolved_. > 3. Otherwise, if _exports_ is an Object and all keys of _exports_ start with > _"."_, then > 1. Let _matchKey_ be the string _"./"_ concatenated with _subpath_. > 2. Let _resolved_ be the result of **PACKAGE\_IMPORTS\_EXPORTS\_RESOLVE**( > _matchKey_, _exports_, _packageURL_, **false**, _conditions_). > 3. If _resolved_ is not **null** or **undefined**, return _resolved_. > 4. Throw a _Package Path Not Exported_ error. **PACKAGE\_IMPORTS\_RESOLVE**(_specifier_, _parentURL_, _conditions_) > 1. Assert: _specifier_ begins with _"#"_. > 2. If _specifier_ is exactly equal to _"#"_ or starts with _"#/"_, then > 1. Throw an _Invalid Module Specifier_ error. > 3. Let _packageURL_ be the result of **LOOKUP\_PACKAGE\_SCOPE**(_parentURL_). > 4. If _packageURL_ is not **null**, then > 1. Let _pjson_ be the result of **READ\_PACKAGE\_JSON**(_packageURL_). > 2. If _pjson.imports_ is a non-null Object, then > 1. Let _resolved_ be the result of > **PACKAGE\_IMPORTS\_EXPORTS\_RESOLVE**( > _specifier_, _pjson.imports_, _packageURL_, **true**, _conditions_). > 2. If _resolved_ is not **null** or **undefined**, return _resolved_. > 5. Throw a _Package Import Not Defined_ error. **PACKAGE\_IMPORTS\_EXPORTS\_RESOLVE**(_matchKey_, _matchObj_, _packageURL_, _isImports_, _conditions_) > 1. If _matchKey_ is a key of _matchObj_ and does not contain _"\*"_, then > 1. Let _target_ be the value of _matchObj_\[_matchKey_]. > 2. Return the result of **PACKAGE\_TARGET\_RESOLVE**(_packageURL_, > _target_, _""_, **false**, _isImports_, _conditions_). > 2. Let _expansionKeys_ be the list of keys of _matchObj_ containing only a > single _"\*"_, sorted by the sorting function **PATTERN\_KEY\_COMPARE** > which orders in descending order of specificity. > 3. For each key _expansionKey_ in _expansionKeys_, do > 1. Let _patternBase_ be the substring of _expansionKey_ up to but excluding > the first _"\*"_ character. > 2. If _matchKey_ starts with but is not equal to _patternBase_, then > 1. Let _patternTrailer_ be the substring of _expansionKey_ from the > index after the first _"\*"_ character. > 2. If _patternTrailer_ has zero length, or if _matchKey_ ends with > _patternTrailer_ and the length of _matchKey_ is greater than or > equal to the length of _expansionKey_, then > 1. Let _target_ be the value of _matchObj_\[_expansionKey_]. > 2. Let _subpath_ be the substring of _matchKey_ starting at the > index of the length of _patternBase_ up to the length of > _matchKey_ minus the length of _patternTrailer_. > 3. Return the result of **PACKAGE\_TARGET\_RESOLVE**(_packageURL_, > _target_, _subpath_, **true**, _isImports_, _conditions_). > 4. Return **null**. **PATTERN\_KEY\_COMPARE**(_keyA_, _keyB_) > 1. Assert: _keyA_ ends with _"/"_ or contains only a single _"\*"_. > 2. Assert: _keyB_ ends with _"/"_ or contains only a single _"\*"_. > 3. Let _baseLengthA_ be the index of _"\*"_ in _keyA_ plus one, if _keyA_ > contains _"\*"_, or the length of _keyA_ otherwise. > 4. Let _baseLengthB_ be the index of _"\*"_ in _keyB_ plus one, if _keyB_ > contains _"\*"_, or the length of _keyB_ otherwise. > 5. If _baseLengthA_ is greater than _baseLengthB_, return -1. > 6. If _baseLengthB_ is greater than _baseLengthA_, return 1. > 7. If _keyA_ does not contain _"\*"_, return 1. > 8. If _keyB_ does not contain _"\*"_, return -1. > 9. If the length of _keyA_ is greater than the length of _keyB_, return -1. > 10. If the length of _keyB_ is greater than the length of _keyA_, return 1. > 11. Return 0. **PACKAGE\_TARGET\_RESOLVE**(_packageURL_, _target_, _subpath_, _pattern_, _internal_, _conditions_) > 1. If _target_ is a String, then > 1. If _pattern_ is **false**, _subpath_ has non-zero length and _target_ > does not end with _"/"_, throw an _Invalid Module Specifier_ error. > 2. If _target_ does not start with _"./"_, then > 1. If _internal_ is **true** and _target_ does not start with _"../"_ or > _"/"_ and is not a valid URL, then > 1. If _pattern_ is **true**, then > 1. Return **PACKAGE\_RESOLVE**(_target_ with every instance of > _"\*"_ replaced by _subpath_, _packageURL_ + _"/"_). > 2. Return **PACKAGE\_RESOLVE**(_target_ + _subpath_, > _packageURL_ + _"/"_). > 2. Otherwise, throw an _Invalid Package Target_ error. > 3. If _target_ split on _"/"_ or _"\\"_ contains any _"."_, _".."_ or > _"node\_modules"_ segments after the first segment, case insensitive and > including percent encoded variants, throw an _Invalid Package Target_ > error. > 4. Let _resolvedTarget_ be the URL resolution of the concatenation of > _packageURL_ and _target_. > 5. Assert: _resolvedTarget_ is contained in _packageURL_. > 6. If _subpath_ split on _"/"_ or _"\\"_ contains any _"."_, _".."_ or > _"node\_modules"_ segments, case insensitive and including percent > encoded variants, throw an _Invalid Module Specifier_ error. > 7. If _pattern_ is **true**, then > 1. Return the URL resolution of _resolvedTarget_ with every instance of > _"\*"_ replaced with _subpath_. > 8. Otherwise, > 1. Return the URL resolution of the concatenation of _subpath_ and > _resolvedTarget_. > 2. Otherwise, if _target_ is a non-null Object, then > 1. If _exports_ contains any index property keys, as defined in ECMA-262 > [6.1.7 Array Index][], throw an _Invalid Package Configuration_ error. > 2. For each property _p_ of _target_, in object insertion order as, > 1. If _p_ equals _"default"_ or _conditions_ contains an entry for _p_, > then > 1. Let _targetValue_ be the value of the _p_ property in _target_. > 2. Let _resolved_ be the result of **PACKAGE\_TARGET\_RESOLVE**( > _packageURL_, _targetValue_, _subpath_, _pattern_, _internal_, > _conditions_). > 3. If _resolved_ is equal to **undefined**, continue the loop. > 4. Return _resolved_. > 3. Return **undefined**. > 3. Otherwise, if _target_ is an Array, then > 1. If \_target.length is zero, return **null**. > 2. For each item _targetValue_ in _target_, do > 1. Let _resolved_ be the result of **PACKAGE\_TARGET\_RESOLVE**( > _packageURL_, _targetValue_, _subpath_, _pattern_, _internal_, > _conditions_), continuing the loop on any _Invalid Package Target_ > error. > 2. If _resolved_ is **undefined**, continue the loop. > 3. Return _resolved_. > 3. Return or throw the last fallback resolution **null** return or error. > 4. Otherwise, if _target_ is _null_, return **null**. > 5. Otherwise throw an _Invalid Package Target_ error. **ESM\_FILE\_FORMAT**(_url_) > 1. Assert: _url_ corresponds to an existing file. > 2. If _url_ ends in _".mjs"_, then > 1. Return _"module"_. > 3. If _url_ ends in _".cjs"_, then > 1. Return _"commonjs"_. > 4. If _url_ ends in _".json"_, then > 1. Return _"json"_. > 5. Let _packageURL_ be the result of **LOOKUP\_PACKAGE\_SCOPE**(_url_). > 6. Let _pjson_ be the result of **READ\_PACKAGE\_JSON**(_packageURL_). > 7. If _pjson?.type_ exists and is _"module"_, then > 1. If _url_ ends in _".js"_, then > 1. Return _"module"_. > 2. Throw an _Unsupported File Extension_ error. > 8. Otherwise, > 1. Throw an _Unsupported File Extension_ error. **LOOKUP\_PACKAGE\_SCOPE**(_url_) > 1. Let _scopeURL_ be _url_. > 2. While _scopeURL_ is not the file system root, > 1. Set _scopeURL_ to the parent URL of _scopeURL_. > 2. If _scopeURL_ ends in a _"node\_modules"_ path segment, return **null**. > 3. Let _pjsonURL_ be the resolution of _"package.json"_ within > _scopeURL_. > 4. if the file at _pjsonURL_ exists, then > 1. Return _scopeURL_. > 3. Return **null**. **READ\_PACKAGE\_JSON**(_packageURL_) > 1. Let _pjsonURL_ be the resolution of _"package.json"_ within _packageURL_. > 2. If the file at _pjsonURL_ does not exist, then > 1. Return **null**. > 3. If the file at _packageURL_ does not parse as valid JSON, then > 1. Throw an _Invalid Package Configuration_ error. > 4. Return the parsed JSON source of the file at _pjsonURL_. ### Customizing ESM specifier resolution algorithm > Stability: 1 - Experimental The current specifier resolution does not support all default behavior of the CommonJS loader. One of the behavior differences is automatic resolution of file extensions and the ability to import directories that have an index file. The `--experimental-specifier-resolution=[mode]` flag can be used to customize the extension resolution algorithm. The default mode is `explicit`, which requires the full path to a module be provided to the loader. To enable the automatic extension resolution and importing from directories that include an index file use the `node` mode. ```console $ node index.mjs success! $ node index # Failure! Error: Cannot find module $ node --experimental-specifier-resolution=node index success! ``` <!-- Note: The cjs-module-lexer link should be kept in-sync with the deps version --> [6.1.7 Array Index]: https://tc39.es/ecma262/#integer-index [CommonJS]: modules.md [Conditional exports]: packages.md#conditional-exports [Core modules]: modules.md#core-modules [Determining module system]: packages.md#determining-module-system [Dynamic `import()`]: https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Dynamic_Imports [ES Module Integration Proposal for WebAssembly]: https://github.com/webassembly/esm-integration [Import Assertions]: #import-assertions [Import Assertions proposal]: https://github.com/tc39/proposal-import-assertions [JSON modules]: #json-modules [Node.js Module Resolution Algorithm]: #resolver-algorithm-specification [Terminology]: #terminology [URL]: https://url.spec.whatwg.org/ [`"exports"`]: packages.md#exports [`"type"`]: packages.md#type [`--input-type`]: cli.md#--input-typetype [`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer [`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer [`TypedArray`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray [`Uint8Array`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array [`data:` URLs]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs [`export`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export [`import()`]: #import-expressions [`import.meta.resolve`]: #importmetaresolvespecifier-parent [`import.meta.url`]: #importmetaurl [`import`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import [`module.createRequire()`]: module.md#modulecreaterequirefilename [`module.syncBuiltinESMExports()`]: module.md#modulesyncbuiltinesmexports [`package.json`]: packages.md#nodejs-packagejson-field-definitions [`port.ref()`]: https://nodejs.org/dist/latest-v17.x/docs/api/worker_threads.html#portref [`port.unref()`]: https://nodejs.org/dist/latest-v17.x/docs/api/worker_threads.html#portunref [`process.dlopen`]: process.md#processdlopenmodule-filename-flags [`string`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String [`util.TextDecoder`]: util.md#class-utiltextdecoder [cjs-module-lexer]: https://github.com/nodejs/cjs-module-lexer/tree/1.2.2 [custom https loader]: #https-loader [load hook]: #loadurl-context-defaultload [percent-encoded]: url.md#percent-encoding-in-urls [resolve hook]: #resolvespecifier-context-defaultresolve [special scheme]: https://url.spec.whatwg.org/#special-scheme [status code]: process.md#exit-codes [the official standard format]: https://tc39.github.io/ecma262/#sec-modules [url.pathToFileURL]: url.md#urlpathtofileurlpath
DeeDeeG added a commit to DeeDeeG/node that referenced this pull request Jul 11, 2022
Support for the 'node:' prefixed builtin module namespace was introduced
for `require()` expressions in Node v16.0.0, and backported to v14.18.0.
This was never supported in Node v15.x or chronologically older.

All of the current API history notes in the docs using 'node:' prefixed
module `require()`s happen to be documenting changes in Node versions
from before the time when support was first introduced.

This commit reverts those `require()`s in the history notes to be
un-prefixed. (They were incorrect as written; The prefixed `require()`s
would not work for those older Node versions.)

This change prevents the API history notes from inaccurately implying
'node:' prefixed builtin modules were introduced many Node versions ago,
or were `require()`-able with the 'node:' prefix in those Node versions.

Refs: nodejs#35387
Refs: nodejs#37246
Refs: nodejs#42752
nodejs-github-bot pushed a commit that referenced this pull request Jul 14, 2022
Support for the 'node:' prefixed builtin module namespace was introduced
for `require()` expressions in Node v16.0.0, and backported to v14.18.0.
This was never supported in Node v15.x or chronologically older.

All of the current API history notes in the docs using 'node:' prefixed
module `require()`s happen to be documenting changes in Node versions
from before the time when support was first introduced.

This commit reverts those `require()`s in the history notes to be
un-prefixed. (They were incorrect as written; The prefixed `require()`s
would not work for those older Node versions.)

This change prevents the API history notes from inaccurately implying
'node:' prefixed builtin modules were introduced many Node versions ago,
or were `require()`-able with the 'node:' prefix in those Node versions.

Refs: #35387
Refs: #37246
Refs: #42752

PR-URL: #43768
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
danielleadams pushed a commit that referenced this pull request Jul 26, 2022
Support for the 'node:' prefixed builtin module namespace was introduced
for `require()` expressions in Node v16.0.0, and backported to v14.18.0.
This was never supported in Node v15.x or chronologically older.

All of the current API history notes in the docs using 'node:' prefixed
module `require()`s happen to be documenting changes in Node versions
from before the time when support was first introduced.

This commit reverts those `require()`s in the history notes to be
un-prefixed. (They were incorrect as written; The prefixed `require()`s
would not work for those older Node versions.)

This change prevents the API history notes from inaccurately implying
'node:' prefixed builtin modules were introduced many Node versions ago,
or were `require()`-able with the 'node:' prefix in those Node versions.

Refs: #35387
Refs: #37246
Refs: #42752

PR-URL: #43768
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos pushed a commit that referenced this pull request Jul 31, 2022
Support for the 'node:' prefixed builtin module namespace was introduced
for `require()` expressions in Node v16.0.0, and backported to v14.18.0.
This was never supported in Node v15.x or chronologically older.

All of the current API history notes in the docs using 'node:' prefixed
module `require()`s happen to be documenting changes in Node versions
from before the time when support was first introduced.

This commit reverts those `require()`s in the history notes to be
un-prefixed. (They were incorrect as written; The prefixed `require()`s
would not work for those older Node versions.)

This change prevents the API history notes from inaccurately implying
'node:' prefixed builtin modules were introduced many Node versions ago,
or were `require()`-able with the 'node:' prefix in those Node versions.

Refs: #35387
Refs: #37246
Refs: #42752

PR-URL: #43768
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
Support for the 'node:' prefixed builtin module namespace was introduced
for `require()` expressions in Node v16.0.0, and backported to v14.18.0.
This was never supported in Node v15.x or chronologically older.

All of the current API history notes in the docs using 'node:' prefixed
module `require()`s happen to be documenting changes in Node versions
from before the time when support was first introduced.

This commit reverts those `require()`s in the history notes to be
un-prefixed. (They were incorrect as written; The prefixed `require()`s
would not work for those older Node versions.)

This change prevents the API history notes from inaccurately implying
'node:' prefixed builtin modules were introduced many Node versions ago,
or were `require()`-able with the 'node:' prefix in those Node versions.

Refs: nodejs/node#35387
Refs: nodejs/node#37246
Refs: nodejs/node#42752

PR-URL: nodejs/node#43768
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module Issues and PRs related to the module subsystem. notable-change PRs with changes that should be highlighted in changelogs. review wanted PRs that need reviews. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for node:‑prefixed imports of built‑in modules to require(…)