Trivikram Kamat
87e7aeb672
os: use const with early return for path
...
PR-URL: https://github.com/nodejs/node/pull/54959
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2024-09-18 02:51:46 +00:00
Andrew Moon
29f31c6a76
crypto: add Date fields for validTo and validFrom
...
Added equivalent fields to `X509Certificate` in Date form.
PR-URL: https://github.com/nodejs/node/pull/54159
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tim Perry <pimterry@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
2024-09-18 00:56:24 +00:00
Joyee Cheung
3ac5b49d85
module: refator ESM loader for adding future synchronous hooks
...
This lays the foundation for supporting synchronous hooks proposed
in https://github.com/nodejs/loaders/pull/198 for ESM.
- Corrects and adds several JSDoc comments for internal functions
of the ESM loader, as well as explaining how require() for
import CJS work in the special resolve/load paths. This doesn't
consolidate it with import in require(esm) yet due to caching
differences, which is left as a TODO.
- The moduleProvider passed into ModuleJob is replaced as
moduleOrModulePromise, we call the translators directly in the
ESM loader and verify it right after loading for clarity.
- Reuse a few refactored out helpers for require(esm) in
getModuleJobForRequire().
PR-URL: https://github.com/nodejs/node/pull/54769
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-09-17 18:38:33 +00:00
Jordan Harband
7014e50ca3
lib: the REPL should survive deletion of Array.prototype methods
...
Specifically, `delete Array.prototype.lastIndexOf` immediately crashes
the REPL, as does deletion of a few other Array prototype methods.
PR-URL: https://github.com/nodejs/node/pull/31457
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2024-09-17 15:08:43 +00:00
Joyee Cheung
3c4ef343ee
module: remove bogus assertion in CJS entrypoint handling with --import
...
The synchronous CJS translator can handle entrypoints now, this
can be hit when --import is used, so lift the bogus assertions and
added tests.
PR-URL: https://github.com/nodejs/node/pull/54592
Fixes: https://github.com/nodejs/node/issues/54577
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-09-17 12:28:09 +02:00
Yagiz Nizipli
d5c29ba12d
events: set EventEmitterAsyncResource fields private
...
PR-URL: https://github.com/nodejs/node/pull/54889
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-09-17 03:55:21 +00:00
Yagiz Nizipli
9195210399
lib,src: use built-in array buffer detach, transfer
...
PR-URL: https://github.com/nodejs/node/pull/54837
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2024-09-16 00:32:04 +00:00
Aviv Keller
028c586478
test_runner: reimplement assert.ok to allow stack parsing
...
PR-URL: https://github.com/nodejs/node/pull/54776
Refs: https://github.com/nodejs/help/issues/4461
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2024-09-15 15:53:18 +00:00
Colin Ihrig
dbaef339aa
test_runner: detect only tests when --test is not used
...
This commit updates the way the test runner processes 'only'
tests when node:test files are run without the --test CLI.
This is a breaking change.
PR-URL: https://github.com/nodejs/node/pull/54881
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-09-15 14:20:59 +00:00
Shima Ryuhei
86bdca9772
repl: avoid interpreting 'npm' as a command when errors are recoverable
...
This change ensures that 'npm' within JavaScript code is not mistakenly
interpreted as an npm command when the error is recoverable.
This allows 'npm' to be treated as expected in such scenarios.
Fixes: https://github.com/nodejs/node/issues/54830
PR-URL: https://github.com/nodejs/node/pull/54848
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com >
2024-09-15 13:25:19 +00:00
Hüseyin Açacak
efbba60e5b
path: fix bugs and inconsistencies
...
Fixes: https://github.com/nodejs/node/issues/54025
PR-URL: https://github.com/nodejs/node/pull/54224
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2024-09-14 14:56:31 +00:00
Yagiz Nizipli
f468509cf6
zlib: add typings for better dx
...
PR-URL: https://github.com/nodejs/node/pull/54699
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-09-14 22:36:24 +08:00
jakecastelli
55f70ee178
lib: remove unnecessary async
...
Co-authored-by: Jason Zhang <xzha4350@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/54829
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Michael Dawson <midawson@redhat.com >
2024-09-14 14:31:29 +00:00
jazelly
05ad947899
http: reduce likelihood of race conditions on keep-alive timeout
...
Fixes: https://github.com/nodejs/node/issues/52649
Refs: https://github.com/nodejs/node/issues/54293
Co-authored-by: Arrigo Zanette <zanettea@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/54863
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2024-09-13 08:45:00 -07:00
jazelly
fee02c70ee
lib: make WeakRef safe in abort_controller
...
PR-URL: https://github.com/nodejs/node/pull/54791
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2024-09-13 08:08:05 -07:00
Aviv Keller
99bbf80608
test_runner: report coverage thresholds in test:coverage
...
PR-URL: https://github.com/nodejs/node/pull/54813
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2024-09-13 13:31:37 +00:00
Pietro Marchini
e21984b70c
test_runner: update kPatterns
...
PR-URL: https://github.com/nodejs/node/pull/54728
Fixes: https://github.com/nodejs/node/issues/54726
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2024-09-13 02:51:35 +00:00
cjihrig
f5f67ae4a7
test_runner: detect only tests when isolation is off
...
This commit updates the way the test runner processes 'only'
tests when process-based test isolation is disabled. The
--test-only flag is no longer necessary in this scenario. The
test runner will automatically detect 'only' tests and apply the
appropriate filtering.
PR-URL: https://github.com/nodejs/node/pull/54832
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2024-09-12 12:41:11 -04:00
cjihrig
e78fd8c0ad
test_runner: apply filtering when tests begin
...
This commit updates the way filtering is applied to tests and
suites. After this change, filters are applied just before the
test/suite is started. The results are the same, but this allows
us to eventually move away from the --test-only flag except
when process level isolation is used.
PR-URL: https://github.com/nodejs/node/pull/54832
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2024-09-12 12:41:11 -04:00
Antoine du Hamel
53cdffea20
esm: throw ERR_REQUIRE_ESM instead of ERR_INTERNAL_ASSERTION
...
PR-URL: https://github.com/nodejs/node/pull/54868
Fixes: https://github.com/nodejs/node/issues/54773
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-09-11 21:48:02 +00:00
Yagiz Nizipli
1d2603b53f
os: improve tmpdir performance
...
PR-URL: https://github.com/nodejs/node/pull/54709
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2024-09-11 14:46:30 +00:00
Colin Ihrig
123bb4cb22
test_runner: improve code coverage cleanup
...
The test runner's code coverage leaves old coverage data in the
temp directory. This commit updates the cleanup logic to:
- Stop code collection. Otherwise V8 would write collection data
again when the process exits.
- Remove the temp directory containing the coverage data.
- Attempt to clean up the coverage data even if parsing the
data resulted in an error.
With this change, I no longer see any coverage data left behind
in the system temp directory.
Refs: https://github.com/nodejs/build/issues/3864
Refs: https://github.com/nodejs/build/issues/3887
PR-URL: https://github.com/nodejs/node/pull/54856
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-09-11 02:50:28 +00:00
Aviv Keller
94a457a1eb
path: remove StringPrototypeCharCodeAt from posix.extname
...
PR-URL: https://github.com/nodejs/node/pull/54546
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-09-10 23:29:33 +00:00
Antoine du Hamel
7c58645aca
lib: move Symbol[Async]Dispose polyfills to internal/util
...
PR-URL: https://github.com/nodejs/node/pull/54853
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-09-10 21:24:56 +00:00
Gürgün Dayıoğlu
26b03c1b79
timers: avoid generating holey internal arrays
...
PR-URL: https://github.com/nodejs/node/pull/54771
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-09-10 12:48:04 +00:00
Yagiz Nizipli
741004a3b8
fs: refactor rimraf to avoid using primordials
...
PR-URL: https://github.com/nodejs/node/pull/54834
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-09-10 02:32:57 +00:00
Antoine du Hamel
2ef33af16e
esm: fix support for URL instances in import.meta.resolve
...
PR-URL: https://github.com/nodejs/node/pull/54690
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-09-10 01:00:33 +02:00
Aviv Keller
5c8d0ebf30
test_runner: allow --import with no isolation
...
Co-Authored-By: Colin Ihrig <cjihrig@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/54697
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
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: Moshe Atlow <moshe@atlow.co.il >
2024-09-10 00:51:36 +02:00
Anna Henningsen
c3a7b29e56
tls: add allowPartialTrustChain flag
...
This commit exposes the `X509_V_FLAG_PARTIAL_CHAIN` OpenSSL flag to
users. This is behavior that has been requested repeatedly in the
Github issues, and allows aligning behavior with other TLS libraries
and commonly used applications (e.g. `curl`).
As a drive-by, simplify the `SecureContext` source by deduplicating
call sites at which a new custom certificate store was created for the
`secureContext` in question.
Fixes: https://github.com/nodejs/node/issues/36453
PR-URL: https://github.com/nodejs/node/pull/54790
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-09-09 17:24:10 +02:00
Khafra
6c85d40593
esm: use Undici/fetch data: URL parser
...
Fixes: https://github.com/nodejs/node/issues/53775
PR-URL: https://github.com/nodejs/node/pull/54748
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-09-07 10:22:03 +02:00
Jason Zhang
973144b7c6
lib: convert signals to array before validation
...
Co-authored-by: Jake Yuesong Li <jake.yuesong@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/54714
Fixes: https://github.com/nodejs/node/issues/54674
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-09-06 17:40:21 +00:00
Jason Zhang
1c67899ffb
buffer: fix out of range for toString
...
Co-authored-by: Michaël Zasso <targos@protonmail.com >
PR-URL: https://github.com/nodejs/node/pull/54553
Fixes: https://github.com/nodejs/node/issues/52298
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
2024-09-06 17:39:24 +00:00
Rafael Gonzaga
143aca7d1f
lib: add note about removing node:sys module
...
PR-URL: https://github.com/nodejs/node/pull/54743
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-09-05 21:53:52 +02:00
Rafael Gonzaga
80a989f931
lib: add util.getCallSite() API
...
PR-URL: https://github.com/nodejs/node/pull/54380
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: Claudio Wunder <cwunder@gnome.org >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-09-04 19:47:25 +00:00
Wuli
5949e169bd
typings: correct param type of SafePromisePrototypeFinally
...
PR-URL: https://github.com/nodejs/node/pull/54727
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
2024-09-03 14:26:06 +02:00
YoonSoo_Shin
298dea0c63
stream: relocate the status checking code in the onwritecomplete
...
relocate the status checking code before verifying if the stream is
destroyed
PR-URL: https://github.com/nodejs/node/pull/54032
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-09-02 07:29:17 +00:00
Paolo Insogna
294ae14b98
timers: document ref option for scheduler.wait
...
PR-URL: https://github.com/nodejs/node/pull/54605
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
2024-09-02 06:57:02 +00:00
Jason Zhang
981c701400
lib: ensure no holey array in fixed_queue
...
Co-authored-by: Jake Yuesong Li <jake.yuesong@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/54537
Fixes: https://github.com/nodejs/node/issues/54472
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
2024-09-02 01:42:44 +00:00
mscdex
71b36b3068
https: only use default ALPNProtocols when appropriate
...
PR-URL: https://github.com/nodejs/node/pull/54411
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Tim Perry <pimterry@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-09-01 03:04:10 +00:00
Antoine du Hamel
4c844a2f30
crypto: remove unused kHashTypes internal
...
PR-URL: https://github.com/nodejs/node/pull/54627
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-08-31 06:34:53 +00:00
Filip Skokan
64bb5f8f8e
lib: refactor SubtleCrypto experimental warnings
...
PR-URL: https://github.com/nodejs/node/pull/54620
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2024-08-30 21:50:10 +00:00
Bryan English
ef6b9ffc8d
async_hooks: add an InactiveAsyncContextFrame class
...
This gives a class prototype for AsyncContextFrame that contains the
required methods, so that when we swap the prototype,
ActiveAsyncContextFrame methods are used instead. Previously, the
methods were defined in AsyncContextFrame, so swapping the prototype
didn't swap those static methods.
Also, make the ActiveAsyncContextFrame extend from Map.
Fixes: https://github.com/nodejs/node/issues/54503
PR-URL: https://github.com/nodejs/node/pull/54510
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
2024-08-30 20:27:28 +00:00
Rafael Gonzaga
9a275e15c3
src,lib: add performance.uvMetricsInfo
...
This commit exposes a new API to the perf_hooks.performance
module. This wraps uv_metrics_info into
performance.uvMetricsInfo() function.
PR-URL: https://github.com/nodejs/node/pull/54413
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2024-08-30 14:22:28 +00:00
Joyee Cheung
d98cfcc581
vm: introduce vanilla contexts via vm.constants.DONT_CONTEXTIFY
...
This implements a flavor of vm.createContext() and friends
that creates a context without contextifying its global object.
This is suitable when users want to freeze the context (impossible
when the global is contextified i.e. has interceptors installed)
or speed up the global access if they don't need the interceptor
behavior.
```js
const vm = require('node:vm');
const context = vm.createContext(vm.constants.DONT_CONTEXTIFY);
// In contexts with contextified global objects, this is false.
// In vanilla contexts this is true.
console.log(vm.runInContext('globalThis', context) === context);
// In contexts with contextified global objects, this would throw,
// but in vanilla contexts freezing the global object works.
vm.runInContext('Object.freeze(globalThis);', context);
// In contexts with contextified global objects, freezing throws
// and won't be effective. In vanilla contexts, freezing works
// and prevents scripts from accidentally leaking globals.
try {
vm.runInContext('globalThis.foo = 1; foo;', context);
} catch(e) {
console.log(e); // Uncaught ReferenceError: foo is not defined
}
console.log(context.Array); // [Function: Array]
```
PR-URL: https://github.com/nodejs/node/pull/54394
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2024-08-29 09:05:03 +00:00
Pietro Marchini
dcf50f15bc
test_runner: ensure test watcher picks up new test files
...
PR-URL: https://github.com/nodejs/node/pull/54225
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
2024-08-29 08:55:34 +00:00
Joyee Cheung
75741a1952
src: use v8::Isolate::GetDefaultLocale() to compute navigator.language
...
Using the Intl API to get the default locale slows down the startup
significantly. This patch uses a new v8 API to get the default locale
directly.
PR-URL: https://github.com/nodejs/node/pull/54279
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-08-29 03:25:51 +00:00
Joyee Cheung
ff5ef7083d
src: add JS APIs for compile cache and NODE_DISABLE_COMPILE_CACHE
...
This patch adds the following API for tools to enable compile
cache dynamically and query its status.
- module.enableCompileCache(cacheDir)
- module.getCompileCacheDir()
In addition this adds a NODE_DISABLE_COMPILE_CACHE environment
variable to disable the code cache enabled by the APIs as
an escape hatch to avoid unexpected/undesired effects of
the compile cache (e.g. less precise test coverage).
When the module.enableCompileCache() method is invoked without
a specified directory, Node.js will use the value of
the NODE_COMPILE_CACHE environment variable if it's set, or
defaults to `path.join(os.tmpdir(), 'node-compile-cache')`
otherwise. Therefore it's recommended for tools to call this
method without specifying the directory to allow overrides.
PR-URL: https://github.com/nodejs/node/pull/54501
Fixes: https://github.com/nodejs/node/issues/53639
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-08-28 23:22:57 +00:00
Rafael Gonzaga
4a0ec20a35
lib: respect terminal capabilities on styleText
...
This PR changes styleText API to respect terminal
capabilities and environment variables such as
NO_COLOR, NODE_DISABLE_COLORS, and FORCE_COLOR.
PR-URL: https://github.com/nodejs/node/pull/54389
Fixes: https://github.com/nodejs/node/issues/54365
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Claudio Wunder <cwunder@gnome.org >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2024-08-28 18:00:11 +00:00
jakecastelli
4f14eb1545
Revert "net: validate host name for server listen"
...
This reverts commit 52322aa42a .
PR-URL: https://github.com/nodejs/node/pull/54554
Reviewed-By: Claudio Wunder <cwunder@gnome.org >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-08-28 17:27:19 +09:30
Vinicius Lourenço
a7271ab47d
lib: fix emit warning for debuglog.time when disabled
...
PR-URL: https://github.com/nodejs/node/pull/54275
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2024-08-27 16:20:35 +00:00