Marco Ippolito
76f82824bf
2025-06-23, Version 20.19.3 'Iron' (LTS)
...
Notable changes:
crypto:
* graduate WebCryptoAPI Ed25519 and X25519 algorithms as stable (Filip Skokan) https://github.com/nodejs/node/pull/56142
* update root certificates to NSS 3.108 (Node.js GitHub Bot) https://github.com/nodejs/node/pull/57381
deps:
* update timezone to 2025b (Node.js GitHub Bot) https://github.com/nodejs/node/pull/57857
doc:
* add dario-piotrowicz to collaborators (Dario Piotrowicz) https://github.com/nodejs/node/pull/58102
PR-URL: https://github.com/nodejs/node/pull/58588
2025-06-20 07:22:15 +02:00
Dario Piotrowicz
791e4879de
doc: document REPL custom eval arguments
...
PR-URL: https://github.com/nodejs/node/pull/57690
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-06-11 09:21:22 +02:00
Alessandro Miliucci
2917f09876
doc: improved fetch docs
...
PR-URL: https://github.com/nodejs/node/pull/57296
Refs: https://undici.nodejs.org
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-06-11 09:21:22 +02:00
Dario Piotrowicz
d940b15843
doc: clarify unhandledRejection events behaviors in process doc
...
PR-URL: https://github.com/nodejs/node/pull/57654
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-06-11 09:21:21 +02:00
Yukihiro Hasegawa
71c664fab7
doc: update position type to integer | null in fs
...
PR-URL: https://github.com/nodejs/node/pull/57745
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-06-11 09:21:20 +02:00
René
e99462c9fc
doc: correct deprecation type of assert.CallTracker
...
PR-URL: https://github.com/nodejs/node/pull/57997
Refs: https://github.com/nodejs/node/pull/47740
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2025-06-10 14:32:58 +02:00
Eng Zer Jun
c7e92696ef
doc: add returns for https.get
...
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/58025
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2025-06-10 14:32:58 +02:00
Antoine du Hamel
ccc42b69ce
doc: fix env variable name in util.styleText
...
PR-URL: https://github.com/nodejs/node/pull/58072
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2025-06-10 14:32:58 +02:00
Naor Tedgi (Abu Emma)
e5d6a3df16
doc: fix AsyncLocalStorage example response changes after node v18
...
PR-URL: https://github.com/nodejs/node/pull/57969
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2025-06-10 14:32:57 +02:00
yusheng chen
f006411998
doc: fix typo of file zlib.md
...
PR-URL: https://github.com/nodejs/node/pull/58093
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2025-06-10 14:32:57 +02:00
Jimmy Leung
5193735df4
doc: add missing options.signal to readlinePromises.createInterface()
...
From the source code, `readlinePromises.createInterface()` calls
`new Interface()` imported from `internal/readline/interface`, which
works the same as the non-promise version. If non-promise version
accepts options.signal, it should also work for
`readlinePromises.createInterface()`. Hence this information need to be
indicated in the documentation.
Refs: https://github.com/nodejs/node/blob/main/lib/readline/promises.js
PR-URL: https://github.com/nodejs/node/pull/55456
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2025-06-10 14:32:57 +02:00
Jimmy Leung
fd44af730f
doc: fix misaligned options in vm.compileFunction()
...
Current alignment mislead doc reader into thinking
`importModuleDynamically` is a separate positional param right next to
`options`, which is incorrect and need to be fixed.
This misalignment is introduced in a PR merged in Feb 2024.
I belive this doc fix applies to node v20 and above.
Refs: https://github.com/nodejs/node/pull/51244
PR-URL: https://github.com/nodejs/node/pull/58145
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
2025-06-10 14:32:57 +02:00
Livia Medeiros
81342d10f0
doc: fix deprecation type for DEP0148
...
PR-URL: https://github.com/nodejs/node/pull/57785
Refs: https://github.com/nodejs/node/pull/40121
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-06-05 11:13:07 +02:00
Huáng Jùnliàng
776becfe01
doc: remove mention of --require not supporting ES modules
...
PR-URL: https://github.com/nodejs/node/pull/57620
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
Reviewed-By: Jordan Harband <ljharb@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2025-06-05 11:11:36 +02:00
Yukihiro Hasegawa
3140a8f133
doc: add missing deprecated badges in fs.md
...
PR-URL: https://github.com/nodejs/node/pull/57384
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2025-06-05 11:08:05 +02:00
Filip Skokan
c535a3c483
crypto: graduate WebCryptoAPI Ed25519 and X25519 algorithms as stable
...
PR-URL: https://github.com/nodejs/node/pull/56142
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2025-06-05 10:53:44 +02:00
Carlos Espa
441ce24ae3
doc: deprecate passing invalid types in fs.existsSync
...
PR-URL: https://github.com/nodejs/node/pull/55892
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Jason Zhang <xzha4350@gmail.com >
2025-06-05 10:46:08 +02:00
Filip Skokan
39925de8b1
crypto: allow non-multiple of 8 in SubtleCrypto.deriveBits
...
PR-URL: https://github.com/nodejs/node/pull/55296
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-06-05 10:04:41 +02:00
Paolo Insogna
190e45a291
deps: update llhttp to 9.1.2
...
PR-URL: https://github.com/nodejs/node/pull/48981
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
CVE-ID: CVE-2025-23167
2025-05-07 16:40:04 -03:00
Marco Ippolito
bb1a61d873
2025-03-13, Version 20.19.0 'Iron' (LTS)
...
Notable changes:
crypto:
* update root certificates to NSS 3.107 (Node.js GitHub Bot) https://github.com/nodejs/node/pull/56566
module:
* (SEMVER-MINOR) only emit require(esm) warning under --trace-require-module (Joyee Cheung) https://github.com/nodejs/node/pull/56194
* (SEMVER-MINOR) unflag --experimental-require-module (Joyee Cheung) https://github.com/nodejs/node/pull/55085
* (SEMVER-MINOR) implement the "module-sync" exports condition (Joyee Cheung) https://github.com/nodejs/node/pull/54648
* (SEMVER-MINOR) unflag detect-module (Geoffrey Booth) https://github.com/nodejs/node/pull/53619
* (SEMVER-MINOR) add __esModule to require()'d ESM (Joyee Cheung) https://github.com/nodejs/node/pull/52166
process:
* (SEMVER-MINOR) add process.features.require_module (Joyee Cheung) https://github.com/nodejs/node/pull/55241
worker:
* (SEMVER-MINOR) add postMessageToThread (Paolo Insogna) https://github.com/nodejs/node/pull/53682
PR-URL: https://github.com/nodejs/node/pull/57349
2025-03-07 19:00:08 +01:00
Robin Mehner
627f2997e3
doc: fix typo in example code for util.styleText
...
Code shows how to style `errorMessage`, but then
only logs out `successMessage` twice. This might
trip people up when copying the code.
PR-URL: https://github.com/nodejs/node/pull/56720
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2025-03-06 13:38:16 +01:00
Shreyans Pathak
68548dcb48
doc: fix inconsistencies in WeakSet and WeakMap comparison details
...
PR-URL: https://github.com/nodejs/node/pull/56683
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
Reviewed-By: Jason Zhang <xzha4350@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2025-03-06 13:38:15 +01:00
Dario Piotrowicz
e890c86d7b
doc: clarify cjs/esm diff in queueMicrotask() vs process.nextTick()
...
the section comparing `queueMicrotask()` and `process.nextTick()`
doesn't address the different scheduling behavior that the two
functions have in cjs and esm modules, the section's introductory mjs
example also provides an incorrect output, the changes here address
such by explaining the difference between the two module types and
updating the example accordingly
PR-URL: https://github.com/nodejs/node/pull/56659
Fixes: https://github.com/nodejs/node/issues/45048
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2025-03-06 13:38:14 +01:00
Shreyans Pathak
978263923f
doc: WeakSet and WeakMap comparison details
...
PR-URL: https://github.com/nodejs/node/pull/56648
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-03-06 13:38:14 +01:00
Pietro Marchini
e67a84902f
test_runner: remove unused errors
...
PR-URL: https://github.com/nodejs/node/pull/56607
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2025-03-06 13:38:12 +01:00
Tobias Nießen
acbbd7c1a6
doc: fix parentheses in options
...
PR-URL: https://github.com/nodejs/node/pull/56563
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
2025-03-06 13:38:09 +01:00
Alfredo González
ff8af58046
doc: add esm examples to node:trace_events
...
PR-URL: https://github.com/nodejs/node/pull/56514
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2025-03-06 13:38:08 +01:00
Gabriel Schulhof
1ef9c9a354
doc: add example for piping ReadableStream
...
When piping a `ReadableStream` created from an `Iterable` into a
`WritableStream`, the sequence of objects in the `Iterable` must
consist of either `Buffer`s, `TypedArray`s, or `DataView`s.
Re: https://github.com/nodejs/node/issues/56297
PR-URL: https://github.com/nodejs/node/pull/56415
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
2025-03-06 13:38:05 +01:00
Kevin Gibbons
e675c3a7fc
doc: expand description of parseArg's default
...
PR-URL: https://github.com/nodejs/node/pull/54431
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Jordan Harband <ljharb@gmail.com >
2025-03-06 13:38:05 +01:00
Joyee Cheung
8e76cc69e5
doc: move dual package shipping docs to separate repo
...
Refs: https://github.com/nodejs/admin/issues/917
Refs: https://github.com/nodejs/package-examples/pull/1
Refs: https://github.com/nodejs/node/pull/54648
PR-URL: https://github.com/nodejs/node/pull/55444
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-03-06 13:38:01 +01:00
Juan José
9fda8e29cd
doc: mark --env-file-if-exists flag as experimental
...
As `--env-file` is experimental, this must be marked as experimental as
well.
Refs: https://github.com/nodejs/node/issues/56887
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/56893
Backport-PR-URL: https://github.com/nodejs/node/pull/56932
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2025-03-06 08:58:03 +01:00
Bosco Domingo
b8c89a693e
src: add --env-file-if-exists flag
...
Fixes: https://github.com/nodejs/node/issues/50993
Refs: https://github.com/nodejs/node/issues/51451
test: remove unnecessary comment
src: conform to style guidelines
src: change flag to `--env-file-optional`
test: revert automatic linter changes
doc: fix typos
src: change flag to `--env-file-if-exists`
src: refactor `env_file_data` and `GetEnvFileDataFromArgs`
test: clean up tests
src: print error when file not found
test: remove unnecessary extras
PR-URL: https://github.com/nodejs/node/pull/53060
Backport-PR-URL: https://github.com/nodejs/node/pull/56932
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-03-06 08:57:59 +01:00
Paolo Insogna
73b5c16684
worker: add postMessageToThread
...
PR-URL: https://github.com/nodejs/node/pull/53682
Backport-PR-URL: https://github.com/nodejs/node/pull/57101
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2025-02-20 13:37:44 +01:00
Antoine du Hamel
9e975f1a7d
doc: fix link and history of SourceMap sections
...
PR-URL: https://github.com/nodejs/node/pull/57098
Backport-PR-URL: https://github.com/nodejs/node/pull/57129
Fixes: https://github.com/nodejs/node/issues/57094
Refs: https://github.com/nodejs/node/pull/48461
Refs: https://github.com/nodejs/node/pull/47790
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-02-20 13:35:15 +01:00
Joyee Cheung
de313b2336
module: only emit require(esm) warning under --trace-require-module
...
require(esm) is relatively stable now and the experimental warning
has run its course - it's now more troublesome than useful.
This patch changes it to no longer emit a warning unless
`--trace-require-module` is explicitly used. The flag supports
two modes:
- `--trace-require-module=all`: emit warnings for all usages
- `--trace-require-module=no-node-modules`: emit warnings for
usages that do not come from a `node_modules` folder.
PR-URL: https://github.com/nodejs/node/pull/56194
Backport-PR-URL: https://github.com/nodejs/node/pull/56927
Fixes: https://github.com/nodejs/node/issues/55417
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Refs: https://github.com/nodejs/node/issues/52697
2025-02-11 11:57:01 +01:00
Joyee Cheung
4fba01911d
process: add process.features.require_module
...
For detecting whether `require(esm)` is supported without triggering
the experimental warning.
PR-URL: https://github.com/nodejs/node/pull/55241
Backport-PR-URL: https://github.com/nodejs/node/pull/56927
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Refs: https://github.com/nodejs/node/issues/52697
2025-02-11 11:56:41 +01:00
Antoine du Hamel
64ce95b8fc
doc: update require(ESM) history and stability status
...
PR-URL: https://github.com/nodejs/node/pull/55199
Backport-PR-URL: https://github.com/nodejs/node/pull/56927
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Refs: https://github.com/nodejs/node/issues/52697
2025-02-11 11:56:37 +01:00
Guy Bedford
dc66632261
module: support 'module.exports' interop export in require(esm)
...
PR-URL: https://github.com/nodejs/node/pull/54563
Backport-PR-URL: https://github.com/nodejs/node/pull/56927
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Refs: https://github.com/nodejs/node/issues/52697
2025-02-11 11:56:34 +01:00
Joyee Cheung
1ac1dda9a4
module: unflag --experimental-require-module
...
This unflags --experimental-require-module so require(esm) can be
used without the flag. For now, when require() actually encounters
an ESM, it will still emit an experimental warning. To opt out
of the feature, --no-experimental-require-module can be used.
There are some tests specifically testing ERR_REQUIRE_ESM. Some
of them are repurposed to test --no-experimental-require-module.
Some of them are modified to just expect loading require(esm) to
work, when it's appropriate.
PR-URL: https://github.com/nodejs/node/pull/55085
Backport-PR-URL: https://github.com/nodejs/node/pull/56927
Refs: https://github.com/nodejs/node/issues/52697
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Michael Dawson <midawson@redhat.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
2025-02-11 11:56:31 +01:00
Joyee Cheung
df8a045afe
module: implement the "module-sync" exports condition
...
This patch implements a "module-sync" exports condition
for packages to supply a sycnrhonous ES module to the
Node.js module loader, no matter it's being required
or imported. This is similar to the "module" condition
that bundlers have been using to support `require(esm)`
in Node.js, and allows dual-package authors to opt into
ESM-first only newer versions of Node.js that supports
require(esm) while avoiding the dual-package hazard.
```json
{
"type": "module",
"exports": {
"node": {
// On new version of Node.js, both require() and import get
// the ESM version
"module-sync": "./index.js",
// On older version of Node.js, where "module" and
// require(esm) are not supported, use the transpiled CJS version
// to avoid dual-package hazard. Library authors can decide
// to drop support for older versions of Node.js when they think
// it's time.
"default": "./dist/index.cjs"
},
// On any other environment, use the ESM version.
"default": "./index.js"
}
}
```
We end up implementing a condition with a different name
instead of reusing "module", because existing code in the
ecosystem using the "module" condition sometimes also expect
the module resolution for these ESM files to work in CJS
style, which is supported by bundlers, but the native
Node.js loader has intentionally made ESM resolution
different from CJS resolution (e.g. forbidding `import
'./noext'` or `import './directory'`), so it would be
semver-major to implement a `"module"` condition
without implementing the forbidden ESM resolution rules.
For now, this just implments a new condition as semver-minor
so it can be backported to older LTS.
Refs: https://webpack.js.org/guides/package-exports/#target-environment-independent-packages
PR-URL: https://github.com/nodejs/node/pull/54648
Backport-PR-URL: https://github.com/nodejs/node/pull/56927
Fixes: https://github.com/nodejs/node/issues/52173
Refs: https://github.com/joyeecheung/test-module-condition
Refs: https://github.com/nodejs/node/issues/52697
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2025-02-11 11:56:26 +01:00
Geoffrey Booth
9916458b44
module: unflag detect-module
...
PR-URL: https://github.com/nodejs/node/pull/53619
Backport-PR-URL: https://github.com/nodejs/node/pull/56927
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Refs: https://github.com/nodejs/node/issues/52697
2025-02-11 11:56:12 +01:00
Joyee Cheung
f9dc1eaef5
module: add __esModule to require()'d ESM
...
Tooling in the ecosystem have been using the __esModule property to
recognize transpiled ESM in consuming code. For example, a 'log'
package written in ESM:
export function log(val) { console.log(val); }
Can be transpiled as:
exports.__esModule = true;
exports.default = function log(val) { console.log(val); }
The consuming code may be written like this in ESM:
import log from 'log'
Which gets transpiled to:
const _mod = require('log');
const log = _mod.__esModule ? _mod.default : _mod;
So to allow transpiled consuming code to recognize require()'d real ESM
as ESM and pick up the default exports, we add a __esModule property by
building a source text module facade for any module that has a default
export and add .__esModule = true to the exports. We don't do this to
modules that don't have default exports to avoid the unnecessary
overhead. This maintains the enumerability of the re-exported names
and the live binding of the exports.
The source of the facade is defined as a constant per-isolate property
required_module_facade_source_string, which looks like this
export * from 'original';
export { default } from 'original';
export const __esModule = true;
And the 'original' module request is always resolved by
createRequiredModuleFacade() to wrap which is a ModuleWrap wrapping
over the original module.
PR-URL: https://github.com/nodejs/node/pull/52166
Backport-PR-URL: https://github.com/nodejs/node/pull/56927
Refs: https://github.com/nodejs/node/issues/52134
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Refs: https://github.com/nodejs/node/issues/52697
2025-02-11 11:56:02 +01:00
Joyee Cheung
a03faf289d
module: support ESM detection in the CJS loader
...
This patch:
1. Adds ESM syntax detection to compileFunctionForCJSLoader()
for --experimental-detect-module and allow it to emit the
warning for how to load ESM when it's used to parse ESM as
CJS but detection is not enabled.
2. Moves the ESM detection of --experimental-detect-module for
the entrypoint from executeUserEntryPoint() into
Module.prototype._compile() and handle it directly in the
CJS loader so that the errors thrown during compilation *and
execution* during the loading of the entrypoint does not
need to be bubbled all the way up. If the entrypoint doesn't
parse as CJS, and detection is enabled, the CJS loader will
re-load the entrypoint as ESM on the spot asynchronously using
runEntryPointWithESMLoader() and cascadedLoader.import(). This
is fine for the entrypoint because unlike require(ESM) we don't
the namespace of the entrypoint synchronously, and can just
ignore the returned value. In this case process.mainModule is
reset to undefined as they are not available for ESM entrypoints.
3. Supports --experimental-detect-module for require(esm).
PR-URL: https://github.com/nodejs/node/pull/52047
Backport-PR-URL: https://github.com/nodejs/node/pull/56927
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Refs: https://github.com/nodejs/node/issues/52697
2025-02-11 11:55:46 +01:00
Antoine du Hamel
697a39248b
doc: fix history of process.features
...
PR-URL: https://github.com/nodejs/node/pull/54982
Backport-PR-URL: https://github.com/nodejs/node/pull/56948
Refs: https://github.com/nodejs/node/commit/aa0308d6182b2f7a2508373770952eefd2fdb0ac
Refs: https://github.com/nodejs/node/commit/9010f5fbab2695e6c0435db396f3e92118da6d76
Refs: https://github.com/nodejs/node/commit/52a40e0fd5f59b295fe9bb74e7f14b35ca4bf96c
Refs: https://github.com/nodejs/node/commit/b3ef289ffb7db476d284866658213f04415ea92d
Refs: https://github.com/nodejs/node/pull/2564
Refs: https://github.com/nodejs/node/pull/25819
Refs: https://github.com/nodejs/node/pull/27311
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
PR-URL: https://github.com/nodejs/node/pull/54897
Refs: https://github.com/nodejs/node/pull/54295
2025-02-10 15:34:03 +01:00
Marco Ippolito
7c38e503a3
doc: add documentation for process.features
...
PR-URL: https://github.com/nodejs/node/pull/54897
Backport-PR-URL: https://github.com/nodejs/node/pull/56948
Refs: https://github.com/nodejs/node/pull/54295
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2025-02-10 15:33:57 +01:00
Marco Ippolito
4819c99baa
2025-02-10, Version 20.18.3 'Iron' (LTS)
...
Notable changes:
crypto:
* update root certificates to NSS 3.104 (Richard Lau) https://github.com/nodejs/node/pull/55681
doc:
* add LJHarb to collaborators (Jordan Harband) https://github.com/nodejs/node/pull/56132
* enforce strict policy to semver-major releases (Rafael Gonzaga) https://github.com/nodejs/node/pull/55732
* add jazelly to collaborators (Jason Zhang) https://github.com/nodejs/node/pull/55531
esm:
* mark import attributes and JSON module as stable (Nicolò Ribaudo) https://github.com/nodejs/node/pull/55333
tools:
* fix root certificate updater (Richard Lau) https://github.com/nodejs/node/pull/55681
PR-URL: https://github.com/nodejs/node/pull/56699
2025-02-10 09:22:05 +01:00
Antoine du Hamel
f78508cd30
doc: add history info for Permission Model
...
PR-URL: https://github.com/nodejs/node/pull/56707
Backport-PR-URL: https://github.com/nodejs/node/pull/56724
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2025-01-24 22:18:59 +01:00
Antoine du Hamel
f07be5e3cd
doc: add note for features using InternalWorker with permission model
...
PR-URL: https://github.com/nodejs/node/pull/56706
Backport-PR-URL: https://github.com/nodejs/node/pull/56721
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2025-01-24 22:18:59 +01:00
Antoine du Hamel
618e005672
doc: add history entries for JSON modules stabilization
...
PR-URL: https://github.com/nodejs/node/pull/55855
Refs: https://github.com/nodejs/node/pull/55333
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Backport-PR-URL: https://github.com/nodejs/node/pull/55961
2025-01-24 22:18:59 +01:00
Nicolò Ribaudo
030f155986
esm: mark import attributes and JSON module as stable
...
The two proposals reached stage 4 at the October 2024 meeting.
PR-URL: https://github.com/nodejs/node/pull/55333
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Backport-PR-URL: https://github.com/nodejs/node/pull/55961
2025-01-24 22:18:59 +01:00