Update Bot

This commit is contained in:
2026-03-15 11:58:43 +01:00
parent b67c111ffc
commit cd99275933
560 changed files with 23173 additions and 55113 deletions

2
node_modules/@types/node/README.md generated vendored
View File

@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
### Additional Details
* Last updated: Sun, 08 Feb 2026 00:09:19 GMT
* Last updated: Thu, 18 Sep 2025 00:04:03 GMT
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
# Credits

419
node_modules/@types/node/assert.d.ts generated vendored
View File

@@ -1,166 +1,20 @@
/**
* The `node:assert` module provides a set of assertion functions for verifying
* invariants.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/assert.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/assert.js)
*/
declare module "node:assert" {
import strict = require("node:assert/strict");
declare module "assert" {
/**
* An alias of {@link assert.ok}.
* An alias of {@link ok}.
* @since v0.5.9
* @param value The input that is checked for being truthy.
*/
function assert(value: unknown, message?: string | Error): asserts value;
const kOptions: unique symbol;
namespace assert {
type AssertMethodNames =
| "deepEqual"
| "deepStrictEqual"
| "doesNotMatch"
| "doesNotReject"
| "doesNotThrow"
| "equal"
| "fail"
| "ifError"
| "match"
| "notDeepEqual"
| "notDeepStrictEqual"
| "notEqual"
| "notStrictEqual"
| "ok"
| "partialDeepStrictEqual"
| "rejects"
| "strictEqual"
| "throws";
interface AssertOptions {
/**
* If set to `'full'`, shows the full diff in assertion errors.
* @default 'simple'
*/
diff?: "simple" | "full" | undefined;
/**
* If set to `true`, non-strict methods behave like their
* corresponding strict methods.
* @default true
*/
strict?: boolean | undefined;
/**
* If set to `true`, skips prototype and constructor
* comparison in deep equality checks.
* @since v24.9.0
* @default false
*/
skipPrototype?: boolean | undefined;
}
interface Assert extends Pick<typeof assert, AssertMethodNames> {
readonly [kOptions]: AssertOptions & { strict: false };
}
interface AssertStrict extends Pick<typeof strict, AssertMethodNames> {
readonly [kOptions]: AssertOptions & { strict: true };
}
/**
* The `Assert` class allows creating independent assertion instances with custom options.
* @since v24.6.0
*/
var Assert: {
/**
* Creates a new assertion instance. The `diff` option controls the verbosity of diffs in assertion error messages.
*
* ```js
* const { Assert } = require('node:assert');
* const assertInstance = new Assert({ diff: 'full' });
* assertInstance.deepStrictEqual({ a: 1 }, { a: 2 });
* // Shows a full diff in the error message.
* ```
*
* **Important**: When destructuring assertion methods from an `Assert` instance,
* the methods lose their connection to the instance's configuration options (such
* as `diff`, `strict`, and `skipPrototype` settings).
* The destructured methods will fall back to default behavior instead.
*
* ```js
* const myAssert = new Assert({ diff: 'full' });
*
* // This works as expected - uses 'full' diff
* myAssert.strictEqual({ a: 1 }, { b: { c: 1 } });
*
* // This loses the 'full' diff setting - falls back to default 'simple' diff
* const { strictEqual } = myAssert;
* strictEqual({ a: 1 }, { b: { c: 1 } });
* ```
*
* The `skipPrototype` option affects all deep equality methods:
*
* ```js
* class Foo {
* constructor(a) {
* this.a = a;
* }
* }
*
* class Bar {
* constructor(a) {
* this.a = a;
* }
* }
*
* const foo = new Foo(1);
* const bar = new Bar(1);
*
* // Default behavior - fails due to different constructors
* const assert1 = new Assert();
* assert1.deepStrictEqual(foo, bar); // AssertionError
*
* // Skip prototype comparison - passes if properties are equal
* const assert2 = new Assert({ skipPrototype: true });
* assert2.deepStrictEqual(foo, bar); // OK
* ```
*
* When destructured, methods lose access to the instance's `this` context and revert to default assertion behavior
* (diff: 'simple', non-strict mode).
* To maintain custom options when using destructured methods, avoid
* destructuring and call methods directly on the instance.
* @since v24.6.0
*/
new(
options?: AssertOptions & { strict?: true | undefined },
): AssertStrict;
new(
options: AssertOptions,
): Assert;
};
interface AssertionErrorOptions {
/**
* If provided, the error message is set to this value.
*/
message?: string | undefined;
/**
* The `actual` property on the error instance.
*/
actual?: unknown;
/**
* The `expected` property on the error instance.
*/
expected?: unknown;
/**
* The `operator` property on the error instance.
*/
operator?: string | undefined;
/**
* If provided, the generated stack trace omits frames before this function.
*/
stackStartFn?: Function | undefined;
/**
* If set to `'full'`, shows the full diff in assertion errors.
* @default 'simple'
*/
diff?: "simple" | "full" | undefined;
}
/**
* Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
*/
class AssertionError extends Error {
constructor(options: AssertionErrorOptions);
/**
* Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
*/
@@ -169,6 +23,10 @@ declare module "node:assert" {
* Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
*/
expected: unknown;
/**
* Set to the passed in operator value.
*/
operator: string;
/**
* Indicates if the message was auto-generated (`true`) or not.
*/
@@ -177,10 +35,167 @@ declare module "node:assert" {
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
*/
code: "ERR_ASSERTION";
constructor(options?: {
/** If provided, the error message is set to this value. */
message?: string | undefined;
/** The `actual` property on the error instance. */
actual?: unknown | undefined;
/** The `expected` property on the error instance. */
expected?: unknown | undefined;
/** The `operator` property on the error instance. */
operator?: string | undefined;
/** If provided, the generated stack trace omits frames before this function. */
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
stackStartFn?: Function | undefined;
});
}
/**
* This feature is deprecated and will be removed in a future version.
* Please consider using alternatives such as the `mock` helper function.
* @since v14.2.0, v12.19.0
* @deprecated Deprecated
*/
class CallTracker {
/**
* Set to the passed in operator value.
* The wrapper function is expected to be called exactly `exact` times. If the
* function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an
* error.
*
* ```js
* import assert from 'node:assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
*
* function func() {}
*
* // Returns a function that wraps func() that must be called exact times
* // before tracker.verify().
* const callsfunc = tracker.calls(func);
* ```
* @since v14.2.0, v12.19.0
* @param [fn='A no-op function']
* @param [exact=1]
* @return A function that wraps `fn`.
*/
calls(exact?: number): () => void;
calls(fn: undefined, exact?: number): () => void;
calls<Func extends (...args: any[]) => any>(fn: Func, exact?: number): Func;
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func | (() => void);
/**
* Example:
*
* ```js
* import assert from 'node:assert';
*
* const tracker = new assert.CallTracker();
*
* function func() {}
* const callsfunc = tracker.calls(func);
* callsfunc(1, 2, 3);
*
* assert.deepStrictEqual(tracker.getCalls(callsfunc),
* [{ thisArg: undefined, arguments: [1, 2, 3] }]);
* ```
* @since v18.8.0, v16.18.0
* @return An array with all the calls to a tracked function.
*/
getCalls(fn: Function): CallTrackerCall[];
/**
* The arrays contains information about the expected and actual number of calls of
* the functions that have not been called the expected number of times.
*
* ```js
* import assert from 'node:assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
*
* function func() {}
*
* // Returns a function that wraps func() that must be called exact times
* // before tracker.verify().
* const callsfunc = tracker.calls(func, 2);
*
* // Returns an array containing information on callsfunc()
* console.log(tracker.report());
* // [
* // {
* // message: 'Expected the func function to be executed 2 time(s) but was
* // executed 0 time(s).',
* // actual: 0,
* // expected: 2,
* // operator: 'func',
* // stack: stack trace
* // }
* // ]
* ```
* @since v14.2.0, v12.19.0
* @return An array of objects containing information about the wrapper functions returned by {@link tracker.calls()}.
*/
report(): CallTrackerReportInformation[];
/**
* Reset calls of the call tracker. If a tracked function is passed as an argument, the calls will be reset for it.
* If no arguments are passed, all tracked functions will be reset.
*
* ```js
* import assert from 'node:assert';
*
* const tracker = new assert.CallTracker();
*
* function func() {}
* const callsfunc = tracker.calls(func);
*
* callsfunc();
* // Tracker was called once
* assert.strictEqual(tracker.getCalls(callsfunc).length, 1);
*
* tracker.reset(callsfunc);
* assert.strictEqual(tracker.getCalls(callsfunc).length, 0);
* ```
* @since v18.8.0, v16.18.0
* @param fn a tracked function to reset.
*/
reset(fn?: Function): void;
/**
* Iterates through the list of functions passed to {@link tracker.calls()} and will throw an error for functions that
* have not been called the expected number of times.
*
* ```js
* import assert from 'node:assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
*
* function func() {}
*
* // Returns a function that wraps func() that must be called exact times
* // before tracker.verify().
* const callsfunc = tracker.calls(func, 2);
*
* callsfunc();
*
* // Will throw an error since callsfunc() was only called once.
* tracker.verify();
* ```
* @since v14.2.0, v12.19.0
*/
verify(): void;
}
interface CallTrackerCall {
thisArg: object;
arguments: unknown[];
}
interface CallTrackerReportInformation {
message: string;
/** The actual number of times the function was called. */
actual: number;
/** The number of times the function was expected to be called. */
expected: number;
/** The name of the function that is wrapped. */
operator: string;
/** A stack trace of the function. */
stack: object;
}
type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error;
/**
@@ -200,10 +215,22 @@ declare module "node:assert" {
* assert.fail(new TypeError('need array'));
* // TypeError: need array
* ```
*
* Using `assert.fail()` with more than two arguments is possible but deprecated.
* See below for further details.
* @since v0.1.21
* @param [message='Failed']
*/
function fail(message?: string | Error): never;
/** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
function fail(
actual: unknown,
expected: unknown,
message?: string | Error,
operator?: string,
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
stackStartFn?: Function,
): never;
/**
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
*
@@ -771,7 +798,7 @@ declare module "node:assert" {
* check that the promise is rejected.
*
* If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v25.x/api/errors.html#err_invalid_return_value)
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v24.x/api/errors.html#err_invalid_return_value)
* error. In both cases the error handler is skipped.
*
* Besides the async nature to await the completion behaves identically to {@link throws}.
@@ -841,7 +868,7 @@ declare module "node:assert" {
*
* If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
* the function does not return a promise, `assert.doesNotReject()` will return a
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v25.x/api/errors.html#err_invalid_return_value) error. In both cases
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v24.x/api/errors.html#err_invalid_return_value) error. In both cases
* the error handler is skipped.
*
* Using `assert.doesNotReject()` is actually not useful because there is little
@@ -904,7 +931,7 @@ declare module "node:assert" {
* If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
* to the value of the `message` parameter. If the `message` parameter is
* undefined, a default error message is assigned. If the `message` parameter is an
* instance of an [Error](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
* instance of an [Error](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
* @since v13.6.0, v12.16.0
*/
function match(value: string, regExp: RegExp, message?: string | Error): void;
@@ -927,7 +954,7 @@ declare module "node:assert" {
* If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
* to the value of the `message` parameter. If the `message` parameter is
* undefined, a default error message is assigned. If the `message` parameter is an
* instance of an [Error](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
* instance of an [Error](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
* @since v13.6.0, v12.16.0
*/
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
@@ -943,13 +970,87 @@ declare module "node:assert" {
* @since v22.13.0
*/
function partialDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
}
namespace assert {
export { strict };
/**
* In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example,
* {@link deepEqual} will behave like {@link deepStrictEqual}.
*
* In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error
* messages for objects display the objects, often truncated.
*
* To use strict assertion mode:
*
* ```js
* import { strict as assert } from 'node:assert';
* import assert from 'node:assert/strict';
* ```
*
* Example error diff:
*
* ```js
* import { strict as assert } from 'node:assert';
*
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
* // AssertionError: Expected inputs to be strictly deep-equal:
* // + actual - expected ... Lines skipped
* //
* // [
* // [
* // ...
* // 2,
* // + 3
* // - '3'
* // ],
* // ...
* // 5
* // ]
* ```
*
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also
* deactivate the colors in the REPL. For more on color support in terminal environments, read the tty
* `getColorDepth()` documentation.
*
* @since v15.0.0, v13.9.0, v12.16.2, v9.9.0
*/
namespace strict {
type AssertionError = assert.AssertionError;
type AssertPredicate = assert.AssertPredicate;
type CallTrackerCall = assert.CallTrackerCall;
type CallTrackerReportInformation = assert.CallTrackerReportInformation;
}
const strict:
& Omit<
typeof assert,
| "equal"
| "notEqual"
| "deepEqual"
| "notDeepEqual"
| "ok"
| "strictEqual"
| "deepStrictEqual"
| "ifError"
| "strict"
| "AssertionError"
>
& {
(value: unknown, message?: string | Error): asserts value;
equal: typeof strictEqual;
notEqual: typeof notStrictEqual;
deepEqual: typeof deepStrictEqual;
notDeepEqual: typeof notDeepStrictEqual;
// Mapped types and assertion functions are incompatible?
// TS2775: Assertions require every name in the call target
// to be declared with an explicit type annotation.
ok: typeof ok;
strictEqual: typeof strictEqual;
deepStrictEqual: typeof deepStrictEqual;
ifError: typeof ifError;
strict: typeof strict;
AssertionError: typeof AssertionError;
};
}
export = assert;
}
declare module "assert" {
import assert = require("node:assert");
declare module "node:assert" {
import assert = require("assert");
export = assert;
}

View File

@@ -1,105 +1,8 @@
/**
* In strict assertion mode, non-strict methods behave like their corresponding
* strict methods. For example, `assert.deepEqual()` will behave like
* `assert.deepStrictEqual()`.
*
* In strict assertion mode, error messages for objects display a diff. In legacy
* assertion mode, error messages for objects display the objects, often truncated.
*
* To use strict assertion mode:
*
* ```js
* import { strict as assert } from 'node:assert';
* ```
*
* ```js
* import assert from 'node:assert/strict';
* ```
*
* Example error diff:
*
* ```js
* import { strict as assert } from 'node:assert';
*
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
* // AssertionError: Expected inputs to be strictly deep-equal:
* // + actual - expected ... Lines skipped
* //
* // [
* // [
* // ...
* // 2,
* // + 3
* // - '3'
* // ],
* // ...
* // 5
* // ]
* ```
*
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS`
* environment variables. This will also deactivate the colors in the REPL. For
* more on color support in terminal environments, read the tty
* [`getColorDepth()`](https://nodejs.org/docs/latest-v25.x/api/tty.html#writestreamgetcolordepthenv) documentation.
* @since v15.0.0
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/assert/strict.js)
*/
declare module "node:assert/strict" {
import {
Assert,
AssertionError,
AssertionErrorOptions,
AssertOptions,
AssertPredicate,
AssertStrict,
deepStrictEqual,
doesNotMatch,
doesNotReject,
doesNotThrow,
fail,
ifError,
match,
notDeepStrictEqual,
notStrictEqual,
ok,
partialDeepStrictEqual,
rejects,
strictEqual,
throws,
} from "node:assert";
function strict(value: unknown, message?: string | Error): asserts value;
namespace strict {
export {
Assert,
AssertionError,
AssertionErrorOptions,
AssertOptions,
AssertPredicate,
AssertStrict,
deepStrictEqual,
deepStrictEqual as deepEqual,
doesNotMatch,
doesNotReject,
doesNotThrow,
fail,
ifError,
match,
notDeepStrictEqual,
notDeepStrictEqual as notDeepEqual,
notStrictEqual,
notStrictEqual as notEqual,
ok,
partialDeepStrictEqual,
rejects,
strict,
strictEqual,
strictEqual as equal,
throws,
};
}
export = strict;
}
declare module "assert/strict" {
import strict = require("node:assert/strict");
import { strict } from "node:assert";
export = strict;
}
declare module "node:assert/strict" {
import { strict } from "node:assert";
export = strict;
}

View File

@@ -2,8 +2,8 @@
* We strongly discourage the use of the `async_hooks` API.
* Other APIs that can cover most of its use cases include:
*
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v25.x/api/async_context.html#class-asynclocalstorage) tracks async context
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v25.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v24.x/api/async_context.html#class-asynclocalstorage) tracks async context
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v24.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
*
* The `node:async_hooks` module provides an API to track asynchronous resources.
* It can be accessed using:
@@ -12,9 +12,9 @@
* import async_hooks from 'node:async_hooks';
* ```
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/async_hooks.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/async_hooks.js)
*/
declare module "node:async_hooks" {
declare module "async_hooks" {
/**
* ```js
* import { executionAsyncId } from 'node:async_hooks';
@@ -44,7 +44,7 @@ declare module "node:async_hooks" {
* ```
*
* Promise contexts may not get precise `executionAsyncIds` by default.
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#promise-execution-tracking).
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#promise-execution-tracking).
* @since v8.1.0
* @return The `asyncId` of the current execution context. Useful to track when something calls.
*/
@@ -117,7 +117,7 @@ declare module "node:async_hooks" {
* ```
*
* Promise contexts may not get valid `triggerAsyncId`s by default. See
* the section on [promise execution tracking](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#promise-execution-tracking).
* the section on [promise execution tracking](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#promise-execution-tracking).
* @return The ID of the resource responsible for calling the callback that is currently being executed.
*/
function triggerAsyncId(): number;
@@ -618,6 +618,6 @@ declare module "node:async_hooks" {
const VERIFYREQUEST: number;
}
}
declare module "async_hooks" {
export * from "node:async_hooks";
declare module "node:async_hooks" {
export * from "async_hooks";
}

View File

@@ -1,4 +1,4 @@
declare module "node:buffer" {
declare module "buffer" {
type ImplicitArrayBuffer<T extends WithImplicitCoercion<ArrayBufferLike>> = T extends
{ valueOf(): infer V extends ArrayBufferLike } ? V : T;
global {
@@ -451,16 +451,13 @@ declare module "node:buffer" {
*/
subarray(start?: number, end?: number): Buffer<TArrayBuffer>;
}
// TODO: remove globals in future version
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedBuffer = Buffer<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type AllowSharedBuffer = Buffer<ArrayBufferLike>;
}
/** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
var SlowBuffer: {
/** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
new(size: number): Buffer<ArrayBuffer>;
prototype: Buffer;
};
}

224
node_modules/@types/node/buffer.d.ts generated vendored
View File

@@ -1,3 +1,8 @@
// If lib.dom.d.ts or lib.webworker.d.ts is loaded, then use the global types.
// Otherwise, use the types from node.
type _Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : import("buffer").Blob;
type _File = typeof globalThis extends { onmessage: any; File: any } ? {} : import("buffer").File;
/**
* `Buffer` objects are used to represent a fixed-length sequence of bytes. Many
* Node.js APIs support `Buffer`s.
@@ -41,10 +46,11 @@
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
* const buf7 = Buffer.from('tést', 'latin1');
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/buffer.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/buffer.js)
*/
declare module "node:buffer" {
import { ReadableStream } from "node:stream/web";
declare module "buffer" {
import { BinaryLike } from "node:crypto";
import { ReadableStream as WebReadableStream } from "node:stream/web";
/**
* This function returns `true` if `input` contains only valid UTF-8-encoded data,
* including the case in which `input` is empty.
@@ -53,7 +59,7 @@ declare module "node:buffer" {
* @since v19.4.0, v18.14.0
* @param input The input to validate.
*/
export function isUtf8(input: ArrayBuffer | NodeJS.TypedArray): boolean;
export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
/**
* This function returns `true` if `input` contains only valid ASCII-encoded data,
* including the case in which `input` is empty.
@@ -62,7 +68,7 @@ declare module "node:buffer" {
* @since v19.6.0, v18.15.0
* @param input The input to validate.
*/
export function isAscii(input: ArrayBuffer | NodeJS.TypedArray): boolean;
export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
export let INSPECT_MAX_BYTES: number;
export const kMaxLength: number;
export const kStringMaxLength: number;
@@ -107,11 +113,7 @@ declare module "node:buffer" {
* @param fromEnc The current encoding.
* @param toEnc To target encoding.
*/
export function transcode(
source: Uint8Array,
fromEnc: TranscodeEncoding,
toEnc: TranscodeEncoding,
): NonSharedBuffer;
export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer;
/**
* Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using
* a prior call to `URL.createObjectURL()`.
@@ -120,11 +122,115 @@ declare module "node:buffer" {
*/
export function resolveObjectURL(id: string): Blob | undefined;
export { type AllowSharedBuffer, Buffer, type NonSharedBuffer };
/** @deprecated This alias will be removed in a future version. Use the canonical `BlobPropertyBag` instead. */
// TODO: remove in future major
export interface BlobOptions extends BlobPropertyBag {}
/** @deprecated This alias will be removed in a future version. Use the canonical `FilePropertyBag` instead. */
export interface FileOptions extends FilePropertyBag {}
/**
* @experimental
*/
export interface BlobOptions {
/**
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts
* will be converted to the platform native line-ending as specified by `import { EOL } from 'node:os'`.
*/
endings?: "transparent" | "native";
/**
* The Blob content-type. The intent is for `type` to convey
* the MIME media type of the data, however no validation of the type format
* is performed.
*/
type?: string | undefined;
}
/**
* A `Blob` encapsulates immutable, raw data that can be safely shared across
* multiple worker threads.
* @since v15.7.0, v14.18.0
*/
export class Blob {
/**
* The total size of the `Blob` in bytes.
* @since v15.7.0, v14.18.0
*/
readonly size: number;
/**
* The content-type of the `Blob`.
* @since v15.7.0, v14.18.0
*/
readonly type: string;
/**
* Creates a new `Blob` object containing a concatenation of the given sources.
*
* {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into
* the 'Blob' and can therefore be safely modified after the 'Blob' is created.
*
* String sources are also copied into the `Blob`.
*/
constructor(sources: Array<ArrayBuffer | BinaryLike | Blob>, options?: BlobOptions);
/**
* Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of
* the `Blob` data.
* @since v15.7.0, v14.18.0
*/
arrayBuffer(): Promise<ArrayBuffer>;
/**
* The `blob.bytes()` method returns the byte of the `Blob` object as a `Promise<Uint8Array>`.
*
* ```js
* const blob = new Blob(['hello']);
* blob.bytes().then((bytes) => {
* console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]
* });
* ```
*/
bytes(): Promise<Uint8Array>;
/**
* Creates and returns a new `Blob` containing a subset of this `Blob` objects
* data. The original `Blob` is not altered.
* @since v15.7.0, v14.18.0
* @param start The starting index.
* @param end The ending index.
* @param type The content-type for the new `Blob`
*/
slice(start?: number, end?: number, type?: string): Blob;
/**
* Returns a promise that fulfills with the contents of the `Blob` decoded as a
* UTF-8 string.
* @since v15.7.0, v14.18.0
*/
text(): Promise<string>;
/**
* Returns a new `ReadableStream` that allows the content of the `Blob` to be read.
* @since v16.7.0
*/
stream(): WebReadableStream;
}
export interface FileOptions {
/**
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be
* converted to the platform native line-ending as specified by `import { EOL } from 'node:os'`.
*/
endings?: "native" | "transparent";
/** The File content-type. */
type?: string;
/** The last modified date of the file. `Default`: Date.now(). */
lastModified?: number;
}
/**
* A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files.
* @since v19.2.0, v18.13.0
*/
export class File extends Blob {
constructor(sources: Array<BinaryLike | Blob>, fileName: string, options?: FileOptions);
/**
* The name of the `File`.
* @since v19.2.0, v18.13.0
*/
readonly name: string;
/**
* The last modified date of the `File`.
* @since v19.2.0, v18.13.0
*/
readonly lastModified: number;
}
export import atob = globalThis.atob;
export import btoa = globalThis.btoa;
export type WithImplicitCoercion<T> =
| T
| { valueOf(): T }
@@ -224,7 +330,7 @@ declare module "node:buffer" {
* @return The number of bytes contained within `string`.
*/
byteLength(
string: string | NodeJS.ArrayBufferView | ArrayBufferLike,
string: string | Buffer | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
encoding?: BufferEncoding,
): number;
/**
@@ -1769,42 +1875,56 @@ declare module "node:buffer" {
includes(value: string | number | Buffer, encoding: BufferEncoding): boolean;
}
var Buffer: BufferConstructor;
/**
* Decodes a string of Base64-encoded data into bytes, and encodes those bytes
* into a string using Latin-1 (ISO-8859-1).
*
* The `data` may be any JavaScript-value that can be coerced into a string.
*
* **This function is only provided for compatibility with legacy web platform APIs**
* **and should never be used in new code, because they use strings to represent**
* **binary data and predate the introduction of typed arrays in JavaScript.**
* **For code running using Node.js APIs, converting between base64-encoded strings**
* **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.**
* @since v15.13.0, v14.17.0
* @legacy Use `Buffer.from(data, 'base64')` instead.
* @param data The Base64-encoded input string.
*/
function atob(data: string): string;
/**
* Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes
* into a string using Base64.
*
* The `data` may be any JavaScript-value that can be coerced into a string.
*
* **This function is only provided for compatibility with legacy web platform APIs**
* **and should never be used in new code, because they use strings to represent**
* **binary data and predate the introduction of typed arrays in JavaScript.**
* **For code running using Node.js APIs, converting between base64-encoded strings**
* **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.**
* @since v15.13.0, v14.17.0
* @legacy Use `buf.toString('base64')` instead.
* @param data An ASCII (Latin1) string.
*/
function btoa(data: string): string;
interface Blob extends _Blob {}
/**
* `Blob` class is a global reference for `import { Blob } from 'node:buffer'`
* https://nodejs.org/api/buffer.html#class-blob
* @since v18.0.0
*/
var Blob: typeof globalThis extends { onmessage: any; Blob: infer T } ? T
: typeof import("buffer").Blob;
interface File extends _File {}
/**
* `File` class is a global reference for `import { File } from 'node:buffer'`
* https://nodejs.org/api/buffer.html#class-file
* @since v20.0.0
*/
var File: typeof globalThis extends { onmessage: any; File: infer T } ? T
: typeof import("buffer").File;
}
// #region web types
export type BlobPart = NodeJS.BufferSource | Blob | string;
export interface BlobPropertyBag {
endings?: "native" | "transparent";
type?: string;
}
export interface FilePropertyBag extends BlobPropertyBag {
lastModified?: number;
}
export interface Blob {
readonly size: number;
readonly type: string;
arrayBuffer(): Promise<ArrayBuffer>;
bytes(): Promise<NodeJS.NonSharedUint8Array>;
slice(start?: number, end?: number, contentType?: string): Blob;
stream(): ReadableStream<NodeJS.NonSharedUint8Array>;
text(): Promise<string>;
}
export var Blob: {
prototype: Blob;
new(blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
};
export interface File extends Blob {
readonly lastModified: number;
readonly name: string;
readonly webkitRelativePath: string;
}
export var File: {
prototype: File;
new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
};
export import atob = globalThis.atob;
export import btoa = globalThis.btoa;
// #endregion
}
declare module "buffer" {
export * from "node:buffer";
declare module "node:buffer" {
export * from "buffer";
}

View File

@@ -5,7 +5,6 @@
*
* ```js
* import { spawn } from 'node:child_process';
* import { once } from 'node:events';
* const ls = spawn('ls', ['-lh', '/usr']);
*
* ls.stdout.on('data', (data) => {
@@ -16,8 +15,9 @@
* console.error(`stderr: ${data}`);
* });
*
* const [code] = await once(ls, 'close');
* console.log(`child process exited with code ${code}`);
* ls.on('close', (code) => {
* console.log(`child process exited with code ${code}`);
* });
* ```
*
* By default, pipes for `stdin`, `stdout`, and `stderr` are established between
@@ -63,25 +63,16 @@
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
* the synchronous methods can have significant impact on performance due to
* stalling the event loop while spawned processes complete.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/child_process.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/child_process.js)
*/
declare module "node:child_process" {
import { NonSharedBuffer } from "node:buffer";
declare module "child_process" {
import { Abortable, EventEmitter } from "node:events";
import * as dgram from "node:dgram";
import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
import * as net from "node:net";
import { Readable, Stream, Writable } from "node:stream";
import { Pipe, Readable, Stream, Writable } from "node:stream";
import { URL } from "node:url";
type Serializable = string | object | number | boolean | bigint;
type SendHandle = net.Socket | net.Server | dgram.Socket | undefined;
interface ChildProcessEventMap {
"close": [code: number | null, signal: NodeJS.Signals | null];
"disconnect": [];
"error": [err: Error];
"exit": [code: number | null, signal: NodeJS.Signals | null];
"message": [message: Serializable, sendHandle: SendHandle];
"spawn": [];
}
/**
* Instances of the `ChildProcess` represent spawned child processes.
*
@@ -90,7 +81,7 @@ declare module "node:child_process" {
* instances of `ChildProcess`.
* @since v2.2.0
*/
class ChildProcess implements EventEmitter {
class ChildProcess extends EventEmitter {
/**
* A `Writable Stream` that represents the child process's `stdin`.
*
@@ -148,7 +139,7 @@ declare module "node:child_process" {
* no IPC channel exists, this property is `undefined`.
* @since v7.1.0
*/
readonly channel?: Control | null;
readonly channel?: Pipe | null | undefined;
/**
* A sparse array of pipes to the child process, corresponding with positions in
* the `stdio` option passed to {@link spawn} that have been set
@@ -466,7 +457,7 @@ declare module "node:child_process" {
* as the connection may have been closed during the time it takes to send the
* connection to the child.
* @since v0.5.9
* @param sendHandle `undefined`, or a [`net.Socket`](https://nodejs.org/docs/latest-v25.x/api/net.html#class-netsocket), [`net.Server`](https://nodejs.org/docs/latest-v25.x/api/net.html#class-netserver), or [`dgram.Socket`](https://nodejs.org/docs/latest-v25.x/api/dgram.html#class-dgramsocket) object.
* @param sendHandle `undefined`, or a [`net.Socket`](https://nodejs.org/docs/latest-v24.x/api/net.html#class-netsocket), [`net.Server`](https://nodejs.org/docs/latest-v24.x/api/net.html#class-netserver), or [`dgram.Socket`](https://nodejs.org/docs/latest-v24.x/api/dgram.html#class-dgramsocket) object.
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
*/
send(message: Serializable, callback?: (error: Error | null) => void): boolean;
@@ -532,8 +523,64 @@ declare module "node:child_process" {
* @since v0.7.10
*/
ref(): void;
/**
* events.EventEmitter
* 1. close
* 2. disconnect
* 3. error
* 4. exit
* 5. message
* 6. spawn
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
addListener(event: "disconnect", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
addListener(event: "spawn", listener: () => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean;
emit(event: "disconnect"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
emit(event: "spawn", listener: () => void): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
on(event: "disconnect", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
on(event: "spawn", listener: () => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
once(event: "disconnect", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
once(event: "spawn", listener: () => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
prependListener(event: "disconnect", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
prependListener(event: "spawn", listener: () => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(
event: "close",
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
): this;
prependOnceListener(event: "disconnect", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(
event: "exit",
listener: (code: number | null, signal: NodeJS.Signals | null) => void,
): this;
prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
prependOnceListener(event: "spawn", listener: () => void): this;
}
interface ChildProcess extends InternalEventEmitter<ChildProcessEventMap> {}
// return this object when stdio option is undefined or not specified
interface ChildProcessWithoutNullStreams extends ChildProcess {
stdin: Writable;
@@ -565,10 +612,6 @@ declare module "node:child_process" {
Readable | Writable | null | undefined, // extra, no modification
];
}
interface Control extends EventEmitter {
ref(): void;
unref(): void;
}
interface MessageOptions {
keepOpen?: boolean | undefined;
}
@@ -671,7 +714,6 @@ declare module "node:child_process" {
*
* ```js
* import { spawn } from 'node:child_process';
* import { once } from 'node:events';
* const ls = spawn('ls', ['-lh', '/usr']);
*
* ls.stdout.on('data', (data) => {
@@ -682,8 +724,9 @@ declare module "node:child_process" {
* console.error(`stderr: ${data}`);
* });
*
* const [code] = await once(ls, 'close');
* console.log(`child process exited with code ${code}`);
* ls.on('close', (code) => {
* console.log(`child process exited with code ${code}`);
* });
* ```
*
* Example: A very elaborate way to run `ps ax | grep ssh`
@@ -851,12 +894,11 @@ declare module "node:child_process" {
interface ExecOptionsWithBufferEncoding extends ExecOptions {
encoding: "buffer" | null; // specify `null`.
}
// TODO: Just Plain Wrong™ (see also nodejs/node#57392)
interface ExecException extends Error {
cmd?: string;
killed?: boolean;
code?: number;
signal?: NodeJS.Signals;
cmd?: string | undefined;
killed?: boolean | undefined;
code?: number | undefined;
signal?: NodeJS.Signals | undefined;
stdout?: string;
stderr?: string;
}
@@ -954,7 +996,7 @@ declare module "node:child_process" {
function exec(
command: string,
options: ExecOptionsWithBufferEncoding,
callback?: (error: ExecException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void,
callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void,
): ChildProcess;
// `options` with well-known or absent `encoding` means stdout/stderr are definitely `string`.
function exec(
@@ -966,11 +1008,7 @@ declare module "node:child_process" {
function exec(
command: string,
options: ExecOptions | undefined | null,
callback?: (
error: ExecException | null,
stdout: string | NonSharedBuffer,
stderr: string | NonSharedBuffer,
) => void,
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
): ChildProcess;
interface PromiseWithChild<T> extends Promise<T> {
child: ChildProcess;
@@ -984,8 +1022,8 @@ declare module "node:child_process" {
command: string,
options: ExecOptionsWithBufferEncoding,
): PromiseWithChild<{
stdout: NonSharedBuffer;
stderr: NonSharedBuffer;
stdout: Buffer;
stderr: Buffer;
}>;
function __promisify__(
command: string,
@@ -998,8 +1036,8 @@ declare module "node:child_process" {
command: string,
options: ExecOptions | undefined | null,
): PromiseWithChild<{
stdout: string | NonSharedBuffer;
stderr: string | NonSharedBuffer;
stdout: string | Buffer;
stderr: string | Buffer;
}>;
}
interface ExecFileOptions extends CommonOptions, Abortable {
@@ -1018,11 +1056,10 @@ declare module "node:child_process" {
}
/** @deprecated Use `ExecFileOptions` instead. */
interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {}
// TODO: execFile exceptions can take many forms... this accurately describes none of them
type ExecFileException =
& Omit<ExecException, "code">
& Omit<NodeJS.ErrnoException, "code">
& { code?: string | number | null };
& { code?: string | number | undefined | null };
/**
* The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified
* executable `file` is spawned directly as a new process making it slightly more
@@ -1101,13 +1138,13 @@ declare module "node:child_process" {
function execFile(
file: string,
options: ExecFileOptionsWithBufferEncoding,
callback?: (error: ExecFileException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void,
callback?: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
): ChildProcess;
function execFile(
file: string,
args: readonly string[] | undefined | null,
options: ExecFileOptionsWithBufferEncoding,
callback?: (error: ExecFileException | null, stdout: NonSharedBuffer, stderr: NonSharedBuffer) => void,
callback?: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
): ChildProcess;
// `options` with well-known or absent `encoding` means stdout/stderr are definitely `string`.
function execFile(
@@ -1126,11 +1163,7 @@ declare module "node:child_process" {
file: string,
options: ExecFileOptions | undefined | null,
callback:
| ((
error: ExecFileException | null,
stdout: string | NonSharedBuffer,
stderr: string | NonSharedBuffer,
) => void)
| ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
| undefined
| null,
): ChildProcess;
@@ -1139,11 +1172,7 @@ declare module "node:child_process" {
args: readonly string[] | undefined | null,
options: ExecFileOptions | undefined | null,
callback:
| ((
error: ExecFileException | null,
stdout: string | NonSharedBuffer,
stderr: string | NonSharedBuffer,
) => void)
| ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
| undefined
| null,
): ChildProcess;
@@ -1163,16 +1192,16 @@ declare module "node:child_process" {
file: string,
options: ExecFileOptionsWithBufferEncoding,
): PromiseWithChild<{
stdout: NonSharedBuffer;
stderr: NonSharedBuffer;
stdout: Buffer;
stderr: Buffer;
}>;
function __promisify__(
file: string,
args: readonly string[] | undefined | null,
options: ExecFileOptionsWithBufferEncoding,
): PromiseWithChild<{
stdout: NonSharedBuffer;
stderr: NonSharedBuffer;
stdout: Buffer;
stderr: Buffer;
}>;
function __promisify__(
file: string,
@@ -1193,16 +1222,16 @@ declare module "node:child_process" {
file: string,
options: ExecFileOptions | undefined | null,
): PromiseWithChild<{
stdout: string | NonSharedBuffer;
stderr: string | NonSharedBuffer;
stdout: string | Buffer;
stderr: string | Buffer;
}>;
function __promisify__(
file: string,
args: readonly string[] | undefined | null,
options: ExecFileOptions | undefined | null,
): PromiseWithChild<{
stdout: string | NonSharedBuffer;
stderr: string | NonSharedBuffer;
stdout: string | Buffer;
stderr: string | Buffer;
}>;
}
interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable {
@@ -1291,7 +1320,7 @@ declare module "node:child_process" {
stderr: T;
status: number | null;
signal: NodeJS.Signals | null;
error?: Error;
error?: Error | undefined;
}
/**
* The `child_process.spawnSync()` method is generally identical to {@link spawn} with the exception that the function will not return
@@ -1308,11 +1337,11 @@ declare module "node:child_process" {
* @param command The command to run.
* @param args List of string arguments.
*/
function spawnSync(command: string): SpawnSyncReturns<NonSharedBuffer>;
function spawnSync(command: string): SpawnSyncReturns<Buffer>;
function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<NonSharedBuffer>;
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<string | NonSharedBuffer>;
function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns<NonSharedBuffer>;
function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns<Buffer>;
function spawnSync(
command: string,
args: readonly string[],
@@ -1322,12 +1351,12 @@ declare module "node:child_process" {
command: string,
args: readonly string[],
options: SpawnSyncOptionsWithBufferEncoding,
): SpawnSyncReturns<NonSharedBuffer>;
): SpawnSyncReturns<Buffer>;
function spawnSync(
command: string,
args?: readonly string[],
options?: SpawnSyncOptions,
): SpawnSyncReturns<string | NonSharedBuffer>;
): SpawnSyncReturns<string | Buffer>;
interface CommonExecOptions extends CommonOptions {
input?: string | NodeJS.ArrayBufferView | undefined;
/**
@@ -1369,10 +1398,10 @@ declare module "node:child_process" {
* @param command The command to run.
* @return The stdout from the command.
*/
function execSync(command: string): NonSharedBuffer;
function execSync(command: string): Buffer;
function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string;
function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): NonSharedBuffer;
function execSync(command: string, options?: ExecSyncOptions): string | NonSharedBuffer;
function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): Buffer;
function execSync(command: string, options?: ExecSyncOptions): string | Buffer;
interface ExecFileSyncOptions extends CommonExecOptions {
shell?: boolean | string | undefined;
}
@@ -1380,7 +1409,7 @@ declare module "node:child_process" {
encoding: BufferEncoding;
}
interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
encoding?: "buffer" | null | undefined; // specify `null`.
encoding?: "buffer" | null; // specify `null`.
}
/**
* The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not
@@ -1402,11 +1431,11 @@ declare module "node:child_process" {
* @param args List of string arguments.
* @return The stdout from the command.
*/
function execFileSync(file: string): NonSharedBuffer;
function execFileSync(file: string): Buffer;
function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string;
function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): NonSharedBuffer;
function execFileSync(file: string, options?: ExecFileSyncOptions): string | NonSharedBuffer;
function execFileSync(file: string, args: readonly string[]): NonSharedBuffer;
function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer;
function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer;
function execFileSync(file: string, args: readonly string[]): Buffer;
function execFileSync(
file: string,
args: readonly string[],
@@ -1416,13 +1445,9 @@ declare module "node:child_process" {
file: string,
args: readonly string[],
options: ExecFileSyncOptionsWithBufferEncoding,
): NonSharedBuffer;
function execFileSync(
file: string,
args?: readonly string[],
options?: ExecFileSyncOptions,
): string | NonSharedBuffer;
): Buffer;
function execFileSync(file: string, args?: readonly string[], options?: ExecFileSyncOptions): string | Buffer;
}
declare module "child_process" {
export * from "node:child_process";
declare module "node:child_process" {
export * from "child_process";
}

573
node_modules/@types/node/cluster.d.ts generated vendored
View File

@@ -1,7 +1,7 @@
/**
* Clusters of Node.js processes can be used to run multiple instances of Node.js
* that can distribute workloads among their application threads. When process isolation
* is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html)
* is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html)
* module instead, which allows running multiple application threads within a single Node.js instance.
*
* The cluster module allows easy creation of child processes that all share
@@ -50,13 +50,90 @@
* ```
*
* On Windows, it is not yet possible to set up a named pipe server in a worker.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/cluster.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/cluster.js)
*/
declare module "node:cluster" {
import * as child_process from "node:child_process";
import { EventEmitter, InternalEventEmitter } from "node:events";
class Worker implements EventEmitter {
constructor(options?: cluster.WorkerOptions);
declare module "cluster" {
import * as child from "node:child_process";
import EventEmitter = require("node:events");
import * as net from "node:net";
type SerializationType = "json" | "advanced";
export interface ClusterSettings {
/**
* List of string arguments passed to the Node.js executable.
* @default process.execArgv
*/
execArgv?: string[] | undefined;
/**
* File path to worker file.
* @default process.argv[1]
*/
exec?: string | undefined;
/**
* String arguments passed to worker.
* @default process.argv.slice(2)
*/
args?: string[] | undefined;
/**
* Whether or not to send output to parent's stdio.
* @default false
*/
silent?: boolean | undefined;
/**
* Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must
* contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child_prcess.spawn()`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#child_processspawncommand-args-options)'s
* [`stdio`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#optionsstdio).
*/
stdio?: any[] | undefined;
/**
* Sets the user identity of the process. (See [`setuid(2)`](https://man7.org/linux/man-pages/man2/setuid.2.html).)
*/
uid?: number | undefined;
/**
* Sets the group identity of the process. (See [`setgid(2)`](https://man7.org/linux/man-pages/man2/setgid.2.html).)
*/
gid?: number | undefined;
/**
* Sets inspector port of worker. This can be a number, or a function that takes no arguments and returns a number.
* By default each worker gets its own port, incremented from the primary's `process.debugPort`.
*/
inspectPort?: number | (() => number) | undefined;
/**
* Specify the kind of serialization used for sending messages between processes. Possible values are `'json'` and `'advanced'`.
* See [Advanced serialization for `child_process`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#advanced-serialization) for more details.
* @default false
*/
serialization?: SerializationType | undefined;
/**
* Current working directory of the worker process.
* @default undefined (inherits from parent process)
*/
cwd?: string | undefined;
/**
* Hide the forked processes console window that would normally be created on Windows systems.
* @default false
*/
windowsHide?: boolean | undefined;
}
export interface Address {
address: string;
port: number;
/**
* The `addressType` is one of:
*
* * `4` (TCPv4)
* * `6` (TCPv6)
* * `-1` (Unix domain socket)
* * `'udp4'` or `'udp6'` (UDPv4 or UDPv6)
*/
addressType: 4 | 6 | -1 | "udp4" | "udp6";
}
/**
* A `Worker` object contains all public information and method about a worker.
* In the primary it can be obtained using `cluster.workers`. In a worker
* it can be obtained using `cluster.worker`.
* @since v0.7.0
*/
export class Worker extends EventEmitter {
/**
* Each new worker is given its own unique id, this id is stored in the `id`.
*
@@ -65,21 +142,21 @@ declare module "node:cluster" {
*/
id: number;
/**
* All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v25.x/api/child_process.html#child_processforkmodulepath-args-options), the returned object
* All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#child_processforkmodulepath-args-options), the returned object
* from this function is stored as `.process`. In a worker, the global `process` is stored.
*
* See: [Child Process module](https://nodejs.org/docs/latest-v25.x/api/child_process.html#child_processforkmodulepath-args-options).
* See: [Child Process module](https://nodejs.org/docs/latest-v24.x/api/child_process.html#child_processforkmodulepath-args-options).
*
* Workers will call `process.exit(0)` if the `'disconnect'` event occurs
* on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
* accidental disconnection.
* @since v0.7.0
*/
process: child_process.ChildProcess;
process: child.ChildProcess;
/**
* Send a message to a worker or primary, optionally with a handle.
*
* In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-v25.x/api/child_process.html#subprocesssendmessage-sendhandle-options-callback).
* In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-v24.x/api/child_process.html#subprocesssendmessage-sendhandle-options-callback).
*
* In a worker, this sends a message to the primary. It is identical to `process.send()`.
*
@@ -99,16 +176,16 @@ declare module "node:cluster" {
* @since v0.7.0
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles.
*/
send(message: child_process.Serializable, callback?: (error: Error | null) => void): boolean;
send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
send(
message: child_process.Serializable,
sendHandle: child_process.SendHandle,
message: child.Serializable,
sendHandle: child.SendHandle,
callback?: (error: Error | null) => void,
): boolean;
send(
message: child_process.Serializable,
sendHandle: child_process.SendHandle,
options?: child_process.MessageOptions,
message: child.Serializable,
sendHandle: child.SendHandle,
options?: child.MessageOptions,
callback?: (error: Error | null) => void,
): boolean;
/**
@@ -121,7 +198,7 @@ declare module "node:cluster" {
* This method is aliased as `worker.destroy()` for backwards compatibility.
*
* In a worker, `process.kill()` exists, but it is not this function;
* it is [`kill()`](https://nodejs.org/docs/latest-v25.x/api/process.html#processkillpid-signal).
* it is [`kill()`](https://nodejs.org/docs/latest-v24.x/api/process.html#processkillpid-signal).
* @since v0.9.12
* @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
*/
@@ -258,229 +335,245 @@ declare module "node:cluster" {
* @since v6.0.0
*/
exitedAfterDisconnect: boolean;
/**
* events.EventEmitter
* 1. disconnect
* 2. error
* 3. exit
* 4. listening
* 5. message
* 6. online
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "disconnect", listener: () => void): this;
addListener(event: "error", listener: (error: Error) => void): this;
addListener(event: "exit", listener: (code: number, signal: string) => void): this;
addListener(event: "listening", listener: (address: Address) => void): this;
addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
addListener(event: "online", listener: () => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "disconnect"): boolean;
emit(event: "error", error: Error): boolean;
emit(event: "exit", code: number, signal: string): boolean;
emit(event: "listening", address: Address): boolean;
emit(event: "message", message: any, handle: net.Socket | net.Server): boolean;
emit(event: "online"): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "disconnect", listener: () => void): this;
on(event: "error", listener: (error: Error) => void): this;
on(event: "exit", listener: (code: number, signal: string) => void): this;
on(event: "listening", listener: (address: Address) => void): this;
on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
on(event: "online", listener: () => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "disconnect", listener: () => void): this;
once(event: "error", listener: (error: Error) => void): this;
once(event: "exit", listener: (code: number, signal: string) => void): this;
once(event: "listening", listener: (address: Address) => void): this;
once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
once(event: "online", listener: () => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "disconnect", listener: () => void): this;
prependListener(event: "error", listener: (error: Error) => void): this;
prependListener(event: "exit", listener: (code: number, signal: string) => void): this;
prependListener(event: "listening", listener: (address: Address) => void): this;
prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
prependListener(event: "online", listener: () => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "disconnect", listener: () => void): this;
prependOnceListener(event: "error", listener: (error: Error) => void): this;
prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this;
prependOnceListener(event: "listening", listener: (address: Address) => void): this;
prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
prependOnceListener(event: "online", listener: () => void): this;
}
interface Worker extends InternalEventEmitter<cluster.WorkerEventMap> {}
type _Worker = Worker;
namespace cluster {
interface Worker extends _Worker {}
interface WorkerOptions {
id?: number | undefined;
process?: child_process.ChildProcess | undefined;
state?: string | undefined;
}
interface WorkerEventMap {
"disconnect": [];
"error": [error: Error];
"exit": [code: number, signal: string];
"listening": [address: Address];
"message": [message: any, handle: child_process.SendHandle];
"online": [];
}
interface ClusterSettings {
/**
* List of string arguments passed to the Node.js executable.
* @default process.execArgv
*/
execArgv?: string[] | undefined;
/**
* File path to worker file.
* @default process.argv[1]
*/
exec?: string | undefined;
/**
* String arguments passed to worker.
* @default process.argv.slice(2)
*/
args?: readonly string[] | undefined;
/**
* Whether or not to send output to parent's stdio.
* @default false
*/
silent?: boolean | undefined;
/**
* Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must
* contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child_prcess.spawn()`](https://nodejs.org/docs/latest-v25.x/api/child_process.html#child_processspawncommand-args-options)'s
* [`stdio`](https://nodejs.org/docs/latest-v25.x/api/child_process.html#optionsstdio).
*/
stdio?: any[] | undefined;
/**
* Sets the user identity of the process. (See [`setuid(2)`](https://man7.org/linux/man-pages/man2/setuid.2.html).)
*/
uid?: number | undefined;
/**
* Sets the group identity of the process. (See [`setgid(2)`](https://man7.org/linux/man-pages/man2/setgid.2.html).)
*/
gid?: number | undefined;
/**
* Sets inspector port of worker. This can be a number, or a function that takes no arguments and returns a number.
* By default each worker gets its own port, incremented from the primary's `process.debugPort`.
*/
inspectPort?: number | (() => number) | undefined;
/**
* Specify the kind of serialization used for sending messages between processes. Possible values are `'json'` and `'advanced'`.
* See [Advanced serialization for `child_process`](https://nodejs.org/docs/latest-v25.x/api/child_process.html#advanced-serialization) for more details.
* @default false
*/
serialization?: "json" | "advanced" | undefined;
/**
* Current working directory of the worker process.
* @default undefined (inherits from parent process)
*/
cwd?: string | undefined;
/**
* Hide the forked processes console window that would normally be created on Windows systems.
* @default false
*/
windowsHide?: boolean | undefined;
}
interface Address {
address: string;
port: number;
/**
* The `addressType` is one of:
*
* * `4` (TCPv4)
* * `6` (TCPv6)
* * `-1` (Unix domain socket)
* * `'udp4'` or `'udp6'` (UDPv4 or UDPv6)
*/
addressType: 4 | 6 | -1 | "udp4" | "udp6";
}
interface ClusterEventMap {
"disconnect": [worker: Worker];
"exit": [worker: Worker, code: number, signal: string];
"fork": [worker: Worker];
"listening": [worker: Worker, address: Address];
"message": [worker: Worker, message: any, handle: child_process.SendHandle];
"online": [worker: Worker];
"setup": [settings: ClusterSettings];
}
interface Cluster extends InternalEventEmitter<ClusterEventMap> {
/**
* A `Worker` object contains all public information and method about a worker.
* In the primary it can be obtained using `cluster.workers`. In a worker
* it can be obtained using `cluster.worker`.
* @since v0.7.0
*/
Worker: typeof Worker;
disconnect(callback?: () => void): void;
/**
* Spawn a new worker process.
*
* This can only be called from the primary process.
* @param env Key/value pairs to add to worker process environment.
* @since v0.6.0
*/
fork(env?: any): Worker;
/** @deprecated since v16.0.0 - use isPrimary. */
readonly isMaster: boolean;
/**
* True if the process is a primary. This is determined by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID`
* is undefined, then `isPrimary` is `true`.
* @since v16.0.0
*/
readonly isPrimary: boolean;
/**
* True if the process is not a primary (it is the negation of `cluster.isPrimary`).
* @since v0.6.0
*/
readonly isWorker: boolean;
/**
* The scheduling policy, either `cluster.SCHED_RR` for round-robin or `cluster.SCHED_NONE` to leave it to the operating system. This is a
* global setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v25.x/api/cluster.html#clustersetupprimarysettings)
* is called, whichever comes first.
*
* `SCHED_RR` is the default on all operating systems except Windows. Windows will change to `SCHED_RR` once libuv is able to effectively distribute
* IOCP handles without incurring a large performance hit.
*
* `cluster.schedulingPolicy` can also be set through the `NODE_CLUSTER_SCHED_POLICY` environment variable. Valid values are `'rr'` and `'none'`.
* @since v0.11.2
*/
schedulingPolicy: number;
/**
* After calling [`.setupPrimary()`](https://nodejs.org/docs/latest-v25.x/api/cluster.html#clustersetupprimarysettings)
* (or [`.fork()`](https://nodejs.org/docs/latest-v25.x/api/cluster.html#clusterforkenv)) this settings object will contain
* the settings, including the default values.
*
* This object is not intended to be changed or set manually.
* @since v0.7.1
*/
readonly settings: ClusterSettings;
/** @deprecated since v16.0.0 - use [`.setupPrimary()`](https://nodejs.org/docs/latest-v25.x/api/cluster.html#clustersetupprimarysettings) instead. */
setupMaster(settings?: ClusterSettings): void;
/**
* `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`.
*
* Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v25.x/api/cluster.html#clusterforkenv)
* and have no effect on workers that are already running.
*
* The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to
* [`.fork()`](https://nodejs.org/docs/latest-v25.x/api/cluster.html#clusterforkenv).
*
* The defaults above apply to the first call only; the defaults for later calls are the current values at the time of
* `cluster.setupPrimary()` is called.
*
* ```js
* import cluster from 'node:cluster';
*
* cluster.setupPrimary({
* exec: 'worker.js',
* args: ['--use', 'https'],
* silent: true,
* });
* cluster.fork(); // https worker
* cluster.setupPrimary({
* exec: 'worker.js',
* args: ['--use', 'http'],
* });
* cluster.fork(); // http worker
* ```
*
* This can only be called from the primary process.
* @since v16.0.0
*/
setupPrimary(settings?: ClusterSettings): void;
/**
* A reference to the current worker object. Not available in the primary process.
*
* ```js
* import cluster from 'node:cluster';
*
* if (cluster.isPrimary) {
* console.log('I am primary');
* cluster.fork();
* cluster.fork();
* } else if (cluster.isWorker) {
* console.log(`I am worker #${cluster.worker.id}`);
* }
* ```
* @since v0.7.0
*/
readonly worker?: Worker;
/**
* A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process.
*
* A worker is removed from `cluster.workers` after the worker has disconnected _and_ exited. The order between these two events cannot be determined in advance. However, it
* is guaranteed that the removal from the `cluster.workers` list happens before the last `'disconnect'` or `'exit'` event is emitted.
*
* ```js
* import cluster from 'node:cluster';
*
* for (const worker of Object.values(cluster.workers)) {
* worker.send('big announcement to all workers');
* }
* ```
* @since v0.7.0
*/
readonly workers?: NodeJS.Dict<Worker>;
readonly SCHED_NONE: number;
readonly SCHED_RR: number;
}
export interface Cluster extends EventEmitter {
disconnect(callback?: () => void): void;
/**
* Spawn a new worker process.
*
* This can only be called from the primary process.
* @param env Key/value pairs to add to worker process environment.
* @since v0.6.0
*/
fork(env?: any): Worker;
/** @deprecated since v16.0.0 - use isPrimary. */
readonly isMaster: boolean;
/**
* True if the process is a primary. This is determined by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID`
* is undefined, then `isPrimary` is `true`.
* @since v16.0.0
*/
readonly isPrimary: boolean;
/**
* True if the process is not a primary (it is the negation of `cluster.isPrimary`).
* @since v0.6.0
*/
readonly isWorker: boolean;
/**
* The scheduling policy, either `cluster.SCHED_RR` for round-robin or `cluster.SCHED_NONE` to leave it to the operating system. This is a
* global setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clustersetupprimarysettings)
* is called, whichever comes first.
*
* `SCHED_RR` is the default on all operating systems except Windows. Windows will change to `SCHED_RR` once libuv is able to effectively distribute
* IOCP handles without incurring a large performance hit.
*
* `cluster.schedulingPolicy` can also be set through the `NODE_CLUSTER_SCHED_POLICY` environment variable. Valid values are `'rr'` and `'none'`.
* @since v0.11.2
*/
schedulingPolicy: number;
/**
* After calling [`.setupPrimary()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clustersetupprimarysettings)
* (or [`.fork()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clusterforkenv)) this settings object will contain
* the settings, including the default values.
*
* This object is not intended to be changed or set manually.
* @since v0.7.1
*/
readonly settings: ClusterSettings;
/** @deprecated since v16.0.0 - use [`.setupPrimary()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clustersetupprimarysettings) instead. */
setupMaster(settings?: ClusterSettings): void;
/**
* `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`.
*
* Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clusterforkenv)
* and have no effect on workers that are already running.
*
* The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to
* [`.fork()`](https://nodejs.org/docs/latest-v24.x/api/cluster.html#clusterforkenv).
*
* The defaults above apply to the first call only; the defaults for later calls are the current values at the time of
* `cluster.setupPrimary()` is called.
*
* ```js
* import cluster from 'node:cluster';
*
* cluster.setupPrimary({
* exec: 'worker.js',
* args: ['--use', 'https'],
* silent: true,
* });
* cluster.fork(); // https worker
* cluster.setupPrimary({
* exec: 'worker.js',
* args: ['--use', 'http'],
* });
* cluster.fork(); // http worker
* ```
*
* This can only be called from the primary process.
* @since v16.0.0
*/
setupPrimary(settings?: ClusterSettings): void;
/**
* A reference to the current worker object. Not available in the primary process.
*
* ```js
* import cluster from 'node:cluster';
*
* if (cluster.isPrimary) {
* console.log('I am primary');
* cluster.fork();
* cluster.fork();
* } else if (cluster.isWorker) {
* console.log(`I am worker #${cluster.worker.id}`);
* }
* ```
* @since v0.7.0
*/
readonly worker?: Worker | undefined;
/**
* A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process.
*
* A worker is removed from `cluster.workers` after the worker has disconnected _and_ exited. The order between these two events cannot be determined in advance. However, it
* is guaranteed that the removal from the `cluster.workers` list happens before the last `'disconnect'` or `'exit'` event is emitted.
*
* ```js
* import cluster from 'node:cluster';
*
* for (const worker of Object.values(cluster.workers)) {
* worker.send('big announcement to all workers');
* }
* ```
* @since v0.7.0
*/
readonly workers?: NodeJS.Dict<Worker> | undefined;
readonly SCHED_NONE: number;
readonly SCHED_RR: number;
/**
* events.EventEmitter
* 1. disconnect
* 2. exit
* 3. fork
* 4. listening
* 5. message
* 6. online
* 7. setup
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "disconnect", listener: (worker: Worker) => void): this;
addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
addListener(event: "fork", listener: (worker: Worker) => void): this;
addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
addListener(
event: "message",
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
): this; // the handle is a net.Socket or net.Server object, or undefined.
addListener(event: "online", listener: (worker: Worker) => void): this;
addListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "disconnect", worker: Worker): boolean;
emit(event: "exit", worker: Worker, code: number, signal: string): boolean;
emit(event: "fork", worker: Worker): boolean;
emit(event: "listening", worker: Worker, address: Address): boolean;
emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
emit(event: "online", worker: Worker): boolean;
emit(event: "setup", settings: ClusterSettings): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "disconnect", listener: (worker: Worker) => void): this;
on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
on(event: "fork", listener: (worker: Worker) => void): this;
on(event: "listening", listener: (worker: Worker, address: Address) => void): this;
on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
on(event: "online", listener: (worker: Worker) => void): this;
on(event: "setup", listener: (settings: ClusterSettings) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "disconnect", listener: (worker: Worker) => void): this;
once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
once(event: "fork", listener: (worker: Worker) => void): this;
once(event: "listening", listener: (worker: Worker, address: Address) => void): this;
once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
once(event: "online", listener: (worker: Worker) => void): this;
once(event: "setup", listener: (settings: ClusterSettings) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "disconnect", listener: (worker: Worker) => void): this;
prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
prependListener(event: "fork", listener: (worker: Worker) => void): this;
prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
// the handle is a net.Socket or net.Server object, or undefined.
prependListener(
event: "message",
listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void,
): this;
prependListener(event: "online", listener: (worker: Worker) => void): this;
prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this;
prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
prependOnceListener(event: "fork", listener: (worker: Worker) => void): this;
prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
// the handle is a net.Socket or net.Server object, or undefined.
prependOnceListener(
event: "message",
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
): this;
prependOnceListener(event: "online", listener: (worker: Worker) => void): this;
prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
}
var cluster: cluster.Cluster;
export = cluster;
const cluster: Cluster;
export default cluster;
}
declare module "cluster" {
import cluster = require("node:cluster");
export = cluster;
declare module "node:cluster" {
export * from "cluster";
export { default as default } from "cluster";
}

409
node_modules/@types/node/console.d.ts generated vendored
View File

@@ -5,12 +5,12 @@
* The module exports two specific components:
*
* * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream.
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v25.x/api/process.html#processstdout) and
* [`process.stderr`](https://nodejs.org/docs/latest-v25.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) and
* [`process.stderr`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
*
* _**Warning**_: The global console object's methods are neither consistently
* synchronous like the browser APIs they resemble, nor are they consistently
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v25.x/api/process.html#a-note-on-process-io) for
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v24.x/api/process.html#a-note-on-process-io) for
* more information.
*
* Example using the global `console`:
@@ -54,63 +54,276 @@
* myConsole.warn(`Danger ${name}! Danger!`);
* // Prints: Danger Will Robinson! Danger!, to err
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/console.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/console.js)
*/
declare module "console" {
import console = require("node:console");
export = console;
}
declare module "node:console" {
import { InspectOptions } from "node:util";
namespace console {
interface ConsoleOptions {
stdout: NodeJS.WritableStream;
stderr?: NodeJS.WritableStream | undefined;
/**
* Ignore errors when writing to the underlying streams.
* @default true
*/
ignoreErrors?: boolean | undefined;
/**
* Set color support for this `Console` instance. Setting to true enables coloring while inspecting
* values. Setting to `false` disables coloring while inspecting values. Setting to `'auto'` makes color
* support depend on the value of the `isTTY` property and the value returned by `getColorDepth()` on the
* respective stream. This option can not be used, if `inspectOptions.colors` is set as well.
* @default 'auto'
*/
colorMode?: boolean | "auto" | undefined;
/**
* Specifies options that are passed along to
* [`util.inspect()`](https://nodejs.org/docs/latest-v25.x/api/util.html#utilinspectobject-options).
*/
inspectOptions?: InspectOptions | ReadonlyMap<NodeJS.WritableStream, InspectOptions> | undefined;
/**
* Set group indentation.
* @default 2
*/
groupIndentation?: number | undefined;
}
global {
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
interface Console {
readonly Console: {
prototype: Console;
new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
new(options: ConsoleOptions): Console;
};
assert(condition?: unknown, ...data: any[]): void;
Console: console.ConsoleConstructor;
/**
* `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only
* writes a message and does not otherwise affect execution. The output always
* starts with `"Assertion failed"`. If provided, `message` is formatted using
* [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args).
*
* If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens.
*
* ```js
* console.assert(true, 'does nothing');
*
* console.assert(false, 'Whoops %s work', 'didn\'t');
* // Assertion failed: Whoops didn't work
*
* console.assert();
* // Assertion failed
* ```
* @since v0.1.101
* @param value The value tested for being truthy.
* @param message All arguments besides `value` are used as error message.
*/
assert(value: any, message?: string, ...optionalParams: any[]): void;
/**
* When `stdout` is a TTY, calling `console.clear()` will attempt to clear the
* TTY. When `stdout` is not a TTY, this method does nothing.
*
* The specific operation of `console.clear()` can vary across operating systems
* and terminal types. For most Linux operating systems, `console.clear()` operates similarly to the `clear` shell command. On Windows, `console.clear()` will clear only the output in the
* current terminal viewport for the Node.js
* binary.
* @since v8.3.0
*/
clear(): void;
/**
* Maintains an internal counter specific to `label` and outputs to `stdout` the
* number of times `console.count()` has been called with the given `label`.
*
* ```js
* > console.count()
* default: 1
* undefined
* > console.count('default')
* default: 2
* undefined
* > console.count('abc')
* abc: 1
* undefined
* > console.count('xyz')
* xyz: 1
* undefined
* > console.count('abc')
* abc: 2
* undefined
* > console.count()
* default: 3
* undefined
* >
* ```
* @since v8.3.0
* @param [label='default'] The display label for the counter.
*/
count(label?: string): void;
/**
* Resets the internal counter specific to `label`.
*
* ```js
* > console.count('abc');
* abc: 1
* undefined
* > console.countReset('abc');
* undefined
* > console.count('abc');
* abc: 1
* undefined
* >
* ```
* @since v8.3.0
* @param [label='default'] The display label for the counter.
*/
countReset(label?: string): void;
debug(...data: any[]): void;
dir(item?: any, options?: InspectOptions): void;
/**
* The `console.debug()` function is an alias for {@link log}.
* @since v8.0.0
*/
debug(message?: any, ...optionalParams: any[]): void;
/**
* Uses [`util.inspect()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilinspectobject-options) on `obj` and prints the resulting string to `stdout`.
* This function bypasses any custom `inspect()` function defined on `obj`.
* @since v0.1.101
*/
dir(obj: any, options?: InspectOptions): void;
/**
* This method calls `console.log()` passing it the arguments received.
* This method does not produce any XML formatting.
* @since v8.0.0
*/
dirxml(...data: any[]): void;
error(...data: any[]): void;
group(...data: any[]): void;
groupCollapsed(...data: any[]): void;
/**
* Prints to `stderr` with newline. Multiple arguments can be passed, with the
* first used as the primary message and all additional used as substitution
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)
* (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)).
*
* ```js
* const code = 5;
* console.error('error #%d', code);
* // Prints: error #5, to stderr
* console.error('error', code);
* // Prints: error 5, to stderr
* ```
*
* If formatting elements (e.g. `%d`) are not found in the first string then
* [`util.inspect()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilinspectobject-options) is called on each argument and the
* resulting string values are concatenated. See [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)
* for more information.
* @since v0.1.100
*/
error(message?: any, ...optionalParams: any[]): void;
/**
* Increases indentation of subsequent lines by spaces for `groupIndentation` length.
*
* If one or more `label`s are provided, those are printed first without the
* additional indentation.
* @since v8.5.0
*/
group(...label: any[]): void;
/**
* An alias for {@link group}.
* @since v8.5.0
*/
groupCollapsed(...label: any[]): void;
/**
* Decreases indentation of subsequent lines by spaces for `groupIndentation` length.
* @since v8.5.0
*/
groupEnd(): void;
info(...data: any[]): void;
log(...data: any[]): void;
table(tabularData?: any, properties?: string[]): void;
/**
* The `console.info()` function is an alias for {@link log}.
* @since v0.1.100
*/
info(message?: any, ...optionalParams: any[]): void;
/**
* Prints to `stdout` with newline. Multiple arguments can be passed, with the
* first used as the primary message and all additional used as substitution
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)
* (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)).
*
* ```js
* const count = 5;
* console.log('count: %d', count);
* // Prints: count: 5, to stdout
* console.log('count:', count);
* // Prints: count: 5, to stdout
* ```
*
* See [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args) for more information.
* @since v0.1.100
*/
log(message?: any, ...optionalParams: any[]): void;
/**
* Try to construct a table with the columns of the properties of `tabularData` (or use `properties`) and rows of `tabularData` and log it. Falls back to just
* logging the argument if it can't be parsed as tabular.
*
* ```js
* // These can't be parsed as tabular data
* console.table(Symbol());
* // Symbol()
*
* console.table(undefined);
* // undefined
*
* console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]);
* // ┌─────────┬─────┬─────┐
* // │ (index) │ a │ b │
* // ├─────────┼─────┼─────┤
* // │ 0 │ 1 │ 'Y' │
* // │ 1 │ 'Z' │ 2 │
* // └─────────┴─────┴─────┘
*
* console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']);
* // ┌─────────┬─────┐
* // │ (index) │ a │
* // ├─────────┼─────┤
* // │ 0 │ 1 │
* // │ 1 │ 'Z' │
* // └─────────┴─────┘
* ```
* @since v10.0.0
* @param properties Alternate properties for constructing the table.
*/
table(tabularData: any, properties?: readonly string[]): void;
/**
* Starts a timer that can be used to compute the duration of an operation. Timers
* are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in
* suitable time units to `stdout`. For example, if the elapsed
* time is 3869ms, `console.timeEnd()` displays "3.869s".
* @since v0.1.104
* @param [label='default']
*/
time(label?: string): void;
/**
* Stops a timer that was previously started by calling {@link time} and
* prints the result to `stdout`:
*
* ```js
* console.time('bunch-of-stuff');
* // Do a bunch of stuff.
* console.timeEnd('bunch-of-stuff');
* // Prints: bunch-of-stuff: 225.438ms
* ```
* @since v0.1.104
* @param [label='default']
*/
timeEnd(label?: string): void;
/**
* For a timer that was previously started by calling {@link time}, prints
* the elapsed time and other `data` arguments to `stdout`:
*
* ```js
* console.time('process');
* const value = expensiveProcess1(); // Returns 42
* console.timeLog('process', value);
* // Prints "process: 365.227ms 42".
* doExpensiveProcess2(value);
* console.timeEnd('process');
* ```
* @since v10.7.0
* @param [label='default']
*/
timeLog(label?: string, ...data: any[]): void;
trace(...data: any[]): void;
warn(...data: any[]): void;
/**
* Prints to `stderr` the string `'Trace: '`, followed by the [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)
* formatted message and stack trace to the current position in the code.
*
* ```js
* console.trace('Show me');
* // Prints: (stack trace will vary based on where trace is called)
* // Trace: Show me
* // at repl:2:9
* // at REPLServer.defaultEval (repl.js:248:27)
* // at bound (domain.js:287:14)
* // at REPLServer.runBound [as eval] (domain.js:300:12)
* // at REPLServer.<anonymous> (repl.js:412:12)
* // at emitOne (events.js:82:20)
* // at REPLServer.emit (events.js:169:7)
* // at REPLServer.Interface._onLine (readline.js:210:10)
* // at REPLServer.Interface._line (readline.js:549:8)
* // at REPLServer.Interface._ttyWrite (readline.js:826:14)
* ```
* @since v0.1.104
*/
trace(message?: any, ...optionalParams: any[]): void;
/**
* The `console.warn()` function is an alias for {@link error}.
* @since v0.1.100
*/
warn(message?: any, ...optionalParams: any[]): void;
// --- Inspector mode only ---
/**
* This method does not display anything unless used in the inspector. The `console.profile()`
* method starts a JavaScript CPU profile with an optional label until {@link profileEnd}
@@ -141,11 +354,99 @@ declare module "node:console" {
*/
timeStamp(label?: string): void;
}
/**
* The `console` module provides a simple debugging console that is similar to the
* JavaScript console mechanism provided by web browsers.
*
* The module exports two specific components:
*
* * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream.
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) and
* [`process.stderr`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
*
* _**Warning**_: The global console object's methods are neither consistently
* synchronous like the browser APIs they resemble, nor are they consistently
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v24.x/api/process.html#a-note-on-process-io) for
* more information.
*
* Example using the global `console`:
*
* ```js
* console.log('hello world');
* // Prints: hello world, to stdout
* console.log('hello %s', 'world');
* // Prints: hello world, to stdout
* console.error(new Error('Whoops, something bad happened'));
* // Prints error message and stack trace to stderr:
* // Error: Whoops, something bad happened
* // at [eval]:5:15
* // at Script.runInThisContext (node:vm:132:18)
* // at Object.runInThisContext (node:vm:309:38)
* // at node:internal/process/execution:77:19
* // at [eval]-wrapper:6:22
* // at evalScript (node:internal/process/execution:76:60)
* // at node:internal/main/eval_string:23:3
*
* const name = 'Will Robinson';
* console.warn(`Danger ${name}! Danger!`);
* // Prints: Danger Will Robinson! Danger!, to stderr
* ```
*
* Example using the `Console` class:
*
* ```js
* const out = getStreamSomehow();
* const err = getStreamSomehow();
* const myConsole = new console.Console(out, err);
*
* myConsole.log('hello world');
* // Prints: hello world, to out
* myConsole.log('hello %s', 'world');
* // Prints: hello world, to out
* myConsole.error(new Error('Whoops, something bad happened'));
* // Prints: [Error: Whoops, something bad happened], to err
*
* const name = 'Will Robinson';
* myConsole.warn(`Danger ${name}! Danger!`);
* // Prints: Danger Will Robinson! Danger!, to err
* ```
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/console.js)
*/
namespace console {
interface ConsoleConstructorOptions {
stdout: NodeJS.WritableStream;
stderr?: NodeJS.WritableStream | undefined;
/**
* Ignore errors when writing to the underlying streams.
* @default true
*/
ignoreErrors?: boolean | undefined;
/**
* Set color support for this `Console` instance. Setting to true enables coloring while inspecting
* values. Setting to `false` disables coloring while inspecting values. Setting to `'auto'` makes color
* support depend on the value of the `isTTY` property and the value returned by `getColorDepth()` on the
* respective stream. This option can not be used, if `inspectOptions.colors` is set as well.
* @default auto
*/
colorMode?: boolean | "auto" | undefined;
/**
* Specifies options that are passed along to
* [`util.inspect()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilinspectobject-options).
*/
inspectOptions?: InspectOptions | undefined;
/**
* Set group indentation.
* @default 2
*/
groupIndentation?: number | undefined;
}
interface ConsoleConstructor {
prototype: Console;
new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
new(options: ConsoleConstructorOptions): Console;
}
}
var console: Console;
}
var console: console.Console;
export = console;
}
declare module "console" {
import console = require("node:console");
export = console;
export = globalThis.console;
}

View File

@@ -4,7 +4,7 @@
* to the `constants` property exposed by the relevant module. For instance,
* `require('node:fs').constants` and `require('node:os').constants`.
*/
declare module "node:constants" {
declare module "constants" {
const constants:
& typeof import("node:os").constants.dlopen
& typeof import("node:os").constants.errno
@@ -14,7 +14,8 @@ declare module "node:constants" {
& typeof import("node:crypto").constants;
export = constants;
}
declare module "constants" {
import constants = require("node:constants");
declare module "node:constants" {
import constants = require("constants");
export = constants;
}

1841
node_modules/@types/node/crypto.d.ts generated vendored

File diff suppressed because it is too large Load Diff

71
node_modules/@types/node/dgram.d.ts generated vendored
View File

@@ -23,13 +23,12 @@
* server.bind(41234);
* // Prints: server listening 0.0.0.0:41234
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/dgram.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/dgram.js)
*/
declare module "node:dgram" {
import { NonSharedBuffer } from "node:buffer";
import * as dns from "node:dns";
import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
declare module "dgram" {
import { AddressInfo, BlockList } from "node:net";
import * as dns from "node:dns";
import { Abortable, EventEmitter } from "node:events";
interface RemoteInfo {
address: string;
family: "IPv4" | "IPv6";
@@ -86,15 +85,8 @@ declare module "node:dgram" {
* @param options Available options are:
* @param callback Attached as a listener for `'message'` events. Optional.
*/
function createSocket(type: SocketType, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket;
function createSocket(options: SocketOptions, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket;
interface SocketEventMap {
"close": [];
"connect": [];
"error": [err: Error];
"listening": [];
"message": [msg: NonSharedBuffer, rinfo: RemoteInfo];
}
function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
/**
* Encapsulates the datagram functionality.
*
@@ -102,7 +94,7 @@ declare module "node:dgram" {
* The `new` keyword is not to be used to create `dgram.Socket` instances.
* @since v0.1.99
*/
class Socket implements EventEmitter {
class Socket extends EventEmitter {
/**
* Tells the kernel to join a multicast group at the given `multicastAddress` and `multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the `multicastInterface` argument is not
* specified, the operating system will choose
@@ -551,14 +543,57 @@ declare module "node:dgram" {
* @since v13.1.0, v12.16.0
*/
dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
/**
* events.EventEmitter
* 1. close
* 2. connect
* 3. error
* 4. listening
* 5. message
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "connect", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "listening", listener: () => void): this;
addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "close"): boolean;
emit(event: "connect"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "listening"): boolean;
emit(event: "message", msg: Buffer, rinfo: RemoteInfo): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: () => void): this;
on(event: "connect", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "listening", listener: () => void): this;
on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "connect", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "listening", listener: () => void): this;
once(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "connect", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "listening", listener: () => void): this;
prependListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "connect", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "listening", listener: () => void): this;
prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
/**
* Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
* @since v20.5.0
*/
[Symbol.asyncDispose](): Promise<void>;
}
interface Socket extends InternalEventEmitter<SocketEventMap> {}
}
declare module "dgram" {
export * from "node:dgram";
declare module "node:dgram" {
export * from "dgram";
}

View File

@@ -20,9 +20,9 @@
* should generally include the module name to avoid collisions with data from
* other modules.
* @since v15.1.0, v14.17.0
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/diagnostics_channel.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/diagnostics_channel.js)
*/
declare module "node:diagnostics_channel" {
declare module "diagnostics_channel" {
import { AsyncLocalStorage } from "node:async_hooks";
/**
* Check if there are active subscribers to the named channel. This is helpful if
@@ -189,6 +189,7 @@ declare module "node:diagnostics_channel" {
* });
* ```
* @since v15.1.0, v14.17.0
* @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)}
* @param onMessage The handler to receive channel messages
*/
subscribe(onMessage: ChannelListener): void;
@@ -209,6 +210,7 @@ declare module "node:diagnostics_channel" {
* channel.unsubscribe(onMessage);
* ```
* @since v15.1.0, v14.17.0
* @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)}
* @param onMessage The previous subscribed handler to remove
* @return `true` if the handler was found, `false` otherwise.
*/
@@ -571,6 +573,6 @@ declare module "node:diagnostics_channel" {
readonly hasSubscribers: boolean;
}
}
declare module "diagnostics_channel" {
export * from "node:diagnostics_channel";
declare module "node:diagnostics_channel" {
export * from "diagnostics_channel";
}

265
node_modules/@types/node/dns.d.ts generated vendored
View File

@@ -41,27 +41,28 @@
* });
* ```
*
* See the [Implementation considerations section](https://nodejs.org/docs/latest-v25.x/api/dns.html#implementation-considerations) for more information.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/dns.js)
* See the [Implementation considerations section](https://nodejs.org/docs/latest-v24.x/api/dns.html#implementation-considerations) for more information.
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/dns.js)
*/
declare module "node:dns" {
declare module "dns" {
import * as dnsPromises from "node:dns/promises";
// Supported getaddrinfo flags.
/**
* Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are
* only returned if the current system has at least one IPv4 address configured.
*/
const ADDRCONFIG: number;
export const ADDRCONFIG: number;
/**
* If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported
* on some operating systems (e.g. FreeBSD 10.1).
*/
const V4MAPPED: number;
export const V4MAPPED: number;
/**
* If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
* well as IPv4 mapped IPv6 addresses.
*/
const ALL: number;
interface LookupOptions {
export const ALL: number;
export interface LookupOptions {
/**
* The record family. Must be `4`, `6`, or `0`. For backward compatibility reasons, `'IPv4'` and `'IPv6'` are interpreted
* as `4` and `6` respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value `0` is used
@@ -70,7 +71,7 @@ declare module "node:dns" {
*/
family?: number | "IPv4" | "IPv6" | undefined;
/**
* One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v25.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be
* One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v24.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be
* passed by bitwise `OR`ing their values.
*/
hints?: number | undefined;
@@ -83,7 +84,7 @@ declare module "node:dns" {
* When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted
* by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6
* addresses before IPv4 addresses. Default value is configurable using
* {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--dns-result-orderorder).
* {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--dns-result-orderorder).
* @default `verbatim` (addresses are not reordered)
* @since v22.1.0
*/
@@ -97,13 +98,13 @@ declare module "node:dns" {
*/
verbatim?: boolean | undefined;
}
interface LookupOneOptions extends LookupOptions {
export interface LookupOneOptions extends LookupOptions {
all?: false | undefined;
}
interface LookupAllOptions extends LookupOptions {
export interface LookupAllOptions extends LookupOptions {
all: true;
}
interface LookupAddress {
export interface LookupAddress {
/**
* A string representation of an IPv4 or IPv6 address.
*/
@@ -132,7 +133,7 @@ declare module "node:dns" {
* The implementation uses an operating system facility that can associate names
* with addresses and vice versa. This implementation can have subtle but
* important consequences on the behavior of any Node.js program. Please take some
* time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v25.x/api/dns.html#implementation-considerations)
* time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v24.x/api/dns.html#implementation-considerations)
* before using `dns.lookup()`.
*
* Example usage:
@@ -154,35 +155,35 @@ declare module "node:dns" {
* // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
* ```
*
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v25.x/api/util.html#utilpromisifyoriginal) ed
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v24.x/api/util.html#utilpromisifyoriginal) ed
* version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties.
* @since v0.1.90
*/
function lookup(
export function lookup(
hostname: string,
family: number,
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
): void;
function lookup(
export function lookup(
hostname: string,
options: LookupOneOptions,
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
): void;
function lookup(
export function lookup(
hostname: string,
options: LookupAllOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void,
): void;
function lookup(
export function lookup(
hostname: string,
options: LookupOptions,
callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void,
): void;
function lookup(
export function lookup(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
): void;
namespace lookup {
export namespace lookup {
function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
@@ -194,7 +195,7 @@ declare module "node:dns" {
* If `address` is not a valid IP address, a `TypeError` will be thrown.
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown.
*
* On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-error) object,
* On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) object,
* where `err.code` is the error code.
*
* ```js
@@ -205,16 +206,16 @@ declare module "node:dns" {
* });
* ```
*
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v25.x/api/util.html#utilpromisifyoriginal) ed
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v24.x/api/util.html#utilpromisifyoriginal) ed
* version, it returns a `Promise` for an `Object` with `hostname` and `service` properties.
* @since v0.11.14
*/
function lookupService(
export function lookupService(
address: string,
port: number,
callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void,
): void;
namespace lookupService {
export namespace lookupService {
function __promisify__(
address: string,
port: number,
@@ -223,23 +224,25 @@ declare module "node:dns" {
service: string;
}>;
}
interface ResolveOptions {
export interface ResolveOptions {
ttl: boolean;
}
interface ResolveWithTtlOptions extends ResolveOptions {
export interface ResolveWithTtlOptions extends ResolveOptions {
ttl: true;
}
interface RecordWithTtl {
export interface RecordWithTtl {
address: string;
ttl: number;
}
interface AnyARecord extends RecordWithTtl {
/** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
export interface AnyARecord extends RecordWithTtl {
type: "A";
}
interface AnyAaaaRecord extends RecordWithTtl {
export interface AnyAaaaRecord extends RecordWithTtl {
type: "AAAA";
}
interface CaaRecord {
export interface CaaRecord {
critical: number;
issue?: string | undefined;
issuewild?: string | undefined;
@@ -247,17 +250,17 @@ declare module "node:dns" {
contactemail?: string | undefined;
contactphone?: string | undefined;
}
interface AnyCaaRecord extends CaaRecord {
export interface AnyCaaRecord extends CaaRecord {
type: "CAA";
}
interface MxRecord {
export interface MxRecord {
priority: number;
exchange: string;
}
interface AnyMxRecord extends MxRecord {
export interface AnyMxRecord extends MxRecord {
type: "MX";
}
interface NaptrRecord {
export interface NaptrRecord {
flags: string;
service: string;
regexp: string;
@@ -265,10 +268,10 @@ declare module "node:dns" {
order: number;
preference: number;
}
interface AnyNaptrRecord extends NaptrRecord {
export interface AnyNaptrRecord extends NaptrRecord {
type: "NAPTR";
}
interface SoaRecord {
export interface SoaRecord {
nsname: string;
hostmaster: string;
serial: number;
@@ -277,44 +280,44 @@ declare module "node:dns" {
expire: number;
minttl: number;
}
interface AnySoaRecord extends SoaRecord {
export interface AnySoaRecord extends SoaRecord {
type: "SOA";
}
interface SrvRecord {
export interface SrvRecord {
priority: number;
weight: number;
port: number;
name: string;
}
interface AnySrvRecord extends SrvRecord {
export interface AnySrvRecord extends SrvRecord {
type: "SRV";
}
interface TlsaRecord {
export interface TlsaRecord {
certUsage: number;
selector: number;
match: number;
data: ArrayBuffer;
}
interface AnyTlsaRecord extends TlsaRecord {
export interface AnyTlsaRecord extends TlsaRecord {
type: "TLSA";
}
interface AnyTxtRecord {
export interface AnyTxtRecord {
type: "TXT";
entries: string[];
}
interface AnyNsRecord {
export interface AnyNsRecord {
type: "NS";
value: string;
}
interface AnyPtrRecord {
export interface AnyPtrRecord {
type: "PTR";
value: string;
}
interface AnyCnameRecord {
export interface AnyCnameRecord {
type: "CNAME";
value: string;
}
type AnyRecord =
export type AnyRecord =
| AnyARecord
| AnyAaaaRecord
| AnyCaaRecord
@@ -334,62 +337,62 @@ declare module "node:dns" {
*
* <omitted>
*
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-error) object,
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) object,
* where `err.code` is one of the `DNS error codes`.
* @since v0.1.27
* @param hostname Host name to resolve.
* @param [rrtype='A'] Resource record type.
*/
function resolve(
export function resolve(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
function resolve(
export function resolve(
hostname: string,
rrtype: "A" | "AAAA" | "CNAME" | "NS" | "PTR",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
function resolve(
export function resolve(
hostname: string,
rrtype: "ANY",
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
): void;
function resolve(
export function resolve(
hostname: string,
rrtype: "CAA",
callback: (err: NodeJS.ErrnoException | null, address: CaaRecord[]) => void,
): void;
function resolve(
export function resolve(
hostname: string,
rrtype: "MX",
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
): void;
function resolve(
export function resolve(
hostname: string,
rrtype: "NAPTR",
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
): void;
function resolve(
export function resolve(
hostname: string,
rrtype: "SOA",
callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void,
): void;
function resolve(
export function resolve(
hostname: string,
rrtype: "SRV",
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
): void;
function resolve(
export function resolve(
hostname: string,
rrtype: "TLSA",
callback: (err: NodeJS.ErrnoException | null, addresses: TlsaRecord[]) => void,
): void;
function resolve(
export function resolve(
hostname: string,
rrtype: "TXT",
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
): void;
function resolve(
export function resolve(
hostname: string,
rrtype: string,
callback: (
@@ -406,7 +409,7 @@ declare module "node:dns" {
| AnyRecord[],
) => void,
): void;
namespace resolve {
export namespace resolve {
function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
function __promisify__(hostname: string, rrtype: "CAA"): Promise<CaaRecord[]>;
@@ -437,21 +440,21 @@ declare module "node:dns" {
* @since v0.1.16
* @param hostname Host name to resolve.
*/
function resolve4(
export function resolve4(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
function resolve4(
export function resolve4(
hostname: string,
options: ResolveWithTtlOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
): void;
function resolve4(
export function resolve4(
hostname: string,
options: ResolveOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
): void;
namespace resolve4 {
export namespace resolve4 {
function __promisify__(hostname: string): Promise<string[]>;
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
@@ -462,21 +465,21 @@ declare module "node:dns" {
* @since v0.1.16
* @param hostname Host name to resolve.
*/
function resolve6(
export function resolve6(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
function resolve6(
export function resolve6(
hostname: string,
options: ResolveWithTtlOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
): void;
function resolve6(
export function resolve6(
hostname: string,
options: ResolveOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
): void;
namespace resolve6 {
export namespace resolve6 {
function __promisify__(hostname: string): Promise<string[]>;
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
@@ -486,11 +489,11 @@ declare module "node:dns" {
* will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`).
* @since v0.3.2
*/
function resolveCname(
export function resolveCname(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
namespace resolveCname {
export namespace resolveCname {
function __promisify__(hostname: string): Promise<string[]>;
}
/**
@@ -499,11 +502,11 @@ declare module "node:dns" {
* available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).
* @since v15.0.0, v14.17.0
*/
function resolveCaa(
export function resolveCaa(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void,
): void;
namespace resolveCaa {
export namespace resolveCaa {
function __promisify__(hostname: string): Promise<CaaRecord[]>;
}
/**
@@ -511,11 +514,11 @@ declare module "node:dns" {
* contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
* @since v0.1.27
*/
function resolveMx(
export function resolveMx(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
): void;
namespace resolveMx {
export namespace resolveMx {
function __promisify__(hostname: string): Promise<MxRecord[]>;
}
/**
@@ -541,11 +544,11 @@ declare module "node:dns" {
* ```
* @since v0.9.12
*/
function resolveNaptr(
export function resolveNaptr(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
): void;
namespace resolveNaptr {
export namespace resolveNaptr {
function __promisify__(hostname: string): Promise<NaptrRecord[]>;
}
/**
@@ -553,11 +556,11 @@ declare module "node:dns" {
* contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`).
* @since v0.1.90
*/
function resolveNs(
export function resolveNs(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
namespace resolveNs {
export namespace resolveNs {
function __promisify__(hostname: string): Promise<string[]>;
}
/**
@@ -565,11 +568,11 @@ declare module "node:dns" {
* be an array of strings containing the reply records.
* @since v6.0.0
*/
function resolvePtr(
export function resolvePtr(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
namespace resolvePtr {
export namespace resolvePtr {
function __promisify__(hostname: string): Promise<string[]>;
}
/**
@@ -598,11 +601,11 @@ declare module "node:dns" {
* ```
* @since v0.11.10
*/
function resolveSoa(
export function resolveSoa(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void,
): void;
namespace resolveSoa {
export namespace resolveSoa {
function __promisify__(hostname: string): Promise<SoaRecord>;
}
/**
@@ -624,11 +627,11 @@ declare module "node:dns" {
* ```
* @since v0.1.27
*/
function resolveSrv(
export function resolveSrv(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
): void;
namespace resolveSrv {
export namespace resolveSrv {
function __promisify__(hostname: string): Promise<SrvRecord[]>;
}
/**
@@ -651,11 +654,11 @@ declare module "node:dns" {
* ```
* @since v23.9.0, v22.15.0
*/
function resolveTlsa(
export function resolveTlsa(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: TlsaRecord[]) => void,
): void;
namespace resolveTlsa {
export namespace resolveTlsa {
function __promisify__(hostname: string): Promise<TlsaRecord[]>;
}
/**
@@ -665,11 +668,11 @@ declare module "node:dns" {
* treated separately.
* @since v0.1.27
*/
function resolveTxt(
export function resolveTxt(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
): void;
namespace resolveTxt {
export namespace resolveTxt {
function __promisify__(hostname: string): Promise<string[][]>;
}
/**
@@ -702,27 +705,27 @@ declare module "node:dns" {
* DNS server operators may choose not to respond to `ANY` queries. It may be better to call individual methods like {@link resolve4}, {@link resolveMx}, and so on. For more details, see
* [RFC 8482](https://tools.ietf.org/html/rfc8482).
*/
function resolveAny(
export function resolveAny(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
): void;
namespace resolveAny {
export namespace resolveAny {
function __promisify__(hostname: string): Promise<AnyRecord[]>;
}
/**
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
* array of host names.
*
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-error) object, where `err.code` is
* one of the [DNS error codes](https://nodejs.org/docs/latest-v25.x/api/dns.html#error-codes).
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-error) object, where `err.code` is
* one of the [DNS error codes](https://nodejs.org/docs/latest-v24.x/api/dns.html#error-codes).
* @since v0.1.16
*/
function reverse(
export function reverse(
ip: string,
callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void,
): void;
/**
* Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v25.x/api/dns.html#dnspromiseslookuphostname-options).
* Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v24.x/api/dns.html#dnspromiseslookuphostname-options).
* The value could be:
*
* * `ipv4first`: for `order` defaulting to `ipv4first`.
@@ -730,7 +733,7 @@ declare module "node:dns" {
* * `verbatim`: for `order` defaulting to `verbatim`.
* @since v18.17.0
*/
function getDefaultResultOrder(): "ipv4first" | "ipv6first" | "verbatim";
export function getDefaultResultOrder(): "ipv4first" | "ipv6first" | "verbatim";
/**
* Sets the IP address and port of servers to be used when performing DNS
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
@@ -759,7 +762,7 @@ declare module "node:dns" {
* @since v0.11.3
* @param servers array of [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952#section-6) formatted addresses
*/
function setServers(servers: readonly string[]): void;
export function setServers(servers: readonly string[]): void;
/**
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
* that are currently configured for DNS resolution. A string will include a port
@@ -775,9 +778,9 @@ declare module "node:dns" {
* ```
* @since v0.11.3
*/
function getServers(): string[];
export function getServers(): string[];
/**
* Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v25.x/api/dns.html#dnspromiseslookuphostname-options).
* Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v24.x/api/dns.html#dnspromiseslookuphostname-options).
* The value could be:
*
* * `ipv4first`: sets default `order` to `ipv4first`.
@@ -785,39 +788,39 @@ declare module "node:dns" {
* * `verbatim`: sets default `order` to `verbatim`.
*
* The default is `verbatim` and {@link setDefaultResultOrder} have higher
* priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--dns-result-orderorder). When using
* [worker threads](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main
* priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--dns-result-orderorder). When using
* [worker threads](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main
* thread won't affect the default dns orders in workers.
* @since v16.4.0, v14.18.0
* @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.
*/
function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
export function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
// Error codes
const NODATA: "ENODATA";
const FORMERR: "EFORMERR";
const SERVFAIL: "ESERVFAIL";
const NOTFOUND: "ENOTFOUND";
const NOTIMP: "ENOTIMP";
const REFUSED: "EREFUSED";
const BADQUERY: "EBADQUERY";
const BADNAME: "EBADNAME";
const BADFAMILY: "EBADFAMILY";
const BADRESP: "EBADRESP";
const CONNREFUSED: "ECONNREFUSED";
const TIMEOUT: "ETIMEOUT";
const EOF: "EOF";
const FILE: "EFILE";
const NOMEM: "ENOMEM";
const DESTRUCTION: "EDESTRUCTION";
const BADSTR: "EBADSTR";
const BADFLAGS: "EBADFLAGS";
const NONAME: "ENONAME";
const BADHINTS: "EBADHINTS";
const NOTINITIALIZED: "ENOTINITIALIZED";
const LOADIPHLPAPI: "ELOADIPHLPAPI";
const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS";
const CANCELLED: "ECANCELLED";
interface ResolverOptions {
export const NODATA: "ENODATA";
export const FORMERR: "EFORMERR";
export const SERVFAIL: "ESERVFAIL";
export const NOTFOUND: "ENOTFOUND";
export const NOTIMP: "ENOTIMP";
export const REFUSED: "EREFUSED";
export const BADQUERY: "EBADQUERY";
export const BADNAME: "EBADNAME";
export const BADFAMILY: "EBADFAMILY";
export const BADRESP: "EBADRESP";
export const CONNREFUSED: "ECONNREFUSED";
export const TIMEOUT: "ETIMEOUT";
export const EOF: "EOF";
export const FILE: "EFILE";
export const NOMEM: "ENOMEM";
export const DESTRUCTION: "EDESTRUCTION";
export const BADSTR: "EBADSTR";
export const BADFLAGS: "EBADFLAGS";
export const NONAME: "ENONAME";
export const BADHINTS: "EBADHINTS";
export const NOTINITIALIZED: "ENOTINITIALIZED";
export const LOADIPHLPAPI: "ELOADIPHLPAPI";
export const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS";
export const CANCELLED: "ECANCELLED";
export interface ResolverOptions {
/**
* Query timeout in milliseconds, or `-1` to use the default timeout.
*/
@@ -826,7 +829,7 @@ declare module "node:dns" {
* The number of tries the resolver will try contacting each name server before giving up.
* @default 4
*/
tries?: number | undefined;
tries?: number;
/**
* The max retry timeout, in milliseconds.
* @default 0
@@ -837,7 +840,7 @@ declare module "node:dns" {
* An independent resolver for DNS requests.
*
* Creating a new resolver uses the default server settings. Setting
* the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v25.x/api/dns.html#dnssetserversservers) does not affect
* the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v24.x/api/dns.html#dnssetserversservers) does not affect
* other resolvers:
*
* ```js
@@ -871,7 +874,7 @@ declare module "node:dns" {
* * `resolver.setServers()`
* @since v8.3.0
*/
class Resolver {
export class Resolver {
constructor(options?: ResolverOptions);
/**
* Cancel all outstanding DNS queries made by this resolver. The corresponding
@@ -913,10 +916,8 @@ declare module "node:dns" {
setLocalAddress(ipv4?: string, ipv6?: string): void;
setServers: typeof setServers;
}
export { dnsPromises as promises };
}
declare module "node:dns" {
export * as promises from "node:dns/promises";
}
declare module "dns" {
export * from "node:dns";
export * from "dns";
}

View File

@@ -4,7 +4,7 @@
* via `import { promises as dnsPromises } from 'node:dns'` or `import dnsPromises from 'node:dns/promises'`.
* @since v10.6.0
*/
declare module "node:dns/promises" {
declare module "dns/promises" {
import {
AnyRecord,
CaaRecord,
@@ -498,6 +498,6 @@ declare module "node:dns/promises" {
setServers: typeof setServers;
}
}
declare module "dns/promises" {
export * from "node:dns/promises";
declare module "node:dns/promises" {
export * from "dns/promises";
}

30
node_modules/@types/node/domain.d.ts generated vendored
View File

@@ -12,10 +12,10 @@
* will be notified, rather than losing the context of the error in the `process.on('uncaughtException')` handler, or causing the program to
* exit immediately with an error code.
* @deprecated Since v1.4.2 - Deprecated
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/domain.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/domain.js)
*/
declare module "node:domain" {
import { EventEmitter } from "node:events";
declare module "domain" {
import EventEmitter = require("node:events");
/**
* The `Domain` class encapsulates the functionality of routing errors and
* uncaught exceptions to the active `Domain` object.
@@ -24,9 +24,10 @@ declare module "node:domain" {
*/
class Domain extends EventEmitter {
/**
* An array of event emitters that have been explicitly added to the domain.
* An array of timers and event emitters that have been explicitly added
* to the domain.
*/
members: EventEmitter[];
members: Array<EventEmitter | NodeJS.Timer>;
/**
* The `enter()` method is plumbing used by the `run()`, `bind()`, and `intercept()` methods to set the active domain. It sets `domain.active` and `process.domain` to the domain, and implicitly
* pushes the domain onto the domain
@@ -90,17 +91,20 @@ declare module "node:domain" {
* will be routed to the domain's `'error'` event, just like with implicit
* binding.
*
* If the `EventEmitter` was already bound to a domain, it is removed from that
* one, and bound to this one instead.
* @param emitter emitter to be added to the domain
* This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by
* the domain `'error'` handler.
*
* If the Timer or `EventEmitter` was already bound to a domain, it is removed
* from that one, and bound to this one instead.
* @param emitter emitter or timer to be added to the domain
*/
add(emitter: EventEmitter): void;
add(emitter: EventEmitter | NodeJS.Timer): void;
/**
* The opposite of {@link add}. Removes domain handling from the
* specified emitter.
* @param emitter emitter to be removed from the domain
* @param emitter emitter or timer to be removed from the domain
*/
remove(emitter: EventEmitter): void;
remove(emitter: EventEmitter | NodeJS.Timer): void;
/**
* The returned function will be a wrapper around the supplied callback
* function. When the returned function is called, any errors that are
@@ -161,6 +165,6 @@ declare module "node:domain" {
}
function create(): Domain;
}
declare module "domain" {
export * from "node:domain";
declare module "node:domain" {
export * from "domain";
}

1550
node_modules/@types/node/events.d.ts generated vendored

File diff suppressed because it is too large Load Diff

1133
node_modules/@types/node/fs.d.ts generated vendored

File diff suppressed because it is too large Load Diff

View File

@@ -8,10 +8,10 @@
* concurrent modifications on the same file or data corruption may occur.
* @since v10.0.0
*/
declare module "node:fs/promises" {
import { NonSharedBuffer } from "node:buffer";
declare module "fs/promises" {
import { Abortable } from "node:events";
import { Interface as ReadlineInterface } from "node:readline";
import { Stream } from "node:stream";
import { ReadableStream } from "node:stream/web";
import {
BigIntStats,
BigIntStatsFs,
@@ -20,6 +20,7 @@ declare module "node:fs/promises" {
CopyOptions,
Dir,
Dirent,
DisposableTempDir,
EncodingOption,
GlobOptions,
GlobOptionsWithFileTypes,
@@ -30,11 +31,10 @@ declare module "node:fs/promises" {
OpenDirOptions,
OpenMode,
PathLike,
ReadOptions,
ReadOptionsWithBuffer,
ReadPosition,
ReadStream,
ReadVResult,
RmDirOptions,
RmOptions,
StatFsOptions,
StatOptions,
@@ -46,8 +46,7 @@ declare module "node:fs/promises" {
WriteStream,
WriteVResult,
} from "node:fs";
import { Stream } from "node:stream";
import { ReadableStream } from "node:stream/web";
import { Interface as ReadlineInterface } from "node:readline";
interface FileChangeInfo<T extends string | Buffer> {
eventType: WatchEventType;
filename: T | null;
@@ -60,7 +59,6 @@ declare module "node:fs/promises" {
bytesRead: number;
buffer: T;
}
/** @deprecated This interface will be removed in a future version. Use `import { ReadOptionsWithBuffer } from "node:fs"` instead. */
interface FileReadOptions<T extends NodeJS.ArrayBufferView = Buffer> {
/**
* @default `Buffer.alloc(0xffff)`
@@ -239,13 +237,11 @@ declare module "node:fs/promises" {
length?: number | null,
position?: ReadPosition | null,
): Promise<FileReadResult<T>>;
read<T extends NodeJS.ArrayBufferView>(
read<T extends NodeJS.ArrayBufferView = Buffer>(
buffer: T,
options?: ReadOptions,
): Promise<FileReadResult<T>>;
read<T extends NodeJS.ArrayBufferView = NonSharedBuffer>(
options?: ReadOptionsWithBuffer<T>,
options?: FileReadOptions<T>,
): Promise<FileReadResult<T>>;
read<T extends NodeJS.ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
/**
* Returns a byte-oriented `ReadableStream` that may be used to read the file's
* contents.
@@ -289,7 +285,7 @@ declare module "node:fs/promises" {
options?:
| ({ encoding?: null | undefined } & Abortable)
| null,
): Promise<NonSharedBuffer>;
): Promise<Buffer>;
/**
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
* The `FileHandle` must have been opened for reading.
@@ -308,7 +304,7 @@ declare module "node:fs/promises" {
| (ObjectEncodingOptions & Abortable)
| BufferEncoding
| null,
): Promise<string | NonSharedBuffer>;
): Promise<string | Buffer>;
/**
* Convenience method to create a `readline` interface and stream over the file.
* See `filehandle.createReadStream()` for the options.
@@ -417,7 +413,7 @@ declare module "node:fs/promises" {
* @param [position='null'] The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current
* position. See the POSIX pwrite(2) documentation for more detail.
*/
write<TBuffer extends NodeJS.ArrayBufferView>(
write<TBuffer extends Uint8Array>(
buffer: TBuffer,
offset?: number | null,
length?: number | null,
@@ -456,20 +452,14 @@ declare module "node:fs/promises" {
* @param [position='null'] The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current
* position.
*/
writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
buffers: TBuffers,
position?: number,
): Promise<WriteVResult<TBuffers>>;
writev(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
/**
* Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s
* @since v13.13.0, v12.17.0
* @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position.
* @return Fulfills upon success an object containing two properties:
*/
readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
buffers: TBuffers,
position?: number,
): Promise<ReadVResult<TBuffers>>;
readv(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise<ReadVResult>;
/**
* Closes the file handle after waiting for any pending operation on the handle to
* complete.
@@ -600,7 +590,7 @@ declare module "node:fs/promises" {
* @since v10.0.0
* @return Fulfills with `undefined` upon success.
*/
function rmdir(path: PathLike): Promise<void>;
function rmdir(path: PathLike, options?: RmDirOptions): Promise<void>;
/**
* Removes files and directories (modeled on the standard POSIX `rm` utility).
* @since v14.14.0
@@ -706,7 +696,7 @@ declare module "node:fs/promises" {
recursive?: boolean | undefined;
}
| "buffer",
): Promise<NonSharedBuffer[]>;
): Promise<Buffer[]>;
/**
* Asynchronous readdir(3) - read a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -721,7 +711,7 @@ declare module "node:fs/promises" {
})
| BufferEncoding
| null,
): Promise<string[] | NonSharedBuffer[]>;
): Promise<string[] | Buffer[]>;
/**
* Asynchronous readdir(3) - read a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -746,7 +736,7 @@ declare module "node:fs/promises" {
withFileTypes: true;
recursive?: boolean | undefined;
},
): Promise<Dirent<NonSharedBuffer>[]>;
): Promise<Dirent<Buffer>[]>;
/**
* Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is
* fulfilled with the`linkString` upon success.
@@ -764,16 +754,13 @@ declare module "node:fs/promises" {
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
function readlink(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
function readlink(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
/**
* Asynchronous readlink(2) - read value of a symbolic link.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
function readlink(
path: PathLike,
options?: ObjectEncodingOptions | string | null,
): Promise<string | NonSharedBuffer>;
function readlink(path: PathLike, options?: ObjectEncodingOptions | string | null): Promise<string | Buffer>;
/**
* Creates a symbolic link.
*
@@ -924,7 +911,7 @@ declare module "node:fs/promises" {
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
function realpath(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
function realpath(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
/**
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -933,7 +920,7 @@ declare module "node:fs/promises" {
function realpath(
path: PathLike,
options?: ObjectEncodingOptions | BufferEncoding | null,
): Promise<string | NonSharedBuffer>;
): Promise<string | Buffer>;
/**
* Creates a unique temporary directory. A unique directory name is generated by
* appending six random characters to the end of the provided `prefix`. Due to
@@ -969,30 +956,13 @@ declare module "node:fs/promises" {
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<NonSharedBuffer>;
function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<Buffer>;
/**
* Asynchronously creates a unique temporary directory.
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
function mkdtemp(
prefix: string,
options?: ObjectEncodingOptions | BufferEncoding | null,
): Promise<string | NonSharedBuffer>;
interface DisposableTempDir extends AsyncDisposable {
/**
* The path of the created directory.
*/
path: string;
/**
* A function which removes the created directory.
*/
remove(): Promise<void>;
/**
* The same as `remove`.
*/
[Symbol.asyncDispose](): Promise<void>;
}
function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
/**
* The resulting Promise holds an async-disposable object whose `path` property
* holds the created directory path. When the object is disposed, the directory
@@ -1168,7 +1138,7 @@ declare module "node:fs/promises" {
flag?: OpenMode | undefined;
} & Abortable)
| null,
): Promise<NonSharedBuffer>;
): Promise<Buffer>;
/**
* Asynchronously reads the entire contents of a file.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -1204,7 +1174,7 @@ declare module "node:fs/promises" {
)
| BufferEncoding
| null,
): Promise<string | NonSharedBuffer>;
): Promise<string | Buffer>;
/**
* Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail.
*
@@ -1281,11 +1251,11 @@ declare module "node:fs/promises" {
function watch(
filename: PathLike,
options: WatchOptionsWithBufferEncoding | "buffer",
): NodeJS.AsyncIterator<FileChangeInfo<NonSharedBuffer>>;
): NodeJS.AsyncIterator<FileChangeInfo<Buffer>>;
function watch(
filename: PathLike,
options: WatchOptions | BufferEncoding | "buffer",
): NodeJS.AsyncIterator<FileChangeInfo<string | NonSharedBuffer>>;
): NodeJS.AsyncIterator<FileChangeInfo<string | Buffer>>;
/**
* Asynchronously copies the entire directory structure from `src` to `dest`,
* including subdirectories and files.
@@ -1324,6 +1294,6 @@ declare module "node:fs/promises" {
options: GlobOptions,
): NodeJS.AsyncIterator<Dirent | string>;
}
declare module "fs/promises" {
export * from "node:fs/promises";
declare module "node:fs/promises" {
export * from "fs/promises";
}

View File

@@ -1,6 +1,7 @@
declare var global: typeof globalThis;
declare var process: NodeJS.Process;
declare var console: Console;
interface ErrorConstructor {
/**
@@ -104,6 +105,31 @@ declare namespace NodeJS {
syscall?: string | undefined;
}
interface ReadableStream extends EventEmitter {
readable: boolean;
read(size?: number): string | Buffer;
setEncoding(encoding: BufferEncoding): this;
pause(): this;
resume(): this;
isPaused(): boolean;
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined }): T;
unpipe(destination?: WritableStream): this;
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
wrap(oldStream: ReadableStream): this;
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
}
interface WritableStream extends EventEmitter {
writable: boolean;
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
end(cb?: () => void): this;
end(data: string | Uint8Array, cb?: () => void): this;
end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
}
interface ReadWriteStream extends ReadableStream, WritableStream {}
interface RefCounted {
ref(): this;
unref(): this;
@@ -117,8 +143,6 @@ declare namespace NodeJS {
readonly [key: string]: T | undefined;
}
type PartialOptions<T> = { [K in keyof T]?: T[K] | undefined };
interface GCFunction {
(minor?: boolean): void;
(options: NodeJS.GCOptions & { execution: "async" }): Promise<void>;
@@ -141,10 +165,4 @@ declare namespace NodeJS {
interface AsyncIterator<T, TReturn = undefined, TNext = any> extends AsyncIteratorObject<T, TReturn, TNext> {
[Symbol.asyncIterator](): NodeJS.AsyncIterator<T, TReturn, TNext>;
}
/** The [`BufferSource`](https://webidl.spec.whatwg.org/#BufferSource) type from the Web IDL specification. */
type BufferSource = NonSharedArrayBufferView | ArrayBuffer;
/** The [`AllowSharedBufferSource`](https://webidl.spec.whatwg.org/#AllowSharedBufferSource) type from the Web IDL specification. */
type AllowSharedBufferSource = ArrayBufferView | ArrayBufferLike;
}

View File

@@ -18,84 +18,5 @@ declare global {
type ArrayBufferView<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> =
| TypedArray<TArrayBuffer>
| DataView<TArrayBuffer>;
// The following aliases are required to allow use of non-shared ArrayBufferViews in @types/node
// while maintaining compatibility with TS <=5.6.
// TODO: remove once @types/node no longer supports TS 5.6, and replace with native types.
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedUint8Array = Uint8Array<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedUint8ClampedArray = Uint8ClampedArray<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedUint16Array = Uint16Array<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedUint32Array = Uint32Array<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedInt8Array = Int8Array<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedInt16Array = Int16Array<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedInt32Array = Int32Array<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedBigUint64Array = BigUint64Array<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedBigInt64Array = BigInt64Array<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedFloat16Array = Float16Array<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedFloat32Array = Float32Array<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedFloat64Array = Float64Array<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedDataView = DataView<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedTypedArray = TypedArray<ArrayBuffer>;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedArrayBufferView = ArrayBufferView<ArrayBuffer>;
}
}

607
node_modules/@types/node/http.d.ts generated vendored
View File

@@ -37,15 +37,14 @@
* 'Host', 'example.com',
* 'accepT', '*' ]
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/http.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/http.js)
*/
declare module "node:http" {
import { NonSharedBuffer } from "node:buffer";
import { LookupOptions } from "node:dns";
import { EventEmitter } from "node:events";
import * as net from "node:net";
declare module "http" {
import * as stream from "node:stream";
import { URL } from "node:url";
import { LookupOptions } from "node:dns";
import { EventEmitter } from "node:events";
import { LookupFunction, Server as NetServer, Socket, TcpSocketConnectOpts } from "node:net";
// incoming headers will never contain number
interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
accept?: string | undefined;
@@ -201,7 +200,7 @@ declare module "node:http" {
"x-frame-options"?: string | undefined;
"x-xss-protection"?: string | undefined;
}
interface ClientRequestArgs extends Pick<LookupOptions, "hints"> {
interface ClientRequestArgs {
_defaultAgent?: Agent | undefined;
agent?: Agent | boolean | undefined;
auth?: string | null | undefined;
@@ -214,12 +213,13 @@ declare module "node:http" {
defaultPort?: number | string | undefined;
family?: number | undefined;
headers?: OutgoingHttpHeaders | readonly string[] | undefined;
hints?: LookupOptions["hints"];
host?: string | null | undefined;
hostname?: string | null | undefined;
insecureHTTPParser?: boolean | undefined;
localAddress?: string | undefined;
localPort?: number | undefined;
lookup?: net.LookupFunction | undefined;
lookup?: LookupFunction | undefined;
/**
* @default 16384
*/
@@ -234,7 +234,7 @@ declare module "node:http" {
socketPath?: string | undefined;
timeout?: number | undefined;
uniqueHeaders?: Array<string | string[]> | undefined;
joinDuplicateHeaders?: boolean | undefined;
joinDuplicateHeaders?: boolean;
}
interface ServerOptions<
Request extends typeof IncomingMessage = typeof IncomingMessage,
@@ -260,7 +260,7 @@ declare module "node:http" {
* @default false
* @since v18.14.0
*/
joinDuplicateHeaders?: boolean | undefined;
joinDuplicateHeaders?: boolean;
/**
* The number of milliseconds of inactivity a server needs to wait for additional incoming data,
* after it has finished writing the last response, before a socket will be destroyed.
@@ -269,13 +269,6 @@ declare module "node:http" {
* @since v18.0.0
*/
keepAliveTimeout?: number | undefined;
/**
* An additional buffer time added to the
* `server.keepAliveTimeout` to extend the internal socket timeout.
* @since 24.6.0
* @default 1000
*/
keepAliveTimeoutBuffer?: number | undefined;
/**
* Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests.
* @default 30000
@@ -340,57 +333,24 @@ declare module "node:http" {
* If the header's value is an array, the items will be joined using `; `.
*/
uniqueHeaders?: Array<string | string[]> | undefined;
/**
* A callback which receives an
* incoming request and returns a boolean, to control which upgrade attempts
* should be accepted. Accepted upgrades will fire an `'upgrade'` event (or
* their sockets will be destroyed, if no listener is registered) while
* rejected upgrades will fire a `'request'` event like any non-upgrade
* request.
* @since v24.9.0
* @default () => server.listenerCount('upgrade') > 0
*/
shouldUpgradeCallback?: ((request: InstanceType<Request>) => boolean) | undefined;
/**
* If set to `true`, an error is thrown when writing to an HTTP response which does not have a body.
* @default false
* @since v18.17.0, v20.2.0
*/
rejectNonStandardBodyWrites?: boolean | undefined;
/**
* If set to `true`, requests without `Content-Length`
* or `Transfer-Encoding` headers (indicating no body) will be initialized with an
* already-ended body stream, so they will never emit any stream events
* (like `'data'` or `'end'`). You can use `req.readableEnded` to detect this case.
* @since v25.1.0
* @default false
*/
optimizeEmptyRequests?: boolean | undefined;
}
type RequestListener<
Request extends typeof IncomingMessage = typeof IncomingMessage,
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
> = (request: InstanceType<Request>, response: InstanceType<Response> & { req: InstanceType<Request> }) => void;
interface ServerEventMap<
Request extends typeof IncomingMessage = typeof IncomingMessage,
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
> extends net.ServerEventMap {
"checkContinue": Parameters<RequestListener<Request, Response>>;
"checkExpectation": Parameters<RequestListener<Request, Response>>;
"clientError": [exception: Error, socket: stream.Duplex];
"connect": [request: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer];
"connection": [socket: net.Socket];
"dropRequest": [request: InstanceType<Request>, socket: stream.Duplex];
"request": Parameters<RequestListener<Request, Response>>;
"upgrade": [req: InstanceType<Request>, socket: stream.Duplex, head: NonSharedBuffer];
}
> = (req: InstanceType<Request>, res: InstanceType<Response> & { req: InstanceType<Request> }) => void;
/**
* @since v0.1.17
*/
class Server<
Request extends typeof IncomingMessage = typeof IncomingMessage,
Response extends typeof ServerResponse<InstanceType<Request>> = typeof ServerResponse,
> extends net.Server {
> extends NetServer {
constructor(requestListener?: RequestListener<Request, Response>);
constructor(options: ServerOptions<Request, Response>, requestListener?: RequestListener<Request, Response>);
/**
@@ -407,8 +367,8 @@ declare module "node:http" {
* @since v0.9.12
* @param [msecs=0 (no timeout)]
*/
setTimeout(msecs?: number, callback?: (socket: net.Socket) => void): this;
setTimeout(callback: (socket: net.Socket) => void): this;
setTimeout(msecs?: number, callback?: (socket: Socket) => void): this;
setTimeout(callback: (socket: Socket) => void): this;
/**
* Limits maximum incoming headers count. If set to 0, no limit will be applied.
* @since v0.7.0
@@ -453,18 +413,12 @@ declare module "node:http" {
/**
* The number of milliseconds of inactivity a server needs to wait for additional
* incoming data, after it has finished writing the last response, before a socket
* will be destroyed.
*
* This timeout value is combined with the
* `server.keepAliveTimeoutBuffer` option to determine the actual socket
* timeout, calculated as:
* socketTimeout = keepAliveTimeout + keepAliveTimeoutBuffer
* If the server receives new data before the keep-alive timeout has fired, it
* will reset the regular inactivity timeout, i.e., `server.timeout`.
* will be destroyed. If the server receives new data before the keep-alive
* timeout has fired, it will reset the regular inactivity timeout, i.e., `server.timeout`.
*
* A value of `0` will disable the keep-alive timeout behavior on incoming
* connections.
* A value of `0` makes the HTTP server behave similarly to Node.js versions prior
* A value of `0` makes the http server behave similarly to Node.js versions prior
* to 8.0.0, which did not have a keep-alive timeout.
*
* The socket timeout logic is set up on connection, so changing this value only
@@ -472,18 +426,6 @@ declare module "node:http" {
* @since v8.0.0
*/
keepAliveTimeout: number;
/**
* An additional buffer time added to the
* `server.keepAliveTimeout` to extend the internal socket timeout.
*
* This buffer helps reduce connection reset (`ECONNRESET`) errors by increasing
* the socket timeout slightly beyond the advertised keep-alive timeout.
*
* This option applies only to new incoming connections.
* @since v24.6.0
* @default 1000
*/
keepAliveTimeoutBuffer: number;
/**
* Sets the timeout value in milliseconds for receiving the entire request from
* the client.
@@ -508,64 +450,120 @@ declare module "node:http" {
* @since v18.2.0
*/
closeIdleConnections(): void;
// #region InternalEventEmitter
addListener<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "connection", listener: (socket: Socket) => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "listening", listener: () => void): this;
addListener(event: "checkContinue", listener: RequestListener<Request, Response>): this;
addListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
addListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
addListener(
event: "connect",
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
): this;
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
emit<E extends keyof ServerEventMap>(eventName: E, ...args: ServerEventMap<Request, Response>[E]): boolean;
emit(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<E extends keyof ServerEventMap>(
eventName: E,
listener?: (...args: ServerEventMap<Request, Response>[E]) => void,
): number;
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
listeners<E extends keyof ServerEventMap>(
eventName: E,
): ((...args: ServerEventMap<Request, Response>[E]) => void)[];
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
off<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
addListener(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
addListener(event: "request", listener: RequestListener<Request, Response>): this;
addListener(
event: "upgrade",
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
on<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
emit(event: string, ...args: any[]): boolean;
emit(event: "close"): boolean;
emit(event: "connection", socket: Socket): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "listening"): boolean;
emit(
event: "checkContinue",
req: InstanceType<Request>,
res: InstanceType<Response> & { req: InstanceType<Request> },
): boolean;
emit(
event: "checkExpectation",
req: InstanceType<Request>,
res: InstanceType<Response> & { req: InstanceType<Request> },
): boolean;
emit(event: "clientError", err: Error, socket: stream.Duplex): boolean;
emit(event: "connect", req: InstanceType<Request>, socket: stream.Duplex, head: Buffer): boolean;
emit(event: "dropRequest", req: InstanceType<Request>, socket: stream.Duplex): boolean;
emit(
event: "request",
req: InstanceType<Request>,
res: InstanceType<Response> & { req: InstanceType<Request> },
): boolean;
emit(event: "upgrade", req: InstanceType<Request>, socket: stream.Duplex, head: Buffer): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: () => void): this;
on(event: "connection", listener: (socket: Socket) => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "listening", listener: () => void): this;
on(event: "checkContinue", listener: RequestListener<Request, Response>): this;
on(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
on(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
on(event: "connect", listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
on(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
on(event: "request", listener: RequestListener<Request, Response>): this;
on(event: "upgrade", listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "connection", listener: (socket: Socket) => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "listening", listener: () => void): this;
once(event: "checkContinue", listener: RequestListener<Request, Response>): this;
once(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
once(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
once(
event: "connect",
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
): this;
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
once<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
once(event: "dropRequest", listener: (req: InstanceType<Request>, socket: stream.Duplex) => void): this;
once(event: "request", listener: RequestListener<Request, Response>): this;
once(
event: "upgrade",
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
): this;
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependListener<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "connection", listener: (socket: Socket) => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "listening", listener: () => void): this;
prependListener(event: "checkContinue", listener: RequestListener<Request, Response>): this;
prependListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
prependListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
prependListener(
event: "connect",
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
): this;
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
prependListener(
event: "dropRequest",
listener: (req: InstanceType<Request>, socket: stream.Duplex) => void,
): this;
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
rawListeners<E extends keyof ServerEventMap>(
eventName: E,
): ((...args: ServerEventMap<Request, Response>[E]) => void)[];
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
removeAllListeners<E extends keyof ServerEventMap>(eventName?: E): this;
removeAllListeners(eventName?: string | symbol): this;
removeListener<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
prependListener(event: "request", listener: RequestListener<Request, Response>): this;
prependListener(
event: "upgrade",
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "connection", listener: (socket: Socket) => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "listening", listener: () => void): this;
prependOnceListener(event: "checkContinue", listener: RequestListener<Request, Response>): this;
prependOnceListener(event: "checkExpectation", listener: RequestListener<Request, Response>): this;
prependOnceListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this;
prependOnceListener(
event: "connect",
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
): this;
prependOnceListener(
event: "dropRequest",
listener: (req: InstanceType<Request>, socket: stream.Duplex) => void,
): this;
prependOnceListener(event: "request", listener: RequestListener<Request, Response>): this;
prependOnceListener(
event: "upgrade",
listener: (req: InstanceType<Request>, socket: stream.Duplex, head: Buffer) => void,
): this;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
// #endregion
}
interface OutgoingMessageEventMap extends stream.WritableEventMap {
"prefinish": [];
}
/**
* This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from
@@ -573,7 +571,6 @@ declare module "node:http" {
* @since v0.1.17
*/
class OutgoingMessage<Request extends IncomingMessage = IncomingMessage> extends stream.Writable {
constructor();
readonly req: Request;
chunkedEncoding: boolean;
shouldKeepAlive: boolean;
@@ -593,7 +590,7 @@ declare module "node:http" {
* @since v0.3.0
* @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead.
*/
readonly connection: net.Socket | null;
readonly connection: Socket | null;
/**
* Reference to the underlying socket. Usually, users will not want to access
* this property.
@@ -601,7 +598,8 @@ declare module "node:http" {
* After calling `outgoingMessage.end()`, this property will be nulled.
* @since v0.3.0
*/
readonly socket: net.Socket | null;
readonly socket: Socket | null;
constructor();
/**
* Once a socket is associated with the message and is connected, `socket.setTimeout()` will be called with `msecs` as the first parameter.
* @since v0.9.12
@@ -759,61 +757,6 @@ declare module "node:http" {
* @since v1.6.0
*/
flushHeaders(): void;
// #region InternalEventEmitter
addListener<E extends keyof OutgoingMessageEventMap>(
eventName: E,
listener: (...args: OutgoingMessageEventMap[E]) => void,
): this;
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
emit<E extends keyof OutgoingMessageEventMap>(eventName: E, ...args: OutgoingMessageEventMap[E]): boolean;
emit(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<E extends keyof OutgoingMessageEventMap>(
eventName: E,
listener?: (...args: OutgoingMessageEventMap[E]) => void,
): number;
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
listeners<E extends keyof OutgoingMessageEventMap>(
eventName: E,
): ((...args: OutgoingMessageEventMap[E]) => void)[];
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
off<E extends keyof OutgoingMessageEventMap>(
eventName: E,
listener: (...args: OutgoingMessageEventMap[E]) => void,
): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
on<E extends keyof OutgoingMessageEventMap>(
eventName: E,
listener: (...args: OutgoingMessageEventMap[E]) => void,
): this;
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
once<E extends keyof OutgoingMessageEventMap>(
eventName: E,
listener: (...args: OutgoingMessageEventMap[E]) => void,
): this;
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependListener<E extends keyof OutgoingMessageEventMap>(
eventName: E,
listener: (...args: OutgoingMessageEventMap[E]) => void,
): this;
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener<E extends keyof OutgoingMessageEventMap>(
eventName: E,
listener: (...args: OutgoingMessageEventMap[E]) => void,
): this;
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
rawListeners<E extends keyof OutgoingMessageEventMap>(
eventName: E,
): ((...args: OutgoingMessageEventMap[E]) => void)[];
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
removeAllListeners<E extends keyof OutgoingMessageEventMap>(eventName?: E): this;
removeAllListeners(eventName?: string | symbol): this;
removeListener<E extends keyof OutgoingMessageEventMap>(
eventName: E,
listener: (...args: OutgoingMessageEventMap[E]) => void,
): this;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
// #endregion
}
/**
* This object is created internally by an HTTP server, not by the user. It is
@@ -858,8 +801,8 @@ declare module "node:http" {
*/
strictContentLength: boolean;
constructor(req: Request);
assignSocket(socket: net.Socket): void;
detachSocket(socket: net.Socket): void;
assignSocket(socket: Socket): void;
detachSocket(socket: Socket): void;
/**
* Sends an HTTP/1.1 100 Continue message to the client, indicating that
* the request body should be sent. See the `'checkContinue'` event on `Server`.
@@ -971,25 +914,14 @@ declare module "node:http" {
writeProcessing(callback?: () => void): void;
}
interface InformationEvent {
statusCode: number;
statusMessage: string;
httpVersion: string;
httpVersionMajor: number;
httpVersionMinor: number;
statusCode: number;
statusMessage: string;
headers: IncomingHttpHeaders;
rawHeaders: string[];
}
interface ClientRequestEventMap extends stream.WritableEventMap {
/** @deprecated Listen for the `'close'` event instead. */
"abort": [];
"connect": [response: IncomingMessage, socket: net.Socket, head: NonSharedBuffer];
"continue": [];
"information": [info: InformationEvent];
"response": [response: IncomingMessage];
"socket": [socket: net.Socket];
"timeout": [];
"upgrade": [response: IncomingMessage, socket: net.Socket, head: NonSharedBuffer];
}
/**
* This object is created internally and returned from {@link request}. It
* represents an _in-progress_ request whose header has already been queued. The
@@ -1046,7 +978,6 @@ declare module "node:http" {
*
* ```js
* import http from 'node:http';
* const agent = new http.Agent({ keepAlive: true });
*
* // Server has a 5 seconds keep-alive timeout by default
* http
@@ -1113,7 +1044,7 @@ declare module "node:http" {
* @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead.
*/
abort(): void;
onSocket(socket: net.Socket): void;
onSocket(socket: Socket): void;
/**
* Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called.
* @since v0.5.9
@@ -1145,63 +1076,114 @@ declare module "node:http" {
* @since v15.13.0, v14.17.0
*/
getRawHeaderNames(): string[];
// #region InternalEventEmitter
addListener<E extends keyof ClientRequestEventMap>(
eventName: E,
listener: (...args: ClientRequestEventMap[E]) => void,
/**
* @deprecated
*/
addListener(event: "abort", listener: () => void): this;
addListener(
event: "connect",
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
): this;
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
emit<E extends keyof ClientRequestEventMap>(eventName: E, ...args: ClientRequestEventMap[E]): boolean;
emit(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<E extends keyof ClientRequestEventMap>(
eventName: E,
listener?: (...args: ClientRequestEventMap[E]) => void,
): number;
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
listeners<E extends keyof ClientRequestEventMap>(eventName: E): ((...args: ClientRequestEventMap[E]) => void)[];
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
off<E extends keyof ClientRequestEventMap>(
eventName: E,
listener: (...args: ClientRequestEventMap[E]) => void,
addListener(event: "continue", listener: () => void): this;
addListener(event: "information", listener: (info: InformationEvent) => void): this;
addListener(event: "response", listener: (response: IncomingMessage) => void): this;
addListener(event: "socket", listener: (socket: Socket) => void): this;
addListener(event: "timeout", listener: () => void): this;
addListener(
event: "upgrade",
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
on<E extends keyof ClientRequestEventMap>(
eventName: E,
listener: (...args: ClientRequestEventMap[E]) => void,
addListener(event: "close", listener: () => void): this;
addListener(event: "drain", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "finish", listener: () => void): this;
addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
/**
* @deprecated
*/
on(event: "abort", listener: () => void): this;
on(event: "connect", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
on(event: "continue", listener: () => void): this;
on(event: "information", listener: (info: InformationEvent) => void): this;
on(event: "response", listener: (response: IncomingMessage) => void): this;
on(event: "socket", listener: (socket: Socket) => void): this;
on(event: "timeout", listener: () => void): this;
on(event: "upgrade", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
on(event: "close", listener: () => void): this;
on(event: "drain", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "finish", listener: () => void): this;
on(event: "pipe", listener: (src: stream.Readable) => void): this;
on(event: "unpipe", listener: (src: stream.Readable) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
/**
* @deprecated
*/
once(event: "abort", listener: () => void): this;
once(event: "connect", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
once(event: "continue", listener: () => void): this;
once(event: "information", listener: (info: InformationEvent) => void): this;
once(event: "response", listener: (response: IncomingMessage) => void): this;
once(event: "socket", listener: (socket: Socket) => void): this;
once(event: "timeout", listener: () => void): this;
once(event: "upgrade", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
once(event: "close", listener: () => void): this;
once(event: "drain", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "finish", listener: () => void): this;
once(event: "pipe", listener: (src: stream.Readable) => void): this;
once(event: "unpipe", listener: (src: stream.Readable) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
/**
* @deprecated
*/
prependListener(event: "abort", listener: () => void): this;
prependListener(
event: "connect",
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
): this;
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
once<E extends keyof ClientRequestEventMap>(
eventName: E,
listener: (...args: ClientRequestEventMap[E]) => void,
prependListener(event: "continue", listener: () => void): this;
prependListener(event: "information", listener: (info: InformationEvent) => void): this;
prependListener(event: "response", listener: (response: IncomingMessage) => void): this;
prependListener(event: "socket", listener: (socket: Socket) => void): this;
prependListener(event: "timeout", listener: () => void): this;
prependListener(
event: "upgrade",
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
): this;
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependListener<E extends keyof ClientRequestEventMap>(
eventName: E,
listener: (...args: ClientRequestEventMap[E]) => void,
prependListener(event: "close", listener: () => void): this;
prependListener(event: "drain", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "finish", listener: () => void): this;
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
/**
* @deprecated
*/
prependOnceListener(event: "abort", listener: () => void): this;
prependOnceListener(
event: "connect",
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
): this;
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener<E extends keyof ClientRequestEventMap>(
eventName: E,
listener: (...args: ClientRequestEventMap[E]) => void,
prependOnceListener(event: "continue", listener: () => void): this;
prependOnceListener(event: "information", listener: (info: InformationEvent) => void): this;
prependOnceListener(event: "response", listener: (response: IncomingMessage) => void): this;
prependOnceListener(event: "socket", listener: (socket: Socket) => void): this;
prependOnceListener(event: "timeout", listener: () => void): this;
prependOnceListener(
event: "upgrade",
listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void,
): this;
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
rawListeners<E extends keyof ClientRequestEventMap>(
eventName: E,
): ((...args: ClientRequestEventMap[E]) => void)[];
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
removeAllListeners<E extends keyof ClientRequestEventMap>(eventName?: E): this;
removeAllListeners(eventName?: string | symbol): this;
removeListener<E extends keyof ClientRequestEventMap>(
eventName: E,
listener: (...args: ClientRequestEventMap[E]) => void,
): this;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
// #endregion
}
interface IncomingMessageEventMap extends stream.ReadableEventMap {
/** @deprecated Listen for `'close'` event instead. */
"aborted": [];
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "drain", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "finish", listener: () => void): this;
prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
/**
* An `IncomingMessage` object is created by {@link Server} or {@link ClientRequest} and passed as the first argument to the `'request'` and `'response'` event respectively. It may be used to
@@ -1214,7 +1196,7 @@ declare module "node:http" {
* @since v0.1.17
*/
class IncomingMessage extends stream.Readable {
constructor(socket: net.Socket);
constructor(socket: Socket);
/**
* The `message.aborted` property will be `true` if the request has
* been aborted.
@@ -1262,7 +1244,7 @@ declare module "node:http" {
* @since v0.1.90
* @deprecated Since v16.0.0 - Use `socket`.
*/
connection: net.Socket;
connection: Socket;
/**
* The `net.Socket` object associated with the connection.
*
@@ -1274,7 +1256,7 @@ declare module "node:http" {
* type other than `net.Socket` or internally nulled.
* @since v0.3.0
*/
socket: net.Socket;
socket: Socket;
/**
* The request/response headers object.
*
@@ -1436,61 +1418,6 @@ declare module "node:http" {
* @since v0.3.0
*/
destroy(error?: Error): this;
// #region InternalEventEmitter
addListener<E extends keyof IncomingMessageEventMap>(
eventName: E,
listener: (...args: IncomingMessageEventMap[E]) => void,
): this;
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
emit<E extends keyof IncomingMessageEventMap>(eventName: E, ...args: IncomingMessageEventMap[E]): boolean;
emit(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<E extends keyof IncomingMessageEventMap>(
eventName: E,
listener?: (...args: IncomingMessageEventMap[E]) => void,
): number;
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
listeners<E extends keyof IncomingMessageEventMap>(
eventName: E,
): ((...args: IncomingMessageEventMap[E]) => void)[];
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
off<E extends keyof IncomingMessageEventMap>(
eventName: E,
listener: (...args: IncomingMessageEventMap[E]) => void,
): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
on<E extends keyof IncomingMessageEventMap>(
eventName: E,
listener: (...args: IncomingMessageEventMap[E]) => void,
): this;
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
once<E extends keyof IncomingMessageEventMap>(
eventName: E,
listener: (...args: IncomingMessageEventMap[E]) => void,
): this;
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependListener<E extends keyof IncomingMessageEventMap>(
eventName: E,
listener: (...args: IncomingMessageEventMap[E]) => void,
): this;
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener<E extends keyof IncomingMessageEventMap>(
eventName: E,
listener: (...args: IncomingMessageEventMap[E]) => void,
): this;
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
rawListeners<E extends keyof IncomingMessageEventMap>(
eventName: E,
): ((...args: IncomingMessageEventMap[E]) => void)[];
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
removeAllListeners<E extends keyof IncomingMessageEventMap>(eventName?: E): this;
removeAllListeners(eventName?: string | symbol): this;
removeListener<E extends keyof IncomingMessageEventMap>(
eventName: E,
listener: (...args: IncomingMessageEventMap[E]) => void,
): this;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
// #endregion
}
interface ProxyEnv extends NodeJS.ProcessEnv {
HTTP_PROXY?: string | undefined;
@@ -1500,7 +1427,7 @@ declare module "node:http" {
https_proxy?: string | undefined;
no_proxy?: string | undefined;
}
interface AgentOptions extends NodeJS.PartialOptions<net.TcpSocketConnectOpts> {
interface AgentOptions extends Partial<TcpSocketConnectOpts> {
/**
* Keep sockets around in a pool to be used by other requests in the future. Default = false
*/
@@ -1510,16 +1437,6 @@ declare module "node:http" {
* Only relevant if keepAlive is set to true.
*/
keepAliveMsecs?: number | undefined;
/**
* Milliseconds to subtract from
* the server-provided `keep-alive: timeout=...` hint when determining socket
* expiration time. This buffer helps ensure the agent closes the socket
* slightly before the server does, reducing the chance of sending a request
* on a socket thats about to be closed by the server.
* @since v24.7.0
* @default 1000
*/
agentKeepAliveTimeoutBuffer?: number | undefined;
/**
* Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
*/
@@ -1543,7 +1460,7 @@ declare module "node:http" {
scheduling?: "fifo" | "lifo" | undefined;
/**
* Environment variables for proxy configuration. See
* [Built-in Proxy Support](https://nodejs.org/docs/latest-v25.x/api/http.html#built-in-proxy-support) for details.
* [Built-in Proxy Support](https://nodejs.org/docs/latest-v24.x/api/http.html#built-in-proxy-support) for details.
* @since v24.5.0
*/
proxyEnv?: ProxyEnv | undefined;
@@ -1612,7 +1529,7 @@ declare module "node:http" {
* });
* ```
*
* `options` in [`socket.connect()`](https://nodejs.org/docs/latest-v25.x/api/net.html#socketconnectoptions-connectlistener) are also supported.
* `options` in [`socket.connect()`](https://nodejs.org/docs/latest-v24.x/api/net.html#socketconnectoptions-connectlistener) are also supported.
*
* To configure any of them, a custom {@link Agent} instance must be created.
*
@@ -1652,19 +1569,19 @@ declare module "node:http" {
* removed from the array on `'timeout'`.
* @since v0.11.4
*/
readonly freeSockets: NodeJS.ReadOnlyDict<net.Socket[]>;
readonly freeSockets: NodeJS.ReadOnlyDict<Socket[]>;
/**
* An object which contains arrays of sockets currently in use by the
* agent. Do not modify.
* @since v0.3.6
*/
readonly sockets: NodeJS.ReadOnlyDict<net.Socket[]>;
readonly sockets: NodeJS.ReadOnlyDict<Socket[]>;
/**
* An object which contains queues of requests that have not yet been assigned to
* sockets. Do not modify.
* @since v0.5.9
*/
readonly requests: NodeJS.ReadOnlyDict<ClientRequest[]>;
readonly requests: NodeJS.ReadOnlyDict<IncomingMessage[]>;
constructor(opts?: AgentOptions);
/**
* Destroy any sockets that are currently in use by the agent.
@@ -1680,34 +1597,20 @@ declare module "node:http" {
/**
* Produces a socket/stream to be used for HTTP requests.
*
* By default, this function behaves identically to `net.createConnection()`,
* synchronously returning the created socket. The optional `callback` parameter in the
* signature is **not** used by this default implementation.
* By default, this function is the same as `net.createConnection()`. However,
* custom agents may override this method in case greater flexibility is desired.
*
* However, custom agents may override this method to provide greater flexibility,
* for example, to create sockets asynchronously. When overriding `createConnection`:
* A socket/stream can be supplied in one of two ways: by returning the
* socket/stream from this function, or by passing the socket/stream to `callback`.
*
* 1. **Synchronous socket creation**: The overriding method can return the
* socket/stream directly.
* 2. **Asynchronous socket creation**: The overriding method can accept the `callback`
* and pass the created socket/stream to it (e.g., `callback(null, newSocket)`).
* If an error occurs during socket creation, it should be passed as the first
* argument to the `callback` (e.g., `callback(err)`).
* This method is guaranteed to return an instance of the `net.Socket` class,
* a subclass of `stream.Duplex`, unless the user specifies a socket
* type other than `net.Socket`.
*
* The agent will call the provided `createConnection` function with `options` and
* this internal `callback`. The `callback` provided by the agent has a signature
* of `(err, stream)`.
* `callback` has a signature of `(err, stream)`.
* @since v0.11.4
* @param options Options containing connection details. Check
* `net.createConnection` for the format of the options. For custom agents,
* this object is passed to the custom `createConnection` function.
* @param callback (Optional, primarily for custom agents) A function to be
* called by a custom `createConnection` implementation when the socket is
* created, especially for asynchronous operations.
* @returns The created socket. This is returned by the default
* implementation or by a custom synchronous `createConnection` implementation.
* If a custom `createConnection` uses the `callback` for asynchronous
* operation, this return value might not be the primary way to obtain the socket.
* @param options Options containing connection details. Check `createConnection` for the format of the options
* @param callback Callback function that receives the created socket
*/
createConnection(
options: ClientRequestArgs,
@@ -2162,6 +2065,6 @@ declare module "node:http" {
*/
const MessageEvent: typeof import("undici-types").MessageEvent;
}
declare module "http" {
export * from "node:http";
declare module "node:http" {
export * from "http";
}

1264
node_modules/@types/node/http2.d.ts generated vendored

File diff suppressed because it is too large Load Diff

293
node_modules/@types/node/https.d.ts generated vendored
View File

@@ -1,35 +1,32 @@
/**
* HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
* separate module.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/https.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/https.js)
*/
declare module "node:https" {
import * as http from "node:http";
declare module "https" {
import { Duplex } from "node:stream";
import * as tls from "node:tls";
import * as http from "node:http";
import { URL } from "node:url";
interface ServerOptions<
type ServerOptions<
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
> extends http.ServerOptions<Request, Response>, tls.TlsOptions {}
interface RequestOptions extends http.RequestOptions, tls.SecureContextOptions {
checkServerIdentity?:
| ((hostname: string, cert: tls.DetailedPeerCertificate) => Error | undefined)
| undefined;
rejectUnauthorized?: boolean | undefined; // Defaults to true
servername?: string | undefined; // SNI TLS Extension
}
> = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions<Request, Response>;
type RequestOptions =
& http.RequestOptions
& tls.SecureContextOptions
& {
checkServerIdentity?:
| ((hostname: string, cert: tls.DetailedPeerCertificate) => Error | undefined)
| undefined;
rejectUnauthorized?: boolean | undefined; // Defaults to true
servername?: string | undefined; // SNI TLS Extension
};
interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
maxCachedSessions?: number | undefined;
}
/**
* An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information.
*
* Like `http.Agent`, the `createConnection(options[, callback])` method can be overridden
* to customize how TLS connections are established.
*
* > See `agent.createConnection()` for details on overriding this method,
* > including asynchronous socket creation with a callback.
* @since v0.4.5
*/
class Agent extends http.Agent {
@@ -41,10 +38,10 @@ declare module "node:https" {
): Duplex | null | undefined;
getName(options?: RequestOptions): string;
}
interface ServerEventMap<
interface Server<
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
> extends http.ServerEventMap<Request, Response>, tls.ServerEventMap {}
> extends http.Server<Request, Response> {}
/**
* See `http.Server` for more information.
* @since v0.3.4
@@ -68,66 +65,214 @@ declare module "node:https" {
* @since v18.2.0
*/
closeIdleConnections(): void;
// #region InternalEventEmitter
addListener<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
addListener(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
emit<E extends keyof ServerEventMap>(eventName: E, ...args: ServerEventMap<Request, Response>[E]): boolean;
emit(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<E extends keyof ServerEventMap>(
eventName: E,
listener?: (...args: ServerEventMap<Request, Response>[E]) => void,
): number;
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
listeners<E extends keyof ServerEventMap>(
eventName: E,
): ((...args: ServerEventMap<Request, Response>[E]) => void)[];
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
off<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
addListener(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
on<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
addListener(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
): this;
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
once<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
addListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "connection", listener: (socket: Duplex) => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "listening", listener: () => void): this;
addListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
addListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
addListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
addListener(
event: "connect",
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependListener<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
addListener(event: "request", listener: http.RequestListener<Request, Response>): this;
addListener(
event: "upgrade",
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
emit(event: string, ...args: any[]): boolean;
emit(event: "keylog", line: Buffer, tlsSocket: tls.TLSSocket): boolean;
emit(
event: "newSession",
sessionId: Buffer,
sessionData: Buffer,
callback: (err: Error, resp: Buffer) => void,
): boolean;
emit(
event: "OCSPRequest",
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
): boolean;
emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean;
emit(event: "secureConnection", tlsSocket: tls.TLSSocket): boolean;
emit(event: "tlsClientError", err: Error, tlsSocket: tls.TLSSocket): boolean;
emit(event: "close"): boolean;
emit(event: "connection", socket: Duplex): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "listening"): boolean;
emit(
event: "checkContinue",
req: InstanceType<Request>,
res: InstanceType<Response>,
): boolean;
emit(
event: "checkExpectation",
req: InstanceType<Request>,
res: InstanceType<Response>,
): boolean;
emit(event: "clientError", err: Error, socket: Duplex): boolean;
emit(event: "connect", req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
emit(
event: "request",
req: InstanceType<Request>,
res: InstanceType<Response>,
): boolean;
emit(event: "upgrade", req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
on(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
rawListeners<E extends keyof ServerEventMap>(
eventName: E,
): ((...args: ServerEventMap<Request, Response>[E]) => void)[];
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
removeAllListeners<E extends keyof ServerEventMap>(eventName?: E): this;
removeAllListeners(eventName?: string | symbol): this;
removeListener<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
on(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
on(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
): this;
on(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
on(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
on(event: "close", listener: () => void): this;
on(event: "connection", listener: (socket: Duplex) => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "listening", listener: () => void): this;
on(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
on(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
on(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
on(event: "connect", listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
on(event: "request", listener: http.RequestListener<Request, Response>): this;
on(event: "upgrade", listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
once(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
once(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
once(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
): this;
once(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
once(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
once(event: "close", listener: () => void): this;
once(event: "connection", listener: (socket: Duplex) => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "listening", listener: () => void): this;
once(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
once(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
once(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
once(event: "connect", listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
once(event: "request", listener: http.RequestListener<Request, Response>): this;
once(event: "upgrade", listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
prependListener(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
prependListener(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
prependListener(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
): this;
prependListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "connection", listener: (socket: Duplex) => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "listening", listener: () => void): this;
prependListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
prependListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
prependListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
prependListener(
event: "connect",
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
prependListener(event: "request", listener: http.RequestListener<Request, Response>): this;
prependListener(
event: "upgrade",
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
prependOnceListener(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
prependOnceListener(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
prependOnceListener(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
): this;
prependOnceListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "connection", listener: (socket: Duplex) => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "listening", listener: () => void): this;
prependOnceListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
prependOnceListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
prependOnceListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
prependOnceListener(
event: "connect",
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
prependOnceListener(event: "request", listener: http.RequestListener<Request, Response>): this;
prependOnceListener(
event: "upgrade",
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
// #endregion
}
interface Server<
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
> extends http.Server<Request, Response> {}
/**
* ```js
* // curl -k https://localhost:8000/
@@ -400,6 +545,6 @@ declare module "node:https" {
): http.ClientRequest;
let globalAgent: Agent;
}
declare module "https" {
export * from "node:https";
declare module "node:https" {
export * from "https";
}

18
node_modules/@types/node/index.d.ts generated vendored
View File

@@ -39,21 +39,11 @@
// Definitions for Node.js modules that are not specific to any version of TypeScript:
/// <reference path="globals.d.ts" />
/// <reference path="web-globals/abortcontroller.d.ts" />
/// <reference path="web-globals/blob.d.ts" />
/// <reference path="web-globals/console.d.ts" />
/// <reference path="web-globals/crypto.d.ts" />
/// <reference path="web-globals/domexception.d.ts" />
/// <reference path="web-globals/encoding.d.ts" />
/// <reference path="web-globals/events.d.ts" />
/// <reference path="web-globals/fetch.d.ts" />
/// <reference path="web-globals/importmeta.d.ts" />
/// <reference path="web-globals/messaging.d.ts" />
/// <reference path="web-globals/navigator.d.ts" />
/// <reference path="web-globals/performance.d.ts" />
/// <reference path="web-globals/storage.d.ts" />
/// <reference path="web-globals/streams.d.ts" />
/// <reference path="web-globals/timers.d.ts" />
/// <reference path="web-globals/url.d.ts" />
/// <reference path="assert.d.ts" />
/// <reference path="assert/strict.d.ts" />
/// <reference path="async_hooks.d.ts" />
@@ -76,30 +66,25 @@
/// <reference path="https.d.ts" />
/// <reference path="inspector.d.ts" />
/// <reference path="inspector.generated.d.ts" />
/// <reference path="inspector/promises.d.ts" />
/// <reference path="module.d.ts" />
/// <reference path="net.d.ts" />
/// <reference path="os.d.ts" />
/// <reference path="path.d.ts" />
/// <reference path="path/posix.d.ts" />
/// <reference path="path/win32.d.ts" />
/// <reference path="perf_hooks.d.ts" />
/// <reference path="process.d.ts" />
/// <reference path="punycode.d.ts" />
/// <reference path="querystring.d.ts" />
/// <reference path="quic.d.ts" />
/// <reference path="readline.d.ts" />
/// <reference path="readline/promises.d.ts" />
/// <reference path="repl.d.ts" />
/// <reference path="sea.d.ts" />
/// <reference path="sqlite.d.ts" />
/// <reference path="stream.d.ts" />
/// <reference path="stream/consumers.d.ts" />
/// <reference path="stream/promises.d.ts" />
/// <reference path="stream/consumers.d.ts" />
/// <reference path="stream/web.d.ts" />
/// <reference path="string_decoder.d.ts" />
/// <reference path="test.d.ts" />
/// <reference path="test/reporters.d.ts" />
/// <reference path="timers.d.ts" />
/// <reference path="timers/promises.d.ts" />
/// <reference path="tls.d.ts" />
@@ -107,7 +92,6 @@
/// <reference path="tty.d.ts" />
/// <reference path="url.d.ts" />
/// <reference path="util.d.ts" />
/// <reference path="util/types.d.ts" />
/// <reference path="v8.d.ts" />
/// <reference path="vm.d.ts" />
/// <reference path="wasi.d.ts" />

View File

@@ -1,10 +1,10 @@
/**
* The `node:inspector` module provides an API for interacting with the V8
* inspector.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/inspector.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/inspector.js)
*/
declare module "node:inspector" {
import { EventEmitter } from "node:events";
declare module "inspector" {
import EventEmitter = require("node:events");
/**
* The `inspector.Session` is used for dispatching messages to the V8 inspector
* back-end and receiving message responses and notifications.
@@ -39,7 +39,7 @@ declare module "node:inspector" {
* If wait is `true`, will block until a client has connected to the inspect port
* and flow control has been passed to the debugger client.
*
* See the [security warning](https://nodejs.org/docs/latest-v25.x/api/cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure)
* See the [security warning](https://nodejs.org/docs/latest-v24.x/api/cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure)
* regarding the `host` parameter usage.
* @param port Port to listen on for inspector connections. Defaults to what was specified on the CLI.
* @param host Host to listen on for inspector connections. Defaults to what was specified on the CLI.
@@ -159,30 +159,6 @@ declare module "node:inspector" {
* @since v22.7.0
*/
function loadingFailed(params: LoadingFailedEventDataType): void;
/**
* This feature is only available with the `--experimental-network-inspection` flag enabled.
*
* Broadcasts the `Network.webSocketCreated` event to connected frontends. This event indicates that
* a WebSocket connection has been initiated.
* @since v24.7.0
*/
function webSocketCreated(params: WebSocketCreatedEventDataType): void;
/**
* This feature is only available with the `--experimental-network-inspection` flag enabled.
*
* Broadcasts the `Network.webSocketHandshakeResponseReceived` event to connected frontends.
* This event indicates that the WebSocket handshake response has been received.
* @since v24.7.0
*/
function webSocketHandshakeResponseReceived(params: WebSocketHandshakeResponseReceivedEventDataType): void;
/**
* This feature is only available with the `--experimental-network-inspection` flag enabled.
*
* Broadcasts the `Network.webSocketClosed` event to connected frontends.
* This event indicates that a WebSocket connection has been closed.
* @since v24.7.0
*/
function webSocketClosed(params: WebSocketClosedEventDataType): void;
}
namespace NetworkResources {
/**
@@ -219,6 +195,59 @@ declare module "node:inspector" {
function put(url: string, data: string): void;
}
}
declare module "inspector" {
export * from "node:inspector";
/**
* The `node:inspector` module provides an API for interacting with the V8
* inspector.
*/
declare module "node:inspector" {
export * from "inspector";
}
/**
* The `node:inspector/promises` module provides an API for interacting with the V8
* inspector.
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/inspector/promises.js)
* @since v19.0.0
*/
declare module "inspector/promises" {
import EventEmitter = require("node:events");
export { close, console, NetworkResources, open, url, waitForDebugger } from "inspector";
/**
* The `inspector.Session` is used for dispatching messages to the V8 inspector
* back-end and receiving message responses and notifications.
* @since v19.0.0
*/
export class Session extends EventEmitter {
/**
* Create a new instance of the inspector.Session class.
* The inspector session needs to be connected through `session.connect()` before the messages can be dispatched to the inspector backend.
*/
constructor();
/**
* Connects a session to the inspector back-end.
*/
connect(): void;
/**
* Connects a session to the inspector back-end.
* An exception will be thrown if this API was not called on a Worker thread.
* @since v12.11.0
*/
connectToMainThread(): void;
/**
* Immediately close the session. All pending message callbacks will be called with an error.
* `session.connect()` will need to be called to be able to send messages again.
* Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints.
*/
disconnect(): void;
}
}
/**
* The `node:inspector/promises` module provides an API for interacting with the V8
* inspector.
* @since v19.0.0
*/
declare module "node:inspector/promises" {
export * from "inspector/promises";
}

View File

@@ -3,11 +3,12 @@
// See scripts/generate-inspector/README.md for information on how to update the protocol definitions.
// Changes to the module itself should be added to the generator template (scripts/generate-inspector/inspector.d.ts.template).
declare module "node:inspector" {
declare module "inspector" {
interface InspectorNotification<T> {
method: string;
params: T;
}
namespace Schema {
/**
* Description of the protocol domain.
@@ -1773,23 +1774,6 @@ declare module "node:inspector" {
success: boolean;
stream?: IO.StreamHandle | undefined;
}
/**
* WebSocket response data.
*/
interface WebSocketResponse {
/**
* HTTP response status code.
*/
status: number;
/**
* HTTP response status text.
*/
statusText: string;
/**
* HTTP response headers.
*/
headers: Headers;
}
interface GetRequestPostDataParameterType {
/**
* Identifier of the network request to get content for.
@@ -1930,44 +1914,6 @@ declare module "node:inspector" {
*/
data?: string | undefined;
}
interface WebSocketCreatedEventDataType {
/**
* Request identifier.
*/
requestId: RequestId;
/**
* WebSocket request URL.
*/
url: string;
/**
* Request initiator.
*/
initiator: Initiator;
}
interface WebSocketClosedEventDataType {
/**
* Request identifier.
*/
requestId: RequestId;
/**
* Timestamp.
*/
timestamp: MonotonicTime;
}
interface WebSocketHandshakeResponseReceivedEventDataType {
/**
* Request identifier.
*/
requestId: RequestId;
/**
* Timestamp.
*/
timestamp: MonotonicTime;
/**
* WebSocket response data.
*/
response: WebSocketResponse;
}
}
namespace NodeRuntime {
interface NotifyWhenWaitingForDisconnectParameterType {
@@ -2032,6 +1978,7 @@ declare module "node:inspector" {
eof: boolean;
}
}
interface Session {
/**
* Posts a message to the inspector back-end. `callback` will be notified when
@@ -2426,6 +2373,7 @@ declare module "node:inspector" {
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;
/**
* Emitted when any notification from the V8 Inspector is received.
@@ -2535,18 +2483,6 @@ declare module "node:inspector" {
* Fired when data chunk was received over the network.
*/
addListener(event: "Network.dataReceived", listener: (message: InspectorNotification<Network.DataReceivedEventDataType>) => void): this;
/**
* Fired upon WebSocket creation.
*/
addListener(event: "Network.webSocketCreated", listener: (message: InspectorNotification<Network.WebSocketCreatedEventDataType>) => void): this;
/**
* Fired when WebSocket is closed.
*/
addListener(event: "Network.webSocketClosed", listener: (message: InspectorNotification<Network.WebSocketClosedEventDataType>) => void): this;
/**
* Fired when WebSocket handshake response becomes available.
*/
addListener(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification<Network.WebSocketHandshakeResponseReceivedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -2593,9 +2529,6 @@ declare module "node:inspector" {
emit(event: "Network.loadingFailed", message: InspectorNotification<Network.LoadingFailedEventDataType>): boolean;
emit(event: "Network.loadingFinished", message: InspectorNotification<Network.LoadingFinishedEventDataType>): boolean;
emit(event: "Network.dataReceived", message: InspectorNotification<Network.DataReceivedEventDataType>): boolean;
emit(event: "Network.webSocketCreated", message: InspectorNotification<Network.WebSocketCreatedEventDataType>): boolean;
emit(event: "Network.webSocketClosed", message: InspectorNotification<Network.WebSocketClosedEventDataType>): boolean;
emit(event: "Network.webSocketHandshakeResponseReceived", message: InspectorNotification<Network.WebSocketHandshakeResponseReceivedEventDataType>): boolean;
emit(event: "NodeRuntime.waitingForDisconnect"): boolean;
emit(event: "NodeRuntime.waitingForDebugger"): boolean;
emit(event: "Target.targetCreated", message: InspectorNotification<Target.TargetCreatedEventDataType>): boolean;
@@ -2709,18 +2642,6 @@ declare module "node:inspector" {
* Fired when data chunk was received over the network.
*/
on(event: "Network.dataReceived", listener: (message: InspectorNotification<Network.DataReceivedEventDataType>) => void): this;
/**
* Fired upon WebSocket creation.
*/
on(event: "Network.webSocketCreated", listener: (message: InspectorNotification<Network.WebSocketCreatedEventDataType>) => void): this;
/**
* Fired when WebSocket is closed.
*/
on(event: "Network.webSocketClosed", listener: (message: InspectorNotification<Network.WebSocketClosedEventDataType>) => void): this;
/**
* Fired when WebSocket handshake response becomes available.
*/
on(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification<Network.WebSocketHandshakeResponseReceivedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -2844,18 +2765,6 @@ declare module "node:inspector" {
* Fired when data chunk was received over the network.
*/
once(event: "Network.dataReceived", listener: (message: InspectorNotification<Network.DataReceivedEventDataType>) => void): this;
/**
* Fired upon WebSocket creation.
*/
once(event: "Network.webSocketCreated", listener: (message: InspectorNotification<Network.WebSocketCreatedEventDataType>) => void): this;
/**
* Fired when WebSocket is closed.
*/
once(event: "Network.webSocketClosed", listener: (message: InspectorNotification<Network.WebSocketClosedEventDataType>) => void): this;
/**
* Fired when WebSocket handshake response becomes available.
*/
once(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification<Network.WebSocketHandshakeResponseReceivedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -2979,18 +2888,6 @@ declare module "node:inspector" {
* Fired when data chunk was received over the network.
*/
prependListener(event: "Network.dataReceived", listener: (message: InspectorNotification<Network.DataReceivedEventDataType>) => void): this;
/**
* Fired upon WebSocket creation.
*/
prependListener(event: "Network.webSocketCreated", listener: (message: InspectorNotification<Network.WebSocketCreatedEventDataType>) => void): this;
/**
* Fired when WebSocket is closed.
*/
prependListener(event: "Network.webSocketClosed", listener: (message: InspectorNotification<Network.WebSocketClosedEventDataType>) => void): this;
/**
* Fired when WebSocket handshake response becomes available.
*/
prependListener(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification<Network.WebSocketHandshakeResponseReceivedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -3114,18 +3011,6 @@ declare module "node:inspector" {
* Fired when data chunk was received over the network.
*/
prependOnceListener(event: "Network.dataReceived", listener: (message: InspectorNotification<Network.DataReceivedEventDataType>) => void): this;
/**
* Fired upon WebSocket creation.
*/
prependOnceListener(event: "Network.webSocketCreated", listener: (message: InspectorNotification<Network.WebSocketCreatedEventDataType>) => void): this;
/**
* Fired when WebSocket is closed.
*/
prependOnceListener(event: "Network.webSocketClosed", listener: (message: InspectorNotification<Network.WebSocketClosedEventDataType>) => void): this;
/**
* Fired when WebSocket handshake response becomes available.
*/
prependOnceListener(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification<Network.WebSocketHandshakeResponseReceivedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -3142,7 +3027,8 @@ declare module "node:inspector" {
prependOnceListener(event: "Target.attachedToTarget", listener: (message: InspectorNotification<Target.AttachedToTargetEventDataType>) => void): this;
}
}
declare module "node:inspector/promises" {
declare module "inspector/promises" {
export {
Schema,
Runtime,
@@ -3158,7 +3044,8 @@ declare module "node:inspector/promises" {
IO,
} from 'inspector';
}
declare module "node:inspector/promises" {
declare module "inspector/promises" {
import {
InspectorNotification,
Schema,
@@ -3174,6 +3061,7 @@ declare module "node:inspector/promises" {
Target,
IO,
} from "inspector";
/**
* The `inspector.Session` is used for dispatching messages to the V8 inspector
* back-end and receiving message responses and notifications.
@@ -3508,6 +3396,7 @@ declare module "node:inspector/promises" {
*/
post(method: "IO.read", params?: IO.ReadParameterType): Promise<IO.ReadReturnType>;
post(method: "IO.close", params?: IO.CloseParameterType): Promise<void>;
addListener(event: string, listener: (...args: any[]) => void): this;
/**
* Emitted when any notification from the V8 Inspector is received.
@@ -3617,18 +3506,6 @@ declare module "node:inspector/promises" {
* Fired when data chunk was received over the network.
*/
addListener(event: "Network.dataReceived", listener: (message: InspectorNotification<Network.DataReceivedEventDataType>) => void): this;
/**
* Fired upon WebSocket creation.
*/
addListener(event: "Network.webSocketCreated", listener: (message: InspectorNotification<Network.WebSocketCreatedEventDataType>) => void): this;
/**
* Fired when WebSocket is closed.
*/
addListener(event: "Network.webSocketClosed", listener: (message: InspectorNotification<Network.WebSocketClosedEventDataType>) => void): this;
/**
* Fired when WebSocket handshake response becomes available.
*/
addListener(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification<Network.WebSocketHandshakeResponseReceivedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -3675,9 +3552,6 @@ declare module "node:inspector/promises" {
emit(event: "Network.loadingFailed", message: InspectorNotification<Network.LoadingFailedEventDataType>): boolean;
emit(event: "Network.loadingFinished", message: InspectorNotification<Network.LoadingFinishedEventDataType>): boolean;
emit(event: "Network.dataReceived", message: InspectorNotification<Network.DataReceivedEventDataType>): boolean;
emit(event: "Network.webSocketCreated", message: InspectorNotification<Network.WebSocketCreatedEventDataType>): boolean;
emit(event: "Network.webSocketClosed", message: InspectorNotification<Network.WebSocketClosedEventDataType>): boolean;
emit(event: "Network.webSocketHandshakeResponseReceived", message: InspectorNotification<Network.WebSocketHandshakeResponseReceivedEventDataType>): boolean;
emit(event: "NodeRuntime.waitingForDisconnect"): boolean;
emit(event: "NodeRuntime.waitingForDebugger"): boolean;
emit(event: "Target.targetCreated", message: InspectorNotification<Target.TargetCreatedEventDataType>): boolean;
@@ -3791,18 +3665,6 @@ declare module "node:inspector/promises" {
* Fired when data chunk was received over the network.
*/
on(event: "Network.dataReceived", listener: (message: InspectorNotification<Network.DataReceivedEventDataType>) => void): this;
/**
* Fired upon WebSocket creation.
*/
on(event: "Network.webSocketCreated", listener: (message: InspectorNotification<Network.WebSocketCreatedEventDataType>) => void): this;
/**
* Fired when WebSocket is closed.
*/
on(event: "Network.webSocketClosed", listener: (message: InspectorNotification<Network.WebSocketClosedEventDataType>) => void): this;
/**
* Fired when WebSocket handshake response becomes available.
*/
on(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification<Network.WebSocketHandshakeResponseReceivedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -3926,18 +3788,6 @@ declare module "node:inspector/promises" {
* Fired when data chunk was received over the network.
*/
once(event: "Network.dataReceived", listener: (message: InspectorNotification<Network.DataReceivedEventDataType>) => void): this;
/**
* Fired upon WebSocket creation.
*/
once(event: "Network.webSocketCreated", listener: (message: InspectorNotification<Network.WebSocketCreatedEventDataType>) => void): this;
/**
* Fired when WebSocket is closed.
*/
once(event: "Network.webSocketClosed", listener: (message: InspectorNotification<Network.WebSocketClosedEventDataType>) => void): this;
/**
* Fired when WebSocket handshake response becomes available.
*/
once(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification<Network.WebSocketHandshakeResponseReceivedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -4061,18 +3911,6 @@ declare module "node:inspector/promises" {
* Fired when data chunk was received over the network.
*/
prependListener(event: "Network.dataReceived", listener: (message: InspectorNotification<Network.DataReceivedEventDataType>) => void): this;
/**
* Fired upon WebSocket creation.
*/
prependListener(event: "Network.webSocketCreated", listener: (message: InspectorNotification<Network.WebSocketCreatedEventDataType>) => void): this;
/**
* Fired when WebSocket is closed.
*/
prependListener(event: "Network.webSocketClosed", listener: (message: InspectorNotification<Network.WebSocketClosedEventDataType>) => void): this;
/**
* Fired when WebSocket handshake response becomes available.
*/
prependListener(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification<Network.WebSocketHandshakeResponseReceivedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.
@@ -4196,18 +4034,6 @@ declare module "node:inspector/promises" {
* Fired when data chunk was received over the network.
*/
prependOnceListener(event: "Network.dataReceived", listener: (message: InspectorNotification<Network.DataReceivedEventDataType>) => void): this;
/**
* Fired upon WebSocket creation.
*/
prependOnceListener(event: "Network.webSocketCreated", listener: (message: InspectorNotification<Network.WebSocketCreatedEventDataType>) => void): this;
/**
* Fired when WebSocket is closed.
*/
prependOnceListener(event: "Network.webSocketClosed", listener: (message: InspectorNotification<Network.WebSocketClosedEventDataType>) => void): this;
/**
* Fired when WebSocket handshake response becomes available.
*/
prependOnceListener(event: "Network.webSocketHandshakeResponseReceived", listener: (message: InspectorNotification<Network.WebSocketHandshakeResponseReceivedEventDataType>) => void): this;
/**
* This event is fired instead of `Runtime.executionContextDestroyed` when
* enabled.

169
node_modules/@types/node/module.d.ts generated vendored
View File

@@ -1,7 +1,7 @@
/**
* @since v0.3.7
*/
declare module "node:module" {
declare module "module" {
import { URL } from "node:url";
class Module {
constructor(id: string, parent?: Module);
@@ -30,7 +30,7 @@ declare module "node:module" {
/**
* The following constants are returned as the `status` field in the object returned by
* {@link enableCompileCache} to indicate the result of the attempt to enable the
* [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache).
* [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache).
* @since v22.8.0
*/
namespace compileCacheStatus {
@@ -62,24 +62,6 @@ declare module "node:module" {
const DISABLED: number;
}
}
interface EnableCompileCacheOptions {
/**
* Optional. Directory to store the compile cache. If not specified,
* the directory specified by the `NODE_COMPILE_CACHE=dir` environment variable
* will be used if it's set, or `path.join(os.tmpdir(), 'node-compile-cache')`
* otherwise.
* @since v25.0.0
*/
directory?: string | undefined;
/**
* Optional. If `true`, enables portable compile cache so that
* the cache can be reused even if the project directory is moved. This is a best-effort
* feature. If not specified, it will depend on whether the environment variable
* `NODE_COMPILE_CACHE_PORTABLE=1` is set.
* @since v25.0.0
*/
portable?: boolean | undefined;
}
interface EnableCompileCacheResult {
/**
* One of the {@link constants.compileCacheStatus}
@@ -99,21 +81,25 @@ declare module "node:module" {
directory?: string;
}
/**
* Enable [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache)
* Enable [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)
* in the current Node.js instance.
*
* For general use cases, it's recommended to call `module.enableCompileCache()` without
* specifying the `options.directory`, so that the directory can be overridden by the
* `NODE_COMPILE_CACHE` environment variable when necessary.
* If `cacheDir` is not specified, Node.js will either use the directory specified by the
* `NODE_COMPILE_CACHE=dir` environment variable if it's set, or use
* `path.join(os.tmpdir(), 'node-compile-cache')` otherwise. For general use cases, it's
* recommended to call `module.enableCompileCache()` without specifying the `cacheDir`,
* so that the directory can be overridden by the `NODE_COMPILE_CACHE` environment
* variable when necessary.
*
* Since compile cache is supposed to be a optimization that is not mission critical, this
* method is designed to not throw any exception when the compile cache cannot be enabled.
* Instead, it will return an object containing an error message in the `message` field to
* aid debugging. If compile cache is enabled successfully, the `directory` field in the
* returned object contains the path to the directory where the compile cache is stored. The
* `status` field in the returned object would be one of the `module.constants.compileCacheStatus`
* Since compile cache is supposed to be a quiet optimization that is not required for the
* application to be functional, this method is designed to not throw any exception when the
* compile cache cannot be enabled. Instead, it will return an object containing an error
* message in the `message` field to aid debugging.
* If compile cache is enabled successfully, the `directory` field in the returned object
* contains the path to the directory where the compile cache is stored. The `status`
* field in the returned object would be one of the `module.constants.compileCacheStatus`
* values to indicate the result of the attempt to enable the
* [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache).
* [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache).
*
* This method only affects the current Node.js instance. To enable it in child worker threads,
* either call this method in child worker threads too, or set the
@@ -121,11 +107,12 @@ declare module "node:module" {
* be inherited into the child workers. The directory can be obtained either from the
* `directory` field returned by this method, or with {@link getCompileCacheDir}.
* @since v22.8.0
* @param options Optional. If a string is passed, it is considered to be `options.directory`.
* @param cacheDir Optional path to specify the directory where the compile cache
* will be stored/retrieved.
*/
function enableCompileCache(options?: string | EnableCompileCacheOptions): EnableCompileCacheResult;
function enableCompileCache(cacheDir?: string): EnableCompileCacheResult;
/**
* Flush the [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache)
* Flush the [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)
* accumulated from modules already loaded
* in the current Node.js instance to disk. This returns after all the flushing
* file system operations come to an end, no matter they succeed or not. If there
@@ -136,7 +123,7 @@ declare module "node:module" {
function flushCompileCache(): void;
/**
* @since v22.8.0
* @return Path to the [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache)
* @return Path to the [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)
* directory if it is enabled, or `undefined` otherwise.
*/
function getCompileCacheDir(): string | undefined;
@@ -207,7 +194,7 @@ declare module "node:module" {
*/
data?: Data | undefined;
/**
* [Transferable objects](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#portpostmessagevalue-transferlist)
* [Transferable objects](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html#portpostmessagevalue-transferlist)
* to be passed into the `initialize` hook.
*/
transferList?: any[] | undefined;
@@ -216,10 +203,10 @@ declare module "node:module" {
/**
* Register a module that exports hooks that customize Node.js module
* resolution and loading behavior. See
* [Customization hooks](https://nodejs.org/docs/latest-v25.x/api/module.html#customization-hooks).
* [Customization hooks](https://nodejs.org/docs/latest-v24.x/api/module.html#customization-hooks).
*
* This feature requires `--allow-worker` if used with the
* [Permission Model](https://nodejs.org/docs/latest-v25.x/api/permissions.html#permission-model).
* [Permission Model](https://nodejs.org/docs/latest-v24.x/api/permissions.html#permission-model).
* @since v20.6.0, v18.19.0
* @param specifier Customization hooks to be registered; this should be
* the same string that would be passed to `import()`, except that if it is
@@ -235,12 +222,12 @@ declare module "node:module" {
function register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
interface RegisterHooksOptions {
/**
* See [load hook](https://nodejs.org/docs/latest-v25.x/api/module.html#loadurl-context-nextload).
* See [load hook](https://nodejs.org/docs/latest-v24.x/api/module.html#loadurl-context-nextload).
* @default undefined
*/
load?: LoadHookSync | undefined;
/**
* See [resolve hook](https://nodejs.org/docs/latest-v25.x/api/module.html#resolvespecifier-context-nextresolve).
* See [resolve hook](https://nodejs.org/docs/latest-v24.x/api/module.html#resolvespecifier-context-nextresolve).
* @default undefined
*/
resolve?: ResolveHookSync | undefined;
@@ -252,7 +239,7 @@ declare module "node:module" {
deregister(): void;
}
/**
* Register [hooks](https://nodejs.org/docs/latest-v25.x/api/module.html#customization-hooks)
* Register [hooks](https://nodejs.org/docs/latest-v24.x/api/module.html#customization-hooks)
* that customize Node.js module resolution and loading behavior.
* @since v22.15.0
* @experimental
@@ -283,9 +270,9 @@ declare module "node:module" {
* with `vm.runInContext()` or `vm.compileFunction()`.
* By default, it will throw an error if the code contains TypeScript features
* that require transformation such as `Enums`,
* see [type-stripping](https://nodejs.org/docs/latest-v25.x/api/typescript.md#type-stripping) for more information.
* see [type-stripping](https://nodejs.org/docs/latest-v24.x/api/typescript.md#type-stripping) for more information.
* When mode is `'transform'`, it also transforms TypeScript features to JavaScript,
* see [transform TypeScript features](https://nodejs.org/docs/latest-v25.x/api/typescript.md#typescript-features) for more information.
* see [transform TypeScript features](https://nodejs.org/docs/latest-v24.x/api/typescript.md#typescript-features) for more information.
* When mode is `'strip'`, source maps are not generated, because locations are preserved.
* If `sourceMap` is provided, when mode is `'strip'`, an error will be thrown.
*
@@ -636,6 +623,94 @@ declare module "node:module" {
function wrap(script: string): string;
}
global {
interface ImportMeta {
/**
* The directory name of the current module.
*
* This is the same as the `path.dirname()` of the `import.meta.filename`.
*
* > **Caveat**: only present on `file:` modules.
* @since v21.2.0, v20.11.0
*/
dirname: string;
/**
* The full absolute path and filename of the current module, with
* symlinks resolved.
*
* This is the same as the `url.fileURLToPath()` of the `import.meta.url`.
*
* > **Caveat** only local modules support this property. Modules not using the
* > `file:` protocol will not provide it.
* @since v21.2.0, v20.11.0
*/
filename: string;
/**
* The absolute `file:` URL of the module.
*
* This is defined exactly the same as it is in browsers providing the URL of the
* current module file.
*
* This enables useful patterns such as relative file loading:
*
* ```js
* import { readFileSync } from 'node:fs';
* const buffer = readFileSync(new URL('./data.proto', import.meta.url));
* ```
*/
url: string;
/**
* `import.meta.resolve` is a module-relative resolution function scoped to
* each module, returning the URL string.
*
* ```js
* const dependencyAsset = import.meta.resolve('component-lib/asset.css');
* // file:///app/node_modules/component-lib/asset.css
* import.meta.resolve('./dep.js');
* // file:///app/dep.js
* ```
*
* All features of the Node.js module resolution are supported. Dependency
* resolutions are subject to the permitted exports resolutions within the package.
*
* **Caveats**:
*
* * This can result in synchronous file-system operations, which
* can impact performance similarly to `require.resolve`.
* * This feature is not available within custom loaders (it would
* create a deadlock).
* @since v13.9.0, v12.16.0
* @param specifier The module specifier to resolve relative to the
* current module.
* @param parent An optional absolute parent module URL to resolve from.
* **Default:** `import.meta.url`
* @returns The absolute URL string that the specifier would resolve to.
*/
resolve(specifier: string, parent?: string | URL): string;
/**
* `true` when the current module is the entry point of the current process; `false` otherwise.
*
* Equivalent to `require.main === module` in CommonJS.
*
* Analogous to Python's `__name__ == "__main__"`.
*
* ```js
* export function foo() {
* return 'Hello, world';
* }
*
* function main() {
* const message = foo();
* console.log(message);
* }
*
* if (import.meta.main) main();
* // `foo` can be imported from another module without possible side-effects from `main`
* ```
* @since v24.2.0
* @experimental
*/
main: boolean;
}
namespace NodeJS {
interface Module {
/**
@@ -709,7 +784,7 @@ declare module "node:module" {
* Modules are cached in this object when they are required. By deleting a key
* value from this object, the next `require` will reload the module.
* This does not apply to
* [native addons](https://nodejs.org/docs/latest-v25.x/api/addons.html),
* [native addons](https://nodejs.org/docs/latest-v24.x/api/addons.html),
* for which reloading will result in an error.
* @since v0.3.0
*/
@@ -743,7 +818,7 @@ declare module "node:module" {
* Paths to resolve module location from. If present, these
* paths are used instead of the default resolution paths, with the exception
* of
* [GLOBAL\_FOLDERS](https://nodejs.org/docs/latest-v25.x/api/modules.html#loading-from-the-global-folders)
* [GLOBAL\_FOLDERS](https://nodejs.org/docs/latest-v24.x/api/modules.html#loading-from-the-global-folders)
* like `$HOME/.node_modules`, which are
* always included. Each of these paths is used as a starting point for
* the module resolution algorithm, meaning that the `node_modules` hierarchy
@@ -813,7 +888,7 @@ declare module "node:module" {
}
export = Module;
}
declare module "module" {
import module = require("node:module");
declare module "node:module" {
import module = require("module");
export = module;
}

260
node_modules/@types/node/net.d.ts generated vendored
View File

@@ -10,13 +10,12 @@
* ```js
* import net from 'node:net';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/net.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/net.js)
*/
declare module "node:net" {
import { NonSharedBuffer } from "node:buffer";
import * as dns from "node:dns";
import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
declare module "net" {
import * as stream from "node:stream";
import { Abortable, EventEmitter } from "node:events";
import * as dns from "node:dns";
type LookupFunction = (
hostname: string,
options: dns.LookupOptions,
@@ -33,7 +32,7 @@ declare module "node:net" {
onread?: OnReadOpts | undefined;
readable?: boolean | undefined;
writable?: boolean | undefined;
signal?: AbortSignal | undefined;
signal?: AbortSignal;
}
interface OnReadOpts {
buffer: Uint8Array | (() => Uint8Array);
@@ -70,17 +69,6 @@ declare module "node:net" {
}
type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
type SocketReadyState = "opening" | "open" | "readOnly" | "writeOnly" | "closed";
interface SocketEventMap extends Omit<stream.DuplexEventMap, "close"> {
"close": [hadError: boolean];
"connect": [];
"connectionAttempt": [ip: string, port: number, family: number];
"connectionAttemptFailed": [ip: string, port: number, family: number, error: Error];
"connectionAttemptTimeout": [ip: string, port: number, family: number];
"data": [data: string | NonSharedBuffer];
"lookup": [err: Error | null, address: string, family: number | null, host: string];
"ready": [];
"timeout": [];
}
/**
* This class is an abstraction of a TCP socket or a streaming `IPC` endpoint
* (uses named pipes on Windows, and Unix domain sockets otherwise). It is also
@@ -333,25 +321,25 @@ declare module "node:net" {
* the socket is destroyed (for example, if the client disconnected).
* @since v0.5.10
*/
readonly remoteAddress: string | undefined;
readonly remoteAddress?: string | undefined;
/**
* The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. Value may be `undefined` if
* the socket is destroyed (for example, if the client disconnected).
* @since v0.11.14
*/
readonly remoteFamily: string | undefined;
readonly remoteFamily?: string | undefined;
/**
* The numeric representation of the remote port. For example, `80` or `21`. Value may be `undefined` if
* the socket is destroyed (for example, if the client disconnected).
* @since v0.5.10
*/
readonly remotePort: number | undefined;
readonly remotePort?: number | undefined;
/**
* The socket timeout in milliseconds as set by `socket.setTimeout()`.
* It is `undefined` if a timeout has not been set.
* @since v10.7.0
*/
readonly timeout?: number;
readonly timeout?: number | undefined;
/**
* Half-closes the socket. i.e., it sends a FIN packet. It is possible the
* server will still send some data.
@@ -365,45 +353,141 @@ declare module "node:net" {
end(callback?: () => void): this;
end(buffer: Uint8Array | string, callback?: () => void): this;
end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this;
// #region InternalEventEmitter
addListener<E extends keyof SocketEventMap>(eventName: E, listener: (...args: SocketEventMap[E]) => void): this;
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
emit<E extends keyof SocketEventMap>(eventName: E, ...args: SocketEventMap[E]): boolean;
emit(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<E extends keyof SocketEventMap>(
eventName: E,
listener?: (...args: SocketEventMap[E]) => void,
): number;
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
listeners<E extends keyof SocketEventMap>(eventName: E): ((...args: SocketEventMap[E]) => void)[];
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
off<E extends keyof SocketEventMap>(eventName: E, listener: (...args: SocketEventMap[E]) => void): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
on<E extends keyof SocketEventMap>(eventName: E, listener: (...args: SocketEventMap[E]) => void): this;
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
once<E extends keyof SocketEventMap>(eventName: E, listener: (...args: SocketEventMap[E]) => void): this;
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependListener<E extends keyof SocketEventMap>(
eventName: E,
listener: (...args: SocketEventMap[E]) => void,
/**
* events.EventEmitter
* 1. close
* 2. connect
* 3. connectionAttempt
* 4. connectionAttemptFailed
* 5. connectionAttemptTimeout
* 6. data
* 7. drain
* 8. end
* 9. error
* 10. lookup
* 11. ready
* 12. timeout
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: (hadError: boolean) => void): this;
addListener(event: "connect", listener: () => void): this;
addListener(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
addListener(
event: "connectionAttemptFailed",
listener: (ip: string, port: number, family: number, error: Error) => void,
): this;
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener<E extends keyof SocketEventMap>(
eventName: E,
listener: (...args: SocketEventMap[E]) => void,
addListener(
event: "connectionAttemptTimeout",
listener: (ip: string, port: number, family: number) => void,
): this;
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
rawListeners<E extends keyof SocketEventMap>(eventName: E): ((...args: SocketEventMap[E]) => void)[];
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
removeAllListeners<E extends keyof SocketEventMap>(eventName?: E): this;
removeAllListeners(eventName?: string | symbol): this;
removeListener<E extends keyof SocketEventMap>(
eventName: E,
listener: (...args: SocketEventMap[E]) => void,
addListener(event: "data", listener: (data: Buffer) => void): this;
addListener(event: "drain", listener: () => void): this;
addListener(event: "end", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(
event: "lookup",
listener: (err: Error, address: string, family: string | number, host: string) => void,
): this;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
// #endregion
addListener(event: "ready", listener: () => void): this;
addListener(event: "timeout", listener: () => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "close", hadError: boolean): boolean;
emit(event: "connect"): boolean;
emit(event: "connectionAttempt", ip: string, port: number, family: number): boolean;
emit(event: "connectionAttemptFailed", ip: string, port: number, family: number, error: Error): boolean;
emit(event: "connectionAttemptTimeout", ip: string, port: number, family: number): boolean;
emit(event: "data", data: Buffer): boolean;
emit(event: "drain"): boolean;
emit(event: "end"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "lookup", err: Error, address: string, family: string | number, host: string): boolean;
emit(event: "ready"): boolean;
emit(event: "timeout"): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: (hadError: boolean) => void): this;
on(event: "connect", listener: () => void): this;
on(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
on(
event: "connectionAttemptFailed",
listener: (ip: string, port: number, family: number, error: Error) => void,
): this;
on(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this;
on(event: "data", listener: (data: Buffer) => void): this;
on(event: "drain", listener: () => void): this;
on(event: "end", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(
event: "lookup",
listener: (err: Error, address: string, family: string | number, host: string) => void,
): this;
on(event: "ready", listener: () => void): this;
on(event: "timeout", listener: () => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: (hadError: boolean) => void): this;
once(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
once(
event: "connectionAttemptFailed",
listener: (ip: string, port: number, family: number, error: Error) => void,
): this;
once(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this;
once(event: "connect", listener: () => void): this;
once(event: "data", listener: (data: Buffer) => void): this;
once(event: "drain", listener: () => void): this;
once(event: "end", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(
event: "lookup",
listener: (err: Error, address: string, family: string | number, host: string) => void,
): this;
once(event: "ready", listener: () => void): this;
once(event: "timeout", listener: () => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: (hadError: boolean) => void): this;
prependListener(event: "connect", listener: () => void): this;
prependListener(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
prependListener(
event: "connectionAttemptFailed",
listener: (ip: string, port: number, family: number, error: Error) => void,
): this;
prependListener(
event: "connectionAttemptTimeout",
listener: (ip: string, port: number, family: number) => void,
): this;
prependListener(event: "data", listener: (data: Buffer) => void): this;
prependListener(event: "drain", listener: () => void): this;
prependListener(event: "end", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(
event: "lookup",
listener: (err: Error, address: string, family: string | number, host: string) => void,
): this;
prependListener(event: "ready", listener: () => void): this;
prependListener(event: "timeout", listener: () => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: (hadError: boolean) => void): this;
prependOnceListener(event: "connect", listener: () => void): this;
prependOnceListener(
event: "connectionAttempt",
listener: (ip: string, port: number, family: number) => void,
): this;
prependOnceListener(
event: "connectionAttemptFailed",
listener: (ip: string, port: number, family: number, error: Error) => void,
): this;
prependOnceListener(
event: "connectionAttemptTimeout",
listener: (ip: string, port: number, family: number) => void,
): this;
prependOnceListener(event: "data", listener: (data: Buffer) => void): this;
prependOnceListener(event: "drain", listener: () => void): this;
prependOnceListener(event: "end", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(
event: "lookup",
listener: (err: Error, address: string, family: string | number, host: string) => void,
): this;
prependOnceListener(event: "ready", listener: () => void): this;
prependOnceListener(event: "timeout", listener: () => void): this;
}
interface ListenOptions extends Abortable {
backlog?: number | undefined;
@@ -451,7 +535,7 @@ declare module "node:net" {
keepAliveInitialDelay?: number | undefined;
/**
* Optionally overrides all `net.Socket`s' `readableHighWaterMark` and `writableHighWaterMark`.
* @default See [stream.getDefaultHighWaterMark()](https://nodejs.org/docs/latest-v25.x/api/stream.html#streamgetdefaulthighwatermarkobjectmode).
* @default See [stream.getDefaultHighWaterMark()](https://nodejs.org/docs/latest-v24.x/api/stream.html#streamgetdefaulthighwatermarkobjectmode).
* @since v18.17.0, v20.1.0
*/
highWaterMark?: number | undefined;
@@ -473,18 +557,11 @@ declare module "node:net" {
remotePort?: number;
remoteFamily?: string;
}
interface ServerEventMap {
"close": [];
"connection": [socket: Socket];
"error": [err: Error];
"listening": [];
"drop": [data?: DropArgument];
}
/**
* This class is used to create a TCP or `IPC` server.
* @since v0.1.90
*/
class Server implements EventEmitter {
class Server extends EventEmitter {
constructor(connectionListener?: (socket: Socket) => void);
constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void);
/**
@@ -610,13 +687,56 @@ declare module "node:net" {
* @since v5.7.0
*/
readonly listening: boolean;
/**
* events.EventEmitter
* 1. close
* 2. connection
* 3. error
* 4. listening
* 5. drop
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "connection", listener: (socket: Socket) => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "listening", listener: () => void): this;
addListener(event: "drop", listener: (data?: DropArgument) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "close"): boolean;
emit(event: "connection", socket: Socket): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "listening"): boolean;
emit(event: "drop", data?: DropArgument): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: () => void): this;
on(event: "connection", listener: (socket: Socket) => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "listening", listener: () => void): this;
on(event: "drop", listener: (data?: DropArgument) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "connection", listener: (socket: Socket) => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "listening", listener: () => void): this;
once(event: "drop", listener: (data?: DropArgument) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "connection", listener: (socket: Socket) => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "listening", listener: () => void): this;
prependListener(event: "drop", listener: (data?: DropArgument) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "connection", listener: (socket: Socket) => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "listening", listener: () => void): this;
prependOnceListener(event: "drop", listener: (data?: DropArgument) => void): this;
/**
* Calls {@link Server.close()} and returns a promise that fulfills when the server has closed.
* @since v20.5.0
*/
[Symbol.asyncDispose](): Promise<void>;
}
interface Server extends InternalEventEmitter<ServerEventMap> {}
type IPVersion = "ipv4" | "ipv6";
/**
* The `BlockList` object can be used with some network APIs to specify rules for
@@ -825,7 +945,7 @@ declare module "node:net" {
function setDefaultAutoSelectFamily(value: boolean): void;
/**
* Gets the current default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
* The initial default value is `500` or the value specified via the command line option `--network-family-autoselection-attempt-timeout`.
* The initial default value is `250` or the value specified via the command line option `--network-family-autoselection-attempt-timeout`.
* @returns The current default value of the `autoSelectFamilyAttemptTimeout` option.
* @since v19.8.0, v18.8.0
*/
@@ -928,6 +1048,6 @@ declare module "node:net" {
static parse(input: string): SocketAddress | undefined;
}
}
declare module "net" {
export * from "node:net";
declare module "node:net" {
export * from "net";
}

29
node_modules/@types/node/os.d.ts generated vendored
View File

@@ -5,10 +5,9 @@
* ```js
* import os from 'node:os';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/os.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/os.js)
*/
declare module "node:os" {
import { NonSharedBuffer } from "buffer";
declare module "os" {
interface CpuInfo {
model: string;
speed: number;
@@ -31,10 +30,10 @@ declare module "node:os" {
mac: string;
internal: boolean;
cidr: string | null;
scopeid?: number;
}
interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase {
family: "IPv4";
scopeid?: undefined;
}
interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase {
family: "IPv6";
@@ -232,15 +231,6 @@ declare module "node:os" {
* @since v2.3.0
*/
function homedir(): string;
interface UserInfoOptions {
encoding?: BufferEncoding | "buffer" | undefined;
}
interface UserInfoOptionsWithBufferEncoding extends UserInfoOptions {
encoding: "buffer";
}
interface UserInfoOptionsWithStringEncoding extends UserInfoOptions {
encoding?: BufferEncoding | undefined;
}
/**
* Returns information about the currently effective user. On POSIX platforms,
* this is typically a subset of the password file. The returned object includes
@@ -251,12 +241,11 @@ declare module "node:os" {
* environment variables for the home directory before falling back to the
* operating system response.
*
* Throws a [`SystemError`](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-systemerror) if a user has no `username` or `homedir`.
* Throws a [`SystemError`](https://nodejs.org/docs/latest-v24.x/api/errors.html#class-systemerror) if a user has no `username` or `homedir`.
* @since v6.0.0
*/
function userInfo(options?: UserInfoOptionsWithStringEncoding): UserInfo<string>;
function userInfo(options: UserInfoOptionsWithBufferEncoding): UserInfo<NonSharedBuffer>;
function userInfo(options: UserInfoOptions): UserInfo<string | NonSharedBuffer>;
function userInfo(options: { encoding: "buffer" }): UserInfo<Buffer>;
function userInfo(options?: { encoding: BufferEncoding }): UserInfo<string>;
type SignalConstants = {
[key in NodeJS.Signals]: number;
};
@@ -431,7 +420,7 @@ declare module "node:os" {
* compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`,
* `'mips'`, `'mipsel'`, `'ppc64'`, `'riscv64'`, `'s390x'`, and `'x64'`.
*
* The return value is equivalent to [process.arch](https://nodejs.org/docs/latest-v25.x/api/process.html#processarch).
* The return value is equivalent to [process.arch](https://nodejs.org/docs/latest-v24.x/api/process.html#processarch).
* @since v0.5.0
*/
function arch(): NodeJS.Architecture;
@@ -502,6 +491,6 @@ declare module "node:os" {
function setPriority(priority: number): void;
function setPriority(pid: number, priority: number): void;
}
declare module "os" {
export * from "node:os";
declare module "node:os" {
export * from "os";
}

View File

@@ -1,6 +1,6 @@
{
"name": "@types/node",
"version": "25.2.2",
"version": "24.5.2",
"description": "TypeScript definitions for node",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
"license": "MIT",
@@ -147,9 +147,9 @@
},
"scripts": {},
"dependencies": {
"undici-types": "~7.16.0"
"undici-types": "~7.12.0"
},
"peerDependencies": {},
"typesPublisherContentHash": "765ef440300302cdea004b925c35f2813d0883562f317541c7ef8e960501af28",
"typesPublisherContentHash": "5df6870a3de1de1f3716802276fe0c64c2b3a2903d725578b50f533f42cfea46",
"typeScriptVersion": "5.2"
}

253
node_modules/@types/node/path.d.ts generated vendored
View File

@@ -1,3 +1,11 @@
declare module "path/posix" {
import path = require("path");
export = path;
}
declare module "path/win32" {
import path = require("path");
export = path;
}
/**
* The `node:path` module provides utilities for working with file and directory
* paths. It can be accessed using:
@@ -5,9 +13,9 @@
* ```js
* import path from 'node:path';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/path.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/path.js)
*/
declare module "node:path" {
declare module "path" {
namespace path {
/**
* A parsed path object generated by path.parse() or consumed by path.format().
@@ -56,132 +64,137 @@ declare module "node:path" {
*/
name?: string | undefined;
}
/**
* Normalize a string path, reducing '..' and '.' parts.
* When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. If the path is a zero-length string, '.' is returned, representing the current working directory.
*
* @param path string path to normalize.
* @throws {TypeError} if `path` is not a string.
*/
function normalize(path: string): string;
/**
* Join all arguments together and normalize the resulting path.
*
* @param paths paths to join.
* @throws {TypeError} if any of the path segments is not a string.
*/
function join(...paths: string[]): string;
/**
* The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
*
* Starting from leftmost {from} parameter, resolves {to} to an absolute path.
*
* If {to} isn't already absolute, {from} arguments are prepended in right to left order,
* until an absolute path is found. If after using all {from} paths still no absolute path is found,
* the current working directory is used as well. The resulting path is normalized,
* and trailing slashes are removed unless the path gets resolved to the root directory.
*
* @param paths A sequence of paths or path segments.
* @throws {TypeError} if any of the arguments is not a string.
*/
function resolve(...paths: string[]): string;
/**
* The `path.matchesGlob()` method determines if `path` matches the `pattern`.
* @param path The path to glob-match against.
* @param pattern The glob to check the path against.
* @returns Whether or not the `path` matched the `pattern`.
* @throws {TypeError} if `path` or `pattern` are not strings.
* @since v22.5.0
*/
function matchesGlob(path: string, pattern: string): boolean;
/**
* Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
*
* If the given {path} is a zero-length string, `false` will be returned.
*
* @param path path to test.
* @throws {TypeError} if `path` is not a string.
*/
function isAbsolute(path: string): boolean;
/**
* Solve the relative path from {from} to {to} based on the current working directory.
* At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
*
* @throws {TypeError} if either `from` or `to` is not a string.
*/
function relative(from: string, to: string): string;
/**
* Return the directory name of a path. Similar to the Unix dirname command.
*
* @param path the path to evaluate.
* @throws {TypeError} if `path` is not a string.
*/
function dirname(path: string): string;
/**
* Return the last portion of a path. Similar to the Unix basename command.
* Often used to extract the file name from a fully qualified path.
*
* @param path the path to evaluate.
* @param suffix optionally, an extension to remove from the result.
* @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string.
*/
function basename(path: string, suffix?: string): string;
/**
* Return the extension of the path, from the last '.' to end of string in the last portion of the path.
* If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.
*
* @param path the path to evaluate.
* @throws {TypeError} if `path` is not a string.
*/
function extname(path: string): string;
/**
* The platform-specific file separator. '\\' or '/'.
*/
const sep: "\\" | "/";
/**
* The platform-specific file delimiter. ';' or ':'.
*/
const delimiter: ";" | ":";
/**
* Returns an object from a path string - the opposite of format().
*
* @param path path to evaluate.
* @throws {TypeError} if `path` is not a string.
*/
function parse(path: string): ParsedPath;
/**
* Returns a path string from an object - the opposite of parse().
*
* @param pathObject path to evaluate.
*/
function format(pathObject: FormatInputPathObject): string;
/**
* On Windows systems only, returns an equivalent namespace-prefixed path for the given path.
* If path is not a string, path will be returned without modifications.
* This method is meaningful only on Windows system.
* On POSIX systems, the method is non-operational and always returns path without modifications.
*/
function toNamespacedPath(path: string): string;
}
namespace path {
export {
interface PlatformPath {
/**
* The `path.posix` property provides access to POSIX specific implementations of the `path` methods.
* Normalize a string path, reducing '..' and '.' parts.
* When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.
*
* The API is accessible via `require('node:path').posix` or `require('node:path/posix')`.
* @param path string path to normalize.
* @throws {TypeError} if `path` is not a string.
*/
path as posix,
normalize(path: string): string;
/**
* The `path.win32` property provides access to Windows-specific implementations of the `path` methods.
* Join all arguments together and normalize the resulting path.
*
* The API is accessible via `require('node:path').win32` or `require('node:path/win32')`.
* @param paths paths to join.
* @throws {TypeError} if any of the path segments is not a string.
*/
path as win32,
};
join(...paths: string[]): string;
/**
* The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
*
* Starting from leftmost {from} parameter, resolves {to} to an absolute path.
*
* If {to} isn't already absolute, {from} arguments are prepended in right to left order,
* until an absolute path is found. If after using all {from} paths still no absolute path is found,
* the current working directory is used as well. The resulting path is normalized,
* and trailing slashes are removed unless the path gets resolved to the root directory.
*
* @param paths A sequence of paths or path segments.
* @throws {TypeError} if any of the arguments is not a string.
*/
resolve(...paths: string[]): string;
/**
* The `path.matchesGlob()` method determines if `path` matches the `pattern`.
* @param path The path to glob-match against.
* @param pattern The glob to check the path against.
* @returns Whether or not the `path` matched the `pattern`.
* @throws {TypeError} if `path` or `pattern` are not strings.
* @since v22.5.0
*/
matchesGlob(path: string, pattern: string): boolean;
/**
* Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
*
* If the given {path} is a zero-length string, `false` will be returned.
*
* @param path path to test.
* @throws {TypeError} if `path` is not a string.
*/
isAbsolute(path: string): boolean;
/**
* Solve the relative path from {from} to {to} based on the current working directory.
* At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
*
* @throws {TypeError} if either `from` or `to` is not a string.
*/
relative(from: string, to: string): string;
/**
* Return the directory name of a path. Similar to the Unix dirname command.
*
* @param path the path to evaluate.
* @throws {TypeError} if `path` is not a string.
*/
dirname(path: string): string;
/**
* Return the last portion of a path. Similar to the Unix basename command.
* Often used to extract the file name from a fully qualified path.
*
* @param path the path to evaluate.
* @param suffix optionally, an extension to remove from the result.
* @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string.
*/
basename(path: string, suffix?: string): string;
/**
* Return the extension of the path, from the last '.' to end of string in the last portion of the path.
* If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.
*
* @param path the path to evaluate.
* @throws {TypeError} if `path` is not a string.
*/
extname(path: string): string;
/**
* The platform-specific file separator. '\\' or '/'.
*/
readonly sep: "\\" | "/";
/**
* The platform-specific file delimiter. ';' or ':'.
*/
readonly delimiter: ";" | ":";
/**
* Returns an object from a path string - the opposite of format().
*
* @param path path to evaluate.
* @throws {TypeError} if `path` is not a string.
*/
parse(path: string): ParsedPath;
/**
* Returns a path string from an object - the opposite of parse().
*
* @param pathObject path to evaluate.
*/
format(pathObject: FormatInputPathObject): string;
/**
* On Windows systems only, returns an equivalent namespace-prefixed path for the given path.
* If path is not a string, path will be returned without modifications.
* This method is meaningful only on Windows system.
* On POSIX systems, the method is non-operational and always returns path without modifications.
*/
toNamespacedPath(path: string): string;
/**
* Posix specific pathing.
* Same as parent object on posix.
*/
readonly posix: PlatformPath;
/**
* Windows specific pathing.
* Same as parent object on windows
*/
readonly win32: PlatformPath;
}
}
const path: path.PlatformPath;
export = path;
}
declare module "path" {
import path = require("node:path");
declare module "node:path" {
import path = require("path");
export = path;
}
declare module "node:path/posix" {
import path = require("path/posix");
export = path;
}
declare module "node:path/win32" {
import path = require("path/win32");
export = path;
}

File diff suppressed because it is too large Load Diff

370
node_modules/@types/node/process.d.ts generated vendored
View File

@@ -1,8 +1,7 @@
declare module "node:process" {
import { Control, MessageOptions, SendHandle } from "node:child_process";
import { PathLike } from "node:fs";
declare module "process" {
import * as tty from "node:tty";
import { Worker } from "node:worker_threads";
interface BuiltInModule {
"assert": typeof import("assert");
"node:assert": typeof import("node:assert");
@@ -68,7 +67,6 @@ declare module "node:process" {
"node:punycode": typeof import("node:punycode");
"querystring": typeof import("querystring");
"node:querystring": typeof import("node:querystring");
"node:quic": typeof import("node:quic");
"readline": typeof import("readline");
"node:readline": typeof import("node:readline");
"readline/promises": typeof import("readline/promises");
@@ -103,6 +101,8 @@ declare module "node:process" {
"node:url": typeof import("node:url");
"util": typeof import("util");
"node:util": typeof import("node:util");
"sys": typeof import("util");
"node:sys": typeof import("node:util");
"util/types": typeof import("util/types");
"node:util/types": typeof import("node:util/types");
"v8": typeof import("v8");
@@ -116,28 +116,8 @@ declare module "node:process" {
"zlib": typeof import("zlib");
"node:zlib": typeof import("node:zlib");
}
type SignalsEventMap = { [S in NodeJS.Signals]: [signal: S] };
interface ProcessEventMap extends SignalsEventMap {
"beforeExit": [code: number];
"disconnect": [];
"exit": [code: number];
"message": [
message: object | boolean | number | string | null,
sendHandle: SendHandle | undefined,
];
"rejectionHandled": [promise: Promise<unknown>];
"uncaughtException": [error: Error, origin: NodeJS.UncaughtExceptionOrigin];
"uncaughtExceptionMonitor": [error: Error, origin: NodeJS.UncaughtExceptionOrigin];
"unhandledRejection": [reason: unknown, promise: Promise<unknown>];
"warning": [warning: Error];
"worker": [worker: Worker];
"workerMessage": [value: any, source: number];
}
global {
var process: NodeJS.Process;
namespace process {
export { ProcessEventMap };
}
namespace NodeJS {
// this namespace merge is here because these are specifically used
// as the type for process.stdin, process.stdout, and process.stderr.
@@ -214,7 +194,7 @@ declare module "node:process" {
readonly ipv6: boolean;
/**
* A boolean value that is `true` if the current Node.js build supports
* [loading ECMAScript modules using `require()`](https://nodejs.org/docs/latest-v25.x/api/modules.md#loading-ecmascript-modules-using-require).
* [loading ECMAScript modules using `require()`](https://nodejs.org/docs/latest-v24.x/api/modules.md#loading-ecmascript-modules-using-require).
* @since v22.10.0
*/
readonly require_module: boolean;
@@ -253,7 +233,7 @@ declare module "node:process" {
/**
* A value that is `"strip"` by default,
* `"transform"` if Node.js is run with `--experimental-transform-types`, and `false` if
* Node.js is run with `--no-strip-types`.
* Node.js is run with `--no-experimental-strip-types`.
* @since v22.10.0
*/
readonly typescript: "strip" | "transform" | false;
@@ -338,129 +318,26 @@ declare module "node:process" {
| "SIGLOST"
| "SIGINFO";
type UncaughtExceptionOrigin = "uncaughtException" | "unhandledRejection";
type MultipleResolveType = "resolve" | "reject";
type BeforeExitListener = (code: number) => void;
type DisconnectListener = () => void;
type ExitListener = (code: number) => void;
type RejectionHandledListener = (promise: Promise<unknown>) => void;
type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void;
/**
* @deprecated Global listener types will be removed in a future version.
* Callbacks passed directly to `process`'s EventEmitter methods
* have their parameter types inferred automatically.
*
* `process` event types are also available via `ProcessEventMap`:
*
* ```ts
* import type { ProcessEventMap } from 'node:process';
* const listener = (...args: ProcessEventMap['beforeExit']) => { ... };
* ```
*/
type BeforeExitListener = (...args: ProcessEventMap["beforeExit"]) => void;
/**
* @deprecated Global listener types will be removed in a future version.
* Callbacks passed directly to `process`'s EventEmitter methods
* have their parameter types inferred automatically.
*
* `process` event types are also available via `ProcessEventMap`:
*
* ```ts
* import type { ProcessEventMap } from 'node:process';
* const listener = (...args: ProcessEventMap['disconnect']) => { ... };
* ```
*/
type DisconnectListener = (...args: ProcessEventMap["disconnect"]) => void;
/**
* @deprecated Global listener types will be removed in a future version.
* Callbacks passed directly to `process`'s EventEmitter methods
* have their parameter types inferred automatically.
*
* `process` event types are also available via `ProcessEventMap`:
*
* ```ts
* import type { ProcessEventMap } from 'node:process';
* const listener = (...args: ProcessEventMap['exit']) => { ... };
* ```
*/
type ExitListener = (...args: ProcessEventMap["exit"]) => void;
/**
* @deprecated Global listener types will be removed in a future version.
* Callbacks passed directly to `process`'s EventEmitter methods
* have their parameter types inferred automatically.
*
* `process` event types are also available via `ProcessEventMap`:
*
* ```ts
* import type { ProcessEventMap } from 'node:process';
* const listener = (...args: ProcessEventMap['message']) => { ... };
* ```
*/
type MessageListener = (...args: ProcessEventMap["message"]) => void;
/**
* @deprecated Global listener types will be removed in a future version.
* Callbacks passed directly to `process`'s EventEmitter methods
* have their parameter types inferred automatically.
*
* `process` event types are also available via `ProcessEventMap`:
*
* ```ts
* import type { ProcessEventMap } from 'node:process';
* const listener = (...args: ProcessEventMap['rejectionHandled']) => { ... };
* ```
*/
type RejectionHandledListener = (...args: ProcessEventMap["rejectionHandled"]) => void;
/**
* @deprecated Global listener types will be removed in a future version.
* Callbacks passed directly to `process`'s EventEmitter methods
* have their parameter types inferred automatically.
* Most of the time the unhandledRejection will be an Error, but this should not be relied upon
* as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error.
*/
type UnhandledRejectionListener = (reason: unknown, promise: Promise<unknown>) => void;
type WarningListener = (warning: Error) => void;
type MessageListener = (message: unknown, sendHandle: unknown) => void;
type SignalsListener = (signal: Signals) => void;
/**
* @deprecated Global listener types will be removed in a future version.
* Callbacks passed directly to `process`'s EventEmitter methods
* have their parameter types inferred automatically.
*
* `process` event types are also available via `ProcessEventMap`:
*
* ```ts
* import type { ProcessEventMap } from 'node:process';
* const listener = (...args: ProcessEventMap['uncaughtException']) => { ... };
* ```
*/
type UncaughtExceptionListener = (...args: ProcessEventMap["uncaughtException"]) => void;
/**
* @deprecated Global listener types will be removed in a future version.
* Callbacks passed directly to `process`'s EventEmitter methods
* have their parameter types inferred automatically.
*
* `process` event types are also available via `ProcessEventMap`:
*
* ```ts
* import type { ProcessEventMap } from 'node:process';
* const listener = (...args: ProcessEventMap['unhandledRejection']) => { ... };
* ```
*/
type UnhandledRejectionListener = (...args: ProcessEventMap["unhandledRejection"]) => void;
/**
* @deprecated Global listener types will be removed in a future version.
* Callbacks passed directly to `process`'s EventEmitter methods
* have their parameter types inferred automatically.
*
* `process` event types are also available via `ProcessEventMap`:
*
* ```ts
* import type { ProcessEventMap } from 'node:process';
* const listener = (...args: ProcessEventMap['warning']) => { ... };
* ```
*/
type WarningListener = (...args: ProcessEventMap["warning"]) => void;
/**
* @deprecated Global listener types will be removed in a future version.
* Callbacks passed directly to `process`'s EventEmitter methods
* have their parameter types inferred automatically.
*
* `process` event types are also available via `ProcessEventMap`:
*
* ```ts
* import type { ProcessEventMap } from 'node:process';
* const listener = (...args: ProcessEventMap['worker']) => { ... };
* ```
*/
type WorkerListener = (...args: ProcessEventMap["worker"]) => void;
type MultipleResolveListener = (
type: MultipleResolveType,
promise: Promise<unknown>,
value: unknown,
) => void;
type WorkerListener = (worker: Worker) => void;
interface Socket extends ReadWriteStream {
isTTY?: true | undefined;
}
@@ -469,7 +346,7 @@ declare module "node:process" {
/**
* Can be used to change the default timezone at runtime
*/
TZ?: string | undefined;
TZ?: string;
}
interface HRTime {
/**
@@ -593,11 +470,6 @@ declare module "node:process" {
* @default false
*/
reportOnUncaughtException: boolean;
/**
* If true, a diagnostic report is generated without the environment variables.
* @default false
*/
excludeEnv: boolean;
/**
* The signal used to trigger the creation of a diagnostic report.
* @default 'SIGUSR2'
@@ -875,7 +747,7 @@ declare module "node:process" {
* should not be used directly, except in special cases. In other words, `require()` should be preferred over `process.dlopen()`
* unless there are specific reasons such as custom dlopen flags or loading from ES modules.
*
* The `flags` argument is an integer that allows to specify dlopen behavior. See the `[os.constants.dlopen](https://nodejs.org/docs/latest-v25.x/api/os.html#dlopen-constants)`
* The `flags` argument is an integer that allows to specify dlopen behavior. See the `[os.constants.dlopen](https://nodejs.org/docs/latest-v24.x/api/os.html#dlopen-constants)`
* documentation for details.
*
* An important requirement when calling `process.dlopen()` is that the `module` instance must be passed. Functions exported by the C++ Addon
@@ -1118,7 +990,7 @@ declare module "node:process" {
* @since v0.1.13
* @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed.
*/
exit(code?: number | string | null): never;
exit(code?: number | string | null | undefined): never;
/**
* A number which will be the process exit code, when the process either
* exits gracefully, or is exited via {@link exit} without specifying
@@ -1129,7 +1001,7 @@ declare module "node:process" {
* @default undefined
* @since v0.11.8
*/
exitCode: number | string | null | undefined;
exitCode?: number | string | number | undefined;
finalization: {
/**
* This function registers a callback to be called when the process emits the `exit` event if the `ref` object was not garbage collected.
@@ -1593,7 +1465,7 @@ declare module "node:process" {
* @since v20.12.0
* @param path The path to the .env file
*/
loadEnvFile(path?: PathLike): void;
loadEnvFile(path?: string | URL | Buffer): void;
/**
* The `process.pid` property returns the PID of the process.
*
@@ -1696,7 +1568,7 @@ declare module "node:process" {
* @since v0.1.17
* @deprecated Since v14.0.0 - Use `main` instead.
*/
mainModule?: Module;
mainModule?: Module | undefined;
memoryUsage: MemoryUsageFn;
/**
* Gets the amount of memory available to the process (in bytes) based on
@@ -1710,7 +1582,7 @@ declare module "node:process" {
constrainedMemory(): number;
/**
* Gets the amount of free memory that is still available to the process (in bytes).
* See [`uv_get_available_memory`](https://nodejs.org/docs/latest-v25.x/api/process.html#processavailablememory) for more information.
* See [`uv_get_available_memory`](https://nodejs.org/docs/latest-v24.x/api/process.html#processavailablememory) for more information.
* @since v20.13.0
*/
availableMemory(): number;
@@ -1830,11 +1702,6 @@ declare module "node:process" {
* @param args Additional arguments to pass when invoking the `callback`
*/
nextTick(callback: Function, ...args: any[]): void;
/**
* The process.noDeprecation property indicates whether the --no-deprecation flag is set on the current Node.js process.
* See the documentation for the ['warning' event](https://nodejs.org/docs/latest/api/process.html#event-warning) and the [emitWarning()](https://nodejs.org/docs/latest/api/process.html#processemitwarningwarning-type-code-ctor) method for more information about this flag's behavior.
*/
noDeprecation?: boolean;
/**
* This API is available through the [--permission](https://nodejs.org/api/cli.html#--permission) flag.
*
@@ -1893,7 +1760,18 @@ declare module "node:process" {
* If no IPC channel exists, this property is undefined.
* @since v7.1.0
*/
channel?: Control;
channel?: {
/**
* This method makes the IPC channel keep the event loop of the process running if .unref() has been called before.
* @since v7.1.0
*/
ref(): void;
/**
* This method makes the IPC channel not keep the event loop of the process running, and lets it finish even while the channel is open.
* @since v7.1.0
*/
unref(): void;
};
/**
* If Node.js is spawned with an IPC channel, the `process.send()` method can be
* used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object.
@@ -1907,19 +1785,12 @@ declare module "node:process" {
*/
send?(
message: any,
sendHandle?: SendHandle,
options?: MessageOptions,
sendHandle?: any,
options?: {
keepOpen?: boolean | undefined;
},
callback?: (error: Error | null) => void,
): boolean;
send?(
message: any,
sendHandle: SendHandle,
callback?: (error: Error | null) => void,
): boolean;
send?(
message: any,
callback: (error: Error | null) => void,
): boolean;
/**
* If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.disconnect()` method will close the
* IPC channel to the parent process, allowing the child process to exit gracefully
@@ -1930,7 +1801,7 @@ declare module "node:process" {
* If the Node.js process was not spawned with an IPC channel, `process.disconnect()` will be `undefined`.
* @since v0.7.2
*/
disconnect?(): void;
disconnect(): void;
/**
* If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.connected` property will return `true` so long as the IPC
* channel is connected and will return `false` after `process.disconnect()` is called.
@@ -1984,7 +1855,7 @@ declare module "node:process" {
allowedNodeEnvironmentFlags: ReadonlySet<string>;
/**
* `process.report` is an object whose methods are used to generate diagnostic reports for the current process.
* Additional documentation is available in the [report documentation](https://nodejs.org/docs/latest-v25.x/api/report.html).
* Additional documentation is available in the [report documentation](https://nodejs.org/docs/latest-v24.x/api/report.html).
* @since v11.8.0
*/
report: ProcessReport;
@@ -2099,63 +1970,104 @@ declare module "node:process" {
* **Default:** `process.env`.
*/
execve?(file: string, args?: readonly string[], env?: ProcessEnv): never;
// #region InternalEventEmitter
addListener<E extends keyof ProcessEventMap>(
eventName: E,
listener: (...args: ProcessEventMap[E]) => void,
/* EventEmitter */
addListener(event: "beforeExit", listener: BeforeExitListener): this;
addListener(event: "disconnect", listener: DisconnectListener): this;
addListener(event: "exit", listener: ExitListener): this;
addListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
addListener(event: "warning", listener: WarningListener): this;
addListener(event: "message", listener: MessageListener): this;
addListener(event: Signals, listener: SignalsListener): this;
addListener(event: "multipleResolves", listener: MultipleResolveListener): this;
addListener(event: "worker", listener: WorkerListener): this;
emit(event: "beforeExit", code: number): boolean;
emit(event: "disconnect"): boolean;
emit(event: "exit", code: number): boolean;
emit(event: "rejectionHandled", promise: Promise<unknown>): boolean;
emit(event: "uncaughtException", error: Error): boolean;
emit(event: "uncaughtExceptionMonitor", error: Error): boolean;
emit(event: "unhandledRejection", reason: unknown, promise: Promise<unknown>): boolean;
emit(event: "warning", warning: Error): boolean;
emit(event: "message", message: unknown, sendHandle: unknown): this;
emit(event: Signals, signal?: Signals): boolean;
emit(
event: "multipleResolves",
type: MultipleResolveType,
promise: Promise<unknown>,
value: unknown,
): this;
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
emit<E extends keyof ProcessEventMap>(eventName: E, ...args: ProcessEventMap[E]): boolean;
emit(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<E extends keyof ProcessEventMap>(
eventName: E,
listener?: (...args: ProcessEventMap[E]) => void,
): number;
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
listeners<E extends keyof ProcessEventMap>(eventName: E): ((...args: ProcessEventMap[E]) => void)[];
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
off<E extends keyof ProcessEventMap>(
eventName: E,
listener: (...args: ProcessEventMap[E]) => void,
): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
on<E extends keyof ProcessEventMap>(
eventName: E,
listener: (...args: ProcessEventMap[E]) => void,
): this;
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
once<E extends keyof ProcessEventMap>(
eventName: E,
listener: (...args: ProcessEventMap[E]) => void,
): this;
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependListener<E extends keyof ProcessEventMap>(
eventName: E,
listener: (...args: ProcessEventMap[E]) => void,
): this;
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener<E extends keyof ProcessEventMap>(
eventName: E,
listener: (...args: ProcessEventMap[E]) => void,
): this;
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
rawListeners<E extends keyof ProcessEventMap>(eventName: E): ((...args: ProcessEventMap[E]) => void)[];
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
removeAllListeners<E extends keyof ProcessEventMap>(eventName?: E): this;
removeAllListeners(eventName?: string | symbol): this;
removeListener<E extends keyof ProcessEventMap>(
eventName: E,
listener: (...args: ProcessEventMap[E]) => void,
): this;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
// #endregion
emit(event: "worker", listener: WorkerListener): this;
on(event: "beforeExit", listener: BeforeExitListener): this;
on(event: "disconnect", listener: DisconnectListener): this;
on(event: "exit", listener: ExitListener): this;
on(event: "rejectionHandled", listener: RejectionHandledListener): this;
on(event: "uncaughtException", listener: UncaughtExceptionListener): this;
on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
on(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
on(event: "warning", listener: WarningListener): this;
on(event: "message", listener: MessageListener): this;
on(event: Signals, listener: SignalsListener): this;
on(event: "multipleResolves", listener: MultipleResolveListener): this;
on(event: "worker", listener: WorkerListener): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "beforeExit", listener: BeforeExitListener): this;
once(event: "disconnect", listener: DisconnectListener): this;
once(event: "exit", listener: ExitListener): this;
once(event: "rejectionHandled", listener: RejectionHandledListener): this;
once(event: "uncaughtException", listener: UncaughtExceptionListener): this;
once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
once(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
once(event: "warning", listener: WarningListener): this;
once(event: "message", listener: MessageListener): this;
once(event: Signals, listener: SignalsListener): this;
once(event: "multipleResolves", listener: MultipleResolveListener): this;
once(event: "worker", listener: WorkerListener): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "beforeExit", listener: BeforeExitListener): this;
prependListener(event: "disconnect", listener: DisconnectListener): this;
prependListener(event: "exit", listener: ExitListener): this;
prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
prependListener(event: "warning", listener: WarningListener): this;
prependListener(event: "message", listener: MessageListener): this;
prependListener(event: Signals, listener: SignalsListener): this;
prependListener(event: "multipleResolves", listener: MultipleResolveListener): this;
prependListener(event: "worker", listener: WorkerListener): this;
prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this;
prependOnceListener(event: "disconnect", listener: DisconnectListener): this;
prependOnceListener(event: "exit", listener: ExitListener): this;
prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
prependOnceListener(event: "warning", listener: WarningListener): this;
prependOnceListener(event: "message", listener: MessageListener): this;
prependOnceListener(event: Signals, listener: SignalsListener): this;
prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this;
prependOnceListener(event: "worker", listener: WorkerListener): this;
listeners(event: "beforeExit"): BeforeExitListener[];
listeners(event: "disconnect"): DisconnectListener[];
listeners(event: "exit"): ExitListener[];
listeners(event: "rejectionHandled"): RejectionHandledListener[];
listeners(event: "uncaughtException"): UncaughtExceptionListener[];
listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[];
listeners(event: "unhandledRejection"): UnhandledRejectionListener[];
listeners(event: "warning"): WarningListener[];
listeners(event: "message"): MessageListener[];
listeners(event: Signals): SignalsListener[];
listeners(event: "multipleResolves"): MultipleResolveListener[];
listeners(event: "worker"): WorkerListener[];
}
}
}
export = process;
}
declare module "process" {
import process = require("node:process");
declare module "node:process" {
import process = require("process");
export = process;
}

View File

@@ -23,10 +23,10 @@
* The `punycode` module is a third-party dependency used by Node.js and
* made available to developers as a convenience. Fixes or other modifications to
* the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
* @deprecated
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/punycode.js)
* @deprecated Since v7.0.0 - Deprecated
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/punycode.js)
*/
declare module "node:punycode" {
declare module "punycode" {
/**
* The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only
* characters to the equivalent string of Unicode codepoints.
@@ -112,6 +112,6 @@ declare module "node:punycode" {
*/
const version: string;
}
declare module "punycode" {
export * from "node:punycode";
declare module "node:punycode" {
export * from "punycode";
}

View File

@@ -9,9 +9,9 @@
* `querystring` is more performant than `URLSearchParams` but is not a
* standardized API. Use `URLSearchParams` when performance is not critical or
* when compatibility with browser code is desirable.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/querystring.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/querystring.js)
*/
declare module "node:querystring" {
declare module "querystring" {
interface StringifyOptions {
/**
* The function to use when converting URL-unsafe characters to percent-encoding in the query string.
@@ -147,6 +147,6 @@ declare module "node:querystring" {
*/
function unescape(str: string): string;
}
declare module "querystring" {
export * from "node:querystring";
declare module "node:querystring" {
export * from "querystring";
}

View File

@@ -1,6 +1,6 @@
/**
* The `node:readline` module provides an interface for reading data from a [Readable](https://nodejs.org/docs/latest-v25.x/api/stream.html#readable-streams) stream
* (such as [`process.stdin`](https://nodejs.org/docs/latest-v25.x/api/process.html#processstdin)) one line at a time.
* The `node:readline` module provides an interface for reading data from a [Readable](https://nodejs.org/docs/latest-v24.x/api/stream.html#readable-streams) stream
* (such as [`process.stdin`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdin)) one line at a time.
*
* To use the promise-based APIs:
*
@@ -31,58 +31,27 @@
*
* Once this code is invoked, the Node.js application will not terminate until the `readline.Interface` is closed because the interface waits for data to be
* received on the `input` stream.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/readline.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/readline.js)
*/
declare module "node:readline" {
import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
interface Key {
declare module "readline" {
import { Abortable, EventEmitter } from "node:events";
import * as promises from "node:readline/promises";
export { promises };
export interface Key {
sequence?: string | undefined;
name?: string | undefined;
ctrl?: boolean | undefined;
meta?: boolean | undefined;
shift?: boolean | undefined;
}
interface InterfaceEventMap {
"close": [];
"history": [history: string[]];
"line": [input: string];
"pause": [];
"resume": [];
"SIGCONT": [];
"SIGINT": [];
"SIGTSTP": [];
}
/**
* Instances of the `readline.Interface` class are constructed using the `readline.createInterface()` method. Every instance is associated with a
* single `input` [Readable](https://nodejs.org/docs/latest-v25.x/api/stream.html#readable-streams) stream and a single `output` [Writable](https://nodejs.org/docs/latest-v25.x/api/stream.html#writable-streams) stream.
* single `input` [Readable](https://nodejs.org/docs/latest-v24.x/api/stream.html#readable-streams) stream and a single `output` [Writable](https://nodejs.org/docs/latest-v24.x/api/stream.html#writable-streams) stream.
* The `output` stream is used to print prompts for user input that arrives on,
* and is read from, the `input` stream.
* @since v0.1.104
*/
class Interface implements EventEmitter, Disposable {
/**
* NOTE: According to the documentation:
*
* > Instances of the `readline.Interface` class are constructed using the
* > `readline.createInterface()` method.
*
* @see https://nodejs.org/dist/latest-v25.x/docs/api/readline.html#class-interfaceconstructor
*/
protected constructor(
input: NodeJS.ReadableStream,
output?: NodeJS.WritableStream,
completer?: Completer | AsyncCompleter,
terminal?: boolean,
);
/**
* NOTE: According to the documentation:
*
* > Instances of the `readline.Interface` class are constructed using the
* > `readline.createInterface()` method.
*
* @see https://nodejs.org/dist/latest-v25.x/docs/api/readline.html#class-interfaceconstructor
*/
protected constructor(options: ReadLineOptions);
export class Interface extends EventEmitter implements Disposable {
readonly terminal: boolean;
/**
* The current input data being processed by node.
@@ -125,6 +94,29 @@ declare module "node:readline" {
* @since v0.1.98
*/
readonly cursor: number;
/**
* NOTE: According to the documentation:
*
* > Instances of the `readline.Interface` class are constructed using the
* > `readline.createInterface()` method.
*
* @see https://nodejs.org/dist/latest-v24.x/docs/api/readline.html#class-interfaceconstructor
*/
protected constructor(
input: NodeJS.ReadableStream,
output?: NodeJS.WritableStream,
completer?: Completer | AsyncCompleter,
terminal?: boolean,
);
/**
* NOTE: According to the documentation:
*
* > Instances of the `readline.Interface` class are constructed using the
* > `readline.createInterface()` method.
*
* @see https://nodejs.org/dist/latest-v24.x/docs/api/readline.html#class-interfaceconstructor
*/
protected constructor(options: ReadLineOptions);
/**
* The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`.
* @since v15.3.0, v14.17.0
@@ -252,23 +244,87 @@ declare module "node:readline" {
* @since v13.5.0, v12.16.0
*/
getCursorPos(): CursorPos;
/**
* events.EventEmitter
* 1. close
* 2. line
* 3. pause
* 4. resume
* 5. SIGCONT
* 6. SIGINT
* 7. SIGTSTP
* 8. history
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "line", listener: (input: string) => void): this;
addListener(event: "pause", listener: () => void): this;
addListener(event: "resume", listener: () => void): this;
addListener(event: "SIGCONT", listener: () => void): this;
addListener(event: "SIGINT", listener: () => void): this;
addListener(event: "SIGTSTP", listener: () => void): this;
addListener(event: "history", listener: (history: string[]) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "close"): boolean;
emit(event: "line", input: string): boolean;
emit(event: "pause"): boolean;
emit(event: "resume"): boolean;
emit(event: "SIGCONT"): boolean;
emit(event: "SIGINT"): boolean;
emit(event: "SIGTSTP"): boolean;
emit(event: "history", history: string[]): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: () => void): this;
on(event: "line", listener: (input: string) => void): this;
on(event: "pause", listener: () => void): this;
on(event: "resume", listener: () => void): this;
on(event: "SIGCONT", listener: () => void): this;
on(event: "SIGINT", listener: () => void): this;
on(event: "SIGTSTP", listener: () => void): this;
on(event: "history", listener: (history: string[]) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "line", listener: (input: string) => void): this;
once(event: "pause", listener: () => void): this;
once(event: "resume", listener: () => void): this;
once(event: "SIGCONT", listener: () => void): this;
once(event: "SIGINT", listener: () => void): this;
once(event: "SIGTSTP", listener: () => void): this;
once(event: "history", listener: (history: string[]) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "line", listener: (input: string) => void): this;
prependListener(event: "pause", listener: () => void): this;
prependListener(event: "resume", listener: () => void): this;
prependListener(event: "SIGCONT", listener: () => void): this;
prependListener(event: "SIGINT", listener: () => void): this;
prependListener(event: "SIGTSTP", listener: () => void): this;
prependListener(event: "history", listener: (history: string[]) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "line", listener: (input: string) => void): this;
prependOnceListener(event: "pause", listener: () => void): this;
prependOnceListener(event: "resume", listener: () => void): this;
prependOnceListener(event: "SIGCONT", listener: () => void): this;
prependOnceListener(event: "SIGINT", listener: () => void): this;
prependOnceListener(event: "SIGTSTP", listener: () => void): this;
prependOnceListener(event: "history", listener: (history: string[]) => void): this;
[Symbol.asyncIterator](): NodeJS.AsyncIterator<string>;
}
interface Interface extends InternalEventEmitter<InterfaceEventMap> {}
type ReadLine = Interface; // type forwarded for backwards compatibility
type Completer = (line: string) => CompleterResult;
type AsyncCompleter = (
export type ReadLine = Interface; // type forwarded for backwards compatibility
export type Completer = (line: string) => CompleterResult;
export type AsyncCompleter = (
line: string,
callback: (err?: null | Error, result?: CompleterResult) => void,
) => void;
type CompleterResult = [string[], string];
interface ReadLineOptions {
export type CompleterResult = [string[], string];
export interface ReadLineOptions {
/**
* The [`Readable`](https://nodejs.org/docs/latest-v25.x/api/stream.html#readable-streams) stream to listen to
* The [`Readable`](https://nodejs.org/docs/latest-v24.x/api/stream.html#readable-streams) stream to listen to
*/
input: NodeJS.ReadableStream;
/**
* The [`Writable`](https://nodejs.org/docs/latest-v25.x/api/stream.html#writable-streams) stream to write readline data to.
* The [`Writable`](https://nodejs.org/docs/latest-v24.x/api/stream.html#writable-streams) stream to write readline data to.
*/
output?: NodeJS.WritableStream | undefined;
/**
@@ -313,7 +369,7 @@ declare module "node:readline" {
* `crlfDelay` will be coerced to a number no less than `100`.
* It can be set to `Infinity`, in which case
* `\r` followed by `\n` will always be considered a single newline
* (which may be reasonable for [reading files](https://nodejs.org/docs/latest-v25.x/api/readline.html#example-read-file-stream-line-by-line) with `\r\n` line delimiter).
* (which may be reasonable for [reading files](https://nodejs.org/docs/latest-v24.x/api/readline.html#example-read-file-stream-line-by-line) with `\r\n` line delimiter).
* @default 100
*/
crlfDelay?: number | undefined;
@@ -366,13 +422,13 @@ declare module "node:readline" {
* waiting for user input, call `process.stdin.unref()`.
* @since v0.1.98
*/
function createInterface(
export function createInterface(
input: NodeJS.ReadableStream,
output?: NodeJS.WritableStream,
completer?: Completer | AsyncCompleter,
terminal?: boolean,
): Interface;
function createInterface(options: ReadLineOptions): Interface;
export function createInterface(options: ReadLineOptions): Interface;
/**
* The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input.
*
@@ -494,48 +550,45 @@ declare module "node:readline" {
* ```
* @since v0.7.7
*/
function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
type Direction = -1 | 0 | 1;
interface CursorPos {
export function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
export type Direction = -1 | 0 | 1;
export interface CursorPos {
rows: number;
cols: number;
}
/**
* The `readline.clearLine()` method clears current line of given [TTY](https://nodejs.org/docs/latest-v25.x/api/tty.html) stream
* The `readline.clearLine()` method clears current line of given [TTY](https://nodejs.org/docs/latest-v24.x/api/tty.html) stream
* in a specified direction identified by `dir`.
* @since v0.7.7
* @param callback Invoked once the operation completes.
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
*/
function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
/**
* The `readline.clearScreenDown()` method clears the given [TTY](https://nodejs.org/docs/latest-v25.x/api/tty.html) stream from
* The `readline.clearScreenDown()` method clears the given [TTY](https://nodejs.org/docs/latest-v24.x/api/tty.html) stream from
* the current position of the cursor down.
* @since v0.7.7
* @param callback Invoked once the operation completes.
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
*/
function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
/**
* The `readline.cursorTo()` method moves cursor to the specified position in a
* given [TTY](https://nodejs.org/docs/latest-v25.x/api/tty.html) `stream`.
* given [TTY](https://nodejs.org/docs/latest-v24.x/api/tty.html) `stream`.
* @since v0.7.7
* @param callback Invoked once the operation completes.
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
*/
function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
/**
* The `readline.moveCursor()` method moves the cursor _relative_ to its current
* position in a given [TTY](https://nodejs.org/docs/latest-v25.x/api/tty.html) `stream`.
* position in a given [TTY](https://nodejs.org/docs/latest-v24.x/api/tty.html) `stream`.
* @since v0.7.7
* @param callback Invoked once the operation completes.
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
*/
function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
export function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
}
declare module "node:readline" {
export * as promises from "node:readline/promises";
}
declare module "readline" {
export * from "node:readline";
export * from "readline";
}

View File

@@ -1,7 +1,7 @@
/**
* @since v17.0.0
*/
declare module "node:readline/promises" {
declare module "readline/promises" {
import { Abortable } from "node:events";
import {
CompleterResult,
@@ -64,7 +64,7 @@ declare module "node:readline/promises" {
constructor(
stream: NodeJS.WritableStream,
options?: {
autoCommit?: boolean | undefined;
autoCommit?: boolean;
},
);
/**
@@ -156,6 +156,6 @@ declare module "node:readline/promises" {
): Interface;
function createInterface(options: ReadLineOptions): Interface;
}
declare module "readline/promises" {
export * from "node:readline/promises";
declare module "node:readline/promises" {
export * from "readline/promises";
}

173
node_modules/@types/node/repl.d.ts generated vendored
View File

@@ -6,12 +6,12 @@
* ```js
* import repl from 'node:repl';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/repl.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/repl.js)
*/
declare module "node:repl" {
import { AsyncCompleter, Completer, Interface, InterfaceEventMap } from "node:readline";
import { InspectOptions } from "node:util";
declare module "repl" {
import { AsyncCompleter, Completer, Interface } from "node:readline";
import { Context } from "node:vm";
import { InspectOptions } from "node:util";
interface ReplOptions {
/**
* The input prompt to display.
@@ -39,7 +39,7 @@ declare module "node:repl" {
* The function to be used when evaluating each given line of input.
* **Default:** an async wrapper for the JavaScript `eval()` function. An `eval` function can
* error with `repl.Recoverable` to indicate the input was incomplete and prompt for
* additional lines. See the [custom evaluation functions](https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#custom-evaluation-functions)
* additional lines. See the [custom evaluation functions](https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#custom-evaluation-functions)
* section for more details.
*/
eval?: REPLEval | undefined;
@@ -72,13 +72,13 @@ declare module "node:repl" {
* The function to invoke to format the output of each command before writing to `output`.
* @default a wrapper for `util.inspect`
*
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_customizing_repl_output
* @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_customizing_repl_output
*/
writer?: REPLWriter | undefined;
/**
* An optional function used for custom Tab auto completion.
*
* @see https://nodejs.org/dist/latest-v25.x/docs/api/readline.html#readline_use_of_the_completer_function
* @see https://nodejs.org/dist/latest-v24.x/docs/api/readline.html#readline_use_of_the_completer_function
*/
completer?: Completer | AsyncCompleter | undefined;
/**
@@ -129,10 +129,6 @@ declare module "node:repl" {
removeHistoryDuplicates?: boolean | undefined;
onHistoryFileLoaded?: ((err: Error | null, repl: REPLServer) => void) | undefined;
}
interface REPLServerEventMap extends InterfaceEventMap {
"exit": [];
"reset": [context: Context];
}
/**
* Instances of `repl.REPLServer` are created using the {@link start} method
* or directly using the JavaScript `new` keyword.
@@ -148,17 +144,6 @@ declare module "node:repl" {
* @since v0.1.91
*/
class REPLServer extends Interface {
/**
* NOTE: According to the documentation:
*
* > Instances of `repl.REPLServer` are created using the `repl.start()` method and
* > _should not_ be created directly using the JavaScript `new` keyword.
*
* `REPLServer` cannot be subclassed due to implementation specifics in NodeJS.
*
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_class_replserver
*/
private constructor();
/**
* The `vm.Context` provided to the `eval` function to be used for JavaScript
* evaluation.
@@ -187,33 +172,33 @@ declare module "node:repl" {
/**
* A value indicating whether the REPL is currently in "editor mode".
*
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_commands_and_special_keys
* @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_commands_and_special_keys
*/
readonly editorMode: boolean;
/**
* A value indicating whether the `_` variable has been assigned.
*
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly underscoreAssigned: boolean;
/**
* The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL).
*
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly last: any;
/**
* A value indicating whether the `_error` variable has been assigned.
*
* @since v9.8.0
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly underscoreErrAssigned: boolean;
/**
* The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL).
*
* @since v9.8.0
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly lastError: any;
/**
@@ -257,6 +242,17 @@ declare module "node:repl" {
* prefacing every repl statement with `'use strict'`.
*/
readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT;
/**
* NOTE: According to the documentation:
*
* > Instances of `repl.REPLServer` are created using the `repl.start()` method and
* > _should not_ be created directly using the JavaScript `new` keyword.
*
* `REPLServer` cannot be subclassed due to implementation specifics in NodeJS.
*
* @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_class_replserver
*/
private constructor();
/**
* The `replServer.defineCommand()` method is used to add new `.`\-prefixed commands
* to the REPL instance. Such commands are invoked by typing a `.` followed by the `keyword`. The `cmd` is either a `Function` or an `Object` with the following
@@ -331,51 +327,78 @@ declare module "node:repl" {
historyConfig?: REPLServerSetupHistoryOptions,
callback?: (err: Error | null, repl: this) => void,
): void;
// #region InternalEventEmitter
addListener<E extends keyof REPLServerEventMap>(
eventName: E,
listener: (...args: REPLServerEventMap[E]) => void,
): this;
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
emit<E extends keyof REPLServerEventMap>(eventName: E, ...args: REPLServerEventMap[E]): boolean;
emit(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<E extends keyof REPLServerEventMap>(
eventName: E,
listener?: (...args: REPLServerEventMap[E]) => void,
): number;
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
listeners<E extends keyof REPLServerEventMap>(eventName: E): ((...args: REPLServerEventMap[E]) => void)[];
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
off<E extends keyof REPLServerEventMap>(eventName: E, listener: (...args: REPLServerEventMap[E]) => void): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
on<E extends keyof REPLServerEventMap>(eventName: E, listener: (...args: REPLServerEventMap[E]) => void): this;
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
once<E extends keyof REPLServerEventMap>(
eventName: E,
listener: (...args: REPLServerEventMap[E]) => void,
): this;
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependListener<E extends keyof REPLServerEventMap>(
eventName: E,
listener: (...args: REPLServerEventMap[E]) => void,
): this;
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener<E extends keyof REPLServerEventMap>(
eventName: E,
listener: (...args: REPLServerEventMap[E]) => void,
): this;
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
rawListeners<E extends keyof REPLServerEventMap>(eventName: E): ((...args: REPLServerEventMap[E]) => void)[];
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
removeAllListeners<E extends keyof REPLServerEventMap>(eventName?: E): this;
removeAllListeners(eventName?: string | symbol): this;
removeListener<E extends keyof REPLServerEventMap>(
eventName: E,
listener: (...args: REPLServerEventMap[E]) => void,
): this;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
// #endregion
/**
* events.EventEmitter
* 1. close - inherited from `readline.Interface`
* 2. line - inherited from `readline.Interface`
* 3. pause - inherited from `readline.Interface`
* 4. resume - inherited from `readline.Interface`
* 5. SIGCONT - inherited from `readline.Interface`
* 6. SIGINT - inherited from `readline.Interface`
* 7. SIGTSTP - inherited from `readline.Interface`
* 8. exit
* 9. reset
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "line", listener: (input: string) => void): this;
addListener(event: "pause", listener: () => void): this;
addListener(event: "resume", listener: () => void): this;
addListener(event: "SIGCONT", listener: () => void): this;
addListener(event: "SIGINT", listener: () => void): this;
addListener(event: "SIGTSTP", listener: () => void): this;
addListener(event: "exit", listener: () => void): this;
addListener(event: "reset", listener: (context: Context) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "close"): boolean;
emit(event: "line", input: string): boolean;
emit(event: "pause"): boolean;
emit(event: "resume"): boolean;
emit(event: "SIGCONT"): boolean;
emit(event: "SIGINT"): boolean;
emit(event: "SIGTSTP"): boolean;
emit(event: "exit"): boolean;
emit(event: "reset", context: Context): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: () => void): this;
on(event: "line", listener: (input: string) => void): this;
on(event: "pause", listener: () => void): this;
on(event: "resume", listener: () => void): this;
on(event: "SIGCONT", listener: () => void): this;
on(event: "SIGINT", listener: () => void): this;
on(event: "SIGTSTP", listener: () => void): this;
on(event: "exit", listener: () => void): this;
on(event: "reset", listener: (context: Context) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "line", listener: (input: string) => void): this;
once(event: "pause", listener: () => void): this;
once(event: "resume", listener: () => void): this;
once(event: "SIGCONT", listener: () => void): this;
once(event: "SIGINT", listener: () => void): this;
once(event: "SIGTSTP", listener: () => void): this;
once(event: "exit", listener: () => void): this;
once(event: "reset", listener: (context: Context) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "line", listener: (input: string) => void): this;
prependListener(event: "pause", listener: () => void): this;
prependListener(event: "resume", listener: () => void): this;
prependListener(event: "SIGCONT", listener: () => void): this;
prependListener(event: "SIGINT", listener: () => void): this;
prependListener(event: "SIGTSTP", listener: () => void): this;
prependListener(event: "exit", listener: () => void): this;
prependListener(event: "reset", listener: (context: Context) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "line", listener: (input: string) => void): this;
prependOnceListener(event: "pause", listener: () => void): this;
prependOnceListener(event: "resume", listener: () => void): this;
prependOnceListener(event: "SIGCONT", listener: () => void): this;
prependOnceListener(event: "SIGINT", listener: () => void): this;
prependOnceListener(event: "SIGTSTP", listener: () => void): this;
prependOnceListener(event: "exit", listener: () => void): this;
prependOnceListener(event: "reset", listener: (context: Context) => void): this;
}
/**
* A flag passed in the REPL options. Evaluates expressions in sloppy mode.
@@ -403,13 +426,13 @@ declare module "node:repl" {
/**
* Indicates a recoverable error that a `REPLServer` can use to support multi-line input.
*
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_recoverable_errors
* @see https://nodejs.org/dist/latest-v24.x/docs/api/repl.html#repl_recoverable_errors
*/
class Recoverable extends SyntaxError {
err: Error;
constructor(err: Error);
}
}
declare module "repl" {
export * from "node:repl";
declare module "node:repl" {
export * from "repl";
}

11
node_modules/@types/node/sea.d.ts generated vendored
View File

@@ -111,7 +111,7 @@
* ```
* @since v19.7.0, v18.16.0
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v25.x/src/node_sea.cc)
* @see [source](https://github.com/nodejs/node/blob/v24.x/src/node_sea.cc)
*/
declare module "node:sea" {
type AssetKey = string;
@@ -150,13 +150,4 @@ declare module "node:sea" {
* @since v20.12.0
*/
function getRawAsset(key: AssetKey): ArrayBuffer;
/**
* This method can be used to retrieve an array of all the keys of assets
* embedded into the single-executable application.
* An error is thrown when not running inside a single-executable application.
* @since v24.8.0
* @returns An array containing all the keys of the assets
* embedded in the executable. If no assets are embedded, returns an empty array.
*/
function getAssetKeys(): string[];
}

258
node_modules/@types/node/sqlite.d.ts generated vendored
View File

@@ -40,12 +40,13 @@
* ```
* @since v22.5.0
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/sqlite.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/sqlite.js)
*/
declare module "node:sqlite" {
import { PathLike } from "node:fs";
type SQLInputValue = null | number | bigint | string | NodeJS.ArrayBufferView;
type SQLOutputValue = null | number | bigint | string | NodeJS.NonSharedUint8Array;
type SQLOutputValue = null | number | bigint | string | Uint8Array;
/** @deprecated Use `SQLInputValue` or `SQLOutputValue` instead. */
type SupportedValueType = SQLOutputValue;
interface DatabaseSyncOptions {
/**
* If `true`, the database is opened by the constructor. When
@@ -123,14 +124,6 @@ declare module "node:sqlite" {
* @default false
*/
allowUnknownNamedParameters?: boolean | undefined;
/**
* If `true`, enables the defensive flag. When the defensive flag is enabled,
* language features that allow ordinary SQL to deliberately corrupt the database file are disabled.
* The defensive flag can also be set using `enableDefensive()`.
* @since v25.1.0
* @default false
*/
defensive?: boolean | undefined;
}
interface CreateSessionOptions {
/**
@@ -247,7 +240,7 @@ declare module "node:sqlite" {
* To use an in-memory database, the path should be the special name `':memory:'`.
* @param options Configuration options for the database connection.
*/
constructor(path: PathLike, options?: DatabaseSyncOptions);
constructor(path: string | Buffer | URL, options?: DatabaseSyncOptions);
/**
* Registers a new aggregate function with the SQLite database. This method is a wrapper around
* [`sqlite3_create_window_function()`](https://www.sqlite.org/c3ref/create_function.html).
@@ -302,14 +295,6 @@ declare module "node:sqlite" {
* @param allow Whether to allow loading extensions.
*/
enableLoadExtension(allow: boolean): void;
/**
* Enables or disables the defensive flag. When the defensive flag is active,
* language features that allow ordinary SQL to deliberately corrupt the database file are disabled.
* See [`SQLITE_DBCONFIG_DEFENSIVE`](https://www.sqlite.org/c3ref/c_dbconfig_defensive.html#sqlitedbconfigdefensive) in the SQLite documentation for details.
* @since v25.1.0
* @param active Whether to set the defensive flag.
*/
enableDefensive(active: boolean): void;
/**
* This method is a wrapper around [`sqlite3_db_filename()`](https://sqlite.org/c3ref/db_filename.html)
* @since v24.0.0
@@ -336,7 +321,7 @@ declare module "node:sqlite" {
* @param func The JavaScript function to call when the SQLite
* function is invoked. The return value of this function should be a valid
* SQLite data type: see
* [Type conversion between JavaScript and SQLite](https://nodejs.org/docs/latest-v25.x/api/sqlite.html#type-conversion-between-javascript-and-sqlite).
* [Type conversion between JavaScript and SQLite](https://nodejs.org/docs/latest-v24.x/api/sqlite.html#type-conversion-between-javascript-and-sqlite).
* The result defaults to `NULL` if the return value is `undefined`.
*/
function(
@@ -345,64 +330,6 @@ declare module "node:sqlite" {
func: (...args: SQLOutputValue[]) => SQLInputValue,
): void;
function(name: string, func: (...args: SQLOutputValue[]) => SQLInputValue): void;
/**
* Sets an authorizer callback that SQLite will invoke whenever it attempts to
* access data or modify the database schema through prepared statements.
* This can be used to implement security policies, audit access, or restrict certain operations.
* This method is a wrapper around [`sqlite3_set_authorizer()`](https://sqlite.org/c3ref/set_authorizer.html).
*
* When invoked, the callback receives five arguments:
*
* * `actionCode` {number} The type of operation being performed (e.g.,
* `SQLITE_INSERT`, `SQLITE_UPDATE`, `SQLITE_SELECT`).
* * `arg1` {string|null} The first argument (context-dependent, often a table name).
* * `arg2` {string|null} The second argument (context-dependent, often a column name).
* * `dbName` {string|null} The name of the database.
* * `triggerOrView` {string|null} The name of the trigger or view causing the access.
*
* The callback must return one of the following constants:
*
* * `SQLITE_OK` - Allow the operation.
* * `SQLITE_DENY` - Deny the operation (causes an error).
* * `SQLITE_IGNORE` - Ignore the operation (silently skip).
*
* ```js
* import { DatabaseSync, constants } from 'node:sqlite';
* const db = new DatabaseSync(':memory:');
*
* // Set up an authorizer that denies all table creation
* db.setAuthorizer((actionCode) => {
* if (actionCode === constants.SQLITE_CREATE_TABLE) {
* return constants.SQLITE_DENY;
* }
* return constants.SQLITE_OK;
* });
*
* // This will work
* db.prepare('SELECT 1').get();
*
* // This will throw an error due to authorization denial
* try {
* db.exec('CREATE TABLE blocked (id INTEGER)');
* } catch (err) {
* console.log('Operation blocked:', err.message);
* }
* ```
* @since v24.10.0
* @param callback The authorizer function to set, or `null` to
* clear the current authorizer.
*/
setAuthorizer(
callback:
| ((
actionCode: number,
arg1: string | null,
arg2: string | null,
dbName: string | null,
triggerOrView: string | null,
) => number)
| null,
): void;
/**
* Whether the database is currently open or not.
* @since v22.15.0
@@ -428,47 +355,6 @@ declare module "node:sqlite" {
* @return The prepared statement.
*/
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.
*
* 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.
*
* ```js
* import { DatabaseSync } from 'node:sqlite';
*
* const db = new DatabaseSync(':memory:');
* const sql = db.createSQLTagStore();
*
* db.exec('CREATE TABLE users (id INT, name TEXT)');
*
* // Using the 'run' method to insert data.
* // The tagged literal is used to identify the prepared statement.
* sql.run`INSERT INTO users VALUES (1, 'Alice')`;
* 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}`;
* console.log(user); // { id: 1, name: 'Alice' }
*
* // Using the 'all' method to retrieve all rows.
* const allUsers = sql.all`SELECT * FROM users ORDER BY id`;
* console.log(allUsers);
* // [
* // { id: 1, name: 'Alice' },
* // { id: 2, name: 'Bob' }
* // ]
* ```
* @since v24.9.0
* @returns A new SQL tag store for caching prepared statements.
*/
createTagStore(maxSize?: number): SQLTagStore;
/**
* Creates and attaches a session to the database. This method is a wrapper around
* [`sqlite3session_create()`](https://www.sqlite.org/session/sqlite3session_create.html) and
@@ -484,8 +370,6 @@ 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:');
*
@@ -526,7 +410,7 @@ declare module "node:sqlite" {
* @returns Binary changeset that can be applied to other databases.
* @since v22.12.0
*/
changeset(): NodeJS.NonSharedUint8Array;
changeset(): Uint8Array;
/**
* Similar to the method above, but generates a more compact patchset. See
* [Changesets and Patchsets](https://www.sqlite.org/sessionintro.html#changesets_and_patchsets)
@@ -536,7 +420,7 @@ declare module "node:sqlite" {
* @returns Binary patchset that can be applied to other databases.
* @since v22.12.0
*/
patchset(): NodeJS.NonSharedUint8Array;
patchset(): Uint8Array;
/**
* Closes the session. An exception is thrown if the database or the session is not open. This method is a
* wrapper around
@@ -544,73 +428,6 @@ declare module "node:sqlite" {
*/
close(): 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
* 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
* class execute synchronously.
* @since v24.9.0
*/
interface SQLTagStore {
/**
* Executes the given SQL query and returns all resulting rows as an array of objects.
* @since v24.9.0
*/
all(
stringElements: TemplateStringsArray,
...boundParameters: SQLInputValue[]
): Record<string, SQLOutputValue>[];
/**
* Executes the given SQL query and returns the first resulting row as an object.
* @since v24.9.0
*/
get(
stringElements: TemplateStringsArray,
...boundParameters: SQLInputValue[]
): Record<string, SQLOutputValue> | undefined;
/**
* Executes the given SQL query and returns an iterator over the resulting rows.
* @since v24.9.0
*/
iterate(
stringElements: TemplateStringsArray,
...boundParameters: SQLInputValue[]
): NodeJS.Iterator<Record<string, SQLOutputValue>>;
/**
* Executes the given SQL query, which is expected to not return any rows (e.g., INSERT, UPDATE, DELETE).
* @since v24.9.0
*/
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;
/**
* A read-only property that returns the maximum number of prepared statements the cache can hold.
* @since v24.9.0
*/
readonly capacity: number;
/**
* A read-only property that returns the `DatabaseSync` object associated with this `SQLTagStore`.
* @since v24.9.0
*/
readonly db: DatabaseSync;
/**
* Resets the LRU cache, clearing all stored prepared statements.
* @since v24.9.0
*/
clear(): void;
}
interface StatementColumnMetadata {
/**
* The unaliased name of the column in the origin
@@ -820,9 +637,8 @@ declare module "node:sqlite" {
*/
rate?: number | undefined;
/**
* An optional callback function that will be called after each backup step. The argument passed
* to this callback is an `Object` with `remainingPages` and `totalPages` properties, describing the current progress
* of the backup operation.
* Callback function that will be called with the number of pages copied and the total number of
* pages.
*/
progress?: ((progressInfo: BackupProgressInfo) => void) | undefined;
}
@@ -859,10 +675,9 @@ declare module "node:sqlite" {
* the contents will be overwritten.
* @param options Optional configuration for the backup. The
* following properties are supported:
* @returns A promise that fulfills with the total number of backed-up pages upon completion, or rejects if an
* error occurs.
* @returns A promise that resolves when the backup is completed and rejects if an error occurs.
*/
function backup(sourceDb: DatabaseSync, path: PathLike, options?: BackupOptions): Promise<number>;
function backup(sourceDb: DatabaseSync, path: string | Buffer | URL, options?: BackupOptions): Promise<void>;
/**
* @since v22.13.0
*/
@@ -902,54 +717,5 @@ declare module "node:sqlite" {
* @since v22.12.0
*/
const SQLITE_CHANGESET_ABORT: number;
/**
* Deny the operation and cause an error to be returned.
* @since v24.10.0
*/
const SQLITE_DENY: number;
/**
* Ignore the operation and continue as if it had never been requested.
* @since 24.10.0
*/
const SQLITE_IGNORE: number;
/**
* Allow the operation to proceed normally.
* @since v24.10.0
*/
const SQLITE_OK: number;
const SQLITE_CREATE_INDEX: number;
const SQLITE_CREATE_TABLE: number;
const SQLITE_CREATE_TEMP_INDEX: number;
const SQLITE_CREATE_TEMP_TABLE: number;
const SQLITE_CREATE_TEMP_TRIGGER: number;
const SQLITE_CREATE_TEMP_VIEW: number;
const SQLITE_CREATE_TRIGGER: number;
const SQLITE_CREATE_VIEW: number;
const SQLITE_DELETE: number;
const SQLITE_DROP_INDEX: number;
const SQLITE_DROP_TABLE: number;
const SQLITE_DROP_TEMP_INDEX: number;
const SQLITE_DROP_TEMP_TABLE: number;
const SQLITE_DROP_TEMP_TRIGGER: number;
const SQLITE_DROP_TEMP_VIEW: number;
const SQLITE_DROP_TRIGGER: number;
const SQLITE_DROP_VIEW: number;
const SQLITE_INSERT: number;
const SQLITE_PRAGMA: number;
const SQLITE_READ: number;
const SQLITE_SELECT: number;
const SQLITE_TRANSACTION: number;
const SQLITE_UPDATE: number;
const SQLITE_ATTACH: number;
const SQLITE_DETACH: number;
const SQLITE_ALTER_TABLE: number;
const SQLITE_REINDEX: number;
const SQLITE_ANALYZE: number;
const SQLITE_CREATE_VTABLE: number;
const SQLITE_DROP_VTABLE: number;
const SQLITE_FUNCTION: number;
const SQLITE_SAVEPOINT: number;
const SQLITE_COPY: number;
const SQLITE_RECURSIVE: number;
}
}

1078
node_modules/@types/node/stream.d.ts generated vendored

File diff suppressed because it is too large Load Diff

View File

@@ -3,36 +3,36 @@
* streams.
* @since v16.7.0
*/
declare module "node:stream/consumers" {
import { Blob, NonSharedBuffer } from "node:buffer";
import { ReadableStream } from "node:stream/web";
declare module "stream/consumers" {
import { Blob as NodeBlob } from "node:buffer";
import { ReadableStream as WebReadableStream } from "node:stream/web";
/**
* @since v16.7.0
* @returns Fulfills with an `ArrayBuffer` containing the full contents of the stream.
*/
function arrayBuffer(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<ArrayBuffer>;
function arrayBuffer(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<ArrayBuffer>;
/**
* @since v16.7.0
* @returns Fulfills with a `Blob` containing the full contents of the stream.
*/
function blob(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<Blob>;
function blob(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<NodeBlob>;
/**
* @since v16.7.0
* @returns Fulfills with a `Buffer` containing the full contents of the stream.
*/
function buffer(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<NonSharedBuffer>;
function buffer(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<Buffer>;
/**
* @since v16.7.0
* @returns Fulfills with the contents of the stream parsed as a
* UTF-8 encoded string that is then passed through `JSON.parse()`.
*/
function json(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<unknown>;
function json(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<unknown>;
/**
* @since v16.7.0
* @returns Fulfills with the contents of the stream parsed as a UTF-8 encoded string.
*/
function text(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<string>;
function text(stream: WebReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<string>;
}
declare module "stream/consumers" {
export * from "node:stream/consumers";
declare module "node:stream/consumers" {
export * from "stream/consumers";
}

View File

@@ -1,12 +1,12 @@
declare module "node:stream/promises" {
import { Abortable } from "node:events";
declare module "stream/promises" {
import {
FinishedOptions as _FinishedOptions,
PipelineDestination,
PipelineOptions,
PipelinePromise,
PipelineSource,
PipelineTransform,
} from "node:stream";
import { ReadableStream, WritableStream } from "node:stream/web";
interface FinishedOptions extends _FinishedOptions {
/**
* If true, removes the listeners registered by this function before the promise is fulfilled.
@@ -14,130 +14,15 @@ declare module "node:stream/promises" {
*/
cleanup?: boolean | undefined;
}
/**
* ```js
* import { finished } from 'node:stream/promises';
* import { createReadStream } from 'node:fs';
*
* const rs = createReadStream('archive.tar');
*
* async function run() {
* await finished(rs);
* console.log('Stream is done reading.');
* }
*
* run().catch(console.error);
* rs.resume(); // Drain the stream.
* ```
*
* The `finished` API also provides a [callback version](https://nodejs.org/docs/latest-v25.x/api/stream.html#streamfinishedstream-options-callback).
*
* `stream.finished()` leaves dangling event listeners (in particular
* `'error'`, `'end'`, `'finish'` and `'close'`) after the returned promise is
* resolved or rejected. The reason for this is so that unexpected `'error'`
* events (due to incorrect stream implementations) do not cause unexpected
* crashes. If this is unwanted behavior then `options.cleanup` should be set to
* `true`:
*
* ```js
* await finished(rs, { cleanup: true });
* ```
* @since v15.0.0
* @returns Fulfills when the stream is no longer readable or writable.
*/
function finished(
stream: NodeJS.ReadableStream | NodeJS.WritableStream | ReadableStream | WritableStream,
stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream,
options?: FinishedOptions,
): Promise<void>;
interface PipelineOptions extends Abortable {
end?: boolean | undefined;
}
type PipelineResult<S extends PipelineDestination<any, any>> = S extends (...args: any[]) => PromiseLike<infer R>
? Promise<R>
: Promise<void>;
/**
* ```js
* import { pipeline } from 'node:stream/promises';
* import { createReadStream, createWriteStream } from 'node:fs';
* import { createGzip } from 'node:zlib';
*
* await pipeline(
* createReadStream('archive.tar'),
* createGzip(),
* createWriteStream('archive.tar.gz'),
* );
* console.log('Pipeline succeeded.');
* ```
*
* To use an `AbortSignal`, pass it inside an options object, as the last argument.
* When the signal is aborted, `destroy` will be called on the underlying pipeline,
* with an `AbortError`.
*
* ```js
* import { pipeline } from 'node:stream/promises';
* import { createReadStream, createWriteStream } from 'node:fs';
* import { createGzip } from 'node:zlib';
*
* const ac = new AbortController();
* const { signal } = ac;
* setImmediate(() => ac.abort());
* try {
* await pipeline(
* createReadStream('archive.tar'),
* createGzip(),
* createWriteStream('archive.tar.gz'),
* { signal },
* );
* } catch (err) {
* console.error(err); // AbortError
* }
* ```
*
* The `pipeline` API also supports async generators:
*
* ```js
* import { pipeline } from 'node:stream/promises';
* import { createReadStream, createWriteStream } from 'node:fs';
*
* await pipeline(
* createReadStream('lowercase.txt'),
* async function* (source, { signal }) {
* source.setEncoding('utf8'); // Work with strings rather than `Buffer`s.
* for await (const chunk of source) {
* yield await processChunk(chunk, { signal });
* }
* },
* createWriteStream('uppercase.txt'),
* );
* console.log('Pipeline succeeded.');
* ```
*
* Remember to handle the `signal` argument passed into the async generator.
* Especially in the case where the async generator is the source for the
* pipeline (i.e. first argument) or the pipeline will never complete.
*
* ```js
* import { pipeline } from 'node:stream/promises';
* import fs from 'node:fs';
* await pipeline(
* async function* ({ signal }) {
* await someLongRunningfn({ signal });
* yield 'asd';
* },
* fs.createWriteStream('uppercase.txt'),
* );
* console.log('Pipeline succeeded.');
* ```
*
* The `pipeline` API provides [callback version](https://nodejs.org/docs/latest-v25.x/api/stream.html#streampipelinesource-transforms-destination-callback):
* @since v15.0.0
* @returns Fulfills when the pipeline is complete.
*/
function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(
source: A,
destination: B,
options?: PipelineOptions,
): PipelineResult<B>;
): PipelinePromise<B>;
function pipeline<
A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
@@ -147,7 +32,7 @@ declare module "node:stream/promises" {
transform1: T1,
destination: B,
options?: PipelineOptions,
): PipelineResult<B>;
): PipelinePromise<B>;
function pipeline<
A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
@@ -159,7 +44,7 @@ declare module "node:stream/promises" {
transform2: T2,
destination: B,
options?: PipelineOptions,
): PipelineResult<B>;
): PipelinePromise<B>;
function pipeline<
A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
@@ -173,7 +58,7 @@ declare module "node:stream/promises" {
transform3: T3,
destination: B,
options?: PipelineOptions,
): PipelineResult<B>;
): PipelinePromise<B>;
function pipeline<
A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
@@ -189,23 +74,17 @@ declare module "node:stream/promises" {
transform4: T4,
destination: B,
options?: PipelineOptions,
): PipelineResult<B>;
): PipelinePromise<B>;
function pipeline(
streams: readonly [PipelineSource<any>, ...PipelineTransform<any, any>[], PipelineDestination<any, any>],
streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
options?: PipelineOptions,
): Promise<void>;
function pipeline(
...streams: [PipelineSource<any>, ...PipelineTransform<any, any>[], PipelineDestination<any, any>]
): Promise<void>;
function pipeline(
...streams: [
PipelineSource<any>,
...PipelineTransform<any, any>[],
PipelineDestination<any, any>,
options: PipelineOptions,
]
stream1: NodeJS.ReadableStream,
stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>
): Promise<void>;
}
declare module "stream/promises" {
export * from "node:stream/promises";
declare module "node:stream/promises" {
export * from "stream/promises";
}

View File

@@ -1,91 +1,119 @@
declare module "node:stream/web" {
import { TextDecoderCommon, TextDecoderOptions, TextEncoderCommon } from "node:util";
type CompressionFormat = "brotli" | "deflate" | "deflate-raw" | "gzip";
type ReadableStreamController<T> = ReadableStreamDefaultController<T> | ReadableByteStreamController;
type ReadableStreamReader<T> = ReadableStreamDefaultReader<T> | ReadableStreamBYOBReader;
type ReadableStreamReaderMode = "byob";
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
type ReadableStreamType = "bytes";
interface GenericTransformStream {
readonly readable: ReadableStream;
readonly writable: WritableStream;
}
interface QueuingStrategy<T = any> {
highWaterMark?: number;
size?: QueuingStrategySize<T>;
}
interface QueuingStrategyInit {
highWaterMark: number;
}
interface QueuingStrategySize<T = any> {
(chunk: T): number;
}
interface ReadableStreamBYOBReaderReadOptions {
min?: number;
}
interface ReadableStreamGenericReader {
readonly closed: Promise<void>;
cancel(reason?: any): Promise<void>;
}
interface ReadableStreamGetReaderOptions {
mode?: ReadableStreamReaderMode;
}
interface ReadableStreamIteratorOptions {
preventCancel?: boolean;
}
interface ReadableStreamReadDoneResult<T> {
done: true;
value: T | undefined;
}
interface ReadableStreamReadValueResult<T> {
done: false;
value: T;
}
type _ByteLengthQueuingStrategy = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").ByteLengthQueuingStrategy;
type _CompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {}
: import("stream/web").CompressionStream;
type _CountQueuingStrategy = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").CountQueuingStrategy;
type _DecompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {}
: import("stream/web").DecompressionStream;
type _QueuingStrategy<T = any> = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").QueuingStrategy<T>;
type _ReadableByteStreamController = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").ReadableByteStreamController;
type _ReadableStream<R = any> = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").ReadableStream<R>;
type _ReadableStreamBYOBReader = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").ReadableStreamBYOBReader;
type _ReadableStreamBYOBRequest = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").ReadableStreamBYOBRequest;
type _ReadableStreamDefaultController<R = any> = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").ReadableStreamDefaultController<R>;
type _ReadableStreamDefaultReader<R = any> = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").ReadableStreamDefaultReader<R>;
type _TextDecoderStream = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").TextDecoderStream;
type _TextEncoderStream = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").TextEncoderStream;
type _TransformStream<I = any, O = any> = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").TransformStream<I, O>;
type _TransformStreamDefaultController<O = any> = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").TransformStreamDefaultController<O>;
type _WritableStream<W = any> = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").WritableStream<W>;
type _WritableStreamDefaultController = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").WritableStreamDefaultController;
type _WritableStreamDefaultWriter<W = any> = typeof globalThis extends { onmessage: any } ? {}
: import("stream/web").WritableStreamDefaultWriter<W>;
declare module "stream/web" {
// stub module, pending copy&paste from .d.ts or manual impl
// copy from lib.dom.d.ts
interface ReadableWritablePair<R = any, W = any> {
readable: ReadableStream<R>;
/**
* Provides a convenient, chainable way of piping this readable stream
* through a transform stream (or any other { writable, readable }
* pair). It simply pipes the stream into the writable side of the
* supplied pair, and returns the readable side for further use.
*
* Piping a stream will lock it for the duration of the pipe, preventing
* any other consumer from acquiring a reader.
*/
writable: WritableStream<W>;
}
interface StreamPipeOptions {
preventAbort?: boolean;
preventCancel?: boolean;
/**
* Pipes this readable stream to a given writable stream destination.
* The way in which the piping process behaves under various error
* conditions can be customized with a number of passed options. It
* returns a promise that fulfills when the piping process completes
* successfully, or rejects if any errors were encountered.
*
* Piping a stream will lock it for the duration of the pipe, preventing
* any other consumer from acquiring a reader.
*
* Errors and closures of the source and destination streams propagate
* as follows:
*
* An error in this source readable stream will abort destination,
* unless preventAbort is truthy. The returned promise will be rejected
* with the source's error, or with any error that occurs during
* aborting the destination.
*
* An error in destination will cancel this source readable stream,
* unless preventCancel is truthy. The returned promise will be rejected
* with the destination's error, or with any error that occurs during
* canceling the source.
*
* When this source readable stream closes, destination will be closed,
* unless preventClose is truthy. The returned promise will be fulfilled
* once this process completes, unless an error is encountered while
* closing the destination, in which case it will be rejected with that
* error.
*
* If destination starts out closed or closing, this source readable
* stream will be canceled, unless preventCancel is true. The returned
* promise will be rejected with an error indicating piping to a closed
* stream failed, or with any error that occurs during canceling the
* source.
*
* The signal option can be set to an AbortSignal to allow aborting an
* ongoing pipe operation via the corresponding AbortController. In this
* case, this source readable stream will be canceled, and destination
* aborted, unless the respective options preventCancel or preventAbort
* are set.
*/
preventClose?: boolean;
signal?: AbortSignal;
}
interface Transformer<I = any, O = any> {
flush?: TransformerFlushCallback<O>;
readableType?: undefined;
start?: TransformerStartCallback<O>;
transform?: TransformerTransformCallback<I, O>;
writableType?: undefined;
interface ReadableStreamGenericReader {
readonly closed: Promise<void>;
cancel(reason?: any): Promise<void>;
}
interface TransformerFlushCallback<O> {
(controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
interface ReadableStreamReadValueResult<T> {
done: false;
value: T;
}
interface TransformerStartCallback<O> {
(controller: TransformStreamDefaultController<O>): any;
interface ReadableStreamReadDoneResult<T> {
done: true;
value?: T;
}
interface TransformerTransformCallback<I, O> {
(chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
}
interface UnderlyingByteSource {
autoAllocateChunkSize?: number;
cancel?: UnderlyingSourceCancelCallback;
pull?: (controller: ReadableByteStreamController) => void | PromiseLike<void>;
start?: (controller: ReadableByteStreamController) => any;
type: "bytes";
}
interface UnderlyingDefaultSource<R = any> {
cancel?: UnderlyingSourceCancelCallback;
pull?: (controller: ReadableStreamDefaultController<R>) => void | PromiseLike<void>;
start?: (controller: ReadableStreamDefaultController<R>) => any;
type?: undefined;
}
interface UnderlyingSink<W = any> {
abort?: UnderlyingSinkAbortCallback;
close?: UnderlyingSinkCloseCallback;
start?: UnderlyingSinkStartCallback;
type?: undefined;
write?: UnderlyingSinkWriteCallback<W>;
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
interface ReadableByteStreamControllerCallback {
(controller: ReadableByteStreamController): void | PromiseLike<void>;
}
interface UnderlyingSinkAbortCallback {
(reason?: any): void | PromiseLike<void>;
@@ -99,13 +127,6 @@ declare module "node:stream/web" {
interface UnderlyingSinkWriteCallback<W> {
(chunk: W, controller: WritableStreamDefaultController): void | PromiseLike<void>;
}
interface UnderlyingSource<R = any> {
autoAllocateChunkSize?: number;
cancel?: UnderlyingSourceCancelCallback;
pull?: UnderlyingSourcePullCallback<R>;
start?: UnderlyingSourceStartCallback<R>;
type?: ReadableStreamType;
}
interface UnderlyingSourceCancelCallback {
(reason?: any): void | PromiseLike<void>;
}
@@ -115,49 +136,45 @@ declare module "node:stream/web" {
interface UnderlyingSourceStartCallback<R> {
(controller: ReadableStreamController<R>): any;
}
interface ByteLengthQueuingStrategy extends QueuingStrategy<NodeJS.ArrayBufferView> {
readonly highWaterMark: number;
readonly size: QueuingStrategySize<NodeJS.ArrayBufferView>;
interface TransformerFlushCallback<O> {
(controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
}
var ByteLengthQueuingStrategy: {
prototype: ByteLengthQueuingStrategy;
new(init: QueuingStrategyInit): ByteLengthQueuingStrategy;
};
interface CompressionStream extends GenericTransformStream {
readonly readable: ReadableStream<NodeJS.NonSharedUint8Array>;
readonly writable: WritableStream<NodeJS.BufferSource>;
interface TransformerStartCallback<O> {
(controller: TransformStreamDefaultController<O>): any;
}
var CompressionStream: {
prototype: CompressionStream;
new(format: CompressionFormat): CompressionStream;
};
interface CountQueuingStrategy extends QueuingStrategy {
readonly highWaterMark: number;
readonly size: QueuingStrategySize;
interface TransformerTransformCallback<I, O> {
(chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
}
var CountQueuingStrategy: {
prototype: CountQueuingStrategy;
new(init: QueuingStrategyInit): CountQueuingStrategy;
};
interface DecompressionStream extends GenericTransformStream {
readonly readable: ReadableStream<NodeJS.NonSharedUint8Array>;
readonly writable: WritableStream<NodeJS.BufferSource>;
interface TransformerCancelCallback {
(reason: any): void | PromiseLike<void>;
}
var DecompressionStream: {
prototype: DecompressionStream;
new(format: CompressionFormat): DecompressionStream;
};
interface ReadableByteStreamController {
readonly byobRequest: ReadableStreamBYOBRequest | null;
readonly desiredSize: number | null;
close(): void;
enqueue(chunk: NodeJS.NonSharedArrayBufferView): void;
error(e?: any): void;
interface UnderlyingByteSource {
autoAllocateChunkSize?: number;
cancel?: ReadableStreamErrorCallback;
pull?: ReadableByteStreamControllerCallback;
start?: ReadableByteStreamControllerCallback;
type: "bytes";
}
var ReadableByteStreamController: {
prototype: ReadableByteStreamController;
new(): ReadableByteStreamController;
};
interface UnderlyingSource<R = any> {
cancel?: UnderlyingSourceCancelCallback;
pull?: UnderlyingSourcePullCallback<R>;
start?: UnderlyingSourceStartCallback<R>;
type?: undefined;
}
interface UnderlyingSink<W = any> {
abort?: UnderlyingSinkAbortCallback;
close?: UnderlyingSinkCloseCallback;
start?: UnderlyingSinkStartCallback;
type?: undefined;
write?: UnderlyingSinkWriteCallback<W>;
}
interface ReadableStreamErrorCallback {
(reason: any): void | PromiseLike<void>;
}
interface ReadableStreamAsyncIterator<T> extends NodeJS.AsyncIterator<T, NodeJS.BuiltinIteratorReturn, unknown> {
[Symbol.asyncIterator](): ReadableStreamAsyncIterator<T>;
}
/** This Streams API interface represents a readable stream of byte data. */
interface ReadableStream<R = any> {
readonly locked: boolean;
cancel(reason?: any): Promise<void>;
@@ -167,81 +184,96 @@ declare module "node:stream/web" {
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
tee(): [ReadableStream<R>, ReadableStream<R>];
[Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
values(options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
values(options?: { preventCancel?: boolean }): ReadableStreamAsyncIterator<R>;
[Symbol.asyncIterator](): ReadableStreamAsyncIterator<R>;
}
var ReadableStream: {
const ReadableStream: {
prototype: ReadableStream;
new(
underlyingSource: UnderlyingByteSource,
strategy?: { highWaterMark?: number },
): ReadableStream<NodeJS.NonSharedUint8Array>;
new<R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
from<T>(iterable: Iterable<T> | AsyncIterable<T>): ReadableStream<T>;
new(underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;
new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
from<R = any>(iterable: Iterable<R> | AsyncIterable<R>): ReadableStream<R>;
};
interface ReadableStreamAsyncIterator<T> extends NodeJS.AsyncIterator<T, NodeJS.BuiltinIteratorReturn, unknown> {
[Symbol.asyncIterator](): ReadableStreamAsyncIterator<T>;
type ReadableStreamReaderMode = "byob";
interface ReadableStreamGetReaderOptions {
/**
* Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
*
* This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.
*/
mode?: ReadableStreamReaderMode;
}
interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
read<T extends NodeJS.NonSharedArrayBufferView>(
view: T,
options?: ReadableStreamBYOBReaderReadOptions,
): Promise<ReadableStreamReadResult<T>>;
type ReadableStreamReader<T> = ReadableStreamDefaultReader<T> | ReadableStreamBYOBReader;
interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader {
read(): Promise<ReadableStreamReadResult<R>>;
releaseLock(): void;
}
var ReadableStreamBYOBReader: {
prototype: ReadableStreamBYOBReader;
new(stream: ReadableStream<NodeJS.NonSharedUint8Array>): ReadableStreamBYOBReader;
};
interface ReadableStreamBYOBRequest {
readonly view: NodeJS.NonSharedArrayBufferView | null;
respond(bytesWritten: number): void;
respondWithNewView(view: NodeJS.NonSharedArrayBufferView): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader) */
interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read) */
read<T extends ArrayBufferView>(
view: T,
options?: {
min?: number;
},
): Promise<ReadableStreamReadResult<T>>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock) */
releaseLock(): void;
}
var ReadableStreamBYOBRequest: {
const ReadableStreamDefaultReader: {
prototype: ReadableStreamDefaultReader;
new<R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
};
const ReadableStreamBYOBReader: {
prototype: ReadableStreamBYOBReader;
new(stream: ReadableStream): ReadableStreamBYOBReader;
};
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest) */
interface ReadableStreamBYOBRequest {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view) */
readonly view: ArrayBufferView | null;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond) */
respond(bytesWritten: number): void;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView) */
respondWithNewView(view: ArrayBufferView): void;
}
const ReadableStreamBYOBRequest: {
prototype: ReadableStreamBYOBRequest;
new(): ReadableStreamBYOBRequest;
};
interface ReadableByteStreamController {
readonly byobRequest: undefined;
readonly desiredSize: number | null;
close(): void;
enqueue(chunk: ArrayBufferView): void;
error(error?: any): void;
}
const ReadableByteStreamController: {
prototype: ReadableByteStreamController;
new(): ReadableByteStreamController;
};
interface ReadableStreamDefaultController<R = any> {
readonly desiredSize: number | null;
close(): void;
enqueue(chunk?: R): void;
error(e?: any): void;
}
var ReadableStreamDefaultController: {
const ReadableStreamDefaultController: {
prototype: ReadableStreamDefaultController;
new(): ReadableStreamDefaultController;
};
interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader {
read(): Promise<ReadableStreamReadResult<R>>;
releaseLock(): void;
interface Transformer<I = any, O = any> {
flush?: TransformerFlushCallback<O>;
readableType?: undefined;
start?: TransformerStartCallback<O>;
transform?: TransformerTransformCallback<I, O>;
cancel?: TransformerCancelCallback;
writableType?: undefined;
}
var ReadableStreamDefaultReader: {
prototype: ReadableStreamDefaultReader;
new<R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
};
interface TextDecoderStream extends GenericTransformStream, TextDecoderCommon {
readonly readable: ReadableStream<string>;
readonly writable: WritableStream<NodeJS.BufferSource>;
}
var TextDecoderStream: {
prototype: TextDecoderStream;
new(label?: string, options?: TextDecoderOptions): TextDecoderStream;
};
interface TextEncoderStream extends GenericTransformStream, TextEncoderCommon {
readonly readable: ReadableStream<NodeJS.NonSharedUint8Array>;
readonly writable: WritableStream<string>;
}
var TextEncoderStream: {
prototype: TextEncoderStream;
new(): TextEncoderStream;
};
interface TransformStream<I = any, O = any> {
readonly readable: ReadableStream<O>;
readonly writable: WritableStream<I>;
}
var TransformStream: {
const TransformStream: {
prototype: TransformStream;
new<I = any, O = any>(
transformer?: Transformer<I, O>,
@@ -255,28 +287,31 @@ declare module "node:stream/web" {
error(reason?: any): void;
terminate(): void;
}
var TransformStreamDefaultController: {
const TransformStreamDefaultController: {
prototype: TransformStreamDefaultController;
new(): TransformStreamDefaultController;
};
/**
* This Streams API interface provides a standard abstraction for writing
* streaming data to a destination, known as a sink. This object comes with
* built-in back pressure and queuing.
*/
interface WritableStream<W = any> {
readonly locked: boolean;
abort(reason?: any): Promise<void>;
close(): Promise<void>;
getWriter(): WritableStreamDefaultWriter<W>;
}
var WritableStream: {
const WritableStream: {
prototype: WritableStream;
new<W = any>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
};
interface WritableStreamDefaultController {
readonly signal: AbortSignal;
error(e?: any): void;
}
var WritableStreamDefaultController: {
prototype: WritableStreamDefaultController;
new(): WritableStreamDefaultController;
};
/**
* This Streams API interface is the object returned by
* WritableStream.getWriter() and once created locks the < writer to the
* WritableStream ensuring that no other streams can write to the underlying
* sink.
*/
interface WritableStreamDefaultWriter<W = any> {
readonly closed: Promise<void>;
readonly desiredSize: number | null;
@@ -286,11 +321,302 @@ declare module "node:stream/web" {
releaseLock(): void;
write(chunk?: W): Promise<void>;
}
var WritableStreamDefaultWriter: {
const WritableStreamDefaultWriter: {
prototype: WritableStreamDefaultWriter;
new<W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
};
/**
* This Streams API interface represents a controller allowing control of a
* WritableStream's state. When constructing a WritableStream, the
* underlying sink is given a corresponding WritableStreamDefaultController
* instance to manipulate.
*/
interface WritableStreamDefaultController {
error(e?: any): void;
}
const WritableStreamDefaultController: {
prototype: WritableStreamDefaultController;
new(): WritableStreamDefaultController;
};
interface QueuingStrategy<T = any> {
highWaterMark?: number;
size?: QueuingStrategySize<T>;
}
interface QueuingStrategySize<T = any> {
(chunk?: T): number;
}
interface QueuingStrategyInit {
/**
* Creates a new ByteLengthQueuingStrategy with the provided high water
* mark.
*
* Note that the provided high water mark will not be validated ahead of
* time. Instead, if it is negative, NaN, or not a number, the resulting
* ByteLengthQueuingStrategy will cause the corresponding stream
* constructor to throw.
*/
highWaterMark: number;
}
/**
* This Streams API interface provides a built-in byte length queuing
* strategy that can be used when constructing streams.
*/
interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
readonly highWaterMark: number;
readonly size: QueuingStrategySize<ArrayBufferView>;
}
const ByteLengthQueuingStrategy: {
prototype: ByteLengthQueuingStrategy;
new(init: QueuingStrategyInit): ByteLengthQueuingStrategy;
};
/**
* This Streams API interface provides a built-in byte length queuing
* strategy that can be used when constructing streams.
*/
interface CountQueuingStrategy extends QueuingStrategy {
readonly highWaterMark: number;
readonly size: QueuingStrategySize;
}
const CountQueuingStrategy: {
prototype: CountQueuingStrategy;
new(init: QueuingStrategyInit): CountQueuingStrategy;
};
interface TextEncoderStream {
/** Returns "utf-8". */
readonly encoding: "utf-8";
readonly readable: ReadableStream<Uint8Array>;
readonly writable: WritableStream<string>;
readonly [Symbol.toStringTag]: string;
}
const TextEncoderStream: {
prototype: TextEncoderStream;
new(): TextEncoderStream;
};
interface TextDecoderOptions {
fatal?: boolean;
ignoreBOM?: boolean;
}
type BufferSource = ArrayBufferView | ArrayBuffer;
interface TextDecoderStream {
/** Returns encoding's name, lower cased. */
readonly encoding: string;
/** Returns `true` if error mode is "fatal", and `false` otherwise. */
readonly fatal: boolean;
/** Returns `true` if ignore BOM flag is set, and `false` otherwise. */
readonly ignoreBOM: boolean;
readonly readable: ReadableStream<string>;
readonly writable: WritableStream<BufferSource>;
readonly [Symbol.toStringTag]: string;
}
const TextDecoderStream: {
prototype: TextDecoderStream;
new(encoding?: string, options?: TextDecoderOptions): TextDecoderStream;
};
interface CompressionStream {
readonly readable: ReadableStream;
readonly writable: WritableStream;
}
const CompressionStream: {
prototype: CompressionStream;
new(format: "deflate" | "deflate-raw" | "gzip"): CompressionStream;
};
interface DecompressionStream {
readonly writable: WritableStream;
readonly readable: ReadableStream;
}
const DecompressionStream: {
prototype: DecompressionStream;
new(format: "deflate" | "deflate-raw" | "gzip"): DecompressionStream;
};
global {
interface ByteLengthQueuingStrategy extends _ByteLengthQueuingStrategy {}
/**
* `ByteLengthQueuingStrategy` class is a global reference for `import { ByteLengthQueuingStrategy } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-bytelengthqueuingstrategy
* @since v18.0.0
*/
var ByteLengthQueuingStrategy: typeof globalThis extends { onmessage: any; ByteLengthQueuingStrategy: infer T }
? T
: typeof import("stream/web").ByteLengthQueuingStrategy;
interface CompressionStream extends _CompressionStream {}
/**
* `CompressionStream` class is a global reference for `import { CompressionStream } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-compressionstream
* @since v18.0.0
*/
var CompressionStream: typeof globalThis extends {
onmessage: any;
// CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit.
// If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts
ReportingObserver: any;
CompressionStream: infer T;
} ? T
// TS 4.8, 4.9, 5.0
: typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {
prototype: T;
new(format: "deflate" | "deflate-raw" | "gzip"): T;
}
: typeof import("stream/web").CompressionStream;
interface CountQueuingStrategy extends _CountQueuingStrategy {}
/**
* `CountQueuingStrategy` class is a global reference for `import { CountQueuingStrategy } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-countqueuingstrategy
* @since v18.0.0
*/
var CountQueuingStrategy: typeof globalThis extends { onmessage: any; CountQueuingStrategy: infer T } ? T
: typeof import("stream/web").CountQueuingStrategy;
interface DecompressionStream extends _DecompressionStream {}
/**
* `DecompressionStream` class is a global reference for `import { DecompressionStream } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-decompressionstream
* @since v18.0.0
*/
var DecompressionStream: typeof globalThis extends {
onmessage: any;
// CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit.
// If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts
ReportingObserver: any;
DecompressionStream: infer T extends object;
} ? T
// TS 4.8, 4.9, 5.0
: typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {
prototype: T;
new(format: "deflate" | "deflate-raw" | "gzip"): T;
}
: typeof import("stream/web").DecompressionStream;
interface QueuingStrategy<T = any> extends _QueuingStrategy<T> {}
interface ReadableByteStreamController extends _ReadableByteStreamController {}
/**
* `ReadableByteStreamController` class is a global reference for `import { ReadableByteStreamController } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-readablebytestreamcontroller
* @since v18.0.0
*/
var ReadableByteStreamController: typeof globalThis extends
{ onmessage: any; ReadableByteStreamController: infer T } ? T
: typeof import("stream/web").ReadableByteStreamController;
interface ReadableStream<R = any> extends _ReadableStream<R> {}
/**
* `ReadableStream` class is a global reference for `import { ReadableStream } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-readablestream
* @since v18.0.0
*/
var ReadableStream: typeof globalThis extends { onmessage: any; ReadableStream: infer T } ? T
: typeof import("stream/web").ReadableStream;
interface ReadableStreamBYOBReader extends _ReadableStreamBYOBReader {}
/**
* `ReadableStreamBYOBReader` class is a global reference for `import { ReadableStreamBYOBReader } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-readablestreambyobreader
* @since v18.0.0
*/
var ReadableStreamBYOBReader: typeof globalThis extends { onmessage: any; ReadableStreamBYOBReader: infer T }
? T
: typeof import("stream/web").ReadableStreamBYOBReader;
interface ReadableStreamBYOBRequest extends _ReadableStreamBYOBRequest {}
/**
* `ReadableStreamBYOBRequest` class is a global reference for `import { ReadableStreamBYOBRequest } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-readablestreambyobrequest
* @since v18.0.0
*/
var ReadableStreamBYOBRequest: typeof globalThis extends { onmessage: any; ReadableStreamBYOBRequest: infer T }
? T
: typeof import("stream/web").ReadableStreamBYOBRequest;
interface ReadableStreamDefaultController<R = any> extends _ReadableStreamDefaultController<R> {}
/**
* `ReadableStreamDefaultController` class is a global reference for `import { ReadableStreamDefaultController } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-readablestreamdefaultcontroller
* @since v18.0.0
*/
var ReadableStreamDefaultController: typeof globalThis extends
{ onmessage: any; ReadableStreamDefaultController: infer T } ? T
: typeof import("stream/web").ReadableStreamDefaultController;
interface ReadableStreamDefaultReader<R = any> extends _ReadableStreamDefaultReader<R> {}
/**
* `ReadableStreamDefaultReader` class is a global reference for `import { ReadableStreamDefaultReader } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-readablestreamdefaultreader
* @since v18.0.0
*/
var ReadableStreamDefaultReader: typeof globalThis extends
{ onmessage: any; ReadableStreamDefaultReader: infer T } ? T
: typeof import("stream/web").ReadableStreamDefaultReader;
interface TextDecoderStream extends _TextDecoderStream {}
/**
* `TextDecoderStream` class is a global reference for `import { TextDecoderStream } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-textdecoderstream
* @since v18.0.0
*/
var TextDecoderStream: typeof globalThis extends { onmessage: any; TextDecoderStream: infer T } ? T
: typeof import("stream/web").TextDecoderStream;
interface TextEncoderStream extends _TextEncoderStream {}
/**
* `TextEncoderStream` class is a global reference for `import { TextEncoderStream } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-textencoderstream
* @since v18.0.0
*/
var TextEncoderStream: typeof globalThis extends { onmessage: any; TextEncoderStream: infer T } ? T
: typeof import("stream/web").TextEncoderStream;
interface TransformStream<I = any, O = any> extends _TransformStream<I, O> {}
/**
* `TransformStream` class is a global reference for `import { TransformStream } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-transformstream
* @since v18.0.0
*/
var TransformStream: typeof globalThis extends { onmessage: any; TransformStream: infer T } ? T
: typeof import("stream/web").TransformStream;
interface TransformStreamDefaultController<O = any> extends _TransformStreamDefaultController<O> {}
/**
* `TransformStreamDefaultController` class is a global reference for `import { TransformStreamDefaultController } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-transformstreamdefaultcontroller
* @since v18.0.0
*/
var TransformStreamDefaultController: typeof globalThis extends
{ onmessage: any; TransformStreamDefaultController: infer T } ? T
: typeof import("stream/web").TransformStreamDefaultController;
interface WritableStream<W = any> extends _WritableStream<W> {}
/**
* `WritableStream` class is a global reference for `import { WritableStream } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-writablestream
* @since v18.0.0
*/
var WritableStream: typeof globalThis extends { onmessage: any; WritableStream: infer T } ? T
: typeof import("stream/web").WritableStream;
interface WritableStreamDefaultController extends _WritableStreamDefaultController {}
/**
* `WritableStreamDefaultController` class is a global reference for `import { WritableStreamDefaultController } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-writablestreamdefaultcontroller
* @since v18.0.0
*/
var WritableStreamDefaultController: typeof globalThis extends
{ onmessage: any; WritableStreamDefaultController: infer T } ? T
: typeof import("stream/web").WritableStreamDefaultController;
interface WritableStreamDefaultWriter<W = any> extends _WritableStreamDefaultWriter<W> {}
/**
* `WritableStreamDefaultWriter` class is a global reference for `import { WritableStreamDefaultWriter } from 'node:stream/web'`.
* https://nodejs.org/api/globals.html#class-writablestreamdefaultwriter
* @since v18.0.0
*/
var WritableStreamDefaultWriter: typeof globalThis extends
{ onmessage: any; WritableStreamDefaultWriter: infer T } ? T
: typeof import("stream/web").WritableStreamDefaultWriter;
}
}
declare module "stream/web" {
export * from "node:stream/web";
declare module "node:stream/web" {
export * from "stream/web";
}

View File

@@ -36,9 +36,9 @@
* decoder.write(Buffer.from([0x82]));
* console.log(decoder.end(Buffer.from([0xAC]))); // Prints: €
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/string_decoder.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/string_decoder.js)
*/
declare module "node:string_decoder" {
declare module "string_decoder" {
class StringDecoder {
constructor(encoding?: BufferEncoding);
/**
@@ -48,7 +48,7 @@ declare module "node:string_decoder" {
* @since v0.1.99
* @param buffer The bytes to decode.
*/
write(buffer: string | NodeJS.ArrayBufferView): string;
write(buffer: string | Buffer | NodeJS.ArrayBufferView): string;
/**
* Returns any remaining input stored in the internal buffer as a string. Bytes
* representing incomplete UTF-8 and UTF-16 characters will be replaced with
@@ -59,9 +59,9 @@ declare module "node:string_decoder" {
* @since v0.9.3
* @param buffer The bytes to decode.
*/
end(buffer?: string | NodeJS.ArrayBufferView): string;
end(buffer?: string | Buffer | NodeJS.ArrayBufferView): string;
}
}
declare module "string_decoder" {
export * from "node:string_decoder";
declare module "node:string_decoder" {
export * from "string_decoder";
}

317
node_modules/@types/node/test.d.ts generated vendored
View File

@@ -76,12 +76,10 @@
*
* If any tests fail, the process exit code is set to `1`.
* @since v18.0.0, v16.17.0
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/test.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/test.js)
*/
declare module "node:test" {
import { AssertMethodNames } from "node:assert";
import { Readable, ReadableEventMap } from "node:stream";
import { TestEvent } from "node:test/reporters";
import { Readable } from "node:stream";
import TestFn = test.TestFn;
import TestOptions = test.TestOptions;
/**
@@ -244,14 +242,14 @@ declare module "node:test" {
/**
* Specifies the current working directory to be used by the test runner.
* Serves as the base path for resolving files according to the
* [test runner execution model](https://nodejs.org/docs/latest-v25.x/api/test.html#test-runner-execution-model).
* [test runner execution model](https://nodejs.org/docs/latest-v24.x/api/test.html#test-runner-execution-model).
* @since v23.0.0
* @default process.cwd()
*/
cwd?: string | undefined;
/**
* An array containing the list of files to run. If omitted, files are run according to the
* [test runner execution model](https://nodejs.org/docs/latest-v25.x/api/test.html#test-runner-execution-model).
* [test runner execution model](https://nodejs.org/docs/latest-v24.x/api/test.html#test-runner-execution-model).
*/
files?: readonly string[] | undefined;
/**
@@ -264,7 +262,7 @@ declare module "node:test" {
/**
* An array containing the list of glob patterns to match test files.
* This option cannot be used together with `files`. If omitted, files are run according to the
* [test runner execution model](https://nodejs.org/docs/latest-v25.x/api/test.html#test-runner-execution-model).
* [test runner execution model](https://nodejs.org/docs/latest-v24.x/api/test.html#test-runner-execution-model).
* @since v22.6.0
*/
globPatterns?: readonly string[] | undefined;
@@ -345,14 +343,7 @@ declare module "node:test" {
*/
shard?: TestShard | undefined;
/**
* A file path where the test runner will
* store the state of the tests to allow rerunning only the failed tests on a next run.
* @since v24.7.0
* @default undefined
*/
rerunFailuresFilePath?: string | undefined;
/**
* enable [code coverage](https://nodejs.org/docs/latest-v25.x/api/test.html#collecting-code-coverage) collection.
* enable [code coverage](https://nodejs.org/docs/latest-v24.x/api/test.html#collecting-code-coverage) collection.
* @since v22.10.0
* @default false
*/
@@ -399,23 +390,6 @@ declare module "node:test" {
*/
functionCoverage?: number | undefined;
}
interface TestsStreamEventMap extends ReadableEventMap {
"data": [data: TestEvent];
"test:coverage": [data: EventData.TestCoverage];
"test:complete": [data: EventData.TestComplete];
"test:dequeue": [data: EventData.TestDequeue];
"test:diagnostic": [data: EventData.TestDiagnostic];
"test:enqueue": [data: EventData.TestEnqueue];
"test:fail": [data: EventData.TestFail];
"test:pass": [data: EventData.TestPass];
"test:plan": [data: EventData.TestPlan];
"test:start": [data: EventData.TestStart];
"test:stderr": [data: EventData.TestStderr];
"test:stdout": [data: EventData.TestStdout];
"test:summary": [data: EventData.TestSummary];
"test:watch:drained": [];
"test:watch:restarted": [];
}
/**
* A successful call to `run()` will return a new `TestsStream` object, streaming a series of events representing the execution of the tests.
*
@@ -423,59 +397,96 @@ declare module "node:test" {
* @since v18.9.0, v16.19.0
*/
interface TestsStream extends Readable {
// #region InternalEventEmitter
addListener<E extends keyof TestsStreamEventMap>(
eventName: E,
listener: (...args: TestsStreamEventMap[E]) => void,
): this;
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
emit<E extends keyof TestsStreamEventMap>(eventName: E, ...args: TestsStreamEventMap[E]): boolean;
emit(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<E extends keyof TestsStreamEventMap>(
eventName: E,
listener?: (...args: TestsStreamEventMap[E]) => void,
): number;
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
listeners<E extends keyof TestsStreamEventMap>(eventName: E): ((...args: TestsStreamEventMap[E]) => void)[];
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
off<E extends keyof TestsStreamEventMap>(
eventName: E,
listener: (...args: TestsStreamEventMap[E]) => void,
): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
on<E extends keyof TestsStreamEventMap>(
eventName: E,
listener: (...args: TestsStreamEventMap[E]) => void,
): this;
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
once<E extends keyof TestsStreamEventMap>(
eventName: E,
listener: (...args: TestsStreamEventMap[E]) => void,
): this;
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependListener<E extends keyof TestsStreamEventMap>(
eventName: E,
listener: (...args: TestsStreamEventMap[E]) => void,
): this;
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener<E extends keyof TestsStreamEventMap>(
eventName: E,
listener: (...args: TestsStreamEventMap[E]) => void,
): this;
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
rawListeners<E extends keyof TestsStreamEventMap>(
eventName: E,
): ((...args: TestsStreamEventMap[E]) => void)[];
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
removeAllListeners<E extends keyof TestsStreamEventMap>(eventName?: E): this;
removeAllListeners(eventName?: string | symbol): this;
removeListener<E extends keyof TestsStreamEventMap>(
eventName: E,
listener: (...args: TestsStreamEventMap[E]) => void,
): this;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
// #endregion
addListener(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this;
addListener(event: "test:complete", listener: (data: EventData.TestComplete) => void): this;
addListener(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this;
addListener(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this;
addListener(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this;
addListener(event: "test:fail", listener: (data: EventData.TestFail) => void): this;
addListener(event: "test:pass", listener: (data: EventData.TestPass) => void): this;
addListener(event: "test:plan", listener: (data: EventData.TestPlan) => void): this;
addListener(event: "test:start", listener: (data: EventData.TestStart) => void): this;
addListener(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this;
addListener(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this;
addListener(event: "test:summary", listener: (data: EventData.TestSummary) => void): this;
addListener(event: "test:watch:drained", listener: () => void): this;
addListener(event: "test:watch:restarted", listener: () => void): this;
addListener(event: string, listener: (...args: any[]) => void): this;
emit(event: "test:coverage", data: EventData.TestCoverage): boolean;
emit(event: "test:complete", data: EventData.TestComplete): boolean;
emit(event: "test:dequeue", data: EventData.TestDequeue): boolean;
emit(event: "test:diagnostic", data: EventData.TestDiagnostic): boolean;
emit(event: "test:enqueue", data: EventData.TestEnqueue): boolean;
emit(event: "test:fail", data: EventData.TestFail): boolean;
emit(event: "test:pass", data: EventData.TestPass): boolean;
emit(event: "test:plan", data: EventData.TestPlan): boolean;
emit(event: "test:start", data: EventData.TestStart): boolean;
emit(event: "test:stderr", data: EventData.TestStderr): boolean;
emit(event: "test:stdout", data: EventData.TestStdout): boolean;
emit(event: "test:summary", data: EventData.TestSummary): boolean;
emit(event: "test:watch:drained"): boolean;
emit(event: "test:watch:restarted"): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this;
on(event: "test:complete", listener: (data: EventData.TestComplete) => void): this;
on(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this;
on(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this;
on(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this;
on(event: "test:fail", listener: (data: EventData.TestFail) => void): this;
on(event: "test:pass", listener: (data: EventData.TestPass) => void): this;
on(event: "test:plan", listener: (data: EventData.TestPlan) => void): this;
on(event: "test:start", listener: (data: EventData.TestStart) => void): this;
on(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this;
on(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this;
on(event: "test:summary", listener: (data: EventData.TestSummary) => void): this;
on(event: "test:watch:drained", listener: () => void): this;
on(event: "test:watch:restarted", listener: () => void): this;
on(event: string, listener: (...args: any[]) => void): this;
once(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this;
once(event: "test:complete", listener: (data: EventData.TestComplete) => void): this;
once(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this;
once(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this;
once(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this;
once(event: "test:fail", listener: (data: EventData.TestFail) => void): this;
once(event: "test:pass", listener: (data: EventData.TestPass) => void): this;
once(event: "test:plan", listener: (data: EventData.TestPlan) => void): this;
once(event: "test:start", listener: (data: EventData.TestStart) => void): this;
once(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this;
once(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this;
once(event: "test:summary", listener: (data: EventData.TestSummary) => void): this;
once(event: "test:watch:drained", listener: () => void): this;
once(event: "test:watch:restarted", listener: () => void): this;
once(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this;
prependListener(event: "test:complete", listener: (data: EventData.TestComplete) => void): this;
prependListener(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this;
prependListener(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this;
prependListener(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this;
prependListener(event: "test:fail", listener: (data: EventData.TestFail) => void): this;
prependListener(event: "test:pass", listener: (data: EventData.TestPass) => void): this;
prependListener(event: "test:plan", listener: (data: EventData.TestPlan) => void): this;
prependListener(event: "test:start", listener: (data: EventData.TestStart) => void): this;
prependListener(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this;
prependListener(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this;
prependListener(event: "test:summary", listener: (data: EventData.TestSummary) => void): this;
prependListener(event: "test:watch:drained", listener: () => void): this;
prependListener(event: "test:watch:restarted", listener: () => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "test:coverage", listener: (data: EventData.TestCoverage) => void): this;
prependOnceListener(event: "test:complete", listener: (data: EventData.TestComplete) => void): this;
prependOnceListener(event: "test:dequeue", listener: (data: EventData.TestDequeue) => void): this;
prependOnceListener(event: "test:diagnostic", listener: (data: EventData.TestDiagnostic) => void): this;
prependOnceListener(event: "test:enqueue", listener: (data: EventData.TestEnqueue) => void): this;
prependOnceListener(event: "test:fail", listener: (data: EventData.TestFail) => void): this;
prependOnceListener(event: "test:pass", listener: (data: EventData.TestPass) => void): this;
prependOnceListener(event: "test:plan", listener: (data: EventData.TestPlan) => void): this;
prependOnceListener(event: "test:start", listener: (data: EventData.TestStart) => void): this;
prependOnceListener(event: "test:stderr", listener: (data: EventData.TestStderr) => void): this;
prependOnceListener(event: "test:stdout", listener: (data: EventData.TestStdout) => void): this;
prependOnceListener(event: "test:summary", listener: (data: EventData.TestSummary) => void): this;
prependOnceListener(event: "test:watch:drained", listener: () => void): this;
prependOnceListener(event: "test:watch:restarted", listener: () => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
}
namespace EventData {
interface Error extends globalThis.Error {
@@ -699,7 +710,7 @@ declare module "node:test" {
/**
* The type of the test, used to denote whether this is a suite.
*/
type?: "suite" | "test";
type?: "suite";
};
/**
* The test name.
@@ -769,13 +780,7 @@ declare module "node:test" {
* The type of the test, used to denote whether this is a suite.
* @since v20.0.0, v19.9.0, v18.17.0
*/
type?: "suite" | "test";
/**
* The attempt number of the test run,
* present only when using the `--test-rerun-failures` flag.
* @since v24.7.0
*/
attempt?: number;
type?: "suite";
};
/**
* The test name.
@@ -811,19 +816,7 @@ declare module "node:test" {
* The type of the test, used to denote whether this is a suite.
* @since 20.0.0, 19.9.0, 18.17.0
*/
type?: "suite" | "test";
/**
* The attempt number of the test run,
* present only when using the `--test-rerun-failures` flag.
* @since v24.7.0
*/
attempt?: number;
/**
* The attempt number the test passed on,
* present only when using the `--test-rerun-failures` flag.
* @since v24.7.0
*/
passed_on_attempt?: number;
type?: "suite";
};
/**
* The test name.
@@ -968,7 +961,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.
@@ -1179,7 +1171,29 @@ declare module "node:test" {
*/
readonly mock: MockTracker;
}
interface TestContextAssert extends Pick<typeof import("assert"), AssertMethodNames> {
interface TestContextAssert extends
Pick<
typeof import("assert"),
| "deepEqual"
| "deepStrictEqual"
| "doesNotMatch"
| "doesNotReject"
| "doesNotThrow"
| "equal"
| "fail"
| "ifError"
| "match"
| "notDeepEqual"
| "notDeepStrictEqual"
| "notEqual"
| "notStrictEqual"
| "ok"
| "partialDeepStrictEqual"
| "rejects"
| "strictEqual"
| "throws"
>
{
/**
* This function serializes `value` and writes it to the file specified by `path`.
*
@@ -1199,7 +1213,7 @@ declare module "node:test" {
* highlighting.
* @since v22.14.0
* @param value A value to serialize to a string. If Node.js was started with
* the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--test-update-snapshots)
* the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--test-update-snapshots)
* flag, the serialized value is written to
* `path`. Otherwise, the serialized value is compared to the contents of the
* existing snapshot file.
@@ -1222,7 +1236,7 @@ declare module "node:test" {
* ```
* @since v22.3.0
* @param value A value to serialize to a string. If Node.js was started with
* the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--test-update-snapshots)
* the [`--test-update-snapshots`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--test-update-snapshots)
* flag, the serialized value is written to
* the snapshot file. Otherwise, the serialized value is compared to the
* corresponding value in the existing snapshot file.
@@ -1653,7 +1667,7 @@ declare module "node:test" {
* This function is used to mock the exports of ECMAScript modules, CommonJS modules, JSON modules, and
* Node.js builtin modules. Any references to the original module prior to mocking are not impacted. In
* order to enable module mocking, Node.js must be started with the
* [`--experimental-test-module-mocks`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--experimental-test-module-mocks)
* [`--experimental-test-module-mocks`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--experimental-test-module-mocks)
* command-line flag.
*
* The following example demonstrates how a mock is created for a module.
@@ -2237,3 +2251,84 @@ declare module "node:test" {
}[keyof T];
export = test;
}
/**
* The `node:test/reporters` module exposes the builtin-reporters for `node:test`.
* To access it:
*
* ```js
* import test from 'node:test/reporters';
* ```
*
* This module is only available under the `node:` scheme. The following will not
* work:
*
* ```js
* import test from 'node:test/reporters';
* ```
* @since v19.9.0
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/test/reporters.js)
*/
declare module "node:test/reporters" {
import { Transform, TransformOptions } from "node:stream";
import { EventData } from "node:test";
type TestEvent =
| { type: "test:coverage"; data: EventData.TestCoverage }
| { type: "test:complete"; data: EventData.TestComplete }
| { type: "test:dequeue"; data: EventData.TestDequeue }
| { type: "test:diagnostic"; data: EventData.TestDiagnostic }
| { type: "test:enqueue"; data: EventData.TestEnqueue }
| { type: "test:fail"; data: EventData.TestFail }
| { type: "test:pass"; data: EventData.TestPass }
| { type: "test:plan"; data: EventData.TestPlan }
| { type: "test:start"; data: EventData.TestStart }
| { type: "test:stderr"; data: EventData.TestStderr }
| { type: "test:stdout"; data: EventData.TestStdout }
| { type: "test:summary"; data: EventData.TestSummary }
| { type: "test:watch:drained"; data: undefined }
| { type: "test:watch:restarted"; data: undefined };
type TestEventGenerator = AsyncGenerator<TestEvent, void>;
interface ReporterConstructorWrapper<T extends new(...args: any[]) => Transform> {
new(...args: ConstructorParameters<T>): InstanceType<T>;
(...args: ConstructorParameters<T>): InstanceType<T>;
}
/**
* The `dot` reporter outputs the test results in a compact format,
* where each passing test is represented by a `.`,
* and each failing test is represented by a `X`.
* @since v20.0.0
*/
function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>;
/**
* The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
* @since v20.0.0
*/
function tap(source: TestEventGenerator): AsyncGenerator<string, void>;
class SpecReporter extends Transform {
constructor();
}
/**
* The `spec` reporter outputs the test results in a human-readable format.
* @since v20.0.0
*/
const spec: ReporterConstructorWrapper<typeof SpecReporter>;
/**
* The `junit` reporter outputs test results in a jUnit XML format.
* @since v21.0.0
*/
function junit(source: TestEventGenerator): AsyncGenerator<string, void>;
class LcovReporter extends Transform {
constructor(opts?: Omit<TransformOptions, "writableObjectMode">);
}
/**
* The `lcov` reporter outputs test coverage when used with the
* [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--experimental-test-coverage) flag.
* @since v22.0.0
*/
const lcov: ReporterConstructorWrapper<typeof LcovReporter>;
export { dot, junit, lcov, spec, tap, TestEvent };
}

134
node_modules/@types/node/timers.d.ts generated vendored
View File

@@ -6,9 +6,9 @@
* The timer functions within Node.js implement a similar API as the timers API
* provided by Web Browsers but use a different internal implementation that is
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/timers.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/timers.js)
*/
declare module "node:timers" {
declare module "timers" {
import { Abortable } from "node:events";
import * as promises from "node:timers/promises";
export interface TimerOptions extends Abortable {
@@ -145,6 +145,132 @@ declare module "node:timers" {
_onTimeout(...args: any[]): void;
}
}
/**
* Schedules the "immediate" execution of the `callback` after I/O events'
* callbacks.
*
* When multiple calls to `setImmediate()` are made, the `callback` functions are
* queued for execution in the order in which they are created. The entire callback
* queue is processed every event loop iteration. If an immediate timer is queued
* from inside an executing callback, that timer will not be triggered until the
* next event loop iteration.
*
* If `callback` is not a function, a `TypeError` will be thrown.
*
* This method has a custom variant for promises that is available using
* `timersPromises.setImmediate()`.
* @since v0.9.1
* @param callback The function to call at the end of this turn of
* the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout)
* @param args Optional arguments to pass when the `callback` is called.
* @returns for use with `clearImmediate()`
*/
function setImmediate<TArgs extends any[]>(
callback: (...args: TArgs) => void,
...args: TArgs
): NodeJS.Immediate;
// Allow a single void-accepting argument to be optional in arguments lists.
// Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
function setImmediate(callback: (_: void) => void): NodeJS.Immediate;
namespace setImmediate {
import __promisify__ = promises.setImmediate;
export { __promisify__ };
}
/**
* Schedules repeated execution of `callback` every `delay` milliseconds.
*
* When `delay` is larger than `2147483647` or less than `1` or `NaN`, the `delay`
* will be set to `1`. Non-integer delays are truncated to an integer.
*
* If `callback` is not a function, a `TypeError` will be thrown.
*
* This method has a custom variant for promises that is available using
* `timersPromises.setInterval()`.
* @since v0.0.1
* @param callback The function to call when the timer elapses.
* @param delay The number of milliseconds to wait before calling the
* `callback`. **Default:** `1`.
* @param args Optional arguments to pass when the `callback` is called.
* @returns for use with `clearInterval()`
*/
function setInterval<TArgs extends any[]>(
callback: (...args: TArgs) => void,
delay?: number,
...args: TArgs
): NodeJS.Timeout;
// Allow a single void-accepting argument to be optional in arguments lists.
// Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
function setInterval(callback: (_: void) => void, delay?: number): NodeJS.Timeout;
/**
* Schedules execution of a one-time `callback` after `delay` milliseconds.
*
* The `callback` will likely not be invoked in precisely `delay` milliseconds.
* Node.js makes no guarantees about the exact timing of when callbacks will fire,
* nor of their ordering. The callback will be called as close as possible to the
* time specified.
*
* When `delay` is larger than `2147483647` or less than `1` or `NaN`, the `delay`
* will be set to `1`. Non-integer delays are truncated to an integer.
*
* If `callback` is not a function, a `TypeError` will be thrown.
*
* This method has a custom variant for promises that is available using
* `timersPromises.setTimeout()`.
* @since v0.0.1
* @param callback The function to call when the timer elapses.
* @param delay The number of milliseconds to wait before calling the
* `callback`. **Default:** `1`.
* @param args Optional arguments to pass when the `callback` is called.
* @returns for use with `clearTimeout()`
*/
function setTimeout<TArgs extends any[]>(
callback: (...args: TArgs) => void,
delay?: number,
...args: TArgs
): NodeJS.Timeout;
// Allow a single void-accepting argument to be optional in arguments lists.
// Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
function setTimeout(callback: (_: void) => void, delay?: number): NodeJS.Timeout;
namespace setTimeout {
import __promisify__ = promises.setTimeout;
export { __promisify__ };
}
/**
* Cancels an `Immediate` object created by `setImmediate()`.
* @since v0.9.1
* @param immediate An `Immediate` object as returned by `setImmediate()`.
*/
function clearImmediate(immediate: NodeJS.Immediate | undefined): void;
/**
* Cancels a `Timeout` object created by `setInterval()`.
* @since v0.0.1
* @param timeout A `Timeout` object as returned by `setInterval()`
* or the primitive of the `Timeout` object as a string or a number.
*/
function clearInterval(timeout: NodeJS.Timeout | string | number | undefined): void;
/**
* Cancels a `Timeout` object created by `setTimeout()`.
* @since v0.0.1
* @param timeout A `Timeout` object as returned by `setTimeout()`
* or the primitive of the `Timeout` object as a string or a number.
*/
function clearTimeout(timeout: NodeJS.Timeout | string | number | undefined): void;
/**
* The `queueMicrotask()` method queues a microtask to invoke `callback`. If
* `callback` throws an exception, the `process` object `'uncaughtException'`
* event will be emitted.
*
* The microtask queue is managed by V8 and may be used in a similar manner to
* the `process.nextTick()` queue, which is managed by Node.js. The
* `process.nextTick()` queue is always processed before the microtask queue
* within each turn of the Node.js event loop.
* @since v11.0.0
* @param callback Function to be queued.
*/
function queueMicrotask(callback: () => void): void;
}
import clearImmediate = globalThis.clearImmediate;
import clearInterval = globalThis.clearInterval;
@@ -154,6 +280,6 @@ declare module "node:timers" {
import setTimeout = globalThis.setTimeout;
export { clearImmediate, clearInterval, clearTimeout, promises, setImmediate, setInterval, setTimeout };
}
declare module "timers" {
export * from "node:timers";
declare module "node:timers" {
export * from "timers";
}

View File

@@ -11,9 +11,9 @@
* } from 'node:timers/promises';
* ```
* @since v15.0.0
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/timers/promises.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/timers/promises.js)
*/
declare module "node:timers/promises" {
declare module "timers/promises" {
import { TimerOptions } from "node:timers";
/**
* ```js
@@ -103,6 +103,6 @@ declare module "node:timers/promises" {
}
const scheduler: Scheduler;
}
declare module "timers/promises" {
export * from "node:timers/promises";
declare module "node:timers/promises" {
export * from "timers/promises";
}

285
node_modules/@types/node/tls.d.ts generated vendored
View File

@@ -6,10 +6,9 @@
* ```js
* import tls from 'node:tls';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/tls.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/tls.js)
*/
declare module "node:tls" {
import { NonSharedBuffer } from "node:buffer";
declare module "tls" {
import { X509Certificate } from "node:crypto";
import * as net from "node:net";
import * as stream from "stream";
@@ -50,7 +49,7 @@ declare module "node:tls" {
/**
* The DER encoded X.509 certificate data.
*/
raw: NonSharedBuffer;
raw: Buffer;
/**
* The certificate subject.
*/
@@ -116,7 +115,7 @@ declare module "node:tls" {
/**
* The public key.
*/
pubkey?: NonSharedBuffer;
pubkey?: Buffer;
/**
* The ASN.1 name of the OID of the elliptic curve.
* Well-known curves are identified by an OID.
@@ -207,12 +206,6 @@ declare module "node:tls" {
*/
requestOCSP?: boolean | undefined;
}
interface TLSSocketEventMap extends net.SocketEventMap {
"keylog": [line: NonSharedBuffer];
"OCSPResponse": [response: NonSharedBuffer];
"secureConnect": [];
"session": [session: NonSharedBuffer];
}
/**
* Performs transparent encryption of written data and all required TLS
* negotiation.
@@ -251,10 +244,6 @@ declare module "node:tls" {
* When a handshake is completed but not ALPN protocol was selected, tlsSocket.alpnProtocol equals false.
*/
alpnProtocol: string | false | null;
/**
* String containing the server name requested via SNI (Server Name Indication) TLS extension.
*/
servername: string | false | null;
/**
* Returns an object representing the local certificate. The returned object has
* some properties corresponding to the fields of the certificate.
@@ -306,7 +295,7 @@ declare module "node:tls" {
* @since v9.9.0
* @return The latest `Finished` message that has been sent to the socket as part of a SSL/TLS handshake, or `undefined` if no `Finished` message has been sent yet.
*/
getFinished(): NonSharedBuffer | undefined;
getFinished(): Buffer | undefined;
/**
* Returns an object representing the peer's certificate. If the peer does not
* provide a certificate, an empty object will be returned. If the socket has been
@@ -333,7 +322,7 @@ declare module "node:tls" {
* @return The latest `Finished` message that is expected or has actually been received from the socket as part of a SSL/TLS handshake, or `undefined` if there is no `Finished` message so
* far.
*/
getPeerFinished(): NonSharedBuffer | undefined;
getPeerFinished(): Buffer | undefined;
/**
* Returns a string containing the negotiated SSL/TLS protocol version of the
* current connection. The value `'unknown'` will be returned for connected
@@ -363,7 +352,7 @@ declare module "node:tls" {
* must use the `'session'` event (it also works for TLSv1.2 and below).
* @since v0.11.4
*/
getSession(): NonSharedBuffer | undefined;
getSession(): Buffer | undefined;
/**
* See [SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html) for more information.
* @since v12.11.0
@@ -378,7 +367,7 @@ declare module "node:tls" {
* See `Session Resumption` for more information.
* @since v0.11.4
*/
getTLSTicket(): NonSharedBuffer | undefined;
getTLSTicket(): Buffer | undefined;
/**
* See `Session Resumption` for more information.
* @since v0.5.6
@@ -489,49 +478,37 @@ declare module "node:tls" {
* @param context Optionally provide a context.
* @return requested bytes of the keying material
*/
exportKeyingMaterial(length: number, label: string, context: Buffer): NonSharedBuffer;
// #region InternalEventEmitter
addListener<E extends keyof TLSSocketEventMap>(
eventName: E,
listener: (...args: TLSSocketEventMap[E]) => void,
): this;
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
emit<E extends keyof TLSSocketEventMap>(eventName: E, ...args: TLSSocketEventMap[E]): boolean;
emit(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<E extends keyof TLSSocketEventMap>(
eventName: E,
listener?: (...args: TLSSocketEventMap[E]) => void,
): number;
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
listeners<E extends keyof TLSSocketEventMap>(eventName: E): ((...args: TLSSocketEventMap[E]) => void)[];
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
off<E extends keyof TLSSocketEventMap>(eventName: E, listener: (...args: TLSSocketEventMap[E]) => void): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
on<E extends keyof TLSSocketEventMap>(eventName: E, listener: (...args: TLSSocketEventMap[E]) => void): this;
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
once<E extends keyof TLSSocketEventMap>(eventName: E, listener: (...args: TLSSocketEventMap[E]) => void): this;
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependListener<E extends keyof TLSSocketEventMap>(
eventName: E,
listener: (...args: TLSSocketEventMap[E]) => void,
): this;
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener<E extends keyof TLSSocketEventMap>(
eventName: E,
listener: (...args: TLSSocketEventMap[E]) => void,
): this;
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
rawListeners<E extends keyof TLSSocketEventMap>(eventName: E): ((...args: TLSSocketEventMap[E]) => void)[];
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
removeAllListeners<E extends keyof TLSSocketEventMap>(eventName?: E): this;
removeAllListeners(eventName?: string | symbol): this;
removeListener<E extends keyof TLSSocketEventMap>(
eventName: E,
listener: (...args: TLSSocketEventMap[E]) => void,
): this;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
// #endregion
exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer;
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
addListener(event: "secureConnect", listener: () => void): this;
addListener(event: "session", listener: (session: Buffer) => void): this;
addListener(event: "keylog", listener: (line: Buffer) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "OCSPResponse", response: Buffer): boolean;
emit(event: "secureConnect"): boolean;
emit(event: "session", session: Buffer): boolean;
emit(event: "keylog", line: Buffer): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "OCSPResponse", listener: (response: Buffer) => void): this;
on(event: "secureConnect", listener: () => void): this;
on(event: "session", listener: (session: Buffer) => void): this;
on(event: "keylog", listener: (line: Buffer) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "OCSPResponse", listener: (response: Buffer) => void): this;
once(event: "secureConnect", listener: () => void): this;
once(event: "session", listener: (session: Buffer) => void): this;
once(event: "keylog", listener: (line: Buffer) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
prependListener(event: "secureConnect", listener: () => void): this;
prependListener(event: "session", listener: (session: Buffer) => void): this;
prependListener(event: "keylog", listener: (line: Buffer) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
prependOnceListener(event: "secureConnect", listener: () => void): this;
prependOnceListener(event: "session", listener: (session: Buffer) => void): this;
prependOnceListener(event: "keylog", listener: (line: Buffer) => void): this;
}
interface CommonConnectionOptions {
/**
@@ -554,7 +531,7 @@ declare module "node:tls" {
* An array of strings or a Buffer naming possible ALPN protocols.
* (Protocols should be ordered by their priority.)
*/
ALPNProtocols?: readonly string[] | NodeJS.ArrayBufferView | undefined;
ALPNProtocols?: string[] | Uint8Array[] | Uint8Array | undefined;
/**
* SNICallback(servername, cb) <Function> A function that will be
* called if the client supports SNI TLS extension. Two arguments
@@ -609,7 +586,7 @@ declare module "node:tls" {
* requires explicitly specifying a cipher suite with the `ciphers` option.
* More information can be found in the RFC 4279.
*/
pskCallback?: ((socket: TLSSocket, identity: string) => NodeJS.ArrayBufferView | null) | undefined;
pskCallback?(socket: TLSSocket, identity: string): DataView | NodeJS.TypedArray | null;
/**
* hint to send to a client to help
* with selecting the identity during TLS-PSK negotiation. Will be ignored
@@ -619,7 +596,7 @@ declare module "node:tls" {
pskIdentityHint?: string | undefined;
}
interface PSKCallbackNegotation {
psk: NodeJS.ArrayBufferView;
psk: DataView | NodeJS.TypedArray;
identity: string;
}
interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions {
@@ -650,20 +627,7 @@ declare module "node:tls" {
* compatible with the selected cipher's digest.
* `identity` must use UTF-8 encoding.
*/
pskCallback?: ((hint: string | null) => PSKCallbackNegotation | null) | undefined;
}
interface ServerEventMap extends net.ServerEventMap {
"connection": [socket: net.Socket];
"keylog": [line: NonSharedBuffer, tlsSocket: TLSSocket];
"newSession": [sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void];
"OCSPRequest": [
certificate: NonSharedBuffer,
issuer: NonSharedBuffer,
callback: (err: Error | null, resp: Buffer | null) => void,
];
"resumeSession": [sessionId: Buffer, callback: (err: Error | null, sessionData?: Buffer) => void];
"secureConnection": [tlsSocket: TLSSocket];
"tlsClientError": [exception: Error, tlsSocket: TLSSocket];
pskCallback?(hint: string | null): PSKCallbackNegotation | null;
}
/**
* Accepts encrypted connections using TLS or SSL.
@@ -691,7 +655,7 @@ declare module "node:tls" {
* @since v3.0.0
* @return A 48-byte buffer containing the session ticket keys.
*/
getTicketKeys(): NonSharedBuffer;
getTicketKeys(): Buffer;
/**
* The `server.setSecureContext()` method replaces the secure context of an
* existing server. Existing connections to the server are not interrupted.
@@ -710,45 +674,128 @@ declare module "node:tls" {
* @param keys A 48-byte buffer containing the session ticket keys.
*/
setTicketKeys(keys: Buffer): void;
// #region InternalEventEmitter
addListener<E extends keyof ServerEventMap>(eventName: E, listener: (...args: ServerEventMap[E]) => void): this;
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
emit<E extends keyof ServerEventMap>(eventName: E, ...args: ServerEventMap[E]): boolean;
emit(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<E extends keyof ServerEventMap>(
eventName: E,
listener?: (...args: ServerEventMap[E]) => void,
): number;
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
listeners<E extends keyof ServerEventMap>(eventName: E): ((...args: ServerEventMap[E]) => void)[];
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
off<E extends keyof ServerEventMap>(eventName: E, listener: (...args: ServerEventMap[E]) => void): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
on<E extends keyof ServerEventMap>(eventName: E, listener: (...args: ServerEventMap[E]) => void): this;
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
once<E extends keyof ServerEventMap>(eventName: E, listener: (...args: ServerEventMap[E]) => void): this;
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependListener<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap[E]) => void,
/**
* events.EventEmitter
* 1. tlsClientError
* 2. newSession
* 3. OCSPRequest
* 4. resumeSession
* 5. secureConnection
* 6. keylog
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
addListener(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
): this;
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap[E]) => void,
addListener(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
rawListeners<E extends keyof ServerEventMap>(eventName: E): ((...args: ServerEventMap[E]) => void)[];
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
removeAllListeners<E extends keyof ServerEventMap>(eventName?: E): this;
removeAllListeners(eventName?: string | symbol): this;
removeListener<E extends keyof ServerEventMap>(
eventName: E,
listener: (...args: ServerEventMap[E]) => void,
addListener(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
): this;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
// #endregion
addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
addListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean;
emit(event: "newSession", sessionId: Buffer, sessionData: Buffer, callback: () => void): boolean;
emit(
event: "OCSPRequest",
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
): boolean;
emit(
event: "resumeSession",
sessionId: Buffer,
callback: (err: Error | null, sessionData: Buffer | null) => void,
): boolean;
emit(event: "secureConnection", tlsSocket: TLSSocket): boolean;
emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
on(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
on(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
): this;
on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
once(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
): this;
once(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
once(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
): this;
once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
prependListener(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
): this;
prependListener(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
prependListener(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
): this;
prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
prependOnceListener(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
): this;
prependOnceListener(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
prependOnceListener(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
): this;
prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
}
type SecureVersion = "TLSv1.3" | "TLSv1.2" | "TLSv1.1" | "TLSv1";
interface SecureContextOptions {
@@ -1104,7 +1151,7 @@ declare module "node:tls" {
* the `ciphers` option of `{@link createSecureContext}`.
*
* Not all supported ciphers are enabled by default. See
* [Modifying the default TLS cipher suite](https://nodejs.org/docs/latest-v25.x/api/tls.html#modifying-the-default-tls-cipher-suite).
* [Modifying the default TLS cipher suite](https://nodejs.org/docs/latest-v24.x/api/tls.html#modifying-the-default-tls-cipher-suite).
*
* Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for
* TLSv1.2 and below.
@@ -1193,6 +1240,6 @@ declare module "node:tls" {
*/
const rootCertificates: readonly string[];
}
declare module "tls" {
export * from "node:tls";
declare module "node:tls" {
export * from "tls";
}

View File

@@ -9,8 +9,8 @@
* The available categories are:
*
* * `node`: An empty placeholder.
* * `node.async_hooks`: Enables capture of detailed [`async_hooks`](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html) trace data.
* The [`async_hooks`](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html) events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property.
* * `node.async_hooks`: Enables capture of detailed [`async_hooks`](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html) trace data.
* The [`async_hooks`](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html) events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property.
* * `node.bootstrap`: Enables capture of Node.js bootstrap milestones.
* * `node.console`: Enables capture of `console.time()` and `console.count()` output.
* * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`.
@@ -22,7 +22,7 @@
* * `node.fs_dir.sync`: Enables capture of trace data for file system sync directory methods.
* * `node.fs.async`: Enables capture of trace data for file system async methods.
* * `node.fs_dir.async`: Enables capture of trace data for file system async directory methods.
* * `node.perf`: Enables capture of [Performance API](https://nodejs.org/docs/latest-v25.x/api/perf_hooks.html) measurements.
* * `node.perf`: Enables capture of [Performance API](https://nodejs.org/docs/latest-v24.x/api/perf_hooks.html) measurements.
* * `node.perf.usertiming`: Enables capture of only Performance API User Timing
* measures and marks.
* * `node.perf.timerify`: Enables capture of only Performance API timerify
@@ -30,7 +30,7 @@
* * `node.promises.rejections`: Enables capture of trace data tracking the number
* of unhandled Promise rejections and handled-after-rejections.
* * `node.vm.script`: Enables capture of trace data for the `node:vm` module's `runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
* * `v8`: The [V8](https://nodejs.org/docs/latest-v25.x/api/v8.html) events are GC, compiling, and execution related.
* * `v8`: The [V8](https://nodejs.org/docs/latest-v24.x/api/v8.html) events are GC, compiling, and execution related.
* * `node.http`: Enables capture of trace data for http request / response.
*
* By default the `node`, `node.async_hooks`, and `v8` categories are enabled.
@@ -88,11 +88,11 @@
* However the trace-event timestamps are expressed in microseconds,
* unlike `process.hrtime()` which returns nanoseconds.
*
* The features from this module are not available in [`Worker`](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#class-worker) threads.
* The features from this module are not available in [`Worker`](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html#class-worker) threads.
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/trace_events.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/trace_events.js)
*/
declare module "node:trace_events" {
declare module "trace_events" {
/**
* The `Tracing` object is used to enable or disable tracing for sets of
* categories. Instances are created using the
@@ -192,6 +192,6 @@ declare module "node:trace_events" {
*/
function getEnabledCategories(): string | undefined;
}
declare module "trace_events" {
export * from "node:trace_events";
declare module "node:trace_events" {
export * from "trace_events";
}

View File

@@ -1,4 +1,4 @@
declare module "node:buffer" {
declare module "buffer" {
global {
interface BufferConstructor {
// see ../buffer.d.ts for implementation shared with all TypeScript versions
@@ -32,7 +32,7 @@ declare module "node:buffer" {
* @param arrayBuffer The ArrayBuffer with which to share memory.
* @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
*/
new(arrayBuffer: ArrayBufferLike): Buffer;
new(arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer;
/**
* Allocates a new `Buffer` using an `array` of bytes in the range `0` `255`.
* Array entries outside that range will be truncated to fit into it.
@@ -126,7 +126,7 @@ declare module "node:buffer" {
* `arrayBuffer.byteLength - byteOffset`.
*/
from(
arrayBuffer: WithImplicitCoercion<ArrayBufferLike>,
arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>,
byteOffset?: number,
length?: number,
): Buffer;
@@ -448,15 +448,13 @@ declare module "node:buffer" {
*/
subarray(start?: number, end?: number): Buffer;
}
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type NonSharedBuffer = Buffer;
/**
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
* TypeScript versions earlier than 5.7.
*/
type AllowSharedBuffer = Buffer;
}
/** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
var SlowBuffer: {
/** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
new(size: number): Buffer;
prototype: Buffer;
};
}

View File

@@ -16,21 +16,5 @@ declare global {
| Float32Array
| Float64Array;
type ArrayBufferView = TypedArray | DataView;
type NonSharedUint8Array = Uint8Array;
type NonSharedUint8ClampedArray = Uint8ClampedArray;
type NonSharedUint16Array = Uint16Array;
type NonSharedUint32Array = Uint32Array;
type NonSharedInt8Array = Int8Array;
type NonSharedInt16Array = Int16Array;
type NonSharedInt32Array = Int32Array;
type NonSharedBigUint64Array = BigUint64Array;
type NonSharedBigInt64Array = BigInt64Array;
type NonSharedFloat16Array = Float16Array;
type NonSharedFloat32Array = Float32Array;
type NonSharedFloat64Array = Float64Array;
type NonSharedDataView = DataView;
type NonSharedTypedArray = TypedArray;
type NonSharedArrayBufferView = ArrayBufferView;
}
}

View File

@@ -41,21 +41,11 @@
// Definitions for Node.js modules that are not specific to any version of TypeScript:
/// <reference path="../globals.d.ts" />
/// <reference path="../web-globals/abortcontroller.d.ts" />
/// <reference path="../web-globals/blob.d.ts" />
/// <reference path="../web-globals/console.d.ts" />
/// <reference path="../web-globals/crypto.d.ts" />
/// <reference path="../web-globals/domexception.d.ts" />
/// <reference path="../web-globals/encoding.d.ts" />
/// <reference path="../web-globals/events.d.ts" />
/// <reference path="../web-globals/fetch.d.ts" />
/// <reference path="../web-globals/importmeta.d.ts" />
/// <reference path="../web-globals/messaging.d.ts" />
/// <reference path="../web-globals/navigator.d.ts" />
/// <reference path="../web-globals/performance.d.ts" />
/// <reference path="../web-globals/storage.d.ts" />
/// <reference path="../web-globals/streams.d.ts" />
/// <reference path="../web-globals/timers.d.ts" />
/// <reference path="../web-globals/url.d.ts" />
/// <reference path="../assert.d.ts" />
/// <reference path="../assert/strict.d.ts" />
/// <reference path="../async_hooks.d.ts" />
@@ -78,30 +68,25 @@
/// <reference path="../https.d.ts" />
/// <reference path="../inspector.d.ts" />
/// <reference path="../inspector.generated.d.ts" />
/// <reference path="../inspector/promises.d.ts" />
/// <reference path="../module.d.ts" />
/// <reference path="../net.d.ts" />
/// <reference path="../os.d.ts" />
/// <reference path="../path.d.ts" />
/// <reference path="../path/posix.d.ts" />
/// <reference path="../path/win32.d.ts" />
/// <reference path="../perf_hooks.d.ts" />
/// <reference path="../process.d.ts" />
/// <reference path="../punycode.d.ts" />
/// <reference path="../querystring.d.ts" />
/// <reference path="../quic.d.ts" />
/// <reference path="../readline.d.ts" />
/// <reference path="../readline/promises.d.ts" />
/// <reference path="../repl.d.ts" />
/// <reference path="../sea.d.ts" />
/// <reference path="../sqlite.d.ts" />
/// <reference path="../stream.d.ts" />
/// <reference path="../stream/consumers.d.ts" />
/// <reference path="../stream/promises.d.ts" />
/// <reference path="../stream/consumers.d.ts" />
/// <reference path="../stream/web.d.ts" />
/// <reference path="../string_decoder.d.ts" />
/// <reference path="../test.d.ts" />
/// <reference path="../test/reporters.d.ts" />
/// <reference path="../timers.d.ts" />
/// <reference path="../timers/promises.d.ts" />
/// <reference path="../tls.d.ts" />
@@ -109,7 +94,6 @@
/// <reference path="../tty.d.ts" />
/// <reference path="../url.d.ts" />
/// <reference path="../util.d.ts" />
/// <reference path="../util/types.d.ts" />
/// <reference path="../v8.d.ts" />
/// <reference path="../vm.d.ts" />
/// <reference path="../wasi.d.ts" />

View File

@@ -41,21 +41,11 @@
// Definitions for Node.js modules that are not specific to any version of TypeScript:
/// <reference path="../globals.d.ts" />
/// <reference path="../web-globals/abortcontroller.d.ts" />
/// <reference path="../web-globals/blob.d.ts" />
/// <reference path="../web-globals/console.d.ts" />
/// <reference path="../web-globals/crypto.d.ts" />
/// <reference path="../web-globals/domexception.d.ts" />
/// <reference path="../web-globals/encoding.d.ts" />
/// <reference path="../web-globals/events.d.ts" />
/// <reference path="../web-globals/fetch.d.ts" />
/// <reference path="../web-globals/importmeta.d.ts" />
/// <reference path="../web-globals/messaging.d.ts" />
/// <reference path="../web-globals/navigator.d.ts" />
/// <reference path="../web-globals/performance.d.ts" />
/// <reference path="../web-globals/storage.d.ts" />
/// <reference path="../web-globals/streams.d.ts" />
/// <reference path="../web-globals/timers.d.ts" />
/// <reference path="../web-globals/url.d.ts" />
/// <reference path="../assert.d.ts" />
/// <reference path="../assert/strict.d.ts" />
/// <reference path="../async_hooks.d.ts" />
@@ -78,30 +68,25 @@
/// <reference path="../https.d.ts" />
/// <reference path="../inspector.d.ts" />
/// <reference path="../inspector.generated.d.ts" />
/// <reference path="../inspector/promises.d.ts" />
/// <reference path="../module.d.ts" />
/// <reference path="../net.d.ts" />
/// <reference path="../os.d.ts" />
/// <reference path="../path.d.ts" />
/// <reference path="../path/posix.d.ts" />
/// <reference path="../path/win32.d.ts" />
/// <reference path="../perf_hooks.d.ts" />
/// <reference path="../process.d.ts" />
/// <reference path="../punycode.d.ts" />
/// <reference path="../querystring.d.ts" />
/// <reference path="../quic.d.ts" />
/// <reference path="../readline.d.ts" />
/// <reference path="../readline/promises.d.ts" />
/// <reference path="../repl.d.ts" />
/// <reference path="../sea.d.ts" />
/// <reference path="../sqlite.d.ts" />
/// <reference path="../stream.d.ts" />
/// <reference path="../stream/consumers.d.ts" />
/// <reference path="../stream/promises.d.ts" />
/// <reference path="../stream/consumers.d.ts" />
/// <reference path="../stream/web.d.ts" />
/// <reference path="../string_decoder.d.ts" />
/// <reference path="../test.d.ts" />
/// <reference path="../test/reporters.d.ts" />
/// <reference path="../timers.d.ts" />
/// <reference path="../timers/promises.d.ts" />
/// <reference path="../tls.d.ts" />
@@ -109,7 +94,6 @@
/// <reference path="../tty.d.ts" />
/// <reference path="../url.d.ts" />
/// <reference path="../util.d.ts" />
/// <reference path="../util/types.d.ts" />
/// <reference path="../v8.d.ts" />
/// <reference path="../vm.d.ts" />
/// <reference path="../wasi.d.ts" />

74
node_modules/@types/node/tty.d.ts generated vendored
View File

@@ -21,9 +21,9 @@
*
* In most cases, there should be little to no reason for an application to
* manually create instances of the `tty.ReadStream` and `tty.WriteStream` classes.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/tty.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/tty.js)
*/
declare module "node:tty" {
declare module "tty" {
import * as net from "node:net";
/**
* The `tty.isatty()` method returns `true` if the given `fd` is associated with
@@ -75,9 +75,6 @@ declare module "node:tty" {
* 1 - to the right from cursor
*/
type Direction = -1 | 0 | 1;
interface WriteStreamEventMap extends net.SocketEventMap {
"resize": [];
}
/**
* Represents the writable side of a TTY. In normal circumstances, `process.stdout` and `process.stderr` will be the only`tty.WriteStream` instances created for a Node.js process and there
* should be no reason to create additional instances.
@@ -85,6 +82,18 @@ declare module "node:tty" {
*/
class WriteStream extends net.Socket {
constructor(fd: number);
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "resize", listener: () => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "resize"): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "resize", listener: () => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "resize", listener: () => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "resize", listener: () => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "resize", listener: () => void): this;
/**
* `writeStream.clearLine()` clears the current line of this `WriteStream` in a
* direction identified by `dir`.
@@ -192,59 +201,8 @@ declare module "node:tty" {
* @since v0.5.8
*/
isTTY: boolean;
// #region InternalEventEmitter
addListener<E extends keyof WriteStreamEventMap>(
eventName: E,
listener: (...args: WriteStreamEventMap[E]) => void,
): this;
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
emit<E extends keyof WriteStreamEventMap>(eventName: E, ...args: WriteStreamEventMap[E]): boolean;
emit(eventName: string | symbol, ...args: any[]): boolean;
listenerCount<E extends keyof WriteStreamEventMap>(
eventName: E,
listener?: (...args: WriteStreamEventMap[E]) => void,
): number;
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
listeners<E extends keyof WriteStreamEventMap>(eventName: E): ((...args: WriteStreamEventMap[E]) => void)[];
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
off<E extends keyof WriteStreamEventMap>(
eventName: E,
listener: (...args: WriteStreamEventMap[E]) => void,
): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
on<E extends keyof WriteStreamEventMap>(
eventName: E,
listener: (...args: WriteStreamEventMap[E]) => void,
): this;
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
once<E extends keyof WriteStreamEventMap>(
eventName: E,
listener: (...args: WriteStreamEventMap[E]) => void,
): this;
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependListener<E extends keyof WriteStreamEventMap>(
eventName: E,
listener: (...args: WriteStreamEventMap[E]) => void,
): this;
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener<E extends keyof WriteStreamEventMap>(
eventName: E,
listener: (...args: WriteStreamEventMap[E]) => void,
): this;
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
rawListeners<E extends keyof WriteStreamEventMap>(eventName: E): ((...args: WriteStreamEventMap[E]) => void)[];
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
removeAllListeners<E extends keyof WriteStreamEventMap>(eventName?: E): this;
removeAllListeners(eventName?: string | symbol): this;
removeListener<E extends keyof WriteStreamEventMap>(
eventName: E,
listener: (...args: WriteStreamEventMap[E]) => void,
): this;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
// #endregion
}
}
declare module "tty" {
export * from "node:tty";
declare module "node:tty" {
export * from "tty";
}

693
node_modules/@types/node/url.d.ts generated vendored
View File

@@ -5,10 +5,10 @@
* ```js
* import url from 'node:url';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/url.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/url.js)
*/
declare module "node:url" {
import { Blob, NonSharedBuffer } from "node:buffer";
declare module "url" {
import { Blob as NodeBlob } from "node:buffer";
import { ClientRequestArgs } from "node:http";
import { ParsedUrlQuery, ParsedUrlQueryInput } from "node:querystring";
// Input to `url.format`
@@ -71,44 +71,20 @@ declare module "node:url" {
* A `URIError` is thrown if the `auth` property is present but cannot be decoded.
*
* `url.parse()` uses a lenient, non-standard algorithm for parsing URL
* strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487)
* and incorrect handling of usernames and passwords. Do not use with untrusted
* input. CVEs are not issued for `url.parse()` vulnerabilities. Use the
* [WHATWG URL](https://nodejs.org/docs/latest-v25.x/api/url.html#the-whatwg-url-api) API instead, for example:
*
* ```js
* 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}`);
* }
* ```
*
* The example above assumes well-formed headers are forwarded from a reverse
* proxy to your Node.js server. If you are not using a reverse proxy, you should
* use the example below:
*
* ```js
* function getURL(req) {
* return new URL(req.url || '/', 'https://example.com');
* }
* ```
* strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487) and incorrect handling of usernames and passwords. Do not use with untrusted
* input. CVEs are not issued for `url.parse()` vulnerabilities. Use the `WHATWG URL` API instead.
* @since v0.1.25
* @deprecated Use the WHATWG URL API instead.
* @param urlString The URL string to parse.
* @param parseQueryString If `true`, the `query` property will always
* be set to an object returned by the [`querystring`](https://nodejs.org/docs/latest-v25.x/api/querystring.html) module's `parse()`
* method. If `false`, the `query` property on the returned URL object will be an
* unparsed, undecoded string. **Default:** `false`.
* @param slashesDenoteHost If `true`, the first token after the literal
* string `//` and preceding the next `/` will be interpreted as the `host`.
* For instance, given `//foo/bar`, the result would be
* `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`.
* **Default:** `false`.
* @param [parseQueryString=false] If `true`, the `query` property will always be set to an object returned by the {@link querystring} module's `parse()` method. If `false`, the `query` property
* on the returned URL object will be an unparsed, undecoded string.
* @param [slashesDenoteHost=false] If `true`, the first token after the literal string `//` and preceding the next `/` will be interpreted as the `host`. For instance, given `//foo/bar`, the
* result would be `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`.
*/
function parse(urlString: string): UrlWithStringQuery;
function parse(
urlString: string,
parseQueryString?: false,
parseQueryString: false | undefined,
slashesDenoteHost?: boolean,
): UrlWithStringQuery;
function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;
@@ -349,7 +325,7 @@ declare module "node:url" {
* @returns The fully-resolved platform-specific Node.js file path
* as a `Buffer`.
*/
function fileURLToPathBuffer(url: string | URL, options?: FileUrlToPathOptions): NonSharedBuffer;
function fileURLToPathBuffer(url: string | URL, options?: FileUrlToPathOptions): Buffer;
/**
* This function ensures that `path` is resolved absolutely, and that the URL
* control characters are correctly encoded when converting into a File URL.
@@ -418,8 +394,381 @@ declare module "node:url" {
*/
unicode?: boolean | undefined;
}
// #region web types
type URLPatternInput = string | URLPatternInit;
/**
* Browser-compatible `URL` class, implemented by following the WHATWG URL
* Standard. [Examples of parsed URLs](https://url.spec.whatwg.org/#example-url-parsing) may be found in the Standard itself.
* The `URL` class is also available on the global object.
*
* In accordance with browser conventions, all properties of `URL` objects
* are implemented as getters and setters on the class prototype, rather than as
* data properties on the object itself. Thus, unlike `legacy urlObject`s,
* using the `delete` keyword on any properties of `URL` objects (e.g. `delete myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will still
* return `true`.
* @since v7.0.0, v6.13.0
*/
class URL {
/**
* Creates a `'blob:nodedata:...'` URL string that represents the given `Blob` object and can be used to retrieve the `Blob` later.
*
* ```js
* import {
* Blob,
* resolveObjectURL,
* } from 'node:buffer';
*
* const blob = new Blob(['hello']);
* const id = URL.createObjectURL(blob);
*
* // later...
*
* const otherBlob = resolveObjectURL(id);
* console.log(otherBlob.size);
* ```
*
* The data stored by the registered `Blob` will be retained in memory until `URL.revokeObjectURL()` is called to remove it.
*
* `Blob` objects are registered within the current thread. If using Worker
* Threads, `Blob` objects registered within one Worker will not be available
* to other workers or the main thread.
* @since v16.7.0
*/
static createObjectURL(blob: NodeBlob): string;
/**
* Removes the stored `Blob` identified by the given ID. Attempting to revoke a
* ID that isn't registered will silently fail.
* @since v16.7.0
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
*/
static revokeObjectURL(id: string): void;
/**
* Checks if an `input` relative to the `base` can be parsed to a `URL`.
*
* ```js
* const isValid = URL.canParse('/foo', 'https://example.org/'); // true
*
* const isNotValid = URL.canParse('/foo'); // false
* ```
* @since v19.9.0
* @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is
* `converted to a string` first.
* @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
*/
static canParse(input: string, base?: string): boolean;
/**
* Parses a string as a URL. If `base` is provided, it will be used as the base
* URL for the purpose of resolving non-absolute `input` URLs. Returns `null`
* if the parameters can't be resolved to a valid URL.
* @since v22.1.0
* @param input The absolute or relative input URL to parse. If `input`
* is relative, then `base` is required. If `input` is absolute, the `base`
* is ignored. If `input` is not a string, it is [converted to a string](https://tc39.es/ecma262/#sec-tostring) first.
* @param base The base URL to resolve against if the `input` is not
* absolute. If `base` is not a string, it is [converted to a string](https://tc39.es/ecma262/#sec-tostring) first.
*/
static parse(input: string, base?: string): URL | null;
constructor(input: string | { toString: () => string }, base?: string | URL);
/**
* Gets and sets the fragment portion of the URL.
*
* ```js
* const myURL = new URL('https://example.org/foo#bar');
* console.log(myURL.hash);
* // Prints #bar
*
* myURL.hash = 'baz';
* console.log(myURL.href);
* // Prints https://example.org/foo#baz
* ```
*
* Invalid URL characters included in the value assigned to the `hash` property
* are `percent-encoded`. The selection of which characters to
* percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
*/
hash: string;
/**
* Gets and sets the host portion of the URL.
*
* ```js
* const myURL = new URL('https://example.org:81/foo');
* console.log(myURL.host);
* // Prints example.org:81
*
* myURL.host = 'example.com:82';
* console.log(myURL.href);
* // Prints https://example.com:82/foo
* ```
*
* Invalid host values assigned to the `host` property are ignored.
*/
host: string;
/**
* Gets and sets the host name portion of the URL. The key difference between`url.host` and `url.hostname` is that `url.hostname` does _not_ include the
* port.
*
* ```js
* const myURL = new URL('https://example.org:81/foo');
* console.log(myURL.hostname);
* // Prints example.org
*
* // Setting the hostname does not change the port
* myURL.hostname = 'example.com';
* console.log(myURL.href);
* // Prints https://example.com:81/foo
*
* // Use myURL.host to change the hostname and port
* myURL.host = 'example.org:82';
* console.log(myURL.href);
* // Prints https://example.org:82/foo
* ```
*
* Invalid host name values assigned to the `hostname` property are ignored.
*/
hostname: string;
/**
* Gets and sets the serialized URL.
*
* ```js
* const myURL = new URL('https://example.org/foo');
* console.log(myURL.href);
* // Prints https://example.org/foo
*
* myURL.href = 'https://example.com/bar';
* console.log(myURL.href);
* // Prints https://example.com/bar
* ```
*
* Getting the value of the `href` property is equivalent to calling {@link toString}.
*
* Setting the value of this property to a new value is equivalent to creating a
* new `URL` object using `new URL(value)`. Each of the `URL` object's properties will be modified.
*
* If the value assigned to the `href` property is not a valid URL, a `TypeError` will be thrown.
*/
href: string;
/**
* Gets the read-only serialization of the URL's origin.
*
* ```js
* const myURL = new URL('https://example.org/foo/bar?baz');
* console.log(myURL.origin);
* // Prints https://example.org
* ```
*
* ```js
* const idnURL = new URL('https://測試');
* console.log(idnURL.origin);
* // Prints https://xn--g6w251d
*
* console.log(idnURL.hostname);
* // Prints xn--g6w251d
* ```
*/
readonly origin: string;
/**
* Gets and sets the password portion of the URL.
*
* ```js
* const myURL = new URL('https://abc:xyz@example.com');
* console.log(myURL.password);
* // Prints xyz
*
* myURL.password = '123';
* console.log(myURL.href);
* // Prints https://abc:123@example.com/
* ```
*
* Invalid URL characters included in the value assigned to the `password` property
* are `percent-encoded`. The selection of which characters to
* percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
*/
password: string;
/**
* Gets and sets the path portion of the URL.
*
* ```js
* const myURL = new URL('https://example.org/abc/xyz?123');
* console.log(myURL.pathname);
* // Prints /abc/xyz
*
* myURL.pathname = '/abcdef';
* console.log(myURL.href);
* // Prints https://example.org/abcdef?123
* ```
*
* Invalid URL characters included in the value assigned to the `pathname` property are `percent-encoded`. The selection of which characters
* to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
*/
pathname: string;
/**
* Gets and sets the port portion of the URL.
*
* The port value may be a number or a string containing a number in the range `0` to `65535` (inclusive). Setting the value to the default port of the `URL` objects given `protocol` will
* result in the `port` value becoming
* the empty string (`''`).
*
* The port value can be an empty string in which case the port depends on
* the protocol/scheme:
*
* <omitted>
*
* Upon assigning a value to the port, the value will first be converted to a
* string using `.toString()`.
*
* If that string is invalid but it begins with a number, the leading number is
* assigned to `port`.
* If the number lies outside the range denoted above, it is ignored.
*
* ```js
* const myURL = new URL('https://example.org:8888');
* console.log(myURL.port);
* // Prints 8888
*
* // Default ports are automatically transformed to the empty string
* // (HTTPS protocol's default port is 443)
* myURL.port = '443';
* console.log(myURL.port);
* // Prints the empty string
* console.log(myURL.href);
* // Prints https://example.org/
*
* myURL.port = 1234;
* console.log(myURL.port);
* // Prints 1234
* console.log(myURL.href);
* // Prints https://example.org:1234/
*
* // Completely invalid port strings are ignored
* myURL.port = 'abcd';
* console.log(myURL.port);
* // Prints 1234
*
* // Leading numbers are treated as a port number
* myURL.port = '5678abcd';
* console.log(myURL.port);
* // Prints 5678
*
* // Non-integers are truncated
* myURL.port = 1234.5678;
* console.log(myURL.port);
* // Prints 1234
*
* // Out-of-range numbers which are not represented in scientific notation
* // will be ignored.
* myURL.port = 1e10; // 10000000000, will be range-checked as described below
* console.log(myURL.port);
* // Prints 1234
* ```
*
* Numbers which contain a decimal point,
* such as floating-point numbers or numbers in scientific notation,
* are not an exception to this rule.
* Leading numbers up to the decimal point will be set as the URL's port,
* assuming they are valid:
*
* ```js
* myURL.port = 4.567e21;
* console.log(myURL.port);
* // Prints 4 (because it is the leading number in the string '4.567e21')
* ```
*/
port: string;
/**
* Gets and sets the protocol portion of the URL.
*
* ```js
* const myURL = new URL('https://example.org');
* console.log(myURL.protocol);
* // Prints https:
*
* myURL.protocol = 'ftp';
* console.log(myURL.href);
* // Prints ftp://example.org/
* ```
*
* Invalid URL protocol values assigned to the `protocol` property are ignored.
*/
protocol: string;
/**
* Gets and sets the serialized query portion of the URL.
*
* ```js
* const myURL = new URL('https://example.org/abc?123');
* console.log(myURL.search);
* // Prints ?123
*
* myURL.search = 'abc=xyz';
* console.log(myURL.href);
* // Prints https://example.org/abc?abc=xyz
* ```
*
* Any invalid URL characters appearing in the value assigned the `search` property will be `percent-encoded`. The selection of which
* characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
*/
search: string;
/**
* Gets the `URLSearchParams` object representing the query parameters of the
* URL. This property is read-only but the `URLSearchParams` object it provides
* can be used to mutate the URL instance; to replace the entirety of query
* parameters of the URL, use the {@link search} setter. See `URLSearchParams` documentation for details.
*
* Use care when using `.searchParams` to modify the `URL` because,
* per the WHATWG specification, the `URLSearchParams` object uses
* different rules to determine which characters to percent-encode. For
* instance, the `URL` object will not percent encode the ASCII tilde (`~`)
* character, while `URLSearchParams` will always encode it:
*
* ```js
* const myURL = new URL('https://example.org/abc?foo=~bar');
*
* console.log(myURL.search); // prints ?foo=~bar
*
* // Modify the URL via searchParams...
* myURL.searchParams.sort();
*
* console.log(myURL.search); // prints ?foo=%7Ebar
* ```
*/
readonly searchParams: URLSearchParams;
/**
* Gets and sets the username portion of the URL.
*
* ```js
* const myURL = new URL('https://abc:xyz@example.com');
* console.log(myURL.username);
* // Prints abc
*
* myURL.username = '123';
* console.log(myURL.href);
* // Prints https://123:xyz@example.com/
* ```
*
* Any invalid URL characters appearing in the value assigned the `username` property will be `percent-encoded`. The selection of which
* characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce.
*/
username: string;
/**
* The `toString()` method on the `URL` object returns the serialized URL. The
* value returned is equivalent to that of {@link href} and {@link toJSON}.
*/
toString(): string;
/**
* The `toJSON()` method on the `URL` object returns the serialized URL. The
* value returned is equivalent to that of {@link href} and {@link toString}.
*
* This method is automatically called when an `URL` object is serialized
* with [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify).
*
* ```js
* const myURLs = [
* new URL('https://www.example.com'),
* new URL('https://test.example.org'),
* ];
* console.log(JSON.stringify(myURLs));
* // Prints ["https://www.example.com/","https://test.example.org/"]
* ```
*/
toJSON(): string;
}
interface URLPatternComponentResult {
input: string;
groups: Record<string, string | undefined>;
@@ -439,7 +788,7 @@ declare module "node:url" {
ignoreCase?: boolean;
}
interface URLPatternResult {
inputs: URLPatternInput[];
inputs: (string | URLPatternInit)[];
protocol: URLPatternComponentResult;
username: URLPatternComponentResult;
password: URLPatternComponentResult;
@@ -449,30 +798,14 @@ declare module "node:url" {
search: URLPatternComponentResult;
hash: URLPatternComponentResult;
}
interface URL {
hash: string;
host: string;
hostname: string;
href: string;
readonly origin: string;
password: string;
pathname: string;
port: string;
protocol: string;
search: string;
readonly searchParams: URLSearchParams;
username: string;
toJSON(): string;
}
var URL: {
prototype: URL;
new(url: string | URL, base?: string | URL): URL;
canParse(input: string | URL, base?: string | URL): boolean;
createObjectURL(blob: Blob): string;
parse(input: string | URL, base?: string | URL): URL | null;
revokeObjectURL(id: string): void;
};
interface URLPattern {
/**
* @since v23.8.0
* @experimental
*/
class URLPattern {
constructor(input: string | URLPatternInit, baseURL: string, options?: URLPatternOptions);
constructor(input?: string | URLPatternInit, options?: URLPatternOptions);
exec(input?: string | URLPatternInit, baseURL?: string): URLPatternResult | null;
readonly hasRegExpGroups: boolean;
readonly hash: string;
readonly hostname: string;
@@ -481,39 +814,215 @@ declare module "node:url" {
readonly port: string;
readonly protocol: string;
readonly search: string;
test(input?: string | URLPatternInit, baseURL?: string): boolean;
readonly username: string;
exec(input?: URLPatternInput, baseURL?: string | URL): URLPatternResult | null;
test(input?: URLPatternInput, baseURL?: string | URL): boolean;
}
var URLPattern: {
prototype: URLPattern;
new(input: URLPatternInput, baseURL: string | URL, options?: URLPatternOptions): URLPattern;
new(input?: URLPatternInput, options?: URLPatternOptions): URLPattern;
};
interface URLSearchParams {
readonly size: number;
append(name: string, value: string): void;
delete(name: string, value?: string): void;
get(name: string): string | null;
getAll(name: string): string[];
has(name: string, value?: string): boolean;
set(name: string, value: string): void;
sort(): void;
forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void;
[Symbol.iterator](): URLSearchParamsIterator<[string, string]>;
entries(): URLSearchParamsIterator<[string, string]>;
keys(): URLSearchParamsIterator<string>;
values(): URLSearchParamsIterator<string>;
}
var URLSearchParams: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
};
interface URLSearchParamsIterator<T> extends NodeJS.Iterator<T, NodeJS.BuiltinIteratorReturn, unknown> {
[Symbol.iterator](): URLSearchParamsIterator<T>;
}
// #endregion
/**
* The `URLSearchParams` API provides read and write access to the query of a `URL`. The `URLSearchParams` class can also be used standalone with one of the
* four following constructors.
* The `URLSearchParams` class is also available on the global object.
*
* The WHATWG `URLSearchParams` interface and the `querystring` module have
* similar purpose, but the purpose of the `querystring` module is more
* general, as it allows the customization of delimiter characters (`&#x26;` and `=`).
* On the other hand, this API is designed purely for URL query strings.
*
* ```js
* const myURL = new URL('https://example.org/?abc=123');
* console.log(myURL.searchParams.get('abc'));
* // Prints 123
*
* myURL.searchParams.append('abc', 'xyz');
* console.log(myURL.href);
* // Prints https://example.org/?abc=123&#x26;abc=xyz
*
* myURL.searchParams.delete('abc');
* myURL.searchParams.set('a', 'b');
* console.log(myURL.href);
* // Prints https://example.org/?a=b
*
* const newSearchParams = new URLSearchParams(myURL.searchParams);
* // The above is equivalent to
* // const newSearchParams = new URLSearchParams(myURL.search);
*
* newSearchParams.append('a', 'c');
* console.log(myURL.href);
* // Prints https://example.org/?a=b
* console.log(newSearchParams.toString());
* // Prints a=b&#x26;a=c
*
* // newSearchParams.toString() is implicitly called
* myURL.search = newSearchParams;
* console.log(myURL.href);
* // Prints https://example.org/?a=b&#x26;a=c
* newSearchParams.delete('a');
* console.log(myURL.href);
* // Prints https://example.org/?a=b&#x26;a=c
* ```
* @since v7.5.0, v6.13.0
*/
class URLSearchParams implements Iterable<[string, string]> {
constructor(
init?:
| URLSearchParams
| string
| Record<string, string | readonly string[]>
| Iterable<[string, string]>
| ReadonlyArray<[string, string]>,
);
/**
* Append a new name-value pair to the query string.
*/
append(name: string, value: string): void;
/**
* If `value` is provided, removes all name-value pairs
* where name is `name` and value is `value`.
*
* If `value` is not provided, removes all name-value pairs whose name is `name`.
*/
delete(name: string, value?: string): void;
/**
* Returns an ES6 `Iterator` over each of the name-value pairs in the query.
* Each item of the iterator is a JavaScript `Array`. The first item of the `Array` is the `name`, the second item of the `Array` is the `value`.
*
* Alias for `urlSearchParams[Symbol.iterator]()`.
*/
entries(): URLSearchParamsIterator<[string, string]>;
/**
* Iterates over each name-value pair in the query and invokes the given function.
*
* ```js
* const myURL = new URL('https://example.org/?a=b&#x26;c=d');
* myURL.searchParams.forEach((value, name, searchParams) => {
* console.log(name, value, myURL.searchParams === searchParams);
* });
* // Prints:
* // a b true
* // c d true
* ```
* @param fn Invoked for each name-value pair in the query
* @param thisArg To be used as `this` value for when `fn` is called
*/
forEach<TThis = this>(
fn: (this: TThis, value: string, name: string, searchParams: URLSearchParams) => void,
thisArg?: TThis,
): void;
/**
* Returns the value of the first name-value pair whose name is `name`. If there
* are no such pairs, `null` is returned.
* @return or `null` if there is no name-value pair with the given `name`.
*/
get(name: string): string | null;
/**
* Returns the values of all name-value pairs whose name is `name`. If there are
* no such pairs, an empty array is returned.
*/
getAll(name: string): string[];
/**
* Checks if the `URLSearchParams` object contains key-value pair(s) based on `name` and an optional `value` argument.
*
* If `value` is provided, returns `true` when name-value pair with
* same `name` and `value` exists.
*
* If `value` is not provided, returns `true` if there is at least one name-value
* pair whose name is `name`.
*/
has(name: string, value?: string): boolean;
/**
* Returns an ES6 `Iterator` over the names of each name-value pair.
*
* ```js
* const params = new URLSearchParams('foo=bar&#x26;foo=baz');
* for (const name of params.keys()) {
* console.log(name);
* }
* // Prints:
* // foo
* // foo
* ```
*/
keys(): URLSearchParamsIterator<string>;
/**
* Sets the value in the `URLSearchParams` object associated with `name` to `value`. If there are any pre-existing name-value pairs whose names are `name`,
* set the first such pair's value to `value` and remove all others. If not,
* append the name-value pair to the query string.
*
* ```js
* const params = new URLSearchParams();
* params.append('foo', 'bar');
* params.append('foo', 'baz');
* params.append('abc', 'def');
* console.log(params.toString());
* // Prints foo=bar&#x26;foo=baz&#x26;abc=def
*
* params.set('foo', 'def');
* params.set('xyz', 'opq');
* console.log(params.toString());
* // Prints foo=def&#x26;abc=def&#x26;xyz=opq
* ```
*/
set(name: string, value: string): void;
/**
* The total number of parameter entries.
* @since v19.8.0
*/
readonly size: number;
/**
* Sort all existing name-value pairs in-place by their names. Sorting is done
* with a [stable sorting algorithm](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability), so relative order between name-value pairs
* with the same name is preserved.
*
* This method can be used, in particular, to increase cache hits.
*
* ```js
* const params = new URLSearchParams('query[]=abc&#x26;type=search&#x26;query[]=123');
* params.sort();
* console.log(params.toString());
* // Prints query%5B%5D=abc&#x26;query%5B%5D=123&#x26;type=search
* ```
* @since v7.7.0, v6.13.0
*/
sort(): void;
/**
* Returns the search parameters serialized as a string, with characters
* percent-encoded where necessary.
*/
toString(): string;
/**
* Returns an ES6 `Iterator` over the values of each name-value pair.
*/
values(): URLSearchParamsIterator<string>;
[Symbol.iterator](): URLSearchParamsIterator<[string, string]>;
}
import {
URL as _URL,
URLPattern as _URLPattern,
URLPatternInit as _URLPatternInit,
URLPatternResult as _URLPatternResult,
URLSearchParams as _URLSearchParams,
} from "url";
global {
interface URL extends _URL {}
var URL: typeof globalThis extends {
onmessage: any;
URL: infer T;
} ? T
: typeof _URL;
interface URLSearchParams extends _URLSearchParams {}
var URLSearchParams: typeof globalThis extends {
onmessage: any;
URLSearchParams: infer T;
} ? T
: typeof _URLSearchParams;
interface URLPatternInit extends _URLPatternInit {}
interface URLPatternResult extends _URLPatternResult {}
interface URLPattern extends _URLPattern {}
var URLPattern: typeof _URLPattern;
}
}
declare module "url" {
export * from "node:url";
declare module "node:url" {
export * from "url";
}

941
node_modules/@types/node/util.d.ts generated vendored

File diff suppressed because it is too large Load Diff

84
node_modules/@types/node/v8.d.ts generated vendored
View File

@@ -4,10 +4,9 @@
* ```js
* import v8 from 'node:v8';
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/v8.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/v8.js)
*/
declare module "node:v8" {
import { NonSharedBuffer } from "node:buffer";
declare module "v8" {
import { Readable } from "node:stream";
interface HeapSpaceInfo {
space_name: string;
@@ -33,7 +32,6 @@ declare module "node:v8" {
total_global_handles_size: number;
used_global_handles_size: number;
external_memory: number;
total_allocated_bytes: number;
}
interface HeapCodeStatistics {
code_and_metadata_size: number;
@@ -45,12 +43,12 @@ declare module "node:v8" {
* If true, expose internals in the heap snapshot.
* @default false
*/
exposeInternals?: boolean | undefined;
exposeInternals?: boolean;
/**
* If true, expose numeric values in artificial fields.
* @default false
*/
exposeNumericValues?: boolean | undefined;
exposeNumericValues?: boolean;
}
/**
* Returns an integer representing a version tag derived from the V8 version,
@@ -94,9 +92,6 @@ declare module "node:v8" {
* `external_memory` The value of external\_memory is the memory size of array
* buffers and external strings.
*
* `total_allocated_bytes` The value of total allocated bytes since the Isolate
* creation
*
* ```js
* {
* total_heap_size: 7326976,
@@ -405,65 +400,6 @@ declare module "node:v8" {
* @since v12.8.0
*/
function getHeapCodeStatistics(): HeapCodeStatistics;
/**
* @since v25.0.0
*/
interface SyncCPUProfileHandle {
/**
* Stopping collecting the profile and return the profile data.
* @since v25.0.0
*/
stop(): string;
/**
* Stopping collecting the profile and the profile will be discarded.
* @since v25.0.0
*/
[Symbol.dispose](): void;
}
/**
* @since v24.8.0
*/
interface CPUProfileHandle {
/**
* Stopping collecting the profile, then return a Promise that fulfills with an error or the
* profile data.
* @since v24.8.0
*/
stop(): Promise<string>;
/**
* Stopping collecting the profile and the profile will be discarded.
* @since v24.8.0
*/
[Symbol.asyncDispose](): Promise<void>;
}
/**
* @since v24.9.0
*/
interface HeapProfileHandle {
/**
* Stopping collecting the profile, then return a Promise that fulfills with an error or the
* profile data.
* @since v24.9.0
*/
stop(): Promise<string>;
/**
* Stopping collecting the profile and the profile will be discarded.
* @since v24.9.0
*/
[Symbol.asyncDispose](): Promise<void>;
}
/**
* Starting a CPU profile then return a `SyncCPUProfileHandle` object.
* This API supports `using` syntax.
*
* ```js
* const handle = v8.startCpuProfile();
* const profile = handle.stop();
* console.log(profile);
* ```
* @since v25.0.0
*/
function startCPUProfile(): SyncCPUProfileHandle;
/**
* V8 only supports `Latin-1/ISO-8859-1` and `UTF16` as the underlying representation of a string.
* If the `content` uses `Latin-1/ISO-8859-1` as the underlying representation, this function will return true;
@@ -517,7 +453,7 @@ declare module "node:v8" {
* the buffer is released. Calling this method results in undefined behavior
* if a previous write has failed.
*/
releaseBuffer(): NonSharedBuffer;
releaseBuffer(): Buffer;
/**
* Marks an `ArrayBuffer` as having its contents transferred out of band.
* Pass the corresponding `ArrayBuffer` in the deserializing context to `deserializer.transferArrayBuffer()`.
@@ -545,7 +481,7 @@ declare module "node:v8" {
* will require a way to compute the length of the buffer.
* For use inside of a custom `serializer._writeHostObject()`.
*/
writeRawBytes(buffer: NodeJS.ArrayBufferView): void;
writeRawBytes(buffer: NodeJS.TypedArray): void;
}
/**
* A subclass of `Serializer` that serializes `TypedArray`(in particular `Buffer`) and `DataView` objects as host objects, and only
@@ -616,7 +552,7 @@ declare module "node:v8" {
* larger than `buffer.constants.MAX_LENGTH`.
* @since v8.0.0
*/
function serialize(value: any): NonSharedBuffer;
function serialize(value: any): Buffer;
/**
* Uses a `DefaultDeserializer` with default options to read a JS value
* from a buffer.
@@ -644,7 +580,7 @@ declare module "node:v8" {
function stopCoverage(): void;
/**
* The API is a no-op if `--heapsnapshot-near-heap-limit` is already set from the command line or the API is called more than once.
* `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--heapsnapshot-near-heap-limitmax_count) for more information.
* `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--heapsnapshot-near-heap-limitmax_count) for more information.
* @since v18.10.0, v16.18.0
*/
function setHeapSnapshotNearHeapLimit(limit: number): void;
@@ -978,6 +914,6 @@ declare module "node:v8" {
function isBuildingSnapshot(): boolean;
}
}
declare module "v8" {
export * from "node:v8";
declare module "node:v8" {
export * from "v8";
}

331
node_modules/@types/node/vm.d.ts generated vendored
View File

@@ -34,10 +34,9 @@
*
* console.log(x); // 1; y is not defined.
* ```
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/vm.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/vm.js)
*/
declare module "node:vm" {
import { NonSharedBuffer } from "node:buffer";
declare module "vm" {
import { ImportAttributes, ImportPhase } from "node:module";
interface Context extends NodeJS.Dict<any> {}
interface BaseOptions {
@@ -67,13 +66,13 @@ declare module "node:vm" {
/**
* Provides an optional data with V8's code cache data for the supplied source.
*/
cachedData?: NodeJS.ArrayBufferView | undefined;
cachedData?: Buffer | NodeJS.ArrayBufferView | undefined;
/** @deprecated in favor of `script.createCachedData()` */
produceCachedData?: boolean | undefined;
/**
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
* @experimental
*/
importModuleDynamically?:
@@ -100,26 +99,32 @@ declare module "node:vm" {
*/
breakOnSigint?: boolean | undefined;
}
interface RunningScriptInNewContextOptions
extends RunningScriptOptions, Pick<CreateContextOptions, "microtaskMode">
{
interface RunningScriptInNewContextOptions extends RunningScriptOptions {
/**
* Human-readable name of the newly created context.
*/
contextName?: CreateContextOptions["name"] | undefined;
contextName?: CreateContextOptions["name"];
/**
* Origin corresponding to the newly created context for display purposes. The origin should be formatted like a URL,
* but with only the scheme, host, and port (if necessary), like the value of the `url.origin` property of a `URL` object.
* Most notably, this string should omit the trailing slash, as that denotes a path.
*/
contextOrigin?: CreateContextOptions["origin"] | undefined;
contextCodeGeneration?: CreateContextOptions["codeGeneration"] | undefined;
contextOrigin?: CreateContextOptions["origin"];
contextCodeGeneration?: CreateContextOptions["codeGeneration"];
/**
* If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
*/
microtaskMode?: CreateContextOptions["microtaskMode"];
}
interface RunningCodeOptions extends RunningScriptOptions, Pick<ScriptOptions, "cachedData"> {
interface RunningCodeOptions extends RunningScriptOptions {
/**
* Provides an optional data with V8's code cache data for the supplied source.
*/
cachedData?: ScriptOptions["cachedData"] | undefined;
/**
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
* @experimental
*/
importModuleDynamically?:
@@ -127,13 +132,15 @@ declare module "node:vm" {
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
| undefined;
}
interface RunningCodeInNewContextOptions
extends RunningScriptInNewContextOptions, Pick<ScriptOptions, "cachedData">
{
interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions {
/**
* Provides an optional data with V8's code cache data for the supplied source.
*/
cachedData?: ScriptOptions["cachedData"] | undefined;
/**
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
* @experimental
*/
importModuleDynamically?:
@@ -141,7 +148,16 @@ declare module "node:vm" {
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
| undefined;
}
interface CompileFunctionOptions extends BaseOptions, Pick<ScriptOptions, "cachedData" | "produceCachedData"> {
interface CompileFunctionOptions extends BaseOptions {
/**
* Provides an optional data with V8's code cache data for the supplied source.
*/
cachedData?: ScriptOptions["cachedData"] | undefined;
/**
* Specifies whether to produce new cache data.
* @default false
*/
produceCachedData?: boolean | undefined;
/**
* The sandbox/context in which the said function should be compiled in.
*/
@@ -153,7 +169,7 @@ declare module "node:vm" {
/**
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
* @experimental
*/
importModuleDynamically?:
@@ -197,7 +213,7 @@ declare module "node:vm" {
/**
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
* @experimental
*/
importModuleDynamically?:
@@ -368,17 +384,17 @@ declare module "node:vm" {
* ```
* @since v10.6.0
*/
createCachedData(): NonSharedBuffer;
createCachedData(): Buffer;
/** @deprecated in favor of `script.createCachedData()` */
cachedDataProduced?: boolean;
cachedDataProduced?: boolean | undefined;
/**
* When `cachedData` is supplied to create the `vm.Script`, this value will be set
* to either `true` or `false` depending on acceptance of the data by V8.
* Otherwise the value is `undefined`.
* @since v5.7.0
*/
cachedDataRejected?: boolean;
cachedData?: NonSharedBuffer;
cachedDataRejected?: boolean | undefined;
cachedData?: Buffer | undefined;
/**
* When the script is compiled from a source that contains a source map magic
* comment, this property will be set to the URL of the source map.
@@ -396,13 +412,13 @@ declare module "node:vm" {
* ```
* @since v19.1.0, v18.13.0
*/
sourceMapURL: string | undefined;
sourceMapURL?: string | undefined;
}
/**
* If the given `contextObject` is an object, the `vm.createContext()` method will
* [prepare that object](https://nodejs.org/docs/latest-v25.x/api/vm.html#what-does-it-mean-to-contextify-an-object)
* [prepare that object](https://nodejs.org/docs/latest-v24.x/api/vm.html#what-does-it-mean-to-contextify-an-object)
* and return a reference to it so that it can be used in calls to {@link runInContext} or
* [`script.runInContext()`](https://nodejs.org/docs/latest-v25.x/api/vm.html#scriptrunincontextcontextifiedobject-options).
* [`script.runInContext()`](https://nodejs.org/docs/latest-v24.x/api/vm.html#scriptrunincontextcontextifiedobject-options).
* Inside such scripts, the global object will be wrapped by the `contextObject`, retaining all of its
* existing properties but also having the built-in objects and functions any standard
* [global object](https://es5.github.io/#x15.1) has. Outside of scripts run by the vm module, global
@@ -606,7 +622,11 @@ declare module "node:vm" {
code: string,
params?: readonly string[],
options?: CompileFunctionOptions,
): Function & Pick<Script, "cachedData" | "cachedDataProduced" | "cachedDataRejected">;
): Function & {
cachedData?: Script["cachedData"] | undefined;
cachedDataProduced?: Script["cachedDataProduced"] | undefined;
cachedDataRejected?: Script["cachedDataRejected"] | undefined;
};
/**
* Measure the memory known to V8 and used by all contexts known to the
* current V8 isolate, or the main context.
@@ -663,7 +683,10 @@ declare module "node:vm" {
* @experimental
*/
function measureMemory(options?: MeasureMemoryOptions): Promise<MemoryMeasurement>;
interface ModuleEvaluateOptions extends Pick<RunningScriptOptions, "breakOnSigint" | "timeout"> {}
interface ModuleEvaluateOptions {
timeout?: RunningScriptOptions["timeout"] | undefined;
breakOnSigint?: RunningScriptOptions["breakOnSigint"] | undefined;
}
type ModuleLinker = (
specifier: string,
referencingModule: Module,
@@ -677,12 +700,14 @@ declare module "node:vm" {
* flag enabled.
*
* The `vm.Module` class provides a low-level interface for using
* ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script`
* class that closely mirrors [Module Record](https://tc39.es/ecma262/#sec-abstract-module-records)s as defined in the ECMAScript
* ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script` class that closely mirrors [Module Record](https://262.ecma-international.org/14.0/#sec-abstract-module-records) s as
* defined in the ECMAScript
* specification.
*
* Unlike `vm.Script` however, every `vm.Module` object is bound to a context from
* its creation.
* its creation. Operations on `vm.Module` objects are intrinsically asynchronous,
* in contrast with the synchronous nature of `vm.Script` objects. The use of
* 'async' functions can help with manipulating `vm.Module` objects.
*
* Using a `vm.Module` object requires three distinct steps: creation/parsing,
* linking, and evaluation. These three steps are illustrated in the following
@@ -710,7 +735,7 @@ declare module "node:vm" {
* // Here, we attempt to obtain the default export from the module "foo", and
* // put it into local binding "secret".
*
* const rootModule = new vm.SourceTextModule(`
* const bar = new vm.SourceTextModule(`
* import s from 'foo';
* s;
* print(s);
@@ -720,48 +745,39 @@ declare module "node:vm" {
* //
* // "Link" the imported dependencies of this Module to it.
* //
* // Obtain the requested dependencies of a SourceTextModule by
* // `sourceTextModule.moduleRequests` and resolve them.
* // The provided linking callback (the "linker") accepts two arguments: the
* // parent module (`bar` in this case) and the string that is the specifier of
* // the imported module. The callback is expected to return a Module that
* // corresponds to the provided specifier, with certain requirements documented
* // in `module.link()`.
* //
* // If linking has not started for the returned Module, the same linker
* // callback will be called on the returned Module.
* //
* // Even top-level Modules without dependencies must be explicitly linked. The
* // array passed to `sourceTextModule.linkRequests(modules)` can be
* // empty, however.
* // callback provided would never be called, however.
* //
* // Note: This is a contrived example in that the resolveAndLinkDependencies
* // creates a new "foo" module every time it is called. In a full-fledged
* // module system, a cache would probably be used to avoid duplicated modules.
* // The link() method returns a Promise that will be resolved when all the
* // Promises returned by the linker resolve.
* //
* // Note: This is a contrived example in that the linker function creates a new
* // "foo" module every time it is called. In a full-fledged module system, a
* // cache would probably be used to avoid duplicated modules.
*
* const moduleMap = new Map([
* ['root', rootModule],
* ]);
* async function linker(specifier, referencingModule) {
* if (specifier === 'foo') {
* return new vm.SourceTextModule(`
* // The "secret" variable refers to the global variable we added to
* // "contextifiedObject" when creating the context.
* export default secret;
* `, { context: referencingModule.context });
*
* function resolveAndLinkDependencies(module) {
* const requestedModules = module.moduleRequests.map((request) => {
* // In a full-fledged module system, the resolveAndLinkDependencies would
* // resolve the module with the module cache key `[specifier, attributes]`.
* // In this example, we just use the specifier as the key.
* const specifier = request.specifier;
*
* let requestedModule = moduleMap.get(specifier);
* if (requestedModule === undefined) {
* requestedModule = new vm.SourceTextModule(`
* // 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, requestedModule);
* // Resolve the dependencies of the new module as well.
* resolveAndLinkDependencies(requestedModule);
* }
*
* return requestedModule;
* });
*
* module.linkRequests(requestedModules);
* // Using `contextifiedObject` instead of `referencingModule.context`
* // here would work as well.
* }
* throw new Error(`Unable to resolve dependency: ${specifier}`);
* }
*
* resolveAndLinkDependencies(rootModule);
* rootModule.instantiate();
* await bar.link(linker);
*
* // Step 3
* //
@@ -769,7 +785,7 @@ declare module "node:vm" {
* // resolve after the module has finished evaluating.
*
* // Prints 42.
* await rootModule.evaluate();
* await bar.evaluate();
* ```
* @since v13.0.0, v12.16.0
* @experimental
@@ -819,47 +835,19 @@ declare module "node:vm" {
*/
status: ModuleStatus;
/**
* 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.
* Evaluate the module.
*
* If the module is a `vm.SourceTextModule`, `evaluate()` must be called after the module has been instantiated;
* otherwise `evaluate()` will return a rejected promise.
* 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'`).
*
* For a `vm.SourceTextModule`, the promise returned by `evaluate()` may be fulfilled either
* synchronously or asynchronously:
* This method cannot be called while the module is being evaluated
* (`module.status` is `'evaluating'`).
*
* 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'`).
* 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.
* @return Fulfills with `undefined` upon success.
*/
evaluate(options?: ModuleEvaluateOptions): Promise<void>;
@@ -867,10 +855,6 @@ declare module "node:vm" {
* Link module dependencies. This method must be called before evaluation, and
* can only be called once per module.
*
* Use `sourceTextModule.linkRequests(modules)` and
* `sourceTextModule.instantiate()` to link modules either synchronously or
* asynchronously.
*
* The function is expected to return a `Module` object or a `Promise` that
* eventually resolves to a `Module` object. The returned `Module` must satisfy the
* following two invariants:
@@ -901,13 +885,19 @@ declare module "node:vm" {
*/
link(linker: ModuleLinker): Promise<void>;
}
interface SourceTextModuleOptions extends Pick<ScriptOptions, "cachedData" | "columnOffset" | "lineOffset"> {
interface SourceTextModuleOptions {
/**
* String used in stack traces.
* @default 'vm:module(i)' where i is a context-specific ascending index.
*/
identifier?: string | undefined;
/**
* Provides an optional data with V8's code cache data for the supplied source.
*/
cachedData?: ScriptOptions["cachedData"] | undefined;
context?: Context | undefined;
lineOffset?: BaseOptions["lineOffset"] | undefined;
columnOffset?: BaseOptions["columnOffset"] | undefined;
/**
* Called during evaluation of this module to initialize the `import.meta`.
*/
@@ -915,7 +905,7 @@ declare module "node:vm" {
/**
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
* @experimental
*/
importModuleDynamically?: DynamicModuleLoader<SourceTextModule> | undefined;
@@ -951,39 +941,6 @@ declare module "node:vm" {
class SourceTextModule extends Module {
/**
* Creates a new `SourceTextModule` instance.
*
* Properties assigned to the `import.meta` object that are objects may
* allow the module to access information outside the specified `context`. Use
* `vm.runInContext()` to create objects in a specific context.
*
* ```js
* import vm from 'node:vm';
*
* const contextifiedObject = vm.createContext({ secret: 42 });
*
* const module = new vm.SourceTextModule(
* 'Object.getPrototypeOf(import.meta.prop).secret = secret;',
* {
* initializeImportMeta(meta) {
* // Note: this object is created in the top context. As such,
* // Object.getPrototypeOf(import.meta.prop) points to the
* // Object.prototype in the top context rather than that in
* // the contextified object.
* meta.prop = {};
* },
* });
* // The module has an empty `moduleRequests` array.
* module.linkRequests([]);
* module.instantiate();
* await module.evaluate();
*
* // Now, Object.prototype.secret will be equal to 42.
* //
* // To fix this problem, replace
* // meta.prop = {};
* // above with
* // meta.prop = vm.runInContext('{}', contextifiedObject);
* ```
* @param code JavaScript Module code to parse
*/
constructor(code: string, options?: SourceTextModuleOptions);
@@ -991,75 +948,6 @@ declare module "node:vm" {
* @deprecated Use `sourceTextModule.moduleRequests` instead.
*/
readonly dependencySpecifiers: readonly string[];
/**
* Iterates over the dependency graph and returns `true` if any module in its
* dependencies or this module itself contains top-level `await` expressions,
* otherwise returns `false`.
*
* The search may be slow if the graph is big enough.
*
* This requires the module to be instantiated first. If the module is not
* instantiated yet, an error will be thrown.
* @since v24.9.0
*/
hasAsyncGraph(): boolean;
/**
* Returns whether the module itself contains any top-level `await` expressions.
*
* This corresponds to the field `[[HasTLA]]` in [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) in the
* ECMAScript specification.
* @since v24.9.0
*/
hasTopLevelAwait(): boolean;
/**
* Instantiate the module with the linked requested modules.
*
* This resolves the imported bindings of the module, including re-exported
* binding names. When there are any bindings that cannot be resolved,
* an error would be thrown synchronously.
*
* If the requested modules include cyclic dependencies, the
* `sourceTextModule.linkRequests(modules)` method must be called on all
* modules in the cycle before calling this method.
* @since v24.8.0
*/
instantiate(): void;
/**
* Link module dependencies. This method must be called before evaluation, and
* can only be called once per module.
*
* The order of the module instances in the `modules` array should correspond to the order of
* `sourceTextModule.moduleRequests` being resolved. If two module requests have the same
* specifier and import attributes, they must be resolved with the same module instance or an
* `ERR_MODULE_LINK_MISMATCH` would be thrown. For example, when linking requests for this
* module:
*
* ```js
* import foo from 'foo';
* import source Foo from 'foo';
* ```
*
* The `modules` array must contain two references to the same instance, because the two
* module requests are identical but in two phases.
*
* If the module has no dependencies, the `modules` array can be empty.
*
* Users can use `sourceTextModule.moduleRequests` to implement the host-defined
* [HostLoadImportedModule](https://tc39.es/ecma262/#sec-HostLoadImportedModule) abstract operation in the ECMAScript specification,
* and using `sourceTextModule.linkRequests()` to invoke specification defined
* [FinishLoadingImportedModule](https://tc39.es/ecma262/#sec-FinishLoadingImportedModule), on the module with all dependencies in a batch.
*
* It's up to the creator of the `SourceTextModule` to determine if the resolution
* of the dependencies is synchronous or asynchronous.
*
* After each module in the `modules` array is linked, call
* `sourceTextModule.instantiate()`.
* @since v24.8.0
* @param modules Array of `vm.Module` objects that this module depends on.
* The order of the modules in the array is the order of
* `sourceTextModule.moduleRequests`.
*/
linkRequests(modules: readonly Module[]): void;
/**
* The requested import dependencies of this module. The returned array is frozen
* to disallow any changes to it.
@@ -1155,7 +1043,9 @@ declare module "node:vm" {
options?: SyntheticModuleOptions,
);
/**
* This method sets the module export binding slots with the given value.
* This method is used after the module is linked to set the values of exports. If
* it is called before the module is linked, an `ERR_VM_MODULE_STATUS` error
* will be thrown.
*
* ```js
* import vm from 'node:vm';
@@ -1164,6 +1054,7 @@ declare module "node:vm" {
* m.setExport('x', 1);
* });
*
* await m.link(() => {});
* await m.evaluate();
*
* assert.strictEqual(m.namespace.x, 1);
@@ -1184,7 +1075,7 @@ declare module "node:vm" {
* and `vm.compileFunction()` so that Node.js uses the default ESM loader from the main
* context to load the requested module.
*
* For detailed information, see [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
* For detailed information, see [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
* @since v21.7.0, v20.12.0
*/
const USE_MAIN_CONTEXT_DEFAULT_LOADER: number;
@@ -1203,6 +1094,6 @@ declare module "node:vm" {
const DONT_CONTEXTIFY: number;
}
}
declare module "vm" {
export * from "node:vm";
declare module "node:vm" {
export * from "vm";
}

10
node_modules/@types/node/wasi.d.ts generated vendored
View File

@@ -67,9 +67,9 @@
* wat2wasm demo.wat
* ```
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/wasi.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/wasi.js)
*/
declare module "node:wasi" {
declare module "wasi" {
interface WASIOptions {
/**
* An array of strings that the WebAssembly application will
@@ -77,7 +77,7 @@ declare module "node:wasi" {
* WASI command itself.
* @default []
*/
args?: readonly string[] | undefined;
args?: string[] | undefined;
/**
* An object similar to `process.env` that the WebAssembly
* application will see as its environment.
@@ -197,6 +197,6 @@ declare module "node:wasi" {
readonly wasiImport: NodeJS.Dict<any>; // TODO: Narrow to DOM types
}
}
declare module "wasi" {
export * from "node:wasi";
declare module "node:wasi" {
export * from "wasi";
}

View File

@@ -1,42 +1,17 @@
export {};
import { InternalEventTargetEventProperties } from "node:events";
type _AbortController = typeof globalThis extends { onmessage: any } ? {} : AbortController;
interface AbortController {
readonly signal: AbortSignal;
abort(reason?: any): void;
}
interface AbortSignalEventMap {
"abort": Event;
}
type _AbortSignal = typeof globalThis extends { onmessage: any } ? {} : AbortSignal;
interface AbortSignal extends EventTarget, InternalEventTargetEventProperties<AbortSignalEventMap> {
interface AbortSignal extends EventTarget {
readonly aborted: boolean;
onabort: ((this: AbortSignal, ev: Event) => any) | null;
readonly reason: any;
throwIfAborted(): void;
addEventListener<K extends keyof AbortSignalEventMap>(
type: K,
listener: (ev: AbortSignalEventMap[K]) => void,
options?: AddEventListenerOptions | boolean,
): void;
addEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: AddEventListenerOptions | boolean,
): void;
removeEventListener<K extends keyof AbortSignalEventMap>(
type: K,
listener: (ev: AbortSignalEventMap[K]) => void,
options?: EventListenerOptions | boolean,
): void;
removeEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: EventListenerOptions | boolean,
): void;
}
declare global {

View File

@@ -1,6 +1,5 @@
export {};
type _AddEventListenerOptions = typeof globalThis extends { onmessage: any } ? {} : AddEventListenerOptions;
interface AddEventListenerOptions extends EventListenerOptions {
once?: boolean;
passive?: boolean;
@@ -44,17 +43,14 @@ interface EventInit {
composed?: boolean;
}
type _EventListener = typeof globalThis extends { onmessage: any } ? {} : EventListener;
interface EventListener {
(evt: Event): void;
}
type _EventListenerObject = typeof globalThis extends { onmessage: any } ? {} : EventListenerObject;
interface EventListenerObject {
handleEvent(object: Event): void;
}
type _EventListenerOptions = typeof globalThis extends { onmessage: any } ? {} : EventListenerOptions;
interface EventListenerOptions {
capture?: boolean;
}
@@ -75,8 +71,6 @@ interface EventTarget {
}
declare global {
interface AddEventListenerOptions extends _AddEventListenerOptions {}
interface CustomEvent<T = any> extends _CustomEvent<T> {}
var CustomEvent: typeof globalThis extends { onmessage: any; CustomEvent: infer T } ? T
: {
@@ -91,12 +85,6 @@ declare global {
new(type: string, eventInitDict?: EventInit): Event;
};
interface EventListener extends _EventListener {}
interface EventListenerObject extends _EventListenerObject {}
interface EventListenerOptions extends _EventListenerOptions {}
interface EventTarget extends _EventTarget {}
var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
: {

View File

@@ -3,21 +3,15 @@ export {};
import * as undici from "undici-types";
type _CloseEvent = typeof globalThis extends { onmessage: any } ? {} : undici.CloseEvent;
type _CloseEventInit = typeof globalThis extends { onmessage: any } ? {} : undici.CloseEventInit;
type _ErrorEvent = typeof globalThis extends { onmessage: any } ? {} : undici.ErrorEvent;
type _ErrorEventInit = typeof globalThis extends { onmessage: any } ? {} : undici.ErrorEventInit;
type _EventSource = typeof globalThis extends { onmessage: any } ? {} : undici.EventSource;
type _EventSourceInit = typeof globalThis extends { onmessage: any } ? {} : undici.EventSourceInit;
type _FormData = typeof globalThis extends { onmessage: any } ? {} : undici.FormData;
type _Headers = typeof globalThis extends { onmessage: any } ? {} : undici.Headers;
type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : undici.MessageEvent;
type _MessageEventInit = typeof globalThis extends { onmessage: any } ? {} : undici.MessageEventInit;
type _Request = typeof globalThis extends { onmessage: any } ? {} : undici.Request;
type _RequestInit = typeof globalThis extends { onmessage: any } ? {} : undici.RequestInit;
type _Response = typeof globalThis extends { onmessage: any } ? {} : undici.Response;
type _ResponseInit = typeof globalThis extends { onmessage: any } ? {} : undici.ResponseInit;
type _WebSocket = typeof globalThis extends { onmessage: any } ? {} : undici.WebSocket;
type _WebSocketInit = typeof globalThis extends { onmessage: any } ? {} : undici.WebSocketInit;
declare global {
function fetch(
@@ -28,18 +22,9 @@ declare global {
interface CloseEvent extends _CloseEvent {}
var CloseEvent: typeof globalThis extends { onmessage: any; CloseEvent: infer T } ? T : typeof undici.CloseEvent;
interface CloseEventInit extends _CloseEventInit {}
interface ErrorEvent extends _ErrorEvent {}
var ErrorEvent: typeof globalThis extends { onmessage: any; ErrorEvent: infer T } ? T : typeof undici.ErrorEvent;
interface ErrorEventInit extends _ErrorEventInit {}
interface EventSource extends _EventSource {}
var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T : typeof undici.EventSource;
interface EventSourceInit extends _EventSourceInit {}
interface FormData extends _FormData {}
var FormData: typeof globalThis extends { onmessage: any; FormData: infer T } ? T : typeof undici.FormData;
@@ -50,8 +35,6 @@ declare global {
var MessageEvent: typeof globalThis extends { onmessage: any; MessageEvent: infer T } ? T
: typeof undici.MessageEvent;
interface MessageEventInit extends _MessageEventInit {}
interface Request extends _Request {}
var Request: typeof globalThis extends { onmessage: any; Request: infer T } ? T : typeof undici.Request;
@@ -64,6 +47,4 @@ declare global {
interface WebSocket extends _WebSocket {}
var WebSocket: typeof globalThis extends { onmessage: any; WebSocket: infer T } ? T : typeof undici.WebSocket;
interface WebSocketInit extends _WebSocketInit {}
}

View File

@@ -52,22 +52,17 @@
*
* Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
* specifically `argv` and `execArgv` options.
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/worker_threads.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/worker_threads.js)
*/
declare module "node:worker_threads" {
import {
EventEmitter,
InternalEventEmitter,
InternalEventTargetEventProperties,
NodeEventTarget,
} from "node:events";
declare module "worker_threads" {
import { Context } from "node:vm";
import { EventEmitter } from "node:events";
import { EventLoopUtilityFunction } from "node:perf_hooks";
import { FileHandle } from "node:fs/promises";
import { Performance } from "node:perf_hooks";
import { Readable, Writable } from "node:stream";
import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
import { URL } from "node:url";
import { CPUProfileHandle, HeapInfo, HeapProfileHandle } from "node:v8";
import { Context } from "node:vm";
import { HeapInfo } from "node:v8";
import { MessageEvent } from "undici-types";
const isInternalThread: boolean;
const isMainThread: boolean;
@@ -75,12 +70,197 @@ declare module "node:worker_threads" {
const resourceLimits: ResourceLimits;
const SHARE_ENV: unique symbol;
const threadId: number;
const threadName: string | null;
const workerData: any;
interface WorkerPerformance extends Pick<Performance, "eventLoopUtilization"> {}
/**
* Instances of the `worker.MessageChannel` class represent an asynchronous,
* two-way communications channel.
* The `MessageChannel` has no methods of its own. `new MessageChannel()` yields an object with `port1` and `port2` properties, which refer to linked `MessagePort` instances.
*
* ```js
* import { MessageChannel } from 'node:worker_threads';
*
* const { port1, port2 } = new MessageChannel();
* port1.on('message', (message) => console.log('received', message));
* port2.postMessage({ foo: 'bar' });
* // Prints: received { foo: 'bar' } from the `port1.on('message')` listener
* ```
* @since v10.5.0
*/
class MessageChannel {
readonly port1: MessagePort;
readonly port2: MessagePort;
}
interface WorkerPerformance {
eventLoopUtilization: EventLoopUtilityFunction;
}
type Transferable =
| ArrayBuffer
| MessagePort
| AbortSignal
| FileHandle
| ReadableStream
| WritableStream
| TransformStream;
/** @deprecated Use `import { Transferable } from "node:worker_threads"` instead. */
// TODO: remove in a future major @types/node version.
type TransferListItem = Transferable;
/**
* Instances of the `worker.MessagePort` class represent one end of an
* asynchronous, two-way communications channel. It can be used to transfer
* structured data, memory regions and other `MessagePort`s between different `Worker`s.
*
* This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
* @since v10.5.0
*/
class MessagePort extends EventEmitter {
/**
* Disables further sending of messages on either side of the connection.
* This method can be called when no further communication will happen over this `MessagePort`.
*
* The `'close' event` is emitted on both `MessagePort` instances that
* are part of the channel.
* @since v10.5.0
*/
close(): void;
/**
* Sends a JavaScript value to the receiving side of this channel. `value` is transferred in a way which is compatible with
* the [HTML structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm).
*
* In particular, the significant differences to `JSON` are:
*
* * `value` may contain circular references.
* * `value` may contain instances of builtin JS types such as `RegExp`s, `BigInt`s, `Map`s, `Set`s, etc.
* * `value` may contain typed arrays, both using `ArrayBuffer`s
* and `SharedArrayBuffer`s.
* * `value` may contain [`WebAssembly.Module`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module) instances.
* * `value` may not contain native (C++-backed) objects other than:
*
* ```js
* import { MessageChannel } from 'node:worker_threads';
* const { port1, port2 } = new MessageChannel();
*
* port1.on('message', (message) => console.log(message));
*
* const circularData = {};
* circularData.foo = circularData;
* // Prints: { foo: [Circular] }
* port2.postMessage(circularData);
* ```
*
* `transferList` may be a list of [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), `MessagePort`, and `FileHandle` objects.
* After transferring, they are not usable on the sending side of the channel
* anymore (even if they are not contained in `value`). Unlike with `child processes`, transferring handles such as network sockets is currently
* not supported.
*
* If `value` contains [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances, those are accessible
* from either thread. They cannot be listed in `transferList`.
*
* `value` may still contain `ArrayBuffer` instances that are not in `transferList`; in that case, the underlying memory is copied rather than moved.
*
* ```js
* import { MessageChannel } from 'node:worker_threads';
* const { port1, port2 } = new MessageChannel();
*
* port1.on('message', (message) => console.log(message));
*
* const uint8Array = new Uint8Array([ 1, 2, 3, 4 ]);
* // This posts a copy of `uint8Array`:
* port2.postMessage(uint8Array);
* // This does not copy data, but renders `uint8Array` unusable:
* port2.postMessage(uint8Array, [ uint8Array.buffer ]);
*
* // The memory for the `sharedUint8Array` is accessible from both the
* // original and the copy received by `.on('message')`:
* const sharedUint8Array = new Uint8Array(new SharedArrayBuffer(4));
* port2.postMessage(sharedUint8Array);
*
* // This transfers a freshly created message port to the receiver.
* // This can be used, for example, to create communication channels between
* // multiple `Worker` threads that are children of the same parent thread.
* const otherChannel = new MessageChannel();
* port2.postMessage({ port: otherChannel.port1 }, [ otherChannel.port1 ]);
* ```
*
* The message object is cloned immediately, and can be modified after
* posting without having side effects.
*
* For more information on the serialization and deserialization mechanisms
* behind this API, see the `serialization API of the node:v8 module`.
* @since v10.5.0
*/
postMessage(value: any, transferList?: readonly Transferable[]): void;
/**
* If true, the `MessagePort` object will keep the Node.js event loop active.
* @since v18.1.0, v16.17.0
*/
hasRef(): boolean;
/**
* Opposite of `unref()`. Calling `ref()` on a previously `unref()`ed port does _not_ let the program exit if it's the only active handle left (the default
* behavior). If the port is `ref()`ed, calling `ref()` again has no effect.
*
* If listeners are attached or removed using `.on('message')`, the port
* is `ref()`ed and `unref()`ed automatically depending on whether
* listeners for the event exist.
* @since v10.5.0
*/
ref(): void;
/**
* Calling `unref()` on a port allows the thread to exit if this is the only
* active handle in the event system. If the port is already `unref()`ed calling `unref()` again has no effect.
*
* If listeners are attached or removed using `.on('message')`, the port is `ref()`ed and `unref()`ed automatically depending on whether
* listeners for the event exist.
* @since v10.5.0
*/
unref(): void;
/**
* Starts receiving messages on this `MessagePort`. When using this port
* as an event emitter, this is called automatically once `'message'` listeners are attached.
*
* This method exists for parity with the Web `MessagePort` API. In Node.js,
* it is only useful for ignoring messages when no event listener is present.
* Node.js also diverges in its handling of `.onmessage`. Setting it
* automatically calls `.start()`, but unsetting it lets messages queue up
* until a new handler is set or the port is discarded.
* @since v10.5.0
*/
start(): void;
addListener(event: "close", listener: () => void): this;
addListener(event: "message", listener: (value: any) => void): this;
addListener(event: "messageerror", listener: (error: Error) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: "close"): boolean;
emit(event: "message", value: any): boolean;
emit(event: "messageerror", error: Error): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: "close", listener: () => void): this;
on(event: "message", listener: (value: any) => void): this;
on(event: "messageerror", listener: (error: Error) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "message", listener: (value: any) => void): this;
once(event: "messageerror", listener: (error: Error) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "message", listener: (value: any) => void): this;
prependListener(event: "messageerror", listener: (error: Error) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "message", listener: (value: any) => void): this;
prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeListener(event: "close", listener: () => void): this;
removeListener(event: "message", listener: (value: any) => void): this;
removeListener(event: "messageerror", listener: (error: Error) => void): this;
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
off(event: "close", listener: () => void): this;
off(event: "message", listener: (value: any) => void): this;
off(event: "messageerror", listener: (error: Error) => void): this;
off(event: string | symbol, listener: (...args: any[]) => void): this;
addEventListener: EventTarget["addEventListener"];
dispatchEvent: EventTarget["dispatchEvent"];
removeEventListener: EventTarget["removeEventListener"];
}
interface WorkerOptions {
/**
* List of arguments which would be stringified and appended to
@@ -131,13 +311,6 @@ declare module "node:worker_threads" {
*/
stackSizeMb?: number | undefined;
}
interface WorkerEventMap {
"error": [err: unknown];
"exit": [exitCode: number];
"message": [value: any];
"messageerror": [error: Error];
"online": [];
}
/**
* The `Worker` class represents an independent JavaScript execution thread.
* Most Node.js APIs are available inside of it.
@@ -202,7 +375,7 @@ declare module "node:worker_threads" {
* ```
* @since v10.5.0
*/
class Worker implements EventEmitter {
class Worker extends EventEmitter {
/**
* If `stdin: true` was passed to the `Worker` constructor, this is a
* writable stream. The data written to this stream will be made available in
@@ -229,12 +402,6 @@ declare module "node:worker_threads" {
* @since v10.5.0
*/
readonly threadId: number;
/**
* A string identifier for the referenced thread or null if the thread is not running.
* Inside the worker thread, it is available as `require('node:worker_threads').threadName`.
* @since v24.6.0
*/
readonly threadName: string | null;
/**
* Provides the set of JS engine resource constraints for this Worker thread.
* If the `resourceLimits` option was passed to the `Worker` constructor,
@@ -262,6 +429,24 @@ declare module "node:worker_threads" {
* @since v10.5.0
*/
postMessage(value: any, transferList?: readonly Transferable[]): void;
/**
* Sends a value to another worker, identified by its thread ID.
* @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
* If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
* @param value The value to send.
* @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
* or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
* @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
* If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
* @since v22.5.0
*/
postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
postMessageToThread(
threadId: number,
value: any,
transferList: readonly Transferable[],
timeout?: number,
): Promise<void>;
/**
* Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does _not_ let the program exit if it's the only active handle left (the default
* behavior). If the worker is `ref()`ed, calling `ref()` again has
@@ -281,13 +466,6 @@ declare module "node:worker_threads" {
* @since v10.5.0
*/
terminate(): Promise<number>;
/**
* 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 methods allows the statistics to be observed from outside the actual thread.
* @since v24.6.0
*/
cpuUsage(prev?: NodeJS.CpuUsage): Promise<NodeJS.CpuUsage>;
/**
* Returns a readable stream for a V8 snapshot of the current state of the Worker.
* See `v8.getHeapSnapshot()` for more details.
@@ -305,81 +483,6 @@ declare module "node:worker_threads" {
* @since v24.0.0
*/
getHeapStatistics(): Promise<HeapInfo>;
/**
* Starting a CPU profile then return a Promise that fulfills with an error
* or an `CPUProfileHandle` object. This API supports `await using` syntax.
*
* ```js
* const { Worker } = require('node:worker_threads');
*
* const worker = new Worker(`
* const { parentPort } = require('worker_threads');
* parentPort.on('message', () => {});
* `, { eval: true });
*
* worker.on('online', async () => {
* const handle = await worker.startCpuProfile();
* const profile = await handle.stop();
* console.log(profile);
* worker.terminate();
* });
* ```
*
* `await using` example.
*
* ```js
* const { Worker } = require('node:worker_threads');
*
* const w = new Worker(`
* const { parentPort } = require('node:worker_threads');
* parentPort.on('message', () => {});
* `, { eval: true });
*
* w.on('online', async () => {
* // Stop profile automatically when return and profile will be discarded
* await using handle = await w.startCpuProfile();
* });
* ```
* @since v24.8.0
*/
startCpuProfile(): Promise<CPUProfileHandle>;
/**
* Starting a Heap profile then return a Promise that fulfills with an error
* or an `HeapProfileHandle` object. This API supports `await using` syntax.
*
* ```js
* const { Worker } = require('node:worker_threads');
*
* const worker = new Worker(`
* const { parentPort } = require('worker_threads');
* parentPort.on('message', () => {});
* `, { eval: true });
*
* worker.on('online', async () => {
* const handle = await worker.startHeapProfile();
* const profile = await handle.stop();
* console.log(profile);
* worker.terminate();
* });
* ```
*
* `await using` example.
*
* ```js
* const { Worker } = require('node:worker_threads');
*
* const w = new Worker(`
* const { parentPort } = require('node:worker_threads');
* parentPort.on('message', () => {});
* `, { eval: true });
*
* w.on('online', async () => {
* // Stop profile automatically when return and profile will be discarded
* await using handle = await w.startHeapProfile();
* });
* ```
*/
startHeapProfile(): Promise<HeapProfileHandle>;
/**
* Calls `worker.terminate()` when the dispose scope is exited.
*
@@ -392,8 +495,139 @@ declare module "node:worker_threads" {
* @since v24.2.0
*/
[Symbol.asyncDispose](): Promise<void>;
addListener(event: "error", listener: (err: Error) => 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: "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: "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: "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: "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: "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: "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: "exit", listener: (exitCode: number) => void): this;
off(event: "message", listener: (value: any) => void): this;
off(event: "messageerror", listener: (error: Error) => void): this;
off(event: "online", listener: () => void): this;
off(event: string | symbol, listener: (...args: any[]) => void): this;
}
interface Worker extends InternalEventEmitter<WorkerEventMap> {}
interface BroadcastChannel extends NodeJS.RefCounted {}
/**
* Instances of `BroadcastChannel` allow asynchronous one-to-many communication
* with all other `BroadcastChannel` instances bound to the same channel name.
*
* ```js
* 'use strict';
*
* import {
* isMainThread,
* BroadcastChannel,
* Worker,
* } from 'node:worker_threads';
*
* const bc = new BroadcastChannel('hello');
*
* if (isMainThread) {
* let c = 0;
* bc.onmessage = (event) => {
* console.log(event.data);
* if (++c === 10) bc.close();
* };
* for (let n = 0; n < 10; n++)
* new Worker(__filename);
* } else {
* bc.postMessage('hello from every worker');
* bc.close();
* }
* ```
* @since v15.4.0
*/
class BroadcastChannel extends EventTarget {
readonly name: string;
/**
* Invoked with a single \`MessageEvent\` argument when a message is received.
* @since v15.4.0
*/
onmessage: (message: MessageEvent) => void;
/**
* Invoked with a received message cannot be deserialized.
* @since v15.4.0
*/
onmessageerror: (message: MessageEvent) => void;
constructor(name: string);
/**
* Closes the `BroadcastChannel` connection.
* @since v15.4.0
*/
close(): void;
/**
* @since v15.4.0
* @param message Any cloneable JavaScript value.
*/
postMessage(message: unknown): void;
}
interface Lock {
readonly mode: LockMode;
readonly name: string;
}
interface LockGrantedCallback<T> {
(lock: Lock | null): T;
}
interface LockInfo {
clientId: string;
mode: LockMode;
name: string;
}
interface LockManager {
query(): Promise<LockManagerSnapshot>;
request<T>(name: string, callback: LockGrantedCallback<T>): Promise<Awaited<T>>;
request<T>(name: string, options: LockOptions, callback: LockGrantedCallback<T>): Promise<Awaited<T>>;
}
interface LockManagerSnapshot {
held: LockInfo[];
pending: LockInfo[];
}
type LockMode = "exclusive" | "shared";
interface LockOptions {
ifAvailable?: boolean;
mode?: LockMode;
signal?: AbortSignal;
steal?: boolean;
}
var locks: LockManager;
/**
* Mark an object as not transferable. If `object` occurs in the transfer list of
* a `port.postMessage()` call, it is ignored.
@@ -553,165 +787,49 @@ declare module "node:worker_threads" {
transferList: readonly Transferable[],
timeout?: number,
): Promise<void>;
// #region web types
type LockMode = "exclusive" | "shared";
type Transferable =
| ArrayBuffer
| MessagePort
| AbortSignal
| FileHandle
| ReadableStream
| WritableStream
| TransformStream;
interface LockGrantedCallback<T> {
(lock: Lock | null): T;
import {
BroadcastChannel as _BroadcastChannel,
MessageChannel as _MessageChannel,
MessagePort as _MessagePort,
} from "worker_threads";
global {
function structuredClone<T>(
value: T,
options?: { transfer?: Transferable[] },
): T;
/**
* `BroadcastChannel` class is a global reference for `import { BroadcastChannel } from 'worker_threads'`
* https://nodejs.org/api/globals.html#broadcastchannel
* @since v18.0.0
*/
var BroadcastChannel: typeof globalThis extends {
onmessage: any;
BroadcastChannel: infer T;
} ? T
: typeof _BroadcastChannel;
/**
* `MessageChannel` class is a global reference for `import { MessageChannel } from 'worker_threads'`
* https://nodejs.org/api/globals.html#messagechannel
* @since v15.0.0
*/
var MessageChannel: typeof globalThis extends {
onmessage: any;
MessageChannel: infer T;
} ? T
: typeof _MessageChannel;
/**
* `MessagePort` class is a global reference for `import { MessagePort } from 'worker_threads'`
* https://nodejs.org/api/globals.html#messageport
* @since v15.0.0
*/
var MessagePort: typeof globalThis extends {
onmessage: any;
MessagePort: infer T;
} ? T
: typeof _MessagePort;
}
interface LockInfo {
clientId: string;
mode: LockMode;
name: string;
}
interface LockManagerSnapshot {
held: LockInfo[];
pending: LockInfo[];
}
interface LockOptions {
ifAvailable?: boolean;
mode?: LockMode;
signal?: AbortSignal;
steal?: boolean;
}
interface StructuredSerializeOptions {
transfer?: Transferable[];
}
interface BroadcastChannelEventMap {
"message": MessageEvent;
"messageerror": MessageEvent;
}
interface BroadcastChannel
extends EventTarget, InternalEventTargetEventProperties<BroadcastChannelEventMap>, NodeJS.RefCounted
{
readonly name: string;
close(): void;
postMessage(message: any): void;
addEventListener<K extends keyof BroadcastChannelEventMap>(
type: K,
listener: (ev: BroadcastChannelEventMap[K]) => void,
options?: AddEventListenerOptions | boolean,
): void;
addEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: AddEventListenerOptions | boolean,
): void;
removeEventListener<K extends keyof BroadcastChannelEventMap>(
type: K,
listener: (ev: BroadcastChannelEventMap[K]) => void,
options?: EventListenerOptions | boolean,
): void;
removeEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: EventListenerOptions | boolean,
): void;
}
var BroadcastChannel: {
prototype: BroadcastChannel;
new(name: string): BroadcastChannel;
};
interface Lock {
readonly mode: LockMode;
readonly name: string;
}
// var Lock: {
// prototype: Lock;
// new(): Lock;
// };
interface LockManager {
query(): Promise<LockManagerSnapshot>;
request<T>(name: string, callback: LockGrantedCallback<T>): Promise<Awaited<T>>;
request<T>(name: string, options: LockOptions, callback: LockGrantedCallback<T>): Promise<Awaited<T>>;
}
// var LockManager: {
// prototype: LockManager;
// new(): LockManager;
// };
interface MessageChannel {
readonly port1: MessagePort;
readonly port2: MessagePort;
}
var MessageChannel: {
prototype: MessageChannel;
new(): MessageChannel;
};
interface MessagePortEventMap {
"close": Event;
"message": MessageEvent;
"messageerror": MessageEvent;
}
interface MessagePort extends NodeEventTarget, InternalEventTargetEventProperties<MessagePortEventMap> {
close(): void;
postMessage(message: any, transfer: Transferable[]): void;
postMessage(message: any, options?: StructuredSerializeOptions): void;
start(): void;
hasRef(): boolean;
ref(): void;
unref(): void;
addEventListener<K extends keyof MessagePortEventMap>(
type: K,
listener: (ev: MessagePortEventMap[K]) => void,
options?: AddEventListenerOptions | boolean,
): void;
addEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: AddEventListenerOptions | boolean,
): void;
removeEventListener<K extends keyof MessagePortEventMap>(
type: K,
listener: (ev: MessagePortEventMap[K]) => void,
options?: EventListenerOptions | boolean,
): void;
removeEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: EventListenerOptions | boolean,
): void;
// #region NodeEventTarget
addListener(event: "close", listener: (ev: Event) => void): this;
addListener(event: "message", listener: (value: any) => void): this;
addListener(event: "messageerror", listener: (error: Error) => void): this;
addListener(event: string, listener: (arg: any) => void): this;
emit(event: "close", ev: Event): boolean;
emit(event: "message", value: any): boolean;
emit(event: "messageerror", error: Error): boolean;
emit(event: string, arg: any): boolean;
off(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
off(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
off(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
off(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
on(event: "close", listener: (ev: Event) => void): this;
on(event: "message", listener: (value: any) => void): this;
on(event: "messageerror", listener: (error: Error) => void): this;
on(event: string, listener: (arg: any) => void): this;
once(event: "close", listener: (ev: Event) => void): this;
once(event: "message", listener: (value: any) => void): this;
once(event: "messageerror", listener: (error: Error) => void): this;
once(event: string, listener: (arg: any) => void): this;
removeListener(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
removeListener(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
removeListener(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
removeListener(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
// #endregion
}
var MessagePort: {
prototype: MessagePort;
new(): MessagePort;
};
var locks: LockManager;
export import structuredClone = globalThis.structuredClone;
// #endregion
}
declare module "worker_threads" {
export * from "node:worker_threads";
declare module "node:worker_threads" {
export * from "worker_threads";
}

134
node_modules/@types/node/zlib.d.ts generated vendored
View File

@@ -9,7 +9,7 @@
* ```
*
* Compression and decompression are built around the Node.js
* [Streams API](https://nodejs.org/docs/latest-v25.x/api/stream.html).
* [Streams API](https://nodejs.org/docs/latest-v24.x/api/stream.html).
*
* Compressing or decompressing a stream (such as a file) can be accomplished by
* piping the source stream through a `zlib` `Transform` stream into a destination
@@ -89,10 +89,9 @@
* });
* ```
* @since v0.5.8
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/zlib.js)
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/zlib.js)
*/
declare module "node:zlib" {
import { NonSharedBuffer } from "node:buffer";
declare module "zlib" {
import * as stream from "node:stream";
interface ZlibOptions {
/**
@@ -144,7 +143,7 @@ declare module "node:zlib" {
}
| undefined;
/**
* Limits output size when using [convenience methods](https://nodejs.org/docs/latest-v25.x/api/zlib.html#convenience-methods).
* Limits output size when using [convenience methods](https://nodejs.org/docs/latest-v24.x/api/zlib.html#convenience-methods).
* @default buffer.kMaxLength
*/
maxOutputLength?: number | undefined;
@@ -168,12 +167,12 @@ declare module "node:zlib" {
chunkSize?: number | undefined;
/**
* Key-value object containing indexed
* [Zstd parameters](https://nodejs.org/docs/latest-v25.x/api/zlib.html#zstd-constants).
* [Zstd parameters](https://nodejs.org/docs/latest-v24.x/api/zlib.html#zstd-constants).
*/
params?: { [key: number]: number | boolean } | undefined;
/**
* Limits output size when using
* [convenience methods](https://nodejs.org/docs/latest-v25.x/api/zlib.html#convenience-methods).
* [convenience methods](https://nodejs.org/docs/latest-v24.x/api/zlib.html#convenience-methods).
* @default buffer.kMaxLength
*/
maxOutputLength?: number | undefined;
@@ -181,12 +180,6 @@ declare module "node:zlib" {
* If `true`, returns an object with `buffer` and `engine`.
*/
info?: boolean | undefined;
/**
* Optional dictionary used to improve compression efficiency when compressing or decompressing data that
* shares common patterns with the dictionary.
* @since v24.6.0
*/
dictionary?: NodeJS.ArrayBufferView | undefined;
}
interface Zlib {
readonly bytesWritten: number;
@@ -228,7 +221,7 @@ declare module "node:zlib" {
* @returns A 32-bit unsigned integer containing the checksum.
* @since v22.2.0
*/
function crc32(data: string | NodeJS.ArrayBufferView, value?: number): number;
function crc32(data: string | Buffer | NodeJS.ArrayBufferView, value?: number): number;
/**
* Creates and returns a new `BrotliCompress` object.
* @since v11.7.0, v10.16.0
@@ -292,124 +285,124 @@ declare module "node:zlib" {
*/
function createZstdDecompress(options?: ZstdOptions): ZstdDecompress;
type InputType = string | ArrayBuffer | NodeJS.ArrayBufferView;
type CompressCallback = (error: Error | null, result: NonSharedBuffer) => void;
type CompressCallback = (error: Error | null, result: Buffer) => void;
/**
* @since v11.7.0, v10.16.0
*/
function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
function brotliCompress(buf: InputType, callback: CompressCallback): void;
namespace brotliCompress {
function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<NonSharedBuffer>;
function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
}
/**
* Compress a chunk of data with `BrotliCompress`.
* @since v11.7.0, v10.16.0
*/
function brotliCompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer;
function brotliCompressSync(buf: InputType, options?: BrotliOptions): Buffer;
/**
* @since v11.7.0, v10.16.0
*/
function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
function brotliDecompress(buf: InputType, callback: CompressCallback): void;
namespace brotliDecompress {
function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<NonSharedBuffer>;
function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
}
/**
* Decompress a chunk of data with `BrotliDecompress`.
* @since v11.7.0, v10.16.0
*/
function brotliDecompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer;
function brotliDecompressSync(buf: InputType, options?: BrotliOptions): Buffer;
/**
* @since v0.6.0
*/
function deflate(buf: InputType, callback: CompressCallback): void;
function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
namespace deflate {
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
}
/**
* Compress a chunk of data with `Deflate`.
* @since v0.11.12
*/
function deflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
function deflateSync(buf: InputType, options?: ZlibOptions): Buffer;
/**
* @since v0.6.0
*/
function deflateRaw(buf: InputType, callback: CompressCallback): void;
function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
namespace deflateRaw {
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
}
/**
* Compress a chunk of data with `DeflateRaw`.
* @since v0.11.12
*/
function deflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
function deflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
/**
* @since v0.6.0
*/
function gzip(buf: InputType, callback: CompressCallback): void;
function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
namespace gzip {
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
}
/**
* Compress a chunk of data with `Gzip`.
* @since v0.11.12
*/
function gzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
function gzipSync(buf: InputType, options?: ZlibOptions): Buffer;
/**
* @since v0.6.0
*/
function gunzip(buf: InputType, callback: CompressCallback): void;
function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
namespace gunzip {
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
}
/**
* Decompress a chunk of data with `Gunzip`.
* @since v0.11.12
*/
function gunzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
function gunzipSync(buf: InputType, options?: ZlibOptions): Buffer;
/**
* @since v0.6.0
*/
function inflate(buf: InputType, callback: CompressCallback): void;
function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
namespace inflate {
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
}
/**
* Decompress a chunk of data with `Inflate`.
* @since v0.11.12
*/
function inflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
function inflateSync(buf: InputType, options?: ZlibOptions): Buffer;
/**
* @since v0.6.0
*/
function inflateRaw(buf: InputType, callback: CompressCallback): void;
function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
namespace inflateRaw {
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
}
/**
* Decompress a chunk of data with `InflateRaw`.
* @since v0.11.12
*/
function inflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
function inflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
/**
* @since v0.6.0
*/
function unzip(buf: InputType, callback: CompressCallback): void;
function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
namespace unzip {
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
}
/**
* Decompress a chunk of data with `Unzip`.
* @since v0.11.12
*/
function unzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
function unzipSync(buf: InputType, options?: ZlibOptions): Buffer;
/**
* @since v22.15.0
* @experimental
@@ -417,14 +410,14 @@ declare module "node:zlib" {
function zstdCompress(buf: InputType, callback: CompressCallback): void;
function zstdCompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
namespace zstdCompress {
function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<NonSharedBuffer>;
function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<Buffer>;
}
/**
* Compress a chunk of data with `ZstdCompress`.
* @since v22.15.0
* @experimental
*/
function zstdCompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer;
function zstdCompressSync(buf: InputType, options?: ZstdOptions): Buffer;
/**
* @since v22.15.0
* @experimental
@@ -432,14 +425,14 @@ declare module "node:zlib" {
function zstdDecompress(buf: InputType, callback: CompressCallback): void;
function zstdDecompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
namespace zstdDecompress {
function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<NonSharedBuffer>;
function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<Buffer>;
}
/**
* Decompress a chunk of data with `ZstdDecompress`.
* @since v22.15.0
* @experimental
*/
function zstdDecompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer;
function zstdDecompressSync(buf: InputType, options?: ZstdOptions): Buffer;
namespace constants {
const BROTLI_DECODE: number;
const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number;
@@ -612,7 +605,70 @@ declare module "node:zlib" {
const Z_SYNC_FLUSH: number;
const Z_VERSION_ERROR: number;
}
// Allowed flush values.
/** @deprecated Use `constants.Z_NO_FLUSH` */
const Z_NO_FLUSH: number;
/** @deprecated Use `constants.Z_PARTIAL_FLUSH` */
const Z_PARTIAL_FLUSH: number;
/** @deprecated Use `constants.Z_SYNC_FLUSH` */
const Z_SYNC_FLUSH: number;
/** @deprecated Use `constants.Z_FULL_FLUSH` */
const Z_FULL_FLUSH: number;
/** @deprecated Use `constants.Z_FINISH` */
const Z_FINISH: number;
/** @deprecated Use `constants.Z_BLOCK` */
const Z_BLOCK: number;
// Return codes for the compression/decompression functions.
// Negative values are errors, positive values are used for special but normal events.
/** @deprecated Use `constants.Z_OK` */
const Z_OK: number;
/** @deprecated Use `constants.Z_STREAM_END` */
const Z_STREAM_END: number;
/** @deprecated Use `constants.Z_NEED_DICT` */
const Z_NEED_DICT: number;
/** @deprecated Use `constants.Z_ERRNO` */
const Z_ERRNO: number;
/** @deprecated Use `constants.Z_STREAM_ERROR` */
const Z_STREAM_ERROR: number;
/** @deprecated Use `constants.Z_DATA_ERROR` */
const Z_DATA_ERROR: number;
/** @deprecated Use `constants.Z_MEM_ERROR` */
const Z_MEM_ERROR: number;
/** @deprecated Use `constants.Z_BUF_ERROR` */
const Z_BUF_ERROR: number;
/** @deprecated Use `constants.Z_VERSION_ERROR` */
const Z_VERSION_ERROR: number;
// Compression levels.
/** @deprecated Use `constants.Z_NO_COMPRESSION` */
const Z_NO_COMPRESSION: number;
/** @deprecated Use `constants.Z_BEST_SPEED` */
const Z_BEST_SPEED: number;
/** @deprecated Use `constants.Z_BEST_COMPRESSION` */
const Z_BEST_COMPRESSION: number;
/** @deprecated Use `constants.Z_DEFAULT_COMPRESSION` */
const Z_DEFAULT_COMPRESSION: number;
// Compression strategy.
/** @deprecated Use `constants.Z_FILTERED` */
const Z_FILTERED: number;
/** @deprecated Use `constants.Z_HUFFMAN_ONLY` */
const Z_HUFFMAN_ONLY: number;
/** @deprecated Use `constants.Z_RLE` */
const Z_RLE: number;
/** @deprecated Use `constants.Z_FIXED` */
const Z_FIXED: number;
/** @deprecated Use `constants.Z_DEFAULT_STRATEGY` */
const Z_DEFAULT_STRATEGY: number;
/** @deprecated */
const Z_BINARY: number;
/** @deprecated */
const Z_TEXT: number;
/** @deprecated */
const Z_ASCII: number;
/** @deprecated */
const Z_UNKNOWN: number;
/** @deprecated */
const Z_DEFLATED: number;
}
declare module "zlib" {
export * from "node:zlib";
declare module "node:zlib" {
export * from "zlib";
}