diff --git a/types/node/v24/inspector.generated.d.ts b/types/node/v24/inspector.generated.d.ts index 17352e7916d9c8..2af699c72d52c6 100644 --- a/types/node/v24/inspector.generated.d.ts +++ b/types/node/v24/inspector.generated.d.ts @@ -1791,6 +1791,18 @@ declare module "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. @@ -2379,6 +2391,7 @@ declare module "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. @@ -3477,7 +3490,7 @@ declare module "inspector/promises" { /** * Enables network tracking, network events will now be delivered to the client. */ - post(method: "Network.enable"): Promise; + post(method: "Network.enable", params?: Network.EnableParameterType): Promise; /** * Returns post data sent with the request. Returns an error when no data was sent with the request. */ diff --git a/types/node/v24/package.json b/types/node/v24/package.json index 68b134a3070e39..5359235af593e4 100644 --- a/types/node/v24/package.json +++ b/types/node/v24/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@types/node", - "version": "24.10.9999", + "version": "24.11.9999", "nonNpm": "conflict", "nonNpmDescription": "Node.js", "projects": [ diff --git a/types/node/v24/sqlite.d.ts b/types/node/v24/sqlite.d.ts index 6ff7943ab8b003..6f29f90f914ab3 100644 --- a/types/node/v24/sqlite.d.ts +++ b/types/node/v24/sqlite.d.ts @@ -6,12 +6,7 @@ * import sqlite from 'node:sqlite'; * ``` * - * This module is only available under the `node:` scheme. The following will not - * work: - * - * ```js - * import sqlite from 'sqlite'; - * ``` + * This module is only available under the `node:` scheme. * * The following example shows the basic usage of the `node:sqlite` module to open * an in-memory database, write data to the database, and then read the data back. @@ -413,7 +408,7 @@ declare module "node:sqlite" { */ prepare(sql: string): StatementSync; /** - * Creates a new `SQLTagStore`, which is an LRU (Least Recently Used) cache for + * Creates a new {@link SQLTagStore `SQLTagStore`}, which is an LRU (Least Recently Used) cache for * storing prepared statements. This allows for the efficient reuse of prepared * statements by tagging them with a unique identifier. * @@ -427,7 +422,7 @@ declare module "node:sqlite" { * import { DatabaseSync } from 'node:sqlite'; * * const db = new DatabaseSync(':memory:'); - * const sql = db.createSQLTagStore(); + * const sql = db.createTagStore(); * * db.exec('CREATE TABLE users (id INT, name TEXT)'); * @@ -450,6 +445,7 @@ declare module "node:sqlite" { * // ] * ``` * @since v24.9.0 + * @param maxSize The maximum number of prepared statements to cache. **Default**: `1000`. * @returns A new SQL tag store for caching prepared statements. */ createTagStore(maxSize?: number): SQLTagStore; @@ -468,6 +464,8 @@ declare module "node:sqlite" { * [`sqlite3changeset_apply()`](https://www.sqlite.org/session/sqlite3changeset_apply.html). * * ```js + * import { DatabaseSync } from 'node:sqlite'; + * * const sourceDb = new DatabaseSync(':memory:'); * const targetDb = new DatabaseSync(':memory:'); * @@ -530,14 +528,14 @@ declare module "node:sqlite" { * This class represents a single LRU (Least Recently Used) cache for storing * prepared statements. * - * Instances of this class are created via the database.createSQLTagStore() method, + * 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 */ diff --git a/types/node/v24/test/vm.ts b/types/node/v24/test/vm.ts index 4482c8209cadad..3112b64e98f25c 100644 --- a/types/node/v24/test/vm.ts +++ b/types/node/v24/test/vm.ts @@ -200,7 +200,7 @@ import { // "contextifiedObject" when creating the context. export default secret; `, - { context: rootModule.context }, + { context: module.context }, ); moduleMap.set(specifier, requestedModule); diff --git a/types/node/v24/url.d.ts b/types/node/v24/url.d.ts index 8d0fb65801cc07..55ce19db54a4aa 100644 --- a/types/node/v24/url.d.ts +++ b/types/node/v24/url.d.ts @@ -80,7 +80,7 @@ declare module "url" { * function getURL(req) { * const proto = req.headers['x-forwarded-proto'] || 'https'; * const host = req.headers['x-forwarded-host'] || req.headers.host || 'example.com'; - * return new URL(req.url || '/', `${proto}://${host}`); + * return new URL(`${proto}://${host}${req.url || '/'}`); * } * ``` * @@ -90,7 +90,7 @@ declare module "url" { * * ```js * function getURL(req) { - * return new URL(req.url || '/', 'https://example.com'); + * return new URL(`https://example.com${req.url || '/'}`); * } * ``` * @since v0.1.25 diff --git a/types/node/v24/vm.d.ts b/types/node/v24/vm.d.ts index 50b7f09ad54c66..e56db1f581e040 100644 --- a/types/node/v24/vm.d.ts +++ b/types/node/v24/vm.d.ts @@ -748,8 +748,8 @@ declare module "vm" { * // The "secret" variable refers to the global variable we added to * // "contextifiedObject" when creating the context. * export default secret; - * `, { context: referencingModule.context }); - * moduleMap.set(specifier, linkedModule); + * `, { context: module.context }); + * moduleMap.set(specifier, requestedModule); * // Resolve the dependencies of the new module as well. * resolveAndLinkDependencies(requestedModule); * } @@ -819,19 +819,34 @@ declare module "vm" { */ status: ModuleStatus; /** - * Evaluate the module. - * - * This must be called after the module has been linked; otherwise it will reject. - * It could be called also when the module has already been evaluated, in which - * case it will either do nothing if the initial evaluation ended in success - * (`module.status` is `'evaluated'`) or it will re-throw the exception that the - * initial evaluation resulted in (`module.status` is `'errored'`). - * - * This method cannot be called while the module is being evaluated - * (`module.status` is `'evaluating'`). - * - * Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation) field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) s in the - * ECMAScript specification. + * Evaluate the module and its depenendencies. Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation) + * field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records)s in the ECMAScript specification. + * + * If the module is a `vm.SourceTextModule`, `evaluate()` must be called after the module has been instantiated; + * otherwise `evaluate()` will return a rejected promise. + * + * For a `vm.SourceTextModule`, the promise returned by `evaluate()` may be fulfilled either synchronously or asynchronously: + * 1. If the `vm.SourceTextModule` has no top-level `await` in itself or any of its dependencies, the promise will be + * fulfilled synchronously after the module and all its dependencies have been evaluated. + * 1. If the evaluation succeeds, the promise will be _synchronously_ resolved to `undefined`. + * 2. If the evaluation results in an exception, the promise will be _synchronously_ rejected with the exception that causes the evaluation to fail, which is the same as `module.error`. + * 2. If the `vm.SourceTextModule` has top-level `await` in itself or any of its dependencies, the promise will be fulfilled asynchronously after the module and all its dependencies have been evaluated. + * 1. If the evaluation succeeds, the promise will be _asynchronously_ resolved to `undefined`. + * 2. If the evaluation results in an exception, the promise will be _asynchronously_ rejected with the exception that causes the evaluation to fail. + * + * If the module is a `vm.SyntheticModule`, `evaluate()` always returns a promise that fulfills synchronously, + * see the specification of [Evaluate() of a Synthetic Module Record](https://tc39.es/ecma262/#sec-smr-Evaluate): + * 1. If the `evaluateCallback` passed to its constructor throws an exception synchronously, `evaluate()` returns a promise that will be synchronously rejected with that exception. + * 2. If the `evaluateCallback` does not throw an exception, `evaluate()` returns a promise that will be synchronously resolved to `undefined`. + * + * The `evaluateCallback` of a `vm.SyntheticModule` is executed synchronously within the `evaluate()` call, and its return value is discarded. This means if `evaluateCallback` is an asynchronous function, the promise + * returned by `evaluate()` will not reflect its asynchronous behavior, and any rejections from an asynchronous `evaluateCallback` will be lost. + * + * evaluate() could also be called again after the module has already been evaluated, in which case: + * 1. If the initial evaluation ended in success (`module.status` is `'evaluated'`), it will do nothing and return a promise that resolves to `undefined`. + * 2. If the initial evaluation resulted in an exception (`module.status` is `'errored'`), it will re-reject the exception that the initial evaluation resulted in. + * + * This method cannot be called while the module is being evaluated (`module.status` is `'evaluating'`). * @return Fulfills with `undefined` upon success. */ evaluate(options?: ModuleEvaluateOptions): Promise; diff --git a/types/node/v24/worker_threads.d.ts b/types/node/v24/worker_threads.d.ts index cc947c044e8f75..76c75d6b0c9545 100644 --- a/types/node/v24/worker_threads.d.ts +++ b/types/node/v24/worker_threads.d.ts @@ -3,7 +3,7 @@ * JavaScript in parallel. To access it: * * ```js - * import worker from 'node:worker_threads'; + * import worker_threads from 'node:worker_threads'; * ``` * * Workers (threads) are useful for performing CPU-intensive JavaScript operations. @@ -446,8 +446,8 @@ declare module "worker_threads" { */ terminate(): Promise; /** - * This method returns a `Promise` that will resolve to an object identical to `process.threadCpuUsage()`, - * or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running. + * This method returns a `Promise` that will resolve to an object identical to {@link process.threadCpuUsage()}, + * or reject with an [`ERR_WORKER_NOT_RUNNING`](https://nodejs.org/docs/latest-v24.x/api/errors.html#err_worker_not_running) error if the worker is no longer running. * This methods allows the statistics to be observed from outside the actual thread. * @since v24.6.0 */ @@ -556,49 +556,49 @@ declare module "worker_threads" { * @since v24.2.0 */ [Symbol.asyncDispose](): Promise; - addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "error", listener: (err: any) => void): this; addListener(event: "exit", listener: (exitCode: number) => void): this; addListener(event: "message", listener: (value: any) => void): this; addListener(event: "messageerror", listener: (error: Error) => void): this; addListener(event: "online", listener: () => void): this; addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "error", err: Error): boolean; + emit(event: "error", err: any): boolean; emit(event: "exit", exitCode: number): boolean; emit(event: "message", value: any): boolean; emit(event: "messageerror", error: Error): boolean; emit(event: "online"): boolean; emit(event: string | symbol, ...args: any[]): boolean; - on(event: "error", listener: (err: Error) => void): this; + on(event: "error", listener: (err: any) => void): this; on(event: "exit", listener: (exitCode: number) => void): this; on(event: "message", listener: (value: any) => void): this; on(event: "messageerror", listener: (error: Error) => void): this; on(event: "online", listener: () => void): this; on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "error", listener: (err: Error) => void): this; + once(event: "error", listener: (err: any) => void): this; once(event: "exit", listener: (exitCode: number) => void): this; once(event: "message", listener: (value: any) => void): this; once(event: "messageerror", listener: (error: Error) => void): this; once(event: "online", listener: () => void): this; once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "error", listener: (err: any) => void): this; prependListener(event: "exit", listener: (exitCode: number) => void): this; prependListener(event: "message", listener: (value: any) => void): this; prependListener(event: "messageerror", listener: (error: Error) => void): this; prependListener(event: "online", listener: () => void): this; prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "error", listener: (err: any) => void): this; prependOnceListener(event: "exit", listener: (exitCode: number) => void): this; prependOnceListener(event: "message", listener: (value: any) => void): this; prependOnceListener(event: "messageerror", listener: (error: Error) => void): this; prependOnceListener(event: "online", listener: () => void): this; prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; + removeListener(event: "error", listener: (err: any) => void): this; removeListener(event: "exit", listener: (exitCode: number) => void): this; removeListener(event: "message", listener: (value: any) => void): this; removeListener(event: "messageerror", listener: (error: Error) => void): this; removeListener(event: "online", listener: () => void): this; removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - off(event: "error", listener: (err: Error) => void): this; + off(event: "error", listener: (err: any) => void): this; off(event: "exit", listener: (exitCode: number) => void): this; off(event: "message", listener: (value: any) => void): this; off(event: "messageerror", listener: (error: Error) => void): this; @@ -691,7 +691,7 @@ declare module "worker_threads" { var locks: LockManager; /** * Mark an object as not transferable. If `object` occurs in the transfer list of - * a `port.postMessage()` call, it is ignored. + * a {@link MessagePort.postMessage port.postMessage()} call, it is ignored. * * In particular, this makes sense for objects that can be cloned, rather than * transferred, and which are used by other objects on the sending side. @@ -813,13 +813,13 @@ declare module "worker_threads" { * * if (isMainThread) { * setEnvironmentData('Hello', 'World!'); - * const worker = new Worker(__filename); + * const worker = new Worker(new URL(import.meta.url)); * } else { * console.log(getEnvironmentData('Hello')); // Prints 'World!'. * } * ``` * @since v15.12.0, v14.18.0 - * @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key. + * @param key Any arbitrary, cloneable JavaScript value that can be used as a {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map Map} key. */ function getEnvironmentData(key: Serializable): Serializable; /**