From 4c6f73c5d55dc74afb5525b14f8077eb83a952a7 Mon Sep 17 00:00:00 2001 From: Giovanni Bucci <8344987+puskin@users.noreply.github.com> Date: Sat, 3 May 2025 07:28:20 -0700 Subject: [PATCH 01/78] url: improve performance of the format function PR-URL: https://github.com/nodejs/node/pull/57099 Reviewed-By: Yagiz Nizipli Reviewed-By: James M Snell Reviewed-By: Chemi Atlow Reviewed-By: Matteo Collina Reviewed-By: Rafael Gonzaga Reviewed-By: Ruben Bridgewater --- lib/url.js | 71 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/lib/url.js b/lib/url.js index c23d9c51c20033..d7c274a96924ac 100644 --- a/lib/url.js +++ b/lib/url.js @@ -27,6 +27,9 @@ const { ObjectAssign, ObjectKeys, StringPrototypeCharCodeAt, + StringPrototypeIndexOf, + StringPrototypeReplaceAll, + StringPrototypeSlice, decodeURIComponent, } = primordials; @@ -637,6 +640,10 @@ Url.prototype.format = function format() { } let protocol = this.protocol || ''; + if (protocol && StringPrototypeCharCodeAt(protocol, protocol.length - 1) !== 58 /* : */) { + protocol += ':'; + } + let pathname = this.pathname || ''; let hash = this.hash || ''; let host = ''; @@ -646,7 +653,7 @@ Url.prototype.format = function format() { host = auth + this.host; } else if (this.hostname) { host = auth + ( - this.hostname.includes(':') && !isIpv6Hostname(this.hostname) ? + StringPrototypeIndexOf(this.hostname, ':') !== -1 && !isIpv6Hostname(this.hostname) ? '[' + this.hostname + ']' : this.hostname ); @@ -658,59 +665,55 @@ Url.prototype.format = function format() { if (this.query !== null && typeof this.query === 'object') { query = querystring.stringify(this.query); } - let search = this.search || (query && ('?' + query)) || ''; - if (protocol && protocol.charCodeAt(protocol.length - 1) !== 58/* : */) - protocol += ':'; - - let newPathname = ''; - let lastPos = 0; - for (let i = 0; i < pathname.length; ++i) { - switch (pathname.charCodeAt(i)) { - case CHAR_HASH: - if (i - lastPos > 0) - newPathname += pathname.slice(lastPos, i); - newPathname += '%23'; - lastPos = i + 1; - break; - case CHAR_QUESTION_MARK: - if (i - lastPos > 0) - newPathname += pathname.slice(lastPos, i); - newPathname += '%3F'; + if (StringPrototypeIndexOf(pathname, '#') !== -1 || StringPrototypeIndexOf(pathname, '?') !== -1) { + let newPathname = ''; + let lastPos = 0; + const len = pathname.length; + for (let i = 0; i < len; i++) { + const code = StringPrototypeCharCodeAt(pathname, i); + if (code === CHAR_HASH || code === CHAR_QUESTION_MARK) { + if (i > lastPos) { + newPathname += StringPrototypeSlice(pathname, lastPos, i); + } + newPathname += (code === CHAR_HASH ? '%23' : '%3F'); lastPos = i + 1; - break; + } } - } - if (lastPos > 0) { - if (lastPos !== pathname.length) - pathname = newPathname + pathname.slice(lastPos); - else - pathname = newPathname; + if (lastPos < len) { + newPathname += StringPrototypeSlice(pathname, lastPos); + } + pathname = newPathname; } // Only the slashedProtocols get the //. Not mailto:, xmpp:, etc. // unless they had them to begin with. if (this.slashes || slashedProtocol.has(protocol)) { if (this.slashes || host) { - if (pathname && pathname.charCodeAt(0) !== CHAR_FORWARD_SLASH) + if (pathname && StringPrototypeCharCodeAt(pathname, 0) !== CHAR_FORWARD_SLASH) pathname = '/' + pathname; host = '//' + host; } else if (protocol.length >= 4 && - protocol.charCodeAt(0) === 102/* f */ && - protocol.charCodeAt(1) === 105/* i */ && - protocol.charCodeAt(2) === 108/* l */ && - protocol.charCodeAt(3) === 101/* e */) { + StringPrototypeCharCodeAt(protocol, 0) === 102/* f */ && + StringPrototypeCharCodeAt(protocol, 1) === 105/* i */ && + StringPrototypeCharCodeAt(protocol, 2) === 108/* l */ && + StringPrototypeCharCodeAt(protocol, 3) === 101/* e */) { host = '//'; } } - search = search.replaceAll('#', '%23'); + // Escape '#' in search. + if (StringPrototypeIndexOf(search, '#') !== -1) { + search = StringPrototypeReplaceAll(search, '#', '%23'); + } - if (hash && hash.charCodeAt(0) !== CHAR_HASH) + if (hash && StringPrototypeCharCodeAt(hash, 0) !== CHAR_HASH) { hash = '#' + hash; - if (search && search.charCodeAt(0) !== CHAR_QUESTION_MARK) + } + if (search && StringPrototypeCharCodeAt(search, 0) !== CHAR_QUESTION_MARK) { search = '?' + search; + } return protocol + host + pathname + search + hash; }; From 94c720c4ee0f766d99d34e0185aa56a90aa34cad Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Fri, 18 Apr 2025 01:14:24 +0800 Subject: [PATCH 02/78] util: add internal `assignFunctionName()` function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/57916 Reviewed-By: Antoine du Hamel Reviewed-By: Vinícius Lourenço Claro Cardoso Reviewed-By: James M Snell --- lib/internal/util.js | 28 ++++++++++++++++++++ test/parallel/test-internal-util-helpers.js | 29 ++++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/lib/internal/util.js b/lib/internal/util.js index 6177b151feea3c..98dc3f81201084 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -41,6 +41,7 @@ const { StringPrototypeToUpperCase, Symbol, SymbolFor, + SymbolPrototypeGetDescription, SymbolReplace, SymbolSplit, } = primordials; @@ -906,10 +907,37 @@ const encodingsMap = { __proto__: null }; for (let i = 0; i < encodings.length; ++i) encodingsMap[encodings[i]] = i; +/** + * Reassigns the .name property of a function. + * Should be used when function can't be initially defined with desired name + * or when desired name should include `#`, `[`, `]`, etc. + * @param {string | symbol} name + * @param {Function} fn + * @param {object} [descriptor] + * @returns {Function} the same function, renamed + */ +function assignFunctionName(name, fn, descriptor = kEmptyObject) { + if (typeof name !== 'string') { + const symbolDescription = SymbolPrototypeGetDescription(name); + assert(symbolDescription !== undefined, 'Attempted to name function after descriptionless Symbol'); + name = `[${symbolDescription}]`; + } + return ObjectDefineProperty(fn, 'name', { + __proto__: null, + writable: false, + enumerable: false, + configurable: true, + ...ObjectGetOwnPropertyDescriptor(fn, 'name'), + ...descriptor, + value: name, + }); +} + module.exports = { getLazy, assertCrypto, assertTypeScript, + assignFunctionName, cachedResult, convertToValidSignal, createClassWrapper, diff --git a/test/parallel/test-internal-util-helpers.js b/test/parallel/test-internal-util-helpers.js index bf60cff9bda4be..01e99d52420d40 100644 --- a/test/parallel/test-internal-util-helpers.js +++ b/test/parallel/test-internal-util-helpers.js @@ -4,7 +4,7 @@ require('../common'); const assert = require('assert'); const { types } = require('util'); -const { isError } = require('internal/util'); +const { assignFunctionName, isError } = require('internal/util'); const vm = require('vm'); // Special cased errors. Test the internal function which is used in @@ -35,3 +35,30 @@ const vm = require('vm'); assert(!(differentRealmErr instanceof Error)); assert(isError(differentRealmErr)); } + +{ + const nameMap = new Map([ + [ 'meaningfulName', 'meaningfulName' ], + [ '', '' ], + [ Symbol.asyncIterator, '[Symbol.asyncIterator]' ], + [ Symbol('notWellKnownSymbol'), '[notWellKnownSymbol]' ], + ]); + for (const fn of [ + () => {}, + function() {}, + function value() {}, + ({ value() {} }).value, + new Function(), + Function(), + function() {}.bind(null), + class {}, + class value {}, + ]) { + for (const [ stringOrSymbol, expectedName ] of nameMap) { + const namedFn = assignFunctionName(stringOrSymbol, fn); + assert.strictEqual(fn, namedFn); + assert.strictEqual(namedFn.name, expectedName); + assert.strictEqual(namedFn.bind(null).name, `bound ${expectedName}`); + } + } +} From 7dabf079b1fd21c10f8b7ea68becb23c711ed9ce Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Fri, 18 Apr 2025 03:05:42 +0800 Subject: [PATCH 03/78] child_process: give names to promisified `exec()` and `execFile()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/57916 Reviewed-By: Antoine du Hamel Reviewed-By: Vinícius Lourenço Claro Cardoso Reviewed-By: James M Snell --- lib/child_process.js | 5 +++-- test/parallel/test-util-promisify-custom-names.mjs | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/child_process.js b/lib/child_process.js index 5c853716a26a4e..21616c69f877ec 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -47,6 +47,7 @@ const { } = primordials; const { + assignFunctionName, convertToValidSignal, getSystemErrorName, kEmptyObject, @@ -236,7 +237,7 @@ function exec(command, options, callback) { } const customPromiseExecFunction = (orig) => { - return (...args) => { + return assignFunctionName(orig.name, function(...args) { const { promise, resolve, reject } = PromiseWithResolvers(); promise.child = orig(...args, (err, stdout, stderr) => { @@ -250,7 +251,7 @@ const customPromiseExecFunction = (orig) => { }); return promise; - }; + }); }; ObjectDefineProperty(exec, promisify.custom, { diff --git a/test/parallel/test-util-promisify-custom-names.mjs b/test/parallel/test-util-promisify-custom-names.mjs index 3ff05d907b5060..79da972ae20d60 100644 --- a/test/parallel/test-util-promisify-custom-names.mjs +++ b/test/parallel/test-util-promisify-custom-names.mjs @@ -9,6 +9,7 @@ import fs from 'node:fs'; import readline from 'node:readline'; import stream from 'node:stream'; import timers from 'node:timers'; +import child_process from 'node:child_process'; assert.strictEqual( @@ -38,3 +39,12 @@ assert.strictEqual( promisify(timers.setTimeout).name, 'setTimeout' ); + +assert.strictEqual( + promisify(child_process.exec).name, + 'exec' +); +assert.strictEqual( + promisify(child_process.execFile).name, + 'execFile' +); From 8f1aee90d9331f89f3cd56ae0ddfc878dd10902f Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Fri, 18 Apr 2025 04:15:17 +0800 Subject: [PATCH 04/78] http2: give name to promisified `connect()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/57916 Reviewed-By: Antoine du Hamel Reviewed-By: Vinícius Lourenço Claro Cardoso Reviewed-By: James M Snell --- lib/internal/http2/core.js | 5 +++-- test/parallel/test-util-promisify-custom-names.mjs | 10 +++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index d7d7fb99ae67cc..18e10fbd16aae4 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -25,6 +25,7 @@ const { } = primordials; const { + assignFunctionName, assertCrypto, customInspectSymbol: kInspect, kEmptyObject, @@ -3395,7 +3396,7 @@ function connect(authority, options, listener) { // Support util.promisify ObjectDefineProperty(connect, promisify.custom, { __proto__: null, - value: (authority, options) => { + value: assignFunctionName('connect', function(authority, options) { return new Promise((resolve, reject) => { const server = connect(authority, options, () => { server.removeListener('error', reject); @@ -3404,7 +3405,7 @@ ObjectDefineProperty(connect, promisify.custom, { server.once('error', reject); }); - }, + }), }); function createSecureServer(options, handler) { diff --git a/test/parallel/test-util-promisify-custom-names.mjs b/test/parallel/test-util-promisify-custom-names.mjs index 79da972ae20d60..3540d20e262e0c 100644 --- a/test/parallel/test-util-promisify-custom-names.mjs +++ b/test/parallel/test-util-promisify-custom-names.mjs @@ -1,4 +1,4 @@ -import '../common/index.mjs'; +import { hasCrypto } from '../common/index.mjs'; import assert from 'node:assert'; import { promisify } from 'node:util'; @@ -48,3 +48,11 @@ assert.strictEqual( promisify(child_process.execFile).name, 'execFile' ); + +if (hasCrypto) { + const http2 = await import('node:http2'); + assert.strictEqual( + promisify(http2.connect).name, + 'connect' + ); +} From 62dbd36dcbfb43e6ddb1a555793192e33d361891 Mon Sep 17 00:00:00 2001 From: Yukihiro Hasegawa <49516827+y-hsgw@users.noreply.github.com> Date: Sun, 4 May 2025 22:42:47 +0900 Subject: [PATCH 05/78] doc: update return types for eventNames method in EventEmitter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/58083 Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca Reviewed-By: Yagiz Nizipli Reviewed-By: LiviaMedeiros Reviewed-By: Chemi Atlow Reviewed-By: Gerhard Stöbich --- doc/api/events.md | 4 ++-- lib/events.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/events.md b/doc/api/events.md index f3a0df9e50eee2..eac09c37047422 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -603,10 +603,10 @@ myEmitter.emit('event', 1, 2, 3, 4, 5); added: v6.0.0 --> -* Returns: {Array} +* Returns: {string\[]|symbol\[]} Returns an array listing the events for which the emitter has registered -listeners. The values in the array are strings or `Symbol`s. +listeners. ```mjs import { EventEmitter } from 'node:events'; diff --git a/lib/events.js b/lib/events.js index 999ee4ec746d18..5bfe95c84ab198 100644 --- a/lib/events.js +++ b/lib/events.js @@ -871,7 +871,7 @@ function listenerCount(type, listener) { /** * Returns an array listing the events for which * the emitter has registered listeners. - * @returns {any[]} + * @returns {(string | symbol)[]} */ EventEmitter.prototype.eventNames = function eventNames() { return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; From 629a954477fa26f898c2ad1c77b7b9290cade2ab Mon Sep 17 00:00:00 2001 From: Giovanni Date: Wed, 23 Apr 2025 15:05:56 +0200 Subject: [PATCH 06/78] repl: add possibility to edit multiline commands while adding them PR-URL: https://github.com/nodejs/node/pull/58003 Reviewed-By: Ruben Bridgewater Reviewed-By: Pietro Marchini --- doc/api/repl.md | 4 + lib/internal/readline/interface.js | 158 ++++++++- lib/internal/readline/utils.js | 16 + lib/repl.js | 37 +-- test/parallel/test-repl-history-navigation.js | 30 +- ...-repl-multiline-navigation-while-adding.js | 312 ++++++++++++++++++ .../test-repl-unexpected-token-recoverable.js | 2 +- 7 files changed, 506 insertions(+), 53 deletions(-) create mode 100644 test/parallel/test-repl-multiline-navigation-while-adding.js diff --git a/doc/api/repl.md b/doc/api/repl.md index f7f5b2d739253b..866c074a1f6ad4 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -680,6 +680,10 @@ A list of the names of some Node.js modules, e.g., `'http'`. -* `msesc` {number} +* `msecs` {number} * `callback` {Function} Optional function to be called when a timeout occurs. Same as binding to the `timeout` event. * Returns: {this} From fcead7c28ec91d3fbe1a9aaa50552233aca61c37 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 11 May 2025 16:53:21 +0200 Subject: [PATCH 44/78] fs: add to `Dir` support for explicit resource management PR-URL: https://github.com/nodejs/node/pull/58206 Reviewed-By: James M Snell Reviewed-By: LiviaMedeiros --- doc/api/fs.md | 20 +++++++++++++++ lib/internal/fs/dir.js | 25 ++++++++++++++++--- .../test-fs-promises-file-handle-dispose.js | 16 +++++++++--- 3 files changed, 54 insertions(+), 7 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 03dee7cacbbc49..58a48d6e8897f2 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -6736,6 +6736,26 @@ provided by the operating system's underlying directory mechanisms. Entries added or removed while iterating over the directory might not be included in the iteration results. +#### `dir[Symbol.asyncDispose]()` + + + +> Stability: 1 - Experimental + +An alias for `dir.close()`. + +#### `dir[Symbol.Dispose]()` + + + +> Stability: 1 - Experimental + +An alias for `dir.closeSync()`. + ### Class: `fs.Dirent` + +> Stability: 1.1 - Active Development + +Enable experimental support for the worker inspection with Chrome DevTools. + ### `--expose-gc` @@ -1326,6 +1334,8 @@ Emitted when [`process.execve()`][] is invoked. #### Worker Thread +> Stability: 1 - Experimental + From b7d1bfa7b47a1609b0105d8e93c2c38a497e1afa Mon Sep 17 00:00:00 2001 From: Giovanni Bucci <8344987+puskin@users.noreply.github.com> Date: Tue, 13 May 2025 02:30:33 -0700 Subject: [PATCH 62/78] doc: add puskin to collaborators Fixes: https://github.com/nodejs/node/issues/58088 PR-URL: https://github.com/nodejs/node/pull/58308 Reviewed-By: Marco Ippolito Reviewed-By: Pietro Marchini Reviewed-By: Antoine du Hamel --- .mailmap | 1 + README.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.mailmap b/.mailmap index a060a422d49cce..e3e502c8716123 100644 --- a/.mailmap +++ b/.mailmap @@ -204,6 +204,7 @@ George Adams Gerhard Stöbich Gibson Fahnestock Gil Pedersen +Giovanni Bucci Graham Fairweather Greg Sabia Tucker Gregor Martynus diff --git a/README.md b/README.md index a199de3cb9aa16..dcb1e77c5d9477 100644 --- a/README.md +++ b/README.md @@ -411,6 +411,8 @@ For information about the governance of the Node.js project, see **Tim Perry** <> (he/him) * [pmarchini](https://github.com/pmarchini) - **Pietro Marchini** <> (he/him) +* [puskin](https://github.com/puskin) - + **Giovanni Bucci** <> (he/him) * [Qard](https://github.com/Qard) - **Stephen Belanger** <> (he/him) * [RafaelGSS](https://github.com/RafaelGSS) - From a1b937bdeef2a78f75f684360fceaa3d5ee822c2 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Tue, 13 May 2025 13:10:36 +0100 Subject: [PATCH 63/78] doc: update commit-queue documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit update the commit-queue contributing documentation by: - removing the references of the feature being experimental - clarifying that it applies to mergeable pull requests PR-URL: https://github.com/nodejs/node/pull/58275 Reviewed-By: James M Snell Reviewed-By: Antoine du Hamel Reviewed-By: Ulises Gascón Reviewed-By: Richard Lau Reviewed-By: Michael Dawson Reviewed-By: Matteo Collina Reviewed-By: Chengzhong Wu --- doc/contributing/commit-queue.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/contributing/commit-queue.md b/doc/contributing/commit-queue.md index cece9ea84e94f8..a47b1d84f29a5f 100644 --- a/doc/contributing/commit-queue.md +++ b/doc/contributing/commit-queue.md @@ -1,10 +1,8 @@ # Commit queue -> Stability: 1 - Experimental - _tl;dr: You can land pull requests by adding the `commit-queue` label to it._ -Commit Queue is an experimental feature for the project which simplifies the +Commit Queue is a feature for the project which simplifies the landing process by automating it via GitHub Actions. With it, collaborators can land pull requests by adding the `commit-queue` label to a PR. All checks will run via `@node-core/utils`, and if the pull request is ready to @@ -18,7 +16,7 @@ implementation details, reasoning for design choices, and current limitations. From a high-level, the Commit Queue works as follow: 1. Collaborators will add `commit-queue` label to pull requests ready to land -2. Every five minutes the queue will do the following for each pull request +2. Every five minutes the queue will do the following for each mergeable pull request with the label: 1. Check if the PR also has a `request-ci` label (if it has, skip this PR since it's pending a CI run) From 3ed159afd162c6a80e1d76e0fd7c7808d395b7f3 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Tue, 13 May 2025 14:52:46 +0100 Subject: [PATCH 64/78] watch: fix watch args not being properly filtered currently when --watch is used, the argv arguments that the target script receives are filtered so that they don't include watch related arguments, however the current filtering logic is incorrect and it causes some watch values to incorrectly pass the filtering, the changes here address such issue PR-URL: https://github.com/nodejs/node/pull/58279 Fixes: https://github.com/nodejs/node/issues/57124 Reviewed-By: Benjamin Gruenbaum Reviewed-By: James M Snell --- lib/internal/main/watch_mode.js | 25 ++++- .../test-watch-mode-watch-flags.mjs | 97 +++++++++++++++++++ 2 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 test/sequential/test-watch-mode-watch-flags.mjs diff --git a/lib/internal/main/watch_mode.js b/lib/internal/main/watch_mode.js index 6ccc90436e6201..dc8323a7c3b377 100644 --- a/lib/internal/main/watch_mode.js +++ b/lib/internal/main/watch_mode.js @@ -43,11 +43,26 @@ const argsWithoutWatchOptions = []; for (let i = 0; i < process.execArgv.length; i++) { const arg = process.execArgv[i]; - if (StringPrototypeStartsWith(arg, '--watch')) { - i++; - const nextArg = process.execArgv[i]; - if (nextArg && nextArg[0] === '-') { - ArrayPrototypePush(argsWithoutWatchOptions, nextArg); + if (StringPrototypeStartsWith(arg, '--watch=')) { + continue; + } + if (arg === '--watch') { + const nextArg = process.execArgv[i + 1]; + if (nextArg && nextArg[0] !== '-') { + // If `--watch` doesn't include `=` and the next + // argument is not a flag then it is interpreted as + // the watch argument, so we need to skip that as well + i++; + } + continue; + } + if (StringPrototypeStartsWith(arg, '--watch-path')) { + const lengthOfWatchPathStr = 12; + if (arg[lengthOfWatchPathStr] !== '=') { + // if --watch-path doesn't include `=` it means + // that the next arg is the target path, so we + // need to skip that as well + i++; } continue; } diff --git a/test/sequential/test-watch-mode-watch-flags.mjs b/test/sequential/test-watch-mode-watch-flags.mjs new file mode 100644 index 00000000000000..8cd08ee08a4c0e --- /dev/null +++ b/test/sequential/test-watch-mode-watch-flags.mjs @@ -0,0 +1,97 @@ +import * as common from '../common/index.mjs'; +import tmpdir from '../common/tmpdir.js'; +import assert from 'node:assert'; +import path from 'node:path'; +import { execPath } from 'node:process'; +import { describe, it } from 'node:test'; +import { spawn } from 'node:child_process'; +import { writeFileSync, mkdirSync } from 'node:fs'; +import { inspect } from 'node:util'; +import { createInterface } from 'node:readline'; + +if (common.isIBMi) + common.skip('IBMi does not support `fs.watch()`'); + +let tmpFiles = 0; +function createTmpFile(content, ext, basename) { + const file = path.join(basename, `${tmpFiles++}${ext}`); + writeFileSync(file, content); + return file; +} + +async function runNode({ + args, + expectedCompletionLog = 'Completed running', + options = {}, +}) { + const child = spawn(execPath, args, { encoding: 'utf8', stdio: 'pipe', ...options }); + let stderr = ''; + const stdout = []; + + child.stderr.on('data', (data) => { + stderr += data; + }); + + try { + // Break the chunks into lines + for await (const data of createInterface({ input: child.stdout })) { + if (!data.startsWith('Waiting for graceful termination') && !data.startsWith('Gracefully restarted')) { + stdout.push(data); + } + if (data.startsWith(expectedCompletionLog)) { + break; + } + } + } finally { + child.kill(); + } + return { stdout, stderr, pid: child.pid }; +} + +tmpdir.refresh(); + +describe('watch mode - watch flags', { concurrency: !process.env.TEST_PARALLEL, timeout: 60_000 }, () => { + it('when multiple `--watch` flags are provided should run as if only one was', async () => { + const projectDir = tmpdir.resolve('project-multi-flag'); + mkdirSync(projectDir); + + const file = createTmpFile(` + console.log( + process.argv.some(arg => arg === '--watch') + ? 'Error: unexpected --watch args present' + : 'no --watch args present' + );`, '.js', projectDir); + const args = ['--watch', '--watch', file]; + const { stdout, stderr } = await runNode({ + file, args, options: { cwd: projectDir } + }); + + assert.strictEqual(stderr, ''); + assert.deepStrictEqual(stdout, [ + 'no --watch args present', + `Completed running ${inspect(file)}. Waiting for file changes before restarting...`, + ]); + }); + + it('`--watch-path` args without `=` used alongside `--watch` should not make it into the script', async () => { + const projectDir = tmpdir.resolve('project-watch-watch-path-args'); + mkdirSync(projectDir); + + const file = createTmpFile(` + console.log( + process.argv.slice(2).some(arg => arg.endsWith('.js')) + ? 'some cli args end with .js' + : 'no cli arg ends with .js' + );`, '.js', projectDir); + const args = ['--watch', `--watch-path`, file, file]; + const { stdout, stderr } = await runNode({ + file, args, options: { cwd: projectDir } + }); + + assert.strictEqual(stderr, ''); + assert.deepStrictEqual(stdout, [ + 'no cli arg ends with .js', + `Completed running ${inspect(file)}. Waiting for file changes before restarting...`, + ]); + }); +}); From 40dc092e258b98fb344ccf1de72e685097ae6be7 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Tue, 13 May 2025 18:30:08 +0100 Subject: [PATCH 65/78] test: remove unnecessary `console.log` from test-repl-null-thrown PR-URL: https://github.com/nodejs/node/pull/58281 Reviewed-By: Colin Ihrig Reviewed-By: Pietro Marchini Reviewed-By: James M Snell --- test/parallel/test-repl-null-thrown.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/parallel/test-repl-null-thrown.js b/test/parallel/test-repl-null-thrown.js index 0ed4a05fd5de55..2d28aa2d820ac2 100644 --- a/test/parallel/test-repl-null-thrown.js +++ b/test/parallel/test-repl-null-thrown.js @@ -19,6 +19,5 @@ replserver.emit('line', 'process.nextTick(() => { throw null; })'); replserver.emit('line', '.exit'); setTimeout(() => { - console.log(text); assert(text.includes('Uncaught null')); }, 0); From 685d137dec7d336cde02cc58948a046df65434df Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Tue, 13 May 2025 21:10:09 +0200 Subject: [PATCH 66/78] test: reduce iteration count in test-child-process-stdout-flush-exit PR-URL: https://github.com/nodejs/node/pull/58273 Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-child-process-stdout-flush-exit.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-child-process-stdout-flush-exit.js b/test/parallel/test-child-process-stdout-flush-exit.js index 3c5f00d9bb2b13..90f746c39ef6d3 100644 --- a/test/parallel/test-child-process-stdout-flush-exit.js +++ b/test/parallel/test-child-process-stdout-flush-exit.js @@ -25,9 +25,14 @@ const assert = require('assert'); // If child process output to console and exit // The console.log statements here are part of the test. +// Note: This test verifies specific behavior that is *not* guaranteed +// by Node.js's API contract. See https://nodejs.org/api/process.html#processexitcode. +// We are still generally interested in knowing when this test breaks, +// since applications may rely on the implicit behavior of stdout having +// a buffer size up to which they can write data synchronously. if (process.argv[2] === 'child') { console.log('hello'); - for (let i = 0; i < 200; i++) { + for (let i = 0; i < 100; i++) { console.log('filler'); } console.log('goodbye'); From a92a4074e4cc0861cc36ebaa9c0bd9c02f07e09e Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Tue, 13 May 2025 22:23:47 +0100 Subject: [PATCH 67/78] src: remove unused `internalVerifyIntegrity` internal binding PR-URL: https://github.com/nodejs/node/pull/58285 Reviewed-By: Filip Skokan Reviewed-By: James M Snell --- src/crypto/crypto_hash.cc | 44 --------------------------------------- src/crypto/crypto_hash.h | 2 -- 2 files changed, 46 deletions(-) diff --git a/src/crypto/crypto_hash.cc b/src/crypto/crypto_hash.cc index 5afa9936b3080e..f9f5e18f2b106a 100644 --- a/src/crypto/crypto_hash.cc +++ b/src/crypto/crypto_hash.cc @@ -279,9 +279,6 @@ void Hash::Initialize(Environment* env, Local target) { SetMethodNoSideEffect(context, target, "oneShotDigest", OneShotDigest); HashJob::Initialize(env, target); - - SetMethodNoSideEffect( - context, target, "internalVerifyIntegrity", InternalVerifyIntegrity); } void Hash::RegisterExternalReferences(ExternalReferenceRegistry* registry) { @@ -293,8 +290,6 @@ void Hash::RegisterExternalReferences(ExternalReferenceRegistry* registry) { registry->Register(OneShotDigest); HashJob::RegisterExternalReferences(registry); - - registry->Register(InternalVerifyIntegrity); } // new Hash(algorithm, algorithmId, xofLen, algorithmCache) @@ -504,44 +499,5 @@ bool HashTraits::DeriveBits(Environment* env, return true; } -void InternalVerifyIntegrity(const v8::FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - - CHECK_EQ(args.Length(), 3); - - CHECK(args[0]->IsString()); - Utf8Value algorithm(env->isolate(), args[0]); - - CHECK(args[1]->IsString() || IsAnyBufferSource(args[1])); - ByteSource content = ByteSource::FromStringOrBuffer(env, args[1]); - - CHECK(args[2]->IsArrayBufferView()); - ArrayBufferOrViewContents expected(args[2]); - - const EVP_MD* md_type = ncrypto::getDigestByName(*algorithm); - unsigned char digest[EVP_MAX_MD_SIZE]; - unsigned int digest_size; - if (md_type == nullptr || EVP_Digest(content.data(), - content.size(), - digest, - &digest_size, - md_type, - nullptr) != 1) [[unlikely]] { - return ThrowCryptoError( - env, ERR_get_error(), "Digest method not supported"); - } - - if (digest_size != expected.size() || - CRYPTO_memcmp(digest, expected.data(), digest_size) != 0) { - Local ret; - if (StringBytes::Encode(env->isolate(), - reinterpret_cast(digest), - digest_size, - BASE64) - .ToLocal(&ret)) { - args.GetReturnValue().Set(ret); - } - } -} } // namespace crypto } // namespace node diff --git a/src/crypto/crypto_hash.h b/src/crypto/crypto_hash.h index ce865b67133651..0a839733cc156e 100644 --- a/src/crypto/crypto_hash.h +++ b/src/crypto/crypto_hash.h @@ -82,8 +82,6 @@ struct HashTraits final { using HashJob = DeriveBitsJob; -void InternalVerifyIntegrity(const v8::FunctionCallbackInfo& args); - } // namespace crypto } // namespace node From f0cf1a028d79b2c2a4f360e0191d8a546043d92e Mon Sep 17 00:00:00 2001 From: Livia Medeiros Date: Wed, 14 May 2025 16:08:14 +0900 Subject: [PATCH 68/78] doc: make Stability labels not sticky in Stability index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/58291 Reviewed-By: Antoine du Hamel Reviewed-By: Dario Piotrowicz Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Ulises Gascón Reviewed-By: Tierney Cyren --- doc/api_assets/style.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index b9af9ddea55aca..c23e486ef80b82 100644 --- a/doc/api_assets/style.css +++ b/doc/api_assets/style.css @@ -299,6 +299,10 @@ li.picker-header a span { z-index: 1; } +#api-section-documentation .api_stability { + position: static; +} + .api_stability * { color: var(--white) !important; } From 24a9aefb0854ea1c5b392265b9cc65de753cb041 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Wed, 14 May 2025 13:11:42 +0530 Subject: [PATCH 69/78] http2: add diagnostics channel 'http2.client.stream.start' Signed-off-by: Darshan Sen PR-URL: https://github.com/nodejs/node/pull/58292 Reviewed-By: James M Snell Reviewed-By: Santiago Gimeno --- doc/api/diagnostics_channel.md | 7 +++ lib/internal/http2/core.js | 19 +++++- ...stics-channel-http2-client-stream-start.js | 59 +++++++++++++++++++ 3 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 test/parallel/test-diagnostics-channel-http2-client-stream-start.js diff --git a/doc/api/diagnostics_channel.md b/doc/api/diagnostics_channel.md index 9d6ee6065a0959..aef7f3e6ec88e4 100644 --- a/doc/api/diagnostics_channel.md +++ b/doc/api/diagnostics_channel.md @@ -1210,6 +1210,13 @@ Emitted when server sends a response. Emitted when a stream is created on the client. +`http2.client.stream.start` + +* `stream` {ClientHttp2Stream} +* `headers` {HTTP/2 Headers Object} + +Emitted when a stream is started on the client. + #### Modules > Stability: 1 - Experimental diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index e43c43fcaf2f8d..ce9f81bebc2494 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -186,6 +186,7 @@ const { _connectionListener: httpConnectionListener } = http; const dc = require('diagnostics_channel'); const onClientStreamCreatedChannel = dc.channel('http2.client.stream.created'); +const onClientStreamStartChannel = dc.channel('http2.client.stream.start'); let debug = require('internal/util/debuglog').debuglog('http2', (fn) => { debug = fn; @@ -381,6 +382,12 @@ function onSessionHeaders(handle, id, cat, flags, headers, sensitiveHeaders) { headers: obj, }); } + if (onClientStreamStartChannel.hasSubscribers) { + onClientStreamStartChannel.publish({ + stream, + headers: obj, + }); + } if (endOfStream) { stream.push(null); } @@ -717,7 +724,7 @@ function onGoawayData(code, lastStreamID, buf) { // When a ClientHttp2Session is first created, the socket may not yet be // connected. If request() is called during this time, the actual request // will be deferred until the socket is ready to go. -function requestOnConnect(headers, options) { +function requestOnConnect(headersList, headersParam, options) { const session = this[kSession]; // At this point, the stream should have already been destroyed during @@ -744,7 +751,7 @@ function requestOnConnect(headers, options) { // `ret` will be either the reserved stream ID (if positive) // or an error code (if negative) - const ret = session[kHandle].request(headers, + const ret = session[kHandle].request(headersList, streamOptions, options.parent | 0, options.weight | 0, @@ -776,6 +783,12 @@ function requestOnConnect(headers, options) { return; } this[kInit](ret.id(), ret); + if (onClientStreamStartChannel.hasSubscribers) { + onClientStreamStartChannel.publish({ + stream: this, + headers: headersParam, + }); + } } // Validates that priority options are correct, specifically: @@ -1859,7 +1872,7 @@ class ClientHttp2Session extends Http2Session { } } - const onConnect = reqAsync.bind(requestOnConnect.bind(stream, headersList, options)); + const onConnect = reqAsync.bind(requestOnConnect.bind(stream, headersList, headersParam, options)); if (this.connecting) { if (this[kPendingRequestCalls] !== null) { this[kPendingRequestCalls].push(onConnect); diff --git a/test/parallel/test-diagnostics-channel-http2-client-stream-start.js b/test/parallel/test-diagnostics-channel-http2-client-stream-start.js new file mode 100644 index 00000000000000..e8edf3a0a49f4a --- /dev/null +++ b/test/parallel/test-diagnostics-channel-http2-client-stream-start.js @@ -0,0 +1,59 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); + +// This test ensures that the built-in HTTP/2 diagnostics channels are reporting +// the diagnostics messages for the 'http2.client.stream.start' channel when +// ClientHttp2Streams are started by both: +// - the client calling ClientHttp2Session#request() +// - in response to an incoming 'push' event from the server + +const Countdown = require('../common/countdown'); +const assert = require('assert'); +const dc = require('diagnostics_channel'); +const http2 = require('http2'); +const { Duplex } = require('stream'); + +const clientHttp2StreamStartCount = 2; + +dc.subscribe('http2.client.stream.start', common.mustCall(({ stream, headers }) => { + // Since ClientHttp2Stream is not exported from any module, this just checks + // if the stream is an instance of Duplex. + assert.ok(stream instanceof Duplex); + assert.strictEqual(stream.constructor.name, 'ClientHttp2Stream'); + assert.ok(headers && !Array.isArray(headers) && typeof headers === 'object'); +}, clientHttp2StreamStartCount)); + +const server = http2.createServer(); +server.on('stream', common.mustCall((stream) => { + stream.respond(); + stream.end(); + + stream.pushStream({}, common.mustSucceed((pushStream) => { + pushStream.respond(); + pushStream.end(); + }, 1)); +}, 1)); + +server.listen(0, common.mustCall(() => { + const port = server.address().port; + const client = http2.connect(`http://localhost:${port}`); + + const countdown = new Countdown(clientHttp2StreamStartCount, () => { + client.close(); + server.close(); + }); + + const stream = client.request({}); + stream.on('response', common.mustCall(() => { + countdown.dec(); + })); + + client.on('stream', common.mustCall((pushStream) => { + pushStream.on('push', common.mustCall(() => { + countdown.dec(); + }, 1)); + }, 1)); +}, 1)); From 3b9b010844c570317141c462ae7d5bc74ff0b491 Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Wed, 14 May 2025 15:06:03 -0300 Subject: [PATCH 70/78] doc: remove comma delimiter mention on permissions doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/58297 Fixes: https://github.com/nodejs/node/issues/58287 Reviewed-By: Marco Ippolito Reviewed-By: Edy Silva Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Ulises Gascón --- doc/api/permissions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/permissions.md b/doc/api/permissions.md index f912cb62862a81..8c226f638a6902 100644 --- a/doc/api/permissions.md +++ b/doc/api/permissions.md @@ -108,8 +108,8 @@ The valid arguments for both flags are: * `*` - To allow all `FileSystemRead` or `FileSystemWrite` operations, respectively. -* Paths delimited by comma (`,`) to allow only matching `FileSystemRead` or - `FileSystemWrite` operations, respectively. +* Relative paths to the current working directory. +* Absolute paths. Example: From f04f09d783ebda860589ccafdd530a0ed741ac19 Mon Sep 17 00:00:00 2001 From: Allon Murienik Date: Wed, 14 May 2025 22:17:46 +0300 Subject: [PATCH 71/78] doc: mark the callback argument of crypto.generatePrime as mandatory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current documentation lists the `callback` argument of `crypto.generatePrime` as optional (it's surrounded by square brackets), but this is incorrect - calling the function without a callback will result in an `ERR_INVALID_ARG_TYPE` error: For the record, the correct way to generate a prime synchronously, without a callback, is to use the `generatePrimeSync` API. This patch fixes the documentation and marks the callback argument as mandatory. The `options` (second) argument, is indeed optional, and is marked as such. Fixes: https://github.com/nodejs/node/issues/58298 PR-URL: https://github.com/nodejs/node/pull/58299 Reviewed-By: James M Snell Reviewed-By: Ulises Gascón Reviewed-By: Edy Silva --- doc/api/crypto.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 7761b4fdcc6555..1b5ca23f8050c1 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -3900,7 +3900,7 @@ console.log(key.export().toString('hex')); // e89..........41e The size of a generated HMAC key should not exceed the block size of the underlying hash function. See [`crypto.createHmac()`][] for more information. -### `crypto.generatePrime(size[, options[, callback]])` +### `crypto.generatePrime(size[, options], callback)` -* `algorithm`: {AlgorithmIdentifier|RsaHashedImportParams|EcKeyImportParams|HmacImportParams} +* `algorithm`: {string|Algorithm|RsaHashedImportParams|EcKeyImportParams|HmacImportParams} diff --git a/doc/api/webcrypto.md b/doc/api/webcrypto.md index 71cff91b2bc87b..4db5b84842c5d4 100644 --- a/doc/api/webcrypto.md +++ b/doc/api/webcrypto.md @@ -441,7 +441,7 @@ added: v15.0.0 -* Type: {AesKeyGenParams|RsaHashedKeyGenParams|EcKeyGenParams|HmacKeyGenParams} +* Type: {KeyAlgorithm|RsaHashedKeyAlgorithm|EcKeyAlgorithm|AesKeyAlgorithm|HmacKeyAlgorithm} @@ -635,7 +635,7 @@ changes: * `algorithm`: {EcdhKeyDeriveParams|HkdfParams|Pbkdf2Params} * `baseKey`: {CryptoKey} -* `derivedKeyAlgorithm`: {string|AlgorithmIdentifier|HmacImportParams|AesDerivedKeyParams} +* `derivedKeyAlgorithm`: {string|Algorithm|HmacImportParams|AesDerivedKeyParams} * `extractable`: {boolean} * `keyUsages`: {string\[]} See [Key usages][]. * Returns: {Promise} Fulfills with a {CryptoKey} upon success. @@ -665,7 +665,7 @@ The algorithms currently supported include: added: v15.0.0 --> -* `algorithm`: {string|AlgorithmIdentifier} +* `algorithm`: {string|Algorithm} * `data`: {ArrayBuffer|TypedArray|DataView|Buffer} * Returns: {Promise} Fulfills with an {ArrayBuffer} upon success. @@ -761,7 +761,7 @@ added: v15.0.0 -* `algorithm`: {string|AlgorithmIdentifier|RsaHashedKeyGenParams|EcKeyGenParams|HmacKeyGenParams|AesKeyGenParams} +* `algorithm`: {string|Algorithm|RsaHashedKeyGenParams|EcKeyGenParams|HmacKeyGenParams|AesKeyGenParams} @@ -815,7 +815,7 @@ changes: -* `algorithm`: {string|AlgorithmIdentifier|RsaHashedImportParams|EcKeyImportParams|HmacImportParams} +* `algorithm`: {string|Algorithm|RsaHashedImportParams|EcKeyImportParams|HmacImportParams} @@ -865,7 +865,7 @@ changes: -* `algorithm`: {string|AlgorithmIdentifier|RsaPssParams|EcdsaParams|Ed448Params} +* `algorithm`: {string|Algorithm|RsaPssParams|EcdsaParams|Ed448Params} * `key`: {CryptoKey} * `data`: {ArrayBuffer|TypedArray|DataView|Buffer} * Returns: {Promise} Fulfills with an {ArrayBuffer} upon success. @@ -898,8 +898,8 @@ added: v15.0.0 -* `unwrapAlgo`: {string|AlgorithmIdentifier|RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams} -* `unwrappedKeyAlgo`: {string|AlgorithmIdentifier|RsaHashedImportParams|EcKeyImportParams|HmacImportParams} +* `unwrapAlgo`: {string|Algorithm|RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams} +* `unwrappedKeyAlgo`: {string|Algorithm|RsaHashedImportParams|EcKeyImportParams|HmacImportParams} @@ -955,7 +955,7 @@ changes: -* `algorithm`: {string|AlgorithmIdentifier|RsaPssParams|EcdsaParams|Ed448Params} +* `algorithm`: {string|Algorithm|RsaPssParams|EcdsaParams|Ed448Params} * `key`: {CryptoKey} * `signature`: {ArrayBuffer|TypedArray|DataView|Buffer} * `data`: {ArrayBuffer|TypedArray|DataView|Buffer} @@ -988,7 +988,7 @@ added: v15.0.0 * `format`: {string} Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. * `key`: {CryptoKey} * `wrappingKey`: {CryptoKey} -* `wrapAlgo`: {string|AlgorithmIdentifier|RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams} +* `wrapAlgo`: {string|Algorithm|RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams} * Returns: {Promise} Fulfills with an {ArrayBuffer} upon success. @@ -1017,13 +1017,13 @@ The algorithm parameter objects define the methods and parameters used by the various {SubtleCrypto} methods. While described here as "classes", they are simple JavaScript dictionary objects. -### Class: `AlgorithmIdentifier` +### Class: `Algorithm` -#### `algorithmIdentifier.name` +#### `Algorithm.name` + +#### `aesKeyAlgorithm.length` + + + +* Type: {number} + +The length of the AES key in bits. + +#### `aesKeyAlgorithm.name` + + + +* Type: {string} + ### Class: `AesKeyGenParams` -* Type: {string|Object} +* Type: {string|Algorithm} If represented as a {string}, the value must be one of: @@ -1245,8 +1269,8 @@ If represented as a {string}, the value must be one of: * `'SHA-384'` * `'SHA-512'` -If represented as an {Object}, the object must have a `name` property -whose value is one of the above listed values. +If represented as an {Algorithm}, the object's `name` property +must be one of the above listed values. #### `ecdsaParams.name` @@ -1256,6 +1280,28 @@ added: v15.0.0 * Type: {string} Must be `'ECDSA'`. +### Class: `EcKeyAlgorithm` + + + +#### `ecKeyAlgorithm.name` + + + +* Type: {string} + +#### `ecKeyAlgorithm.namedCurve` + + + +* Type: {string} + ### Class: `EcKeyGenParams` -* Type: {string|Object} +* Type: {string|Algorithm} If represented as a {string}, the value must be one of: @@ -1352,8 +1398,8 @@ If represented as a {string}, the value must be one of: * `'SHA-384'` * `'SHA-512'` -If represented as an {Object}, the object must have a `name` property -whose value is one of the above listed values. +If represented as an {Algorithm}, the object's `name` property +must be one of the above listed values. #### `hkdfParams.info` @@ -1399,7 +1445,7 @@ added: v15.0.0 added: v15.0.0 --> -* Type: {string|Object} +* Type: {string|Algorithm} If represented as a {string}, the value must be one of: @@ -1408,8 +1454,8 @@ If represented as a {string}, the value must be one of: * `'SHA-384'` * `'SHA-512'` -If represented as an {Object}, the object must have a `name` property -whose value is one of the above listed values. +If represented as an {Algorithm}, the object's `name` property +must be one of the above listed values. #### `hmacImportParams.length` @@ -1430,6 +1476,38 @@ added: v15.0.0 * Type: {string} Must be `'HMAC'`. +### Class: `HmacKeyAlgorithm` + + + +#### `hmacKeyAlgorithm.hash` + + + +* Type: {Algorithm} + +#### `hmacKeyAlgorithm.length` + + + +* Type: {number} + +The length of the HMAC key in bits. + +#### `hmacKeyAlgorithm.name` + + + +* Type: {string} + ### Class: `HmacKeyGenParams` -* Type: {string|Object} +* Type: {string|Algorithm} If represented as a {string}, the value must be one of: @@ -1451,8 +1529,8 @@ If represented as a {string}, the value must be one of: * `'SHA-384'` * `'SHA-512'` -If represented as an {Object}, the object must have a `name` property -whose value is one of the above listed values. +If represented as an {Algorithm}, the object's `name` property +must be one of the above listed values. #### `hmacKeyGenParams.length` @@ -1474,6 +1552,20 @@ added: v15.0.0 * Type: {string} Must be `'HMAC'`. +### Class: `KeyAlgorithm` + + + +#### `keyAlgorithm.name` + + + +* Type: {string} + ### Class: `Pbkdf2Params` -* Type: {string|Object} +* Type: {string|Algorithm} If represented as a {string}, the value must be one of: @@ -1495,8 +1587,8 @@ If represented as a {string}, the value must be one of: * `'SHA-384'` * `'SHA-512'` -If represented as an {Object}, the object must have a `name` property -whose value is one of the above listed values. +If represented as an {Algorithm}, the object's `name` property +must be one of the above listed values. #### `pbkdf2Params.iterations` @@ -1538,7 +1630,7 @@ added: v15.0.0 added: v15.0.0 --> -* Type: {string|Object} +* Type: {string|Algorithm} If represented as a {string}, the value must be one of: @@ -1547,8 +1639,8 @@ If represented as a {string}, the value must be one of: * `'SHA-384'` * `'SHA-512'` -If represented as an {Object}, the object must have a `name` property -whose value is one of the above listed values. +If represented as an {Algorithm}, the object's `name` property +must be one of the above listed values. #### `rsaHashedImportParams.name` @@ -1559,6 +1651,48 @@ added: v15.0.0 * Type: {string} Must be one of `'RSASSA-PKCS1-v1_5'`, `'RSA-PSS'`, or `'RSA-OAEP'`. +### Class: `RsaHashedKeyAlgorithm` + + + +#### `rsaHashedKeyAlgorithm.hash` + + + +* Type: {Algorithm} + +#### `rsaHashedKeyAlgorithm.modulusLength` + + + +* Type: {number} + +The length in bits of the RSA modulus. + +#### `rsaHashedKeyAlgorithm.name` + + + +* Type: {string} + +#### `rsaHashedKeyAlgorithm.publicExponent` + + + +* Type: {Uint8Array} + +The RSA public exponent. + ### Class: `RsaHashedKeyGenParams` -* Type: {string|Object} +* Type: {string|Algorithm} If represented as a {string}, the value must be one of: @@ -1580,8 +1714,8 @@ If represented as a {string}, the value must be one of: * `'SHA-384'` * `'SHA-512'` -If represented as an {Object}, the object must have a `name` property -whose value is one of the above listed values. +If represented as an {Algorithm}, the object's `name` property +must be one of the above listed values. #### `rsaHashedKeyGenParams.modulusLength` diff --git a/tools/doc/type-parser.mjs b/tools/doc/type-parser.mjs index 9485a85e4bbb70..adf320af6e1989 100644 --- a/tools/doc/type-parser.mjs +++ b/tools/doc/type-parser.mjs @@ -87,23 +87,29 @@ const customTypesMap = { 'Verify': 'crypto.html#class-verify', 'crypto.constants': 'crypto.html#cryptoconstants', + 'Algorithm': 'webcrypto.html#class-algorithm', 'CryptoKey': 'webcrypto.html#class-cryptokey', 'CryptoKeyPair': 'webcrypto.html#class-cryptokeypair', 'Crypto': 'webcrypto.html#class-crypto', 'SubtleCrypto': 'webcrypto.html#class-subtlecrypto', 'RsaOaepParams': 'webcrypto.html#class-rsaoaepparams', - 'AlgorithmIdentifier': 'webcrypto.html#class-algorithmidentifier', 'AesCtrParams': 'webcrypto.html#class-aesctrparams', 'AesCbcParams': 'webcrypto.html#class-aescbcparams', 'AesDerivedKeyParams': 'webcrypto.html#class-aesderivedkeyparams', 'AesGcmParams': 'webcrypto.html#class-aesgcmparams', 'EcdhKeyDeriveParams': 'webcrypto.html#class-ecdhkeyderiveparams', 'HkdfParams': 'webcrypto.html#class-hkdfparams', + 'KeyAlgorithm': 'webcrypto.html#class-keyalgorithm', 'Pbkdf2Params': 'webcrypto.html#class-pbkdf2params', + 'HmacKeyAlgorithm': 'webcrypto.html#class-hmackeyalgorithm', 'HmacKeyGenParams': 'webcrypto.html#class-hmackeygenparams', + 'AesKeyAlgorithm': 'webcrypto.html#class-aeskeyalgorithm', 'AesKeyGenParams': 'webcrypto.html#class-aeskeygenparams', + 'RsaHashedKeyAlgorithm': + 'webcrypto.html#class-rsahashedkeyalgorithm', 'RsaHashedKeyGenParams': 'webcrypto.html#class-rsahashedkeygenparams', + 'EcKeyAlgorithm': 'webcrypto.html#class-eckeyalgorithm', 'EcKeyGenParams': 'webcrypto.html#class-eckeygenparams', 'RsaHashedImportParams': 'webcrypto.html#class-rsahashedimportparams', From c35cc1bdd9fbd7589f7a99b3b47dacad2a5fc292 Mon Sep 17 00:00:00 2001 From: Nico Jansen Date: Thu, 15 May 2025 00:50:38 +0200 Subject: [PATCH 73/78] doc: document default test-reporter change Document the change made in https://github.com/nodejs/node/pull/54548 PR-URL: https://github.com/nodejs/node/pull/58302 Fixes: https://github.com/nodejs/node/issues/58301 Refs: https://github.com/nodejs/node/pull/54548 Reviewed-By: Tierney Cyren Reviewed-By: Jacob Smith Reviewed-By: Antoine du Hamel Reviewed-By: Pietro Marchini --- doc/api/test.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/test.md b/doc/api/test.md index e1639cab9ce585..154d11424f194e 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -1046,6 +1046,10 @@ added: - v19.6.0 - v18.15.0 changes: + - version: v23.0.0 + pr-url: https://github.com/nodejs/node/pull/54548 + description: The default reporter on non-TTY stdout is changed from `tap` to + `spec`, aligning with TTY stdout. - version: - v19.9.0 - v18.17.0 From 2676ca0cf57e108909aef888b51022421ec0e4fd Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Thu, 15 May 2025 07:35:45 -0300 Subject: [PATCH 74/78] doc: add latest security release steward PR-URL: https://github.com/nodejs/node/pull/58339 Reviewed-By: Darshan Sen Reviewed-By: Jordan Harband Reviewed-By: Marco Ippolito --- doc/contributing/security-release-process.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/contributing/security-release-process.md b/doc/contributing/security-release-process.md index 66078c255fb238..0903557a1de181 100644 --- a/doc/contributing/security-release-process.md +++ b/doc/contributing/security-release-process.md @@ -36,6 +36,7 @@ The current security stewards are documented in the main Node.js | NodeSource | Rafael | 2024-Apr-10 | | NodeSource | Rafael | 2024-Jul-08 | | NodeSource | Rafael | 2025-Jan-21 | +| NodeSource | Rafael | 2025-May-14 | | Datadog | Bryan | | | IBM | Joe | | | Platformatic | Matteo | | From 6301b003f7ea156475b86cb2bee9108b2b907dfb Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Thu, 15 May 2025 16:41:17 -0300 Subject: [PATCH 75/78] tools: ignore `deps/` and `benchmark/` for CodeQL PR-URL: https://github.com/nodejs/node/pull/58254 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- .github/codeql-config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/codeql-config.yml b/.github/codeql-config.yml index 4e81d7e041e68a..d042ed96096955 100644 --- a/.github/codeql-config.yml +++ b/.github/codeql-config.yml @@ -2,5 +2,5 @@ name: CodeQL config paths-ignore: - test - - deps/v8/test - - deps/v8/tools + - deps + - benchmark From 570cb6f6b60f5c68ec7a20b808c3b312a2722264 Mon Sep 17 00:00:00 2001 From: Jonas Date: Fri, 16 May 2025 14:53:33 -0400 Subject: [PATCH 76/78] meta: ignore mailmap changes in linux ci PR-URL: https://github.com/nodejs/node/pull/58356 Reviewed-By: Yagiz Nizipli Reviewed-By: James M Snell Reviewed-By: Richard Lau Reviewed-By: Filip Skokan Reviewed-By: Luigi Pinca Reviewed-By: Trivikram Kamat --- .github/workflows/test-linux.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index ea4a6a138e21ad..789689c25cd4bf 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -3,6 +3,7 @@ name: Test Linux on: pull_request: paths-ignore: + - .mailmap - README.md - .github/** - '!.github/workflows/test-linux.yml' @@ -14,6 +15,7 @@ on: - v[0-9]+.x-staging - v[0-9]+.x paths-ignore: + - .mailmap - README.md - .github/** - '!.github/workflows/test-linux.yml' From 9d35b4ce954088b5ca0d8a77dafd032ab5e4e272 Mon Sep 17 00:00:00 2001 From: Jonas Date: Fri, 16 May 2025 16:19:55 -0400 Subject: [PATCH 77/78] doc: add JonasBa to collaborators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: https://github.com/nodejs/node/issues/57410 PR-URL: https://github.com/nodejs/node/pull/58355 Reviewed-By: Yagiz Nizipli Reviewed-By: Richard Lau Reviewed-By: Chengzhong Wu Reviewed-By: James M Snell Reviewed-By: Filip Skokan Reviewed-By: Ulises Gascón Reviewed-By: Darshan Sen Reviewed-By: Matteo Collina Reviewed-By: Rafael Gonzaga --- .mailmap | 1 + README.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.mailmap b/.mailmap index e3e502c8716123..ec877b4c767a83 100644 --- a/.mailmap +++ b/.mailmap @@ -271,6 +271,7 @@ John McGuirk John Musgrave Johnny Ray Austin Jon Tippens +Jonas Badalic Jonas Pfenniger Jonathan Gourlay Jonathan Ong diff --git a/README.md b/README.md index dcb1e77c5d9477..93964e275e7a10 100644 --- a/README.md +++ b/README.md @@ -363,6 +363,8 @@ For information about the governance of the Node.js project, see **Jason Zhang** <> (he/him) * [jkrems](https://github.com/jkrems) - **Jan Martin** <> (he/him) +* [JonasBa](https://github.com/JonasBa) - + **Jonas Badalic** <> (he/him) * [joyeecheung](https://github.com/joyeecheung) - **Joyee Cheung** <> (she/her) * [juanarbol](https://github.com/juanarbol) - From 587a88b7243005969627b190d009a70c2cb9f23e Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Tue, 20 May 2025 14:00:33 -0400 Subject: [PATCH 78/78] 2025-05-21, Version 24.1.0 (Current) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Notable changes: doc: * add JonasBa to collaborators (Jonas Badalic) https://github.com/nodejs/node/pull/58355 * add puskin to collaborators (Giovanni Bucci) https://github.com/nodejs/node/pull/58308 fs: * (SEMVER-MINOR) add to `Dir` support for explicit resource management (Antoine du Hamel) https://github.com/nodejs/node/pull/58206 test_runner: * Revert "test_runner: change ts default glob (Théo LUDWIG) https://github.com/nodejs/node/pull/58202 PR-URL: https://github.com/nodejs/node/pull/58406 --- CHANGELOG.md | 3 +- doc/api/cli.md | 2 +- doc/api/fs.md | 10 ++-- doc/api/repl.md | 2 +- doc/changelogs/CHANGELOG_V24.md | 92 +++++++++++++++++++++++++++++++++ src/node_version.h | 6 +-- 6 files changed, 104 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b5bba8e266594..bb1b85cf163c9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,7 +40,8 @@ release. -24.0.2
+24.1.0
+24.0.2
24.0.1
24.0.0
diff --git a/doc/api/cli.md b/doc/api/cli.md index 16781b89b8e461..2b707496b5531c 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1209,7 +1209,7 @@ Enable experimental [`Web Storage`][] support. > Stability: 1.1 - Active Development diff --git a/doc/api/fs.md b/doc/api/fs.md index 8a273b786ca8f8..9fefd90aced5c8 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1077,7 +1077,7 @@ behavior is similar to `cp dir1/ dir2/`. > Stability: 1 - Experimental @@ -6758,7 +6758,7 @@ An alias for `dir.close()`. #### `dir[Symbol.Dispose]()` > Stability: 1 - Experimental diff --git a/doc/api/repl.md b/doc/api/repl.md index 866c074a1f6ad4..53c99cc5167fd5 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -680,7 +680,7 @@ A list of the names of some Node.js modules, e.g., `'http'`.