Socket
Socket
Sign inDemoInstall

@types/node

Package Overview
Dependencies
Maintainers
1
Versions
1920
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/node - npm Package Compare versions

Comparing version 16.11.12 to 20.10.0

node/dom-events.d.ts

286

node/assert.d.ts
/**
* The `assert` module provides a set of assertion functions for verifying
* The `node:assert` module provides a set of assertion functions for verifying
* invariants.
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/assert.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/assert.js)
*/
declare module 'assert' {
declare module "assert" {
/**

@@ -15,11 +15,25 @@ * An alias of {@link ok}.

/**
* Indicates the failure of an assertion. All errors thrown by the `assert` module
* will be instances of the `AssertionError` class.
* 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 {
/**
* Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
*/
actual: unknown;
/**
* 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.
*/
generatedMessage: boolean;
code: 'ERR_ASSERTION';
/**
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
*/
code: "ERR_ASSERTION";
constructor(options?: {

@@ -35,3 +49,3 @@ /** If provided, the error message is set to this value. */

/** If provided, the generated stack trace omits frames before this function. */
// tslint:disable-next-line:ban-types
// eslint-disable-next-line @typescript-eslint/ban-types
stackStartFn?: Function | undefined;

@@ -41,5 +55,6 @@ });

/**
* This feature is currently experimental and behavior might still change.
* 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
* @experimental
* @deprecated Deprecated
*/

@@ -53,3 +68,3 @@ class CallTracker {

* ```js
* import assert from 'assert';
* import assert from 'node:assert';
*

@@ -73,2 +88,22 @@ * // Creates call tracker.

/**
* 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
* @param fn
* @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

@@ -78,3 +113,3 @@ * the functions that have not been called the expected number of times.

* ```js
* import assert from 'assert';
* import assert from 'node:assert';
*

@@ -86,4 +121,2 @@ * // Creates call tracker.

*
* function foo() {}
*
* // Returns a function that wraps func() that must be called exact times

@@ -94,3 +127,3 @@ * // before tracker.verify().

* // Returns an array containing information on callsfunc()
* tracker.report();
* console.log(tracker.report());
* // [

@@ -108,6 +141,30 @@ * // {

* @since v14.2.0, v12.19.0
* @return of objects containing information about the wrapper functions returned by `calls`.
* @return An Array of objects containing information about the wrapper functions returned by `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 `tracker.calls()` and will throw an error for functions that

@@ -117,3 +174,3 @@ * have not been called the expected number of times.

* ```js
* import assert from 'assert';
* import assert from 'node:assert';
*

@@ -138,2 +195,6 @@ * // Creates call tracker.

}
interface CallTrackerCall {
thisArg: object;
arguments: unknown[];
}
interface CallTrackerReportInformation {

@@ -150,3 +211,3 @@ message: string;

}
type AssertPredicate = RegExp | (new () => object) | ((thrown: unknown) => boolean) | object | Error;
type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error;
/**

@@ -158,3 +219,3 @@ * Throws an `AssertionError` with the provided error message or a default

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -183,4 +244,4 @@ * assert.fail();

operator?: string,
// tslint:disable-next-line:ban-types
stackStartFn?: Function
// eslint-disable-next-line @typescript-eslint/ban-types
stackStartFn?: Function,
): never;

@@ -198,3 +259,3 @@ /**

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -234,3 +295,3 @@ * assert.ok(true);

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -256,7 +317,7 @@ * // Using `assert()` works the same:

* Tests shallow, coercive equality between the `actual` and `expected` parameters
* using the [Abstract Equality Comparison](https://tc39.github.io/ecma262/#sec-abstract-equality-comparison) ( `==` ). `NaN` is special handled
* and treated as being identical in case both sides are `NaN`.
* using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled
* and treated as being identical if both sides are `NaN`.
*
* ```js
* import assert from 'assert';
* import assert from 'node:assert';
*

@@ -290,8 +351,7 @@ * assert.equal(1, 1);

*
* Tests shallow, coercive inequality with the [Abstract Equality Comparison](https://tc39.github.io/ecma262/#sec-abstract-equality-comparison)(`!=` ). `NaN` is special handled and treated as
* being identical in case both
* sides are `NaN`.
* Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is
* specially handled and treated as being identical if both sides are `NaN`.
*
* ```js
* import assert from 'assert';
* import assert from 'node:assert';
*

@@ -343,20 +403,20 @@ * assert.notEqual(1, 2);

* ```js
* import assert from 'assert';
* import assert from 'node:assert';
*
* const obj1 = {
* a: {
* b: 1
* }
* b: 1,
* },
* };
* const obj2 = {
* a: {
* b: 2
* }
* b: 2,
* },
* };
* const obj3 = {
* a: {
* b: 1
* }
* b: 1,
* },
* };
* const obj4 = Object.create(obj1);
* const obj4 = { __proto__: obj1 };
*

@@ -384,6 +444,6 @@ * assert.notDeepEqual(obj1, obj1);

* Tests strict equality between the `actual` and `expected` parameters as
* determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -423,6 +483,6 @@ * assert.strictEqual(1, 2);

* Tests strict inequality between the `actual` and `expected` parameters as
* determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
*
* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -458,3 +518,3 @@ * assert.notStrictEqual(1, 2);

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -490,3 +550,3 @@ * assert.notDeepStrictEqual({ a: 1 }, { a: '1' });

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -498,3 +558,3 @@ * const err = new TypeError('Wrong value');

* nested: true,
* baz: 'text'
* baz: 'text',
* };

@@ -512,12 +572,12 @@ * err.reg = /abc/i;

* nested: true,
* baz: 'text'
* }
* baz: 'text',
* },
* // Only properties on the validation object will be tested for.
* // Using nested objects requires all properties to be present. Otherwise
* // the validation is going to fail.
* }
* },
* );
*
* // Using regular expressions to validate error properties:
* throws(
* assert.throws(
* () => {

@@ -536,3 +596,3 @@ * throw err;

* // It is not possible to use regular expressions for nested properties!
* baz: 'text'
* baz: 'text',
* },

@@ -542,8 +602,8 @@ * // The `reg` property contains a regular expression and only if the

* // to pass.
* reg: /abc/i
* }
* reg: /abc/i,
* },
* );
*
* // Fails due to the different `message` and `name` properties:
* throws(
* assert.throws(
* () => {

@@ -559,3 +619,3 @@ * const otherErr = new Error('Not found');

* // an error as validation object.
* err
* err,
* );

@@ -567,3 +627,3 @@ * ```

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -574,3 +634,3 @@ * assert.throws(

* },
* Error
* Error,
* );

@@ -585,3 +645,3 @@ * ```

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -592,3 +652,3 @@ * assert.throws(

* },
* /^Error: Wrong value$/
* /^Error: Wrong value$/,
* );

@@ -603,3 +663,3 @@ * ```

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -620,3 +680,3 @@ * assert.throws(

* },
* 'unexpected error'
* 'unexpected error',
* );

@@ -631,3 +691,3 @@ * ```

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -688,3 +748,3 @@ * function throwingFirst() {

* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
* function. See {@link throws} for more details.

@@ -696,3 +756,3 @@ *

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -703,3 +763,3 @@ * assert.doesNotThrow(

* },
* SyntaxError
* SyntaxError,
* );

@@ -712,3 +772,3 @@ * ```

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -719,3 +779,3 @@ * assert.doesNotThrow(

* },
* TypeError
* TypeError,
* );

@@ -727,3 +787,3 @@ * ```

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -735,3 +795,3 @@ * assert.doesNotThrow(

* /Wrong value/,
* 'Whoops'
* 'Whoops',
* );

@@ -750,3 +810,3 @@ * // Throws: AssertionError: Got unwanted exception: Whoops

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -797,3 +857,3 @@ * assert.ifError(null);

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -806,4 +866,4 @@ * await assert.rejects(

* name: 'TypeError',
* message: 'Wrong value'
* }
* message: 'Wrong value',
* },
* );

@@ -813,3 +873,3 @@ * ```

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -824,3 +884,3 @@ * await assert.rejects(

* return true;
* }
* },
* );

@@ -830,7 +890,7 @@ * ```

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*
* assert.rejects(
* Promise.reject(new Error('Wrong value')),
* Error
* Error,
* ).then(() => {

@@ -848,3 +908,7 @@ * // ...

function rejects(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
function rejects(block: (() => Promise<unknown>) | Promise<unknown>, error: AssertPredicate, message?: string | Error): Promise<void>;
function rejects(
block: (() => Promise<unknown>) | Promise<unknown>,
error: AssertPredicate,
message?: string | Error,
): Promise<void>;
/**

@@ -866,3 +930,3 @@ * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately

* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
* function. See {@link throws} for more details.

@@ -873,3 +937,3 @@ *

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -880,3 +944,3 @@ * await assert.doesNotReject(

* },
* SyntaxError
* SyntaxError,
* );

@@ -886,3 +950,3 @@ * ```

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -896,4 +960,11 @@ * assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))

*/
function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, error: AssertPredicate, message?: string | Error): Promise<void>;
function doesNotReject(
block: (() => Promise<unknown>) | Promise<unknown>,
message?: string | Error,
): Promise<void>;
function doesNotReject(
block: (() => Promise<unknown>) | Promise<unknown>,
error: AssertPredicate,
message?: string | Error,
): Promise<void>;
/**

@@ -903,3 +974,3 @@ * Expects the `string` input to match the regular expression.

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -927,3 +998,3 @@ * assert.match('I will fail', /pass/);

* ```js
* import assert from 'assert/strict';
* import assert from 'node:assert/strict';
*

@@ -947,23 +1018,36 @@ * assert.doesNotMatch('I will fail', /fail/);

function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
const strict: Omit<typeof assert, 'equal' | 'notEqual' | 'deepEqual' | 'notDeepEqual' | 'ok' | 'strictEqual' | 'deepStrictEqual' | 'ifError' | 'strict'> & {
(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;
};
const strict:
& Omit<
typeof assert,
| "equal"
| "notEqual"
| "deepEqual"
| "notDeepEqual"
| "ok"
| "strictEqual"
| "deepStrictEqual"
| "ifError"
| "strict"
>
& {
(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;
};
}
export = assert;
}
declare module 'node:assert' {
import assert = require('assert');
declare module "node:assert" {
import assert = require("assert");
export = assert;
}

@@ -1,8 +0,8 @@

declare module 'assert/strict' {
import { strict } from 'node:assert';
declare module "assert/strict" {
import { strict } from "node:assert";
export = strict;
}
declare module 'node:assert/strict' {
import { strict } from 'node:assert';
declare module "node:assert/strict" {
import { strict } from "node:assert";
export = strict;
}
/**
* The `async_hooks` module provides an API to track asynchronous resources. It
* can be accessed using:
* We strongly discourage the use of the `async_hooks` API.
* Other APIs that can cover most of its use cases include:
*
* * `AsyncLocalStorage` tracks async context
* * `process.getActiveResourcesInfo()` tracks active resources
*
* The `node:async_hooks` module provides an API to track asynchronous resources.
* It can be accessed using:
*
* ```js
* import async_hooks from 'async_hooks';
* import async_hooks from 'node:async_hooks';
* ```
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/async_hooks.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/async_hooks.js)
*/
declare module 'async_hooks' {
declare module "async_hooks" {
/**
* ```js
* import { executionAsyncId } from 'async_hooks';
* import { executionAsyncId } from 'node:async_hooks';
* import fs from 'node:fs';
*
* console.log(executionAsyncId()); // 1 - bootstrap
* const path = '.';
* fs.open(path, 'r', (err, fd) => {

@@ -54,4 +62,4 @@ * console.log(executionAsyncId()); // 6 - open()

* ```js
* import { open } from 'fs';
* import { executionAsyncId, executionAsyncResource } from 'async_hooks';
* import { open } from 'node:fs';
* import { executionAsyncId, executionAsyncResource } from 'node:async_hooks';
*

@@ -68,7 +76,7 @@ * console.log(executionAsyncId(), executionAsyncResource()); // 1 {}

* ```js
* import { createServer } from 'http';
* import { createServer } from 'node:http';
* import {
* executionAsyncId,
* executionAsyncResource,
* createHook
* createHook,
* } from 'async_hooks';

@@ -83,3 +91,3 @@ * const sym = Symbol('state'); // Private symbol to avoid pollution

* }
* }
* },
* }).enable();

@@ -173,7 +181,7 @@ *

* ```js
* import { createHook } from 'async_hooks';
* import { createHook } from 'node:async_hooks';
*
* const asyncHook = createHook({
* init(asyncId, type, triggerAsyncId, resource) { },
* destroy(asyncId) { }
* destroy(asyncId) { },
* });

@@ -230,3 +238,3 @@ * ```

* ```js
* import { AsyncResource, executionAsyncId } from 'async_hooks';
* import { AsyncResource, executionAsyncId } from 'node:async_hooks';
*

@@ -237,3 +245,3 @@ * // AsyncResource() is meant to be extended. Instantiating a

* const asyncResource = new AsyncResource(
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false },
* );

@@ -267,3 +275,3 @@ *

* this async event (default: `executionAsyncId()`), or an
* AsyncResourceOptions object (since 9.3)
* AsyncResourceOptions object (since v9.3.0)
*/

@@ -273,5 +281,2 @@ constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);

* Binds the given function to the current execution context.
*
* The returned function will have an `asyncResource` property referencing
* the `AsyncResource` to which the function is bound.
* @since v14.8.0, v12.19.0

@@ -284,19 +289,10 @@ * @param fn The function to bind to the current execution context.

type?: string,
thisArg?: ThisArg
): Func & {
asyncResource: AsyncResource;
};
thisArg?: ThisArg,
): Func;
/**
* Binds the given function to execute to this `AsyncResource`'s scope.
*
* The returned function will have an `asyncResource` property referencing
* the `AsyncResource` to which the function is bound.
* @since v14.8.0, v12.19.0
* @param fn The function to bind to the current `AsyncResource`.
*/
bind<Func extends (...args: any[]) => any>(
fn: Func
): Func & {
asyncResource: AsyncResource;
};
bind<Func extends (...args: any[]) => any>(fn: Func): Func;
/**

@@ -312,3 +308,7 @@ * Call the provided function with the provided arguments in the execution context

*/
runInAsyncScope<This, Result>(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result;
runInAsyncScope<This, Result>(
fn: (this: This, ...args: any[]) => Result,
thisArg?: This,
...args: any[]
): Result;
/**

@@ -327,3 +327,2 @@ * Call all `destroy` hooks. This should only ever be called once. An error will

/**
*
* @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.

@@ -336,5 +335,5 @@ */

*
* While you can create your own implementation on top of the `async_hooks` module,`AsyncLocalStorage` should be preferred as it is a performant and memory safe
* implementation that involves significant optimizations that are non-obvious to
* implement.
* While you can create your own implementation on top of the `node:async_hooks`module, `AsyncLocalStorage` should be preferred as it is a performant and memory
* safe implementation that involves significant optimizations that are non-obvious
* to implement.
*

@@ -346,4 +345,4 @@ * The following example uses `AsyncLocalStorage` to build a simple logger

* ```js
* import http from 'http';
* import { AsyncLocalStorage } from 'async_hooks';
* import http from 'node:http';
* import { AsyncLocalStorage } from 'node:async_hooks';
*

@@ -380,3 +379,3 @@ * const asyncLocalStorage = new AsyncLocalStorage();

* Multiple instances can safely exist simultaneously without risk of interfering
* with each other data.
* with each other's data.
* @since v13.10.0, v12.17.0

@@ -386,2 +385,40 @@ */

/**
* Binds the given function to the current execution context.
* @since v19.8.0
* @experimental
* @param fn The function to bind to the current execution context.
* @return A new function that calls `fn` within the captured execution context.
*/
static bind<Func extends (...args: any[]) => any>(fn: Func): Func;
/**
* Captures the current execution context and returns a function that accepts a
* function as an argument. Whenever the returned function is called, it
* calls the function passed to it within the captured context.
*
* ```js
* const asyncLocalStorage = new AsyncLocalStorage();
* const runInAsyncScope = asyncLocalStorage.run(123, () => AsyncLocalStorage.snapshot());
* const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore()));
* console.log(result); // returns 123
* ```
*
* AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple
* async context tracking purposes, for example:
*
* ```js
* class Foo {
* #runInAsyncScope = AsyncLocalStorage.snapshot();
*
* get() { return this.#runInAsyncScope(() => asyncLocalStorage.getStore()); }
* }
*
* const foo = asyncLocalStorage.run(123, () => new Foo());
* console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123
* ```
* @since v19.8.0
* @experimental
* @return A new function with the signature `(fn: (...args) : R, ...args) : R`.
*/
static snapshot(): <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
/**
* Disables the instance of `AsyncLocalStorage`. All subsequent calls

@@ -413,4 +450,5 @@ * to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.

* Runs a function synchronously within a context and returns its
* return value. The store is not accessible outside of the callback function or
* the asynchronous operations created within the callback.
* return value. The store is not accessible outside of the callback function.
* The store is accessible to any asynchronous operations created within the
* callback.
*

@@ -429,2 +467,5 @@ * The optional `args` are passed to the callback function.

* asyncLocalStorage.getStore(); // Returns the store object
* setTimeout(() => {
* asyncLocalStorage.getStore(); // Returns the store object
* }, 200);
* throw new Error();

@@ -439,2 +480,3 @@ * });

*/
run<R>(store: T, callback: () => R): R;
run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;

@@ -513,4 +555,4 @@ /**

}
declare module 'node:async_hooks' {
export * from 'async_hooks';
declare module "node:async_hooks" {
export * from "async_hooks";
}
/**
* A single instance of Node.js runs in a single thread. To take advantage of
* multi-core systems, the user will sometimes want to launch a cluster of Node.js
* processes to handle the load.
* 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` module instead, which
* allows running multiple application threads within a single Node.js instance.
*

@@ -10,8 +11,8 @@ * The cluster module allows easy creation of child processes that all share

* ```js
* import cluster from 'cluster';
* import http from 'http';
* import { cpus } from 'os';
* import process from 'process';
* import cluster from 'node:cluster';
* import http from 'node:http';
* import { availableParallelism } from 'node:os';
* import process from 'node:process';
*
* const numCPUs = cpus().length;
* const numCPUs = availableParallelism();
*

@@ -53,8 +54,9 @@ * if (cluster.isPrimary) {

* 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/v16.9.0/lib/cluster.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/cluster.js)
*/
declare module 'cluster' {
import * as child from 'node:child_process';
import EventEmitter = require('node:events');
import * as net from 'node:net';
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 {

@@ -69,2 +71,5 @@ execArgv?: string[] | undefined; // default: process.execArgv

inspectPort?: number | (() => number) | undefined;
serialization?: SerializationType | undefined;
cwd?: string | undefined;
windowsHide?: boolean | undefined;
}

@@ -74,3 +79,3 @@ export interface Address {

port: number;
addressType: number | 'udp4' | 'udp6'; // 4, 6, -1, "udp4", "udp6"
addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6"
}

@@ -106,5 +111,5 @@ /**

*
* In the primary this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
* In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
*
* In a worker this sends a message to the primary. It is identical to`process.send()`.
* In a worker, this sends a message to the primary. It is identical to`process.send()`.
*

@@ -128,19 +133,22 @@ * This example will echo back all messages from the primary:

send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
send(message: child.Serializable, sendHandle: child.SendHandle, callback?: (error: Error | null) => void): boolean;
send(message: child.Serializable, sendHandle: child.SendHandle, options?: child.MessageOptions, callback?: (error: Error | null) => void): boolean;
send(
message: child.Serializable,
sendHandle: child.SendHandle,
callback?: (error: Error | null) => void,
): boolean;
send(
message: child.Serializable,
sendHandle: child.SendHandle,
options?: child.MessageOptions,
callback?: (error: Error | null) => void,
): boolean;
/**
* This function will kill the worker. In the primary, it does this
* by disconnecting the `worker.process`, and once disconnected, killing
* with `signal`. In the worker, it does it by disconnecting the channel,
* and then exiting with code `0`.
* This function will kill the worker. In the primary worker, it does this by
* disconnecting the `worker.process`, and once disconnected, killing with`signal`. In the worker, it does it by killing the process with `signal`.
*
* Because `kill()` attempts to gracefully disconnect the worker process, it is
* susceptible to waiting indefinitely for the disconnect to complete. For example,
* if the worker enters an infinite loop, a graceful disconnect will never occur.
* If the graceful disconnect behavior is not needed, use `worker.process.kill()`.
* The `kill()` function kills the worker process without waiting for a graceful
* disconnect, it has the same behavior as `worker.process.kill()`.
*
* Causes `.exitedAfterDisconnect` to be set.
* This method is aliased as `worker.destroy()` for backwards compatibility.
*
* This method is aliased as `worker.destroy()` for backward compatibility.
*
* In a worker, `process.kill()` exists, but it is not this function;

@@ -197,3 +205,3 @@ * it is `kill()`.

* } else if (cluster.isWorker) {
* const net = require('net');
* const net = require('node:net');
* const server = net.createServer((socket) => {

@@ -228,8 +236,8 @@ * // Connections never end

* ```js
* import cluster from 'cluster';
* import http from 'http';
* import { cpus } from 'os';
* import process from 'process';
* import cluster from 'node:cluster';
* import http from 'node:http';
* import { availableParallelism } from 'node:os';
* import process from 'node:process';
*
* const numCPUs = cpus().length;
* const numCPUs = availableParallelism();
*

@@ -264,3 +272,4 @@ * if (cluster.isPrimary) {

/**
* This property is `true` if the worker exited due to `.kill()` or`.disconnect()`. If the worker exited any other way, it is `false`. If the
* This property is `true` if the worker exited due to `.disconnect()`.
* If the worker exited any other way, it is `false`. If the
* worker has not exited, it is `undefined`.

@@ -295,43 +304,43 @@ *

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;
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;
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;
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;
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;
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;
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;
}

@@ -368,51 +377,60 @@ export interface Cluster extends EventEmitter {

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;
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;
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;
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;
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;
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;
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;
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;
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;
}

@@ -422,5 +440,5 @@ const cluster: Cluster;

}
declare module 'node:cluster' {
export * from 'cluster';
export { default as default } from 'cluster';
declare module "node:cluster" {
export * from "cluster";
export { default as default } from "cluster";
}
/**
* The `console` module provides a simple debugging console that is similar to the
* JavaScript console mechanism provided by web browsers.
* The `node: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` and `process.stderr`. The global `console` can be used without calling`require('console')`.
* * 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` and `process.stderr`. The global `console` can be used without calling`require('node:console')`.
*

@@ -56,10 +56,10 @@ * _**Warning**_: The global console object's methods are neither consistently

* ```
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/console.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/console.js)
*/
declare module 'console' {
import console = require('node:console');
declare module "console" {
import console = require("node:console");
export = console;
}
declare module 'node:console' {
import { InspectOptions } from 'node:util';
declare module "node:console" {
import { InspectOptions } from "node:util";
global {

@@ -127,3 +127,3 @@ // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build

* @since v8.3.0
* @param label The display label for the counter.
* @param [label='default'] The display label for the counter.
*/

@@ -146,3 +146,3 @@ count(label?: string): void;

* @since v8.3.0
* @param label The display label for the counter.
* @param [label='default'] The display label for the counter.
*/

@@ -227,3 +227,3 @@ countReset(label?: string): 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.
* logging the argument if it can't be parsed as tabular.
*

@@ -257,3 +257,3 @@ * ```js

*/
table(tabularData: any, properties?: ReadonlyArray<string>): void;
table(tabularData: any, properties?: readonly string[]): void;
/**

@@ -265,2 +265,3 @@ * Starts a timer that can be used to compute the duration of an operation. Timers

* @since v0.1.104
* @param [label='default']
*/

@@ -273,8 +274,9 @@ time(label?: string): void;

* ```js
* console.time('100-elements');
* for (let i = 0; i < 100; i++) {}
* console.timeEnd('100-elements');
* // prints 100-elements: 225.438ms
* 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']
*/

@@ -295,2 +297,3 @@ timeEnd(label?: string): void;

* @since v10.7.0
* @param [label='default']
*/

@@ -403,3 +406,3 @@ timeLog(label?: string, ...data: any[]): void;

ignoreErrors?: boolean | undefined;
colorMode?: boolean | 'auto' | undefined;
colorMode?: boolean | "auto" | undefined;
inspectOptions?: InspectOptions | undefined;

@@ -414,4 +417,4 @@ /**

prototype: Console;
new (stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
new (options: ConsoleConstructorOptions): Console;
new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
new(options: ConsoleConstructorOptions): Console;
}

@@ -418,0 +421,0 @@ }

/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
declare module 'constants' {
import { constants as osConstants, SignalConstants } from 'node:os';
import { constants as cryptoConstants } from 'node:crypto';
import { constants as fsConstants } from 'node:fs';
declare module "constants" {
import { constants as osConstants, SignalConstants } from "node:os";
import { constants as cryptoConstants } from "node:crypto";
import { constants as fsConstants } from "node:fs";
const exp: typeof osConstants.errno &
typeof osConstants.priority &
SignalConstants &
typeof cryptoConstants &
typeof fsConstants;
const exp:
& typeof osConstants.errno
& typeof osConstants.priority
& SignalConstants
& typeof cryptoConstants
& typeof fsConstants;
export = exp;
}
declare module 'node:constants' {
import constants = require('constants');
declare module "node:constants" {
import constants = require("constants");
export = constants;
}
/**
* The `dgram` module provides an implementation of UDP datagram sockets.
* The `node:dgram` module provides an implementation of UDP datagram sockets.
*
* ```js
* import dgram from 'dgram';
* import dgram from 'node:dgram';
*

@@ -10,3 +10,3 @@ * const server = dgram.createSocket('udp4');

* server.on('error', (err) => {
* console.log(`server error:\n${err.stack}`);
* console.error(`server error:\n${err.stack}`);
* server.close();

@@ -27,11 +27,11 @@ * });

* ```
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/dgram.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dgram.js)
*/
declare module 'dgram' {
import { AddressInfo } from 'node:net';
import * as dns from 'node:dns';
import { EventEmitter, Abortable } from 'node:events';
declare module "dgram" {
import { AddressInfo } from "node:net";
import * as dns from "node:dns";
import { Abortable, EventEmitter } from "node:events";
interface RemoteInfo {
address: string;
family: 'IPv4' | 'IPv6';
family: "IPv4" | "IPv6";
port: number;

@@ -46,3 +46,3 @@ size: number;

}
type SocketType = 'udp4' | 'udp6';
type SocketType = "udp4" | "udp6";
interface SocketOptions extends Abortable {

@@ -57,3 +57,9 @@ type: SocketType;

sendBufferSize?: number | undefined;
lookup?: ((hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void) | undefined;
lookup?:
| ((
hostname: string,
options: dns.LookupOneOptions,
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
) => void)
| undefined;
}

@@ -105,4 +111,4 @@ /**

* ```js
* import cluster from 'cluster';
* import dgram from 'dgram';
* import cluster from 'node:cluster';
* import dgram from 'node:dgram';
*

@@ -124,3 +130,3 @@ * if (cluster.isPrimary) {

* Returns an object containing the address information for a socket.
* For UDP sockets, this object will contain `address`, `family` and `port`properties.
* For UDP sockets, this object will contain `address`, `family`, and `port`properties.
*

@@ -151,3 +157,3 @@ * This method throws `EBADF` if called on an unbound socket.

* ```js
* import dgram from 'dgram';
* import dgram from 'node:dgram';
*

@@ -157,3 +163,3 @@ * const server = dgram.createSocket('udp4');

* server.on('error', (err) => {
* console.log(`server error:\n${err.stack}`);
* console.error(`server error:\n${err.stack}`);
* server.close();

@@ -271,3 +277,3 @@ * });

* DNS will be used to resolve the address of the host. If `address` is not
* provided or otherwise falsy, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default.
* provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default.
*

@@ -296,4 +302,4 @@ * If the socket has not been previously bound with a call to `bind`, the socket

* ```js
* import dgram from 'dgram';
* import { Buffer } from 'buffer';
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
*

@@ -310,4 +316,4 @@ * const message = Buffer.from('Some bytes');

* ```js
* import dgram from 'dgram';
* import { Buffer } from 'buffer';
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
*

@@ -330,4 +336,4 @@ * const buf1 = Buffer.from('Some ');

* ```js
* import dgram from 'dgram';
* import { Buffer } from 'buffer';
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
*

@@ -350,8 +356,38 @@ * const message = Buffer.from('Some bytes');

*/
send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
send(msg: string | Uint8Array | ReadonlyArray<any>, callback?: (error: Error | null, bytes: number) => void): void;
send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void;
send(
msg: string | Uint8Array | readonly any[],
port?: number,
address?: string,
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | Uint8Array | readonly any[],
port?: number,
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | Uint8Array | readonly any[],
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | Uint8Array,
offset: number,
length: number,
port?: number,
address?: string,
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | Uint8Array,
offset: number,
length: number,
port?: number,
callback?: (error: Error | null, bytes: number) => void,
): void;
send(
msg: string | Uint8Array,
offset: number,
length: number,
callback?: (error: Error | null, bytes: number) => void,
): void;
/**

@@ -467,3 +503,3 @@ * Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP

*
* The `ttl` argument may be between between 1 and 255\. The default on most systems
* The `ttl` argument may be between 1 and 255\. The default on most systems
* is 64.

@@ -482,3 +518,3 @@ *

*
* Calling `socket.unref()` multiple times will have no addition effect.
* Calling `socket.unref()` multiple times will have no additional effect.
*

@@ -521,41 +557,46 @@ * The `socket.unref()` method returns a reference to the socket so calls can be

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;
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;
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;
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;
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;
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;
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>;
}
}
declare module 'node:dgram' {
export * from 'dgram';
declare module "node:dgram" {
export * from "dgram";
}
/**
* The `diagnostics_channel` module provides an API to create named channels
* The `node:diagnostics_channel` module provides an API to create named channels
* to report arbitrary message data for diagnostics purposes.

@@ -8,3 +8,3 @@ *

* ```js
* import diagnostics_channel from 'diagnostics_channel';
* import diagnostics_channel from 'node:diagnostics_channel';
* ```

@@ -23,6 +23,6 @@ *

* other modules.
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/diagnostics_channel.js)
* @since v15.1.0, v14.17.0
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/diagnostics_channel.js)
*/
declare module 'diagnostics_channel' {
declare module "diagnostics_channel" {
/**

@@ -36,3 +36,3 @@ * Check if there are active subscribers to the named channel. This is helpful if

* ```js
* import diagnostics_channel from 'diagnostics_channel';
* import diagnostics_channel from 'node:diagnostics_channel';
*

@@ -47,5 +47,5 @@ * if (diagnostics_channel.hasSubscribers('my-channel')) {

*/
function hasSubscribers(name: string): boolean;
function hasSubscribers(name: string | symbol): boolean;
/**
* This is the primary entry-point for anyone wanting to interact with a named
* This is the primary entry-point for anyone wanting to publish to a named
* channel. It produces a channel object which is optimized to reduce overhead at

@@ -55,3 +55,3 @@ * publish time as much as possible.

* ```js
* import diagnostics_channel from 'diagnostics_channel';
* import diagnostics_channel from 'node:diagnostics_channel';
*

@@ -64,7 +64,44 @@ * const channel = diagnostics_channel.channel('my-channel');

*/
function channel(name: string): Channel;
type ChannelListener = (name: string, message: unknown) => void;
function channel(name: string | symbol): Channel;
type ChannelListener = (message: unknown, name: string | symbol) => void;
/**
* Register a message handler to subscribe to this channel. This message handler
* will be run synchronously whenever a message is published to the channel. Any
* errors thrown in the message handler will trigger an `'uncaughtException'`.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* diagnostics_channel.subscribe('my-channel', (message, name) => {
* // Received data
* });
* ```
* @since v18.7.0, v16.17.0
* @param name The channel name
* @param onMessage The handler to receive channel messages
*/
function subscribe(name: string | symbol, onMessage: ChannelListener): void;
/**
* Remove a message handler previously registered to this channel with {@link subscribe}.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* function onMessage(message, name) {
* // Received data
* }
*
* diagnostics_channel.subscribe('my-channel', onMessage);
*
* diagnostics_channel.unsubscribe('my-channel', onMessage);
* ```
* @since v18.7.0, v16.17.0
* @param name The channel name
* @param onMessage The previous subscribed handler to remove
* @return `true` if the handler was found, `false` otherwise.
*/
function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean;
/**
* The class `Channel` represents an individual named channel within the data
* pipeline. It is use to track subscribers and to publish messages when there
* pipeline. It is used to track subscribers and to publish messages when there
* are subscribers present. It exists as a separate object to avoid channel

@@ -77,3 +114,3 @@ * lookups at publish time, enabling very fast publish speeds and allowing

class Channel {
readonly name: string;
readonly name: string | symbol;
/**

@@ -87,3 +124,3 @@ * Check if there are active subscribers to this channel. This is helpful if

* ```js
* import diagnostics_channel from 'diagnostics_channel';
* import diagnostics_channel from 'node:diagnostics_channel';
*

@@ -99,4 +136,21 @@ * const channel = diagnostics_channel.channel('my-channel');

readonly hasSubscribers: boolean;
private constructor(name: string);
private constructor(name: string | symbol);
/**
* Publish a message to any subscribers to the channel. This will trigger
* message handlers synchronously so they will execute within the same context.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
*
* channel.publish({
* some: 'message',
* });
* ```
* @since v15.1.0, v14.17.0
* @param message The message to send to the channel subscribers
*/
publish(message: unknown): void;
/**
* Register a message handler to subscribe to this channel. This message handler

@@ -107,3 +161,3 @@ * will be run synchronously whenever a message is published to the channel. Any

* ```js
* import diagnostics_channel from 'diagnostics_channel';
* import diagnostics_channel from 'node:diagnostics_channel';
*

@@ -117,2 +171,3 @@ * const channel = diagnostics_channel.channel('my-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

@@ -125,3 +180,3 @@ */

* ```js
* import diagnostics_channel from 'diagnostics_channel';
* import diagnostics_channel from 'node:diagnostics_channel';
*

@@ -139,3 +194,5 @@ * const channel = diagnostics_channel.channel('my-channel');

* @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.
*/

@@ -145,4 +202,4 @@ unsubscribe(onMessage: ChannelListener): void;

}
declare module 'node:diagnostics_channel' {
export * from 'diagnostics_channel';
declare module "node:diagnostics_channel" {
export * from "diagnostics_channel";
}
/**
* The `dns` module enables name resolution. For example, use it to look up IP
* The `node:dns` module enables name resolution. For example, use it to look up IP
* addresses of host names.

@@ -12,3 +12,3 @@ *

* ```js
* const dns = require('dns');
* const dns = require('node:dns');
*

@@ -21,3 +21,3 @@ * dns.lookup('example.org', (err, address, family) => {

*
* All other functions in the `dns` module connect to an actual DNS server to
* All other functions in the `node:dns` module connect to an actual DNS server to
* perform name resolution. They will always use the network to perform DNS

@@ -28,3 +28,3 @@ * queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform

* ```js
* const dns = require('dns');
* const dns = require('node:dns');
*

@@ -48,6 +48,6 @@ * dns.resolve4('archive.org', (err, addresses) => {

* See the `Implementation considerations section` for more information.
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/dns.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dns.js)
*/
declare module 'dns' {
import * as dnsPromises from 'node:dns/promises';
declare module "dns" {
import * as dnsPromises from "node:dns/promises";
// Supported getaddrinfo flags.

@@ -65,2 +65,5 @@ export const ADDRCONFIG: number;

all?: boolean | undefined;
/**
* @default true
*/
verbatim?: boolean | undefined;

@@ -81,4 +84,4 @@ }

* AAAA (IPv6) record. All `option` properties are optional. If `options` is an
* integer, then it must be `4` or `6` – if `options` is not provided, then IPv4
* and IPv6 addresses are both returned if found.
* integer, then it must be `4` or `6` – if `options` is `0` or not provided, then
* IPv4 and IPv6 addresses are both returned if found.
*

@@ -95,3 +98,3 @@ * With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the

* The implementation uses an operating system facility that can associate names
* with addresses, and vice versa. This implementation can have subtle but
* with addresses and vice versa. This implementation can have subtle but
* important consequences on the behavior of any Node.js program. Please take some

@@ -103,3 +106,3 @@ * time to consult the `Implementation considerations section` before using`dns.lookup()`.

* ```js
* const dns = require('dns');
* const dns = require('node:dns');
* const options = {

@@ -123,7 +126,26 @@ * family: 6,

*/
export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void;
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void;
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
export function lookup(
hostname: string,
family: number,
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
): void;
export function lookup(
hostname: string,
options: LookupOneOptions,
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
): void;
export function lookup(
hostname: string,
options: LookupAllOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void,
): void;
export function lookup(
hostname: string,
options: LookupOptions,
callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void,
): void;
export function lookup(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
): void;
export namespace lookup {

@@ -144,3 +166,3 @@ function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;

* ```js
* const dns = require('dns');
* const dns = require('node:dns');
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {

@@ -155,7 +177,11 @@ * console.log(hostname, service);

*/
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
export function lookupService(
address: string,
port: number,
callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void,
): void;
export namespace lookupService {
function __promisify__(
address: string,
port: number
port: number,
): Promise<{

@@ -179,9 +205,9 @@ hostname: string;

export interface AnyARecord extends RecordWithTtl {
type: 'A';
type: "A";
}
export interface AnyAaaaRecord extends RecordWithTtl {
type: 'AAAA';
type: "AAAA";
}
export interface CaaRecord {
critial: number;
critical: number;
issue?: string | undefined;

@@ -198,3 +224,3 @@ issuewild?: string | undefined;

export interface AnyMxRecord extends MxRecord {
type: 'MX';
type: "MX";
}

@@ -210,3 +236,3 @@ export interface NaptrRecord {

export interface AnyNaptrRecord extends NaptrRecord {
type: 'NAPTR';
type: "NAPTR";
}

@@ -223,3 +249,3 @@ export interface SoaRecord {

export interface AnySoaRecord extends SoaRecord {
type: 'SOA';
type: "SOA";
}

@@ -233,21 +259,31 @@ export interface SrvRecord {

export interface AnySrvRecord extends SrvRecord {
type: 'SRV';
type: "SRV";
}
export interface AnyTxtRecord {
type: 'TXT';
type: "TXT";
entries: string[];
}
export interface AnyNsRecord {
type: 'NS';
type: "NS";
value: string;
}
export interface AnyPtrRecord {
type: 'PTR';
type: "PTR";
value: string;
}
export interface AnyCnameRecord {
type: 'CNAME';
type: "CNAME";
value: string;
}
export type AnyRecord = AnyARecord | AnyAaaaRecord | AnyCnameRecord | AnyMxRecord | AnyNaptrRecord | AnyNsRecord | AnyPtrRecord | AnySoaRecord | AnySrvRecord | AnyTxtRecord;
export type AnyRecord =
| AnyARecord
| AnyAaaaRecord
| AnyCnameRecord
| AnyMxRecord
| AnyNaptrRecord
| AnyNsRecord
| AnyPtrRecord
| AnySoaRecord
| AnySrvRecord
| AnyTxtRecord;
/**

@@ -265,28 +301,81 @@ * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array

*/
export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve(hostname: string, rrtype: 'A', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve(hostname: string, rrtype: 'AAAA', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve(hostname: string, rrtype: 'ANY', callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
export function resolve(hostname: string, rrtype: 'CNAME', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve(hostname: string, rrtype: 'MX', callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
export function resolve(hostname: string, rrtype: 'NAPTR', callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
export function resolve(hostname: string, rrtype: 'NS', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve(hostname: string, rrtype: 'PTR', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve(hostname: string, rrtype: 'SOA', callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void;
export function resolve(hostname: string, rrtype: 'SRV', callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
export function resolve(hostname: string, rrtype: 'TXT', callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
export function resolve(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "A",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "AAAA",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "ANY",
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "CNAME",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "MX",
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "NAPTR",
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "NS",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "PTR",
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "SOA",
callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void,
): void;
export function resolve(
hostname: string,
rrtype: "SRV",
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
): void;
export function resolve(
hostname: string,
rrtype: "TXT",
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
): void;
export function resolve(
hostname: string,
rrtype: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void
callback: (
err: NodeJS.ErrnoException | null,
addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[],
) => void,
): void;
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: 'MX'): Promise<MxRecord[]>;
function __promisify__(hostname: string, rrtype: 'NAPTR'): Promise<NaptrRecord[]>;
function __promisify__(hostname: string, rrtype: 'SOA'): Promise<SoaRecord>;
function __promisify__(hostname: string, rrtype: 'SRV'): Promise<SrvRecord[]>;
function __promisify__(hostname: string, rrtype: 'TXT'): Promise<string[][]>;
function __promisify__(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
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: "MX"): Promise<MxRecord[]>;
function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
function __promisify__(
hostname: string,
rrtype: string,
): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
}

@@ -299,5 +388,16 @@ /**

*/
export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
export function resolve4(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve4(
hostname: string,
options: ResolveWithTtlOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
): void;
export function resolve4(
hostname: string,
options: ResolveOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
): void;
export namespace resolve4 {

@@ -309,3 +409,3 @@ function __promisify__(hostname: string): Promise<string[]>;

/**
* Uses the DNS protocol to resolve a IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
* will contain an array of IPv6 addresses.

@@ -315,5 +415,16 @@ * @since v0.1.16

*/
export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
export function resolve6(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export function resolve6(
hostname: string,
options: ResolveWithTtlOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
): void;
export function resolve6(
hostname: string,
options: ResolveOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
): void;
export namespace resolve6 {

@@ -329,3 +440,6 @@ function __promisify__(hostname: string): Promise<string[]>;

*/
export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolveCname(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export namespace resolveCname {

@@ -338,5 +452,8 @@ function __promisify__(hostname: string): Promise<string[]>;

* available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).
* @since v15.0.0
* @since v15.0.0, v14.17.0
*/
export function resolveCaa(hostname: string, callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void): void;
export function resolveCaa(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void,
): void;
export namespace resolveCaa {

@@ -350,3 +467,6 @@ function __promisify__(hostname: string): Promise<CaaRecord[]>;

*/
export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
export function resolveMx(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
): void;
export namespace resolveMx {

@@ -356,3 +476,3 @@ function __promisify__(hostname: string): Promise<MxRecord[]>;

/**
* Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of
* Uses the DNS protocol to resolve regular expression-based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of
* objects with the following properties:

@@ -379,3 +499,6 @@ *

*/
export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
export function resolveNaptr(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
): void;
export namespace resolveNaptr {

@@ -389,3 +512,6 @@ function __promisify__(hostname: string): Promise<NaptrRecord[]>;

*/
export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolveNs(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export namespace resolveNs {

@@ -399,3 +525,6 @@ function __promisify__(hostname: string): Promise<string[]>;

*/
export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
export function resolvePtr(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
): void;
export namespace resolvePtr {

@@ -430,3 +559,6 @@ function __promisify__(hostname: string): Promise<string[]>;

*/
export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void;
export function resolveSoa(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void,
): void;
export namespace resolveSoa {

@@ -454,3 +586,6 @@ function __promisify__(hostname: string): Promise<SoaRecord>;

*/
export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
export function resolveSrv(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
): void;
export namespace resolveSrv {

@@ -466,3 +601,6 @@ function __promisify__(hostname: string): Promise<SrvRecord[]>;

*/
export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
export function resolveTxt(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
): void;
export namespace resolveTxt {

@@ -501,3 +639,6 @@ function __promisify__(hostname: string): Promise<string[][]>;

*/
export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
export function resolveAny(
hostname: string,
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
): void;
export namespace resolveAny {

@@ -514,4 +655,15 @@ function __promisify__(hostname: string): Promise<AnyRecord[]>;

*/
export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
export function reverse(
ip: string,
callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void,
): void;
/**
* Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
*
* * `ipv4first`: for `verbatim` defaulting to `false`.
* * `verbatim`: for `verbatim` defaulting to `true`.
* @since v20.1.0
*/
export function getDefaultResultOrder(): "ipv4first" | "verbatim";
/**
* Sets the IP address and port of servers to be used when performing DNS

@@ -544,3 +696,3 @@ * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted

*/
export function setServers(servers: ReadonlyArray<string>): void;
export function setServers(servers: readonly string[]): void;
/**

@@ -563,12 +715,14 @@ * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),

/**
* Set the default value of `verbatim` in {@link lookup}. The value could be:
* - `ipv4first`: sets default `verbatim` `false`.
* - `verbatim`: sets default `verbatim` `true`.
* Set the default value of `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
*
* The default is `ipv4first` and {@link setDefaultResultOrder} have higher priority than `--dns-result-order`.
* When using worker threads, {@link setDefaultResultOrder} from the main thread won't affect the default dns orders in workers.
* @since v14.18.0
* @param order must be 'ipv4first' or 'verbatim'.
* * `ipv4first`: sets default `verbatim` `false`.
* * `verbatim`: sets default `verbatim` `true`.
*
* The default is `verbatim` and {@link setDefaultResultOrder} have higher
* priority than `--dns-result-order`. When using `worker threads`,{@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'` or `'verbatim'`.
*/
export function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
export function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void;
// Error codes

@@ -614,3 +768,3 @@ export const NODATA: string;

* ```js
* const { Resolver } = require('dns');
* const { Resolver } = require('node:dns');
* const resolver = new Resolver();

@@ -625,3 +779,3 @@ * resolver.setServers(['4.4.4.4']);

*
* The following methods from the `dns` module are available:
* The following methods from the `node:dns` module are available:
*

@@ -659,2 +813,3 @@ * * `resolver.getServers()`

resolveAny: typeof resolveAny;
resolveCaa: typeof resolveCaa;
resolveCname: typeof resolveCname;

@@ -674,3 +829,3 @@ resolveMx: typeof resolveMx;

*
* If a v4 or v6 address is not specified, it is set to the default, and the
* If a v4 or v6 address is not specified, it is set to the default and the
* operating system will choose a local address automatically.

@@ -681,3 +836,3 @@ *

* The `rrtype` of resolution requests has no impact on the local address used.
* @since v15.1.0
* @since v15.1.0, v14.17.0
* @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.

@@ -691,4 +846,4 @@ * @param [ipv6='::0'] A string representation of an IPv6 address.

}
declare module 'node:dns' {
export * from 'dns';
declare module "node:dns" {
export * from "dns";
}
/**
* The `dns.promises` API provides an alternative set of asynchronous DNS methods
* that return `Promise` objects rather than using callbacks. The API is accessible
* via `require('dns').promises` or `require('dns/promises')`.
* via `require('node:dns').promises` or `require('node:dns/promises')`.
* @since v10.6.0
*/
declare module 'dns/promises' {
declare module "dns/promises" {
import {
AnyRecord,
CaaRecord,
LookupAddress,
LookupAllOptions,
LookupOneOptions,
LookupAllOptions,
LookupOptions,
AnyRecord,
CaaRecord,
MxRecord,
NaptrRecord,
SoaRecord,
SrvRecord,
ResolveWithTtlOptions,
RecordWithTtl,
ResolveOptions,
ResolverOptions,
} from 'node:dns';
ResolveWithTtlOptions,
SoaRecord,
SrvRecord,
} from "node:dns";
/**

@@ -55,3 +55,3 @@ * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),

* protocol. The implementation uses an operating system facility that can
* associate names with addresses, and vice versa. This implementation can have
* associate names with addresses and vice versa. This implementation can have
* subtle but important consequences on the behavior of any Node.js program. Please

@@ -64,3 +64,3 @@ * take some time to consult the `Implementation considerations section` before

* ```js
* const dns = require('dns');
* const dns = require('node:dns');
* const dnsPromises = dns.promises;

@@ -101,3 +101,3 @@ * const options = {

* ```js
* const dnsPromises = require('dns').promises;
* const dnsPromises = require('node:dns').promises;
* dnsPromises.lookupService('127.0.0.1', 22).then((result) => {

@@ -112,3 +112,3 @@ * console.log(result.hostname, result.service);

address: string,
port: number
port: number,
): Promise<{

@@ -132,15 +132,18 @@ hostname: string;

function resolve(hostname: string): Promise<string[]>;
function resolve(hostname: string, rrtype: 'A'): Promise<string[]>;
function resolve(hostname: string, rrtype: 'AAAA'): Promise<string[]>;
function resolve(hostname: string, rrtype: 'ANY'): Promise<AnyRecord[]>;
function resolve(hostname: string, rrtype: 'CAA'): Promise<CaaRecord[]>;
function resolve(hostname: string, rrtype: 'CNAME'): Promise<string[]>;
function resolve(hostname: string, rrtype: 'MX'): Promise<MxRecord[]>;
function resolve(hostname: string, rrtype: 'NAPTR'): Promise<NaptrRecord[]>;
function resolve(hostname: string, rrtype: 'NS'): Promise<string[]>;
function resolve(hostname: string, rrtype: 'PTR'): Promise<string[]>;
function resolve(hostname: string, rrtype: 'SOA'): Promise<SoaRecord>;
function resolve(hostname: string, rrtype: 'SRV'): Promise<SrvRecord[]>;
function resolve(hostname: string, rrtype: 'TXT'): Promise<string[][]>;
function resolve(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
function resolve(hostname: string, rrtype: "A"): Promise<string[]>;
function resolve(hostname: string, rrtype: "AAAA"): Promise<string[]>;
function resolve(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
function resolve(hostname: string, rrtype: "CAA"): Promise<CaaRecord[]>;
function resolve(hostname: string, rrtype: "CNAME"): Promise<string[]>;
function resolve(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
function resolve(hostname: string, rrtype: "NS"): Promise<string[]>;
function resolve(hostname: string, rrtype: "PTR"): Promise<string[]>;
function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>;
function resolve(
hostname: string,
rrtype: string,
): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
/**

@@ -197,3 +200,3 @@ * Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv4

* certification authority authorization records available for the `hostname`(e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`).
* @since v15.0.0
* @since v15.0.0, v14.17.0
*/

@@ -215,3 +218,3 @@ function resolveCaa(hostname: string): Promise<CaaRecord[]>;

/**
* Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array
* Uses the DNS protocol to resolve regular expression-based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array
* of objects with the following properties:

@@ -315,2 +318,10 @@ *

/**
* Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
*
* * `ipv4first`: for `verbatim` defaulting to `false`.
* * `verbatim`: for `verbatim` defaulting to `true`.
* @since v20.1.0
*/
function getDefaultResultOrder(): "ipv4first" | "verbatim";
/**
* Sets the IP address and port of servers to be used when performing DNS

@@ -341,14 +352,59 @@ * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted

*/
function setServers(servers: ReadonlyArray<string>): void;
function setServers(servers: readonly string[]): void;
/**
* Set the default value of `verbatim` in {@link lookup}. The value could be:
* - `ipv4first`: sets default `verbatim` `false`.
* - `verbatim`: sets default `verbatim` `true`.
* Set the default value of `verbatim` in `dns.lookup()` and `dnsPromises.lookup()`. The value could be:
*
* The default is `ipv4first` and {@link setDefaultResultOrder} have higher priority than `--dns-result-order`.
* When using worker threads, {@link setDefaultResultOrder} from the main thread won't affect the default dns orders in workers.
* @since v14.18.0
* @param order must be 'ipv4first' or 'verbatim'.
* * `ipv4first`: sets default `verbatim` `false`.
* * `verbatim`: sets default `verbatim` `true`.
*
* The default is `verbatim` and `dnsPromises.setDefaultResultOrder()` have
* higher priority than `--dns-result-order`. When using `worker threads`,`dnsPromises.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'` or `'verbatim'`.
*/
function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void;
/**
* 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()` does not affect
* other resolvers:
*
* ```js
* const { Resolver } = require('node:dns').promises;
* const resolver = new Resolver();
* resolver.setServers(['4.4.4.4']);
*
* // This request will use the server at 4.4.4.4, independent of global settings.
* resolver.resolve4('example.org').then((addresses) => {
* // ...
* });
*
* // Alternatively, the same code can be written using async-await style.
* (async function() {
* const addresses = await resolver.resolve4('example.org');
* })();
* ```
*
* The following methods from the `dnsPromises` API are available:
*
* * `resolver.getServers()`
* * `resolver.resolve()`
* * `resolver.resolve4()`
* * `resolver.resolve6()`
* * `resolver.resolveAny()`
* * `resolver.resolveCaa()`
* * `resolver.resolveCname()`
* * `resolver.resolveMx()`
* * `resolver.resolveNaptr()`
* * `resolver.resolveNs()`
* * `resolver.resolvePtr()`
* * `resolver.resolveSoa()`
* * `resolver.resolveSrv()`
* * `resolver.resolveTxt()`
* * `resolver.reverse()`
* * `resolver.setServers()`
* @since v10.6.0
*/
class Resolver {

@@ -362,2 +418,3 @@ constructor(options?: ResolverOptions);

resolveAny: typeof resolveAny;
resolveCaa: typeof resolveCaa;
resolveCname: typeof resolveCname;

@@ -376,4 +433,4 @@ resolveMx: typeof resolveMx;

}
declare module 'node:dns/promises' {
export * from 'dns/promises';
declare module "node:dns/promises" {
export * from "dns/promises";
}
/**
* **This module is pending deprecation.** Once a replacement API has been
* finalized, this module will be fully deprecated. Most developers should**not** have cause to use this module. Users who absolutely must have
* finalized, this module will be fully deprecated. Most developers should
* **not** have cause to use this module. Users who absolutely must have
* the functionality that domains provide may rely on it for the time being

@@ -14,6 +15,6 @@ * but should expect to have to migrate to a different solution

* @deprecated Since v1.4.2 - Deprecated
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/domain.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/domain.js)
*/
declare module 'domain' {
import EventEmitter = require('node:events');
declare module "domain" {
import EventEmitter = require("node:events");
/**

@@ -59,3 +60,3 @@ * The `Domain` class encapsulates the functionality of routing errors and

* Run the supplied function in the context of the domain, implicitly
* binding all event emitters, timers, and lowlevel requests that are
* binding all event emitters, timers, and low-level requests that are
* created in that context. Optionally, arguments can be passed to

@@ -67,4 +68,4 @@ * the function.

* ```js
* const domain = require('domain');
* const fs = require('fs');
* const domain = require('node:domain');
* const fs = require('node:fs');
* const d = domain.create();

@@ -170,4 +171,4 @@ * d.on('error', (er) => {

}
declare module 'node:domain' {
export * from 'domain';
declare module "node:domain" {
export * from "domain";
}

@@ -25,3 +25,3 @@ /**

* ```js
* const EventEmitter = require('events');
* import { EventEmitter } from 'node:events';
*

@@ -36,5 +36,39 @@ * class MyEmitter extends EventEmitter {}

* ```
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/events.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/events.js)
*/
declare module 'events' {
declare module "events" {
import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
// NOTE: This class is in the docs but is **not actually exported** by Node.
// If https://github.com/nodejs/node/issues/39903 gets resolved and Node
// actually starts exporting the class, uncomment below.
// import { EventListener, EventListenerObject } from '__dom-events';
// /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */
// interface NodeEventTarget extends EventTarget {
// /**
// * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API.
// * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget.
// */
// addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
// /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */
// eventNames(): string[];
// /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */
// listenerCount(type: string): number;
// /** Node.js-specific alias for `eventTarget.removeListener()`. */
// off(type: string, listener: EventListener | EventListenerObject): this;
// /** Node.js-specific alias for `eventTarget.addListener()`. */
// on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
// /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */
// once(type: string, listener: EventListener | EventListenerObject): this;
// /**
// * Node.js-specific extension to the `EventTarget` class.
// * If `type` is specified, removes all registered listeners for `type`,
// * otherwise removes all registered listeners.
// */
// removeAllListeners(type: string): this;
// /**
// * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`.
// * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`.
// */
// removeListener(type: string, listener: EventListener | EventListenerObject): this;
// }
interface EventEmitterOptions {

@@ -46,6 +80,8 @@ /**

}
interface NodeEventTarget {
// Any EventTarget with a Node-style `once` function
interface _NodeEventTarget {
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
}
interface DOMEventTarget {
// Any EventTarget with a DOM-style `addEventListener`
interface _DOMEventTarget {
addEventListener(

@@ -56,3 +92,3 @@ eventName: string,

once: boolean;
}
},
): any;

@@ -65,6 +101,6 @@ }

/**
* The `EventEmitter` class is defined and exposed by the `events` module:
* The `EventEmitter` class is defined and exposed by the `node:events` module:
*
* ```js
* const EventEmitter = require('events');
* import { EventEmitter } from 'node:events';
* ```

@@ -80,2 +116,5 @@ *

constructor(options?: EventEmitterOptions);
[EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
/**

@@ -91,27 +130,24 @@ * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given

* ```js
* const { once, EventEmitter } = require('events');
* import { once, EventEmitter } from 'node:events';
* import process from 'node:process';
*
* async function run() {
* const ee = new EventEmitter();
* const ee = new EventEmitter();
*
* process.nextTick(() => {
* ee.emit('myevent', 42);
* });
* process.nextTick(() => {
* ee.emit('myevent', 42);
* });
*
* const [value] = await once(ee, 'myevent');
* console.log(value);
* const [value] = await once(ee, 'myevent');
* console.log(value);
*
* const err = new Error('kaboom');
* process.nextTick(() => {
* ee.emit('error', err);
* });
* const err = new Error('kaboom');
* process.nextTick(() => {
* ee.emit('error', err);
* });
*
* try {
* await once(ee, 'myevent');
* } catch (err) {
* console.log('error happened', err);
* }
* try {
* await once(ee, 'myevent');
* } catch (err) {
* console.error('error happened', err);
* }
*
* run();
* ```

@@ -124,3 +160,3 @@ *

* ```js
* const { EventEmitter, once } = require('events');
* import { EventEmitter, once } from 'node:events';
*

@@ -131,3 +167,3 @@ * const ee = new EventEmitter();

* .then(([err]) => console.log('ok', err.message))
* .catch((err) => console.log('error', err.message));
* .catch((err) => console.error('error', err.message));
*

@@ -142,3 +178,3 @@ * ee.emit('error', new Error('boom'));

* ```js
* const { EventEmitter, once } = require('events');
* import { EventEmitter, once } from 'node:events';
*

@@ -167,25 +203,28 @@ * const ee = new EventEmitter();

*/
static once(emitter: NodeEventTarget, eventName: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>;
static once(emitter: DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
static once(
emitter: _NodeEventTarget,
eventName: string | symbol,
options?: StaticEventEmitterOptions,
): Promise<any[]>;
static once(emitter: _DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
/**
* ```js
* const { on, EventEmitter } = require('events');
* import { on, EventEmitter } from 'node:events';
* import process from 'node:process';
*
* (async () => {
* const ee = new EventEmitter();
* const ee = new EventEmitter();
*
* // Emit later on
* process.nextTick(() => {
* ee.emit('foo', 'bar');
* ee.emit('foo', 42);
* });
* // Emit later on
* process.nextTick(() => {
* ee.emit('foo', 'bar');
* ee.emit('foo', 42);
* });
*
* for await (const event of on(ee, 'foo')) {
* // The execution of this inner block is synchronous and it
* // processes one event at a time (even with await). Do not use
* // if concurrent execution is required.
* console.log(event); // prints ['bar'] [42]
* }
* // Unreachable here
* })();
* for await (const event of on(ee, 'foo')) {
* // The execution of this inner block is synchronous and it
* // processes one event at a time (even with await). Do not use
* // if concurrent execution is required.
* console.log(event); // prints ['bar'] [42]
* }
* // Unreachable here
* ```

@@ -201,3 +240,5 @@ *

* ```js
* const { on, EventEmitter } = require('events');
* import { on, EventEmitter } from 'node:events';
* import process from 'node:process';
*
* const ac = new AbortController();

@@ -229,3 +270,7 @@ *

*/
static on(emitter: NodeJS.EventEmitter, eventName: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>;
static on(
emitter: NodeJS.EventEmitter,
eventName: string,
options?: StaticEventEmitterOptions,
): AsyncIterableIterator<any>;
/**

@@ -235,3 +280,4 @@ * A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.

* ```js
* const { EventEmitter, listenerCount } = require('events');
* import { EventEmitter, listenerCount } from 'node:events';
*
* const myEmitter = new EventEmitter();

@@ -259,3 +305,3 @@ * myEmitter.on('event', () => {});

* ```js
* const { getEventListeners, EventEmitter } = require('events');
* import { getEventListeners, EventEmitter } from 'node:events';
*

@@ -266,3 +312,3 @@ * {

* ee.on('foo', listener);
* getEventListeners(ee, 'foo'); // [listener]
* console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
* }

@@ -273,27 +319,148 @@ * {

* et.addEventListener('foo', listener);
* getEventListeners(et, 'foo'); // [listener]
* console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
* }
* ```
* @since v15.2.0
* @since v15.2.0, v14.17.0
*/
static getEventListeners(emitter: DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
/**
* This symbol shall be used to install a listener for only monitoring `'error'`
* events. Listeners installed using this symbol are called before the regular
* `'error'` listeners are called.
* Returns the currently set max amount of listeners.
*
* Installing a listener using this symbol does not change the behavior once an
* `'error'` event is emitted, therefore the process will still crash if no
* For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on
* the emitter.
*
* For `EventTarget`s this is the only way to get the max event listeners for the
* event target. If the number of event handlers on a single EventTarget exceeds
* the max set, the EventTarget will print a warning.
*
* ```js
* import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events';
*
* {
* const ee = new EventEmitter();
* console.log(getMaxListeners(ee)); // 10
* setMaxListeners(11, ee);
* console.log(getMaxListeners(ee)); // 11
* }
* {
* const et = new EventTarget();
* console.log(getMaxListeners(et)); // 10
* setMaxListeners(11, et);
* console.log(getMaxListeners(et)); // 11
* }
* ```
* @since v19.9.0
*/
static getMaxListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter): number;
/**
* ```js
* import { setMaxListeners, EventEmitter } from 'node:events';
*
* const target = new EventTarget();
* const emitter = new EventEmitter();
*
* setMaxListeners(5, target, emitter);
* ```
* @since v15.4.0
* @param n A non-negative number. The maximum number of listeners per `EventTarget` event.
* @param eventsTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter}
* objects.
*/
static setMaxListeners(n?: number, ...eventTargets: Array<_DOMEventTarget | NodeJS.EventEmitter>): void;
/**
* Listens once to the `abort` event on the provided `signal`.
*
* Listening to the `abort` event on abort signals is unsafe and may
* lead to resource leaks since another third party with the signal can
* call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change
* this since it would violate the web standard. Additionally, the original
* API makes it easy to forget to remove listeners.
*
* This API allows safely using `AbortSignal`s in Node.js APIs by solving these
* two issues by listening to the event such that `stopImmediatePropagation` does
* not prevent the listener from running.
*
* Returns a disposable so that it may be unsubscribed from more easily.
*
* ```js
* import { addAbortListener } from 'node:events';
*
* function example(signal) {
* let disposable;
* try {
* signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
* disposable = addAbortListener(signal, (e) => {
* // Do something when signal is aborted.
* });
* } finally {
* disposable?.[Symbol.dispose]();
* }
* }
* ```
* @since v20.5.0
* @experimental
* @return Disposable that removes the `abort` listener.
*/
static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable;
/**
* This symbol shall be used to install a listener for only monitoring `'error'`events. Listeners installed using this symbol are called before the regular`'error'` listeners are called.
*
* Installing a listener using this symbol does not change the behavior once an`'error'` event is emitted. Therefore, the process will still crash if no
* regular `'error'` listener is installed.
* @since v13.6.0, v12.17.0
*/
static readonly errorMonitor: unique symbol;
/**
* Value: `Symbol.for('nodejs.rejection')`
*
* See how to write a custom `rejection handler`.
* @since v13.4.0, v12.16.0
*/
static readonly captureRejectionSymbol: unique symbol;
/**
* Sets or gets the default captureRejection value for all emitters.
* Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)
*
* Change the default `captureRejections` option on all new `EventEmitter` objects.
* @since v13.4.0, v12.16.0
*/
// TODO: These should be described using static getter/setter pairs:
static captureRejections: boolean;
/**
* By default, a maximum of `10` listeners can be registered for any single
* event. This limit can be changed for individual `EventEmitter` instances
* using the `emitter.setMaxListeners(n)` method. To change the default
* for _all_`EventEmitter` instances, the `events.defaultMaxListeners`property can be used. If this value is not a positive number, a `RangeError`is thrown.
*
* Take caution when setting the `events.defaultMaxListeners` because the
* change affects _all_`EventEmitter` instances, including those created before
* the change is made. However, calling `emitter.setMaxListeners(n)` still has
* precedence over `events.defaultMaxListeners`.
*
* This is not a hard limit. The `EventEmitter` instance will allow
* more listeners to be added but will output a trace warning to stderr indicating
* that a "possible EventEmitter memory leak" has been detected. For any single`EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()`methods can be used to
* temporarily avoid this warning:
*
* ```js
* import { EventEmitter } from 'node:events';
* const emitter = new EventEmitter();
* emitter.setMaxListeners(emitter.getMaxListeners() + 1);
* emitter.once('event', () => {
* // do stuff
* emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
* });
* ```
*
* The `--trace-warnings` command-line flag can be used to display the
* stack trace for such warnings.
*
* The emitted warning can be inspected with `process.on('warning')` and will
* have the additional `emitter`, `type`, and `count` properties, referring to
* the event emitter instance, the event's name and the number of attached
* listeners, respectively.
* Its `name` property is set to `'MaxListenersExceededWarning'`.
* @since v0.11.2
*/
static defaultMaxListeners: number;
}
import internal = require('node:events');
import internal = require("node:events");
namespace EventEmitter {

@@ -308,2 +475,80 @@ // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4

}
export interface EventEmitterReferencingAsyncResource extends AsyncResource {
readonly eventEmitter: EventEmitterAsyncResource;
}
export interface EventEmitterAsyncResourceOptions extends AsyncResourceOptions, EventEmitterOptions {
/**
* The type of async event, this is required when instantiating `EventEmitterAsyncResource`
* directly rather than as a child class.
* @default new.target.name if instantiated as a child class.
*/
name?: string;
}
/**
* Integrates `EventEmitter` with `AsyncResource` for `EventEmitter`s that
* require manual async tracking. Specifically, all events emitted by instances
* of `events.EventEmitterAsyncResource` will run within its `async context`.
*
* ```js
* import { EventEmitterAsyncResource, EventEmitter } from 'node:events';
* import { notStrictEqual, strictEqual } from 'node:assert';
* import { executionAsyncId, triggerAsyncId } from 'node:async_hooks';
*
* // Async tracking tooling will identify this as 'Q'.
* const ee1 = new EventEmitterAsyncResource({ name: 'Q' });
*
* // 'foo' listeners will run in the EventEmitters async context.
* ee1.on('foo', () => {
* strictEqual(executionAsyncId(), ee1.asyncId);
* strictEqual(triggerAsyncId(), ee1.triggerAsyncId);
* });
*
* const ee2 = new EventEmitter();
*
* // 'foo' listeners on ordinary EventEmitters that do not track async
* // context, however, run in the same async context as the emit().
* ee2.on('foo', () => {
* notStrictEqual(executionAsyncId(), ee2.asyncId);
* notStrictEqual(triggerAsyncId(), ee2.triggerAsyncId);
* });
*
* Promise.resolve().then(() => {
* ee1.emit('foo');
* ee2.emit('foo');
* });
* ```
*
* The `EventEmitterAsyncResource` class has the same methods and takes the
* same options as `EventEmitter` and `AsyncResource` themselves.
* @since v17.4.0, v16.14.0
*/
export class EventEmitterAsyncResource extends EventEmitter {
/**
* @param options Only optional in child class.
*/
constructor(options?: EventEmitterAsyncResourceOptions);
/**
* Call all `destroy` hooks. This should only ever be called once. An error will
* be thrown if it is called more than once. This **must** be manually called. If
* the resource is left to be collected by the GC then the `destroy` hooks will
* never be called.
*/
emitDestroy(): void;
/**
* The unique `asyncId` assigned to the resource.
*/
readonly asyncId: number;
/**
* The same triggerAsyncId that is passed to the AsyncResource constructor.
*/
readonly triggerAsyncId: number;
/**
* The returned `AsyncResource` object has an additional `eventEmitter` property
* that provides a reference to this `EventEmitterAsyncResource`.
*/
readonly asyncResource: EventEmitterReferencingAsyncResource;
}
}

@@ -313,2 +558,3 @@ global {

interface EventEmitter {
[EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
/**

@@ -337,2 +583,3 @@ * Alias for `emitter.on(eventName, listener)`.

* ```js
* import { EventEmitter } from 'node:events';
* const myEE = new EventEmitter();

@@ -367,2 +614,3 @@ * myEE.on('foo', () => console.log('a'));

* ```js
* import { EventEmitter } from 'node:events';
* const myEE = new EventEmitter();

@@ -399,6 +647,8 @@ * myEE.once('foo', () => console.log('a'));

* Once an event is emitted, all listeners attached to it at the
* time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and_before_ the last listener finishes execution will
* not remove them from`emit()` in progress. Subsequent events behave as expected.
* time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution
* will not remove them from`emit()` in progress. Subsequent events behave as expected.
*
* ```js
* import { EventEmitter } from 'node:events';
* class MyEmitter extends EventEmitter {}
* const myEmitter = new MyEmitter();

@@ -444,2 +694,3 @@ *

* ```js
* import { EventEmitter } from 'node:events';
* const ee = new EventEmitter();

@@ -513,2 +764,3 @@ *

* ```js
* import { EventEmitter } from 'node:events';
* const emitter = new EventEmitter();

@@ -546,3 +798,3 @@ * emitter.once('log', () => console.log('log once'));

* ```js
* const EventEmitter = require('events');
* import { EventEmitter } from 'node:events';
* const myEmitter = new EventEmitter();

@@ -582,7 +834,10 @@ *

/**
* Returns the number of listeners listening to the event named `eventName`.
* Returns the number of listeners listening for the event named `eventName`.
* If `listener` is provided, it will return how many times the listener is found
* in the list of the listeners of the event.
* @since v3.2.0
* @param eventName The name of the event being listened for
* @param listener The event handler function
*/
listenerCount(eventName: string | symbol): number;
listenerCount(eventName: string | symbol, listener?: Function): number;
/**

@@ -607,3 +862,3 @@ * Adds the `listener` function to the _beginning_ of the listeners array for the

/**
* Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this
* Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this
* listener is removed, and then invoked.

@@ -628,3 +883,4 @@ *

* ```js
* const EventEmitter = require('events');
* import { EventEmitter } from 'node:events';
*
* const myEE = new EventEmitter();

@@ -648,5 +904,5 @@ * myEE.on('foo', () => {});

}
declare module 'node:events' {
import events = require('events');
declare module "node:events" {
import events = require("events");
export = events;
}

@@ -11,31 +11,38 @@ /**

*/
declare module 'fs/promises' {
import { Abortable } from 'node:events';
import { Stream } from 'node:stream';
declare module "fs/promises" {
import { Abortable } from "node:events";
import { Stream } from "node:stream";
import { ReadableStream } from "node:stream/web";
import {
Stats,
BigIntStats,
StatOptions,
WriteVResult,
BigIntStatsFs,
BufferEncodingOption,
constants as fsConstants,
CopyOptions,
Dir,
Dirent,
MakeDirectoryOptions,
Mode,
ObjectEncodingOptions,
OpenDirOptions,
OpenMode,
PathLike,
ReadStream,
ReadVResult,
PathLike,
RmDirOptions,
RmOptions,
MakeDirectoryOptions,
Dirent,
OpenDirOptions,
Dir,
ObjectEncodingOptions,
BufferEncodingOption,
OpenMode,
Mode,
StatFsOptions,
StatOptions,
Stats,
StatsFs,
TimeLike,
WatchEventType,
WatchOptions,
WatchEventType,
CopyOptions,
ReadStream,
WriteStream,
} from 'node:fs';
WriteVResult,
} from "node:fs";
import { Interface as ReadlineInterface } from "node:readline";
interface FileChangeInfo<T extends string | Buffer> {
eventType: WatchEventType;
filename: T;
filename: T | null;
}

@@ -46,7 +53,7 @@ interface FlagAndOpenMode {

}
interface FileReadResult<T extends ArrayBufferView> {
interface FileReadResult<T extends NodeJS.ArrayBufferView> {
bytesRead: number;
buffer: T;
}
interface FileReadOptions<T extends ArrayBufferView = Buffer> {
interface FileReadOptions<T extends NodeJS.ArrayBufferView = Buffer> {
/**

@@ -79,3 +86,12 @@ * @default `Buffer.alloc(0xffff)`

start?: number | undefined;
highWaterMark?: number | undefined;
flush?: boolean | undefined;
}
interface ReadableWebStreamOptions {
/**
* Whether to open a normal or a `'bytes'` stream.
* @since v20.0.0
*/
type?: "bytes" | undefined;
}
// TODO: Add `EventEmitter` close

@@ -96,3 +112,9 @@ interface FileHandle {

*/
appendFile(data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding | null): Promise<void>;
appendFile(
data: string | Uint8Array,
options?:
| (ObjectEncodingOptions & FlagAndOpenMode & { flush?: boolean | undefined })
| BufferEncoding
| null,
): Promise<void>;
/**

@@ -114,4 +136,4 @@ * Changes the ownership of the file. A wrapper for [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html).

/**
* Unlike the 16 kb default `highWaterMark` for a `stream.Readable`, the stream
* returned by this method has a default `highWaterMark` of 64 kb.
* Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream
* returned by this method has a default `highWaterMark` of 64 KiB.
*

@@ -134,3 +156,3 @@ * `options` can include `start` and `end` values to read a range of bytes from

* ```js
* import { open } from 'fs/promises';
* import { open } from 'node:fs/promises';
*

@@ -161,3 +183,3 @@ * const fd = await open('/dev/input/event0');

* ```js
* import { open } from 'fs/promises';
* import { open } from 'node:fs/promises';
*

@@ -173,5 +195,5 @@ * const fd = await open('sample.txt');

* position past the beginning of the file, allowed values are in the
* \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than replacing
* it may require the `flags` `open` option to be set to `r+` rather than the
* default `r`. The `encoding` can be any one of those accepted by `Buffer`.
* \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than
* replacing it may require the `flags` `open` option to be set to `r+` rather than
* the default `r`. The `encoding` can be any one of those accepted by `Buffer`.
*

@@ -202,3 +224,3 @@ * If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,

* @since v10.0.0
* @return Fufills with `undefined` upon success.
* @return Fulfills with `undefined` upon success.
*/

@@ -219,5 +241,35 @@ sync(): Promise<void>;

*/
read<T extends ArrayBufferView>(buffer: T, offset?: number | null, length?: number | null, position?: number | null): Promise<FileReadResult<T>>;
read<T extends ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
read<T extends NodeJS.ArrayBufferView>(
buffer: T,
offset?: number | null,
length?: number | null,
position?: number | null,
): Promise<FileReadResult<T>>;
read<T extends NodeJS.ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
/**
* Returns a `ReadableStream` that may be used to read the files data.
*
* An error will be thrown if this method is called more than once or is called
* after the `FileHandle` is closed or closing.
*
* ```js
* import {
* open,
* } from 'node:fs/promises';
*
* const file = await open('./some/file/to/read');
*
* for await (const chunk of file.readableWebStream())
* console.log(chunk);
*
* await file.close();
* ```
*
* While the `ReadableStream` will read the file to completion, it will not
* close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method.
* @since v17.0.0
* @experimental
*/
readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
/**
* Asynchronously reads the entire contents of a file.

@@ -240,3 +292,3 @@ *

flag?: OpenMode | undefined;
} | null
} | null,
): Promise<Buffer>;

@@ -252,6 +304,6 @@ /**

| {
encoding: BufferEncoding;
flag?: OpenMode | undefined;
}
| BufferEncoding
encoding: BufferEncoding;
flag?: OpenMode | undefined;
}
| BufferEncoding,
): Promise<string>;

@@ -267,8 +319,24 @@ /**

| (ObjectEncodingOptions & {
flag?: OpenMode | undefined;
})
flag?: OpenMode | undefined;
})
| BufferEncoding
| null
| null,
): Promise<string | Buffer>;
/**
* Convenience method to create a `readline` interface and stream over the file.
* See `filehandle.createReadStream()` for the options.
*
* ```js
* import { open } from 'node:fs/promises';
*
* const file = await open('./some/file/to/read');
*
* for await (const line of file.readLines()) {
* console.log(line);
* }
* ```
* @since v18.11.0
*/
readLines(options?: CreateReadStreamOptions): ReadlineInterface;
/**
* @since v10.0.0

@@ -280,3 +348,3 @@ * @return Fulfills with an {fs.Stats} for the file.

bigint?: false | undefined;
}
},
): Promise<Stats>;

@@ -286,3 +354,3 @@ stat(

bigint: true;
}
},
): Promise<BigIntStats>;

@@ -299,3 +367,3 @@ stat(opts?: StatOptions): Promise<Stats | BigIntStats>;

* ```js
* import { open } from 'fs/promises';
* import { open } from 'node:fs/promises';
*

@@ -321,12 +389,11 @@ * let filehandle = null;

/**
* Change the file system timestamps of the object referenced by the `FileHandle` then resolves the promise with no arguments upon success.
* Change the file system timestamps of the object referenced by the `FileHandle` then fulfills the promise with no arguments upon success.
* @since v10.0.0
*/
utimes(atime: string | number | Date, mtime: string | number | Date): Promise<void>;
utimes(atime: TimeLike, mtime: TimeLike): Promise<void>;
/**
* Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface) or
* [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object, or an
* object with an own `toString` function
* property. The promise is resolved with no arguments upon success.
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
* [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object.
* The promise is fulfilled with no arguments upon success.
*

@@ -338,3 +405,3 @@ * If `options` is a string, then it specifies the `encoding`.

* It is unsafe to use `filehandle.writeFile()` multiple times on the same file
* without waiting for the promise to be resolved (or rejected).
* without waiting for the promise to be fulfilled (or rejected).
*

@@ -346,13 +413,17 @@ * If one or more `filehandle.write()` calls are made on a file handle and then a`filehandle.writeFile()` call is made, the data will be written from the

*/
writeFile(data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode & Abortable) | BufferEncoding | null): Promise<void>;
writeFile(
data: string | Uint8Array,
options?:
| (ObjectEncodingOptions & FlagAndOpenMode & Abortable & { flush?: boolean | undefined })
| BufferEncoding
| null,
): Promise<void>;
/**
* Write `buffer` to the file.
*
* If `buffer` is a plain object, it must have an own (not inherited) `toString`function property.
* The promise is fulfilled with an object containing two properties:
*
* The promise is resolved with an object containing two properties:
*
* It is unsafe to use `filehandle.write()` multiple times on the same file
* without waiting for the promise to be resolved (or rejected). For this
* scenario, use `fs.createWriteStream()`.
* without waiting for the promise to be fulfilled (or rejected). For this
* scenario, use `filehandle.createWriteStream()`.
*

@@ -363,6 +434,6 @@ * On Linux, positional writes do not work when the file is opened in append mode.

* @since v10.0.0
* @param [offset=0] The start position from within `buffer` where the data to write begins.
* @param [length=buffer.byteLength] The number of bytes from `buffer` to write.
* @param position 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.
* @param offset The start position from within `buffer` where the data to write begins.
* @param [length=buffer.byteLength - offset] The number of bytes from `buffer` to write.
* @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.
*/

@@ -373,3 +444,3 @@ write<TBuffer extends Uint8Array>(

length?: number | null,
position?: number | null
position?: number | null,
): Promise<{

@@ -382,3 +453,3 @@ bytesWritten: number;

position?: number | null,
encoding?: BufferEncoding | null
encoding?: BufferEncoding | null,
): Promise<{

@@ -391,6 +462,6 @@ bytesWritten: number;

*
* The promise is resolved with an object containing a two properties:
* The promise is fulfilled with an object containing a two properties:
*
* It is unsafe to call `writev()` multiple times on the same file without waiting
* for the promise to be resolved (or rejected).
* for the promise to be fulfilled (or rejected).
*

@@ -401,13 +472,13 @@ * On Linux, positional writes don't work when the file is opened in append mode.

* @since v12.9.0
* @param position 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
* @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(buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<WriteVResult>;
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 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.
* @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(buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<ReadVResult>;
readv(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise<ReadVResult>;
/**

@@ -418,3 +489,3 @@ * Closes the file handle after waiting for any pending operation on the handle to

* ```js
* import { open } from 'fs/promises';
* import { open } from 'node:fs/promises';
*

@@ -432,11 +503,17 @@ * let filehandle;

close(): Promise<void>;
/**
* An alias for {@link FileHandle.close()}.
* @since v20.4.0
*/
[Symbol.asyncDispose](): Promise<void>;
}
const constants: typeof fsConstants;
/**
* Tests a user's permissions for the file or directory specified by `path`.
* The `mode` argument is an optional integer that specifies the accessibility
* checks to be performed. Check `File access constants` for possible values
* of `mode`. It is possible to create a mask consisting of the bitwise OR of
* two or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`).
* checks to be performed. `mode` should be either the value `fs.constants.F_OK`or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`,`fs.constants.W_OK`, and `fs.constants.X_OK`
* (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for
* possible values of `mode`.
*
* If the accessibility check is successful, the promise is resolved with no
* If the accessibility check is successful, the promise is fulfilled with no
* value. If any of the accessibility checks fail, the promise is rejected

@@ -447,4 +524,3 @@ * with an [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object. The following example checks if the file`/etc/passwd` can be read and

* ```js
* import { access } from 'fs/promises';
* import { constants } from 'fs';
* import { access, constants } from 'node:fs/promises';
*

@@ -478,4 +554,3 @@ * try {

* ```js
* import { constants } from 'fs';
* import { copyFile } from 'fs/promises';
* import { copyFile, constants } from 'node:fs/promises';
*

@@ -486,3 +561,3 @@ * try {

* } catch {
* console.log('The file could not be copied');
* console.error('The file could not be copied');
* }

@@ -495,3 +570,3 @@ *

* } catch {
* console.log('The file could not be copied');
* console.error('The file could not be copied');
* }

@@ -520,3 +595,3 @@ * ```

*/
function open(path: PathLike, flags: string | number, mode?: Mode): Promise<FileHandle>;
function open(path: PathLike, flags?: string | number, mode?: Mode): Promise<FileHandle>;
/**

@@ -559,2 +634,15 @@ * Renames `oldPath` to `newPath`.

* rejection only when `recursive` is false.
*
* ```js
* import { mkdir } from 'node:fs/promises';
*
* try {
* const projectFolder = new URL('./test/project/', import.meta.url);
* const createDir = await mkdir(projectFolder, { recursive: true });
*
* console.log(`created ${createDir}`);
* } catch (err) {
* console.error(err.message);
* }
* ```
* @since v10.0.0

@@ -567,3 +655,3 @@ * @return Upon success, fulfills with `undefined` if `recursive` is `false`, or the first directory path created if `recursive` is `true`.

recursive: true;
}
},
): Promise<string | undefined>;

@@ -581,5 +669,5 @@ /**

| (MakeDirectoryOptions & {
recursive?: false | undefined;
})
| null
recursive?: false | undefined;
})
| null,
): Promise<void>;

@@ -601,6 +689,6 @@ /**

*
* If `options.withFileTypes` is set to `true`, the resolved array will contain `fs.Dirent` objects.
* If `options.withFileTypes` is set to `true`, the returned array will contain `fs.Dirent` objects.
*
* ```js
* import { readdir } from 'fs/promises';
* import { readdir } from 'node:fs/promises';
*

@@ -622,6 +710,7 @@ * try {

| (ObjectEncodingOptions & {
withFileTypes?: false | undefined;
})
withFileTypes?: false | undefined;
recursive?: boolean | undefined;
})
| BufferEncoding
| null
| null,
): Promise<string[]>;

@@ -637,6 +726,7 @@ /**

| {
encoding: 'buffer';
withFileTypes?: false | undefined;
}
| 'buffer'
encoding: "buffer";
withFileTypes?: false | undefined;
recursive?: boolean | undefined;
}
| "buffer",
): Promise<Buffer[]>;

@@ -652,6 +742,7 @@ /**

| (ObjectEncodingOptions & {
withFileTypes?: false | undefined;
})
withFileTypes?: false | undefined;
recursive?: boolean | undefined;
})
| BufferEncoding
| null
| null,
): Promise<string[] | Buffer[]>;

@@ -667,7 +758,8 @@ /**

withFileTypes: true;
}
recursive?: boolean | undefined;
},
): Promise<Dirent[]>;
/**
* 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
* resolved with the`linkString` upon success.
* fulfilled with the`linkString` upon success.
*

@@ -697,7 +789,10 @@ * The optional `options` argument can be a string specifying an encoding, or an

*
* The `type` argument is only used on Windows platforms and can be one of `'dir'`,`'file'`, or `'junction'`. Windows junction points require the destination path
* to be absolute. When using `'junction'`, the `target` argument will
* automatically be normalized to absolute path.
* The `type` argument is only used on Windows platforms and can be one of `'dir'`,`'file'`, or `'junction'`. If the `type` argument is not a string, Node.js will
* autodetect `target` type and use `'file'` or `'dir'`. If the `target` does not
* exist, `'file'` will be used. Windows junction points require the destination
* path to be absolute. When using `'junction'`, the `target` argument will
* automatically be normalized to absolute path. Junction points on NTFS volumes
* can only point to directories.
* @since v10.0.0
* @param [type='file']
* @param [type='null']
* @return Fulfills with `undefined` upon success.

@@ -717,3 +812,3 @@ */

bigint?: false | undefined;
}
},
): Promise<Stats>;

@@ -724,3 +819,3 @@ function lstat(

bigint: true;
}
},
): Promise<BigIntStats>;

@@ -736,3 +831,3 @@ function lstat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;

bigint?: false | undefined;
}
},
): Promise<Stats>;

@@ -743,6 +838,23 @@ function stat(

bigint: true;
}
},
): Promise<BigIntStats>;
function stat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
/**
* @since v19.6.0, v18.15.0
* @return Fulfills with the {fs.StatFs} object for the given `path`.
*/
function statfs(
path: PathLike,
opts?: StatFsOptions & {
bigint?: false | undefined;
},
): Promise<StatsFs>;
function statfs(
path: PathLike,
opts: StatFsOptions & {
bigint: true;
},
): Promise<BigIntStatsFs>;
function statfs(path: PathLike, opts?: StatFsOptions): Promise<StatsFs | BigIntStatsFs>;
/**
* Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail.

@@ -788,3 +900,3 @@ * @since v10.0.0

*/
function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise<void>;
/**

@@ -803,7 +915,7 @@ * Changes the ownership of a file.

* numeric string like `'123456789.0'`.
* * If the value can not be converted to a number, or is `NaN`, `Infinity` or`-Infinity`, an `Error` will be thrown.
* * If the value can not be converted to a number, or is `NaN`, `Infinity`, or`-Infinity`, an `Error` will be thrown.
* @since v10.0.0
* @return Fulfills with `undefined` upon success.
*/
function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise<void>;
/**

@@ -837,3 +949,6 @@ * Determines the actual location of `path` using the same semantics as the`fs.realpath.native()` function.

*/
function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
function realpath(
path: PathLike,
options?: ObjectEncodingOptions | BufferEncoding | null,
): Promise<string | Buffer>;
/**

@@ -850,6 +965,8 @@ * Creates a unique temporary directory. A unique directory name is generated by

* ```js
* import { mkdtemp } from 'fs/promises';
* import { mkdtemp } from 'node:fs/promises';
* import { join } from 'node:path';
* import { tmpdir } from 'node:os';
*
* try {
* await mkdtemp(path.join(os.tmpdir(), 'foo-'));
* await mkdtemp(join(tmpdir(), 'foo-'));
* } catch (err) {

@@ -863,5 +980,5 @@ * console.error(err);

* platform-specific path separator
* (`require('path').sep`).
* (`require('node:path').sep`).
* @since v10.0.0
* @return Fulfills with a string containing the filesystem path of the newly created temporary directory.
* @return Fulfills with a string containing the file system path of the newly created temporary directory.
*/

@@ -882,3 +999,5 @@ function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string>;

/**
* Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a `Buffer`, or, an object with an own (not inherited)`toString` function property.
* Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
* [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object.
*

@@ -898,3 +1017,3 @@ * The `encoding` option is ignored if `data` is a buffer.

* method that performs multiple `write` calls internally to write the buffer
* passed to it. For performance sensitive code consider using `fs.createWriteStream()`.
* passed to it. For performance sensitive code consider using `fs.createWriteStream()` or `filehandle.createWriteStream()`.
*

@@ -906,4 +1025,4 @@ * It is possible to use an `AbortSignal` to cancel an `fsPromises.writeFile()`.

* ```js
* import { writeFile } from 'fs/promises';
* import { Buffer } from 'buffer';
* import { writeFile } from 'node:fs/promises';
* import { Buffer } from 'node:buffer';
*

@@ -934,10 +1053,15 @@ * try {

file: PathLike | FileHandle,
data: string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | Stream,
data:
| string
| NodeJS.ArrayBufferView
| Iterable<string | NodeJS.ArrayBufferView>
| AsyncIterable<string | NodeJS.ArrayBufferView>
| Stream,
options?:
| (ObjectEncodingOptions & {
mode?: Mode | undefined;
flag?: OpenMode | undefined;
} & Abortable)
mode?: Mode | undefined;
flag?: OpenMode | undefined;
} & Abortable)
| BufferEncoding
| null
| null,
): Promise<void>;

@@ -958,3 +1082,7 @@ /**

*/
function appendFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding | null): Promise<void>;
function appendFile(
path: PathLike | FileHandle,
data: string | Uint8Array,
options?: (ObjectEncodingOptions & FlagAndOpenMode & { flush?: boolean | undefined }) | BufferEncoding | null,
): Promise<void>;
/**

@@ -973,2 +1101,16 @@ * Asynchronously reads the entire contents of a file.

*
* An example of reading a `package.json` file located in the same directory of the
* running code:
*
* ```js
* import { readFile } from 'node:fs/promises';
* try {
* const filePath = new URL('./package.json', import.meta.url);
* const contents = await readFile(filePath, { encoding: 'utf8' });
* console.log(contents);
* } catch (err) {
* console.error(err.message);
* }
* ```
*
* It is possible to abort an ongoing `readFile` using an `AbortSignal`. If a

@@ -978,3 +1120,3 @@ * request is aborted the promise returned is rejected with an `AbortError`:

* ```js
* import { readFile } from 'fs/promises';
* import { readFile } from 'node:fs/promises';
*

@@ -1008,6 +1150,6 @@ * try {

| ({
encoding?: null | undefined;
flag?: OpenMode | undefined;
} & Abortable)
| null
encoding?: null | undefined;
flag?: OpenMode | undefined;
} & Abortable)
| null,
): Promise<Buffer>;

@@ -1025,6 +1167,6 @@ /**

| ({
encoding: BufferEncoding;
flag?: OpenMode | undefined;
} & Abortable)
| BufferEncoding
encoding: BufferEncoding;
flag?: OpenMode | undefined;
} & Abortable)
| BufferEncoding,
): Promise<string>;

@@ -1041,8 +1183,11 @@ /**

options?:
| (ObjectEncodingOptions &
Abortable & {
flag?: OpenMode | undefined;
})
| (
& ObjectEncodingOptions
& Abortable
& {
flag?: OpenMode | undefined;
}
)
| BufferEncoding
| null
| null,
): Promise<string | Buffer>;

@@ -1061,3 +1206,3 @@ /**

* ```js
* import { opendir } from 'fs/promises';
* import { opendir } from 'node:fs/promises';
*

@@ -1083,3 +1228,3 @@ * try {

* ```js
* const { watch } = require('fs/promises');
* const { watch } = require('node:fs/promises');
*

@@ -1107,3 +1252,3 @@ * const ac = new AbortController();

* All the `caveats` for `fs.watch()` also apply to `fsPromises.watch()`.
* @since v15.9.0
* @since v15.9.0, v14.18.0
* @return of objects with the properties:

@@ -1115,5 +1260,5 @@ */

| (WatchOptions & {
encoding: 'buffer';
})
| 'buffer'
encoding: "buffer";
})
| "buffer",
): AsyncIterable<FileChangeInfo<Buffer>>;

@@ -1137,3 +1282,6 @@ /**

*/
function watch(filename: PathLike, options: WatchOptions | string): AsyncIterable<FileChangeInfo<string>> | AsyncIterable<FileChangeInfo<Buffer>>;
function watch(
filename: PathLike,
options: WatchOptions | string,
): AsyncIterable<FileChangeInfo<string>> | AsyncIterable<FileChangeInfo<Buffer>>;
/**

@@ -1151,6 +1299,6 @@ * Asynchronously copies the entire directory structure from `src` to `dest`,

*/
function cp(source: string, destination: string, opts?: CopyOptions): Promise<void>;
function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise<void>;
}
declare module 'node:fs/promises' {
export * from 'fs/promises';
declare module "node:fs/promises" {
export * from "fs/promises";
}

@@ -23,5 +23,5 @@ // Declare "static" methods in Error

// For backwards compability
interface NodeRequire extends NodeJS.Require { }
interface RequireResolve extends NodeJS.RequireResolve { }
interface NodeModule extends NodeJS.Module { }
interface NodeRequire extends NodeJS.Require {}
interface RequireResolve extends NodeJS.RequireResolve {}
interface NodeModule extends NodeJS.Module {}

@@ -45,3 +45,3 @@ declare var process: NodeJS.Process;

//#region borrowed
// #region borrowed
// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib

@@ -58,7 +58,7 @@ /** A controller object that allows you to abort one or more DOM requests as and when desired. */

*/
abort(): void;
abort(reason?: any): void;
}
/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
interface AbortSignal {
interface AbortSignal extends EventTarget {
/**

@@ -68,17 +68,45 @@ * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.

readonly aborted: boolean;
readonly reason: any;
onabort: null | ((this: AbortSignal, event: Event) => any);
throwIfAborted(): void;
}
declare var AbortController: {
prototype: AbortController;
new(): AbortController;
};
declare var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
: {
prototype: AbortController;
new(): AbortController;
};
declare var AbortSignal: {
prototype: AbortSignal;
new(): AbortSignal;
// TODO: Add abort() static
};
//#endregion borrowed
declare var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
: {
prototype: AbortSignal;
new(): AbortSignal;
abort(reason?: any): AbortSignal;
timeout(milliseconds: number): AbortSignal;
};
// #endregion borrowed
//#region ArrayLike.at()
// #region Disposable
interface SymbolConstructor {
/**
* A method that is used to release resources held by an object. Called by the semantics of the `using` statement.
*/
readonly dispose: unique symbol;
/**
* A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement.
*/
readonly asyncDispose: unique symbol;
}
interface Disposable {
[Symbol.dispose](): void;
}
interface AsyncDisposable {
[Symbol.asyncDispose](): PromiseLike<void>;
}
// #endregion Disposable
// #region ArrayLike.at()
interface RelativeIndexable<T> {

@@ -94,2 +122,3 @@ /**

interface Array<T> extends RelativeIndexable<T> {}
interface ReadonlyArray<T> extends RelativeIndexable<T> {}
interface Int8Array extends RelativeIndexable<number> {}

@@ -106,4 +135,14 @@ interface Uint8Array extends RelativeIndexable<number> {}

interface BigUint64Array extends RelativeIndexable<bigint> {}
//#endregion ArrayLike.at() end
// #endregion ArrayLike.at() end
/**
* @since v17.0.0
*
* Creates a deep clone of an object.
*/
declare function structuredClone<T>(
value: T,
transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> },
): T;
/*----------------------------------------------*

@@ -150,3 +189,3 @@ * *

*/
getFileName(): string | null;
getFileName(): string | undefined;

@@ -204,3 +243,3 @@ /**

isPaused(): boolean;
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T;
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined }): T;
unpipe(destination?: WritableStream): this;

@@ -216,8 +255,8 @@ unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;

write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
end(cb?: () => void): void;
end(data: string | Uint8Array, cb?: () => void): void;
end(str: string, encoding?: BufferEncoding, cb?: () => void): void;
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 ReadWriteStream extends ReadableStream, WritableStream {}

@@ -255,3 +294,3 @@ interface RefCounted {

interface RequireResolve {
(id: string, options?: { paths?: string[] | undefined; }): string;
(id: string, options?: { paths?: string[] | undefined }): string;
paths(request: string): string[] | null;

@@ -261,5 +300,5 @@ }

interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
'.js': (m: Module, filename: string) => any;
'.json': (m: Module, filename: string) => any;
'.node': (m: Module, filename: string) => any;
".js": (m: Module, filename: string) => any;
".json": (m: Module, filename: string) => any;
".node": (m: Module, filename: string) => any;
}

@@ -276,7 +315,7 @@ interface Module {

loaded: boolean;
/** @deprecated since 14.6.0 Please use `require.main` and `module.children` instead. */
/** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */
parent: Module | null | undefined;
children: Module[];
/**
* @since 11.14.0
* @since v11.14.0
*

@@ -296,2 +335,60 @@ * The directory name of the module. This is usually the same as the path.dirname() of the module.id.

}
namespace fetch {
type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Request;
type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response;
type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData;
type _Headers = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Headers;
type _RequestInit = typeof globalThis extends { onmessage: any } ? {}
: import("undici-types").RequestInit;
type Request = globalThis.Request;
type Response = globalThis.Response;
type Headers = globalThis.Headers;
type FormData = globalThis.FormData;
type RequestInit = globalThis.RequestInit;
type RequestInfo = import("undici-types").RequestInfo;
type HeadersInit = import("undici-types").HeadersInit;
type BodyInit = import("undici-types").BodyInit;
type RequestRedirect = import("undici-types").RequestRedirect;
type RequestCredentials = import("undici-types").RequestCredentials;
type RequestMode = import("undici-types").RequestMode;
type ReferrerPolicy = import("undici-types").ReferrerPolicy;
type Dispatcher = import("undici-types").Dispatcher;
type RequestDuplex = import("undici-types").RequestDuplex;
}
}
interface RequestInit extends NodeJS.fetch._RequestInit {}
declare function fetch(
input: NodeJS.fetch.RequestInfo,
init?: RequestInit,
): Promise<Response>;
interface Request extends NodeJS.fetch._Request {}
declare var Request: typeof globalThis extends {
onmessage: any;
Request: infer T;
} ? T
: typeof import("undici-types").Request;
interface Response extends NodeJS.fetch._Response {}
declare var Response: typeof globalThis extends {
onmessage: any;
Response: infer T;
} ? T
: typeof import("undici-types").Response;
interface FormData extends NodeJS.fetch._FormData {}
declare var FormData: typeof globalThis extends {
onmessage: any;
FormData: infer T;
} ? T
: typeof import("undici-types").FormData;
interface Headers extends NodeJS.fetch._Headers {}
declare var Headers: typeof globalThis extends {
onmessage: any;
Headers: infer T;
} ? T
: typeof import("undici-types").Headers;
/**
* 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/v16.9.0/lib/https.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/https.js)
*/
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';
type ServerOptions = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions;
type RequestOptions = http.RequestOptions &
tls.SecureContextOptions & {
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";
type ServerOptions<
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
Response extends typeof http.ServerResponse = typeof http.ServerResponse,
> = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions<Request, Response>;
type RequestOptions =
& http.RequestOptions
& tls.SecureContextOptions
& {
checkServerIdentity?: typeof tls.checkServerIdentity | undefined;
rejectUnauthorized?: boolean | undefined; // Defaults to true

@@ -29,3 +35,6 @@ servername?: string | undefined; // SNI TLS Extension

}
interface Server extends http.Server {}
interface Server<
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
Response extends typeof http.ServerResponse = typeof http.ServerResponse,
> extends http.Server<Request, Response> {}
/**

@@ -35,107 +44,234 @@ * See `http.Server` for more information.

*/
class Server extends tls.Server {
constructor(requestListener?: http.RequestListener);
constructor(options: ServerOptions, requestListener?: http.RequestListener);
class Server<
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
Response extends typeof http.ServerResponse = typeof http.ServerResponse,
> extends tls.Server {
constructor(requestListener?: http.RequestListener<Request, Response>);
constructor(
options: ServerOptions<Request, Response>,
requestListener?: http.RequestListener<Request, Response>,
);
/**
* Closes all connections connected to this server.
* @since v18.2.0
*/
closeAllConnections(): void;
/**
* Closes all connections connected to this server which are not sending a request or waiting for a response.
* @since v18.2.0
*/
closeIdleConnections(): 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(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
addListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
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): this;
addListener(event: 'checkExpectation', listener: http.RequestListener): this;
addListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
addListener(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
addListener(event: 'request', listener: http.RequestListener): this;
addListener(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => 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(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
addListener(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
): this;
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;
addListener(event: "request", listener: http.RequestListener<Request, Response>): this;
addListener(
event: "upgrade",
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
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: http.IncomingMessage, res: http.ServerResponse): boolean;
emit(event: 'checkExpectation', req: http.IncomingMessage, res: http.ServerResponse): boolean;
emit(event: 'clientError', err: Error, socket: Duplex): boolean;
emit(event: 'connect', req: http.IncomingMessage, socket: Duplex, head: Buffer): boolean;
emit(event: 'request', req: http.IncomingMessage, res: http.ServerResponse): boolean;
emit(event: 'upgrade', req: http.IncomingMessage, socket: Duplex, head: Buffer): 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> & {
req: InstanceType<Request>;
},
): boolean;
emit(
event: "checkExpectation",
req: InstanceType<Request>,
res: InstanceType<Response> & {
req: InstanceType<Request>;
},
): 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> & {
req: InstanceType<Request>;
},
): 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;
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): this;
on(event: 'checkExpectation', listener: http.RequestListener): this;
on(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
on(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
on(event: 'request', listener: http.RequestListener): this;
on(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => 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;
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): this;
once(event: 'checkExpectation', listener: http.RequestListener): this;
once(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
once(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
once(event: 'request', listener: http.RequestListener): this;
once(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => 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): this;
prependListener(event: 'checkExpectation', listener: http.RequestListener): this;
prependListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
prependListener(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
prependListener(event: 'request', listener: http.RequestListener): this;
prependListener(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => 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): this;
prependOnceListener(event: 'checkExpectation', listener: http.RequestListener): this;
prependOnceListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
prependOnceListener(event: 'connect', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => void): this;
prependOnceListener(event: 'request', listener: http.RequestListener): this;
prependOnceListener(event: 'upgrade', listener: (req: http.IncomingMessage, socket: Duplex, head: Buffer) => 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;
}

@@ -145,8 +281,8 @@ /**

* // curl -k https://localhost:8000/
* const https = require('https');
* const fs = require('fs');
* const https = require('node:https');
* const fs = require('node:fs');
*
* const options = {
* key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
* cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
* cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
* };

@@ -163,8 +299,8 @@ *

* ```js
* const https = require('https');
* const fs = require('fs');
* const https = require('node:https');
* const fs = require('node:fs');
*
* const options = {
* pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
* passphrase: 'sample'
* passphrase: 'sample',
* };

@@ -181,4 +317,13 @@ *

*/
function createServer(requestListener?: http.RequestListener): Server;
function createServer(options: ServerOptions, requestListener?: http.RequestListener): Server;
function createServer<
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
Response extends typeof http.ServerResponse = typeof http.ServerResponse,
>(requestListener?: http.RequestListener<Request, Response>): Server<Request, Response>;
function createServer<
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
Response extends typeof http.ServerResponse = typeof http.ServerResponse,
>(
options: ServerOptions<Request, Response>,
requestListener?: http.RequestListener<Request, Response>,
): Server<Request, Response>;
/**

@@ -197,3 +342,3 @@ * Makes a request to a secure web server.

* ```js
* const https = require('https');
* const https = require('node:https');
*

@@ -204,3 +349,3 @@ * const options = {

* path: '/',
* method: 'GET'
* method: 'GET',
* };

@@ -232,3 +377,3 @@ *

* key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
* cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
* cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
* };

@@ -252,3 +397,3 @@ * options.agent = new https.Agent(options);

* cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
* agent: false
* agent: false,
* };

@@ -274,5 +419,5 @@ *

* ```js
* const tls = require('tls');
* const https = require('https');
* const crypto = require('crypto');
* const tls = require('node:tls');
* const https = require('node:https');
* const crypto = require('node:crypto');
*

@@ -294,3 +439,3 @@ * function sha256(s) {

*
* // Pin the public key, similar to HPKP pin-sha25 pinning
* // Pin the public key, similar to HPKP pin-sha256 pinning
* const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU=';

@@ -370,4 +515,11 @@ * if (sha256(cert.pubkey) !== pubkey256) {

*/
function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
function request(
options: RequestOptions | string | URL,
callback?: (res: http.IncomingMessage) => void,
): http.ClientRequest;
function request(
url: string | URL,
options: RequestOptions,
callback?: (res: http.IncomingMessage) => void,
): http.ClientRequest;
/**

@@ -380,3 +532,3 @@ * Like `http.get()` but for HTTPS.

* ```js
* const https = require('https');
* const https = require('node:https');
*

@@ -398,8 +550,15 @@ * https.get('https://encrypted.google.com/', (res) => {

*/
function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
function get(
options: RequestOptions | string | URL,
callback?: (res: http.IncomingMessage) => void,
): http.ClientRequest;
function get(
url: string | URL,
options: RequestOptions,
callback?: (res: http.IncomingMessage) => void,
): http.ClientRequest;
let globalAgent: Agent;
}
declare module 'node:https' {
export * from 'https';
declare module "node:https" {
export * from "https";
}

@@ -1,47 +0,1 @@

// Type definitions for non-npm package Node.js 16.11
// Project: https://nodejs.org/
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
// DefinitelyTyped <https://github.com/DefinitelyTyped>
// Alberto Schiabel <https://github.com/jkomyno>
// Alvis HT Tang <https://github.com/alvis>
// Andrew Makarov <https://github.com/r3nya>
// Benjamin Toueg <https://github.com/btoueg>
// Chigozirim C. <https://github.com/smac89>
// David Junger <https://github.com/touffy>
// Deividas Bakanas <https://github.com/DeividasBakanas>
// Eugene Y. Q. Shen <https://github.com/eyqs>
// Hannes Magnusson <https://github.com/Hannes-Magnusson-CK>
// Huw <https://github.com/hoo29>
// Kelvin Jin <https://github.com/kjin>
// Klaus Meinhardt <https://github.com/ajafff>
// Lishude <https://github.com/islishude>
// Mariusz Wiktorczyk <https://github.com/mwiktorczyk>
// Mohsen Azimi <https://github.com/mohsen1>
// Nicolas Even <https://github.com/n-e>
// Nikita Galkin <https://github.com/galkin>
// Parambir Singh <https://github.com/parambirs>
// Sebastian Silbermann <https://github.com/eps1lon>
// Seth Westphal <https://github.com/westy92>
// Simon Schick <https://github.com/SimonSchick>
// Thomas den Hollander <https://github.com/ThomasdenH>
// Wilco Bakker <https://github.com/WilcoBakker>
// wwwy3y3 <https://github.com/wwwy3y3>
// Samuel Ainsworth <https://github.com/samuela>
// Kyle Uehlein <https://github.com/kuehlein>
// Thanik Bhongbhibhat <https://github.com/bhongy>
// Marcin Kopacz <https://github.com/chyzwar>
// Trivikram Kamat <https://github.com/trivikr>
// Junxiao Shi <https://github.com/yoursunny>
// Ilia Baryshnikov <https://github.com/qwelias>
// ExE Boss <https://github.com/ExE-Boss>
// Surasak Chaisurin <https://github.com/Ryan-Willpower>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Anna Henningsen <https://github.com/addaleax>
// Victor Perin <https://github.com/victorperin>
// Yongsheng Zhang <https://github.com/ZYSzys>
// NodeJS Contributors <https://github.com/NodeJS>
// Linus Unnebäck <https://github.com/LinusU>
// wafuwafu13 <https://github.com/wafuwafu13>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**

@@ -71,3 +25,3 @@ * License for programmatically and manually incorporated

// NOTE: These definitions support NodeJS and TypeScript 3.7+.
// NOTE: These definitions support NodeJS and TypeScript 4.9+.

@@ -97,2 +51,3 @@ // Reference required types from the default lib:

/// <reference path="domain.d.ts" />
/// <reference path="dom-events.d.ts" />
/// <reference path="events.d.ts" />

@@ -114,2 +69,3 @@ /// <reference path="fs.d.ts" />

/// <reference path="readline.d.ts" />
/// <reference path="readline/promises.d.ts" />
/// <reference path="repl.d.ts" />

@@ -121,2 +77,3 @@ /// <reference path="stream.d.ts" />

/// <reference path="string_decoder.d.ts" />
/// <reference path="test.d.ts" />
/// <reference path="timers.d.ts" />

@@ -123,0 +80,0 @@ /// <reference path="timers/promises.d.ts" />

/**
* @since v0.3.7
* @experimental
*/
declare module 'module' {
import { URL } from 'node:url';
declare module "module" {
import { URL } from "node:url";
import { MessagePort } from "node:worker_threads";
namespace Module {

@@ -13,5 +15,5 @@ /**

* ```js
* const fs = require('fs');
* const assert = require('assert');
* const { syncBuiltinESMExports } = require('module');
* const fs = require('node:fs');
* const assert = require('node:assert');
* const { syncBuiltinESMExports } = require('node:module');
*

@@ -30,3 +32,3 @@ * fs.readFile = newAPI;

*
* import('fs').then((esmFS) => {
* import('node:fs').then((esmFS) => {
* // It syncs the existing readFile property with the new value

@@ -49,2 +51,3 @@ * assert.strictEqual(esmFS.readFile, newAPI);

* @since v13.7.0, v12.17.0
* @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise.
*/

@@ -68,2 +71,20 @@ function findSourceMap(path: string, error?: Error): SourceMap;

}
interface SourceOrigin {
/**
* The name of the range in the source map, if one was provided
*/
name?: string;
/**
* The file name of the original source, as reported in the SourceMap
*/
fileName: string;
/**
* The 1-indexed lineNumber of the corresponding call site in the original source
*/
lineNumber: number;
/**
* The 1-indexed columnNumber of the corresponding call site in the original source
*/
columnNumber: number;
}
/**

@@ -79,9 +100,167 @@ * @since v13.7.0, v12.17.0

/**
* Given a line number and column number in the generated source file, returns
* an object representing the position in the original file. The object returned
* consists of the following keys:
* Given a line offset and column offset in the generated source
* file, returns an object representing the SourceMap range in the
* original file if found, or an empty object if not.
*
* The object returned contains the following keys:
*
* The returned value represents the raw range as it appears in the
* SourceMap, based on zero-indexed offsets, _not_ 1-indexed line and
* column numbers as they appear in Error messages and CallSite
* objects.
*
* To get the corresponding 1-indexed line and column numbers from a
* lineNumber and columnNumber as they are reported by Error stacks
* and CallSite objects, use `sourceMap.findOrigin(lineNumber, columnNumber)`
* @param lineOffset The zero-indexed line number offset in the generated source
* @param columnOffset The zero-indexed column number offset in the generated source
*/
findEntry(line: number, column: number): SourceMapping;
findEntry(lineOffset: number, columnOffset: number): SourceMapping;
/**
* Given a 1-indexed `lineNumber` and `columnNumber` from a call site in the generated source,
* find the corresponding call site location in the original source.
*
* If the `lineNumber` and `columnNumber` provided are not found in any source map,
* then an empty object is returned.
* @param lineNumber The 1-indexed line number of the call site in the generated source
* @param columnNumber The 1-indexed column number of the call site in the generated source
*/
findOrigin(lineNumber: number, columnNumber: number): SourceOrigin | {};
}
/** @deprecated Use `ImportAttributes` instead */
interface ImportAssertions extends ImportAttributes {}
interface ImportAttributes extends NodeJS.Dict<string> {
type?: string | undefined;
}
type ModuleFormat = "builtin" | "commonjs" | "json" | "module" | "wasm";
type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
interface GlobalPreloadContext {
port: MessagePort;
}
/**
* @deprecated This hook will be removed in a future version.
* Use `initialize` instead. When a loader has an `initialize` export, `globalPreload` will be ignored.
*
* Sometimes it might be necessary to run some code inside of the same global scope that the application runs in.
* This hook allows the return of a string that is run as a sloppy-mode script on startup.
*
* @param context Information to assist the preload code
* @return Code to run before application startup
*/
type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
/**
* The `initialize` hook provides a way to define a custom function that runs in the hooks thread
* when the hooks module is initialized. Initialization happens when the hooks module is registered via `register`.
*
* This hook can receive data from a `register` invocation, including ports and other transferrable objects.
* The return value of `initialize` can be a `Promise`, in which case it will be awaited before the main application thread execution resumes.
*/
type InitializeHook<Data = any> = (data: Data) => void | Promise<void>;
interface ResolveHookContext {
/**
* Export conditions of the relevant `package.json`
*/
conditions: string[];
/**
* @deprecated Use `importAttributes` instead
*/
importAssertions: ImportAttributes;
/**
* An object whose key-value pairs represent the assertions for the module to import
*/
importAttributes: ImportAttributes;
/**
* The module importing this one, or undefined if this is the Node.js entry point
*/
parentURL: string | undefined;
}
interface ResolveFnOutput {
/**
* A hint to the load hook (it might be ignored)
*/
format?: ModuleFormat | null | undefined;
/**
* @deprecated Use `importAttributes` instead
*/
importAssertions?: ImportAttributes | undefined;
/**
* The import attributes to use when caching the module (optional; if excluded the input will be used)
*/
importAttributes?: ImportAttributes | undefined;
/**
* A signal that this hook intends to terminate the chain of `resolve` hooks.
* @default false
*/
shortCircuit?: boolean | undefined;
/**
* The absolute URL to which this input resolves
*/
url: string;
}
/**
* The `resolve` hook chain is responsible for resolving file URL for a given module specifier and parent URL, and optionally its format (such as `'module'`) as a hint to the `load` hook.
* If a format is specified, the load hook is ultimately responsible for providing the final `format` value (and it is free to ignore the hint provided by `resolve`);
* if `resolve` provides a format, a custom `load` hook is required even if only to pass the value to the Node.js default `load` hook.
*
* @param specifier The specified URL path of the module to be resolved
* @param context
* @param nextResolve The subsequent `resolve` hook in the chain, or the Node.js default `resolve` hook after the last user-supplied resolve hook
*/
type ResolveHook = (
specifier: string,
context: ResolveHookContext,
nextResolve: (
specifier: string,
context?: ResolveHookContext,
) => ResolveFnOutput | Promise<ResolveFnOutput>,
) => ResolveFnOutput | Promise<ResolveFnOutput>;
interface LoadHookContext {
/**
* Export conditions of the relevant `package.json`
*/
conditions: string[];
/**
* The format optionally supplied by the `resolve` hook chain
*/
format: ModuleFormat;
/**
* @deprecated Use `importAttributes` instead
*/
importAssertions: ImportAttributes;
/**
* An object whose key-value pairs represent the assertions for the module to import
*/
importAttributes: ImportAttributes;
}
interface LoadFnOutput {
format: ModuleFormat;
/**
* A signal that this hook intends to terminate the chain of `resolve` hooks.
* @default false
*/
shortCircuit?: boolean | undefined;
/**
* The source for Node.js to evaluate
*/
source?: ModuleSource;
}
/**
* The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed.
* It is also in charge of validating the import assertion.
*
* @param url The URL/path of the module to be loaded
* @param context Metadata about the module
* @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook
*/
type LoadHook = (
url: string,
context: LoadHookContext,
nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput | Promise<LoadFnOutput>,
) => LoadFnOutput | Promise<LoadFnOutput>;
}
interface RegisterOptions<Data> {
parentURL: string | URL;
data?: Data | undefined;
transferList?: any[] | undefined;
}
interface Module extends NodeModule {}

@@ -93,3 +272,10 @@ class Module {

static builtinModules: string[];
static isBuiltin(moduleName: string): boolean;
static Module: typeof Module;
static register<Data = any>(
specifier: string | URL,
parentURL?: string | URL,
options?: RegisterOptions<Data>,
): void;
static register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
constructor(id: string, parent?: Module);

@@ -101,14 +287,15 @@ }

/**
* @experimental
* This feature is only available with the `--experimental-import-meta-resolve`
* command flag enabled.
*
* Provides a module-relative resolution function scoped to each module, returning
* the URL string.
*
* @param specified The module specifier to resolve relative to `parent`.
* @param parent The absolute parent module URL to resolve from. If none
* is specified, the value of `import.meta.url` is used as the default.
* Second `parent` parameter is only used when the `--experimental-import-meta-resolve`
* command flag enabled.
*
* @since v20.6.0
*
* @param specifier The module specifier to resolve relative to `parent`.
* @param parent The absolute parent module URL to resolve from.
* @returns The absolute (`file:`) URL string for the resolved module.
*/
resolve?(specified: string, parent?: string | URL): Promise<string>;
resolve(specifier: string, parent?: string | URL | undefined): string;
}

@@ -118,5 +305,5 @@ }

}
declare module 'node:module' {
import module = require('module');
declare module "node:module" {
import module = require("module");
export = module;
}
/**
* > Stability: 2 - Stable
*
* The `net` module provides an asynchronous network API for creating stream-based
* The `node:net` module provides an asynchronous network API for creating stream-based
* TCP or `IPC` servers ({@link createServer}) and clients

@@ -11,11 +11,15 @@ * ({@link createConnection}).

* ```js
* const net = require('net');
* const net = require('node:net');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/net.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/net.js)
*/
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.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void;
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.LookupAllOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: dns.LookupAddress[]) => void,
) => void;
interface AddressInfo {

@@ -31,2 +35,3 @@ address: string;

writable?: boolean | undefined;
signal?: AbortSignal;
}

@@ -58,2 +63,13 @@ interface OnReadOpts {

lookup?: LookupFunction | undefined;
noDelay?: boolean | undefined;
keepAlive?: boolean | undefined;
keepAliveInitialDelay?: number | undefined;
/**
* @since v18.13.0
*/
autoSelectFamily?: boolean | undefined;
/**
* @since v18.13.0
*/
autoSelectFamilyAttemptTimeout?: number | undefined;
}

@@ -64,2 +80,3 @@ interface IpcSocketConnectOpts extends ConnectOpts {

type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
type SocketReadyState = "opening" | "open" | "readOnly" | "writeOnly" | "closed";
/**

@@ -82,2 +99,8 @@ * This class is an abstraction of a TCP socket or a streaming `IPC` endpoint

/**
* Destroys the socket after all data is written. If the `finish` event was already emitted the socket is destroyed immediately.
* If the socket is still writable it implicitly calls `socket.end()`.
* @since v0.3.4
*/
destroySoon(): void;
/**
* Sends data on the socket. The second parameter specifies the encoding in the

@@ -135,2 +158,10 @@ * case of a string. It defaults to UTF8 encoding.

/**
* Close the TCP connection by sending an RST packet and destroy the stream.
* If this TCP socket is in connecting status, it will send an RST packet and destroy this TCP socket once it is connected.
* Otherwise, it will call `socket.destroy` with an `ERR_SOCKET_CLOSED` Error.
* If this is not a TCP socket (for example, a pipe), calling this method will immediately throw an `ERR_INVALID_HANDLE_TYPE` Error.
* @since v18.3.0, v16.17.0
*/
resetAndDestroy(): this;
/**
* Resumes reading after a call to `socket.pause()`.

@@ -212,3 +243,3 @@ * @return The socket itself.

/**
* Opposite of `unref()`, calling `ref()` on a previously `unref`ed socket will_not_ let the program exit if it's the only socket left (the default behavior).
* Opposite of `unref()`, calling `ref()` on a previously `unref`ed socket will _not_ let the program exit if it's the only socket left (the default behavior).
* If the socket is `ref`ed calling `ref` again will have no effect.

@@ -220,2 +251,11 @@ * @since v0.9.1

/**
* This property is only present if the family autoselection algorithm is enabled in `socket.connect(options)`
* and it is an array of the addresses that have been attempted.
*
* Each address is a string in the form of `$IP:$PORT`.
* If the connection was successful, then the last address is the one that the socket is currently connected to.
* @since v19.4.0
*/
readonly autoSelectFamilyAttemptedAddresses: string[];
/**
* This property shows the number of characters buffered for writing. The buffer

@@ -257,2 +297,8 @@ * may contain strings whose length after encoding is not yet known. So this number

/**
* This is `true` if the socket is not connected yet, either because `.connect()`has not yet been called or because it is still in the process of connecting
* (see `socket.connecting`).
* @since v11.2.0, v10.16.0
*/
readonly pending: boolean;
/**
* See `writable.destroyed` for further details.

@@ -274,2 +320,17 @@ */

/**
* The string representation of the local IP family. `'IPv4'` or `'IPv6'`.
* @since v18.8.0, v16.18.0
*/
readonly localFamily?: string;
/**
* This property represents the state of the connection as a string.
*
* * If the stream is connecting `socket.readyState` is `opening`.
* * If the stream is readable and writable, it is `open`.
* * If the stream is readable and not writable, it is `readOnly`.
* * If the stream is not readable and writable, it is `writeOnly`.
* @since v0.5.0
*/
readonly readyState: SocketReadyState;
/**
* The string representation of the remote IP address. For example,`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if

@@ -281,3 +342,4 @@ * the socket is destroyed (for example, if the client disconnected).

/**
* The string representation of the remote IP family. `'IPv4'` or `'IPv6'`.
* 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

@@ -287,3 +349,4 @@ */

/**
* The numeric representation of the remote port. For example, `80` or `21`.
* 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

@@ -293,2 +356,8 @@ */

/**
* 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 | undefined;
/**
* Half-closes the socket. i.e., it sends a FIN packet. It is possible the

@@ -303,5 +372,5 @@ * server will still send some data.

*/
end(callback?: () => void): void;
end(buffer: Uint8Array | string, callback?: () => void): void;
end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): void;
end(callback?: () => void): this;
end(buffer: Uint8Array | string, callback?: () => void): this;
end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this;
/**

@@ -316,64 +385,80 @@ * events.EventEmitter

* 7. lookup
* 8. timeout
* 8. ready
* 9. 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: '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;
addListener(event: 'ready', listener: () => void): this;
addListener(event: 'timeout', listener: () => void): this;
addListener(event: "close", listener: (hadError: boolean) => void): this;
addListener(event: "connect", listener: () => void): this;
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;
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: '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;
emit(event: "close", hadError: boolean): boolean;
emit(event: "connect"): 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: '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;
on(event: "close", listener: (hadError: boolean) => void): this;
on(event: "connect", listener: () => 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: '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;
once(event: "close", listener: (hadError: boolean) => 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: '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;
prependListener(event: "close", listener: (hadError: boolean) => void): this;
prependListener(event: "connect", listener: () => 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: '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;
prependOnceListener(event: "close", listener: (hadError: boolean) => void): this;
prependOnceListener(event: "connect", listener: () => 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;
}

@@ -404,3 +489,30 @@ interface ListenOptions extends Abortable {

pauseOnConnect?: boolean | undefined;
/**
* If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received.
* @default false
* @since v16.5.0
*/
noDelay?: boolean | undefined;
/**
* If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received,
* similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`.
* @default false
* @since v16.5.0
*/
keepAlive?: boolean | undefined;
/**
* If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket.
* @default 0
* @since v16.5.0
*/
keepAliveInitialDelay?: number | undefined;
}
interface DropArgument {
localAddress?: string;
localPort?: number;
localFamily?: string;
remoteAddress?: string;
remotePort?: number;
remoteFamily?: string;
}
/**

@@ -445,3 +557,3 @@ * This class is used to create a TCP or `IPC` server.

* if (e.code === 'EADDRINUSE') {
* console.log('Address in use, retrying...');
* console.error('Address in use, retrying...');
* setTimeout(() => {

@@ -511,3 +623,3 @@ * server.close();

/**
* Opposite of `unref()`, calling `ref()` on a previously `unref`ed server will_not_ let the program exit if it's the only server left (the default behavior).
* Opposite of `unref()`, calling `ref()` on a previously `unref`ed server will _not_ let the program exit if it's the only server left (the default behavior).
* If the server is `ref`ed calling `ref()` again will have no effect.

@@ -544,35 +656,47 @@ * @since v0.9.1

* 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: "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: "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: "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: "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: "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: "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>;
}
type IPVersion = 'ipv4' | 'ipv6';
type IPVersion = "ipv4" | "ipv6";
/**

@@ -582,3 +706,3 @@ * The `BlockList` object can be used with some network APIs to specify rules for

* IP subnets.
* @since v15.0.0
* @since v15.0.0, v14.18.0
*/

@@ -588,3 +712,3 @@ class BlockList {

* Adds a rule to block the given IP address.
* @since v15.0.0
* @since v15.0.0, v14.18.0
* @param address An IPv4 or IPv6 address.

@@ -597,3 +721,3 @@ * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.

* Adds a rule to block a range of IP addresses from `start` (inclusive) to`end` (inclusive).
* @since v15.0.0
* @since v15.0.0, v14.18.0
* @param start The starting IPv4 or IPv6 address in the range.

@@ -607,3 +731,3 @@ * @param end The ending IPv4 or IPv6 address in the range.

* Adds a rule to block a range of IP addresses specified as a subnet mask.
* @since v15.0.0
* @since v15.0.0, v14.18.0
* @param net The network IPv4 or IPv6 address.

@@ -632,3 +756,3 @@ * @param prefix The number of CIDR prefix bits. For IPv4, this must be a value between `0` and `32`. For IPv6, this must be between `0` and `128`.

* ```
* @since v15.0.0
* @since v15.0.0, v14.18.0
* @param address The IP address to check

@@ -664,7 +788,7 @@ * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.

*
* Here is an example of an TCP echo server which listens for connections
* Here is an example of a TCP echo server which listens for connections
* on port 8124:
*
* ```js
* const net = require('net');
* const net = require('node:net');
* const server = net.createServer((c) => {

@@ -689,4 +813,4 @@ * // 'connection' listener.

*
* ```console
* $ telnet localhost 8124
* ```bash
* telnet localhost 8124
* ```

@@ -704,4 +828,4 @@ *

*
* ```console
* $ nc -U /tmp/echo.sock
* ```bash
* nc -U /tmp/echo.sock
* ```

@@ -746,5 +870,34 @@ * @since v0.5.0

/**
* Tests if input is an IP address. Returns `0` for invalid strings,
* returns `4` for IP version 4 addresses, and returns `6` for IP version 6
* addresses.
* Gets the current default value of the `autoSelectFamily` option of `socket.connect(options)`.
* The initial default value is `true`, unless the command line option`--no-network-family-autoselection` is provided.
* @since v19.4.0
*/
function getDefaultAutoSelectFamily(): boolean;
/**
* Sets the default value of the `autoSelectFamily` option of `socket.connect(options)`.
* @since v19.4.0
*/
function setDefaultAutoSelectFamily(value: boolean): void;
/**
* Gets the current default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
* The initial default value is `250`.
* @since v19.8.0
*/
function getDefaultAutoSelectFamilyAttemptTimeout(): number;
/**
* Sets the default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
* @since v19.8.0
*/
function setDefaultAutoSelectFamilyAttemptTimeout(value: number): void;
/**
* Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4
* address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`.
*
* ```js
* net.isIP('::1'); // returns 6
* net.isIP('127.0.0.1'); // returns 4
* net.isIP('127.000.000.001'); // returns 0
* net.isIP('127.0.0.1/24'); // returns 0
* net.isIP('fhqwhgads'); // returns 0
* ```
* @since v0.3.0

@@ -754,3 +907,11 @@ */

/**
* Returns `true` if input is a version 4 IP address, otherwise returns `false`.
* Returns `true` if `input` is an IPv4 address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no
* leading zeroes. Otherwise, returns `false`.
*
* ```js
* net.isIPv4('127.0.0.1'); // returns true
* net.isIPv4('127.000.000.001'); // returns false
* net.isIPv4('127.0.0.1/24'); // returns false
* net.isIPv4('fhqwhgads'); // returns false
* ```
* @since v0.3.0

@@ -760,3 +921,8 @@ */

/**
* Returns `true` if input is a version 6 IP address, otherwise returns `false`.
* Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`.
*
* ```js
* net.isIPv6('::1'); // returns true
* net.isIPv6('fhqwhgads'); // returns false
* ```
* @since v0.3.0

@@ -787,3 +953,3 @@ */

/**
* @since v15.14.0
* @since v15.14.0, v14.18.0
*/

@@ -794,3 +960,3 @@ class SocketAddress {

* Either \`'ipv4'\` or \`'ipv6'\`.
* @since v15.14.0
* @since v15.14.0, v14.18.0
*/

@@ -800,11 +966,11 @@ readonly address: string;

* Either \`'ipv4'\` or \`'ipv6'\`.
* @since v15.14.0
* @since v15.14.0, v14.18.0
*/
readonly family: IPVersion;
/**
* @since v15.14.0
* @since v15.14.0, v14.18.0
*/
readonly port: number;
/**
* @since v15.14.0
* @since v15.14.0, v14.18.0
*/

@@ -814,4 +980,4 @@ readonly flowlabel: number;

}
declare module 'node:net' {
export * from 'net';
declare module "node:net" {
export * from "net";
}
/**
* The `os` module provides operating system-related utility methods and
* The `node:os` module provides operating system-related utility methods and
* properties. It can be accessed using:
*
* ```js
* const os = require('os');
* const os = require('node:os');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/os.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/os.js)
*/
declare module 'os' {
declare module "os" {
interface CpuInfo {

@@ -30,6 +30,7 @@ model: string;

interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase {
family: 'IPv4';
family: "IPv4";
scopeid?: undefined;
}
interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase {
family: 'IPv6';
family: "IPv6";
scopeid: number;

@@ -41,3 +42,3 @@ }

gid: number;
shell: T;
shell: T | null;
homedir: T;

@@ -79,2 +80,3 @@ }

* Returns an array of objects containing information about each logical CPU core.
* The array will be empty if no CPU information is available, such as if the`/proc` file system is unavailable.
*

@@ -93,4 +95,4 @@ * The properties included on each object include:

* idle: 1070356870,
* irq: 0
* }
* irq: 0,
* },
* },

@@ -105,4 +107,4 @@ * {

* idle: 1071569080,
* irq: 0
* }
* irq: 0,
* },
* },

@@ -117,4 +119,4 @@ * {

* idle: 1070919370,
* irq: 0
* }
* irq: 0,
* },
* },

@@ -129,4 +131,4 @@ * {

* idle: 1070905480,
* irq: 20
* }
* irq: 20,
* },
* },

@@ -138,2 +140,5 @@ * ]

* are always 0.
*
* `os.cpus().length` should not be used to calculate the amount of parallelism
* available to an application. Use {@link availableParallelism} for this purpose.
* @since v0.3.3

@@ -143,2 +148,10 @@ */

/**
* Returns an estimate of the default amount of parallelism a program should use.
* Always returns a value greater than zero.
*
* This function is a small wrapper about libuv's [`uv_available_parallelism()`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_available_parallelism).
* @since v19.4.0, v18.14.0
*/
function availableParallelism(): number;
/**
* Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it

@@ -238,3 +251,3 @@ * returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.

*/
function userInfo(options: { encoding: 'buffer' }): UserInfo<Buffer>;
function userInfo(options: { encoding: "buffer" }): UserInfo<Buffer>;
function userInfo(options?: { encoding: BufferEncoding }): UserInfo<string>;

@@ -400,3 +413,4 @@ type SignalConstants = {

* Returns the operating system CPU architecture for which the Node.js binary was
* compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`.
* compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`,`'mips'`, `'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`,
* and `'x64'`.
*

@@ -416,4 +430,5 @@ * The return value is equivalent to `process.arch`.

/**
* Returns a string identifying the operating system platform. The value is set
* at compile time. Possible values are `'aix'`, `'darwin'`, `'freebsd'`,`'linux'`, `'openbsd'`, `'sunos'`, and `'win32'`.
* Returns a string identifying the operating system platform for which
* the Node.js binary was compiled. The value is set at compile time.
* Possible values are `'aix'`, `'darwin'`, `'freebsd'`,`'linux'`,`'openbsd'`, `'sunos'`, and `'win32'`.
*

@@ -428,2 +443,10 @@ * The return value is equivalent to `process.platform`.

/**
* Returns the machine type as a string, such as `arm`, `arm64`, `aarch64`,`mips`, `mips64`, `ppc64`, `ppc64le`, `s390`, `s390x`, `i386`, `i686`, `x86_64`.
*
* On POSIX systems, the machine type is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not
* available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
* @since v18.9.0, v16.18.0
*/
function machine(): string;
/**
* Returns the operating system's default directory for temporary files as a

@@ -441,3 +464,3 @@ * string.

*/
function endianness(): 'BE' | 'LE';
function endianness(): "BE" | "LE";
/**

@@ -467,4 +490,4 @@ * Returns the scheduling priority for the process specified by `pid`. If `pid` is

}
declare module 'node:os' {
export * from 'os';
declare module "node:os" {
export * from "os";
}
{
"name": "@types/node",
"version": "16.11.12",
"description": "TypeScript definitions for Node.js",
"version": "20.10.0",
"description": "TypeScript definitions for node",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",

@@ -10,209 +10,199 @@ "license": "MIT",

"name": "Microsoft TypeScript",
"url": "https://github.com/Microsoft",
"githubUsername": "Microsoft"
"githubUsername": "Microsoft",
"url": "https://github.com/Microsoft"
},
{
"name": "DefinitelyTyped",
"url": "https://github.com/DefinitelyTyped",
"githubUsername": "DefinitelyTyped"
},
{
"name": "Alberto Schiabel",
"url": "https://github.com/jkomyno",
"githubUsername": "jkomyno"
"githubUsername": "jkomyno",
"url": "https://github.com/jkomyno"
},
{
"name": "Alvis HT Tang",
"url": "https://github.com/alvis",
"githubUsername": "alvis"
"githubUsername": "alvis",
"url": "https://github.com/alvis"
},
{
"name": "Andrew Makarov",
"url": "https://github.com/r3nya",
"githubUsername": "r3nya"
"githubUsername": "r3nya",
"url": "https://github.com/r3nya"
},
{
"name": "Benjamin Toueg",
"url": "https://github.com/btoueg",
"githubUsername": "btoueg"
"githubUsername": "btoueg",
"url": "https://github.com/btoueg"
},
{
"name": "Chigozirim C.",
"url": "https://github.com/smac89",
"githubUsername": "smac89"
"githubUsername": "smac89",
"url": "https://github.com/smac89"
},
{
"name": "David Junger",
"url": "https://github.com/touffy",
"githubUsername": "touffy"
"githubUsername": "touffy",
"url": "https://github.com/touffy"
},
{
"name": "Deividas Bakanas",
"url": "https://github.com/DeividasBakanas",
"githubUsername": "DeividasBakanas"
"githubUsername": "DeividasBakanas",
"url": "https://github.com/DeividasBakanas"
},
{
"name": "Eugene Y. Q. Shen",
"url": "https://github.com/eyqs",
"githubUsername": "eyqs"
"githubUsername": "eyqs",
"url": "https://github.com/eyqs"
},
{
"name": "Hannes Magnusson",
"url": "https://github.com/Hannes-Magnusson-CK",
"githubUsername": "Hannes-Magnusson-CK"
"githubUsername": "Hannes-Magnusson-CK",
"url": "https://github.com/Hannes-Magnusson-CK"
},
{
"name": "Huw",
"url": "https://github.com/hoo29",
"githubUsername": "hoo29"
"githubUsername": "hoo29",
"url": "https://github.com/hoo29"
},
{
"name": "Kelvin Jin",
"url": "https://github.com/kjin",
"githubUsername": "kjin"
"githubUsername": "kjin",
"url": "https://github.com/kjin"
},
{
"name": "Klaus Meinhardt",
"url": "https://github.com/ajafff",
"githubUsername": "ajafff"
"githubUsername": "ajafff",
"url": "https://github.com/ajafff"
},
{
"name": "Lishude",
"url": "https://github.com/islishude",
"githubUsername": "islishude"
"githubUsername": "islishude",
"url": "https://github.com/islishude"
},
{
"name": "Mariusz Wiktorczyk",
"url": "https://github.com/mwiktorczyk",
"githubUsername": "mwiktorczyk"
"githubUsername": "mwiktorczyk",
"url": "https://github.com/mwiktorczyk"
},
{
"name": "Mohsen Azimi",
"url": "https://github.com/mohsen1",
"githubUsername": "mohsen1"
"githubUsername": "mohsen1",
"url": "https://github.com/mohsen1"
},
{
"name": "Nicolas Even",
"url": "https://github.com/n-e",
"githubUsername": "n-e"
"githubUsername": "n-e",
"url": "https://github.com/n-e"
},
{
"name": "Nikita Galkin",
"url": "https://github.com/galkin",
"githubUsername": "galkin"
"githubUsername": "galkin",
"url": "https://github.com/galkin"
},
{
"name": "Parambir Singh",
"url": "https://github.com/parambirs",
"githubUsername": "parambirs"
"githubUsername": "parambirs",
"url": "https://github.com/parambirs"
},
{
"name": "Sebastian Silbermann",
"url": "https://github.com/eps1lon",
"githubUsername": "eps1lon"
"githubUsername": "eps1lon",
"url": "https://github.com/eps1lon"
},
{
"name": "Seth Westphal",
"url": "https://github.com/westy92",
"githubUsername": "westy92"
},
{
"name": "Simon Schick",
"url": "https://github.com/SimonSchick",
"githubUsername": "SimonSchick"
},
{
"name": "Thomas den Hollander",
"url": "https://github.com/ThomasdenH",
"githubUsername": "ThomasdenH"
"githubUsername": "ThomasdenH",
"url": "https://github.com/ThomasdenH"
},
{
"name": "Wilco Bakker",
"url": "https://github.com/WilcoBakker",
"githubUsername": "WilcoBakker"
"githubUsername": "WilcoBakker",
"url": "https://github.com/WilcoBakker"
},
{
"name": "wwwy3y3",
"url": "https://github.com/wwwy3y3",
"githubUsername": "wwwy3y3"
"githubUsername": "wwwy3y3",
"url": "https://github.com/wwwy3y3"
},
{
"name": "Samuel Ainsworth",
"url": "https://github.com/samuela",
"githubUsername": "samuela"
"githubUsername": "samuela",
"url": "https://github.com/samuela"
},
{
"name": "Kyle Uehlein",
"url": "https://github.com/kuehlein",
"githubUsername": "kuehlein"
"githubUsername": "kuehlein",
"url": "https://github.com/kuehlein"
},
{
"name": "Thanik Bhongbhibhat",
"url": "https://github.com/bhongy",
"githubUsername": "bhongy"
"githubUsername": "bhongy",
"url": "https://github.com/bhongy"
},
{
"name": "Marcin Kopacz",
"url": "https://github.com/chyzwar",
"githubUsername": "chyzwar"
"githubUsername": "chyzwar",
"url": "https://github.com/chyzwar"
},
{
"name": "Trivikram Kamat",
"url": "https://github.com/trivikr",
"githubUsername": "trivikr"
"githubUsername": "trivikr",
"url": "https://github.com/trivikr"
},
{
"name": "Junxiao Shi",
"url": "https://github.com/yoursunny",
"githubUsername": "yoursunny"
"githubUsername": "yoursunny",
"url": "https://github.com/yoursunny"
},
{
"name": "Ilia Baryshnikov",
"url": "https://github.com/qwelias",
"githubUsername": "qwelias"
"githubUsername": "qwelias",
"url": "https://github.com/qwelias"
},
{
"name": "ExE Boss",
"url": "https://github.com/ExE-Boss",
"githubUsername": "ExE-Boss"
"githubUsername": "ExE-Boss",
"url": "https://github.com/ExE-Boss"
},
{
"name": "Surasak Chaisurin",
"url": "https://github.com/Ryan-Willpower",
"githubUsername": "Ryan-Willpower"
},
{
"name": "Piotr Błażejewicz",
"url": "https://github.com/peterblazejewicz",
"githubUsername": "peterblazejewicz"
"githubUsername": "peterblazejewicz",
"url": "https://github.com/peterblazejewicz"
},
{
"name": "Anna Henningsen",
"url": "https://github.com/addaleax",
"githubUsername": "addaleax"
"githubUsername": "addaleax",
"url": "https://github.com/addaleax"
},
{
"name": "Victor Perin",
"url": "https://github.com/victorperin",
"githubUsername": "victorperin"
"githubUsername": "victorperin",
"url": "https://github.com/victorperin"
},
{
"name": "Yongsheng Zhang",
"url": "https://github.com/ZYSzys",
"githubUsername": "ZYSzys"
"githubUsername": "ZYSzys",
"url": "https://github.com/ZYSzys"
},
{
"name": "NodeJS Contributors",
"url": "https://github.com/NodeJS",
"githubUsername": "NodeJS"
"githubUsername": "NodeJS",
"url": "https://github.com/NodeJS"
},
{
"name": "Linus Unnebäck",
"url": "https://github.com/LinusU",
"githubUsername": "LinusU"
"githubUsername": "LinusU",
"url": "https://github.com/LinusU"
},
{
"name": "wafuwafu13",
"url": "https://github.com/wafuwafu13",
"githubUsername": "wafuwafu13"
"githubUsername": "wafuwafu13",
"url": "https://github.com/wafuwafu13"
},
{
"name": "Matteo Collina",
"githubUsername": "mcollina",
"url": "https://github.com/mcollina"
},
{
"name": "Dmitry Semigradsky",
"githubUsername": "Semigradsky",
"url": "https://github.com/Semigradsky"
}

@@ -222,2 +212,9 @@ ],

"types": "index.d.ts",
"typesVersions": {
"<=4.8": {
"*": [
"ts4.8/*"
]
}
},
"repository": {

@@ -229,5 +226,8 @@ "type": "git",

"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "66478bcf856b451a83d797fa3c4495aeb7e18e217db90d6545b2711843bfe71c",
"typeScriptVersion": "3.8"
"dependencies": {
"undici-types": "~5.26.4"
},
"typesPublisherContentHash": "113c7907419784bd540719fa975d139f836a902f43f8f562120dc8ec3fa551c2",
"typeScriptVersion": "4.5",
"nonNpm": true
}

@@ -1,19 +0,19 @@

declare module 'path/posix' {
import path = require('path');
declare module "path/posix" {
import path = require("path");
export = path;
}
declare module 'path/win32' {
import path = require('path');
declare module "path/win32" {
import path = require("path");
export = path;
}
/**
* The `path` module provides utilities for working with file and directory paths.
* It can be accessed using:
* The `node:path` module provides utilities for working with file and directory
* paths. It can be accessed using:
*
* ```js
* const path = require('path');
* const path = require('node:path');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/path.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/path.js)
*/
declare module 'path' {
declare module "path" {
namespace path {

@@ -72,14 +72,15 @@ /**

*
* @param p string path to normalize.
* @param path string path to normalize.
* @throws {TypeError} if `path` is not a string.
*/
normalize(p: string): string;
normalize(path: string): string;
/**
* Join all arguments together and normalize the resulting path.
* Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.
*
* @param paths paths to join.
* @throws {TypeError} if any of the path segments is not a string.
*/
join(...paths: string[]): string;
/**
* The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
* The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
*

@@ -93,14 +94,20 @@ * Starting from leftmost {from} parameter, resolves {to} to an absolute path.

*
* @param pathSegments string paths to join. Non-string arguments are ignored.
* @param paths A sequence of paths or path segments.
* @throws {TypeError} if any of the arguments is not a string.
*/
resolve(...pathSegments: string[]): string;
resolve(...paths: string[]): string;
/**
* 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(p: string): boolean;
isAbsolute(path: string): boolean;
/**
* Solve the relative path from {from} to {to}.
* 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.
*/

@@ -111,5 +118,6 @@ relative(from: string, to: string): string;

*
* @param p the path to evaluate.
* @param path the path to evaluate.
* @throws {TypeError} if `path` is not a string.
*/
dirname(p: string): string;
dirname(path: string): string;
/**

@@ -119,33 +127,36 @@ * Return the last portion of a path. Similar to the Unix basename command.

*
* @param p the path to evaluate.
* @param ext optionally, an extension to remove from the result.
* @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(p: string, ext?: string): 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
* 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 p the path to evaluate.
* @param path the path to evaluate.
* @throws {TypeError} if `path` is not a string.
*/
extname(p: string): string;
extname(path: string): string;
/**
* The platform-specific file separator. '\\' or '/'.
*/
readonly sep: string;
readonly sep: "\\" | "/";
/**
* The platform-specific file delimiter. ';' or ':'.
*/
readonly delimiter: string;
readonly delimiter: ";" | ":";
/**
* Returns an object from a path string - the opposite of format().
*
* @param pathString path to evaluate.
* @param path path to evaluate.
* @throws {TypeError} if `path` is not a string.
*/
parse(p: string): ParsedPath;
parse(path: string): ParsedPath;
/**
* Returns a path string from an object - the opposite of parse().
*
* @param pathString path to evaluate.
* @param pathObject path to evaluate.
*/
format(pP: FormatInputPathObject): string;
format(pathObject: FormatInputPathObject): string;
/**

@@ -173,5 +184,13 @@ * On Windows systems only, returns an equivalent namespace-prefixed path for the given path.

}
declare module 'node:path' {
import path = require('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;
}

@@ -10,5 +10,6 @@ /**

* * [User Timing](https://www.w3.org/TR/user-timing/)
* * [Resource Timing](https://www.w3.org/TR/resource-timing-2/)
*
* ```js
* const { PerformanceObserver, performance } = require('perf_hooks');
* const { PerformanceObserver, performance } = require('node:perf_hooks');
*

@@ -30,7 +31,7 @@ * const obs = new PerformanceObserver((items) => {

* ```
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/perf_hooks.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/perf_hooks.js)
*/
declare module 'perf_hooks' {
import { AsyncResource } from 'node:async_hooks';
type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http';
declare module "perf_hooks" {
import { AsyncResource } from "node:async_hooks";
type EntryType = "node" | "mark" | "measure" | "gc" | "function" | "http2" | "http" | "dns" | "net";
interface NodeGCPerformanceDetail {

@@ -51,2 +52,3 @@ /**

/**
* The constructor of this class is not exposed to users directly.
* @since v8.5.0

@@ -91,4 +93,22 @@ */

readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type.
toJSON(): any;
}
/**
* Exposes marks created via the `Performance.mark()` method.
* @since v18.2.0, v16.17.0
*/
class PerformanceMark extends PerformanceEntry {
readonly duration: 0;
readonly entryType: "mark";
}
/**
* Exposes measures created via the `Performance.measure()` method.
*
* The constructor of this class is not exposed to users directly.
* @since v18.2.0, v16.17.0
*/
class PerformanceMeasure extends PerformanceEntry {
readonly entryType: "measure";
}
/**
* _This property is an extension by Node.js. It is not available in Web browsers._

@@ -153,3 +173,6 @@ *

*/
type EventLoopUtilityFunction = (util1?: EventLoopUtilization, util2?: EventLoopUtilization) => EventLoopUtilization;
type EventLoopUtilityFunction = (
util1?: EventLoopUtilization,
util2?: EventLoopUtilization,
) => EventLoopUtilization;
interface MarkOptions {

@@ -200,2 +223,31 @@ /**

/**
* If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline.
* If name is provided, removes only the named measure.
* @param name
* @since v16.7.0
*/
clearMeasures(name?: string): void;
/**
* Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`.
* If you are only interested in performance entries of certain types or that have certain names, see
* `performance.getEntriesByType()` and `performance.getEntriesByName()`.
* @since v16.7.0
*/
getEntries(): PerformanceEntry[];
/**
* Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
* whose `performanceEntry.name` is equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to `type`.
* @param name
* @param type
* @since v16.7.0
*/
getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
/**
* Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
* whose `performanceEntry.entryType` is equal to `type`.
* @param type
* @since v16.7.0
*/
getEntriesByType(type: EntryType): PerformanceEntry[];
/**
* Creates a new PerformanceMark entry in the Performance Timeline.

@@ -206,4 +258,5 @@ * A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark',

* @param name
* @return The PerformanceMark entry that was created
*/
mark(name?: string, options?: MarkOptions): void;
mark(name?: string, options?: MarkOptions): PerformanceMark;
/**

@@ -223,5 +276,6 @@ * Creates a new PerformanceMeasure entry in the Performance Timeline.

* @param endMark
* @return The PerformanceMeasure entry that was created
*/
measure(name: string, startMark?: string, endMark?: string): void;
measure(name: string, options: MeasureOptions): void;
measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure;
measure(name: string, options: MeasureOptions): PerformanceMeasure;
/**

@@ -260,4 +314,4 @@ * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones.

* performance,
* PerformanceObserver
* } = require('perf_hooks');
* PerformanceObserver,
* } = require('node:perf_hooks');
*

@@ -282,2 +336,4 @@ * const obs = new PerformanceObserver((perfObserverList, observer) => {

*
* performance.clearMarks();
* performance.clearMeasures();
* observer.disconnect();

@@ -301,4 +357,4 @@ * });

* performance,
* PerformanceObserver
* } = require('perf_hooks');
* PerformanceObserver,
* } = require('node:perf_hooks');
*

@@ -331,2 +387,5 @@ * const obs = new PerformanceObserver((perfObserverList, observer) => {

* console.log(perfObserverList.getEntriesByName('test', 'measure')); // []
*
* performance.clearMarks();
* performance.clearMeasures();
* observer.disconnect();

@@ -349,4 +408,4 @@ * });

* performance,
* PerformanceObserver
* } = require('perf_hooks');
* PerformanceObserver,
* } = require('node:perf_hooks');
*

@@ -371,2 +430,4 @@ * const obs = new PerformanceObserver((perfObserverList, observer) => {

*
* performance.clearMarks();
* performance.clearMeasures();
* observer.disconnect();

@@ -384,2 +445,5 @@ * });

type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void;
/**
* @since v8.5.0
*/
class PerformanceObserver extends AsyncResource {

@@ -398,7 +462,7 @@ constructor(callback: PerformanceObserverCallback);

* performance,
* PerformanceObserver
* } = require('perf_hooks');
* PerformanceObserver,
* } = require('node:perf_hooks');
*
* const obs = new PerformanceObserver((list, observer) => {
* // Called three times synchronously. `list` contains one item.
* // Called once asynchronously. `list` contains three items.
* });

@@ -415,7 +479,9 @@ * obs.observe({ type: 'mark' });

| {
entryTypes: ReadonlyArray<EntryType>;
}
entryTypes: readonly EntryType[];
buffered?: boolean | undefined;
}
| {
type: EntryType;
}
type: EntryType;
buffered?: boolean | undefined;
},
): void;

@@ -505,3 +571,3 @@ }

/**
* @since v15.9.0
* @since v15.9.0, v14.18.0
* @param val The amount to record in the histogram.

@@ -515,5 +581,10 @@ */

* ## Examples
* @since v15.9.0
* @since v15.9.0, v14.18.0
*/
recordDelta(): void;
/**
* Adds the values from `other` to this histogram.
* @since v17.4.0, v16.14.0
*/
add(other: RecordableHistogram): void;
}

@@ -533,3 +604,3 @@ /**

* ```js
* const { monitorEventLoopDelay } = require('perf_hooks');
* const { monitorEventLoopDelay } = require('node:perf_hooks');
* const h = monitorEventLoopDelay({ resolution: 20 });

@@ -569,8 +640,21 @@ * h.enable();

* Returns a `RecordableHistogram`.
* @since v15.9.0
* @since v15.9.0, v14.18.0
*/
function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
import { performance as _performance } from "perf_hooks";
global {
/**
* `performance` is a global reference for `require('perf_hooks').performance`
* https://nodejs.org/api/globals.html#performance
* @since v16.0.0
*/
var performance: typeof globalThis extends {
onmessage: any;
performance: infer T;
} ? T
: typeof _performance;
}
}
declare module 'node:perf_hooks' {
export * from 'perf_hooks';
declare module "node:perf_hooks" {
export * from "perf_hooks";
}

@@ -27,5 +27,5 @@ /**

* @deprecated Since v7.0.0 - Deprecated
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/punycode.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/punycode.js)
*/
declare module 'punycode' {
declare module "punycode" {
/**

@@ -105,3 +105,3 @@ * The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only

*/
encode(codePoints: ReadonlyArray<number>): string;
encode(codePoints: readonly number[]): string;
}

@@ -117,4 +117,4 @@ /**

}
declare module 'node:punycode' {
export * from 'punycode';
declare module "node:punycode" {
export * from "punycode";
}
/**
* The `querystring` module provides utilities for parsing and formatting URL
* The `node:querystring` module provides utilities for parsing and formatting URL
* query strings. It can be accessed using:
*
* ```js
* const querystring = require('querystring');
* const querystring = require('node:querystring');
* ```
*
* The `querystring` API is considered Legacy. While it is still maintained,
* new code should use the `URLSearchParams` API instead.
* @deprecated Legacy
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/querystring.js)
* `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/v20.2.0/lib/querystring.js)
*/
declare module 'querystring' {
declare module "querystring" {
interface StringifyOptions {

@@ -23,3 +23,13 @@ encodeURIComponent?: ((str: string) => string) | undefined;

interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> {}
interface ParsedUrlQueryInput extends NodeJS.Dict<string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<boolean> | null> {}
interface ParsedUrlQueryInput extends
NodeJS.Dict<
| string
| number
| boolean
| readonly string[]
| readonly number[]
| readonly boolean[]
| null
>
{}
/**

@@ -130,4 +140,4 @@ * The `querystring.stringify()` method produces a URL query string from a

}
declare module 'node:querystring' {
export * from 'querystring';
declare module "node:querystring" {
export * from "querystring";
}
/**
* The `readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time. It can be accessed
* using:
* The `node:readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time.
*
* To use the promise-based APIs:
*
* ```js
* const readline = require('readline');
* import * as readline from 'node:readline/promises';
* ```
*
* The following simple example illustrates the basic use of the `readline` module.
* To use the callback and sync APIs:
*
* ```js
* const readline = require('readline');
* import * as readline from 'node:readline';
* ```
*
* const rl = readline.createInterface({
* input: process.stdin,
* output: process.stdout
* });
* The following simple example illustrates the basic use of the `node:readline`module.
*
* rl.question('What do you think of Node.js? ', (answer) => {
* // TODO: Log the answer in a database
* console.log(`Thank you for your valuable feedback: ${answer}`);
* ```js
* import * as readline from 'node:readline/promises';
* import { stdin as input, stdout as output } from 'node:process';
*
* rl.close();
* });
* const rl = readline.createInterface({ input, output });
*
* const answer = await rl.question('What do you think of Node.js? ');
*
* console.log(`Thank you for your valuable feedback: ${answer}`);
*
* rl.close();
* ```

@@ -29,7 +33,9 @@ *

* received on the `input` stream.
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/readline.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/readline.js)
*/
declare module 'readline' {
import { Abortable, EventEmitter } 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;

@@ -48,3 +54,3 @@ name?: string | undefined;

*/
class Interface extends EventEmitter {
export class Interface extends EventEmitter {
readonly terminal: boolean;

@@ -72,3 +78,3 @@ /**

* '\n',
* values.filter((val) => val.startsWith(rl.line)).join(' ')
* values.filter((val) => val.startsWith(rl.line)).join(' '),
* );

@@ -99,5 +105,10 @@ * }, 300);

*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
* @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor
*/
protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean);
protected constructor(
input: NodeJS.ReadableStream,
output?: NodeJS.WritableStream,
completer?: Completer | AsyncCompleter,
terminal?: boolean,
);
/**

@@ -109,3 +120,3 @@ * NOTE: According to the documentation:

*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
* @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor
*/

@@ -115,3 +126,3 @@ protected constructor(options: ReadLineOptions);

* The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`.
* @since v15.3.0
* @since v15.3.0, v14.17.0
* @return the current prompt string

@@ -126,3 +137,3 @@ */

/**
* The `rl.prompt()` method writes the `readline.Interface` instances configured`prompt` to a new line in `output` in order to provide a user with a new
* The `rl.prompt()` method writes the `Interface` instances configured`prompt` to a new line in `output` in order to provide a user with a new
* location at which to provide input.

@@ -133,3 +144,3 @@ *

*
* If the `readline.Interface` was created with `output` set to `null` or`undefined` the prompt is not written.
* If the `Interface` was created with `output` set to `null` or`undefined` the prompt is not written.
* @since v0.1.98

@@ -146,3 +157,3 @@ * @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`.

*
* If the `readline.Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
* If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
*

@@ -153,2 +164,4 @@ * The `callback` function passed to `rl.question()` does not follow the typical

*
* An error will be thrown if calling `rl.question()` after `rl.close()`.
*
* Example usage:

@@ -178,21 +191,2 @@ *

* ```
*
* If this method is invoked as it's util.promisify()ed version, it returns a
* Promise that fulfills with the answer. If the question is canceled using
* an `AbortController` it will reject with an `AbortError`.
*
* ```js
* const util = require('util');
* const question = util.promisify(rl.question).bind(rl);
*
* async function questionExample() {
* try {
* const answer = await question('What is you favorite food? ');
* console.log(`Oh, so your favorite food is ${answer}`);
* } catch (err) {
* console.error('Question rejected', err);
* }
* }
* questionExample();
* ```
* @since v0.3.3

@@ -208,3 +202,3 @@ * @param query A statement or query to write to `output`, prepended to the prompt.

*
* Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `readline.Interface` instance.
* Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `Interface` instance.
* @since v0.3.4

@@ -219,3 +213,3 @@ */

/**
* The `rl.close()` method closes the `readline.Interface` instance and
* The `rl.close()` method closes the `Interface` instance and
* relinquishes control over the `input` and `output` streams. When called,

@@ -225,3 +219,3 @@ * the `'close'` event will be emitted.

* Calling `rl.close()` does not immediately stop other events (including `'line'`)
* from being emitted by the `readline.Interface` instance.
* from being emitted by the `Interface` instance.
* @since v0.1.98

@@ -241,3 +235,3 @@ */

*
* If the `readline.Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written.
* If the `Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written.
*

@@ -274,62 +268,65 @@ * ```js

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;
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;
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;
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;
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;
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;
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](): AsyncIterableIterator<string>;
}
type ReadLine = Interface; // type forwarded for backwards compatibility
type Completer = (line: string) => CompleterResult;
type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => void;
type CompleterResult = [string[], string];
interface ReadLineOptions {
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;
export type CompleterResult = [string[], string];
export interface ReadLineOptions {
input: NodeJS.ReadableStream;

@@ -363,6 +360,6 @@ output?: NodeJS.WritableStream | undefined;

* ```js
* const readline = require('readline');
* const readline = require('node:readline');
* const rl = readline.createInterface({
* input: process.stdin,
* output: process.stdout
* output: process.stdout,
* });

@@ -386,14 +383,13 @@ * ```

* When creating a `readline.Interface` using `stdin` as input, the program
* will not terminate until it receives `EOF` (Ctrl+D on
* Linux/macOS, Ctrl+Z followed by Return on
* Windows).
* If you want your application to exit without waiting for user input, you can `unref()` the standard input stream:
*
* ```js
* process.stdin.unref();
* ```
* will not terminate until it receives an [EOF character](https://en.wikipedia.org/wiki/End-of-file#EOF_character). To exit without
* waiting for user input, call `process.stdin.unref()`.
* @since v0.1.98
*/
function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
function createInterface(options: ReadLineOptions): Interface;
export function createInterface(
input: NodeJS.ReadableStream,
output?: NodeJS.WritableStream,
completer?: Completer | AsyncCompleter,
terminal?: boolean,
): Interface;
export function createInterface(options: ReadLineOptions): Interface;
/**

@@ -415,37 +411,2 @@ * The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input.

* ```
* @since v0.7.7
*/
function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
type Direction = -1 | 0 | 1;
interface CursorPos {
rows: number;
cols: number;
}
/**
* The `readline.clearLine()` method clears current line of given `TTY` 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;
/**
* The `readline.clearScreenDown()` method clears the given `TTY` 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;
/**
* The `readline.cursorTo()` method moves cursor to the specified position in a
* given `TTY` `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;
/**
* The `readline.moveCursor()` method moves the cursor _relative_ to its current
* position in a given `TTY` `stream`.
*

@@ -458,7 +419,7 @@ * ## Example: Tiny CLI

* ```js
* const readline = require('readline');
* const readline = require('node:readline');
* const rl = readline.createInterface({
* input: process.stdin,
* output: process.stdout,
* prompt: 'OHAI> '
* prompt: 'OHAI> ',
* });

@@ -491,4 +452,4 @@ *

* ```js
* const fs = require('fs');
* const readline = require('readline');
* const fs = require('node:fs');
* const readline = require('node:readline');
*

@@ -500,3 +461,3 @@ * async function processLineByLine() {

* input: fileStream,
* crlfDelay: Infinity
* crlfDelay: Infinity,
* });

@@ -518,8 +479,8 @@ * // Note: we use the crlfDelay option to recognize all instances of CR LF

* ```js
* const fs = require('fs');
* const readline = require('readline');
* const fs = require('node:fs');
* const readline = require('node:readline');
*
* const rl = readline.createInterface({
* input: fs.createReadStream('sample.txt'),
* crlfDelay: Infinity
* crlfDelay: Infinity,
* });

@@ -535,5 +496,5 @@ *

* ```js
* const { once } = require('events');
* const { createReadStream } = require('fs');
* const { createInterface } = require('readline');
* const { once } = require('node:events');
* const { createReadStream } = require('node:fs');
* const { createInterface } = require('node:readline');
*

@@ -544,3 +505,3 @@ * (async function processLineByLine() {

* input: createReadStream('big-file.txt'),
* crlfDelay: Infinity
* crlfDelay: Infinity,
* });

@@ -561,9 +522,44 @@ *

* @since v0.7.7
*/
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` 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 moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
/**
* The `readline.clearScreenDown()` method clears the given `TTY` 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`.
*/
export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
/**
* The `readline.cursorTo()` method moves cursor to the specified position in a
* given `TTY` `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`.
*/
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` `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`.
*/
export function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
}
declare module 'node:readline' {
export * from 'readline';
declare module "node:readline" {
export * from "readline";
}

@@ -5,3 +5,3 @@ # Installation

# Summary
This package contains type definitions for Node.js (https://nodejs.org/).
This package contains type definitions for node (https://nodejs.org/).

@@ -12,7 +12,6 @@ # Details

### Additional Details
* Last updated: Tue, 07 Dec 2021 06:31:07 GMT
* Dependencies: none
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
* Last updated: Fri, 24 Nov 2023 09:07:15 GMT
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
# Credits
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Seth Westphal](https://github.com/westy92), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), and [wafuwafu13](https://github.com/wafuwafu13).
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).
/**
* The `repl` module provides a Read-Eval-Print-Loop (REPL) implementation that
* is available both as a standalone program or includible in other applications.
* It can be accessed using:
* The `node:repl` module provides a Read-Eval-Print-Loop (REPL) implementation
* that is available both as a standalone program or includible in other
* applications. It can be accessed using:
*
* ```js
* const repl = require('repl');
* const repl = require('node:repl');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/repl.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/repl.js)
*/
declare module 'repl' {
import { Interface, Completer, AsyncCompleter } from 'node:readline';
import { Context } from 'node:vm';
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 {

@@ -44,4 +44,4 @@ /**

*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_default_evaluation
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_custom_evaluation_functions
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_default_evaluation
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_custom_evaluation_functions
*/

@@ -78,3 +78,3 @@ eval?: REPLEval | undefined;

*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_customizing_repl_output
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_customizing_repl_output
*/

@@ -85,3 +85,3 @@ writer?: REPLWriter | undefined;

*
* @see https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function
* @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#readline_use_of_the_completer_function
*/

@@ -105,3 +105,9 @@ completer?: Completer | AsyncCompleter | undefined;

}
type REPLEval = (this: REPLServer, evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void;
type REPLEval = (
this: REPLServer,
evalCmd: string,
context: Context,
file: string,
cb: (err: Error | null, result: any) => void,
) => void;
type REPLWriter = (this: REPLServer, obj: any) => string;

@@ -131,3 +137,3 @@ /**

* ```js
* const repl = require('repl');
* const repl = require('node:repl');
*

@@ -170,3 +176,3 @@ * const options = { useColors: true };

*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_commands_and_special_keys
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_commands_and_special_keys
*/

@@ -177,3 +183,3 @@ readonly editorMode: boolean;

*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/

@@ -184,3 +190,3 @@ readonly underscoreAssigned: boolean;

*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/

@@ -192,3 +198,3 @@ readonly last: any;

* @since v9.8.0
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/

@@ -200,3 +206,3 @@ readonly underscoreErrAssigned: boolean;

* @since v9.8.0
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/

@@ -253,3 +259,3 @@ readonly lastError: any;

*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_class_replserver
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_class_replserver
*/

@@ -265,3 +271,3 @@ private constructor();

* ```js
* const repl = require('repl');
* const repl = require('node:repl');
*

@@ -275,3 +281,3 @@ * const replServer = repl.start({ prompt: '> ' });

* this.displayPrompt();
* }
* },
* });

@@ -293,3 +299,3 @@ * replServer.defineCommand('saybye', function saybye() {

* @since v0.3.0
* @param keyword The command keyword (*without* a leading `.` character).
* @param keyword The command keyword (_without_ a leading `.` character).
* @param cmd The function to invoke when the command is processed.

@@ -343,61 +349,61 @@ */

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;
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;
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;
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;
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;
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;
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;
}

@@ -419,3 +425,3 @@ /**

* ```js
* const repl = require('repl');
* const repl = require('node:repl');
*

@@ -431,3 +437,3 @@ * // a Unix style prompt

*
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_recoverable_errors
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_recoverable_errors
*/

@@ -439,4 +445,4 @@ class Recoverable extends SyntaxError {

}
declare module 'node:repl' {
export * from 'repl';
declare module "node:repl" {
export * from "repl";
}

@@ -1,24 +0,12 @@

// Duplicates of interface in lib.dom.ts.
// Duplicated here rather than referencing lib.dom.ts because doing so causes lib.dom.ts to be loaded for "test-all"
// Which in turn causes tests to pass that shouldn't pass.
//
// This interface is not, and should not be, exported.
interface Blob {
readonly size: number;
readonly type: string;
arrayBuffer(): Promise<ArrayBuffer>;
slice(start?: number, end?: number, contentType?: string): Blob;
stream(): NodeJS.ReadableStream;
text(): Promise<string>;
declare module "stream/consumers" {
import { Blob as NodeBlob } from "node:buffer";
import { Readable } from "node:stream";
function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<Buffer>;
function text(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<string>;
function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<ArrayBuffer>;
function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<NodeBlob>;
function json(stream: NodeJS.ReadableStream | Readable | AsyncIterable<any>): Promise<unknown>;
}
declare module 'stream/consumers' {
import { Readable } from 'node:stream';
function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Buffer>;
function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<string>;
function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<ArrayBuffer>;
function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Blob>;
function json(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<unknown>;
declare module "node:stream/consumers" {
export * from "stream/consumers";
}
declare module 'node:stream/consumers' {
export * from 'stream/consumers';
}

@@ -1,12 +0,35 @@

declare module 'stream/promises' {
import { FinishedOptions, PipelineSource, PipelineTransform, PipelineDestination, PipelinePromise, PipelineOptions } from 'node:stream';
function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;
function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(source: A, destination: B, options?: PipelineOptions): PipelinePromise<B>;
function pipeline<A extends PipelineSource<any>, T1 extends PipelineTransform<A, any>, B extends PipelineDestination<T1, any>>(
declare module "stream/promises" {
import {
FinishedOptions,
PipelineDestination,
PipelineOptions,
PipelinePromise,
PipelineSource,
PipelineTransform,
} from "node:stream";
function finished(
stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream,
options?: FinishedOptions,
): Promise<void>;
function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(
source: A,
destination: B,
options?: PipelineOptions,
): PipelinePromise<B>;
function pipeline<
A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
B extends PipelineDestination<T1, any>,
>(
source: A,
transform1: T1,
destination: B,
options?: PipelineOptions
options?: PipelineOptions,
): PipelinePromise<B>;
function pipeline<A extends PipelineSource<any>, T1 extends PipelineTransform<A, any>, T2 extends PipelineTransform<T1, any>, B extends PipelineDestination<T2, any>>(
function pipeline<
A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
T2 extends PipelineTransform<T1, any>,
B extends PipelineDestination<T2, any>,
>(
source: A,

@@ -16,3 +39,3 @@ transform1: T1,

destination: B,
options?: PipelineOptions
options?: PipelineOptions,
): PipelinePromise<B>;

@@ -24,4 +47,11 @@ function pipeline<

T3 extends PipelineTransform<T2, any>,
B extends PipelineDestination<T3, any>
>(source: A, transform1: T1, transform2: T2, transform3: T3, destination: B, options?: PipelineOptions): PipelinePromise<B>;
B extends PipelineDestination<T3, any>,
>(
source: A,
transform1: T1,
transform2: T2,
transform3: T3,
destination: B,
options?: PipelineOptions,
): PipelinePromise<B>;
function pipeline<

@@ -33,6 +63,17 @@ A extends PipelineSource<any>,

T4 extends PipelineTransform<T3, any>,
B extends PipelineDestination<T4, any>
>(source: A, transform1: T1, transform2: T2, transform3: T3, transform4: T4, destination: B, options?: PipelineOptions): PipelinePromise<B>;
function pipeline(streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>, options?: PipelineOptions): Promise<void>;
B extends PipelineDestination<T4, any>,
>(
source: A,
transform1: T1,
transform2: T2,
transform3: T3,
transform4: T4,
destination: B,
options?: PipelineOptions,
): PipelinePromise<B>;
function pipeline(
streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>,
options?: PipelineOptions,
): Promise<void>;
function pipeline(
stream1: NodeJS.ReadableStream,

@@ -43,4 +84,4 @@ stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,

}
declare module 'node:stream/promises' {
export * from 'stream/promises';
declare module "node:stream/promises" {
export * from "stream/promises";
}

@@ -1,5 +0,4 @@

declare module 'stream/web' {
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> {

@@ -18,3 +17,2 @@ readable: ReadableStream<R>;

}
interface StreamPipeOptions {

@@ -67,3 +65,2 @@ preventAbort?: boolean;

}
interface ReadableStreamGenericReader {

@@ -73,3 +70,2 @@ readonly closed: Promise<undefined>;

}
interface ReadableStreamDefaultReadValueResult<T> {

@@ -79,3 +75,2 @@ done: false;

}
interface ReadableStreamDefaultReadDoneResult {

@@ -89,47 +84,44 @@ done: true;

| ReadableStreamDefaultReadDoneResult;
interface ReadableStreamReadValueResult<T> {
done: false;
value: T;
}
interface ReadableStreamReadDoneResult<T> {
done: true;
value?: T;
}
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
interface ReadableByteStreamControllerCallback {
(controller: ReadableByteStreamController): void | PromiseLike<void>;
}
interface UnderlyingSinkAbortCallback {
(reason?: any): void | PromiseLike<void>;
}
interface UnderlyingSinkCloseCallback {
(): void | PromiseLike<void>;
}
interface UnderlyingSinkStartCallback {
(controller: WritableStreamDefaultController): any;
}
interface UnderlyingSinkWriteCallback<W> {
(chunk: W, controller: WritableStreamDefaultController): void | PromiseLike<void>;
}
interface UnderlyingSourceCancelCallback {
(reason?: any): void | PromiseLike<void>;
}
interface UnderlyingSourcePullCallback<R> {
(controller: ReadableStreamController<R>): void | PromiseLike<void>;
}
interface UnderlyingSourceStartCallback<R> {
(controller: ReadableStreamController<R>): any;
}
interface TransformerFlushCallback<O> {
(controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
}
interface TransformerStartCallback<O> {
(controller: TransformStreamDefaultController<O>): any;
}
interface TransformerTransformCallback<I, O> {
(chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
}
interface UnderlyingByteSource {

@@ -140,5 +132,4 @@ autoAllocateChunkSize?: number;

start?: ReadableByteStreamControllerCallback;
type: 'bytes';
type: "bytes";
}
interface UnderlyingSource<R = any> {

@@ -150,3 +141,2 @@ cancel?: UnderlyingSourceCancelCallback;

}
interface UnderlyingSink<W = any> {

@@ -159,7 +149,5 @@ abort?: UnderlyingSinkAbortCallback;

}
interface ReadableStreamErrorCallback {
(reason: any): void | PromiseLike<void>;
}
/** This Streams API interface represents a readable stream of byte data. */

@@ -170,17 +158,14 @@ interface ReadableStream<R = any> {

getReader(): ReadableStreamDefaultReader<R>;
getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
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?: { preventCancel?: boolean }): AsyncIterableIterator<R>;
values(options?: { preventCancel?: boolean }): AsyncIterableIterator<R>;
[Symbol.asyncIterator](): AsyncIterableIterator<R>;
}
const ReadableStream: {
prototype: ReadableStream;
new (
underlyingSource: UnderlyingByteSource,
strategy?: QueuingStrategy<Uint8Array>,
): ReadableStream<Uint8Array>;
new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
new(underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;
new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
};
interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader {

@@ -190,11 +175,12 @@ read(): Promise<ReadableStreamDefaultReadResult<R>>;

}
interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
releaseLock(): void;
}
const ReadableStreamDefaultReader: {
prototype: ReadableStreamDefaultReader;
new <R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
new<R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
};
const ReadableStreamBYOBReader: any;
const ReadableStreamBYOBRequest: any;
interface ReadableByteStreamController {

@@ -207,8 +193,6 @@ readonly byobRequest: undefined;

}
const ReadableByteStreamController: {
prototype: ReadableByteStreamController;
new (): ReadableByteStreamController;
new(): ReadableByteStreamController;
};
interface ReadableStreamDefaultController<R = any> {

@@ -220,8 +204,6 @@ readonly desiredSize: number | null;

}
const ReadableStreamDefaultController: {
prototype: ReadableStreamDefaultController;
new (): ReadableStreamDefaultController;
new(): ReadableStreamDefaultController;
};
interface Transformer<I = any, O = any> {

@@ -234,3 +216,2 @@ flush?: TransformerFlushCallback<O>;

}
interface TransformStream<I = any, O = any> {

@@ -240,6 +221,5 @@ readonly readable: ReadableStream<O>;

}
const TransformStream: {
prototype: TransformStream;
new <I = any, O = any>(
new<I = any, O = any>(
transformer?: Transformer<I, O>,

@@ -250,3 +230,2 @@ writableStrategy?: QueuingStrategy<I>,

};
interface TransformStreamDefaultController<O = any> {

@@ -258,8 +237,6 @@ readonly desiredSize: number | null;

}
const TransformStreamDefaultController: {
prototype: TransformStreamDefaultController;
new (): TransformStreamDefaultController;
new(): TransformStreamDefaultController;
};
/**

@@ -276,8 +253,6 @@ * This Streams API interface provides a standard abstraction for writing

}
const WritableStream: {
prototype: WritableStream;
new <W = any>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
new<W = any>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
};
/**

@@ -298,8 +273,6 @@ * This Streams API interface is the object returned by

}
const WritableStreamDefaultWriter: {
prototype: WritableStreamDefaultWriter;
new <W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
new<W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
};
/**

@@ -314,8 +287,6 @@ * This Streams API interface represents a controller allowing control of a

}
const WritableStreamDefaultController: {
prototype: WritableStreamDefaultController;
new (): WritableStreamDefaultController;
new(): WritableStreamDefaultController;
};
interface QueuingStrategy<T = any> {

@@ -325,7 +296,5 @@ highWaterMark?: number;

}
interface QueuingStrategySize<T = any> {
(chunk?: T): number;
}
interface QueuingStrategyInit {

@@ -343,3 +312,2 @@ /**

}
/**

@@ -353,8 +321,6 @@ * This Streams API interface provides a built-in byte length queuing

}
const ByteLengthQueuingStrategy: {
prototype: ByteLengthQueuingStrategy;
new (init: QueuingStrategyInit): ByteLengthQueuingStrategy;
new(init: QueuingStrategyInit): ByteLengthQueuingStrategy;
};
/**

@@ -368,11 +334,9 @@ * This Streams API interface provides a built-in byte length queuing

}
const CountQueuingStrategy: {
prototype: CountQueuingStrategy;
new (init: QueuingStrategyInit): CountQueuingStrategy;
new(init: QueuingStrategyInit): CountQueuingStrategy;
};
interface TextEncoderStream {
/** Returns "utf-8". */
readonly encoding: 'utf-8';
readonly encoding: "utf-8";
readonly readable: ReadableStream<Uint8Array>;

@@ -382,8 +346,6 @@ readonly writable: WritableStream<string>;

}
const TextEncoderStream: {
prototype: TextEncoderStream;
new (): TextEncoderStream;
new(): TextEncoderStream;
};
interface TextDecoderOptions {

@@ -393,5 +355,3 @@ fatal?: boolean;

}
type BufferSource = ArrayBufferView | ArrayBuffer;
interface TextDecoderStream {

@@ -408,10 +368,9 @@ /** Returns encoding's name, lower cased. */

}
const TextDecoderStream: {
prototype: TextDecoderStream;
new (label?: string, options?: TextDecoderOptions): TextDecoderStream;
new(label?: string, options?: TextDecoderOptions): TextDecoderStream;
};
}
declare module 'node:stream/web' {
export * from 'stream/web';
declare module "node:stream/web" {
export * from "stream/web";
}
/**
* The `string_decoder` module provides an API for decoding `Buffer` objects into
* strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16
* The `node:string_decoder` module provides an API for decoding `Buffer` objects
* into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16
* characters. It can be accessed using:
*
* ```js
* const { StringDecoder } = require('string_decoder');
* const { StringDecoder } = require('node:string_decoder');
* ```

@@ -13,10 +13,10 @@ *

* ```js
* const { StringDecoder } = require('string_decoder');
* const { StringDecoder } = require('node:string_decoder');
* const decoder = new StringDecoder('utf8');
*
* const cent = Buffer.from([0xC2, 0xA2]);
* console.log(decoder.write(cent));
* console.log(decoder.write(cent)); // Prints: ¢
*
* const euro = Buffer.from([0xE2, 0x82, 0xAC]);
* console.log(decoder.write(euro));
* console.log(decoder.write(euro)); // Prints: €
* ```

@@ -33,3 +33,3 @@ *

* ```js
* const { StringDecoder } = require('string_decoder');
* const { StringDecoder } = require('node:string_decoder');
* const decoder = new StringDecoder('utf8');

@@ -39,7 +39,7 @@ *

* decoder.write(Buffer.from([0x82]));
* console.log(decoder.end(Buffer.from([0xAC])));
* console.log(decoder.end(Buffer.from([0xAC]))); // Prints: €
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/string_decoder.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/string_decoder.js)
*/
declare module 'string_decoder' {
declare module "string_decoder" {
class StringDecoder {

@@ -52,3 +52,3 @@ constructor(encoding?: BufferEncoding);

* @since v0.1.99
* @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
* @param buffer The bytes to decode.
*/

@@ -64,3 +64,3 @@ write(buffer: Buffer): string;

* @since v0.9.3
* @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
* @param buffer The bytes to decode.
*/

@@ -70,4 +70,4 @@ end(buffer?: Buffer): string;

}
declare module 'node:string_decoder' {
export * from 'string_decoder';
declare module "node:string_decoder" {
export * from "string_decoder";
}
/**
* The `timer` module exposes a global API for scheduling functions to
* be called at some future period of time. Because the timer functions are
* globals, there is no need to call `require('timers')` to use the API.
* globals, there is no need to call `require('node:timers')` to use the API.
*

@@ -9,7 +9,11 @@ * The timer functions within Node.js implement a similar API as the timers API

* 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/v16.9.0/lib/timers.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/timers.js)
*/
declare module 'timers' {
import { Abortable } from 'node:events';
import { setTimeout as setTimeoutPromise, setImmediate as setImmediatePromise, setInterval as setIntervalPromise } from 'node:timers/promises';
declare module "timers" {
import { Abortable } from "node:events";
import {
setImmediate as setImmediatePromise,
setInterval as setIntervalPromise,
setTimeout as setTimeoutPromise,
} from "node:timers/promises";
interface TimerOptions extends Abortable {

@@ -37,4 +41,32 @@ /**

}
interface Immediate extends RefCounted {
/**
* This object is created internally and is returned from `setImmediate()`. It
* can be passed to `clearImmediate()` in order to cancel the scheduled
* actions.
*
* By default, when an immediate is scheduled, the Node.js event loop will continue
* running as long as the immediate is active. The `Immediate` object returned by `setImmediate()` exports both `immediate.ref()` and `immediate.unref()`functions that can be used to
* control this default behavior.
*/
class Immediate implements RefCounted {
/**
* When called, requests that the Node.js event loop _not_ exit so long as the`Immediate` is active. Calling `immediate.ref()` multiple times will have no
* effect.
*
* By default, all `Immediate` objects are "ref'ed", making it normally unnecessary
* to call `immediate.ref()` unless `immediate.unref()` had been called previously.
* @since v9.7.0
* @return a reference to `immediate`
*/
ref(): this;
/**
* When called, the active `Immediate` object will not require the Node.js event
* loop to remain active. If there is no other activity keeping the event loop
* running, the process may exit before the `Immediate` object's callback is
* invoked. Calling `immediate.unref()` multiple times will have no effect.
* @since v9.7.0
* @return a reference to `immediate`
*/
unref(): this;
/**
* If true, the `Immediate` object will keep the Node.js event loop active.

@@ -45,5 +77,36 @@ * @since v11.0.0

_onImmediate: Function; // to distinguish it from the Timeout class
/**
* Cancels the immediate. This is similar to calling `clearImmediate()`.
* @since v20.5.0
*/
[Symbol.dispose](): void;
}
interface Timeout extends Timer {
/**
* This object is created internally and is returned from `setTimeout()` and `setInterval()`. It can be passed to either `clearTimeout()` or `clearInterval()` in order to cancel the
* scheduled actions.
*
* By default, when a timer is scheduled using either `setTimeout()` or `setInterval()`, the Node.js event loop will continue running as long as the
* timer is active. Each of the `Timeout` objects returned by these functions
* export both `timeout.ref()` and `timeout.unref()` functions that can be used to
* control this default behavior.
*/
class Timeout implements Timer {
/**
* When called, requests that the Node.js event loop _not_ exit so long as the`Timeout` is active. Calling `timeout.ref()` multiple times will have no effect.
*
* By default, all `Timeout` objects are "ref'ed", making it normally unnecessary
* to call `timeout.ref()` unless `timeout.unref()` had been called previously.
* @since v0.9.1
* @return a reference to `timeout`
*/
ref(): this;
/**
* When called, the active `Timeout` object will not require the Node.js event loop
* to remain active. If there is no other activity keeping the event loop running,
* the process may exit before the `Timeout` object's callback is invoked. Calling`timeout.unref()` multiple times will have no effect.
* @since v0.9.1
* @return a reference to `timeout`
*/
unref(): this;
/**
* If true, the `Timeout` object will keep the Node.js event loop active.

@@ -66,7 +129,35 @@ * @since v11.0.0

[Symbol.toPrimitive](): number;
/**
* Cancels the timeout.
* @since v20.5.0
*/
[Symbol.dispose](): void;
}
}
function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): 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`, 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=1] The number of milliseconds to wait before calling the `callback`.
* @param args Optional arguments to pass when the `callback` is called.
* @return for use with {@link clearTimeout}
*/
function setTimeout<TArgs extends any[]>(
callback: (...args: TArgs) => void,
ms?: number,
...args: TArgs
): NodeJS.Timeout;
// util.promisify no rest args compability
// tslint:disable-next-line void-return
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout;

@@ -76,14 +167,64 @@ namespace setTimeout {

}
function clearTimeout(timeoutId: NodeJS.Timeout): void;
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
/**
* Cancels a `Timeout` object created by `setTimeout()`.
* @since v0.0.1
* @param timeout A `Timeout` object as returned by {@link setTimeout} or the `primitive` of the `Timeout` object as a string or a number.
*/
function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
/**
* Schedules repeated execution of `callback` every `delay` milliseconds.
*
* When `delay` is larger than `2147483647` or less than `1`, 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=1] The number of milliseconds to wait before calling the `callback`.
* @param args Optional arguments to pass when the `callback` is called.
* @return for use with {@link clearInterval}
*/
function setInterval<TArgs extends any[]>(
callback: (...args: TArgs) => void,
ms?: number,
...args: TArgs
): NodeJS.Timeout;
// util.promisify no rest args compability
// tslint:disable-next-line void-return
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timer;
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
namespace setInterval {
const __promisify__: typeof setIntervalPromise;
}
function clearInterval(intervalId: NodeJS.Timeout): void;
function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
/**
* Cancels a `Timeout` object created by `setInterval()`.
* @since v0.0.1
* @param timeout A `Timeout` object as returned by {@link setInterval} or the `primitive` of the `Timeout` object as a string or a number.
*/
function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): 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`
* @param args Optional arguments to pass when the `callback` is called.
* @return for use with {@link clearImmediate}
*/
function setImmediate<TArgs extends any[]>(
callback: (...args: TArgs) => void,
...args: TArgs
): NodeJS.Immediate;
// util.promisify no rest args compability
// tslint:disable-next-line void-return
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
function setImmediate(callback: (args: void) => void): NodeJS.Immediate;

@@ -93,8 +234,13 @@ namespace setImmediate {

}
function clearImmediate(immediateId: NodeJS.Immediate): void;
/**
* Cancels an `Immediate` object created by `setImmediate()`.
* @since v0.9.1
* @param immediate An `Immediate` object as returned by {@link setImmediate}.
*/
function clearImmediate(immediateId: NodeJS.Immediate | undefined): void;
function queueMicrotask(callback: () => void): void;
}
}
declare module 'node:timers' {
export * from 'timers';
declare module "node:timers" {
export * from "timers";
}
/**
* The `timers/promises` API provides an alternative set of timer functions
* that return `Promise` objects. The API is accessible via`require('timers/promises')`.
* that return `Promise` objects. The API is accessible via`require('node:timers/promises')`.
*

@@ -14,4 +14,4 @@ * ```js

*/
declare module 'timers/promises' {
import { TimerOptions } from 'node:timers';
declare module "timers/promises" {
import { TimerOptions } from "node:timers";
/**

@@ -48,2 +48,4 @@ * ```js

* Returns an async iterator that generates values in an interval of `delay` ms.
* If `ref` is `true`, you need to call `next()` of async iterator explicitly
* or implicitly to keep the event loop alive.
*

@@ -67,5 +69,28 @@ * ```js

function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
interface Scheduler {
/**
* ```js
* import { scheduler } from 'node:timers/promises';
*
* await scheduler.wait(1000); // Wait one second before continuing
* ```
* An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API.
* Calling timersPromises.scheduler.wait(delay, options) is roughly equivalent to calling timersPromises.setTimeout(delay, undefined, options) except that the ref option is not supported.
* @since v16.14.0
* @experimental
* @param [delay=1] The number of milliseconds to wait before fulfilling the promise.
*/
wait: (delay?: number, options?: TimerOptions) => Promise<void>;
/**
* An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API.
* Calling timersPromises.scheduler.yield() is equivalent to calling timersPromises.setImmediate() with no arguments.
* @since v16.14.0
* @experimental
*/
yield: () => Promise<void>;
}
const scheduler: Scheduler;
}
declare module 'node:timers/promises' {
export * from 'timers/promises';
declare module "node:timers/promises" {
export * from "timers/promises";
}
/**
* The `tls` module provides an implementation of the Transport Layer Security
* The `node:tls` module provides an implementation of the Transport Layer Security
* (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL.

@@ -7,9 +7,10 @@ * The module can be accessed using:

* ```js
* const tls = require('tls');
* const tls = require('node:tls');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/tls.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/tls.js)
*/
declare module 'tls' {
import { X509Certificate } from 'node:crypto';
import * as net from 'node:net';
declare module "tls" {
import { X509Certificate } from "node:crypto";
import * as net from "node:net";
import * as stream from "stream";
const CLIENT_RENEG_LIMIT: number;

@@ -44,17 +45,96 @@ const CLIENT_RENEG_WINDOW: number;

interface PeerCertificate {
/**
* `true` if a Certificate Authority (CA), `false` otherwise.
* @since v18.13.0
*/
ca: boolean;
/**
* The DER encoded X.509 certificate data.
*/
raw: Buffer;
/**
* The certificate subject.
*/
subject: Certificate;
/**
* The certificate issuer, described in the same terms as the `subject`.
*/
issuer: Certificate;
subjectaltname: string;
infoAccess: NodeJS.Dict<string[]>;
modulus: string;
exponent: string;
/**
* The date-time the certificate is valid from.
*/
valid_from: string;
/**
* The date-time the certificate is valid to.
*/
valid_to: string;
/**
* The certificate serial number, as a hex string.
*/
serialNumber: string;
/**
* The SHA-1 digest of the DER encoded certificate.
* It is returned as a `:` separated hexadecimal string.
*/
fingerprint: string;
/**
* The SHA-256 digest of the DER encoded certificate.
* It is returned as a `:` separated hexadecimal string.
*/
fingerprint256: string;
ext_key_usage: string[];
serialNumber: string;
raw: Buffer;
/**
* The SHA-512 digest of the DER encoded certificate.
* It is returned as a `:` separated hexadecimal string.
*/
fingerprint512: string;
/**
* The extended key usage, a set of OIDs.
*/
ext_key_usage?: string[];
/**
* A string containing concatenated names for the subject,
* an alternative to the `subject` names.
*/
subjectaltname?: string;
/**
* An array describing the AuthorityInfoAccess, used with OCSP.
*/
infoAccess?: NodeJS.Dict<string[]>;
/**
* For RSA keys: The RSA bit size.
*
* For EC keys: The key size in bits.
*/
bits?: number;
/**
* The RSA exponent, as a string in hexadecimal number notation.
*/
exponent?: string;
/**
* The RSA modulus, as a hexadecimal string.
*/
modulus?: string;
/**
* The public key.
*/
pubkey?: Buffer;
/**
* The ASN.1 name of the OID of the elliptic curve.
* Well-known curves are identified by an OID.
* While it is unusual, it is possible that the curve
* is identified by its mathematical properties,
* in which case it will not have an OID.
*/
asn1Curve?: string;
/**
* The NIST name for the elliptic curve,if it has one
* (not all well-known curves have been assigned names by NIST).
*/
nistCurve?: string;
}
interface DetailedPeerCertificate extends PeerCertificate {
/**
* The issuer certificate object.
* For self-signed certificates, this may be a circular reference.
*/
issuerCertificate: DetailedPeerCertificate;

@@ -137,3 +217,3 @@ }

*
* Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate} will only return data while the
* Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate}) will only return data while the
* connection is open.

@@ -148,4 +228,4 @@ * @since v0.11.4

/**
* Returns `true` if the peer certificate was signed by one of the CAs specified
* when creating the `tls.TLSSocket` instance, otherwise `false`.
* This property is `true` if the peer certificate was signed by one of the CAs
* specified when creating the `tls.TLSSocket` instance, otherwise `false`.
* @since v0.11.4

@@ -164,3 +244,3 @@ */

*/
encrypted: boolean;
encrypted: true;
/**

@@ -187,9 +267,9 @@ * String containing the selected ALPN protocol.

*
* For example:
* For example, a TLSv1.2 protocol with AES256-SHA cipher:
*
* ```json
* {
* "name": "AES128-SHA256",
* "standardName": "TLS_RSA_WITH_AES_128_CBC_SHA256",
* "version": "TLSv1.2"
* "name": "AES256-SHA",
* "standardName": "TLS_RSA_WITH_AES_256_CBC_SHA",
* "version": "SSLv3"
* }

@@ -325,3 +405,3 @@ * ```

},
callback: (err: Error | null) => void
callback: (err: Error | null) => void,
): undefined | boolean;

@@ -352,5 +432,5 @@ /**

*
* Note: The format of the output is identical to the output of `openssl s_client -trace` or `openssl s_server -trace`. While it is produced by OpenSSL's`SSL_trace()` function, the format is
* undocumented, can change without notice,
* and should not be relied on.
* The format of the output is identical to the output of`openssl s_client -trace` or `openssl s_server -trace`. While it is produced by
* OpenSSL's `SSL_trace()` function, the format is undocumented, can change
* without notice, and should not be relied on.
* @since v12.2.0

@@ -384,3 +464,3 @@ */

*
*
* /*
* Example return value of keyingMaterial:

@@ -404,31 +484,31 @@ * <Buffer 76 26 af 99 c5 56 8e 42 09 91 ef 9f 93 cb ad 6c 7b 65 f8 53 f1 d8 d9

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;
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;
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;
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;
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;
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;
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;
}

@@ -494,3 +574,2 @@ interface CommonConnectionOptions {

/**
*
* @param socket

@@ -530,3 +609,3 @@ * @param identity identity parameter sent from the client.

path?: string | undefined; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored.
socket?: net.Socket | undefined; // Establish secure connection on a given socket rather than creating a new socket
socket?: stream.Duplex | undefined; // Establish secure connection on a given socket rather than creating a new socket
checkServerIdentity?: typeof checkServerIdentity | undefined;

@@ -572,3 +651,4 @@ servername?: string | undefined; // SNI TLS Extension

* @param hostname A SNI host name or wildcard (e.g. `'*'`)
* @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc).
* @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created
* with {@link createSecureContext} itself.
*/

@@ -612,43 +692,114 @@ addContext(hostname: string, context: SecureContextOptions): void;

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: (err: Error, resp: Buffer) => void) => void): this;
addListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
addListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
addListener(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this;
addListener(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
addListener(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
): this;
addListener(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
addListener(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
): this;
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: (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: TLSSocket): boolean;
emit(event: 'keylog', line: Buffer, tlsSocket: TLSSocket): 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: (err: Error, resp: Buffer) => 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, sessionData: Buffer) => void) => void): this;
on(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this;
on(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => 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: (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: TLSSocket) => void): this;
once(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => 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: (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: TLSSocket) => void): this;
prependListener(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => 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: (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: TLSSocket) => void): this;
prependOnceListener(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => 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;
}

@@ -662,5 +813,16 @@ /**

}
type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1';
type SecureVersion = "TLSv1.3" | "TLSv1.2" | "TLSv1.1" | "TLSv1";
interface SecureContextOptions {
/**
* If set, this will be called when a client opens a connection using the ALPN extension.
* One argument will be passed to the callback: an object containing `servername` and `protocols` fields,
* respectively containing the server name from the SNI extension (if any) and an array of
* ALPN protocol name strings. The callback must return either one of the strings listed in `protocols`,
* which will be returned to the client as the selected ALPN protocol, or `undefined`,
* to reject the connection with a fatal alert. If a string is returned that does not match one of
* the client's ALPN protocols, an error will be thrown.
* This option cannot be used with the `ALPNProtocols` option, and setting both options will throw an error.
*/
ALPNCallback?: ((arg: { servername: string; protocols: string[] }) => string | undefined) | undefined;
/**
* Optionally override the trusted CA certificates. Default is to trust

@@ -706,8 +868,5 @@ * the well-known CAs curated by Mozilla. Mozilla's CAs are completely

/**
* Diffie Hellman parameters, required for Perfect Forward Secrecy. Use
* openssl dhparam to create the parameters. The key length must be
* greater than or equal to 1024 bits or else an error will be thrown.
* Although 1024 bits is permissible, use 2048 bits or larger for
* stronger security. If omitted or invalid, the parameters are
* silently discarded and DHE ciphers will not be available.
* `'auto'` or custom Diffie-Hellman parameters, required for non-ECDHE perfect forward secrecy.
* If omitted or invalid, the parameters are silently discarded and DHE ciphers will not be available.
* ECDHE-based perfect forward secrecy will still be available.
*/

@@ -741,3 +900,3 @@ dhparam?: string | Buffer | undefined;

*/
key?: string | Buffer | Array<Buffer | KeyObject> | undefined;
key?: string | Buffer | Array<string | Buffer | KeyObject> | undefined;
/**

@@ -833,4 +992,6 @@ * Name of an OpenSSL engine to get private key from. Should be used

*
* This function can be overwritten by providing alternative function as part of
* the `options.checkServerIdentity` option passed to `tls.connect()`. The
* This function is intended to be used in combination with the`checkServerIdentity` option that can be passed to {@link connect} and as
* such operates on a `certificate object`. For other purposes, consider using `x509.checkHost()` instead.
*
* This function can be overwritten by providing an alternative function as the`options.checkServerIdentity` option that is passed to `tls.connect()`. The
* overwriting function can call `tls.checkServerIdentity()` of course, to augment

@@ -841,2 +1002,6 @@ * the checks done with additional verification.

* being issued by trusted CA (`options.ca`).
*
* Earlier versions of Node.js incorrectly accepted certificates for a given`hostname` if a matching `uniformResourceIdentifier` subject alternative name
* was present (see [CVE-2021-44531](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44531)). Applications that wish to accept`uniformResourceIdentifier` subject alternative names can use
* a custom`options.checkServerIdentity` function that implements the desired behavior.
* @since v0.8.4

@@ -851,3 +1016,3 @@ * @param hostname The host name or IP address to verify the certificate against.

*
* The `ticketKeys` options is automatically shared between `cluster` module
* The `ticketKeys` options is automatically shared between `node:cluster` module
* workers.

@@ -858,4 +1023,4 @@ *

* ```js
* const tls = require('tls');
* const fs = require('fs');
* const tls = require('node:tls');
* const fs = require('node:fs');
*

@@ -870,3 +1035,3 @@ * const options = {

* // This is necessary only if the client uses a self-signed certificate.
* ca: [ fs.readFileSync('client-cert.pem') ]
* ca: [ fs.readFileSync('client-cert.pem') ],
* };

@@ -906,4 +1071,4 @@ *

* // Assumes an echo server that is listening on port 8000.
* const tls = require('tls');
* const fs = require('fs');
* const tls = require('node:tls');
* const fs = require('node:fs');
*

@@ -939,3 +1104,8 @@ * const options = {

function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
function connect(
port: number,
host?: string,
options?: ConnectionOptions,
secureConnectListener?: () => void,
): TLSSocket;
function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;

@@ -975,3 +1145,8 @@ /**

*/
function createSecurePair(context?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
function createSecurePair(
context?: SecureContext,
isServer?: boolean,
requestCert?: boolean,
rejectUnauthorized?: boolean,
): SecurePair;
/**

@@ -986,3 +1161,4 @@ * {@link createServer} sets the default value of the `honorCipherOrder` option

* The `tls.createSecureContext()` method creates a `SecureContext` object. It is
* usable as an argument to several `tls` APIs, such as {@link createServer} and `server.addContext()`, but has no public methods.
* usable as an argument to several `tls` APIs, such as `server.addContext()`,
* but has no public methods. The {@link Server} constructor and the {@link createServer} method do not support the `secureContext` option.
*

@@ -993,2 +1169,8 @@ * A key is _required_ for ciphers that use certificates. Either `key` or`pfx` can be used to provide it.

* CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt).
*
* Custom DHE parameters are discouraged in favor of the new `dhparam: 'auto'`option. When set to `'auto'`, well-known DHE parameters of sufficient strength
* will be selected automatically. Otherwise, if necessary, `openssl dhparam` can
* be used to create custom parameters. The key length must be greater than or
* equal to 1024 bits or else an error will be thrown. Although 1024 bits is
* permissible, use 2048 bits or larger for stronger security.
* @since v0.11.13

@@ -1002,2 +1184,4 @@ */

*
* Not all supported ciphers are enabled by default. See `Modifying the default TLS cipher suite`.
*
* Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for

@@ -1039,2 +1223,9 @@ * TLSv1.2 and below.

/**
* The default value of the ciphers option of tls.createSecureContext().
* It can be assigned any of the supported OpenSSL ciphers.
* Defaults to the content of crypto.constants.defaultCoreCipherList, unless
* changed using CLI options using --tls-default-ciphers.
*/
let DEFAULT_CIPHERS: string;
/**
* An immutable array of strings representing the root certificates (in PEM

@@ -1044,6 +1235,6 @@ * format) used for verifying peer certificates. This is the default value

*/
const rootCertificates: ReadonlyArray<string>;
const rootCertificates: readonly string[];
}
declare module 'node:tls' {
export * from 'tls';
declare module "node:tls" {
export * from "tls";
}
/**
* The `trace_events` module provides a mechanism to centralize tracing information
* generated by V8, Node.js core, and userspace code.
* The `node:trace_events` module provides a mechanism to centralize tracing
* information generated by V8, Node.js core, and userspace code.
*
* Tracing can be enabled with the `--trace-event-categories` command-line flag
* or by using the `trace_events` module. The `--trace-event-categories` flag
* or by using the `node:trace_events` module. The `--trace-event-categories` flag
* accepts a list of comma-separated category names.

@@ -16,5 +16,15 @@ *

* * `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`.
* * `node.threadpoolwork.async`: Enables capture of trace data for threadpool
* asynchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`.
* * `node.dns.native`: Enables capture of trace data for DNS queries.
* * `node.net.native`: Enables capture of trace data for network.
* * `node.environment`: Enables capture of Node.js Environment milestones.
* * `node.fs.sync`: Enables capture of trace data for file system sync methods.
* * `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` measurements.

@@ -27,4 +37,5 @@ * * `node.perf.usertiming`: Enables capture of only Performance API User Timing

* of unhandled Promise rejections and handled-after-rejections.
* * `node.vm.script`: Enables capture of trace data for the `vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
* * `node.vm.script`: Enables capture of trace data for the `node:vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
* * `v8`: The `V8` events are GC, compiling, and execution related.
* * `node.http`: Enables capture of trace data for http request / response.
*

@@ -48,6 +59,6 @@ * By default the `node`, `node.async_hooks`, and `v8` categories are enabled.

*
* Alternatively, trace events may be enabled using the `trace_events` module:
* Alternatively, trace events may be enabled using the `node:trace_events` module:
*
* ```js
* const trace_events = require('trace_events');
* const trace_events = require('node:trace_events');
* const tracing = trace_events.createTracing({ categories: ['node.perf'] });

@@ -72,2 +83,12 @@ * tracing.enable(); // Enable trace event capture for the 'node.perf' category

*
* To guarantee that the log file is properly generated after signal events like`SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers
* in your code, such as:
*
* ```js
* process.on('SIGINT', function onSigint() {
* console.info('Received SIGINT.');
* process.exit(130); // Or applicable exit code depending on OS and signal
* });
* ```
*
* The tracing system uses the same time source

@@ -80,5 +101,5 @@ * as the one used by `process.hrtime()`.

* @experimental
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/trace_events.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/trace_events.js)
*/
declare module 'trace_events' {
declare module "trace_events" {
/**

@@ -130,3 +151,3 @@ * The `Tracing` object is used to enable or disable tracing for sets of

* ```js
* const trace_events = require('trace_events');
* const trace_events = require('node:trace_events');
* const categories = ['node.perf', 'node.async_hooks'];

@@ -151,3 +172,3 @@ * const tracing = trace_events.createTracing({ categories });

* ```js
* const trace_events = require('trace_events');
* const trace_events = require('node:trace_events');
* const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });

@@ -166,4 +187,4 @@ * const t2 = trace_events.createTracing({ categories: ['node.perf'] });

}
declare module 'node:trace_events' {
export * from 'trace_events';
declare module "node:trace_events" {
export * from "trace_events";
}
/**
* The `tty` module provides the `tty.ReadStream` and `tty.WriteStream` classes.
* In most cases, it will not be necessary or possible to use this module directly.
* However, it can be accessed using:
* The `node:tty` module provides the `tty.ReadStream` and `tty.WriteStream`classes. In most cases, it will not be necessary or possible to use this module
* directly. However, it can be accessed using:
*
* ```js
* const tty = require('tty');
* const tty = require('node:tty');
* ```

@@ -25,6 +24,6 @@ *

* manually create instances of the `tty.ReadStream` and `tty.WriteStream`classes.
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/tty.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/tty.js)
*/
declare module 'tty' {
import * as net from 'node:net';
declare module "tty" {
import * as net from "node:net";
/**

@@ -47,3 +46,6 @@ * The `tty.isatty()` method returns `true` if the given `fd` is associated with

* A `boolean` that is `true` if the TTY is currently configured to operate as a
* raw device. Defaults to `false`.
* raw device.
*
* This flag is always `false` when a process starts, even if the terminal is
* operating in raw mode. Its value will change with subsequent calls to`setRawMode`.
* @since v0.7.7

@@ -57,3 +59,5 @@ */

* including modifiers. Additionally, all special processing of characters by the
* terminal is disabled, including echoing input characters.Ctrl+C will no longer cause a `SIGINT` when in this mode.
* terminal is disabled, including echoing input
* characters. Ctrl+C will no longer cause a `SIGINT` when
* in this mode.
* @since v0.7.7

@@ -85,13 +89,13 @@ * @param mode If `true`, configures the `tty.ReadStream` to operate as a raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw`

addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: 'resize', listener: () => void): this;
addListener(event: "resize", listener: () => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: 'resize'): boolean;
emit(event: "resize"): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: 'resize', listener: () => void): this;
on(event: "resize", listener: () => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: 'resize', listener: () => void): this;
once(event: "resize", listener: () => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: 'resize', listener: () => void): this;
prependListener(event: "resize", listener: () => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: 'resize', listener: () => void): this;
prependOnceListener(event: "resize", listener: () => void): this;
/**

@@ -206,4 +210,4 @@ * `writeStream.clearLine()` clears the current line of this `WriteStream` in a

}
declare module 'node:tty' {
export * from 'tty';
declare module "node:tty" {
export * from "tty";
}
/**
* The `url` module provides utilities for URL resolution and parsing. It can be
* accessed using:
* The `node:url` module provides utilities for URL resolution and parsing. It can
* be accessed using:
*
* ```js
* import url from 'url';
* import url from 'node:url';
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/url.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/url.js)
*/
declare module 'url' {
import { Blob } from 'node:buffer';
import { ClientRequestArgs } from 'node:http';
import { ParsedUrlQuery, ParsedUrlQueryInput } from 'node:querystring';
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`

@@ -57,9 +57,7 @@ interface UrlObject {

*
* Use of the legacy `url.parse()` method is discouraged. Users should
* use the WHATWG `URL` API. Because the `url.parse()` method uses a
* lenient, non-standard algorithm for parsing URL strings, security
* issues can be introduced. Specifically, issues with [host name spoofing](https://hackerone.com/reports/678487) and
* incorrect handling of usernames and passwords have been identified.
* `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` API instead.
* @since v0.1.25
* @deprecated Legacy: Use the WHATWG URL API instead.
* @deprecated Use the WHATWG URL API instead.
* @param urlString The URL string to parse.

@@ -72,27 +70,71 @@ * @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

function parse(urlString: string): UrlWithStringQuery;
function parse(urlString: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery;
function parse(
urlString: string,
parseQueryString: false | undefined,
slashesDenoteHost?: boolean,
): UrlWithStringQuery;
function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;
function parse(urlString: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;
/**
* The URL object has both a `toString()` method and `href` property that return string serializations of the URL.
* These are not, however, customizable in any way. The `url.format(URL[, options])` method allows for basic
* customization of the output.
* Returns a customizable serialization of a URL `String` representation of a `WHATWG URL` object.
* The `url.format()` method returns a formatted URL string derived from`urlObject`.
*
* ```js
* import url from 'url';
* const myURL = new URL('https://a:b@測試?abc#foo');
* const url = require('node:url');
* url.format({
* protocol: 'https',
* hostname: 'example.com',
* pathname: '/some/path',
* query: {
* page: 1,
* format: 'json',
* },
* });
*
* console.log(myURL.href);
* // Prints https://a:b@xn--g6w251d/?abc#foo
* // => 'https://example.com/some/path?page=1&#x26;format=json'
* ```
*
* console.log(myURL.toString());
* // Prints https://a:b@xn--g6w251d/?abc#foo
* If `urlObject` is not an object or a string, `url.format()` will throw a `TypeError`.
*
* console.log(url.format(myURL, { fragment: false, unicode: true, auth: false }));
* // Prints 'https://測試/?abc'
* ```
* @since v7.6.0
* @param urlObject A `WHATWG URL` object
* @param options
* The formatting process operates as follows:
*
* * A new empty string `result` is created.
* * If `urlObject.protocol` is a string, it is appended as-is to `result`.
* * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown.
* * For all string values of `urlObject.protocol` that _do not end_ with an ASCII
* colon (`:`) character, the literal string `:` will be appended to `result`.
* * If either of the following conditions is true, then the literal string `//`will be appended to `result`:
* * `urlObject.slashes` property is true;
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or`file`;
* * If the value of the `urlObject.auth` property is truthy, and either`urlObject.host` or `urlObject.hostname` are not `undefined`, the value of`urlObject.auth` will be coerced into a string
* and appended to `result`followed by the literal string `@`.
* * If the `urlObject.host` property is `undefined` then:
* * If the `urlObject.hostname` is a string, it is appended to `result`.
* * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string,
* an `Error` is thrown.
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname`is not `undefined`:
* * The literal string `:` is appended to `result`, and
* * The value of `urlObject.port` is coerced to a string and appended to`result`.
* * Otherwise, if the `urlObject.host` property value is truthy, the value of`urlObject.host` is coerced to a string and appended to `result`.
* * If the `urlObject.pathname` property is a string that is not an empty string:
* * If the `urlObject.pathname`_does not start_ with an ASCII forward slash
* (`/`), then the literal string `'/'` is appended to `result`.
* * The value of `urlObject.pathname` is appended to `result`.
* * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown.
* * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result`followed by the output of calling the
* `querystring` module's `stringify()`method passing the value of `urlObject.query`.
* * Otherwise, if `urlObject.search` is a string:
* * If the value of `urlObject.search`_does not start_ with the ASCII question
* mark (`?`) character, the literal string `?` is appended to `result`.
* * The value of `urlObject.search` is appended to `result`.
* * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown.
* * If the `urlObject.hash` property is a string:
* * If the value of `urlObject.hash`_does not start_ with the ASCII hash (`#`)
* character, the literal string `#` is appended to `result`.
* * The value of `urlObject.hash` is appended to `result`.
* * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a
* string, an `Error` is thrown.
* * `result` is returned.
* @since v0.1.25
* @legacy Use the WHATWG URL API instead.
* @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`.
*/

@@ -160,3 +202,3 @@ function format(urlObject: URL, options?: URLFormatOptions): string;

* @since v0.1.25
* @deprecated Legacy: Use the WHATWG URL API instead.
* @legacy Use the WHATWG URL API instead.
* @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`.

@@ -167,6 +209,6 @@ */

* The `url.resolve()` method resolves a target URL relative to a base URL in a
* manner similar to that of a Web browser resolving an anchor tag HREF.
* manner similar to that of a web browser resolving an anchor tag.
*
* ```js
* const url = require('url');
* const url = require('node:url');
* url.resolve('/one/two/three', 'four'); // '/one/two/four'

@@ -177,3 +219,3 @@ * url.resolve('http://example.com/', '/one'); // 'http://example.com/one'

*
* You can achieve the same result using the WHATWG URL API:
* To achieve the same result using the WHATWG URL API:
*

@@ -196,5 +238,5 @@ * ```js

* @since v0.1.25
* @deprecated Legacy: Use the WHATWG URL API instead.
* @param from The Base URL being resolved against.
* @param to The HREF URL being resolved.
* @legacy Use the WHATWG URL API instead.
* @param from The base URL to use if `to` is a relative URL.
* @param to The target URL to resolve.
*/

@@ -208,6 +250,4 @@ function resolve(from: string, to: string): string;

*
* This feature is only available if the `node` executable was compiled with `ICU` enabled. If not, the domain names are passed through unchanged.
*
* ```js
* import url from 'url';
* import url from 'node:url';
*

@@ -230,6 +270,4 @@ * console.log(url.domainToASCII('español.com'));

*
* This feature is only available if the `node` executable was compiled with `ICU` enabled. If not, the domain names are passed through unchanged.
*
* ```js
* import url from 'url';
* import url from 'node:url';
*

@@ -251,3 +289,3 @@ * console.log(url.domainToUnicode('xn--espaol-zwa.com'));

* ```js
* import { fileURLToPath } from 'url';
* import { fileURLToPath } from 'node:url';
*

@@ -278,3 +316,3 @@ * const __filename = fileURLToPath(import.meta.url);

* ```js
* import { pathToFileURL } from 'url';
* import { pathToFileURL } from 'node:url';
*

@@ -297,7 +335,7 @@ * new URL('/foo#1', 'file:'); // Incorrect: file:///foo#1

* ```js
* import { urlToHttpOptions } from 'url';
* import { urlToHttpOptions } from 'node:url';
* const myURL = new URL('https://a:b@測試?abc#foo');
*
* console.log(urlToHttpOptions(myURL));
*
* /*
* {

@@ -315,3 +353,3 @@ * protocol: 'https:',

* ```
* @since v15.7.0
* @since v15.7.0, v14.18.0
* @param url The `WHATWG URL` object to convert to an options object.

@@ -347,3 +385,3 @@ * @return Options object

* resolveObjectURL,
* } = require('buffer');
* } = require('node:buffer');
*

@@ -367,5 +405,6 @@ * const blob = new Blob(['hello']);

*/
static createObjectURL(blob: Blob): string;
static createObjectURL(blob: NodeBlob): string;
/**
* Removes the stored `Blob` identified by the given ID.
* 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

@@ -376,2 +415,16 @@ * @experimental

static revokeObjectURL(objectUrl: 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;
constructor(input: string, base?: string | URL);

@@ -422,3 +475,3 @@ /**

* // Setting the hostname does not change the port
* myURL.hostname = 'example.com:82';
* myURL.hostname = 'example.com';
* console.log(myURL.href);

@@ -486,3 +539,3 @@ * // Prints https://example.com:81/foo

* console.log(myURL.href);
* // Prints https://abc:123@example.com
* // Prints https://abc:123@example.com/
* ```

@@ -631,10 +684,10 @@ *

* ```js
* const myUrl = new URL('https://example.org/abc?foo=~bar');
* const myURL = new URL('https://example.org/abc?foo=~bar');
*
* console.log(myUrl.search); // prints ?foo=~bar
* console.log(myURL.search); // prints ?foo=~bar
*
* // Modify the URL via searchParams...
* myUrl.searchParams.sort();
* myURL.searchParams.sort();
*
* console.log(myUrl.search); // prints ?foo=%7Ebar
* console.log(myURL.search); // prints ?foo=%7Ebar
* ```

@@ -728,3 +781,10 @@ */

class URLSearchParams implements Iterable<[string, string]> {
constructor(init?: URLSearchParams | string | Record<string, string | ReadonlyArray<string>> | Iterable<[string, string]> | ReadonlyArray<[string, string]>);
constructor(
init?:
| URLSearchParams
| string
| Record<string, string | readonly string[]>
| Iterable<[string, string]>
| ReadonlyArray<[string, string]>,
);
/**

@@ -735,5 +795,8 @@ * Append a new name-value pair to the query string.

/**
* Remove all name-value pairs whose name is `name`.
* 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): void;
delete(name: string, value?: string): void;
/**

@@ -761,3 +824,6 @@ * Returns an ES6 `Iterator` over each of the name-value pairs in the query.

*/
forEach<TThis = this>(callback: (this: TThis, value: string, name: string, searchParams: this) => void, thisArg?: TThis): void;
forEach<TThis = this>(
callback: (this: TThis, value: string, name: string, searchParams: URLSearchParams) => void,
thisArg?: TThis,
): void;
/**

@@ -775,5 +841,11 @@ * Returns the value of the first name-value pair whose name is `name`. If there

/**
* Returns `true` if there is at least one name-value pair whose name is `name`.
* 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): boolean;
has(name: string, value?: string): boolean;
/**

@@ -814,2 +886,7 @@ * Returns an ES6 `Iterator` over the names of each name-value pair.

/**
* 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

@@ -841,5 +918,34 @@ * with a [stable sorting algorithm](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability), so relative order between name-value pairs

}
import { URL as _URL, URLSearchParams as _URLSearchParams } from "url";
global {
interface URLSearchParams extends _URLSearchParams {}
interface URL extends _URL {}
interface Global {
URL: typeof _URL;
URLSearchParams: typeof _URLSearchParams;
}
/**
* `URL` class is a global reference for `require('url').URL`
* https://nodejs.org/api/url.html#the-whatwg-url-api
* @since v10.0.0
*/
var URL: typeof globalThis extends {
onmessage: any;
URL: infer T;
} ? T
: typeof _URL;
/**
* `URLSearchParams` class is a global reference for `require('url').URLSearchParams`
* https://nodejs.org/api/url.html#class-urlsearchparams
* @since v10.0.0
*/
var URLSearchParams: typeof globalThis extends {
onmessage: any;
URLSearchParams: infer T;
} ? T
: typeof _URLSearchParams;
}
}
declare module 'node:url' {
export * from 'url';
declare module "node:url" {
export * from "url";
}
/**
* The `v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using:
* The `node:v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using:
*
* ```js
* const v8 = require('v8');
* const v8 = require('node:v8');
* ```
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/v8.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/v8.js)
*/
declare module 'v8' {
import { Readable } from 'node:stream';
declare module "v8" {
import { Readable } from "node:stream";
interface HeapSpaceInfo {

@@ -32,2 +32,5 @@ space_name: string;

number_of_detached_contexts: number;
total_global_handles_size: number;
used_global_handles_size: number;
external_memory: number;
}

@@ -72,2 +75,11 @@ interface HeapCodeStatistics {

*
* `total_global_handles_size` The value of total\_global\_handles\_size is the
* total memory size of V8 global handles.
*
* `used_global_handles_size` The value of used\_global\_handles\_size is the
* used memory size of V8 global handles.
*
* `external_memory` The value of external\_memory is the memory size of array
* buffers and external strings.
*
* ```js

@@ -85,3 +97,6 @@ * {

* number_of_native_contexts: 1,
* number_of_detached_contexts: 0
* number_of_detached_contexts: 0,
* total_global_handles_size: 8192,
* used_global_handles_size: 3296,
* external_memory: 318824
* }

@@ -155,3 +170,3 @@ * ```

* // Print GC events to stdout for one minute.
* const v8 = require('v8');
* const v8 = require('node:v8');
* v8.setFlagsFromString('--trace_gc');

@@ -170,5 +185,12 @@ * setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3);

*
* Creating a heap snapshot requires memory about twice the size of the heap at
* the time the snapshot is created. This results in the risk of OOM killers
* terminating the process.
*
* Generating a snapshot is a synchronous operation which blocks the event loop
* for a duration depending on the heap size.
*
* ```js
* // Print heap snapshot to the console
* const v8 = require('v8');
* const v8 = require('node:v8');
* const stream = v8.getHeapSnapshot();

@@ -178,3 +200,3 @@ * stream.pipe(process.stdout);

* @since v11.13.0
* @return A Readable Stream containing the V8 heap snapshot
* @return A Readable containing the V8 heap snapshot.
*/

@@ -191,9 +213,16 @@ function getHeapSnapshot(): Readable;

*
* Creating a heap snapshot requires memory about twice the size of the heap at
* the time the snapshot is created. This results in the risk of OOM killers
* terminating the process.
*
* Generating a snapshot is a synchronous operation which blocks the event loop
* for a duration depending on the heap size.
*
* ```js
* const { writeHeapSnapshot } = require('v8');
* const { writeHeapSnapshot } = require('node:v8');
* const {
* Worker,
* isMainThread,
* parentPort
* } = require('worker_threads');
* parentPort,
* } = require('node:worker_threads');
*

@@ -229,3 +258,5 @@ * if (isMainThread) {

/**
* Returns an object with the following properties:
* Get statistics about code and its metadata in the heap, see
* V8[`GetHeapCodeAndMetadataStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#a6079122af17612ef54ef3348ce170866) API. Returns an object with the
* following properties:
*

@@ -236,3 +267,4 @@ * ```js

* bytecode_and_metadata_size: 161368,
* external_script_source_size: 1410794
* external_script_source_size: 1410794,
* cpu_profiler_metadata_size: 0,
* }

@@ -287,3 +319,3 @@ * ```

/**
* Write raw bytes into the serializer’s internal buffer. The deserializer
* Write raw bytes into the serializer's internal buffer. The deserializer
* will require a way to compute the length of the buffer.

@@ -344,3 +376,3 @@ * For use inside of a custom `serializer._writeHostObject()`.

/**
* Read raw bytes from the deserializer’s internal buffer. The `length` parameter
* Read raw bytes from the deserializer's internal buffer. The `length` parameter
* must correspond to the length of the buffer that was passed to `serializer.writeRawBytes()`.

@@ -358,2 +390,6 @@ * For use inside of a custom `deserializer._readHostObject()`.

* Uses a `DefaultSerializer` to serialize `value` into a buffer.
*
* `ERR_BUFFER_TOO_LARGE` will be thrown when trying to
* serialize a huge object which requires buffer
* larger than `buffer.constants.MAX_LENGTH`.
* @since v8.0.0

@@ -377,3 +413,3 @@ */

* disk unless {@link stopCoverage} is invoked before the process exits.
* @since v15.1.0, v12.22.0
* @since v15.1.0, v14.18.0, v12.22.0
*/

@@ -385,8 +421,229 @@ function takeCoverage(): void;

* records and optimize code. This can be used in conjunction with {@link takeCoverage} if the user wants to collect the coverage on demand.
* @since v15.1.0, v12.22.0
* @since v15.1.0, v14.18.0, v12.22.0
*/
function stopCoverage(): void;
/**
* This API collects GC data in current thread.
* @since v19.6.0, v18.15.0
*/
class GCProfiler {
/**
* Start collecting GC data.
* @since v19.6.0, v18.15.0
*/
start(): void;
/**
* Stop collecting GC data and return an object.The content of object
* is as follows.
*
* ```json
* {
* "version": 1,
* "startTime": 1674059033862,
* "statistics": [
* {
* "gcType": "Scavenge",
* "beforeGC": {
* "heapStatistics": {
* "totalHeapSize": 5005312,
* "totalHeapSizeExecutable": 524288,
* "totalPhysicalSize": 5226496,
* "totalAvailableSize": 4341325216,
* "totalGlobalHandlesSize": 8192,
* "usedGlobalHandlesSize": 2112,
* "usedHeapSize": 4883840,
* "heapSizeLimit": 4345298944,
* "mallocedMemory": 254128,
* "externalMemory": 225138,
* "peakMallocedMemory": 181760
* },
* "heapSpaceStatistics": [
* {
* "spaceName": "read_only_space",
* "spaceSize": 0,
* "spaceUsedSize": 0,
* "spaceAvailableSize": 0,
* "physicalSpaceSize": 0
* }
* ]
* },
* "cost": 1574.14,
* "afterGC": {
* "heapStatistics": {
* "totalHeapSize": 6053888,
* "totalHeapSizeExecutable": 524288,
* "totalPhysicalSize": 5500928,
* "totalAvailableSize": 4341101384,
* "totalGlobalHandlesSize": 8192,
* "usedGlobalHandlesSize": 2112,
* "usedHeapSize": 4059096,
* "heapSizeLimit": 4345298944,
* "mallocedMemory": 254128,
* "externalMemory": 225138,
* "peakMallocedMemory": 181760
* },
* "heapSpaceStatistics": [
* {
* "spaceName": "read_only_space",
* "spaceSize": 0,
* "spaceUsedSize": 0,
* "spaceAvailableSize": 0,
* "physicalSpaceSize": 0
* }
* ]
* }
* }
* ],
* "endTime": 1674059036865
* }
* ```
*
* Here's an example.
*
* ```js
* const { GCProfiler } = require('v8');
* const profiler = new GCProfiler();
* profiler.start();
* setTimeout(() => {
* console.log(profiler.stop());
* }, 1000);
* ```
* @since v19.6.0, v18.15.0
*/
stop(): GCProfilerResult;
}
interface GCProfilerResult {
version: number;
startTime: number;
endTime: number;
statistics: Array<{
gcType: string;
cost: number;
beforeGC: {
heapStatistics: HeapStatistics;
heapSpaceStatistics: HeapSpaceStatistics[];
};
afterGC: {
heapStatistics: HeapStatistics;
heapSpaceStatistics: HeapSpaceStatistics[];
};
}>;
}
interface HeapStatistics {
totalHeapSize: number;
totalHeapSizeExecutable: number;
totalPhysicalSize: number;
totalAvailableSize: number;
totalGlobalHandlesSize: number;
usedGlobalHandlesSize: number;
usedHeapSize: number;
heapSizeLimit: number;
mallocedMemory: number;
externalMemory: number;
peakMallocedMemory: number;
}
interface HeapSpaceStatistics {
spaceName: string;
spaceSize: number;
spaceUsedSize: number;
spaceAvailableSize: number;
physicalSpaceSize: number;
}
/**
* Called when a promise is constructed. This does not mean that corresponding before/after events will occur, only that the possibility exists. This will
* happen if a promise is created without ever getting a continuation.
* @since v17.1.0, v16.14.0
* @param promise The promise being created.
* @param parent The promise continued from, if applicable.
*/
interface Init {
(promise: Promise<unknown>, parent: Promise<unknown>): void;
}
/**
* Called before a promise continuation executes. This can be in the form of `then()`, `catch()`, or `finally()` handlers or an await resuming.
*
* The before callback will be called 0 to N times. The before callback will typically be called 0 times if no continuation was ever made for the promise.
* The before callback may be called many times in the case where many continuations have been made from the same promise.
* @since v17.1.0, v16.14.0
*/
interface Before {
(promise: Promise<unknown>): void;
}
/**
* Called immediately after a promise continuation executes. This may be after a `then()`, `catch()`, or `finally()` handler or before an await after another await.
* @since v17.1.0, v16.14.0
*/
interface After {
(promise: Promise<unknown>): void;
}
/**
* Called when the promise receives a resolution or rejection value. This may occur synchronously in the case of {@link Promise.resolve()} or
* {@link Promise.reject()}.
* @since v17.1.0, v16.14.0
*/
interface Settled {
(promise: Promise<unknown>): void;
}
/**
* Key events in the lifetime of a promise have been categorized into four areas: creation of a promise, before/after a continuation handler is called or
* around an await, and when the promise resolves or rejects.
*
* Because promises are asynchronous resources whose lifecycle is tracked via the promise hooks mechanism, the `init()`, `before()`, `after()`, and
* `settled()` callbacks must not be async functions as they create more promises which would produce an infinite loop.
* @since v17.1.0, v16.14.0
*/
interface HookCallbacks {
init?: Init;
before?: Before;
after?: After;
settled?: Settled;
}
interface PromiseHooks {
/**
* The `init` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
* @since v17.1.0, v16.14.0
* @param init The {@link Init | `init` callback} to call when a promise is created.
* @return Call to stop the hook.
*/
onInit: (init: Init) => Function;
/**
* The `settled` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
* @since v17.1.0, v16.14.0
* @param settled The {@link Settled | `settled` callback} to call when a promise is created.
* @return Call to stop the hook.
*/
onSettled: (settled: Settled) => Function;
/**
* The `before` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
* @since v17.1.0, v16.14.0
* @param before The {@link Before | `before` callback} to call before a promise continuation executes.
* @return Call to stop the hook.
*/
onBefore: (before: Before) => Function;
/**
* The `after` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
* @since v17.1.0, v16.14.0
* @param after The {@link After | `after` callback} to call after a promise continuation executes.
* @return Call to stop the hook.
*/
onAfter: (after: After) => Function;
/**
* Registers functions to be called for different lifetime events of each promise.
* The callbacks `init()`/`before()`/`after()`/`settled()` are called for the respective events during a promise's lifetime.
* All callbacks are optional. For example, if only promise creation needs to be tracked, then only the init callback needs to be passed.
* The hook callbacks must be plain functions. Providing async functions will throw as it would produce an infinite microtask loop.
* @since v17.1.0, v16.14.0
* @param callbacks The {@link HookCallbacks | Hook Callbacks} to register
* @return Used for disabling hooks
*/
createHook: (callbacks: HookCallbacks) => Function;
}
/**
* The `promiseHooks` interface can be used to track promise lifecycle events.
* @since v17.1.0, v16.14.0
*/
const promiseHooks: PromiseHooks;
}
declare module 'node:v8' {
export * from 'v8';
declare module "node:v8" {
export * from "v8";
}
/**
* The `vm` module enables compiling and running code within V8 Virtual
* Machine contexts. **The `vm` module is not a security mechanism. Do**
* **not use it to run untrusted code.**
* The `node:vm` module enables compiling and running code within V8 Virtual
* Machine contexts.
*
* **The `node:vm` module is not a security**
* **mechanism. Do not use it to run untrusted code.**
*
* JavaScript code can be compiled and run immediately or

@@ -18,3 +20,3 @@ * compiled, saved, and run later.

* ```js
* const vm = require('vm');
* const vm = require('node:vm');
*

@@ -36,5 +38,6 @@ * const x = 1;

* ```
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/vm.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/vm.js)
*/
declare module 'vm' {
declare module "vm" {
import { ImportAttributes } from "node:module";
interface Context extends NodeJS.Dict<any> {}

@@ -59,7 +62,15 @@ interface BaseOptions {

interface ScriptOptions extends BaseOptions {
displayErrors?: boolean | undefined;
timeout?: number | undefined;
cachedData?: Buffer | undefined;
/**
* V8's code cache data for the supplied source.
*/
cachedData?: Buffer | NodeJS.ArrayBufferView | undefined;
/** @deprecated in favor of `script.createCachedData()` */
produceCachedData?: boolean | undefined;
/**
* Called during evaluation of this module when `import()` is called.
* If this option is not specified, calls to `import()` will reject with `ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`.
*/
importModuleDynamically?:
| ((specifier: string, script: Script, importAttributes: ImportAttributes) => Module)
| undefined;
}

@@ -84,7 +95,28 @@ interface RunningScriptOptions extends BaseOptions {

breakOnSigint?: boolean | undefined;
}
interface RunningScriptInNewContextOptions extends RunningScriptOptions {
/**
* Human-readable name of the newly created context.
*/
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"];
contextCodeGeneration?: CreateContextOptions["codeGeneration"];
/**
* If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
*/
microtaskMode?: 'afterEvaluate' | undefined;
microtaskMode?: CreateContextOptions["microtaskMode"];
}
interface RunningCodeOptions extends RunningScriptOptions {
cachedData?: ScriptOptions["cachedData"];
importModuleDynamically?: ScriptOptions["importModuleDynamically"];
}
interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions {
cachedData?: ScriptOptions["cachedData"];
importModuleDynamically?: ScriptOptions["importModuleDynamically"];
}
interface CompileFunctionOptions extends BaseOptions {

@@ -125,14 +157,14 @@ /**

| {
/**
* If set to false any calls to eval or function constructors (Function, GeneratorFunction, etc)
* will throw an EvalError.
* @default true
*/
strings?: boolean | undefined;
/**
* If set to false any attempt to compile a WebAssembly module will throw a WebAssembly.CompileError.
* @default true
*/
wasm?: boolean | undefined;
}
/**
* If set to false any calls to eval or function constructors (Function, GeneratorFunction, etc)
* will throw an EvalError.
* @default true
*/
strings?: boolean | undefined;
/**
* If set to false any attempt to compile a WebAssembly module will throw a WebAssembly.CompileError.
* @default true
*/
wasm?: boolean | undefined;
}
| undefined;

@@ -142,5 +174,5 @@ /**

*/
microtaskMode?: 'afterEvaluate' | undefined;
microtaskMode?: "afterEvaluate" | undefined;
}
type MeasureMemoryMode = 'summary' | 'detailed';
type MeasureMemoryMode = "summary" | "detailed";
interface MeasureMemoryOptions {

@@ -151,3 +183,6 @@ /**

mode?: MeasureMemoryMode | undefined;
context?: Context | undefined;
/**
* @default 'default'
*/
execution?: "default" | "eager" | undefined;
}

@@ -166,3 +201,3 @@ interface MemoryMeasurement {

class Script {
constructor(code: string, options?: ScriptOptions);
constructor(code: string, options?: ScriptOptions | string);
/**

@@ -177,7 +212,7 @@ * Runs the compiled code contained by the `vm.Script` object within the given`contextifiedObject` and returns the result. Running code does not have access

* ```js
* const vm = require('vm');
* const vm = require('node:vm');
*
* const context = {
* animal: 'cat',
* count: 2
* count: 2,
* };

@@ -214,3 +249,3 @@ *

* ```js
* const vm = require('vm');
* const vm = require('node:vm');
*

@@ -231,6 +266,6 @@ * const script = new vm.Script('globalVar = "set"');

*/
runInNewContext(contextObject?: Context, options?: RunningScriptOptions): any;
runInNewContext(contextObject?: Context, options?: RunningScriptInNewContextOptions): any;
/**
* Runs the compiled code contained by the `vm.Script` within the context of the
* current `global` object. Running code does not have access to local scope, but_does_ have access to the current `global` object.
* current `global` object. Running code does not have access to local scope, but _does_ have access to the current `global` object.
*

@@ -241,3 +276,3 @@ * The following example compiles code that increments a `global` variable then

* ```js
* const vm = require('vm');
* const vm = require('node:vm');
*

@@ -264,2 +299,12 @@ * global.globalVar = 0;

*
* The code cache of the `Script` doesn't contain any JavaScript observable
* states. The code cache is safe to be saved along side the script source and
* used to construct new `Script` instances multiple times.
*
* Functions in the `Script` source can be marked as lazily compiled and they are
* not compiled at construction of the `Script`. These functions are going to be
* compiled when they are invoked the first time. The code cache serializes the
* metadata that V8 currently knows about the `Script` that it can use to speed up
* future compilations.
*
* ```js

@@ -274,7 +319,10 @@ * const script = new vm.Script(`

*
* const cacheWithoutX = script.createCachedData();
* const cacheWithoutAdd = script.createCachedData();
* // In `cacheWithoutAdd` the function `add()` is marked for full compilation
* // upon invocation.
*
* script.runInThisContext();
*
* const cacheWithX = script.createCachedData();
* const cacheWithAdd = script.createCachedData();
* // `cacheWithAdd` contains fully compiled function `add()`.
* ```

@@ -286,4 +334,28 @@ * @since v10.6.0

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 | 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.
*
* ```js
* import vm from 'node:vm';
*
* const script = new vm.Script(`
* function myFunc() {}
* //# sourceMappingURL=sourcemap.json
* `);
*
* console.log(script.sourceMapURL);
* // Prints: sourcemap.json
* ```
* @since v19.1.0, v18.13.0
*/
sourceMapURL?: string | undefined;
}

@@ -298,3 +370,3 @@ /**

* ```js
* const vm = require('vm');
* const vm = require('node:vm');
*

@@ -346,3 +418,3 @@ * global.globalVar = 3;

* ```js
* const vm = require('vm');
* const vm = require('node:vm');
*

@@ -363,3 +435,3 @@ * const contextObject = { globalVar: 1 };

*/
function runInContext(code: string, contextifiedObject: Context, options?: RunningScriptOptions | string): any;
function runInContext(code: string, contextifiedObject: Context, options?: RunningCodeOptions | string): any;
/**

@@ -377,7 +449,7 @@ * The `vm.runInNewContext()` first contextifies the given `contextObject` (or

* ```js
* const vm = require('vm');
* const vm = require('node:vm');
*
* const contextObject = {
* animal: 'cat',
* count: 2
* count: 2,
* };

@@ -394,3 +466,7 @@ *

*/
function runInNewContext(code: string, contextObject?: Context, options?: RunningScriptOptions | string): any;
function runInNewContext(
code: string,
contextObject?: Context,
options?: RunningCodeInNewContextOptions | string,
): any;
/**

@@ -407,3 +483,3 @@ * `vm.runInThisContext()` compiles `code`, runs it within the context of the

* ```js
* const vm = require('vm');
* const vm = require('node:vm');
* let localVar = 'initial value';

@@ -429,13 +505,13 @@ *

*
* In order to run a simple web server using the `http` module the code passed to
* the context must either call `require('http')` on its own, or have a reference
* to the `http` module passed to it. For instance:
* In order to run a simple web server using the `node:http` module the code passed
* to the context must either call `require('node:http')` on its own, or have a
* reference to the `node:http` module passed to it. For instance:
*
* ```js
* 'use strict';
* const vm = require('vm');
* const vm = require('node:vm');
*
* const code = `
* ((require) => {
* const http = require('http');
* const http = require('node:http');
*

@@ -460,3 +536,3 @@ * http.createServer((request, response) => {

*/
function runInThisContext(code: string, options?: RunningScriptOptions | string): any;
function runInThisContext(code: string, options?: RunningCodeOptions | string): any;
/**

@@ -470,3 +546,11 @@ * Compiles the given code into the provided context (if no context is

*/
function compileFunction(code: string, params?: ReadonlyArray<string>, options?: CompileFunctionOptions): Function;
function compileFunction(
code: string,
params?: readonly string[],
options?: CompileFunctionOptions,
): Function & {
cachedData?: Script["cachedData"] | undefined;
cachedDataProduced?: Script["cachedDataProduced"] | undefined;
cachedDataRejected?: Script["cachedDataRejected"] | undefined;
};
/**

@@ -485,3 +569,3 @@ * Measure the memory known to V8 and used by all contexts known to the

* ```js
* const vm = require('vm');
* const vm = require('node:vm');
* // Measure the memory used by the main context.

@@ -529,5 +613,317 @@ * vm.measureMemory({ mode: 'summary' })

function measureMemory(options?: MeasureMemoryOptions): Promise<MemoryMeasurement>;
interface ModuleEvaluateOptions {
timeout?: RunningScriptOptions["timeout"] | undefined;
breakOnSigint?: RunningScriptOptions["breakOnSigint"] | undefined;
}
type ModuleLinker = (
specifier: string,
referencingModule: Module,
extra: {
/** @deprecated Use `attributes` instead */
assert: ImportAttributes;
attributes: ImportAttributes;
},
) => Module | Promise<Module>;
type ModuleStatus = "unlinked" | "linking" | "linked" | "evaluating" | "evaluated" | "errored";
/**
* This feature is only available with the `--experimental-vm-modules` command
* 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://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. 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
* example.
*
* This implementation lies at a lower level than the `ECMAScript Module
* loader`. There is also no way to interact with the Loader yet, though
* support is planned.
*
* ```js
* import vm from 'node:vm';
*
* const contextifiedObject = vm.createContext({
* secret: 42,
* print: console.log,
* });
*
* // Step 1
* //
* // Create a Module by constructing a new `vm.SourceTextModule` object. This
* // parses the provided source text, throwing a `SyntaxError` if anything goes
* // wrong. By default, a Module is created in the top context. But here, we
* // specify `contextifiedObject` as the context this Module belongs to.
* //
* // Here, we attempt to obtain the default export from the module "foo", and
* // put it into local binding "secret".
*
* const bar = new vm.SourceTextModule(`
* import s from 'foo';
* s;
* print(s);
* `, { context: contextifiedObject });
*
* // Step 2
* //
* // "Link" the imported dependencies of this Module to it.
* //
* // 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
* // callback provided would never be called, however.
* //
* // 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.
*
* 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 });
*
* // Using `contextifiedObject` instead of `referencingModule.context`
* // here would work as well.
* }
* throw new Error(`Unable to resolve dependency: ${specifier}`);
* }
* await bar.link(linker);
*
* // Step 3
* //
* // Evaluate the Module. The evaluate() method returns a promise which will
* // resolve after the module has finished evaluating.
*
* // Prints 42.
* await bar.evaluate();
* ```
* @since v13.0.0, v12.16.0
* @experimental
*/
class Module {
/**
* The specifiers of all dependencies of this module. The returned array is frozen
* to disallow any changes to it.
*
* Corresponds to the `[[RequestedModules]]` field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) s in
* the ECMAScript specification.
*/
dependencySpecifiers: readonly string[];
/**
* If the `module.status` is `'errored'`, this property contains the exception
* thrown by the module during evaluation. If the status is anything else,
* accessing this property will result in a thrown exception.
*
* The value `undefined` cannot be used for cases where there is not a thrown
* exception due to possible ambiguity with `throw undefined;`.
*
* Corresponds to the `[[EvaluationError]]` field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) s
* in the ECMAScript specification.
*/
error: any;
/**
* The identifier of the current module, as set in the constructor.
*/
identifier: string;
context: Context;
/**
* The namespace object of the module. This is only available after linking
* (`module.link()`) has completed.
*
* Corresponds to the [GetModuleNamespace](https://tc39.es/ecma262/#sec-getmodulenamespace) abstract operation in the ECMAScript
* specification.
*/
namespace: Object;
/**
* The current status of the module. Will be one of:
*
* * `'unlinked'`: `module.link()` has not yet been called.
* * `'linking'`: `module.link()` has been called, but not all Promises returned
* by the linker function have been resolved yet.
* * `'linked'`: The module has been linked successfully, and all of its
* dependencies are linked, but `module.evaluate()` has not yet been called.
* * `'evaluating'`: The module is being evaluated through a `module.evaluate()` on
* itself or a parent module.
* * `'evaluated'`: The module has been successfully evaluated.
* * `'errored'`: The module has been evaluated, but an exception was thrown.
*
* Other than `'errored'`, this status string corresponds to the specification's [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records)'s `[[Status]]` field. `'errored'`
* corresponds to`'evaluated'` in the specification, but with `[[EvaluationError]]` set to a
* value that is not `undefined`.
*/
status: ModuleStatus;
/**
* Evaluate the module.
*
* This must be called after the module has been linked; otherwise it will reject.
* It could be called also when the module has already been evaluated, in which
* case it will either do nothing if the initial evaluation ended in success
* (`module.status` is `'evaluated'`) or it will re-throw the exception that the
* initial evaluation resulted in (`module.status` is `'errored'`).
*
* This method cannot be called while the module is being evaluated
* (`module.status` is `'evaluating'`).
*
* Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation) field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) s in the
* ECMAScript specification.
* @return Fulfills with `undefined` upon success.
*/
evaluate(options?: ModuleEvaluateOptions): Promise<void>;
/**
* Link module dependencies. This method must be called before evaluation, and
* can only be called once per module.
*
* 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:
*
* * It must belong to the same context as the parent `Module`.
* * Its `status` must not be `'errored'`.
*
* If the returned `Module`'s `status` is `'unlinked'`, this method will be
* recursively called on the returned `Module` with the same provided `linker`function.
*
* `link()` returns a `Promise` that will either get resolved when all linking
* instances resolve to a valid `Module`, or rejected if the linker function either
* throws an exception or returns an invalid `Module`.
*
* The linker function roughly corresponds to the implementation-defined [HostResolveImportedModule](https://tc39.es/ecma262/#sec-hostresolveimportedmodule) abstract operation in the
* ECMAScript
* specification, with a few key differences:
*
* * The linker function is allowed to be asynchronous while [HostResolveImportedModule](https://tc39.es/ecma262/#sec-hostresolveimportedmodule) is synchronous.
*
* The actual [HostResolveImportedModule](https://tc39.es/ecma262/#sec-hostresolveimportedmodule) implementation used during module
* linking is one that returns the modules linked during linking. Since at
* that point all modules would have been fully linked already, the [HostResolveImportedModule](https://tc39.es/ecma262/#sec-hostresolveimportedmodule) implementation is fully synchronous per
* specification.
*
* Corresponds to the [Link() concrete method](https://tc39.es/ecma262/#sec-moduledeclarationlinking) field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) s in
* the ECMAScript specification.
*/
link(linker: ModuleLinker): Promise<void>;
}
interface SourceTextModuleOptions {
/**
* String used in stack traces.
* @default 'vm:module(i)' where i is a context-specific ascending index.
*/
identifier?: string | undefined;
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`.
*/
initializeImportMeta?: ((meta: ImportMeta, module: SourceTextModule) => void) | undefined;
importModuleDynamically?: ScriptOptions["importModuleDynamically"] | undefined;
}
/**
* This feature is only available with the `--experimental-vm-modules` command
* flag enabled.
*
* The `vm.SourceTextModule` class provides the [Source Text Module Record](https://tc39.es/ecma262/#sec-source-text-module-records) as
* defined in the ECMAScript specification.
* @since v9.6.0
* @experimental
*/
class SourceTextModule extends Module {
/**
* Creates a new `SourceTextModule` instance.
* @param code JavaScript Module code to parse
*/
constructor(code: string, options?: SourceTextModuleOptions);
}
interface SyntheticModuleOptions {
/**
* String used in stack traces.
* @default 'vm:module(i)' where i is a context-specific ascending index.
*/
identifier?: string | undefined;
/**
* The contextified object as returned by the `vm.createContext()` method, to compile and evaluate this module in.
*/
context?: Context | undefined;
}
/**
* This feature is only available with the `--experimental-vm-modules` command
* flag enabled.
*
* The `vm.SyntheticModule` class provides the [Synthetic Module Record](https://heycam.github.io/webidl/#synthetic-module-records) as
* defined in the WebIDL specification. The purpose of synthetic modules is to
* provide a generic interface for exposing non-JavaScript sources to ECMAScript
* module graphs.
*
* ```js
* const vm = require('node:vm');
*
* const source = '{ "a": 1 }';
* const module = new vm.SyntheticModule(['default'], function() {
* const obj = JSON.parse(source);
* this.setExport('default', obj);
* });
*
* // Use `module` in linking...
* ```
* @since v13.0.0, v12.16.0
* @experimental
*/
class SyntheticModule extends Module {
/**
* Creates a new `SyntheticModule` instance.
* @param exportNames Array of names that will be exported from the module.
* @param evaluateCallback Called when the module is evaluated.
*/
constructor(
exportNames: string[],
evaluateCallback: (this: SyntheticModule) => void,
options?: SyntheticModuleOptions,
);
/**
* 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';
*
* const m = new vm.SyntheticModule(['x'], () => {
* m.setExport('x', 1);
* });
*
* await m.link(() => {});
* await m.evaluate();
*
* assert.strictEqual(m.namespace.x, 1);
* ```
* @since v13.0.0, v12.16.0
* @param name Name of the export to set.
* @param value The value to set the export to.
*/
setExport(name: string, value: any): void;
}
}
declare module 'node:vm' {
export * from 'vm';
declare module "node:vm" {
export * from "vm";
}

@@ -6,22 +6,19 @@ /**

* ```js
* import { readFile } from 'fs/promises';
* import { readFile } from 'node:fs/promises';
* import { WASI } from 'wasi';
* import { argv, env } from 'process';
* import { argv, env } from 'node:process';
*
* const wasi = new WASI({
* version: 'preview1',
* args: argv,
* env,
* preopens: {
* '/sandbox': '/some/real/path/that/wasm/can/access'
* }
* '/sandbox': '/some/real/path/that/wasm/can/access',
* },
* });
*
* // Some WASI binaries require:
* // const importObject = { wasi_unstable: wasi.wasiImport };
* const importObject = { wasi_snapshot_preview1: wasi.wasiImport };
*
* const wasm = await WebAssembly.compile(
* await readFile(new URL('./demo.wasm', import.meta.url))
* await readFile(new URL('./demo.wasm', import.meta.url)),
* );
* const instance = await WebAssembly.instantiate(wasm, importObject);
* const instance = await WebAssembly.instantiate(wasm, wasi.getImportObject());
*

@@ -65,12 +62,9 @@ * wasi.start(instance);

*
* ```console
* $ wat2wasm demo.wat
* ```bash
* wat2wasm demo.wat
* ```
*
* The `--experimental-wasi-unstable-preview1` CLI argument is needed for this
* example to run.
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/wasi.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/wasi.js)
*/
declare module 'wasi' {
declare module "wasi" {
interface WASIOptions {

@@ -96,7 +90,7 @@ /**

/**
* By default, WASI applications terminate the Node.js
* process via the `__wasi_proc_exit()` function. Setting this option to `true`
* causes `wasi.start()` to return the exit code rather than terminate the
* process.
* @default false
* By default, when WASI applications call `__wasi_proc_exit()`
* `wasi.start()` will return with the exit code specified rather than terminatng the process.
* Setting this option to `false` will cause the Node.js process to exit with
* the specified exit code instead.
* @default true
*/

@@ -119,2 +113,8 @@ returnOnExit?: boolean | undefined;

stderr?: number | undefined;
/**
* The version of WASI requested.
* Currently the only supported versions are `'unstable'` and `'preview1'`.
* @since v20.0.0
*/
version: string;
}

@@ -140,3 +140,3 @@ /**

*/
start(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
start(instance: object): number; // TODO: avoid DOM dependency until WASM moved to own lib.
/**

@@ -161,4 +161,4 @@ * Attempt to initialize `instance` as a WASI reactor by invoking its`_initialize()` export, if it is present. If `instance` contains a `_start()`export, then an exception is thrown.

}
declare module 'node:wasi' {
export * from 'wasi';
declare module "node:wasi" {
export * from "wasi";
}
/**
* The `worker_threads` module enables the use of threads that execute JavaScript
* in parallel. To access it:
* The `node:worker_threads` module enables the use of threads that execute
* JavaScript in parallel. To access it:
*
* ```js
* const worker = require('worker_threads');
* const worker = require('node:worker_threads');
* ```

@@ -18,4 +18,4 @@ *

* const {
* Worker, isMainThread, parentPort, workerData
* } = require('worker_threads');
* Worker, isMainThread, parentPort, workerData,
* } = require('node:worker_threads');
*

@@ -26,3 +26,3 @@ * if (isMainThread) {

* const worker = new Worker(__filename, {
* workerData: script
* workerData: script,
* });

@@ -44,3 +44,3 @@ * worker.on('message', resolve);

*
* The above example spawns a Worker thread for each `parse()` call. In actual
* The above example spawns a Worker thread for each `parseJSAsync()` call. In
* practice, use a pool of Workers for these kinds of tasks. Otherwise, the

@@ -55,13 +55,13 @@ * overhead of creating Workers would likely exceed their benefit.

* specifically `argv` and `execArgv` options.
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/worker_threads.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/worker_threads.js)
*/
declare module 'worker_threads' {
import { Blob } from 'node:buffer';
import { Context } from 'node:vm';
import { EventEmitter } from 'node:events';
import { EventLoopUtilityFunction } from 'node:perf_hooks';
import { FileHandle } from 'node:fs/promises';
import { Readable, Writable } from 'node:stream';
import { URL } from 'node:url';
import { X509Certificate } from 'node:crypto';
declare module "worker_threads" {
import { Blob } from "node:buffer";
import { Context } from "node:vm";
import { EventEmitter } from "node:events";
import { EventLoopUtilityFunction } from "node:perf_hooks";
import { FileHandle } from "node:fs/promises";
import { Readable, Writable } from "node:stream";
import { URL } from "node:url";
import { X509Certificate } from "node:crypto";
const isMainThread: boolean;

@@ -79,3 +79,3 @@ const parentPort: null | MessagePort;

* ```js
* const { MessageChannel } = require('worker_threads');
* const { MessageChannel } = require('node:worker_threads');
*

@@ -129,3 +129,3 @@ * const { port1, port2 } = new MessageChannel();

* ```js
* const { MessageChannel } = require('worker_threads');
* const { MessageChannel } = require('node:worker_threads');
* const { port1, port2 } = new MessageChannel();

@@ -141,3 +141,3 @@ *

*
* `transferList` may be a list of [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), `MessagePort` and `FileHandle` objects.
* `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

@@ -153,3 +153,3 @@ * anymore (even if they are not contained in `value`). Unlike with `child processes`, transferring handles such as network sockets is currently

* ```js
* const { MessageChannel } = require('worker_threads');
* const { MessageChannel } = require('node:worker_threads');
* const { port1, port2 } = new MessageChannel();

@@ -181,8 +181,8 @@ *

* For more information on the serialization and deserialization mechanisms
* behind this API, see the `serialization API of the v8 module`.
* behind this API, see the `serialization API of the node:v8 module`.
* @since v10.5.0
*/
postMessage(value: any, transferList?: ReadonlyArray<TransferListItem>): void;
postMessage(value: any, transferList?: readonly TransferListItem[]): void;
/**
* 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
* 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.

@@ -217,33 +217,33 @@ *

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: "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: "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: "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: "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: "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: "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: "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: "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;

@@ -275,2 +275,8 @@ }

trackUnmanagedFds?: boolean | undefined;
/**
* An optional `name` to be appended to the worker title
* for debuggin/identification purposes, making the final title as
* `[worker ${id}] ${name}`.
*/
name?: string | undefined;
}

@@ -302,5 +308,5 @@ interface ResourceLimits {

*
* * The `process.stdin`, `process.stdout` and `process.stderr` may be redirected by the parent thread.
* * The `require('worker_threads').isMainThread` property is set to `false`.
* * The `require('worker_threads').parentPort` message port is available.
* * The `process.stdin`, `process.stdout`, and `process.stderr` streams may be redirected by the parent thread.
* * The `require('node:worker_threads').isMainThread` property is set to `false`.
* * The `require('node:worker_threads').parentPort` message port is available.
* * `process.exit()` does not stop the whole program, just the single thread,

@@ -312,3 +318,4 @@ * and `process.abort()` is not available.

* unless otherwise specified. Changes to one copy are not visible in other
* threads, and are not visible to native add-ons (unless `worker.SHARE_ENV` is passed as the `env` option to the `Worker` constructor).
* threads, and are not visible to native add-ons (unless `worker.SHARE_ENV` is passed as the `env` option to the `Worker` constructor). On Windows, unlike the main thread, a copy of the
* environment variables operates in a case-sensitive manner.
* * `process.title` cannot be modified.

@@ -323,7 +330,7 @@ * * Signals are not delivered through `process.on('...')`.

*
* Like [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) and the `cluster module`, two-way communication can be
* achieved through inter-thread message passing. Internally, a `Worker` has a
* built-in pair of `MessagePort` s that are already associated with each other
* when the `Worker` is created. While the `MessagePort` object on the parent side
* is not directly exposed, its functionalities are exposed through `worker.postMessage()` and the `worker.on('message')` event
* Like [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) and the `node:cluster module`, two-way communication
* can be achieved through inter-thread message passing. Internally, a `Worker` has
* a built-in pair of `MessagePort` s that are already associated with each
* other when the `Worker` is created. While the `MessagePort` object on the parent
* side is not directly exposed, its functionalities are exposed through `worker.postMessage()` and the `worker.on('message')` event
* on the `Worker` object for the parent thread.

@@ -341,6 +348,6 @@ *

* ```js
* const assert = require('assert');
* const assert = require('node:assert');
* const {
* Worker, MessageChannel, MessagePort, isMainThread, parentPort
* } = require('worker_threads');
* Worker, MessageChannel, MessagePort, isMainThread, parentPort,
* } = require('node:worker_threads');
* if (isMainThread) {

@@ -385,3 +392,3 @@ * const worker = new Worker(__filename);

* An integer identifier for the referenced thread. Inside the worker thread,
* it is available as `require('worker_threads').threadId`.
* it is available as `require('node:worker_threads').threadId`.
* This value is unique for each `Worker` instance inside a single process.

@@ -403,3 +410,3 @@ * @since v10.5.0

* instance. Similar to `perf_hooks.performance`.
* @since v15.1.0, v12.22.0
* @since v15.1.0, v14.17.0, v12.22.0
*/

@@ -414,9 +421,9 @@ readonly performance: WorkerPerformance;

/**
* Send a message to the worker that is received via `require('worker_threads').parentPort.on('message')`.
* Send a message to the worker that is received via `require('node:worker_threads').parentPort.on('message')`.
* See `port.postMessage()` for more details.
* @since v10.5.0
*/
postMessage(value: any, transferList?: ReadonlyArray<TransferListItem>): void;
postMessage(value: any, transferList?: readonly TransferListItem[]): 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
* 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

@@ -449,49 +456,49 @@ * no effect.

getHeapSnapshot(): Promise<Readable>;
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: "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: "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: "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: "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: "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: "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: "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: "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;

@@ -510,4 +517,4 @@ }

* BroadcastChannel,
* Worker
* } = require('worker_threads');
* Worker,
* } = require('node:worker_threads');
*

@@ -530,3 +537,2 @@ * const bc = new BroadcastChannel('hello');

* @since v15.4.0
* @experimental
*/

@@ -568,3 +574,3 @@ class BroadcastChannel {

* ```js
* const { MessageChannel, markAsUntransferable } = require('worker_threads');
* const { MessageChannel, markAsUntransferable } = require('node:worker_threads');
*

@@ -611,6 +617,6 @@ * const pooledBuffer = new ArrayBuffer(8);

* Receive a single message from a given `MessagePort`. If no message is available,`undefined` is returned, otherwise an object with a single `message` property
* that contains the message payload, corresponding to the oldest message in the`MessagePort`’s queue.
* that contains the message payload, corresponding to the oldest message in the`MessagePort`'s queue.
*
* ```js
* const { MessageChannel, receiveMessageOnPort } = require('worker_threads');
* const { MessageChannel, receiveMessageOnPort } = require('node:worker_threads');
* const { port1, port2 } = new MessageChannel();

@@ -630,4 +636,4 @@ * port1.postMessage({ hello: 'world' });

| {
message: any;
}
message: any;
}
| undefined;

@@ -647,3 +653,3 @@ type Serializable = string | object | number | boolean | bigint;

* getEnvironmentData,
* } = require('worker_threads');
* } = require('node:worker_threads');
*

@@ -657,4 +663,3 @@ * if (isMainThread) {

* ```
* @since v15.12.0
* @experimental
* @since v15.12.0, v14.18.0
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.

@@ -665,4 +670,3 @@ */

* The `worker.setEnvironmentData()` API sets the content of`worker.getEnvironmentData()` in the current thread and all new `Worker`instances spawned from the current context.
* @since v15.12.0
* @experimental
* @since v15.12.0, v14.18.0
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.

@@ -673,5 +677,43 @@ * @param value Any arbitrary, cloneable JavaScript value that will be cloned and passed automatically to all new `Worker` instances. If `value` is passed as `undefined`, any previously set value

function setEnvironmentData(key: Serializable, value: Serializable): void;
import {
BroadcastChannel as _BroadcastChannel,
MessageChannel as _MessageChannel,
MessagePort as _MessagePort,
} from "worker_threads";
global {
/**
* `BroadcastChannel` class is a global reference for `require('worker_threads').BroadcastChannel`
* 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 `require('worker_threads').MessageChannel`
* 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 `require('worker_threads').MessagePort`
* https://nodejs.org/api/globals.html#messageport
* @since v15.0.0
*/
var MessagePort: typeof globalThis extends {
onmessage: any;
MessagePort: infer T;
} ? T
: typeof _MessagePort;
}
}
declare module 'node:worker_threads' {
export * from 'worker_threads';
declare module "node:worker_threads" {
export * from "worker_threads";
}
/**
* The `zlib` module provides compression functionality implemented using Gzip,
* Deflate/Inflate, and Brotli.
* The `node:zlib` module provides compression functionality implemented using
* Gzip, Deflate/Inflate, and Brotli.
*

@@ -8,3 +8,3 @@ * To access it:

* ```js
* const zlib = require('zlib');
* const zlib = require('node:zlib');
* ```

@@ -19,8 +19,8 @@ *

* ```js
* const { createGzip } = require('zlib');
* const { pipeline } = require('stream');
* const { createGzip } = require('node:zlib');
* const { pipeline } = require('node:stream');
* const {
* createReadStream,
* createWriteStream
* } = require('fs');
* createWriteStream,
* } = require('node:fs');
*

@@ -40,3 +40,3 @@ * const gzip = createGzip();

*
* const { promisify } = require('util');
* const { promisify } = require('node:util');
* const pipe = promisify(pipeline);

@@ -61,3 +61,3 @@ *

* ```js
* const { deflate, unzip } = require('zlib');
* const { deflate, unzip } = require('node:zlib');
*

@@ -84,3 +84,3 @@ * const input = '.................................';

*
* const { promisify } = require('util');
* const { promisify } = require('node:util');
* const do_unzip = promisify(unzip);

@@ -96,6 +96,6 @@ *

* @since v0.5.8
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/zlib.js)
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/zlib.js)
*/
declare module 'zlib' {
import * as stream from 'node:stream';
declare module "zlib" {
import * as stream from "node:stream";
interface ZlibOptions {

@@ -137,7 +137,7 @@ /**

| {
/**
* Each key is a `constants.BROTLI_*` constant.
*/
[key: number]: boolean | number;
}
/**
* Each key is a `constants.BROTLI_*` constant.
*/
[key: number]: boolean | number;
}
| undefined;

@@ -522,4 +522,4 @@ maxOutputLength?: number | undefined;

}
declare module 'node:zlib' {
export * from 'zlib';
declare module "node:zlib" {
export * from "zlib";
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc