diff --git a/types/cfn-response/index.d.ts b/types/cfn-response/index.d.ts index a004b55050188e..84283f3af160e4 100644 --- a/types/cfn-response/index.d.ts +++ b/types/cfn-response/index.d.ts @@ -1,14 +1,43 @@ import { CloudFormationCustomResourceEvent, Context } from "aws-lambda"; +/** + * Response status indicating the custom resource operation succeeded. + */ export const SUCCESS: "SUCCESS"; + +/** + * Response status indicating the custom resource operation failed. + * CloudFormation will roll back the stack if FAILED is returned during create or update. + */ export const FAILED: "FAILED"; + +/** + * Union type of the two possible response statuses for a CloudFormation custom resource. + */ export type ResponseStatus = typeof SUCCESS | typeof FAILED; +/** + * Sends a response to the CloudFormation pre-signed S3 URL to signal the result + * of a custom resource operation. Must be called in every code path of a Lambda-backed + * custom resource — if not called, the CloudFormation stack will hang until it times out. + * + * Note: this function does not return a Promise. Lambda completion is signaled via + * `context.done()` internally. Do not use `await` with this function. + * + * @param event - The CloudFormation custom resource event containing the ResponseURL, + * StackId, RequestId, and LogicalResourceId. + * @param context - The Lambda context object, used for the log stream name and signaling completion. + * @param responseStatus - Whether the operation succeeded or failed. Use `SUCCESS` or `FAILED`. + * @param responseData - Optional key-value data to return to CloudFormation, + * accessible via `Fn::GetAtt` in the template. + * @param physicalResourceId - The unique identifier of the custom resource. + * Defaults to the Lambda log stream name if not provided. + * WARNING: changing this value on an update will cause CloudFormation to delete the old resource. + */ export function send( event: CloudFormationCustomResourceEvent, context: Context, responseStatus: ResponseStatus, - responseData?: object, + responseData?: Record, physicalResourceId?: string, - noEcho?: boolean, ): void; diff --git a/types/cfn-response/package.json b/types/cfn-response/package.json index 95837bd49e697d..61f573fd6d6f6a 100644 --- a/types/cfn-response/package.json +++ b/types/cfn-response/package.json @@ -13,7 +13,7 @@ }, "owners": [ { - "name": "Artur Androsovych", + "name": "arturovt", "githubUsername": "arturovt" } ] diff --git a/types/headroom/package.json b/types/headroom/package.json index ffa99d567c0feb..4b7666fea58af6 100644 --- a/types/headroom/package.json +++ b/types/headroom/package.json @@ -2,7 +2,7 @@ "private": true, "name": "@types/headroom", "version": "0.12.9999", - "nonNpm": true, + "nonNpm": "conflict", "nonNpmDescription": "headroom", "projects": [ "http://wicky.nillia.ms/headroom.js/" diff --git a/types/node/assert.d.ts b/types/node/assert.d.ts index ef4d852d5e392b..9b7144eeefc029 100644 --- a/types/node/assert.d.ts +++ b/types/node/assert.d.ts @@ -253,10 +253,10 @@ declare module "node:assert" { * import assert from 'node:assert/strict'; * * // Using `assert()` works the same: - * assert(0); + * assert(2 + 2 > 5);; * // AssertionError: The expression evaluated to a falsy value: * // - * // assert(0) + * // assert(2 + 2 > 5) * ``` * @since v0.1.21 */ diff --git a/types/node/child_process.d.ts b/types/node/child_process.d.ts index f0818091a3069f..d71fed18def569 100644 --- a/types/node/child_process.d.ts +++ b/types/node/child_process.d.ts @@ -228,6 +228,11 @@ declare module "node:child_process" { /** * The `subprocess.exitCode` property indicates the exit code of the child process. * If the child process is still running, the field will be `null`. + * + * When the child process is terminated by a signal, `subprocess.exitCode` will be + * `null` and `subprocess.signalCode` will be set. To get the corresponding + * POSIX exit code, use + * `util.convertProcessSignalToExitCode(subprocess.signalCode)`. */ readonly exitCode: number | null; /** diff --git a/types/node/events.d.ts b/types/node/events.d.ts index 4ed0f651015314..6870cf5b1388dc 100644 --- a/types/node/events.d.ts +++ b/types/node/events.d.ts @@ -638,24 +638,17 @@ declare module "node:events" { */ function getMaxListeners(emitter: EventEmitter | EventTarget): number; /** - * A class method that returns the number of listeners for the given `eventName` - * registered on the given `emitter`. + * Returns the number of registered listeners for the event named `eventName`. * - * ```js - * import { EventEmitter, listenerCount } from 'node:events'; + * For `EventEmitter`s this behaves exactly the same as calling `.listenerCount` + * on the emitter. * - * const myEmitter = new EventEmitter(); - * myEmitter.on('event', () => {}); - * myEmitter.on('event', () => {}); - * console.log(listenerCount(myEmitter, 'event')); - * // Prints: 2 - * ``` + * For `EventTarget`s this is the only way to obtain the listener count. This can + * be useful for debugging and diagnostic purposes. * @since v0.9.12 - * @deprecated Use `emitter.listenerCount()` instead. - * @param emitter The emitter to query - * @param eventName The event name */ function listenerCount(emitter: EventEmitter, eventName: string | symbol): number; + function listenerCount(emitter: EventTarget, eventName: string): number; interface OnOptions extends Abortable { /** * Names of events that will end the iteration. diff --git a/types/node/http.d.ts b/types/node/http.d.ts index 9eb39cc6e63aaf..f88f49f54a963c 100644 --- a/types/node/http.d.ts +++ b/types/node/http.d.ts @@ -2136,6 +2136,27 @@ declare module "node:http" { * @param [max=1000] */ function setMaxIdleHTTPParsers(max: number): void; + /** + * Dynamically resets the global configurations to enable built-in proxy support for + * `fetch()` and `http.request()`/`https.request()` at runtime, as an alternative + * to using the `--use-env-proxy` flag or `NODE_USE_ENV_PROXY` environment variable. + * It can also be used to override settings configured from the environment variables. + * + * As this function resets the global configurations, any previously configured + * `http.globalAgent`, `https.globalAgent` or undici global dispatcher would be + * overridden after this function is invoked. It's recommended to invoke it before any + * requests are made and avoid invoking it in the middle of any requests. + * + * See [Built-in Proxy Support](https://nodejs.org/docs/latest-v25.x/api/http.html#built-in-proxy-support) for details on proxy URL formats and `NO_PROXY` + * syntax. + * @since v25.4.0 + * @param proxyEnv An object containing proxy configuration. This accepts the + * same options as the `proxyEnv` option accepted by {@link Agent}. **Default:** + * `process.env`. + * @returns A function that restores the original agent and dispatcher + * settings to the state before this `http.setGlobalProxyFromEnv()` is invoked. + */ + function setGlobalProxyFromEnv(proxyEnv?: ProxyEnv): () => void; /** * Global instance of `Agent` which is used as the default for all HTTP client * requests. Diverges from a default `Agent` configuration by having `keepAlive` diff --git a/types/node/inspector.generated.d.ts b/types/node/inspector.generated.d.ts index 84c482d69faffc..088159b9fd3eaa 100644 --- a/types/node/inspector.generated.d.ts +++ b/types/node/inspector.generated.d.ts @@ -1620,79 +1620,38 @@ declare module "node: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 { @@ -1790,6 +1749,18 @@ declare module "node:inspector" { */ headers: Headers; } + interface EnableParameterType { + /** + * Buffer size in bytes to use when preserving network payloads (XHRs, etc). + * @experimental + */ + maxTotalBufferSize?: number | undefined; + /** + * Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc). + * @experimental + */ + maxResourceBufferSize?: number | undefined; + } interface GetRequestPostDataParameterType { /** * Identifier of the network request to get content for. @@ -1974,6 +1945,81 @@ declare module "node: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; @@ -1998,40 +2044,6 @@ declare module "node: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 @@ -2337,39 +2349,12 @@ declare module "node: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. */ @@ -2377,6 +2362,7 @@ declare module "node:inspector" { /** * Enables network tracking, network events will now be delivered to the client. */ + post(method: "Network.enable", params?: Network.EnableParameterType, callback?: (err: Error | null) => void): void; post(method: "Network.enable", callback?: (err: Error | null) => void): void; /** * Returns post data sent with the request. Returns an error when no data was sent with the request. @@ -2417,28 +2403,55 @@ declare module "node: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; + /** + * 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. + */ + 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 */ @@ -2499,28 +2512,6 @@ declare module "node: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. */ @@ -2559,6 +2550,28 @@ declare module "node: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; @@ -2583,11 +2596,6 @@ declare module "node: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; @@ -2598,6 +2606,11 @@ declare module "node: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; @@ -2673,28 +2686,6 @@ declare module "node: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. */ @@ -2733,6 +2724,28 @@ declare module "node: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; @@ -2808,28 +2821,6 @@ declare module "node: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. */ @@ -2868,6 +2859,28 @@ declare module "node: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; @@ -2943,28 +2956,6 @@ declare module "node: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. */ @@ -3003,6 +2994,28 @@ declare module "node: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; @@ -3078,28 +3091,6 @@ declare module "node: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. */ @@ -3138,6 +3129,28 @@ declare module "node: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; } @@ -3150,12 +3163,12 @@ declare module "node:inspector/promises" { Console, Profiler, HeapProfiler, - NodeTracing, - NodeWorker, + IO, Network, NodeRuntime, + NodeTracing, + NodeWorker, Target, - IO, } from 'inspector'; } declare module "node:inspector/promises" { @@ -3167,12 +3180,12 @@ declare module "node: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 @@ -3435,79 +3448,79 @@ declare module "node:inspector/promises" { post(method: "HeapProfiler.stopSampling"): Promise; post(method: "HeapProfiler.getSamplingProfile"): Promise; /** - * Gets supported tracing categories. + * Read a chunk of the stream */ - post(method: "NodeTracing.getCategories"): Promise; + post(method: "IO.read", params?: IO.ReadParameterType): Promise; + post(method: "IO.close", params?: IO.CloseParameterType): Promise; /** - * Start trace events collection. + * Disables network tracking, prevents network events from being sent to the client. */ - post(method: "NodeTracing.start", params?: NodeTracing.StartParameterType): Promise; + post(method: "Network.disable"): Promise; /** - * Stop trace events collection. Remaining collected events will be sent as a sequence of - * dataCollected events followed by tracingComplete event. + * Enables network tracking, network events will now be delivered to the client. */ - post(method: "NodeTracing.stop"): Promise; + post(method: "Network.enable", params?: Network.EnableParameterType): Promise; /** - * Sends protocol message over session with given id. + * Returns post data sent with the request. Returns an error when no data was sent with the request. */ - post(method: "NodeWorker.sendMessageToWorker", params?: NodeWorker.SendMessageToWorkerParameterType): Promise; + post(method: "Network.getRequestPostData", params?: Network.GetRequestPostDataParameterType): Promise; /** - * Instructs the inspector to attach to running workers. Will also attach to new workers - * as they start + * Returns content served for the given request. */ - post(method: "NodeWorker.enable", params?: NodeWorker.EnableParameterType): Promise; + post(method: "Network.getResponseBody", params?: Network.GetResponseBodyParameterType): Promise; /** - * Detaches from all running workers and disables attaching to new workers as they are started. + * Enables streaming of the response for the given requestId. + * If enabled, the dataReceived event contains the data that was received during streaming. + * @experimental */ - post(method: "NodeWorker.disable"): Promise; + post(method: "Network.streamResourceContent", params?: Network.StreamResourceContentParameterType): Promise; /** - * Detached from the worker with given sessionId. + * Fetches the resource and returns the content. */ - post(method: "NodeWorker.detach", params?: NodeWorker.DetachParameterType): Promise; + post(method: "Network.loadNetworkResource", params?: Network.LoadNetworkResourceParameterType): Promise; /** - * Disables network tracking, prevents network events from being sent to the client. + * Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`. */ - post(method: "Network.disable"): Promise; + post(method: "NodeRuntime.enable"): Promise; /** - * Enables network tracking, network events will now be delivered to the client. + * Disable NodeRuntime events */ - post(method: "Network.enable"): Promise; + post(method: "NodeRuntime.disable"): Promise; /** - * Returns post data sent with the request. Returns an error when no data was sent with the request. + * Enable the `NodeRuntime.waitingForDisconnect`. */ - post(method: "Network.getRequestPostData", params?: Network.GetRequestPostDataParameterType): Promise; + post(method: "NodeRuntime.notifyWhenWaitingForDisconnect", params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType): Promise; /** - * Returns content served for the given request. + * Gets supported tracing categories. */ - post(method: "Network.getResponseBody", params?: Network.GetResponseBodyParameterType): Promise; + post(method: "NodeTracing.getCategories"): Promise; /** - * Enables streaming of the response for the given requestId. - * If enabled, the dataReceived event contains the data that was received during streaming. - * @experimental + * Start trace events collection. */ - post(method: "Network.streamResourceContent", params?: Network.StreamResourceContentParameterType): Promise; + post(method: "NodeTracing.start", params?: NodeTracing.StartParameterType): Promise; /** - * Fetches the resource and returns the content. + * 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. @@ -3581,28 +3594,6 @@ declare module "node: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. */ @@ -3641,6 +3632,28 @@ declare module "node: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; @@ -3665,11 +3678,6 @@ declare module "node: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; @@ -3680,6 +3688,11 @@ declare module "node: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; @@ -3755,28 +3768,6 @@ declare module "node: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. */ @@ -3815,6 +3806,28 @@ declare module "node: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; @@ -3890,28 +3903,6 @@ declare module "node: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. */ @@ -3950,6 +3941,28 @@ declare module "node: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; @@ -4025,28 +4038,6 @@ declare module "node: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. */ @@ -4085,6 +4076,28 @@ declare module "node: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; @@ -4160,28 +4173,6 @@ declare module "node: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. */ @@ -4220,6 +4211,28 @@ declare module "node: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/module.d.ts b/types/node/module.d.ts index 14c898fa263020..6a8e339c17aa9c 100644 --- a/types/node/module.d.ts +++ b/types/node/module.d.ts @@ -383,59 +383,18 @@ declare module "node: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, @@ -453,36 +412,15 @@ declare module "node: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/net.d.ts b/types/node/net.d.ts index 0fcd105b52586f..9000542cae3ca2 100644 --- a/types/node/net.d.ts +++ b/types/node/net.d.ts @@ -34,6 +34,10 @@ declare module "node: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 "node: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 "node:net" { * @since v18.13.0 */ autoSelectFamilyAttemptTimeout?: number | undefined; - blockList?: BlockList | undefined; } interface IpcSocketConnectOpts { path: string; diff --git a/types/node/node-tests/events.ts b/types/node/node-tests/events.ts index 902042a4762413..b511c212a21d1a 100644 --- a/types/node/node-tests/events.ts +++ b/types/node/node-tests/events.ts @@ -23,6 +23,7 @@ declare const any: any; events.setMaxListeners(10, emitter, eventTarget); events.listenerCount(emitter, event); // $ExpectType number + events.listenerCount(eventTarget, "event"); // $ExpectType number } void async function() { diff --git a/types/node/node-tests/http.ts b/types/node/node-tests/http.ts index 74e6be671509fd..a89053bd63b6d2 100644 --- a/types/node/node-tests/http.ts +++ b/types/node/node-tests/http.ts @@ -724,6 +724,11 @@ import * as url from "node:url"; http.validateHeaderValue("Location", "/"); http.setMaxIdleHTTPParsers(1337); + + // $ExpectType () => void + http.setGlobalProxyFromEnv(); + // $ExpectType () => void + http.setGlobalProxyFromEnv(process.env); } { diff --git a/types/node/node-tests/net.ts b/types/node/node-tests/net.ts index 4629316b471980..172411925e294e 100644 --- a/types/node/node-tests/net.ts +++ b/types/node/node-tests/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; @@ -170,9 +174,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/node-tests/process.ts b/types/node/node-tests/process.ts index 9093134c45d626..6bdb6bdf33fc36 100644 --- a/types/node/node-tests/process.ts +++ b/types/node/node-tests/process.ts @@ -116,6 +116,7 @@ import { fileURLToPath } from "node:url"; } { process.traceDeprecation = true; + process.traceProcessWarnings = true; } { diff --git a/types/node/node-tests/sqlite.ts b/types/node/node-tests/sqlite.ts index 22bb01269b722b..71214334ff3eb8 100644 --- a/types/node/node-tests/sqlite.ts +++ b/types/node/node-tests/sqlite.ts @@ -106,7 +106,7 @@ import { TextEncoder } from "node:util"; sourceDb.exec("CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)"); targetDb.exec("CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)"); - const session = sourceDb.createSession(); + using session = sourceDb.createSession(); const insert = sourceDb.prepare("INSERT INTO data (key, value) VALUES (?, ?)"); insert.run(1, "hello"); @@ -163,7 +163,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/node-tests/stream.ts b/types/node/node-tests/stream.ts index 380fa49dd4deeb..705b92856726d1 100644 --- a/types/node/node-tests/stream.ts +++ b/types/node/node-tests/stream.ts @@ -591,6 +591,9 @@ addAbortSignal(new AbortSignal(), new Readable()); }, }, }); + + // $ExpectType ReadableStream + Readable.toWeb(readable, { type: "bytes" }); } { @@ -633,6 +636,8 @@ addAbortSignal(new AbortSignal(), new Readable()); const duplex = new Duplex(); // $ExpectType ReadableWritablePair Duplex.toWeb(duplex); + // $ExpectType ReadableWritablePair + Duplex.toWeb(duplex, { type: "bytes" }); } { diff --git a/types/node/node-tests/test.ts b/types/node/node-tests/test.ts index 4b5014139e2e87..eaa29507b47b70 100644 --- a/types/node/node-tests/test.ts +++ b/types/node/node-tests/test.ts @@ -165,6 +165,10 @@ test(undefined, undefined, t => { t.signal; // $ExpectType MockTracker t.mock; + // $ExpectType boolean + t.passed; + // $ExpectType Error | null + t.error; // $ExpectType number t.attempt; }); @@ -342,6 +346,8 @@ describe(s => { // $ExpectType SuiteContext s; // $ExpectType string + s.fullName; + // $ExpectType string s.name; // $ExpectType string | undefined s.filePath; diff --git a/types/node/node-tests/util.ts b/types/node/node-tests/util.ts index 9b92e24531fe1f..d42607a22134c6 100644 --- a/types/node/node-tests/util.ts +++ b/types/node/node-tests/util.ts @@ -548,3 +548,10 @@ util.setTraceSigInt(true); console.log(`Column Number: ${callSite.columnNumber}`); }); } + +{ + // $ExpectType number + util.convertProcessSignalToExitCode("SIGABRT"); + // @ts-expect-error + util.convertProcessSignalToExitCode("INVALID"); +} diff --git a/types/node/package.json b/types/node/package.json index 7ac75da9a883e8..2d7cf3d57b2322 100644 --- a/types/node/package.json +++ b/types/node/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/node", - "version": "25.3.9999", + "version": "25.4.9999", "nonNpm": "conflict", "nonNpmDescription": "Node.js", "projects": [ diff --git a/types/node/process.d.ts b/types/node/process.d.ts index fea9dd5e9a7d81..431d2f8f0707ba 100644 --- a/types/node/process.d.ts +++ b/types/node/process.d.ts @@ -1861,6 +1861,24 @@ declare module "node: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/readline.d.ts b/types/node/readline.d.ts index a47e18555a9546..9e3714fde46532 100644 --- a/types/node/readline.d.ts +++ b/types/node/readline.d.ts @@ -44,6 +44,7 @@ declare module "node:readline" { } interface InterfaceEventMap { "close": []; + "error": [error: Error]; "history": [history: string[]]; "line": [input: string]; "pause": []; diff --git a/types/node/sqlite.d.ts b/types/node/sqlite.d.ts index f6c34529e111b0..ec90e7a683e518 100644 --- a/types/node/sqlite.d.ts +++ b/types/node/sqlite.d.ts @@ -429,15 +429,68 @@ declare module "node:sqlite" { */ prepare(sql: string): StatementSync; /** - * Creates a new `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'; @@ -453,8 +506,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. @@ -543,26 +596,39 @@ declare module "node:sqlite" { * [`sqlite3session_delete()`](https://www.sqlite.org/session/sqlite3session_delete.html). */ close(): void; + /** + * Closes the session. If the session is already closed, does nothing. + * @since v24.9.0 + */ + [Symbol.dispose](): void; } /** * This class represents a single LRU (Least Recently Used) cache for storing * prepared statements. * - * Instances of this class are created via the database.createSQLTagStore() 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.createSQLTagStore(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, @@ -570,7 +636,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, @@ -578,7 +652,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, @@ -586,15 +667,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/stream.d.ts b/types/node/stream.d.ts index 79ad890bfadb1e..3f046ac34f7e07 100644 --- a/types/node/stream.d.ts +++ b/types/node/stream.d.ts @@ -81,6 +81,7 @@ declare module "node:stream" { interface ArrayOptions extends ReadableOperatorOptions {} interface ReadableToWebOptions { strategy?: web.QueuingStrategy | undefined; + type?: web.ReadableStreamType | undefined; } interface ReadableEventMap { "close": []; @@ -485,13 +486,18 @@ declare module "node:stream" { * } * } * - * const wordsStream = Readable.from(['this is', 'compose as operator']).compose(splitToWords); + * const wordsStream = Readable.from(['text passed through', 'composed stream']).compose(splitToWords); * const words = await wordsStream.toArray(); * - * console.log(words); // prints ['this', 'is', 'compose', 'as', 'operator'] + * console.log(words); // prints ['text', 'passed', 'through', 'composed', 'stream'] * ``` * - * See [`stream.compose`](https://nodejs.org/docs/latest-v25.x/api/stream.html#streamcomposestreams) for more information. + * `readable.compose(s)` is equivalent to `stream.compose(readable, s)`. + * + * This method also allows for an `AbortSignal` to be provided, which will destroy + * the composed stream when aborted. + * + * See [`stream.compose(...streams)`](https://nodejs.org/docs/latest-v25.x/api/stream.html#streamcomposestreams) for more information. * @since v19.1.0, v18.13.0 * @returns a stream composed with the stream `stream`. */ @@ -1056,6 +1062,9 @@ declare module "node:stream" { writableHighWaterMark?: number | undefined; writableCorked?: number | undefined; } + interface DuplexToWebOptions { + type?: web.ReadableStreamType | undefined; + } interface DuplexEventMap extends ReadableEventMap, WritableEventMap {} /** * Duplex streams are streams that implement both the `Readable` and `Writable` interfaces. @@ -1109,7 +1118,7 @@ declare module "node:stream" { * A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`. * @since v17.0.0 */ - static toWeb(streamDuplex: NodeJS.ReadWriteStream): web.ReadableWritablePair; + static toWeb(streamDuplex: NodeJS.ReadWriteStream, options?: DuplexToWebOptions): web.ReadableWritablePair; /** * A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`. * @since v17.0.0 @@ -1653,7 +1662,8 @@ declare module "node:stream" { * console.log(res); // prints 'HELLOWORLD' * ``` * - * See [`readable.compose(stream)`](https://nodejs.org/docs/latest-v25.x/api/stream.html#readablecomposestream-options) for `stream.compose` as operator. + * For convenience, the `readable.compose(stream)` method is available on + * `Readable` and `Duplex` streams as a wrapper for this function. * @since v16.9.0 * @experimental */ diff --git a/types/node/test.d.ts b/types/node/test.d.ts index a3d3b682055ee1..07318b268454fe 100644 --- a/types/node/test.d.ts +++ b/types/node/test.d.ts @@ -237,7 +237,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 */ @@ -480,7 +480,7 @@ declare module "node:test" { } namespace EventData { interface Error extends globalThis.Error { - cause: globalThis.Error; + cause: unknown; } interface LocationInfo { /** @@ -969,7 +969,6 @@ declare module "node:test" { * @since v22.2.0, v20.15.0 */ readonly assert: TestContextAssert; - readonly attempt: number; /** * This function is used to create a hook running before subtest of the current test. * @param fn The hook function. The first argument to this function is a `TestContext` object. @@ -1032,6 +1031,21 @@ declare module "node:test" { * @since v18.8.0, v16.18.0 */ readonly name: string; + /** + * Indicated whether the test succeeded. + * @since v21.7.0, v20.12.0 + */ + readonly passed: boolean; + /** + * The failure reason for the test/case; wrapped and available via `context.error.cause`. + * @since v21.7.0, v20.12.0 + */ + readonly error: EventData.Error | null; + /** + * Number of times the test has been attempted. + * @since v21.7.0, v20.12.0 + */ + readonly attempt: number; /** * This function is used to set the number of assertions and subtests that are expected to run * within the test. If the number of assertions and subtests that run does not match the @@ -1286,6 +1300,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 @@ -1353,7 +1372,7 @@ declare module "node:test" { * describe('tests', async () => { * before(() => console.log('about to run some test')); * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); + * // Some relevant assertion here * }); * }); * ``` @@ -1369,7 +1388,7 @@ declare module "node:test" { * describe('tests', async () => { * after(() => console.log('finished running tests')); * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); + * // Some relevant assertion here * }); * }); * ``` @@ -1385,7 +1404,7 @@ declare module "node:test" { * describe('tests', async () => { * beforeEach(() => console.log('about to run a test')); * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); + * // Some relevant assertion here * }); * }); * ``` @@ -1402,7 +1421,7 @@ declare module "node:test" { * describe('tests', async () => { * afterEach(() => console.log('finished running a test')); * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); + * // Some relevant assertion here * }); * }); * ``` @@ -2034,24 +2053,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/tls.d.ts b/types/node/tls.d.ts index 635ee3e7ddebd9..873d44eee4025b 100644 --- a/types/node/tls.d.ts +++ b/types/node/tls.d.ts @@ -551,8 +551,12 @@ declare module "node:tls" { */ requestCert?: boolean | undefined; /** - * An array of strings or a Buffer naming possible ALPN protocols. - * (Protocols should be ordered by their priority.) + * An array of strings, or a single `Buffer`, `TypedArray`, or `DataView` containing the supported + * ALPN protocols. Buffers should have the format `[len][name][len][name]...` + * e.g. `'\x08http/1.1\x08http/1.0'`, where the `len` byte is the length of the + * next protocol name. Passing an array is usually much simpler, e.g. + * `['http/1.1', 'http/1.0']`. Protocols earlier in the list have higher + * preference than those later. */ ALPNProtocols?: readonly string[] | NodeJS.ArrayBufferView | undefined; /** diff --git a/types/node/url.d.ts b/types/node/url.d.ts index 6f5b88569dd535..b0a8ed056fa2e3 100644 --- a/types/node/url.d.ts +++ b/types/node/url.d.ts @@ -334,6 +334,19 @@ declare module "node: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 "node: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/util.d.ts b/types/node/util.d.ts index 4caf804beb8604..10062f655ca763 100644 --- a/types/node/util.d.ts +++ b/types/node/util.d.ts @@ -308,6 +308,9 @@ declare module "node: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'; * @@ -320,7 +323,7 @@ declare module "node: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 @@ -750,6 +753,28 @@ declare module "node:util" { * @legacy Use ES2015 class syntax and `extends` keyword instead. */ export function inherits(constructor: unknown, superConstructor: unknown): void; + /** + * The `util.convertProcessSignalToExitCode()` method converts a signal name to its + * corresponding POSIX exit code. Following the POSIX standard, the exit code + * for a process terminated by a signal is calculated as `128 + signal number`. + * + * If `signal` is not a valid signal name, then an error will be thrown. See + * [`signal(7)`](https://man7.org/linux/man-pages/man7/signal.7.html) for a list of valid signals. + * + * ```js + * import { convertProcessSignalToExitCode } from 'node:util'; + * + * console.log(convertProcessSignalToExitCode('SIGTERM')); // 143 (128 + 15) + * console.log(convertProcessSignalToExitCode('SIGKILL')); // 137 (128 + 9) + * ``` + * + * This is particularly useful when working with processes to determine + * the exit code based on the signal that terminated the process. + * @since v25.4.0 + * @param signal A signal name (e.g. `'SIGTERM'`) + * @returns The exit code corresponding to `signal` + */ + export function convertProcessSignalToExitCode(signal: NodeJS.Signals): number; export type DebugLoggerFunction = (msg: string, ...param: unknown[]) => void; export interface DebugLogger extends DebugLoggerFunction { /** @@ -804,7 +829,7 @@ declare module "node: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/v8.d.ts b/types/node/v8.d.ts index 632552b6f7a0eb..814807a3d0692f 100644 --- a/types/node/v8.d.ts +++ b/types/node/v8.d.ts @@ -308,7 +308,6 @@ declare module "node: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; diff --git a/types/node/worker_threads.d.ts b/types/node/worker_threads.d.ts index 1654e4a6b2f125..9a24e0bb751b62 100644 --- a/types/node/worker_threads.d.ts +++ b/types/node/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}`)); * }); diff --git a/types/vscode/index.d.ts b/types/vscode/index.d.ts index 109140692f3655..3ba200fa2bc4f3 100644 --- a/types/vscode/index.d.ts +++ b/types/vscode/index.d.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ /** - * Type Definition for Visual Studio Code 1.108 Extension API + * Type Definition for Visual Studio Code 1.110 Extension API * See https://code.visualstudio.com/api for more information */ @@ -6482,6 +6482,21 @@ declare module 'vscode' { */ export type CharacterPair = [string, string]; + /** + * Configuration for line comments. + */ + export interface LineCommentRule { + /** + * The line comment token, like `//` + */ + comment: string; + /** + * Whether the comment token should not be indented and placed at the first column. + * Defaults to false. + */ + noIndent?: boolean; + } + /** * Describes how comments for a language work. */ @@ -6490,7 +6505,7 @@ declare module 'vscode' { /** * The line comment token, like `// this is a comment` */ - lineComment?: string; + lineComment?: string | LineCommentRule; /** * The block comment character pair, like `/* block comment */` @@ -10781,6 +10796,16 @@ declare module 'vscode' { */ export const isNewAppInstall: boolean; + /** + * Indicates whether the application is running in portable mode. + * + * Portable mode is enabled when the application is run from a folder that contains + * a `data` directory, allowing for self-contained installations. + * + * Learn more about [Portable Mode](https://code.visualstudio.com/docs/editor/portable). + */ + export const isAppPortable: boolean; + /** * Indicates whether the users has telemetry enabled. * Can be observed to determine if the extension should send telemetry. @@ -21211,4 +21236,3 @@ declare module 'vscode' { * we recommend the use of native promises which are available in this editor. */ interface Thenable extends PromiseLike { } - diff --git a/types/vscode/package.json b/types/vscode/package.json index a1c8d147661899..76e1d6b7c1905b 100644 --- a/types/vscode/package.json +++ b/types/vscode/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/vscode", - "version": "1.109.9999", + "version": "1.110.9999", "nonNpm": "conflict", "nonNpmDescription": "TypeScript definitions for the Visual Studio Code Extension API", "projects": [