From 4e4c198c164b1fba9bba790ea9acb7fa47fc4f80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= Date: Thu, 4 Jun 2026 06:17:27 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#75038=20node:=20v2?= =?UTF-8?q?4.13=20by=20@Renegade334?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/node/v24/domain.d.ts | 20 +- types/node/v24/inspector.generated.d.ts | 845 ++++++++++++------------ types/node/v24/module.d.ts | 62 -- types/node/v24/net.d.ts | 8 +- types/node/v24/package.json | 4 +- types/node/v24/process.d.ts | 21 +- types/node/v24/readline.d.ts | 6 + types/node/v24/sqlite.d.ts | 114 +++- types/node/v24/test.d.ts | 35 +- types/node/v24/test/net.ts | 7 +- types/node/v24/test/process.ts | 1 + types/node/v24/test/sqlite.ts | 2 +- types/node/v24/test/test.ts | 2 + types/node/v24/test/tls.ts | 1 + types/node/v24/test/v8.ts | 6 +- types/node/v24/tls.d.ts | 18 +- types/node/v24/url.d.ts | 22 + types/node/v24/util.d.ts | 7 +- types/node/v24/v8.d.ts | 6 +- types/node/v24/worker_threads.d.ts | 4 +- 20 files changed, 636 insertions(+), 555 deletions(-) diff --git a/types/node/v24/domain.d.ts b/types/node/v24/domain.d.ts index 4c64115370b6cf..d6eaecbc8b237a 100644 --- a/types/node/v24/domain.d.ts +++ b/types/node/v24/domain.d.ts @@ -24,10 +24,9 @@ declare module "domain" { */ class Domain extends EventEmitter { /** - * An array of timers and event emitters that have been explicitly added - * to the domain. + * An array of event emitters that have been explicitly added to the domain. */ - members: Array; + members: EventEmitter[]; /** * The `enter()` method is plumbing used by the `run()`, `bind()`, and `intercept()` methods to set the active domain. It sets `domain.active` and `process.domain` to the domain, and implicitly * pushes the domain onto the domain @@ -91,20 +90,17 @@ declare module "domain" { * will be routed to the domain's `'error'` event, just like with implicit * binding. * - * This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by - * the domain `'error'` handler. - * - * If the Timer or `EventEmitter` was already bound to a domain, it is removed - * from that one, and bound to this one instead. - * @param emitter emitter or timer to be added to the domain + * If the `EventEmitter` was already bound to a domain, it is removed from that + * one, and bound to this one instead. + * @param emitter emitter to be added to the domain */ - add(emitter: EventEmitter | NodeJS.Timer): void; + add(emitter: EventEmitter): void; /** * The opposite of {@link add}. Removes domain handling from the * specified emitter. - * @param emitter emitter or timer to be removed from the domain + * @param emitter emitter to be removed from the domain */ - remove(emitter: EventEmitter | NodeJS.Timer): void; + remove(emitter: EventEmitter): void; /** * The returned function will be a wrapper around the supplied callback * function. When the returned function is called, any errors that are diff --git a/types/node/v24/inspector.generated.d.ts b/types/node/v24/inspector.generated.d.ts index 2af699c72d52c6..d7d3a55c6af1d1 100644 --- a/types/node/v24/inspector.generated.d.ts +++ b/types/node/v24/inspector.generated.d.ts @@ -8,7 +8,6 @@ declare module "inspector" { method: string; params: T; } - namespace Schema { /** * Description of the protocol domain. @@ -1621,79 +1620,38 @@ declare module "inspector" { statsUpdate: number[]; } } - namespace NodeTracing { - interface TraceConfig { - /** - * Controls how the trace buffer stores data. - */ - recordMode?: string | undefined; - /** - * Included category filters. - */ - includedCategories: string[]; - } - interface StartParameterType { - traceConfig: TraceConfig; - } - interface GetCategoriesReturnType { + namespace IO { + type StreamHandle = string; + interface ReadParameterType { /** - * A list of supported tracing categories. + * Handle of the stream to read. */ - categories: string[]; - } - interface DataCollectedEventDataType { - value: object[]; - } - } - namespace NodeWorker { - type WorkerID = string; - /** - * Unique identifier of attached debugging session. - */ - type SessionID = string; - interface WorkerInfo { - workerId: WorkerID; - type: string; - title: string; - url: string; - } - interface SendMessageToWorkerParameterType { - message: string; + handle: StreamHandle; /** - * Identifier of the session. + * Seek to the specified offset before reading (if not specified, proceed with offset + * following the last read). Some types of streams may only support sequential reads. */ - sessionId: SessionID; - } - interface EnableParameterType { + offset?: number | undefined; /** - * Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger` - * message to run them. + * Maximum number of bytes to read (left upon the agent discretion if not specified). */ - waitForDebuggerOnStart: boolean; - } - interface DetachParameterType { - sessionId: SessionID; + size?: number | undefined; } - interface AttachedToWorkerEventDataType { + interface CloseParameterType { /** - * Identifier assigned to the session used to send/receive messages. + * Handle of the stream to close. */ - sessionId: SessionID; - workerInfo: WorkerInfo; - waitingForDebugger: boolean; + handle: StreamHandle; } - interface DetachedFromWorkerEventDataType { + interface ReadReturnType { /** - * Detached session identifier. + * Data that were read. */ - sessionId: SessionID; - } - interface ReceivedMessageFromWorkerEventDataType { + data: string; /** - * Identifier of a session which sends a message. + * Set if the end-of-file condition occurred while reading. */ - sessionId: SessionID; - message: string; + eof: boolean; } } namespace Network { @@ -1801,8 +1759,8 @@ declare module "inspector" { * Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc). * @experimental */ - maxResourceBufferSize?: number | undefined; - } + maxResourceBufferSize?: number | undefined; + } interface GetRequestPostDataParameterType { /** * Identifier of the network request to get content for. @@ -1987,6 +1945,81 @@ declare module "inspector" { enabled: boolean; } } + namespace NodeTracing { + interface TraceConfig { + /** + * Controls how the trace buffer stores data. + */ + recordMode?: string | undefined; + /** + * Included category filters. + */ + includedCategories: string[]; + } + interface StartParameterType { + traceConfig: TraceConfig; + } + interface GetCategoriesReturnType { + /** + * A list of supported tracing categories. + */ + categories: string[]; + } + interface DataCollectedEventDataType { + value: object[]; + } + } + namespace NodeWorker { + type WorkerID = string; + /** + * Unique identifier of attached debugging session. + */ + type SessionID = string; + interface WorkerInfo { + workerId: WorkerID; + type: string; + title: string; + url: string; + } + interface SendMessageToWorkerParameterType { + message: string; + /** + * Identifier of the session. + */ + sessionId: SessionID; + } + interface EnableParameterType { + /** + * Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger` + * message to run them. + */ + waitForDebuggerOnStart: boolean; + } + interface DetachParameterType { + sessionId: SessionID; + } + interface AttachedToWorkerEventDataType { + /** + * Identifier assigned to the session used to send/receive messages. + */ + sessionId: SessionID; + workerInfo: WorkerInfo; + waitingForDebugger: boolean; + } + interface DetachedFromWorkerEventDataType { + /** + * Detached session identifier. + */ + sessionId: SessionID; + } + interface ReceivedMessageFromWorkerEventDataType { + /** + * Identifier of a session which sends a message. + */ + sessionId: SessionID; + message: string; + } + } namespace Target { type SessionID = string; type TargetID = string; @@ -2011,41 +2044,6 @@ declare module "inspector" { waitingForDebugger: boolean; } } - namespace IO { - type StreamHandle = string; - interface ReadParameterType { - /** - * Handle of the stream to read. - */ - handle: StreamHandle; - /** - * Seek to the specified offset before reading (if not specified, proceed with offset - * following the last read). Some types of streams may only support sequential reads. - */ - offset?: number | undefined; - /** - * Maximum number of bytes to read (left upon the agent discretion if not specified). - */ - size?: number | undefined; - } - interface CloseParameterType { - /** - * Handle of the stream to close. - */ - handle: StreamHandle; - } - interface ReadReturnType { - /** - * Data that were read. - */ - data: string; - /** - * Set if the end-of-file condition occurred while reading. - */ - eof: boolean; - } - } - interface Session { /** * Posts a message to the inspector back-end. `callback` will be notified when @@ -2351,39 +2349,12 @@ declare module "inspector" { post(method: "HeapProfiler.stopSampling", callback?: (err: Error | null, params: HeapProfiler.StopSamplingReturnType) => void): void; post(method: "HeapProfiler.getSamplingProfile", callback?: (err: Error | null, params: HeapProfiler.GetSamplingProfileReturnType) => void): void; /** - * Gets supported tracing categories. - */ - post(method: "NodeTracing.getCategories", callback?: (err: Error | null, params: NodeTracing.GetCategoriesReturnType) => void): void; - /** - * Start trace events collection. - */ - post(method: "NodeTracing.start", params?: NodeTracing.StartParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeTracing.start", callback?: (err: Error | null) => void): void; - /** - * Stop trace events collection. Remaining collected events will be sent as a sequence of - * dataCollected events followed by tracingComplete event. - */ - post(method: "NodeTracing.stop", callback?: (err: Error | null) => void): void; - /** - * Sends protocol message over session with given id. - */ - post(method: "NodeWorker.sendMessageToWorker", params?: NodeWorker.SendMessageToWorkerParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.sendMessageToWorker", callback?: (err: Error | null) => void): void; - /** - * Instructs the inspector to attach to running workers. Will also attach to new workers - * as they start - */ - post(method: "NodeWorker.enable", params?: NodeWorker.EnableParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.enable", callback?: (err: Error | null) => void): void; - /** - * Detaches from all running workers and disables attaching to new workers as they are started. - */ - post(method: "NodeWorker.disable", callback?: (err: Error | null) => void): void; - /** - * Detached from the worker with given sessionId. + * Read a chunk of the stream */ - post(method: "NodeWorker.detach", params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void; - post(method: "NodeWorker.detach", callback?: (err: Error | null) => void): void; + post(method: "IO.read", params?: IO.ReadParameterType, callback?: (err: Error | null, params: IO.ReadReturnType) => void): void; + post(method: "IO.read", callback?: (err: Error | null, params: IO.ReadReturnType) => void): void; + post(method: "IO.close", params?: IO.CloseParameterType, callback?: (err: Error | null) => void): void; + post(method: "IO.close", callback?: (err: Error | null) => void): void; /** * Disables network tracking, prevents network events from being sent to the client. */ @@ -2432,33 +2403,59 @@ declare module "inspector" { */ post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType, callback?: (err: Error | null) => void): void; post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", callback?: (err: Error | null) => void): void; - post(method: "Target.setAutoAttach", params?: Target.SetAutoAttachParameterType, callback?: (err: Error | null) => void): void; - post(method: "Target.setAutoAttach", callback?: (err: Error | null) => void): void; /** - * Read a chunk of the stream + * Gets supported tracing categories. */ - post(method: "IO.read", params?: IO.ReadParameterType, callback?: (err: Error | null, params: IO.ReadReturnType) => void): void; - post(method: "IO.read", callback?: (err: Error | null, params: IO.ReadReturnType) => void): void; - post(method: "IO.close", params?: IO.CloseParameterType, callback?: (err: Error | null) => void): void; - post(method: "IO.close", callback?: (err: Error | null) => void): void; - - addListener(event: string, listener: (...args: any[]) => void): this; + post(method: "NodeTracing.getCategories", callback?: (err: Error | null, params: NodeTracing.GetCategoriesReturnType) => void): void; /** - * Emitted when any notification from the V8 Inspector is received. + * Start trace events collection. */ - addListener(event: "inspectorNotification", listener: (message: InspectorNotification) => void): this; + post(method: "NodeTracing.start", params?: NodeTracing.StartParameterType, callback?: (err: Error | null) => void): void; + post(method: "NodeTracing.start", callback?: (err: Error | null) => void): void; /** - * Issued when new execution context is created. + * Stop trace events collection. Remaining collected events will be sent as a sequence of + * dataCollected events followed by tracingComplete event. */ - addListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; + post(method: "NodeTracing.stop", callback?: (err: Error | null) => void): void; /** - * Issued when execution context is destroyed. + * Sends protocol message over session with given id. */ - addListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; + post(method: "NodeWorker.sendMessageToWorker", params?: NodeWorker.SendMessageToWorkerParameterType, callback?: (err: Error | null) => void): void; + post(method: "NodeWorker.sendMessageToWorker", callback?: (err: Error | null) => void): void; /** - * Issued when all executionContexts were cleared in browser + * Instructs the inspector to attach to running workers. Will also attach to new workers + * as they start */ - addListener(event: "Runtime.executionContextsCleared", listener: () => void): this; + post(method: "NodeWorker.enable", params?: NodeWorker.EnableParameterType, callback?: (err: Error | null) => void): void; + post(method: "NodeWorker.enable", callback?: (err: Error | null) => void): void; + /** + * Detaches from all running workers and disables attaching to new workers as they are started. + */ + post(method: "NodeWorker.disable", callback?: (err: Error | null) => void): void; + /** + * Detached from the worker with given sessionId. + */ + post(method: "NodeWorker.detach", params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void; + post(method: "NodeWorker.detach", callback?: (err: Error | null) => void): void; + post(method: "Target.setAutoAttach", params?: Target.SetAutoAttachParameterType, callback?: (err: Error | null) => void): void; + post(method: "Target.setAutoAttach", callback?: (err: Error | null) => void): void; + addListener(event: string, listener: (...args: any[]) => void): this; + /** + * Emitted when any notification from the V8 Inspector is received. + */ + addListener(event: "inspectorNotification", listener: (message: InspectorNotification) => void): this; + /** + * Issued when new execution context is created. + */ + addListener(event: "Runtime.executionContextCreated", listener: (message: InspectorNotification) => void): this; + /** + * Issued when execution context is destroyed. + */ + addListener(event: "Runtime.executionContextDestroyed", listener: (message: InspectorNotification) => void): this; + /** + * Issued when all executionContexts were cleared in browser + */ + addListener(event: "Runtime.executionContextsCleared", listener: () => void): this; /** * Issued when exception was thrown and unhandled. */ @@ -2515,28 +2512,6 @@ declare module "inspector" { * If heap objects tracking has been started then backend may send update for one or more fragments */ addListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - addListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - addListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - addListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - addListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - addListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; /** * Fired when page is about to send HTTP request. */ @@ -2575,6 +2550,28 @@ declare module "inspector" { * example, when inspector.waitingForDebugger is called */ addListener(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; + /** + * Contains an bucket of collected trace events. + */ + addListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + addListener(event: "NodeTracing.tracingComplete", listener: () => void): this; + /** + * Issued when attached to a worker. + */ + addListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + addListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + addListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; addListener(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; addListener(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; emit(event: string | symbol, ...args: any[]): boolean; @@ -2599,11 +2596,6 @@ declare module "inspector" { emit(event: "HeapProfiler.reportHeapSnapshotProgress", message: InspectorNotification): boolean; emit(event: "HeapProfiler.lastSeenObjectId", message: InspectorNotification): boolean; emit(event: "HeapProfiler.heapStatsUpdate", message: InspectorNotification): boolean; - emit(event: "NodeTracing.dataCollected", message: InspectorNotification): boolean; - emit(event: "NodeTracing.tracingComplete"): boolean; - emit(event: "NodeWorker.attachedToWorker", message: InspectorNotification): boolean; - emit(event: "NodeWorker.detachedFromWorker", message: InspectorNotification): boolean; - emit(event: "NodeWorker.receivedMessageFromWorker", message: InspectorNotification): boolean; emit(event: "Network.requestWillBeSent", message: InspectorNotification): boolean; emit(event: "Network.responseReceived", message: InspectorNotification): boolean; emit(event: "Network.loadingFailed", message: InspectorNotification): boolean; @@ -2614,6 +2606,11 @@ declare module "inspector" { emit(event: "Network.webSocketHandshakeResponseReceived", message: InspectorNotification): boolean; emit(event: "NodeRuntime.waitingForDisconnect"): boolean; emit(event: "NodeRuntime.waitingForDebugger"): boolean; + emit(event: "NodeTracing.dataCollected", message: InspectorNotification): boolean; + emit(event: "NodeTracing.tracingComplete"): boolean; + emit(event: "NodeWorker.attachedToWorker", message: InspectorNotification): boolean; + emit(event: "NodeWorker.detachedFromWorker", message: InspectorNotification): boolean; + emit(event: "NodeWorker.receivedMessageFromWorker", message: InspectorNotification): boolean; emit(event: "Target.targetCreated", message: InspectorNotification): boolean; emit(event: "Target.attachedToTarget", message: InspectorNotification): boolean; on(event: string, listener: (...args: any[]) => void): this; @@ -2689,28 +2686,6 @@ declare module "inspector" { * If heap objects tracking has been started then backend may send update for one or more fragments */ on(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - on(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - on(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - on(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - on(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - on(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; /** * Fired when page is about to send HTTP request. */ @@ -2749,6 +2724,28 @@ declare module "inspector" { * example, when inspector.waitingForDebugger is called */ on(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; + /** + * Contains an bucket of collected trace events. + */ + on(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + on(event: "NodeTracing.tracingComplete", listener: () => void): this; + /** + * Issued when attached to a worker. + */ + on(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + on(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + on(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; on(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; on(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; once(event: string, listener: (...args: any[]) => void): this; @@ -2824,28 +2821,6 @@ declare module "inspector" { * If heap objects tracking has been started then backend may send update for one or more fragments */ once(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - once(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - once(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - once(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - once(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - once(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; /** * Fired when page is about to send HTTP request. */ @@ -2884,6 +2859,28 @@ declare module "inspector" { * example, when inspector.waitingForDebugger is called */ once(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; + /** + * Contains an bucket of collected trace events. + */ + once(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + once(event: "NodeTracing.tracingComplete", listener: () => void): this; + /** + * Issued when attached to a worker. + */ + once(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + once(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + once(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; once(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; once(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; @@ -2959,28 +2956,6 @@ declare module "inspector" { * If heap objects tracking has been started then backend may send update for one or more fragments */ prependListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - prependListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - prependListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - prependListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; /** * Fired when page is about to send HTTP request. */ @@ -3019,6 +2994,28 @@ declare module "inspector" { * example, when inspector.waitingForDebugger is called */ prependListener(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; + /** + * Contains an bucket of collected trace events. + */ + prependListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + prependListener(event: "NodeTracing.tracingComplete", listener: () => void): this; + /** + * Issued when attached to a worker. + */ + prependListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + prependListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + prependListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; prependListener(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; prependListener(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; @@ -3094,28 +3091,6 @@ declare module "inspector" { * If heap objects tracking has been started then backend may send update for one or more fragments */ prependOnceListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - prependOnceListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependOnceListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - prependOnceListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - prependOnceListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependOnceListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; /** * Fired when page is about to send HTTP request. */ @@ -3154,11 +3129,32 @@ declare module "inspector" { * example, when inspector.waitingForDebugger is called */ prependOnceListener(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; + /** + * Contains an bucket of collected trace events. + */ + prependOnceListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + prependOnceListener(event: "NodeTracing.tracingComplete", listener: () => void): this; + /** + * Issued when attached to a worker. + */ + prependOnceListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + prependOnceListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + prependOnceListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; prependOnceListener(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; prependOnceListener(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; } } - declare module "inspector/promises" { export { Schema, @@ -3167,15 +3163,14 @@ declare module "inspector/promises" { Console, Profiler, HeapProfiler, - NodeTracing, - NodeWorker, + IO, Network, NodeRuntime, + NodeTracing, + NodeWorker, Target, - IO, } from 'inspector'; } - declare module "inspector/promises" { import { InspectorNotification, @@ -3185,14 +3180,13 @@ declare module "inspector/promises" { Console, Profiler, HeapProfiler, - NodeTracing, - NodeWorker, + IO, Network, NodeRuntime, + NodeTracing, + NodeWorker, Target, - IO, } from "inspector"; - /** * The `inspector.Session` is used for dispatching messages to the V8 inspector * back-end and receiving message responses and notifications. @@ -3454,35 +3448,10 @@ declare module "inspector/promises" { post(method: "HeapProfiler.stopSampling"): Promise; post(method: "HeapProfiler.getSamplingProfile"): Promise; /** - * Gets supported tracing categories. - */ - post(method: "NodeTracing.getCategories"): Promise; - /** - * Start trace events collection. - */ - post(method: "NodeTracing.start", params?: NodeTracing.StartParameterType): Promise; - /** - * Stop trace events collection. Remaining collected events will be sent as a sequence of - * dataCollected events followed by tracingComplete event. - */ - post(method: "NodeTracing.stop"): Promise; - /** - * Sends protocol message over session with given id. - */ - post(method: "NodeWorker.sendMessageToWorker", params?: NodeWorker.SendMessageToWorkerParameterType): Promise; - /** - * Instructs the inspector to attach to running workers. Will also attach to new workers - * as they start - */ - post(method: "NodeWorker.enable", params?: NodeWorker.EnableParameterType): Promise; - /** - * Detaches from all running workers and disables attaching to new workers as they are started. - */ - post(method: "NodeWorker.disable"): Promise; - /** - * Detached from the worker with given sessionId. + * Read a chunk of the stream */ - post(method: "NodeWorker.detach", params?: NodeWorker.DetachParameterType): Promise; + post(method: "IO.read", params?: IO.ReadParameterType): Promise; + post(method: "IO.close", params?: IO.CloseParameterType): Promise; /** * Disables network tracking, prevents network events from being sent to the client. */ @@ -3506,28 +3475,52 @@ declare module "inspector/promises" { */ post(method: "Network.streamResourceContent", params?: Network.StreamResourceContentParameterType): Promise; /** - * Fetches the resource and returns the content. + * Fetches the resource and returns the content. + */ + post(method: "Network.loadNetworkResource", params?: Network.LoadNetworkResourceParameterType): Promise; + /** + * Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`. + */ + post(method: "NodeRuntime.enable"): Promise; + /** + * Disable NodeRuntime events + */ + post(method: "NodeRuntime.disable"): Promise; + /** + * Enable the `NodeRuntime.waitingForDisconnect`. + */ + post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType): Promise; + /** + * Gets supported tracing categories. + */ + post(method: "NodeTracing.getCategories"): Promise; + /** + * Start trace events collection. + */ + post(method: "NodeTracing.start", params?: NodeTracing.StartParameterType): Promise; + /** + * Stop trace events collection. Remaining collected events will be sent as a sequence of + * dataCollected events followed by tracingComplete event. */ - post(method: "Network.loadNetworkResource", params?: Network.LoadNetworkResourceParameterType): Promise; + post(method: "NodeTracing.stop"): Promise; /** - * Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`. + * Sends protocol message over session with given id. */ - post(method: "NodeRuntime.enable"): Promise; + post(method: "NodeWorker.sendMessageToWorker", params?: NodeWorker.SendMessageToWorkerParameterType): Promise; /** - * Disable NodeRuntime events + * Instructs the inspector to attach to running workers. Will also attach to new workers + * as they start */ - post(method: "NodeRuntime.disable"): Promise; + post(method: "NodeWorker.enable", params?: NodeWorker.EnableParameterType): Promise; /** - * Enable the `NodeRuntime.waitingForDisconnect`. + * Detaches from all running workers and disables attaching to new workers as they are started. */ - post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType): Promise; - post(method: "Target.setAutoAttach", params?: Target.SetAutoAttachParameterType): Promise; + post(method: "NodeWorker.disable"): Promise; /** - * Read a chunk of the stream + * Detached from the worker with given sessionId. */ - post(method: "IO.read", params?: IO.ReadParameterType): Promise; - post(method: "IO.close", params?: IO.CloseParameterType): Promise; - + post(method: "NodeWorker.detach", params?: NodeWorker.DetachParameterType): Promise; + post(method: "Target.setAutoAttach", params?: Target.SetAutoAttachParameterType): Promise; addListener(event: string, listener: (...args: any[]) => void): this; /** * Emitted when any notification from the V8 Inspector is received. @@ -3601,28 +3594,6 @@ declare module "inspector/promises" { * If heap objects tracking has been started then backend may send update for one or more fragments */ addListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - addListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - addListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - addListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - addListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - addListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; /** * Fired when page is about to send HTTP request. */ @@ -3661,6 +3632,28 @@ declare module "inspector/promises" { * example, when inspector.waitingForDebugger is called */ addListener(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; + /** + * Contains an bucket of collected trace events. + */ + addListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + addListener(event: "NodeTracing.tracingComplete", listener: () => void): this; + /** + * Issued when attached to a worker. + */ + addListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + addListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + addListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; addListener(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; addListener(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; emit(event: string | symbol, ...args: any[]): boolean; @@ -3685,11 +3678,6 @@ declare module "inspector/promises" { emit(event: "HeapProfiler.reportHeapSnapshotProgress", message: InspectorNotification): boolean; emit(event: "HeapProfiler.lastSeenObjectId", message: InspectorNotification): boolean; emit(event: "HeapProfiler.heapStatsUpdate", message: InspectorNotification): boolean; - emit(event: "NodeTracing.dataCollected", message: InspectorNotification): boolean; - emit(event: "NodeTracing.tracingComplete"): boolean; - emit(event: "NodeWorker.attachedToWorker", message: InspectorNotification): boolean; - emit(event: "NodeWorker.detachedFromWorker", message: InspectorNotification): boolean; - emit(event: "NodeWorker.receivedMessageFromWorker", message: InspectorNotification): boolean; emit(event: "Network.requestWillBeSent", message: InspectorNotification): boolean; emit(event: "Network.responseReceived", message: InspectorNotification): boolean; emit(event: "Network.loadingFailed", message: InspectorNotification): boolean; @@ -3700,6 +3688,11 @@ declare module "inspector/promises" { emit(event: "Network.webSocketHandshakeResponseReceived", message: InspectorNotification): boolean; emit(event: "NodeRuntime.waitingForDisconnect"): boolean; emit(event: "NodeRuntime.waitingForDebugger"): boolean; + emit(event: "NodeTracing.dataCollected", message: InspectorNotification): boolean; + emit(event: "NodeTracing.tracingComplete"): boolean; + emit(event: "NodeWorker.attachedToWorker", message: InspectorNotification): boolean; + emit(event: "NodeWorker.detachedFromWorker", message: InspectorNotification): boolean; + emit(event: "NodeWorker.receivedMessageFromWorker", message: InspectorNotification): boolean; emit(event: "Target.targetCreated", message: InspectorNotification): boolean; emit(event: "Target.attachedToTarget", message: InspectorNotification): boolean; on(event: string, listener: (...args: any[]) => void): this; @@ -3775,28 +3768,6 @@ declare module "inspector/promises" { * If heap objects tracking has been started then backend may send update for one or more fragments */ on(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - on(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - on(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - on(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - on(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - on(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; /** * Fired when page is about to send HTTP request. */ @@ -3835,6 +3806,28 @@ declare module "inspector/promises" { * example, when inspector.waitingForDebugger is called */ on(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; + /** + * Contains an bucket of collected trace events. + */ + on(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + on(event: "NodeTracing.tracingComplete", listener: () => void): this; + /** + * Issued when attached to a worker. + */ + on(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + on(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + on(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; on(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; on(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; once(event: string, listener: (...args: any[]) => void): this; @@ -3910,28 +3903,6 @@ declare module "inspector/promises" { * If heap objects tracking has been started then backend may send update for one or more fragments */ once(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - once(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - once(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - once(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - once(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - once(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; /** * Fired when page is about to send HTTP request. */ @@ -3970,6 +3941,28 @@ declare module "inspector/promises" { * example, when inspector.waitingForDebugger is called */ once(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; + /** + * Contains an bucket of collected trace events. + */ + once(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + once(event: "NodeTracing.tracingComplete", listener: () => void): this; + /** + * Issued when attached to a worker. + */ + once(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + once(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + once(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; once(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; once(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; @@ -4045,28 +4038,6 @@ declare module "inspector/promises" { * If heap objects tracking has been started then backend may send update for one or more fragments */ prependListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - prependListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - prependListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - prependListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; /** * Fired when page is about to send HTTP request. */ @@ -4105,6 +4076,28 @@ declare module "inspector/promises" { * example, when inspector.waitingForDebugger is called */ prependListener(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; + /** + * Contains an bucket of collected trace events. + */ + prependListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + prependListener(event: "NodeTracing.tracingComplete", listener: () => void): this; + /** + * Issued when attached to a worker. + */ + prependListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + prependListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + prependListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; prependListener(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; prependListener(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; @@ -4180,28 +4173,6 @@ declare module "inspector/promises" { * If heap objects tracking has been started then backend may send update for one or more fragments */ prependOnceListener(event: "HeapProfiler.heapStatsUpdate", listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - prependOnceListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependOnceListener(event: "NodeTracing.tracingComplete", listener: () => void): this; - /** - * Issued when attached to a worker. - */ - prependOnceListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - prependOnceListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependOnceListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; /** * Fired when page is about to send HTTP request. */ @@ -4240,6 +4211,28 @@ declare module "inspector/promises" { * example, when inspector.waitingForDebugger is called */ prependOnceListener(event: "NodeRuntime.waitingForDebugger", listener: () => void): this; + /** + * Contains an bucket of collected trace events. + */ + prependOnceListener(event: "NodeTracing.dataCollected", listener: (message: InspectorNotification) => void): this; + /** + * Signals that tracing is stopped and there is no trace buffers pending flush, all data were + * delivered via dataCollected events. + */ + prependOnceListener(event: "NodeTracing.tracingComplete", listener: () => void): this; + /** + * Issued when attached to a worker. + */ + prependOnceListener(event: "NodeWorker.attachedToWorker", listener: (message: InspectorNotification) => void): this; + /** + * Issued when detached from the worker. + */ + prependOnceListener(event: "NodeWorker.detachedFromWorker", listener: (message: InspectorNotification) => void): this; + /** + * Notifies about a new protocol message received from the session + * (session ID is provided in attachedToWorker notification). + */ + prependOnceListener(event: "NodeWorker.receivedMessageFromWorker", listener: (message: InspectorNotification) => void): this; prependOnceListener(event: "Target.targetCreated", listener: (message: InspectorNotification) => void): this; prependOnceListener(event: "Target.attachedToTarget", listener: (message: InspectorNotification) => void): this; } diff --git a/types/node/v24/module.d.ts b/types/node/v24/module.d.ts index 52a86ee490b0f2..889e2ddb60b796 100644 --- a/types/node/v24/module.d.ts +++ b/types/node/v24/module.d.ts @@ -381,59 +381,18 @@ declare module "module" { | "module-typescript" | "wasm"; type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray; - /** - * The `initialize` hook provides a way to define a custom function that runs in - * the hooks thread when the hooks module is initialized. Initialization happens - * when the hooks module is registered via {@link register}. - * - * This hook can receive data from a {@link register} invocation, including - * ports and other transferable objects. The return value of `initialize` can be a - * `Promise`, in which case it will be awaited before the main application thread - * execution resumes. - */ type InitializeHook = (data: Data) => void | Promise; interface ResolveHookContext { - /** - * Export conditions of the relevant `package.json` - */ conditions: string[]; - /** - * An object whose key-value pairs represent the assertions for the module to import - */ importAttributes: ImportAttributes; - /** - * The module importing this one, or undefined if this is the Node.js entry point - */ parentURL: string | undefined; } interface ResolveFnOutput { - /** - * A hint to the load hook (it might be ignored); can be an intermediary value. - */ format?: string | null | undefined; - /** - * The import attributes to use when caching the module (optional; if excluded the input will be used) - */ importAttributes?: ImportAttributes | undefined; - /** - * A signal that this hook intends to terminate the chain of `resolve` hooks. - * @default false - */ shortCircuit?: boolean | undefined; - /** - * The absolute URL to which this input resolves - */ url: string; } - /** - * The `resolve` hook chain is responsible for telling Node.js where to find and - * how to cache a given `import` statement or expression, or `require` call. It can - * optionally return a format (such as `'module'`) as a hint to the `load` hook. If - * a format is specified, the `load` hook is ultimately responsible for providing - * the final `format` value (and it is free to ignore the hint provided by - * `resolve`); if `resolve` provides a `format`, a custom `load` hook is required - * even if only to pass the value to the Node.js default `load` hook. - */ type ResolveHook = ( specifier: string, context: ResolveHookContext, @@ -451,36 +410,15 @@ declare module "module" { ) => ResolveFnOutput, ) => ResolveFnOutput; interface LoadHookContext { - /** - * Export conditions of the relevant `package.json` - */ conditions: string[]; - /** - * The format optionally supplied by the `resolve` hook chain (can be an intermediary value). - */ format: string | null | undefined; - /** - * An object whose key-value pairs represent the assertions for the module to import - */ importAttributes: ImportAttributes; } interface LoadFnOutput { format: string | null | undefined; - /** - * A signal that this hook intends to terminate the chain of `resolve` hooks. - * @default false - */ shortCircuit?: boolean | undefined; - /** - * The source for Node.js to evaluate - */ source?: ModuleSource | undefined; } - /** - * The `load` hook provides a way to define a custom method of determining how a - * URL should be interpreted, retrieved, and parsed. It is also in charge of - * validating the import attributes. - */ type LoadHook = ( url: string, context: LoadHookContext, diff --git a/types/node/v24/net.d.ts b/types/node/v24/net.d.ts index 7dac21f328982f..f03f9802b71f4d 100644 --- a/types/node/v24/net.d.ts +++ b/types/node/v24/net.d.ts @@ -34,6 +34,10 @@ declare module "net" { readable?: boolean | undefined; writable?: boolean | undefined; signal?: AbortSignal | undefined; + noDelay?: boolean | undefined; + keepAlive?: boolean | undefined; + keepAliveInitialDelay?: number | undefined; + blockList?: BlockList | undefined; } interface OnReadOpts { buffer: Uint8Array | (() => Uint8Array); @@ -52,9 +56,6 @@ declare module "net" { hints?: number | undefined; family?: number | undefined; lookup?: LookupFunction | undefined; - noDelay?: boolean | undefined; - keepAlive?: boolean | undefined; - keepAliveInitialDelay?: number | undefined; /** * @since v18.13.0 */ @@ -63,7 +64,6 @@ declare module "net" { * @since v18.13.0 */ autoSelectFamilyAttemptTimeout?: number | undefined; - blockList?: BlockList | undefined; } interface IpcSocketConnectOpts { path: string; diff --git a/types/node/v24/package.json b/types/node/v24/package.json index b3c0d1769f7d84..175b9cd302623f 100644 --- a/types/node/v24/package.json +++ b/types/node/v24/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/node", - "version": "24.12.9999", + "version": "24.13.9999", "nonNpm": "conflict", "nonNpmDescription": "Node.js", "projects": [ @@ -18,7 +18,7 @@ } }, "dependencies": { - "undici-types": "~7.16.0" + "undici-types": "~7.18.0" }, "devDependencies": { "@types/node": "workspace:." diff --git a/types/node/v24/process.d.ts b/types/node/v24/process.d.ts index 38b3e86d032370..7b69dd5459c634 100644 --- a/types/node/v24/process.d.ts +++ b/types/node/v24/process.d.ts @@ -608,7 +608,8 @@ declare module "process" { * arguments passed when the Node.js process was launched. The first element will * be {@link execPath}. See `process.argv0` if access to the original value * of `argv[0]` is needed. The second element will be the path to the JavaScript - * file being executed. The remaining elements will be any additional command-line + * file being executed. If a [program entry point](https://nodejs.org/docs/latest-v24.x/api/cli.html#program-entry-point) was provided, the second element + * will be the absolute path to it. The remaining elements are additional command-line * arguments. * * For example, assuming the following script for `process-args.js`: @@ -1740,6 +1741,24 @@ declare module "process" { */ readonly release: ProcessRelease; readonly features: ProcessFeatures; + /** + * The `process.traceProcessWarnings` property indicates whether the `--trace-warnings` flag + * is set on the current Node.js process. This property allows programmatic control over the + * tracing of warnings, enabling or disabling stack traces for warnings at runtime. + * + * ```js + * // Enable trace warnings + * process.traceProcessWarnings = true; + * + * // Emit a warning with a stack trace + * process.emitWarning('Warning with stack trace'); + * + * // Disable trace warnings + * process.traceProcessWarnings = false; + * ``` + * @since v6.10.0 + */ + traceProcessWarnings: boolean; /** * `process.umask()` returns the Node.js process's file mode creation mask. Child * processes inherit the mask from the parent process. diff --git a/types/node/v24/readline.d.ts b/types/node/v24/readline.d.ts index 519b4a46be1fa2..5984dfd9537a41 100644 --- a/types/node/v24/readline.d.ts +++ b/types/node/v24/readline.d.ts @@ -257,6 +257,7 @@ declare module "readline" { */ addListener(event: string, listener: (...args: any[]) => void): this; addListener(event: "close", listener: () => void): this; + addListener(event: "error", listener: (error: Error) => void): this; addListener(event: "line", listener: (input: string) => void): this; addListener(event: "pause", listener: () => void): this; addListener(event: "resume", listener: () => void): this; @@ -266,6 +267,7 @@ declare module "readline" { addListener(event: "history", listener: (history: string[]) => void): this; emit(event: string | symbol, ...args: any[]): boolean; emit(event: "close"): boolean; + emit(event: "error", error: Error): boolean; emit(event: "line", input: string): boolean; emit(event: "pause"): boolean; emit(event: "resume"): boolean; @@ -275,6 +277,7 @@ declare module "readline" { emit(event: "history", history: string[]): boolean; on(event: string, listener: (...args: any[]) => void): this; on(event: "close", listener: () => void): this; + on(event: "error", listener: (error: Error) => void): this; on(event: "line", listener: (input: string) => void): this; on(event: "pause", listener: () => void): this; on(event: "resume", listener: () => void): this; @@ -284,6 +287,7 @@ declare module "readline" { on(event: "history", listener: (history: string[]) => void): this; once(event: string, listener: (...args: any[]) => void): this; once(event: "close", listener: () => void): this; + once(event: "error", listener: (error: Error) => void): this; once(event: "line", listener: (input: string) => void): this; once(event: "pause", listener: () => void): this; once(event: "resume", listener: () => void): this; @@ -293,6 +297,7 @@ declare module "readline" { once(event: "history", listener: (history: string[]) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; prependListener(event: "close", listener: () => void): this; + prependListener(event: "error", listener: (error: Error) => void): this; prependListener(event: "line", listener: (input: string) => void): this; prependListener(event: "pause", listener: () => void): this; prependListener(event: "resume", listener: () => void): this; @@ -302,6 +307,7 @@ declare module "readline" { prependListener(event: "history", listener: (history: string[]) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "error", listener: (error: Error) => void): this; prependOnceListener(event: "line", listener: (input: string) => void): this; prependOnceListener(event: "pause", listener: () => void): this; prependOnceListener(event: "resume", listener: () => void): this; diff --git a/types/node/v24/sqlite.d.ts b/types/node/v24/sqlite.d.ts index 171d32c4d947ce..43112d4164aca1 100644 --- a/types/node/v24/sqlite.d.ts +++ b/types/node/v24/sqlite.d.ts @@ -426,15 +426,68 @@ declare module "node:sqlite" { */ prepare(sql: string): StatementSync; /** - * Creates a new {@link SQLTagStore `SQLTagStore`}, which is an LRU (Least Recently Used) cache for - * storing prepared statements. This allows for the efficient reuse of prepared - * statements by tagging them with a unique identifier. + * Creates a new {@link SQLTagStore}, which is a Least Recently Used (LRU) cache + * for storing prepared statements. This allows for the efficient reuse of + * prepared statements by tagging them with a unique identifier. * * When a tagged SQL literal is executed, the `SQLTagStore` checks if a prepared - * statement for that specific SQL string already exists in the cache. If it does, - * the cached statement is used. If not, a new prepared statement is created, - * executed, and then stored in the cache for future use. This mechanism helps to - * avoid the overhead of repeatedly parsing and preparing the same SQL statements. + * statement for the corresponding SQL query string already exists in the cache. + * If it does, the cached statement is used. If not, a new prepared statement is + * created, executed, and then stored in the cache for future use. This mechanism + * helps to avoid the overhead of repeatedly parsing and preparing the same SQL + * statements. + * + * Tagged statements bind the placeholder values from the template literal as + * parameters to the underlying prepared statement. For example: + * + * ```js + * sqlTagStore.get`SELECT ${value}`; + * ``` + * + * is equivalent to: + * + * ```js + * db.prepare('SELECT ?').get(value); + * ``` + * + * However, in the first example, the tag store will cache the underlying prepared + * statement for future use. + * + * > **Note:** The `${value}` syntax in tagged statements _binds_ a parameter to + * > the prepared statement. This differs from its behavior in _untagged_ template + * > literals, where it performs string interpolation. + * > + * > ```js + * > // This a safe example of binding a parameter to a tagged statement. + * > sqlTagStore.run`INSERT INTO t1 (id) VALUES (${id})`; + * > + * > // This is an *unsafe* example of an untagged template string. + * > // `id` is interpolated into the query text as a string. + * > // This can lead to SQL injection and data corruption. + * > db.run(`INSERT INTO t1 (id) VALUES (${id})`); + * > ``` + * + * The tag store will match a statement from the cache if the query strings + * (including the positions of any bound placeholders) are identical. + * + * ```js + * // The following statements will match in the cache: + * sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`; + * sqlTagStore.get`SELECT * FROM t1 WHERE id = ${12345} AND active = 1`; + * + * // The following statements will not match, as the query strings + * // and bound placeholders differ: + * sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`; + * sqlTagStore.get`SELECT * FROM t1 WHERE id = 12345 AND active = 1`; + * + * // The following statements will not match, as matches are case-sensitive: + * sqlTagStore.get`SELECT * FROM t1 WHERE id = ${id} AND active = 1`; + * sqlTagStore.get`select * from t1 where id = ${id} and active = 1`; + * ``` + * + * The only way of binding parameters in tagged statements is with the `${value}` + * syntax. Do not add parameter binding placeholders (`?` etc.) to the SQL query + * string itself. * * ```js * import { DatabaseSync } from 'node:sqlite'; @@ -450,8 +503,8 @@ declare module "node:sqlite" { * sql.run`INSERT INTO users VALUES (2, 'Bob')`; * * // Using the 'get' method to retrieve a single row. - * const id = 1; - * const user = sql.get`SELECT * FROM users WHERE id = ${id}`; + * const name = 'Alice'; + * const user = sql.get`SELECT * FROM users WHERE name = ${name}`; * console.log(user); // { id: 1, name: 'Alice' } * * // Using the 'all' method to retrieve all rows. @@ -551,21 +604,29 @@ declare module "node:sqlite" { * This class represents a single LRU (Least Recently Used) cache for storing * prepared statements. * - * Instances of this class are created via the database.createTagStore() method, - * not by using a constructor. The store caches prepared statements based on the - * provided SQL query string. When the same query is seen again, the store + * Instances of this class are created via the `database.createTagStore()` + * method, not by using a constructor. The store caches prepared statements based + * on the provided SQL query string. When the same query is seen again, the store * retrieves the cached statement and safely applies the new values through * parameter binding, thereby preventing attacks like SQL injection. * * The cache has a maxSize that defaults to 1000 statements, but a custom size can - * be provided (e.g., database.createTagStore(100)). All APIs exposed by this + * be provided (e.g., `database.createTagStore(100)`). All APIs exposed by this * class execute synchronously. * @since v24.9.0 */ interface SQLTagStore { /** - * Executes the given SQL query and returns all resulting rows as an array of objects. + * Executes the given SQL query and returns all resulting rows as an array of + * objects. + * + * This function is intended to be used as a template literal tag, not to be + * called directly. * @since v24.9.0 + * @param stringElements Template literal elements containing the SQL + * query. + * @param boundParameters Parameter values to be bound to placeholders in the template string. + * @returns An array of objects representing the rows returned by the query. */ all( stringElements: TemplateStringsArray, @@ -573,7 +634,15 @@ declare module "node:sqlite" { ): Record[]; /** * Executes the given SQL query and returns the first resulting row as an object. + * + * This function is intended to be used as a template literal tag, not to be + * called directly. * @since v24.9.0 + * @param stringElements Template literal elements containing the SQL + * query. + * @param boundParameters Parameter values to be bound to placeholders in the template string. + * @returns An object representing the first row returned by + * the query, or `undefined` if no rows are returned. */ get( stringElements: TemplateStringsArray, @@ -581,7 +650,14 @@ declare module "node:sqlite" { ): Record | undefined; /** * Executes the given SQL query and returns an iterator over the resulting rows. + * + * This function is intended to be used as a template literal tag, not to be + * called directly. * @since v24.9.0 + * @param stringElements Template literal elements containing the SQL + * query. + * @param boundParameters Parameter values to be bound to placeholders in the template string. + * @returns An iterator that yields objects representing the rows returned by the query. */ iterate( stringElements: TemplateStringsArray, @@ -589,15 +665,21 @@ declare module "node:sqlite" { ): NodeJS.Iterator>; /** * Executes the given SQL query, which is expected to not return any rows (e.g., INSERT, UPDATE, DELETE). + * + * This function is intended to be used as a template literal tag, not to be + * called directly. * @since v24.9.0 + * @param stringElements Template literal elements containing the SQL + * query. + * @param boundParameters Parameter values to be bound to placeholders in the template string. + * @returns An object containing information about the execution, including `changes` and `lastInsertRowid`. */ run(stringElements: TemplateStringsArray, ...boundParameters: SQLInputValue[]): StatementResultingChanges; /** * A read-only property that returns the number of prepared statements currently in the cache. * @since v24.9.0 - * @returns The maximum number of prepared statements the cache can hold. */ - size(): number; + readonly size: number; /** * A read-only property that returns the maximum number of prepared statements the cache can hold. * @since v24.9.0 diff --git a/types/node/v24/test.d.ts b/types/node/v24/test.d.ts index 1b237deb705116..848f4ca1c5687a 100644 --- a/types/node/v24/test.d.ts +++ b/types/node/v24/test.d.ts @@ -236,7 +236,7 @@ declare module "node:test" { } interface RunOptions { /** - * If a number is provided, then that many test processes would run in parallel, where each process corresponds to one test file. + * If a number is provided, then that many tests would run asynchronously (they are still managed by the single-threaded event loop). * If `true`, it would run `os.availableParallelism() - 1` test files in parallel. If `false`, it would only run one test file at a time. * @default false */ @@ -1305,6 +1305,11 @@ declare module "node:test" { * @since v22.6.0 */ readonly filePath: string | undefined; + /** + * The name of the suite and each of its ancestors, separated by `>`. + * @since v22.3.0, v20.16.0 + */ + readonly fullName: string; /** * The name of the suite. * @since v18.8.0, v16.18.0 @@ -2053,24 +2058,28 @@ declare module "node:test" { */ enable(options?: MockTimersOptions): void; /** - * You can use the `.setTime()` method to manually move the mocked date to another time. This method only accepts a positive integer. - * Note: This method will execute any mocked timers that are in the past from the new time. - * In the below example we are setting a new time for the mocked date. + * Sets the current Unix timestamp that will be used as reference for any mocked + * `Date` objects. + * * ```js * import assert from 'node:assert'; * import { test } from 'node:test'; - * test('sets the time of a date object', (context) => { - * // Optionally choose what to mock - * context.mock.timers.enable({ apis: ['Date'], now: 100 }); - * assert.strictEqual(Date.now(), 100); - * // Advance in time will also advance the date - * context.mock.timers.setTime(1000); - * context.mock.timers.tick(200); - * assert.strictEqual(Date.now(), 1200); + * + * test('runAll functions following the given order', (context) => { + * const now = Date.now(); + * const setTime = 1000; + * // Date.now is not mocked + * assert.deepStrictEqual(Date.now(), now); + * + * context.mock.timers.enable({ apis: ['Date'] }); + * context.mock.timers.setTime(setTime); + * // Date.now is now 1000 + * assert.strictEqual(Date.now(), setTime); * }); * ``` + * @since v21.2.0, v20.11.0 */ - setTime(time: number): void; + setTime(milliseconds: number): void; /** * This function restores the default behavior of all mocks that were previously * created by this `MockTimers` instance and disassociates the mocks diff --git a/types/node/v24/test/net.ts b/types/node/v24/test/net.ts index f5dfba33008cd1..8dad4405eef55d 100644 --- a/types/node/v24/test/net.ts +++ b/types/node/v24/test/net.ts @@ -60,6 +60,10 @@ import * as net from "node:net"; }, readable: false, writable: false, + keepAlive: true, + keepAliveInitialDelay: 1000, + noDelay: false, + blockList: new net.BlockList(), }); let bool: boolean; @@ -169,9 +173,6 @@ import * as net from "node:net"; // nothing }, port: 80, - keepAlive: true, - keepAliveInitialDelay: 1000, - noDelay: false, autoSelectFamily: false, autoSelectFamilyAttemptTimeout: 250, }; diff --git a/types/node/v24/test/process.ts b/types/node/v24/test/process.ts index 0fca87b7ff9e94..d1c6142e9d9ca4 100644 --- a/types/node/v24/test/process.ts +++ b/types/node/v24/test/process.ts @@ -116,6 +116,7 @@ import { fileURLToPath } from "node:url"; } { process.traceDeprecation = true; + process.traceProcessWarnings = true; } { diff --git a/types/node/v24/test/sqlite.ts b/types/node/v24/test/sqlite.ts index 007327e17d6470..9433903ef6604b 100644 --- a/types/node/v24/test/sqlite.ts +++ b/types/node/v24/test/sqlite.ts @@ -159,7 +159,7 @@ import { TextEncoder } from "node:util"; tagStore.iterate`SELECT * FROM users WHERE id = ${id}`; // $ExpectType Iterator, undefined, any> tagStore.run`INSERT INTO users VALUES (${id}, ${name})`; // $ExpectType StatementResultingChanges - tagStore.size(); // $ExpectType number + tagStore.size; // $ExpectType number tagStore.capacity; // $ExpectType number tagStore.db; // $ExpectType DatabaseSync tagStore.clear(); diff --git a/types/node/v24/test/test.ts b/types/node/v24/test/test.ts index 2be5e5274c7437..0e178a317882b8 100644 --- a/types/node/v24/test/test.ts +++ b/types/node/v24/test/test.ts @@ -342,6 +342,8 @@ describe(s => { // $ExpectType SuiteContext s; // $ExpectType string + s.fullName; + // $ExpectType string s.name; // $ExpectType string | undefined s.filePath; diff --git a/types/node/v24/test/tls.ts b/types/node/v24/test/tls.ts index e587ab13f7ee42..0ef3979f32b6f3 100644 --- a/types/node/v24/test/tls.ts +++ b/types/node/v24/test/tls.ts @@ -40,6 +40,7 @@ import { psk: Buffer.from("asd"), }; }, + requestOCSP: true, }; const tlsSocket = connect(connOpts); diff --git a/types/node/v24/test/v8.ts b/types/node/v24/test/v8.ts index d0dbdb53d8aeaa..48c8dd6bace3b5 100644 --- a/types/node/v24/test/v8.ts +++ b/types/node/v24/test/v8.ts @@ -19,11 +19,9 @@ v8.takeCoverage(); v8.stopCoverage(); { - const profiler = new v8.GCProfiler(); + using profiler = new v8.GCProfiler(); profiler.start(); - setTimeout(() => { - console.log(profiler.stop()); - }, 1000); + profiler.stop(); } const disable = v8.promiseHooks.createHook({ diff --git a/types/node/v24/tls.d.ts b/types/node/v24/tls.d.ts index db044ac01c4d72..658c0135e85498 100644 --- a/types/node/v24/tls.d.ts +++ b/types/node/v24/tls.d.ts @@ -200,12 +200,6 @@ declare module "tls" { * An optional Buffer instance containing a TLS session. */ session?: Buffer | undefined; - /** - * If true, specifies that the OCSP status request extension will be - * added to the client hello and an 'OCSPResponse' event will be - * emitted on the socket before establishing a secure communication - */ - requestOCSP?: boolean | undefined; } /** * Performs transparent encryption of written data and all required TLS @@ -486,31 +480,37 @@ declare module "tls" { exportKeyingMaterial(length: number, label: string, context: Buffer): NonSharedBuffer; addListener(event: string, listener: (...args: any[]) => void): this; addListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; + addListener(event: "secure", listener: () => void): this; addListener(event: "secureConnect", listener: () => void): this; addListener(event: "session", listener: (session: NonSharedBuffer) => void): this; addListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this; emit(event: string | symbol, ...args: any[]): boolean; emit(event: "OCSPResponse", response: NonSharedBuffer): boolean; + emit(event: "secure"): boolean; emit(event: "secureConnect"): boolean; emit(event: "session", session: NonSharedBuffer): boolean; emit(event: "keylog", line: NonSharedBuffer): boolean; on(event: string, listener: (...args: any[]) => void): this; on(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; + on(event: "secure", listener: () => void): this; on(event: "secureConnect", listener: () => void): this; on(event: "session", listener: (session: NonSharedBuffer) => void): this; on(event: "keylog", listener: (line: NonSharedBuffer) => void): this; once(event: string, listener: (...args: any[]) => void): this; once(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; + once(event: "secure", listener: () => void): this; once(event: "secureConnect", listener: () => void): this; once(event: "session", listener: (session: NonSharedBuffer) => void): this; once(event: "keylog", listener: (line: NonSharedBuffer) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; prependListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; + prependListener(event: "secure", listener: () => void): this; prependListener(event: "secureConnect", listener: () => void): this; prependListener(event: "session", listener: (session: NonSharedBuffer) => void): this; prependListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; prependOnceListener(event: "OCSPResponse", listener: (response: NonSharedBuffer) => void): this; + prependOnceListener(event: "secure", listener: () => void): this; prependOnceListener(event: "secureConnect", listener: () => void): this; prependOnceListener(event: "session", listener: (session: NonSharedBuffer) => void): this; prependOnceListener(event: "keylog", listener: (line: NonSharedBuffer) => void): this; @@ -554,6 +554,12 @@ declare module "tls" { * @default true */ rejectUnauthorized?: boolean | undefined; + /** + * If true, specifies that the OCSP status request extension will be + * added to the client hello and an 'OCSPResponse' event will be + * emitted on the socket before establishing a secure communication. + */ + requestOCSP?: boolean | undefined; } interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts { /** diff --git a/types/node/v24/url.d.ts b/types/node/v24/url.d.ts index 55ce19db54a4aa..abf5796c5c5017 100644 --- a/types/node/v24/url.d.ts +++ b/types/node/v24/url.d.ts @@ -334,6 +334,19 @@ declare module "url" { * new URL('file:///hello world').pathname; // Incorrect: /hello%20world * fileURLToPath('file:///hello world'); // Correct: /hello world (POSIX) * ``` + * + * **Security Considerations:** + * + * This function decodes percent-encoded characters, including encoded dot-segments + * (`%2e` as `.` and `%2e%2e` as `..`), and then normalizes the resulting path. + * This means that encoded directory traversal sequences (such as `%2e%2e`) are + * decoded and processed as actual path traversal, even though encoded slashes + * (`%2F`, `%5C`) are correctly rejected. + * + * **Applications must not rely on `fileURLToPath()` alone to prevent directory + * traversal attacks.** Always perform explicit path validation and security checks + * on the returned path value to ensure it remains within expected boundaries + * before using it for file system operations. * @since v10.12.0 * @param url The file URL string or URL object to convert to a path. * @return The fully-resolved platform-specific Node.js file path. @@ -344,6 +357,15 @@ declare module "url" { * representation of the path, a `Buffer` is returned. This conversion is * helpful when the input URL contains percent-encoded segments that are * not valid UTF-8 / Unicode sequences. + * + * **Security Considerations:** + * + * This function has the same security considerations as `url.fileURLToPath()`. + * It decodes percent-encoded characters, including encoded dot-segments + * (`%2e` as `.` and `%2e%2e` as `..`), and normalizes the path. **Applications + * must not rely on this function alone to prevent directory traversal attacks.** + * Always perform explicit path validation on the returned buffer value before + * using it for file system operations. * @since v24.3.0 * @param url The file URL string or URL object to convert to a path. * @returns The fully-resolved platform-specific Node.js file path diff --git a/types/node/v24/util.d.ts b/types/node/v24/util.d.ts index 12e48fe4cd7818..304d44ff143a56 100644 --- a/types/node/v24/util.d.ts +++ b/types/node/v24/util.d.ts @@ -254,6 +254,9 @@ declare module "util" { * Returns an array of call site objects containing the stack of * the caller function. * + * Unlike accessing an `error.stack`, the result returned from this API is not + * interfered with `Error.prepareStackTrace`. + * * ```js * import { getCallSites } from 'node:util'; * @@ -266,7 +269,7 @@ declare module "util" { * console.log(`Function Name: ${callSite.functionName}`); * console.log(`Script Name: ${callSite.scriptName}`); * console.log(`Line Number: ${callSite.lineNumber}`); - * console.log(`Column Number: ${callSite.column}`); + * console.log(`Column Number: ${callSite.columnNumber}`); * }); * // CallSite 1: * // Function Name: exampleFunction @@ -758,7 +761,7 @@ declare module "util" { * * ```js * import { debuglog } from 'node:util'; - * const log = debuglog('foo'); + * const log = debuglog('foo-bar'); * * log('hi there, it\'s foo-bar [%d]', 2333); * ``` diff --git a/types/node/v24/v8.d.ts b/types/node/v24/v8.d.ts index c78ebca5eaf851..e57f970d8fb5ea 100644 --- a/types/node/v24/v8.d.ts +++ b/types/node/v24/v8.d.ts @@ -304,7 +304,6 @@ declare module "v8" { * ``` * @param ctor The constructor that can be used to search on the prototype chain in order to filter target objects in the heap. * @since v20.13.0 - * @experimental */ function queryObjects(ctor: Function): number | string[]; function queryObjects(ctor: Function, options: { format: "count" }): number; @@ -732,6 +731,11 @@ declare module "v8" { * @since v19.6.0, v18.15.0 */ stop(): GCProfilerResult; + /** + * Stop collecting GC data, and discard the profile. + * @since v24.13.0 + */ + [Symbol.dispose](): void; } interface GCProfilerResult { version: number; diff --git a/types/node/v24/worker_threads.d.ts b/types/node/v24/worker_threads.d.ts index e400ae06c6b7d7..4361bb4ad0a735 100644 --- a/types/node/v24/worker_threads.d.ts +++ b/types/node/v24/worker_threads.d.ts @@ -33,8 +33,8 @@ * workerData: script, * }); * worker.on('message', resolve); - * worker.on('error', reject); - * worker.on('exit', (code) => { + * worker.once('error', reject); + * worker.once('exit', (code) => { * if (code !== 0) * reject(new Error(`Worker stopped with exit code ${code}`)); * });