Giovanni Bucci
f6885e1c68
assert: fix the string length check for printing the simple diff
...
PR-URL: https://github.com/nodejs/node/pull/55474
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2024-11-27 11:03:39 -05:00
Gürgün Dayıoğlu
753cbede2a
lib: remove startsWith/endsWith primordials for char checks
...
PR-URL: https://github.com/nodejs/node/pull/55407
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Mattias Buelens <mattias@buelens.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2024-11-27 11:03:39 -05:00
Aviv Keller
6e3e99c81e
lib: prefer logical assignment
...
PR-URL: https://github.com/nodejs/node/pull/55044
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
2024-11-27 11:03:39 -05:00
Marco Ippolito
c81c818a21
module: throw ERR_NO_TYPESCRIPT when compiled without amaro
...
PR-URL: https://github.com/nodejs/node/pull/55332
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-11-27 11:03:39 -05:00
Xuguang Mei
907484f04d
assert: fix deepEqual always return true on URL
...
PR-URL: https://github.com/nodejs/node/pull/50853
Fixes: https://github.com/nodejs/node/issues/50836
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2024-11-27 11:03:39 -05:00
Yagiz Nizipli
03902ebb74
lib: replace createDeferredPromise util with Promise.withResolvers
...
PR-URL: https://github.com/nodejs/node/pull/54836
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2024-11-27 11:03:39 -05:00
Antoine du Hamel
6317f77942
url: refactor pathToFileURL to native
...
PR-URL: https://github.com/nodejs/node/pull/55476
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2024-11-27 11:03:38 -05:00
Antoine du Hamel and EarlyRiser42
5418d40256
url: handle "unsafe" characters properly in pathToFileURL
...
Co-authored-by: EarlyRiser42 <tkfydtls464@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/54545
Fixes: https://github.com/nodejs/node/issues/54515
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-11-27 11:03:38 -05:00
Antoine du Hamel
ee17fcd6f3
lib: prefer symbol to number in webidl type function
...
PR-URL: https://github.com/nodejs/node/pull/55737
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Jason Zhang <xzha4350@gmail.com >
2024-11-27 11:03:38 -05:00
Jason Zhang
18f0f07e92
lib: implement webidl dictionary converter and use it in structuredClone
...
This commit provides a factory to generate `dictionaryConverter`
compliant with the spec. The implemented factory function is used for
the `structuredClone` algorithm with updated test cases.
PR-URL: https://github.com/nodejs/node/pull/55489
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-11-27 11:03:38 -05:00
Jason Zhang
bcead24e24
lib: prefer number to string in webidl type function
...
PR-URL: https://github.com/nodejs/node/pull/55489
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-11-27 11:03:38 -05:00
Jason Zhang
d48c5da039
lib: convert transfer sequence to array in js
...
This commit lets `tranfer` passed to `structuredClone` get validated at
JS layer by doing webidl conversion. This avoids the C++ to JS function
call overhead in the native implementaiton of `structuredClone`
PR-URL: https://github.com/nodejs/node/pull/55317
Fixes: https://github.com/nodejs/node/issues/55280
Refs: https://github.com/nodejs/node/pull/50330
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
2024-11-27 11:03:38 -05:00
Antoine du Hamel
fce8c32c19
util: do not mark experimental feature as deprecated
...
PR-URL: https://github.com/nodejs/node/pull/55740
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2024-11-27 11:03:38 -05:00
Antoine du Hamel
301844e249
assert: differentiate cases where cause is undefined or missing
...
PR-URL: https://github.com/nodejs/node/pull/55738
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-11-27 11:03:37 -05:00
Edigleysson Silva (Edy)
89ccd3e3f4
assert: fix deepStrictEqual on errors when cause is not undefined
...
PR-URL: https://github.com/nodejs/node/pull/55406
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2024-11-27 11:03:37 -05:00
Giovanni Bucci and Pietro Marchini
4920869935
assert: make assertion_error use Myers diff algorithm
...
Fixes: https://github.com/nodejs/node/issues/51733
Co-Authored-By: Pietro Marchini <pietro.marchini94@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/54862
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-11-27 11:03:37 -05:00
Filip Skokan
c26b1bfe6a
crypto: allow length=0 for HKDF and PBKDF2 in SubtleCrypto.deriveBits
...
PR-URL: https://github.com/nodejs/node/pull/55866
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Jason Zhang <xzha4350@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2024-11-27 11:03:37 -05:00
Carlos Espa and Pietro Marchini
c17601557b
fs: prevent unwanted dependencyOwners removal
...
Remove files from watcher `dependencyOwners` on file change only if it
has no other owners.
Co-authored-by: Pietro Marchini <pietro.marchini94@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/55565
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-11-27 11:03:37 -05:00
Aviv Keller
363e7d5a76
test_runner: error on mocking an already mocked date
...
Fixes #55849
PR-URL: https://github.com/nodejs/node/pull/55858
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-11-27 11:03:37 -05:00
Ethan Arrowood
4dd609c685
fs: fix bufferSize option for opendir recursive
...
The bufferSize option was not respected in recursive mode. This PR
implements a naive solution to fix this issue until a better
implementation can be designed.
Fixes: https://github.com/nodejs/node/issues/48820
PR-URL: https://github.com/nodejs/node/pull/55744
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2024-11-27 11:03:34 -05:00
Gürgün Dayıoğlu
cefce4cbb0
lib: remove unnecessary optional chaining
...
PR-URL: https://github.com/nodejs/node/pull/55728
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2024-11-27 11:03:33 -05:00
Aviv Keller and Colin Ihrig
42ac0c2af3
util: do not catch on circular @@toStringTag errors
...
PR-URL: https://github.com/nodejs/node/pull/55544
Fixes: https://github.com/nodejs/node/issues/55539
Reviewed-By: James M Snell <jasnell@gmail.com >
Co-Authored-By: Colin Ihrig <cjihrig@gmail.com >
2024-11-27 11:03:32 -05:00
Joyee Cheung
d6d1479fcc
module: simplify --inspect-brk handling
...
Previously in the CommonJS loader, --inspect-brk is implemented
checking whether the module points to the result of re-resolving
process.argv[1] to determine whether the module is the entry point.
This is unnecessarily complex, especially now that we store that
information in the module as kIsMainSymbol. This patch updates
it to simply check that symbol property instead.
PR-URL: https://github.com/nodejs/node/pull/55679
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-11-27 11:03:30 -05:00
Filip Skokan
38c047e38f
src: refactor ECDHBitsJob signature
...
PR-URL: https://github.com/nodejs/node/pull/55610
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2024-11-27 11:03:28 -05:00
RafaelGSS
e14fb2defb
src,lib: optimize nodeTiming.uvMetricsInfo
...
PR-URL: https://github.com/nodejs/node/pull/55614
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
2024-11-27 11:03:28 -05:00
Orgad Shaneh
d2430ee363
http2: fix client async storage persistence
...
Create and store an AsyncResource for each stream, following a similar
approach as used in HttpAgent.
Fixes: https://github.com/nodejs/node/issues/55376
PR-URL: https://github.com/nodejs/node/pull/55460
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
2024-11-27 11:03:27 -05:00
Joyee Cheung
91fdec3a52
module: fix error thrown from require(esm) hitting TLA repeatedly
...
This tracks the asynchronicity in the ModuleWraps when they turn out to
contain TLA after instantiation, and throw the right error
(ERR_REQUIRE_ASYNC_MODULE) when it's required again. It removes
the freezing of ModuleWraps since it's not meaningful to freeze
this when the rest of the module loader is mutable, and we
can record the asynchronicity in the ModuleWrap right after
compilation after we get a V8 upgrade that contains
v8::Module::HasTopLevelAwait() instead of searching through
the module graph repeatedly which can be slow.
PR-URL: https://github.com/nodejs/node/pull/55520
Fixes: https://github.com/nodejs/node/issues/55516
Refs: https://github.com/nodejs/node/issues/52697
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2024-11-27 11:03:26 -05:00
Marvin ROGER
8f59c41d52
stream: propagate AbortSignal reason
...
PR-URL: https://github.com/nodejs/node/pull/55473
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
2024-11-27 02:25:38 -05:00
Antoine du Hamel
15dd43dd6e
esm: add a fallback when importer in not a file
...
PR-URL: https://github.com/nodejs/node/pull/55471
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
2024-11-27 02:25:38 -05:00
Aviv Keller
d695bd4c4f
fs: pass correct path to DirentFromStats during glob
...
PR-URL: https://github.com/nodejs/node/pull/55071
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2024-11-27 02:25:38 -05:00
Juan José
e14dba3ee5
src,lib: introduce util.getSystemErrorMessage(err)
...
This patch adds a new utility function which provides human-readable
string description of the given system error code.
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/54075
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2024-11-27 01:42:44 -05:00
theanarkh
4f89059f63
lib: add flag to drop connection when running in cluster mode
...
PR-URL: https://github.com/nodejs/node/pull/54927
Refs: https://github.com/nodejs/node/issues/54882
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-11-27 01:37:54 -05:00
Erick Wendel
f41d329e98
test_runner: add support for scheduler.wait on mock timers
...
This adds support for nodetimers.promises.scheduler.wait on Mocktimers
Refs: https://github.com/nodejs/node/pull/55244
PR-URL: https://github.com/nodejs/node/pull/55244
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2024-11-27 01:37:51 -05:00
Wei Zhu
aed758d270
esm: fix inconsistency with importAssertion in resolve hook
...
As the documentation states, the `context.importAssertion` should be
still supported and emit a warning. This is true for the `load` hook,
but not correct for context of the `resolve` hook.
This commit fixes the inconsistency.
PR-URL: https://github.com/nodejs/node/pull/55365
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-11-27 01:37:51 -05:00
BadKey
29f7325e73
lib: test_runner#mock:timers respeced timeout_max behaviour
...
PR-URL: https://github.com/nodejs/node/pull/55375
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Claudio Wunder <cwunder@gnome.org >
2024-11-27 01:23:22 -05:00
Edigleysson Silva (Edy)
68bcec64b8
lib: remove settled dependant signals when they are GCed
...
PR-URL: https://github.com/nodejs/node/pull/55354
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2024-11-27 01:23:19 -05:00
Aviv Keller
b9200c33ae
test_runner: require --enable-source-maps for sourcemap coverage
...
PR-URL: https://github.com/nodejs/node/pull/55359
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2024-11-27 01:23:19 -05:00
Robert Nagy
4f84cdc8a2
events: optimize EventTarget.addEventListener
...
PR-URL: https://github.com/nodejs/node/pull/55312
Fixes: https://github.com/nodejs/node/issues/55311
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-11-27 01:23:18 -05:00
Joyee Cheung
cb527a925d
module: do not warn when require(esm) comes from node_modules
...
As part of the standard experimental feature graduation
policy, when we unflagged require(esm) we moved the
experimental warning to be emitted when require() is
actually used to load ESM, which previously was an error.
However, some packages in the ecosystem have already
being using try-catch to load require(esm) to e.g.
resolve optional dependency, and emitting warning from
there instead of throwing directly could break the CLI
output.
To reduce the disruption for releases, as a compromise, this
patch skips the warning if require(esm) comes from
node_modules, where users typically don't have much control
over the code. This warning will be eventually removed
when require(esm) becomes stable.
This patch was originally intended for the LTS releases,
though it seems there's appetite for it on v23.x as
well so it's re-targeted to the main branch.
PR-URL: https://github.com/nodejs/node/pull/55960
Backport-PR-URL: https://github.com/nodejs/node/pull/55217
Refs: https://github.com/nodejs/node/pull/55217
Refs: https://github.com/nodejs/node/issues/52697
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2024-11-27 00:45:39 -05:00
Joyee Cheung
16119f206f
module: trim off internal stack frames for require(esm) warnings
...
Trim off irrelevant internal stack frames for require(esm) warnings
so it's easier to locate where the call comes from when
--trace-warnings is used.
PR-URL: https://github.com/nodejs/node/pull/55496
Backport-PR-URL: https://github.com/nodejs/node/pull/55217
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Refs: https://github.com/nodejs/node/issues/52697
2024-11-27 00:45:34 -05:00
Joyee Cheung
28b5b9a57d
module: allow ESM that failed to be required to be re-imported
...
When a ESM module cannot be loaded by require due to the presence
of TLA, its module status would be stopped at kInstantiated. In
this case, when it's imported again, we should allow it to be
evaluated asynchronously, as it's also a common pattern for users
to retry with dynamic import when require fails.
PR-URL: https://github.com/nodejs/node/pull/55502
Backport-PR-URL: https://github.com/nodejs/node/pull/55217
Fixes: https://github.com/nodejs/node/issues/55500
Refs: https://github.com/nodejs/node/issues/52697
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2024-11-27 00:45:27 -05:00
Joyee Cheung
6ac3400960
module: include module information in require(esm) warning
...
When emitting the experimental warning for `require(esm)`, include
information about the parent module and the module being require()-d
to help users locate and update them.
PR-URL: https://github.com/nodejs/node/pull/55397
Backport-PR-URL: https://github.com/nodejs/node/pull/55217
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Refs: https://github.com/nodejs/node/issues/52697
2024-11-27 00:45:18 -05:00
Joyee Cheung
2af72a7671
src: implement IsInsideNodeModules() in C++
...
This previously compiles a script and run it in a new context
to avoid global pollution, which is more complex than necessary
and can be too slow for it to be reused in other cases. The
new implementation just checks the frames in C++ which is safe
from global pollution, faster and simpler.
The previous implementation also had a bug when the call site
is in a ESM, because ESM have URLs as their script names,
which don't start with '/' or '\' and will be skipped. The new
implementation removes the skipping to fix it for ESM.
PR-URL: https://github.com/nodejs/node/pull/55286
Backport-PR-URL: https://github.com/nodejs/node/pull/55217
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Refs: https://github.com/nodejs/node/issues/52697
2024-11-27 00:45:16 -05:00
Joyee Cheung
fcdd6167d8
module: check --experimental-require-module separately from detection
...
Previously we assumed if `--experimental-detect-module` is true, then
`--experimental-require-module` is true, which isn't the case, as
the two can be enabled/disabled separately. This patch fixes the
checks so `--no-experimental-require-module` is still effective when
`--experimental-detect-module` is enabled.
Drive-by: make the assertion messages more informative and remove
obsolete TODO about allowing TLA in entrypoints handled by
require(esm).
PR-URL: https://github.com/nodejs/node/pull/55250
Backport-PR-URL: https://github.com/nodejs/node/pull/55217
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Refs: https://github.com/nodejs/node/issues/52697
2024-11-27 00:45:12 -05:00
Joyee Cheung
d8c34ced43
module: use kNodeModulesRE to detect node_modules
...
This is faster and more consistent with other places using the
regular expression to detect node_modules.
PR-URL: https://github.com/nodejs/node/pull/55243
Backport-PR-URL: https://github.com/nodejs/node/pull/55217
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Refs: https://github.com/nodejs/node/issues/52697
2024-11-27 00:45:07 -05:00
Guy Bedford
545c069eb5
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/55217
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
2024-11-27 00:44:51 -05:00
Joyee Cheung
58d6871c45
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/55217
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 >
2024-11-27 00:44:46 -05:00
Nicolò Ribaudo
88d91e8bc2
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 >
2024-11-16 17:45:08 +01:00
Joyee Cheung
e95163b170
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
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-10-11 23:58:11 +02:00
Antoine du Hamel
0655d3a384
process: fix process.features.typescript when Amaro is unavailable
...
PR-URL: https://github.com/nodejs/node/pull/55323
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
2024-10-11 20:58:16 +02:00