Compare commits

..

No commits in common. "master" and "v.4.5" have entirely different histories.

347 changed files with 814478 additions and 616945 deletions

View File

@ -4,7 +4,7 @@ Add this step into workflow
```
- name: Set up Maven
uses: stCarolas/setup-maven@v5
uses: stCarolas/setup-maven@v4.5
with:
maven-version: 3.8.2
```

View File

@ -6,5 +6,5 @@ inputs:
description: 'Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0'
default: '3.8.2'
runs:
using: 'node20'
using: 'node16'
main: 'lib/setup-maven.js'

View File

@ -1,27 +1,4 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
@ -31,8 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMaven = void 0;
// Load tempDirectory before it gets wiped by tool-cache
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || '';
const core = __importStar(require("@actions/core"));

View File

@ -1,27 +1,4 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
@ -31,6 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const installer = __importStar(require("./installer"));

24
node_modules/.package-lock.json generated vendored
View File

@ -1,7 +1,7 @@
{
"name": "setup-maven",
"version": "1.0.0",
"lockfileVersion": 3,
"lockfileVersion": 2,
"requires": true,
"packages": {
"node_modules/@actions/core": {
@ -185,12 +185,9 @@
}
},
"node_modules/@types/node": {
"version": "20.11.6",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.6.tgz",
"integrity": "sha512-+EOokTnksGVgip2PbYbr3xnR7kZigh4LbybAfBAw5BpnQ+FqBYUsvCEjYd70IXKlbohQ64mzEYmMtlWUY8q//Q==",
"dependencies": {
"undici-types": "~5.26.4"
}
"version": "16.11.64",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.64.tgz",
"integrity": "sha512-z5hPTlVFzNwtJ2LNozTpJcD1Cu44c4LNuzaq1mwxmiHWQh2ULdR6Vjwo1UGldzRpzL0yUEdZddnfqGW2G70z6Q=="
},
"node_modules/@types/normalize-package-data": {
"version": "2.4.0",
@ -1157,16 +1154,16 @@
}
},
"node_modules/typescript": {
"version": "5.3.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
"version": "3.7.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.3.tgz",
"integrity": "sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
"node": ">=4.2.0"
}
},
"node_modules/underscore": {
@ -1174,11 +1171,6 @@
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.4.tgz",
"integrity": "sha512-BQFnUDuAQ4Yf/cYY5LNrK9NCJFKriaRbD9uR1fTeXnBeoa97W0i41qkZfGO9pSo8I5KzjAcSY2XYtdf0oKd7KQ=="
},
"node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
},
"node_modules/universal-user-agent": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-2.1.0.tgz",

0
node_modules/@types/node/LICENSE generated vendored Normal file → Executable file
View File

11
node_modules/@types/node/README.md generated vendored Normal file → Executable file
View File

@ -2,14 +2,15 @@
> `npm install --save @types/node`
# Summary
This package contains type definitions for node (https://nodejs.org/).
This package contains type definitions for Node.js (https://nodejs.org/).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v16.
### Additional Details
* Last updated: Wed, 24 Jan 2024 06:08:24 GMT
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
* Last updated: Mon, 03 Oct 2022 22:33:04 GMT
* Dependencies: none
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
# Credits
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).
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), [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).

286
node_modules/@types/node/assert.d.ts generated vendored Normal file → Executable file
View File

@ -1,9 +1,9 @@
/**
* The `node:assert` module provides a set of assertion functions for verifying
* The `assert` module provides a set of assertion functions for verifying
* invariants.
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/assert.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/assert.js)
*/
declare module "assert" {
declare module 'assert' {
/**
* An alias of {@link ok}.
* @since v0.5.9
@ -12,29 +12,15 @@ declare module "assert" {
function assert(value: unknown, message?: string | Error): asserts value;
namespace assert {
/**
* Indicates the failure of an assertion. All errors thrown by the `node:assert`module will be instances of the `AssertionError` class.
* Indicates the failure of an assertion. All errors thrown by the `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;
/**
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
*/
code: "ERR_ASSERTION";
code: 'ERR_ASSERTION';
constructor(options?: {
/** If provided, the error message is set to this value. */
message?: string | undefined;
@ -45,15 +31,14 @@ declare module "assert" {
/** The `operator` property on the error instance. */
operator?: string | undefined;
/** If provided, the generated stack trace omits frames before this function. */
// eslint-disable-next-line @typescript-eslint/ban-types
// tslint:disable-next-line:ban-types
stackStartFn?: Function | undefined;
});
}
/**
* This feature is deprecated and will be removed in a future version.
* Please consider using alternatives such as the `mock` helper function.
* This feature is currently experimental and behavior might still change.
* @since v14.2.0, v12.19.0
* @deprecated Deprecated
* @experimental
*/
class CallTracker {
/**
@ -62,7 +47,7 @@ declare module "assert" {
* error.
*
* ```js
* import assert from 'node:assert';
* import assert from 'assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
@ -80,44 +65,26 @@ declare module "assert" {
*/
calls(exact?: number): () => void;
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
/**
* 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
* the functions that have not been called the expected number of times.
*
* ```js
* import assert from 'node:assert';
* import assert from 'assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
*
* function func() {}
*
* function foo() {}
*
* // Returns a function that wraps func() that must be called exact times
* // before tracker.verify().
* const callsfunc = tracker.calls(func, 2);
*
* // Returns an array containing information on callsfunc()
* console.log(tracker.report());
* tracker.report();
* // [
* // {
* // message: 'Expected the func function to be executed 2 time(s) but was
@ -130,39 +97,15 @@ declare module "assert" {
* // ]
* ```
* @since v14.2.0, v12.19.0
* @return An Array of objects containing information about the wrapper functions returned by `calls`.
* @return 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
* have not been called the expected number of times.
*
* ```js
* import assert from 'node:assert';
* import assert from 'assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
@ -182,10 +125,6 @@ declare module "assert" {
*/
verify(): void;
}
interface CallTrackerCall {
thisArg: object;
arguments: unknown[];
}
interface CallTrackerReportInformation {
message: string;
/** The actual number of times the function was called. */
@ -197,14 +136,14 @@ declare module "assert" {
/** A stack trace of the function. */
stack: object;
}
type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error;
type AssertPredicate = RegExp | (new () => object) | ((thrown: unknown) => boolean) | object | Error;
/**
* Throws an `AssertionError` with the provided error message or a default
* error message. If the `message` parameter is an instance of an `Error` then
* it will be thrown instead of the `AssertionError`.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.fail();
* // AssertionError [ERR_ASSERTION]: Failed
@ -228,8 +167,8 @@ declare module "assert" {
expected: unknown,
message?: string | Error,
operator?: string,
// eslint-disable-next-line @typescript-eslint/ban-types
stackStartFn?: Function,
// tslint:disable-next-line:ban-types
stackStartFn?: Function
): never;
/**
* Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`.
@ -242,7 +181,7 @@ declare module "assert" {
* thrown in a file! See below for further details.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.ok(true);
* // OK
@ -277,7 +216,7 @@ declare module "assert" {
* ```
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* // Using `assert()` works the same:
* assert(0);
@ -298,11 +237,11 @@ declare module "assert" {
* > Stability: 3 - Legacy: Use {@link strictEqual} instead.
*
* Tests shallow, coercive equality between the `actual` and `expected` parameters
* 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`.
* 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`.
*
* ```js
* import assert from 'node:assert';
* import assert from 'assert';
*
* assert.equal(1, 1);
* // OK, 1 == 1
@ -331,11 +270,12 @@ declare module "assert" {
*
* > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
*
* 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`.
* 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`.
*
* ```js
* import assert from 'node:assert';
* import assert from 'assert';
*
* assert.notEqual(1, 2);
* // OK
@ -382,24 +322,24 @@ declare module "assert" {
* Tests for any deep inequality. Opposite of {@link deepEqual}.
*
* ```js
* import assert from 'node:assert';
* import assert from 'assert';
*
* const obj1 = {
* a: {
* b: 1,
* },
* b: 1
* }
* };
* const obj2 = {
* a: {
* b: 2,
* },
* b: 2
* }
* };
* const obj3 = {
* a: {
* b: 1,
* },
* b: 1
* }
* };
* const obj4 = { __proto__: obj1 };
* const obj4 = Object.create(obj1);
*
* assert.notDeepEqual(obj1, obj1);
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
@ -422,10 +362,10 @@ declare module "assert" {
function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
/**
* Tests strict equality between the `actual` and `expected` parameters as
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
* determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.strictEqual(1, 2);
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
@ -460,10 +400,10 @@ declare module "assert" {
function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
/**
* Tests strict inequality between the `actual` and `expected` parameters as
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
* determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.notStrictEqual(1, 2);
* // OK
@ -494,7 +434,7 @@ declare module "assert" {
* Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
* // OK
@ -525,14 +465,14 @@ declare module "assert" {
* Custom validation object/error instance:
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* const err = new TypeError('Wrong value');
* err.code = 404;
* err.foo = 'bar';
* err.info = {
* nested: true,
* baz: 'text',
* baz: 'text'
* };
* err.reg = /abc/i;
*
@ -545,16 +485,16 @@ declare module "assert" {
* message: 'Wrong value',
* info: {
* 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:
* assert.throws(
* throws(
* () => {
* throw err;
* },
@ -568,17 +508,17 @@ declare module "assert" {
* info: {
* nested: true,
* // It is not possible to use regular expressions for nested properties!
* baz: 'text',
* baz: 'text'
* },
* // The `reg` property contains a regular expression and only if the
* // validation object contains an identical regular expression, it is going
* // to pass.
* reg: /abc/i,
* },
* reg: /abc/i
* }
* );
*
* // Fails due to the different `message` and `name` properties:
* assert.throws(
* throws(
* () => {
* const otherErr = new Error('Not found');
* // Copy all enumerable properties from `err` to `otherErr`.
@ -589,20 +529,20 @@ declare module "assert" {
* },
* // The error's `message` and `name` properties will also be checked when using
* // an error as validation object.
* err,
* err
* );
* ```
*
* Validate instanceof using constructor:
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.throws(
* () => {
* throw new Error('Wrong value');
* },
* Error,
* Error
* );
* ```
*
@ -612,13 +552,13 @@ declare module "assert" {
* therefore also include the error name.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.throws(
* () => {
* throw new Error('Wrong value');
* },
* /^Error: Wrong value$/,
* /^Error: Wrong value$/
* );
* ```
*
@ -628,7 +568,7 @@ declare module "assert" {
* It will otherwise fail with an `AssertionError`.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.throws(
* () => {
@ -644,7 +584,7 @@ declare module "assert" {
* // possible.
* return true;
* },
* 'unexpected error',
* 'unexpected error'
* );
* ```
*
@ -654,7 +594,7 @@ declare module "assert" {
* a string as the second argument gets considered:
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* function throwingFirst() {
* throw new Error('First');
@ -710,20 +650,20 @@ declare module "assert" {
* propagated back to the caller.
*
* 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.
*
* The following, for instance, will throw the `TypeError` because there is no
* matching error type in the assertion:
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
* SyntaxError,
* SyntaxError
* );
* ```
*
@ -731,27 +671,27 @@ declare module "assert" {
* 'Got unwanted exception...':
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
* TypeError,
* TypeError
* );
* ```
*
* If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message:
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
* /Wrong value/,
* 'Whoops',
* 'Whoops'
* );
* // Throws: AssertionError: Got unwanted exception: Whoops
* ```
@ -765,7 +705,7 @@ declare module "assert" {
* from the error passed to `ifError()` including the potential new frames for`ifError()` itself.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.ifError(null);
* // OK
@ -811,7 +751,7 @@ declare module "assert" {
* If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* await assert.rejects(
* async () => {
@ -819,13 +759,13 @@ declare module "assert" {
* },
* {
* name: 'TypeError',
* message: 'Wrong value',
* },
* message: 'Wrong value'
* }
* );
* ```
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* await assert.rejects(
* async () => {
@ -835,16 +775,16 @@ declare module "assert" {
* assert.strictEqual(err.name, 'TypeError');
* assert.strictEqual(err.message, 'Wrong value');
* return true;
* },
* }
* );
* ```
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.rejects(
* Promise.reject(new Error('Wrong value')),
* Error,
* Error
* ).then(() => {
* // ...
* });
@ -857,11 +797,7 @@ declare module "assert" {
* @since v10.0.0
*/
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>;
/**
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
* calls the function and awaits the returned promise to complete. It will then
@ -878,24 +814,24 @@ declare module "assert" {
* error messages as expressive as possible.
*
* 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.
*
* Besides the async nature to await the completion behaves identically to {@link doesNotThrow}.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* await assert.doesNotReject(
* async () => {
* throw new TypeError('Wrong value');
* },
* SyntaxError,
* SyntaxError
* );
* ```
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
* .then(() => {
@ -904,20 +840,13 @@ declare module "assert" {
* ```
* @since v10.0.0
*/
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>;
/**
* Expects the `string` input to match the regular expression.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.match('I will fail', /pass/);
* // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
@ -940,7 +869,7 @@ declare module "assert" {
* Expects the `string` input not to match the regular expression.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.doesNotMatch('I will fail', /fail/);
* // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...
@ -959,38 +888,25 @@ declare module "assert" {
* @since v13.6.0, v12.16.0
*/
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;
}

8
node_modules/@types/node/assert/strict.d.ts generated vendored Normal file → Executable file
View File

@ -1,8 +1,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;
}

126
node_modules/@types/node/async_hooks.d.ts generated vendored Normal file → Executable file
View File

@ -1,27 +1,19 @@
/**
* 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:
* The `async_hooks` module provides an API to track asynchronous resources. It
* can be accessed using:
*
* ```js
* import async_hooks from 'node:async_hooks';
* import async_hooks from 'async_hooks';
* ```
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/async_hooks.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/async_hooks.js)
*/
declare module "async_hooks" {
declare module 'async_hooks' {
/**
* ```js
* import { executionAsyncId } from 'node:async_hooks';
* import fs from 'node:fs';
* import { executionAsyncId } from 'async_hooks';
*
* console.log(executionAsyncId()); // 1 - bootstrap
* const path = '.';
* fs.open(path, 'r', (err, fd) => {
* console.log(executionAsyncId()); // 6 - open()
* });
@ -59,8 +51,8 @@ declare module "async_hooks" {
* but having an object representing the top-level can be helpful.
*
* ```js
* import { open } from 'node:fs';
* import { executionAsyncId, executionAsyncResource } from 'node:async_hooks';
* import { open } from 'fs';
* import { executionAsyncId, executionAsyncResource } from 'async_hooks';
*
* console.log(executionAsyncId(), executionAsyncResource()); // 1 {}
* open(new URL(import.meta.url), 'r', (err, fd) => {
@ -72,11 +64,11 @@ declare module "async_hooks" {
* use of a tracking `Map` to store the metadata:
*
* ```js
* import { createServer } from 'node:http';
* import { createServer } from 'http';
* import {
* executionAsyncId,
* executionAsyncResource,
* createHook,
* createHook
* } from 'async_hooks';
* const sym = Symbol('state'); // Private symbol to avoid pollution
*
@ -86,7 +78,7 @@ declare module "async_hooks" {
* if (cr) {
* resource[sym] = cr[sym];
* }
* },
* }
* }).enable();
*
* const server = createServer((req, res) => {
@ -175,11 +167,11 @@ declare module "async_hooks" {
* specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
*
* ```js
* import { createHook } from 'node:async_hooks';
* import { createHook } from 'async_hooks';
*
* const asyncHook = createHook({
* init(asyncId, type, triggerAsyncId, resource) { },
* destroy(asyncId) { },
* destroy(asyncId) { }
* });
* ```
*
@ -231,13 +223,13 @@ declare module "async_hooks" {
* The following is an overview of the `AsyncResource` API.
*
* ```js
* import { AsyncResource, executionAsyncId } from 'node:async_hooks';
* import { AsyncResource, executionAsyncId } from 'async_hooks';
*
* // AsyncResource() is meant to be extended. Instantiating a
* // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
* // async_hook.executionAsyncId() is used.
* const asyncResource = new AsyncResource(
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false },
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }
* );
*
* // Run a function in the execution context of the resource. This will
@ -271,6 +263,9 @@ declare module "async_hooks" {
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
* @param fn The function to bind to the current execution context.
* @param type An optional name to associate with the underlying `AsyncResource`.
@ -278,14 +273,23 @@ declare module "async_hooks" {
static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(
fn: Func,
type?: string,
thisArg?: ThisArg,
): Func;
thisArg?: ThisArg
): Func & {
asyncResource: AsyncResource;
};
/**
* 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;
bind<Func extends (...args: any[]) => any>(
fn: Func
): Func & {
asyncResource: AsyncResource;
};
/**
* Call the provided function with the provided arguments in the execution context
* of the async resource. This will establish the context, trigger the AsyncHooks
@ -296,11 +300,7 @@ declare module "async_hooks" {
* @param thisArg The receiver to be used for the function call.
* @param args Optional arguments to pass to the function.
*/
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;
/**
* 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
@ -314,6 +314,7 @@ declare module "async_hooks" {
*/
asyncId(): number;
/**
*
* @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.
*/
triggerAsyncId(): number;
@ -321,17 +322,17 @@ declare module "async_hooks" {
/**
* This class creates stores that stay coherent through asynchronous operations.
*
* 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.
* 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.
*
* The following example uses `AsyncLocalStorage` to build a simple logger
* that assigns IDs to incoming HTTP requests and includes them in messages
* logged within each request.
*
* ```js
* import http from 'node:http';
* import { AsyncLocalStorage } from 'node:async_hooks';
* import http from 'http';
* import { AsyncLocalStorage } from 'async_hooks';
*
* const asyncLocalStorage = new AsyncLocalStorage();
*
@ -363,48 +364,10 @@ declare module "async_hooks" {
*
* Each instance of `AsyncLocalStorage` maintains an independent storage context.
* Multiple instances can safely exist simultaneously without risk of interfering
* with each other's data.
* with each other data.
* @since v13.10.0, v12.17.0
*/
class AsyncLocalStorage<T> {
/**
* 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
* to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
@ -432,9 +395,8 @@ declare module "async_hooks" {
getStore(): T | undefined;
/**
* Runs a function synchronously within a context and returns its
* return value. The store is not accessible outside of the callback function.
* The store is accessible to any asynchronous operations created within the
* callback.
* return value. The store is not accessible outside of the callback function or
* the asynchronous operations created within the callback.
*
* The optional `args` are passed to the callback function.
*
@ -448,9 +410,6 @@ declare module "async_hooks" {
* try {
* asyncLocalStorage.run(store, () => {
* asyncLocalStorage.getStore(); // Returns the store object
* setTimeout(() => {
* asyncLocalStorage.getStore(); // Returns the store object
* }, 200);
* throw new Error();
* });
* } catch (e) {
@ -460,7 +419,6 @@ declare module "async_hooks" {
* ```
* @since v13.10.0, v12.17.0
*/
run<R>(store: T, callback: () => R): R;
run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
/**
* Runs a function synchronously outside of a context and returns its
@ -534,6 +492,6 @@ declare module "async_hooks" {
enterWith(store: T): void;
}
}
declare module "node:async_hooks" {
export * from "async_hooks";
declare module 'node:async_hooks' {
export * from 'async_hooks';
}

403
node_modules/@types/node/buffer.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

562
node_modules/@types/node/child_process.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

252
node_modules/@types/node/cluster.d.ts generated vendored Normal file → Executable file
View File

@ -1,19 +1,18 @@
/**
* 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.
* 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.
*
* The cluster module allows easy creation of child processes that all share
* server ports.
*
* ```js
* import cluster from 'node:cluster';
* import http from 'node:http';
* import { availableParallelism } from 'node:os';
* import process from 'node:process';
* import cluster from 'cluster';
* import http from 'http';
* import { cpus } from 'os';
* import process from 'process';
*
* const numCPUs = availableParallelism();
* const numCPUs = cpus().length;
*
* if (cluster.isPrimary) {
* console.log(`Primary ${process.pid} is running`);
@ -50,13 +49,12 @@
* ```
*
* 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/v20.2.0/lib/cluster.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.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";
type SerializationType = "json" | "advanced";
declare module 'cluster' {
import * as child from 'node:child_process';
import EventEmitter = require('node:events');
import * as net from 'node:net';
export interface ClusterSettings {
execArgv?: string[] | undefined; // default: process.execArgv
exec?: string | undefined;
@ -66,14 +64,11 @@ declare module "cluster" {
uid?: number | undefined;
gid?: number | undefined;
inspectPort?: number | (() => number) | undefined;
serialization?: SerializationType | undefined;
cwd?: string | undefined;
windowsHide?: boolean | undefined;
}
export interface Address {
address: string;
port: number;
addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6"
addressType: number | 'udp4' | 'udp6'; // 4, 6, -1, "udp4", "udp6"
}
/**
* A `Worker` object contains all public information and method about a worker.
@ -104,9 +99,9 @@ declare module "cluster" {
/**
* Send a message to a worker or primary, optionally with a handle.
*
* In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
* 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()`.
*
* This example will echo back all messages from the primary:
*
@ -125,25 +120,22 @@ declare module "cluster" {
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
*/
send(message: 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 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`.
* 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`.
*
* The `kill()` function kills the worker process without waiting for a graceful
* disconnect, it has the same behavior as `worker.process.kill()`.
* 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()`.
*
* This method is aliased as `worker.destroy()` for backwards compatibility.
* Causes `.exitedAfterDisconnect` to be set.
*
* This method is aliased as `worker.destroy()` for backward compatibility.
*
* In a worker, `process.kill()` exists, but it is not this function;
* it is `kill()`.
@ -196,7 +188,7 @@ declare module "cluster" {
* });
*
* } else if (cluster.isWorker) {
* const net = require('node:net');
* const net = require('net');
* const server = net.createServer((socket) => {
* // Connections never end
* });
@ -226,12 +218,12 @@ declare module "cluster" {
* because of exiting or being signaled). Otherwise, it returns `false`.
*
* ```js
* import cluster from 'node:cluster';
* import http from 'node:http';
* import { availableParallelism } from 'node:os';
* import process from 'node:process';
* import cluster from 'cluster';
* import http from 'http';
* import { cpus } from 'os';
* import process from 'process';
*
* const numCPUs = availableParallelism();
* const numCPUs = cpus().length;
*
* if (cluster.isPrimary) {
* console.log(`Primary ${process.pid} is running`);
@ -261,8 +253,7 @@ declare module "cluster" {
*/
isDead(): boolean;
/**
* This property is `true` if the worker exited due to `.disconnect()`.
* If the worker exited any other way, it is `false`. If the
* 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
* worker has not exited, it is `undefined`.
*
* The boolean `worker.exitedAfterDisconnect` allows distinguishing between
@ -292,47 +283,47 @@ declare module "cluster" {
* 6. online
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "disconnect", listener: () => void): this;
addListener(event: "error", listener: (error: Error) => void): this;
addListener(event: "exit", listener: (code: number, signal: string) => void): this;
addListener(event: "listening", listener: (address: Address) => void): this;
addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
addListener(event: "online", listener: () => void): this;
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;
}
export interface Cluster extends EventEmitter {
disconnect(callback?: () => void): void;
@ -364,69 +355,60 @@ declare module "cluster" {
* 7. setup
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "disconnect", listener: (worker: Worker) => void): this;
addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
addListener(event: "fork", listener: (worker: Worker) => void): this;
addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
addListener(
event: "message",
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
): this; // the handle is a net.Socket or net.Server object, or undefined.
addListener(event: "online", listener: (worker: Worker) => void): this;
addListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
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;
}
const cluster: Cluster;
export default 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';
}

43
node_modules/@types/node/console.d.ts generated vendored Normal file → Executable file
View File

@ -1,11 +1,11 @@
/**
* The `node:console` module provides a simple debugging console that is similar to
* the JavaScript console mechanism provided by web browsers.
* The `console` module provides a simple debugging console that is similar to the
* JavaScript console mechanism provided by web browsers.
*
* The module exports two specific components:
*
* * A `Console` class with methods such as `console.log()`, `console.error()`, and`console.warn()` that can be used to write to any Node.js stream.
* * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('node: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('console')`.
*
* _**Warning**_: The global console object's methods are neither consistently
* synchronous like the browser APIs they resemble, nor are they consistently
@ -53,14 +53,14 @@
* myConsole.warn(`Danger ${name}! Danger!`);
* // Prints: Danger Will Robinson! Danger!, to err
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/console.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.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 {
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
interface Console {
@ -123,7 +123,7 @@ declare module "node:console" {
* >
* ```
* @since v8.3.0
* @param [label='default'] The display label for the counter.
* @param label The display label for the counter.
*/
count(label?: string): void;
/**
@ -141,7 +141,7 @@ declare module "node:console" {
* >
* ```
* @since v8.3.0
* @param [label='default'] The display label for the counter.
* @param label The display label for the counter.
*/
countReset(label?: string): void;
/**
@ -221,7 +221,7 @@ declare module "node:console" {
log(message?: any, ...optionalParams: any[]): void;
/**
* Try to construct a table with the columns of the properties of `tabularData`(or use `properties`) and rows of `tabularData` and log it. Falls back to just
* logging the argument if it can't be parsed as tabular.
* logging the argument if it cant be parsed as tabular.
*
* ```js
* // These can't be parsed as tabular data
@ -250,14 +250,13 @@ declare module "node:console" {
* @since v10.0.0
* @param properties Alternate properties for constructing the table.
*/
table(tabularData: any, properties?: readonly string[]): void;
table(tabularData: any, properties?: ReadonlyArray<string>): void;
/**
* Starts a timer that can be used to compute the duration of an operation. Timers
* are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in
* suitable time units to `stdout`. For example, if the elapsed
* time is 3869ms, `console.timeEnd()` displays "3.869s".
* @since v0.1.104
* @param [label='default']
*/
time(label?: string): void;
/**
@ -265,13 +264,12 @@ declare module "node:console" {
* prints the result to `stdout`:
*
* ```js
* console.time('bunch-of-stuff');
* // Do a bunch of stuff.
* console.timeEnd('bunch-of-stuff');
* // Prints: bunch-of-stuff: 225.438ms
* console.time('100-elements');
* for (let i = 0; i < 100; i++) {}
* console.timeEnd('100-elements');
* // prints 100-elements: 225.438ms
* ```
* @since v0.1.104
* @param [label='default']
*/
timeEnd(label?: string): void;
/**
@ -287,7 +285,6 @@ declare module "node:console" {
* console.timeEnd('process');
* ```
* @since v10.7.0
* @param [label='default']
*/
timeLog(label?: string, ...data: any[]): void;
/**
@ -395,7 +392,7 @@ declare module "node:console" {
stdout: NodeJS.WritableStream;
stderr?: NodeJS.WritableStream | undefined;
ignoreErrors?: boolean | undefined;
colorMode?: boolean | "auto" | undefined;
colorMode?: boolean | 'auto' | undefined;
inspectOptions?: InspectOptions | undefined;
/**
* Set group indentation
@ -405,8 +402,8 @@ declare module "node:console" {
}
interface ConsoleConstructor {
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;
}
}
var console: Console;

23
node_modules/@types/node/constants.d.ts generated vendored Normal file → Executable file
View File

@ -1,19 +1,18 @@
/** @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;
}

1699
node_modules/@types/node/crypto.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

177
node_modules/@types/node/dgram.d.ts generated vendored Normal file → Executable file
View File

@ -1,13 +1,13 @@
/**
* The `node:dgram` module provides an implementation of UDP datagram sockets.
* The `dgram` module provides an implementation of UDP datagram sockets.
*
* ```js
* import dgram from 'node:dgram';
* import dgram from 'dgram';
*
* const server = dgram.createSocket('udp4');
*
* server.on('error', (err) => {
* console.error(`server error:\n${err.stack}`);
* console.log(`server error:\n${err.stack}`);
* server.close();
* });
*
@ -23,15 +23,15 @@
* server.bind(41234);
* // Prints: server listening 0.0.0.0:41234
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dgram.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/dgram.js)
*/
declare module "dgram" {
import { AddressInfo } from "node:net";
import * as dns from "node:dns";
import { Abortable, EventEmitter } from "node:events";
declare module 'dgram' {
import { AddressInfo } from 'node:net';
import * as dns from 'node:dns';
import { EventEmitter, Abortable } from 'node:events';
interface RemoteInfo {
address: string;
family: "IPv4" | "IPv6";
family: 'IPv4' | 'IPv6';
port: number;
size: number;
}
@ -41,7 +41,7 @@ declare module "dgram" {
exclusive?: boolean | undefined;
fd?: number | undefined;
}
type SocketType = "udp4" | "udp6";
type SocketType = 'udp4' | 'udp6';
interface SocketOptions extends Abortable {
type: SocketType;
reuseAddr?: boolean | undefined;
@ -51,13 +51,7 @@ declare module "dgram" {
ipv6Only?: boolean | undefined;
recvBufferSize?: number | undefined;
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;
}
/**
* Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram
@ -104,8 +98,8 @@ declare module "dgram" {
* When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur:
*
* ```js
* import cluster from 'node:cluster';
* import dgram from 'node:dgram';
* import cluster from 'cluster';
* import dgram from 'dgram';
*
* if (cluster.isPrimary) {
* cluster.fork(); // Works ok.
@ -122,7 +116,7 @@ declare module "dgram" {
addMembership(multicastAddress: string, multicastInterface?: string): void;
/**
* 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.
*
* This method throws `EBADF` if called on an unbound socket.
* @since v0.1.99
@ -148,12 +142,12 @@ declare module "dgram" {
* Example of a UDP server listening on port 41234:
*
* ```js
* import dgram from 'node:dgram';
* import dgram from 'dgram';
*
* const server = dgram.createSocket('udp4');
*
* server.on('error', (err) => {
* console.error(`server error:\n${err.stack}`);
* console.log(`server error:\n${err.stack}`);
* server.close();
* });
*
@ -227,16 +221,6 @@ declare module "dgram" {
* @return the `SO_SNDBUF` socket send buffer size in bytes.
*/
getSendBufferSize(): number;
/**
* @since v18.8.0, v16.19.0
* @return Number of bytes queued for sending.
*/
getSendQueueSize(): number;
/**
* @since v18.8.0, v16.19.0
* @return Number of send requests currently in the queue awaiting to be processed.
*/
getSendQueueCount(): number;
/**
* By default, binding a socket will cause it to block the Node.js process from
* exiting as long as the socket is open. The `socket.unref()` method can be used
@ -276,7 +260,7 @@ declare module "dgram" {
*
* The `address` argument is a string. If the value of `address` is a host name,
* DNS will be used to resolve the address of the host. If `address` is not
* provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default.
* provided or otherwise falsy, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default.
*
* If the socket has not been previously bound with a call to `bind`, the socket
* is assigned a random port number and is bound to the "all interfaces" address
@ -300,8 +284,8 @@ declare module "dgram" {
* Example of sending a UDP packet to a port on `localhost`;
*
* ```js
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
* import dgram from 'dgram';
* import { Buffer } from 'buffer';
*
* const message = Buffer.from('Some bytes');
* const client = dgram.createSocket('udp4');
@ -313,8 +297,8 @@ declare module "dgram" {
* Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`;
*
* ```js
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
* import dgram from 'dgram';
* import { Buffer } from 'buffer';
*
* const buf1 = Buffer.from('Some ');
* const buf2 = Buffer.from('bytes');
@ -332,8 +316,8 @@ declare module "dgram" {
* Example of sending a UDP packet using a socket connected to a port on`localhost`:
*
* ```js
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
* import dgram from 'dgram';
* import { Buffer } from 'buffer';
*
* const message = Buffer.from('Some bytes');
* const client = dgram.createSocket('udp4');
@ -351,42 +335,12 @@ declare module "dgram" {
* @param address Destination host name or IP address.
* @param callback Called when the message has been sent.
*/
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;
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;
/**
* Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP
* packets may be sent to a local interface's broadcast address.
@ -497,7 +451,7 @@ declare module "dgram" {
* TTL. If the TTL is decremented to 0 by a router, it will not be forwarded.
* Changing TTL values is typically done for network probes or when multicasting.
*
* The `ttl` argument may be between 1 and 255\. The default on most systems
* The `ttl` argument may be between between 1 and 255\. The default on most systems
* is 64.
*
* This method throws `EBADF` if called on an unbound socket.
@ -511,7 +465,7 @@ declare module "dgram" {
* process active, allowing the process to exit even if the socket is still
* listening.
*
* Calling `socket.unref()` multiple times will have no additional effect.
* Calling `socket.unref()` multiple times will have no addition effect.
*
* The `socket.unref()` method returns a reference to the socket so calls can be
* chained.
@ -549,48 +503,43 @@ declare module "dgram" {
* 5. message
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "connect", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "listening", listener: () => void): this;
addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
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;
/**
* Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
* @since v20.5.0
*/
[Symbol.asyncDispose](): Promise<void>;
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;
}
}
declare module "node:dgram" {
export * from "dgram";
declare module 'node:dgram' {
export * from 'dgram';
}

443
node_modules/@types/node/diagnostics_channel.d.ts generated vendored Normal file → Executable file
View File

@ -1,11 +1,11 @@
/**
* The `node:diagnostics_channel` module provides an API to create named channels
* The `diagnostics_channel` module provides an API to create named channels
* to report arbitrary message data for diagnostics purposes.
*
* It can be accessed using:
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import diagnostics_channel from 'diagnostics_channel';
* ```
*
* It is intended that a module writer wanting to report diagnostics messages
@ -19,11 +19,10 @@
* channels are used along with the shape of the message data. Channel names
* should generally include the module name to avoid collisions with data from
* other modules.
* @since v15.1.0, v14.17.0
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/diagnostics_channel.js)
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/diagnostics_channel.js)
*/
declare module "diagnostics_channel" {
import { AsyncLocalStorage } from "node:async_hooks";
declare module 'diagnostics_channel' {
/**
* Check if there are active subscribers to the named channel. This is helpful if
* the message you want to send might be expensive to prepare.
@ -32,7 +31,7 @@ declare module "diagnostics_channel" {
* performance-sensitive code.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import diagnostics_channel from 'diagnostics_channel';
*
* if (diagnostics_channel.hasSubscribers('my-channel')) {
* // There are subscribers, prepare and publish message
@ -42,14 +41,14 @@ declare module "diagnostics_channel" {
* @param name The channel name
* @return If there are active subscribers
*/
function hasSubscribers(name: string | symbol): boolean;
function hasSubscribers(name: string): boolean;
/**
* This is the primary entry-point for anyone wanting to publish to a named
* This is the primary entry-point for anyone wanting to interact with a named
* channel. It produces a channel object which is optimized to reduce overhead at
* publish time as much as possible.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import diagnostics_channel from 'diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
* ```
@ -57,86 +56,19 @@ declare module "diagnostics_channel" {
* @param name The channel name
* @return The named channel object
*/
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;
/**
* Creates a `TracingChannel` wrapper for the given `TracingChannel Channels`. If a name is given, the corresponding tracing
* channels will be created in the form of `tracing:${name}:${eventType}` where`eventType` corresponds to the types of `TracingChannel Channels`.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channelsByName = diagnostics_channel.tracingChannel('my-channel');
*
* // or...
*
* const channelsByCollection = diagnostics_channel.tracingChannel({
* start: diagnostics_channel.channel('tracing:my-channel:start'),
* end: diagnostics_channel.channel('tracing:my-channel:end'),
* asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'),
* asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'),
* error: diagnostics_channel.channel('tracing:my-channel:error'),
* });
* ```
* @since v19.9.0
* @experimental
* @param nameOrChannels Channel name or object containing all the `TracingChannel Channels`
* @return Collection of channels to trace with
*/
function tracingChannel<
StoreType = unknown,
ContextType extends object = StoreType extends object ? StoreType : object,
>(
nameOrChannels: string | TracingChannelCollection<StoreType, ContextType>,
): TracingChannel<StoreType, ContextType>;
function channel(name: string): Channel;
type ChannelListener = (message: unknown, name: string) => void;
/**
* The class `Channel` represents an individual named channel within the data
* pipeline. It is used to track subscribers and to publish messages when there
* pipeline. It is use to track subscribers and to publish messages when there
* are subscribers present. It exists as a separate object to avoid channel
* lookups at publish time, enabling very fast publish speeds and allowing
* for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly
* with `new Channel(name)` is not supported.
* @since v15.1.0, v14.17.0
*/
class Channel<StoreType = unknown, ContextType = StoreType> {
readonly name: string | symbol;
class Channel {
readonly name: string;
/**
* Check if there are active subscribers to this channel. This is helpful if
* the message you want to send might be expensive to prepare.
@ -145,7 +77,7 @@ declare module "diagnostics_channel" {
* performance-sensitive code.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import diagnostics_channel from 'diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
*
@ -156,18 +88,19 @@ declare module "diagnostics_channel" {
* @since v15.1.0, v14.17.0
*/
readonly hasSubscribers: boolean;
private constructor(name: string | symbol);
private constructor(name: string);
/**
* Publish a message to any subscribers to the channel. This will trigger
* message handlers synchronously so they will execute within the same context.
* 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';
* import diagnostics_channel from 'diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
*
* channel.publish({
* some: 'message',
* some: 'message'
* });
* ```
* @since v15.1.0, v14.17.0
@ -180,7 +113,7 @@ declare module "diagnostics_channel" {
* errors thrown in the message handler will trigger an `'uncaughtException'`.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import diagnostics_channel from 'diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
*
@ -189,7 +122,6 @@ declare module "diagnostics_channel" {
* });
* ```
* @since v15.1.0, v14.17.0
* @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)}
* @param onMessage The handler to receive channel messages
*/
subscribe(onMessage: ChannelListener): void;
@ -197,7 +129,7 @@ declare module "diagnostics_channel" {
* Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import diagnostics_channel from 'diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
*
@ -210,336 +142,11 @@ declare module "diagnostics_channel" {
* channel.unsubscribe(onMessage);
* ```
* @since v15.1.0, v14.17.0
* @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)}
* @param onMessage The previous subscribed handler to remove
* @return `true` if the handler was found, `false` otherwise.
*/
unsubscribe(onMessage: ChannelListener): void;
/**
* When `channel.runStores(context, ...)` is called, the given context data
* will be applied to any store bound to the channel. If the store has already been
* bound the previous `transform` function will be replaced with the new one.
* The `transform` function may be omitted to set the given context data as the
* context directly.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const store = new AsyncLocalStorage();
*
* const channel = diagnostics_channel.channel('my-channel');
*
* channel.bindStore(store, (data) => {
* return { data };
* });
* ```
* @since v19.9.0
* @experimental
* @param store The store to which to bind the context data
* @param transform Transform context data before setting the store context
*/
bindStore(store: AsyncLocalStorage<StoreType>, transform?: (context: ContextType) => StoreType): void;
/**
* Remove a message handler previously registered to this channel with `channel.bindStore(store)`.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const store = new AsyncLocalStorage();
*
* const channel = diagnostics_channel.channel('my-channel');
*
* channel.bindStore(store);
* channel.unbindStore(store);
* ```
* @since v19.9.0
* @experimental
* @param store The store to unbind from the channel.
* @return `true` if the store was found, `false` otherwise.
*/
unbindStore(store: any): void;
/**
* Applies the given data to any AsyncLocalStorage instances bound to the channel
* for the duration of the given function, then publishes to the channel within
* the scope of that data is applied to the stores.
*
* If a transform function was given to `channel.bindStore(store)` it will be
* applied to transform the message data before it becomes the context value for
* the store. The prior storage context is accessible from within the transform
* function in cases where context linking is required.
*
* The context applied to the store should be accessible in any async code which
* continues from execution which began during the given function, however
* there are some situations in which `context loss` may occur.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const store = new AsyncLocalStorage();
*
* const channel = diagnostics_channel.channel('my-channel');
*
* channel.bindStore(store, (message) => {
* const parent = store.getStore();
* return new Span(message, parent);
* });
* channel.runStores({ some: 'message' }, () => {
* store.getStore(); // Span({ some: 'message' })
* });
* ```
* @since v19.9.0
* @experimental
* @param context Message to send to subscribers and bind to stores
* @param fn Handler to run within the entered storage context
* @param thisArg The receiver to be used for the function call.
* @param args Optional arguments to pass to the function.
*/
runStores(): void;
}
interface TracingChannelSubscribers<ContextType extends object> {
start: (message: ContextType) => void;
end: (
message: ContextType & {
error?: unknown;
result?: unknown;
},
) => void;
asyncStart: (
message: ContextType & {
error?: unknown;
result?: unknown;
},
) => void;
asyncEnd: (
message: ContextType & {
error?: unknown;
result?: unknown;
},
) => void;
error: (
message: ContextType & {
error: unknown;
},
) => void;
}
interface TracingChannelCollection<StoreType = unknown, ContextType = StoreType> {
start: Channel<StoreType, ContextType>;
end: Channel<StoreType, ContextType>;
asyncStart: Channel<StoreType, ContextType>;
asyncEnd: Channel<StoreType, ContextType>;
error: Channel<StoreType, ContextType>;
}
/**
* The class `TracingChannel` is a collection of `TracingChannel Channels` which
* together express a single traceable action. It is used to formalize and
* simplify the process of producing events for tracing application flow.{@link tracingChannel} is used to construct a`TracingChannel`. As with `Channel` it is recommended to create and reuse a
* single `TracingChannel` at the top-level of the file rather than creating them
* dynamically.
* @since v19.9.0
* @experimental
*/
class TracingChannel<StoreType = unknown, ContextType extends object = {}> implements TracingChannelCollection {
start: Channel<StoreType, ContextType>;
end: Channel<StoreType, ContextType>;
asyncStart: Channel<StoreType, ContextType>;
asyncEnd: Channel<StoreType, ContextType>;
error: Channel<StoreType, ContextType>;
/**
* Helper to subscribe a collection of functions to the corresponding channels.
* This is the same as calling `channel.subscribe(onMessage)` on each channel
* individually.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.subscribe({
* start(message) {
* // Handle start message
* },
* end(message) {
* // Handle end message
* },
* asyncStart(message) {
* // Handle asyncStart message
* },
* asyncEnd(message) {
* // Handle asyncEnd message
* },
* error(message) {
* // Handle error message
* },
* });
* ```
* @since v19.9.0
* @experimental
* @param subscribers Set of `TracingChannel Channels` subscribers
*/
subscribe(subscribers: TracingChannelSubscribers<ContextType>): void;
/**
* Helper to unsubscribe a collection of functions from the corresponding channels.
* This is the same as calling `channel.unsubscribe(onMessage)` on each channel
* individually.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.unsubscribe({
* start(message) {
* // Handle start message
* },
* end(message) {
* // Handle end message
* },
* asyncStart(message) {
* // Handle asyncStart message
* },
* asyncEnd(message) {
* // Handle asyncEnd message
* },
* error(message) {
* // Handle error message
* },
* });
* ```
* @since v19.9.0
* @experimental
* @param subscribers Set of `TracingChannel Channels` subscribers
* @return `true` if all handlers were successfully unsubscribed, and `false` otherwise.
*/
unsubscribe(subscribers: TracingChannelSubscribers<ContextType>): void;
/**
* Trace a synchronous function call. This will always produce a `start event` and `end event` around the execution and may produce an `error event` if the given function throws an error.
* This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
* events should have any bound stores set to match this trace context.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.traceSync(() => {
* // Do something
* }, {
* some: 'thing',
* });
* ```
* @since v19.9.0
* @experimental
* @param fn Function to wrap a trace around
* @param context Shared object to correlate events through
* @param thisArg The receiver to be used for the function call
* @param args Optional arguments to pass to the function
* @return The return value of the given function
*/
traceSync<ThisArg = any, Args extends any[] = any[]>(
fn: (this: ThisArg, ...args: Args) => any,
context?: ContextType,
thisArg?: ThisArg,
...args: Args
): void;
/**
* Trace a promise-returning function call. This will always produce a `start event` and `end event` around the synchronous portion of the
* function execution, and will produce an `asyncStart event` and `asyncEnd event` when a promise continuation is reached. It may also
* produce an `error event` if the given function throws an error or the
* returned promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
* events should have any bound stores set to match this trace context.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.tracePromise(async () => {
* // Do something
* }, {
* some: 'thing',
* });
* ```
* @since v19.9.0
* @experimental
* @param fn Promise-returning function to wrap a trace around
* @param context Shared object to correlate trace events through
* @param thisArg The receiver to be used for the function call
* @param args Optional arguments to pass to the function
* @return Chained from promise returned by the given function
*/
tracePromise<ThisArg = any, Args extends any[] = any[]>(
fn: (this: ThisArg, ...args: Args) => Promise<any>,
context?: ContextType,
thisArg?: ThisArg,
...args: Args
): void;
/**
* Trace a callback-receiving function call. This will always produce a `start event` and `end event` around the synchronous portion of the
* function execution, and will produce a `asyncStart event` and `asyncEnd event` around the callback execution. It may also produce an `error event` if the given function throws an error or
* the returned
* promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
* events should have any bound stores set to match this trace context.
*
* The `position` will be -1 by default to indicate the final argument should
* be used as the callback.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.traceCallback((arg1, callback) => {
* // Do something
* callback(null, 'result');
* }, 1, {
* some: 'thing',
* }, thisArg, arg1, callback);
* ```
*
* The callback will also be run with `channel.runStores(context, ...)` which
* enables context loss recovery in some cases.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
* const myStore = new AsyncLocalStorage();
*
* // The start channel sets the initial store data to something
* // and stores that store data value on the trace context object
* channels.start.bindStore(myStore, (data) => {
* const span = new Span(data);
* data.span = span;
* return span;
* });
*
* // Then asyncStart can restore from that data it stored previously
* channels.asyncStart.bindStore(myStore, (data) => {
* return data.span;
* });
* ```
* @since v19.9.0
* @experimental
* @param fn callback using function to wrap a trace around
* @param position Zero-indexed argument position of expected callback
* @param context Shared object to correlate trace events through
* @param thisArg The receiver to be used for the function call
* @param args Optional arguments to pass to the function
* @return The return value of the given function
*/
traceCallback<Fn extends (this: any, ...args: any) => any>(
fn: Fn,
position: number | undefined,
context: ContextType | undefined,
thisArg: any,
...args: Parameters<Fn>
): void;
}
}
declare module "node:diagnostics_channel" {
export * from "diagnostics_channel";
declare module 'node:diagnostics_channel' {
export * from 'diagnostics_channel';
}

329
node_modules/@types/node/dns.d.ts generated vendored Normal file → Executable file
View File

@ -1,5 +1,5 @@
/**
* The `node:dns` module enables name resolution. For example, use it to look up IP
* The `dns` module enables name resolution. For example, use it to look up IP
* addresses of host names.
*
* Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
@ -9,7 +9,7 @@
* system do, use {@link lookup}.
*
* ```js
* const dns = require('node:dns');
* const dns = require('dns');
*
* dns.lookup('example.org', (err, address, family) => {
* console.log('address: %j family: IPv%s', address, family);
@ -17,13 +17,13 @@
* // address: "93.184.216.34" family: IPv4
* ```
*
* All other functions in the `node:dns` module connect to an actual DNS server to
* All other functions in the `dns` module connect to an actual DNS server to
* perform name resolution. They will always use the network to perform DNS
* 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
* DNS queries, bypassing other name-resolution facilities.
*
* ```js
* const dns = require('node:dns');
* const dns = require('dns');
*
* dns.resolve4('archive.org', (err, addresses) => {
* if (err) throw err;
@ -42,10 +42,10 @@
* ```
*
* See the `Implementation considerations section` for more information.
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dns.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.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.
export const ADDRCONFIG: number;
export const V4MAPPED: number;
@ -58,9 +58,6 @@ declare module "dns" {
family?: number | undefined;
hints?: number | undefined;
all?: boolean | undefined;
/**
* @default true
*/
verbatim?: boolean | undefined;
}
export interface LookupOneOptions extends LookupOptions {
@ -76,8 +73,8 @@ declare module "dns" {
/**
* Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
* AAAA (IPv6) record. All `option` properties are optional. If `options` is an
* 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.
* integer, then it must be `4` or `6` if `options` is not provided, then IPv4
* and IPv6 addresses are both returned if found.
*
* With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the
* properties `address` and `family`.
@ -89,14 +86,14 @@ declare module "dns" {
*
* `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
* 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
* time to consult the `Implementation considerations section` before using`dns.lookup()`.
*
* Example usage:
*
* ```js
* const dns = require('node:dns');
* const dns = require('dns');
* const options = {
* family: 6,
* hints: dns.ADDRCONFIG | dns.V4MAPPED,
@ -115,30 +112,11 @@ declare module "dns" {
* If this method is invoked as its `util.promisify()` ed version, and `all`is not set to `true`, it returns a `Promise` for an `Object` with `address` and`family` properties.
* @since v0.1.90
*/
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 {
function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
@ -154,7 +132,7 @@ declare module "dns" {
* On an error, `err` is an `Error` object, where `err.code` is the error code.
*
* ```js
* const dns = require('node:dns');
* const dns = require('dns');
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
* console.log(hostname, service);
* // Prints: localhost ssh
@ -164,15 +142,11 @@ declare module "dns" {
* If this method is invoked as its `util.promisify()` ed version, it returns a`Promise` for an `Object` with `hostname` and `service` properties.
* @since v0.11.14
*/
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<{
hostname: string;
service: string;
@ -191,13 +165,13 @@ declare module "dns" {
/** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
export interface AnyARecord extends RecordWithTtl {
type: "A";
type: 'A';
}
export interface AnyAaaaRecord extends RecordWithTtl {
type: "AAAA";
type: 'AAAA';
}
export interface CaaRecord {
critical: number;
critial: number;
issue?: string | undefined;
issuewild?: string | undefined;
iodef?: string | undefined;
@ -209,7 +183,7 @@ declare module "dns" {
exchange: string;
}
export interface AnyMxRecord extends MxRecord {
type: "MX";
type: 'MX';
}
export interface NaptrRecord {
flags: string;
@ -220,7 +194,7 @@ declare module "dns" {
preference: number;
}
export interface AnyNaptrRecord extends NaptrRecord {
type: "NAPTR";
type: 'NAPTR';
}
export interface SoaRecord {
nsname: string;
@ -232,7 +206,7 @@ declare module "dns" {
minttl: number;
}
export interface AnySoaRecord extends SoaRecord {
type: "SOA";
type: 'SOA';
}
export interface SrvRecord {
priority: number;
@ -241,35 +215,25 @@ declare module "dns" {
name: string;
}
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;
/**
* Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
* of the resource records. The `callback` function has arguments`(err, records)`. When successful, `records` will be an array of resource
@ -282,85 +246,32 @@ declare module "dns" {
* @param hostname Host name to resolve.
* @param [rrtype='A'] Resource record type.
*/
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[]>;
}
/**
* Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the`hostname`. The `addresses` argument passed to the `callback` function
@ -368,45 +279,23 @@ declare module "dns" {
* @since v0.1.16
* @param hostname Host name to resolve.
*/
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 {
function __promisify__(hostname: string): Promise<string[]>;
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
}
/**
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
* Uses the DNS protocol to resolve a IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
* will contain an array of IPv6 addresses.
* @since v0.1.16
* @param hostname Host name to resolve.
*/
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 {
function __promisify__(hostname: string): Promise<string[]>;
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
@ -417,10 +306,7 @@ declare module "dns" {
* will contain an array of canonical name records available for the `hostname`(e.g. `['bar.example.com']`).
* @since v0.3.2
*/
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 {
function __promisify__(hostname: string): Promise<string[]>;
}
@ -428,12 +314,9 @@ declare module "dns" {
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. The`addresses` argument passed to the `callback` function
* will contain an array of 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, v14.17.0
* @since v15.0.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 {
function __promisify__(hostname: string): Promise<CaaRecord[]>;
}
@ -442,15 +325,12 @@ declare module "dns" {
* contain an array of objects containing both a `priority` and `exchange`property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
* @since v0.1.27
*/
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 {
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:
*
* * `flags`
@ -472,10 +352,7 @@ declare module "dns" {
* ```
* @since v0.9.12
*/
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 {
function __promisify__(hostname: string): Promise<NaptrRecord[]>;
}
@ -484,10 +361,7 @@ declare module "dns" {
* contain an array of name server records available for `hostname`(e.g. `['ns1.example.com', 'ns2.example.com']`).
* @since v0.1.90
*/
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 {
function __promisify__(hostname: string): Promise<string[]>;
}
@ -496,10 +370,7 @@ declare module "dns" {
* be an array of strings containing the reply records.
* @since v6.0.0
*/
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 {
function __promisify__(hostname: string): Promise<string[]>;
}
@ -529,10 +400,7 @@ declare module "dns" {
* ```
* @since v0.11.10
*/
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 {
function __promisify__(hostname: string): Promise<SoaRecord>;
}
@ -555,10 +423,7 @@ declare module "dns" {
* ```
* @since v0.1.27
*/
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 {
function __promisify__(hostname: string): Promise<SrvRecord[]>;
}
@ -569,10 +434,7 @@ declare module "dns" {
* treated separately.
* @since v0.1.27
*/
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 {
function __promisify__(hostname: string): Promise<string[][]>;
}
@ -606,10 +468,7 @@ declare module "dns" {
* DNS server operators may choose not to respond to `ANY`queries. It may be better to call individual methods like {@link resolve4},{@link resolveMx}, and so on. For more details, see [RFC
* 8482](https://tools.ietf.org/html/rfc8482).
*/
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 {
function __promisify__(hostname: string): Promise<AnyRecord[]>;
}
@ -621,18 +480,7 @@ declare module "dns" {
* one of the `DNS error codes`.
* @since v0.1.16
*/
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";
export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
/**
* Sets the IP address and port of servers to be used when performing DNS
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
@ -661,7 +509,7 @@ declare module "dns" {
* @since v0.11.3
* @param servers array of `RFC 5952` formatted addresses
*/
export function setServers(servers: readonly string[]): void;
export function setServers(servers: ReadonlyArray<string>): void;
/**
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
* that are currently configured for DNS resolution. A string will include a port
@ -679,18 +527,16 @@ declare module "dns" {
*/
export function getServers(): string[];
/**
* Set the default value of `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
* Set the default value of `verbatim` in {@link lookup}. The value could be:
* - `ipv4first`: sets default `verbatim` `false`.
* - `verbatim`: sets default `verbatim` `true`.
*
* * `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'`.
* 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'.
*/
export function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void;
export function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
// Error codes
export const NODATA: string;
export const FORMERR: string;
@ -731,7 +577,7 @@ declare module "dns" {
* other resolvers:
*
* ```js
* const { Resolver } = require('node:dns');
* const { Resolver } = require('dns');
* const resolver = new Resolver();
* resolver.setServers(['4.4.4.4']);
*
@ -741,7 +587,7 @@ declare module "dns" {
* });
* ```
*
* The following methods from the `node:dns` module are available:
* The following methods from the `dns` module are available:
*
* * `resolver.getServers()`
* * `resolver.resolve()`
@ -774,7 +620,6 @@ declare module "dns" {
resolve4: typeof resolve4;
resolve6: typeof resolve6;
resolveAny: typeof resolveAny;
resolveCaa: typeof resolveCaa;
resolveCname: typeof resolveCname;
resolveMx: typeof resolveMx;
resolveNaptr: typeof resolveNaptr;
@ -789,13 +634,13 @@ declare module "dns" {
* This allows programs to specify outbound interfaces when used on multi-homed
* systems.
*
* 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.
*
* The resolver will use the v4 local address when making requests to IPv4 DNS
* servers, and the v6 local address when making requests to IPv6 DNS servers.
* The `rrtype` of resolution requests has no impact on the local address used.
* @since v15.1.0, v14.17.0
* @since v15.1.0
* @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
* @param [ipv6='::0'] A string representation of an IPv6 address.
*/
@ -804,6 +649,6 @@ declare module "dns" {
}
export { dnsPromises as promises };
}
declare module "node:dns" {
export * from "dns";
declare module 'node:dns' {
export * from 'dns';
}

137
node_modules/@types/node/dns/promises.d.ts generated vendored Normal file → Executable file
View File

@ -1,26 +1,26 @@
/**
* 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('node:dns').promises` or `require('node:dns/promises')`.
* via `require('dns').promises` or `require('dns/promises')`.
* @since v10.6.0
*/
declare module "dns/promises" {
declare module 'dns/promises' {
import {
LookupAddress,
LookupOneOptions,
LookupAllOptions,
LookupOptions,
AnyRecord,
CaaRecord,
LookupAddress,
LookupAllOptions,
LookupOneOptions,
LookupOptions,
MxRecord,
NaptrRecord,
SoaRecord,
SrvRecord,
ResolveWithTtlOptions,
RecordWithTtl,
ResolveOptions,
ResolverOptions,
ResolveWithTtlOptions,
SoaRecord,
SrvRecord,
} from "node:dns";
} from 'node:dns';
/**
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
* that are currently configured for DNS resolution. A string will include a port
@ -52,7 +52,7 @@ declare module "dns/promises" {
*
* `dnsPromises.lookup()` does not necessarily have anything to do with the DNS
* 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
* take some time to consult the `Implementation considerations section` before
* using `dnsPromises.lookup()`.
@ -60,7 +60,7 @@ declare module "dns/promises" {
* Example usage:
*
* ```js
* const dns = require('node:dns');
* const dns = require('dns');
* const dnsPromises = dns.promises;
* const options = {
* family: 6,
@ -96,7 +96,7 @@ declare module "dns/promises" {
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code.
*
* ```js
* const dnsPromises = require('node:dns').promises;
* const dnsPromises = require('dns').promises;
* dnsPromises.lookupService('127.0.0.1', 22).then((result) => {
* console.log(result.hostname, result.service);
* // Prints: localhost ssh
@ -106,7 +106,7 @@ declare module "dns/promises" {
*/
function lookupService(
address: string,
port: number,
port: number
): Promise<{
hostname: string;
service: string;
@ -125,22 +125,19 @@ declare module "dns/promises" {
* @param [rrtype='A'] Resource record type.
*/
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[]>;
/**
* Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv4
* addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
@ -192,7 +189,7 @@ declare module "dns/promises" {
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success,
* the `Promise` is resolved with an array of objects containing available
* 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, v14.17.0
* @since v15.0.0
*/
function resolveCaa(hostname: string): Promise<CaaRecord[]>;
/**
@ -209,7 +206,7 @@ declare module "dns/promises" {
*/
function resolveMx(hostname: string): Promise<MxRecord[]>;
/**
* 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:
*
* * `flags`
@ -307,14 +304,6 @@ declare module "dns/promises" {
* @since v10.6.0
*/
function reverse(ip: string): Promise<string[]>;
/**
* 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
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
@ -341,63 +330,18 @@ declare module "dns/promises" {
* @since v10.6.0
* @param servers array of `RFC 5952` formatted addresses
*/
function setServers(servers: readonly string[]): void;
function setServers(servers: ReadonlyArray<string>): void;
/**
* Set the default value of `verbatim` in `dns.lookup()` and `dnsPromises.lookup()`. The value could be:
* Set the default value of `verbatim` in {@link lookup}. The value could be:
* - `ipv4first`: sets default `verbatim` `false`.
* - `verbatim`: sets default `verbatim` `true`.
*
* * `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;
/**
* 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
* 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'.
*/
function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
class Resolver {
constructor(options?: ResolverOptions);
cancel(): void;
@ -406,7 +350,6 @@ declare module "dns/promises" {
resolve4: typeof resolve4;
resolve6: typeof resolve6;
resolveAny: typeof resolveAny;
resolveCaa: typeof resolveCaa;
resolveCname: typeof resolveCname;
resolveMx: typeof resolveMx;
resolveNaptr: typeof resolveNaptr;
@ -420,6 +363,6 @@ declare module "dns/promises" {
setServers: typeof setServers;
}
}
declare module "node:dns/promises" {
export * from "dns/promises";
declare module 'node:dns/promises' {
export * from 'dns/promises';
}

View File

@ -1,122 +0,0 @@
export {}; // Don't export anything!
//// DOM-like Events
// NB: The Event / EventTarget / EventListener implementations below were copied
// from lib.dom.d.ts, then edited to reflect Node's documentation at
// https://nodejs.org/api/events.html#class-eventtarget.
// Please read that link to understand important implementation differences.
// This conditional type will be the existing global Event in a browser, or
// the copy below in a Node environment.
type __Event = typeof globalThis extends { onmessage: any; Event: any } ? {}
: {
/** This is not used in Node.js and is provided purely for completeness. */
readonly bubbles: boolean;
/** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */
cancelBubble: () => void;
/** True if the event was created with the cancelable option */
readonly cancelable: boolean;
/** This is not used in Node.js and is provided purely for completeness. */
readonly composed: boolean;
/** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */
composedPath(): [EventTarget?];
/** Alias for event.target. */
readonly currentTarget: EventTarget | null;
/** Is true if cancelable is true and event.preventDefault() has been called. */
readonly defaultPrevented: boolean;
/** This is not used in Node.js and is provided purely for completeness. */
readonly eventPhase: 0 | 2;
/** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */
readonly isTrusted: boolean;
/** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */
preventDefault(): void;
/** This is not used in Node.js and is provided purely for completeness. */
returnValue: boolean;
/** Alias for event.target. */
readonly srcElement: EventTarget | null;
/** Stops the invocation of event listeners after the current one completes. */
stopImmediatePropagation(): void;
/** This is not used in Node.js and is provided purely for completeness. */
stopPropagation(): void;
/** The `EventTarget` dispatching the event */
readonly target: EventTarget | null;
/** The millisecond timestamp when the Event object was created. */
readonly timeStamp: number;
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */
readonly type: string;
};
// See comment above explaining conditional type
type __EventTarget = typeof globalThis extends { onmessage: any; EventTarget: any } ? {}
: {
/**
* Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
*
* If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched.
*
* The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification.
* Specifically, the `capture` option is used as part of the key when registering a `listener`.
* Any individual `listener` may be added once with `capture = false`, and once with `capture = true`.
*/
addEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: AddEventListenerOptions | boolean,
): void;
/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
dispatchEvent(event: Event): boolean;
/** Removes the event listener in target's event listener list with the same type, callback, and options. */
removeEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: EventListenerOptions | boolean,
): void;
};
interface EventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
}
interface EventListenerOptions {
/** Not directly used by Node.js. Added for API completeness. Default: `false`. */
capture?: boolean;
}
interface AddEventListenerOptions extends EventListenerOptions {
/** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */
once?: boolean;
/** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
passive?: boolean;
}
interface EventListener {
(evt: Event): void;
}
interface EventListenerObject {
handleEvent(object: Event): void;
}
import {} from "events"; // Make this an ambient declaration
declare global {
/** An event which takes place in the DOM. */
interface Event extends __Event {}
var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
: {
prototype: __Event;
new(type: string, eventInitDict?: EventInit): __Event;
};
/**
* EventTarget is a DOM interface implemented by objects that can
* receive events and may have listeners for them.
*/
interface EventTarget extends __EventTarget {}
var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
: {
prototype: __EventTarget;
new(): __EventTarget;
};
}

16
node_modules/@types/node/domain.d.ts generated vendored Normal file → Executable file
View File

@ -12,10 +12,10 @@
* will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
* exit immediately with an error code.
* @deprecated Since v1.4.2 - Deprecated
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/domain.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/domain.js)
*/
declare module "domain" {
import EventEmitter = require("node:events");
declare module 'domain' {
import EventEmitter = require('node:events');
/**
* The `Domain` class encapsulates the functionality of routing errors and
* uncaught exceptions to the active `Domain` object.
@ -56,15 +56,15 @@ declare module "domain" {
exit(): void;
/**
* Run the supplied function in the context of the domain, implicitly
* binding all event emitters, timers, and low-level requests that are
* binding all event emitters, timers, and lowlevel requests that are
* created in that context. Optionally, arguments can be passed to
* the function.
*
* This is the most basic way to use a domain.
*
* ```js
* const domain = require('node:domain');
* const fs = require('node:fs');
* const domain = require('domain');
* const fs = require('fs');
* const d = domain.create();
* d.on('error', (er) => {
* console.error('Caught error!', er);
@ -165,6 +165,6 @@ declare module "domain" {
}
function create(): Domain;
}
declare module "node:domain" {
export * from "domain";
declare module 'node:domain' {
export * from 'domain';
}

394
node_modules/@types/node/events.d.ts generated vendored Normal file → Executable file
View File

@ -22,7 +22,7 @@
* the `eventEmitter.emit()` method is used to trigger the event.
*
* ```js
* import { EventEmitter } from 'node:events';
* const EventEmitter = require('events');
*
* class MyEmitter extends EventEmitter {}
*
@ -32,61 +32,25 @@
* });
* myEmitter.emit('event');
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/events.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/events.js)
*/
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;
// }
declare module 'events' {
interface EventEmitterOptions {
/**
* Enables automatic capturing of promise rejection.
*/
captureRejections?: boolean | undefined;
}
// Any EventTarget with a Node-style `once` function
interface _NodeEventTarget {
interface NodeEventTarget {
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
}
// Any EventTarget with a DOM-style `addEventListener`
interface _DOMEventTarget {
interface DOMEventTarget {
addEventListener(
eventName: string,
listener: (...args: any[]) => void,
opts?: {
once: boolean;
},
}
): any;
}
interface StaticEventEmitterOptions {
@ -94,10 +58,10 @@ declare module "events" {
}
interface EventEmitter extends NodeJS.EventEmitter {}
/**
* The `EventEmitter` class is defined and exposed by the `node:events` module:
* The `EventEmitter` class is defined and exposed by the `events` module:
*
* ```js
* import { EventEmitter } from 'node:events';
* const EventEmitter = require('events');
* ```
*
* All `EventEmitter`s emit the event `'newListener'` when new listeners are
@ -108,9 +72,6 @@ declare module "events" {
*/
class EventEmitter {
constructor(options?: EventEmitterOptions);
[EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
/**
* Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
* event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
@ -121,28 +82,31 @@ declare module "events" {
* semantics and does not listen to the `'error'` event.
*
* ```js
* import { once, EventEmitter } from 'node:events';
* import process from 'node:process';
* const { once, EventEmitter } = require('events');
*
* const ee = new EventEmitter();
* async function run() {
* 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.error('error happened', err);
* try {
* await once(ee, 'myevent');
* } catch (err) {
* console.log('error happened', err);
* }
* }
*
* run();
* ```
*
* The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the
@ -150,13 +114,13 @@ declare module "events" {
* special handling:
*
* ```js
* import { EventEmitter, once } from 'node:events';
* const { EventEmitter, once } = require('events');
*
* const ee = new EventEmitter();
*
* once(ee, 'error')
* .then(([err]) => console.log('ok', err.message))
* .catch((err) => console.error('error', err.message));
* .catch((err) => console.log('error', err.message));
*
* ee.emit('error', new Error('boom'));
*
@ -166,7 +130,7 @@ declare module "events" {
* An `AbortSignal` can be used to cancel waiting for the event:
*
* ```js
* import { EventEmitter, once } from 'node:events';
* const { EventEmitter, once } = require('events');
*
* const ee = new EventEmitter();
* const ac = new AbortController();
@ -190,32 +154,29 @@ declare module "events" {
* ```
* @since v11.13.0, v10.16.0
*/
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
* import { on, EventEmitter } from 'node:events';
* import process from 'node:process';
* const { on, EventEmitter } = require('events');
*
* const ee = new EventEmitter();
* (async () => {
* 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
* })();
* ```
*
* Returns an `AsyncIterator` that iterates `eventName` events. It will throw
@ -226,9 +187,7 @@ declare module "events" {
* An `AbortSignal` can be used to cancel waiting on events:
*
* ```js
* import { on, EventEmitter } from 'node:events';
* import process from 'node:process';
*
* const { on, EventEmitter } = require('events');
* const ac = new AbortController();
*
* (async () => {
@ -255,17 +214,12 @@ declare module "events" {
* @param eventName The name of the event being listened for
* @return that iterates `eventName` events emitted by the `emitter`
*/
static on(
emitter: NodeJS.EventEmitter,
eventName: string,
options?: StaticEventEmitterOptions,
): AsyncIterableIterator<any>;
static on(emitter: NodeJS.EventEmitter, eventName: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>;
/**
* A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
*
* ```js
* import { EventEmitter, listenerCount } from 'node:events';
*
* const { EventEmitter, listenerCount } = require('events');
* const myEmitter = new EventEmitter();
* myEmitter.on('event', () => {});
* myEmitter.on('event', () => {});
@ -288,56 +242,30 @@ declare module "events" {
* event target. This is useful for debugging and diagnostic purposes.
*
* ```js
* import { getEventListeners, EventEmitter } from 'node:events';
* const { getEventListeners, EventEmitter } = require('events');
*
* {
* const ee = new EventEmitter();
* const listener = () => console.log('Events are fun');
* ee.on('foo', listener);
* console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
* getEventListeners(ee, 'foo'); // [listener]
* }
* {
* const et = new EventTarget();
* const listener = () => console.log('Events are fun');
* et.addEventListener('foo', listener);
* console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
* getEventListeners(et, 'foo'); // [listener]
* }
* ```
* @since v15.2.0, v14.17.0
* @since v15.2.0
*/
static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
/**
* Returns the currently set max amount of listeners.
*
* 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;
static getEventListeners(emitter: DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
/**
* ```js
* import { setMaxListeners, EventEmitter } from 'node:events';
* const {
* setMaxListeners,
* EventEmitter
* } = require('events');
*
* const target = new EventTarget();
* const emitter = new EventEmitter();
@ -349,103 +277,26 @@ declare module "events" {
* @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;
static setMaxListeners(n?: number, ...eventTargets: Array<DOMEventTarget | NodeJS.EventEmitter>): void;
/**
* Listens once to the `abort` event on the provided `signal`.
* 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.
*
* 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
* 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;
/**
* 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
* Sets or gets the default captureRejection value for all emitters.
*/
// 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 {
// Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4
export { internal as EventEmitter };
@ -455,89 +306,10 @@ declare module "events" {
*/
signal?: AbortSignal | undefined;
}
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;
}
}
global {
namespace NodeJS {
interface EventEmitter {
[EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
/**
* Alias for `emitter.on(eventName, listener)`.
* @since v0.1.26
@ -561,7 +333,6 @@ declare module "events" {
* event listener to the beginning of the listeners array.
*
* ```js
* import { EventEmitter } from 'node:events';
* const myEE = new EventEmitter();
* myEE.on('foo', () => console.log('a'));
* myEE.prependListener('foo', () => console.log('b'));
@ -591,7 +362,6 @@ declare module "events" {
* event listener to the beginning of the listeners array.
*
* ```js
* import { EventEmitter } from 'node:events';
* const myEE = new EventEmitter();
* myEE.once('foo', () => console.log('a'));
* myEE.prependOnceListener('foo', () => console.log('b'));
@ -623,12 +393,10 @@ declare module "events" {
* called multiple times to remove each instance.
*
* 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();
*
* const callbackA = () => {
@ -669,7 +437,6 @@ declare module "events" {
* recently added instance. In the example the `once('ping')`listener is removed:
*
* ```js
* import { EventEmitter } from 'node:events';
* const ee = new EventEmitter();
*
* function pong() {
@ -738,7 +505,6 @@ declare module "events" {
* including any wrappers (such as those created by `.once()`).
*
* ```js
* import { EventEmitter } from 'node:events';
* const emitter = new EventEmitter();
* emitter.once('log', () => console.log('log once'));
*
@ -771,7 +537,7 @@ declare module "events" {
* Returns `true` if the event had listeners, `false` otherwise.
*
* ```js
* import { EventEmitter } from 'node:events';
* const EventEmitter = require('events');
* const myEmitter = new EventEmitter();
*
* // First listener
@ -806,14 +572,11 @@ declare module "events" {
*/
emit(eventName: string | symbol, ...args: any[]): boolean;
/**
* 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.
* Returns the number of listeners listening to the event named `eventName`.
* @since v3.2.0
* @param eventName The name of the event being listened for
* @param listener The event handler function
*/
listenerCount(eventName: string | symbol, listener?: Function): number;
listenerCount(eventName: string | symbol): number;
/**
* Adds the `listener` function to the _beginning_ of the listeners array for the
* event named `eventName`. No checks are made to see if the `listener` has
@ -833,7 +596,7 @@ declare module "events" {
*/
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): 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
* 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.
*
* ```js
@ -853,8 +616,7 @@ declare module "events" {
* listeners. The values in the array are strings or `Symbol`s.
*
* ```js
* import { EventEmitter } from 'node:events';
*
* const EventEmitter = require('events');
* const myEE = new EventEmitter();
* myEE.on('foo', () => {});
* myEE.on('bar', () => {});
@ -873,7 +635,7 @@ declare module "events" {
}
export = EventEmitter;
}
declare module "node:events" {
import events = require("events");
declare module 'node:events' {
import events = require('events');
export = events;
}

1374
node_modules/@types/node/fs.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

411
node_modules/@types/node/fs/promises.d.ts generated vendored Normal file → Executable file
View File

@ -8,13 +8,11 @@
* concurrent modifications on the same file or data corruption may occur.
* @since v10.0.0
*/
declare module "fs/promises" {
import { Abortable } from "node:events";
import { Stream } from "node:stream";
import { ReadableStream } from "node:stream/web";
declare module 'fs/promises' {
import { Abortable } from 'node:events';
import { Stream } from 'node:stream';
import {
BigIntStats,
BigIntStatsFs,
BufferEncodingOption,
constants as fsConstants,
CopyOptions,
@ -30,30 +28,26 @@ declare module "fs/promises" {
ReadVResult,
RmDirOptions,
RmOptions,
StatFsOptions,
StatOptions,
Stats,
StatsFs,
TimeLike,
WatchEventType,
WatchOptions,
WriteStream,
WriteVResult,
} from "node:fs";
import { Interface as ReadlineInterface } from "node:readline";
} from 'node:fs';
interface FileChangeInfo<T extends string | Buffer> {
eventType: WatchEventType;
filename: T | null;
filename: T;
}
interface FlagAndOpenMode {
mode?: Mode | undefined;
flag?: OpenMode | undefined;
}
interface FileReadResult<T extends NodeJS.ArrayBufferView> {
interface FileReadResult<T extends ArrayBufferView> {
bytesRead: number;
buffer: T;
}
interface FileReadOptions<T extends NodeJS.ArrayBufferView = Buffer> {
interface FileReadOptions<T extends ArrayBufferView = Buffer> {
/**
* @default `Buffer.alloc(0xffff)`
*/
@ -81,15 +75,6 @@ declare module "fs/promises" {
autoClose?: boolean | undefined;
emitClose?: boolean | undefined;
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
interface FileHandle {
@ -106,13 +91,7 @@ declare module "fs/promises" {
* @since v10.0.0
* @return Fulfills with `undefined` upon success.
*/
appendFile(
data: string | Uint8Array,
options?:
| (ObjectEncodingOptions & FlagAndOpenMode & { flush?: boolean | undefined })
| BufferEncoding
| null,
): Promise<void>;
appendFile(data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding | null): Promise<void>;
/**
* Changes the ownership of the file. A wrapper for [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html).
* @since v10.0.0
@ -129,8 +108,8 @@ declare module "fs/promises" {
*/
chmod(mode: Mode): Promise<void>;
/**
* Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream
* returned by this method has a default `highWaterMark` of 64 KiB.
* Unlike the 16 kb default `highWaterMark` for a `stream.Readable`, the stream
* returned by this method has a default `highWaterMark` of 64 kb.
*
* `options` can include `start` and `end` values to read a range of bytes from
* the file instead of the entire file. Both `start` and `end` are inclusive and
@ -148,7 +127,7 @@ declare module "fs/promises" {
* destroyed. Set the `emitClose` option to `false` to change this behavior.
*
* ```js
* import { open } from 'node:fs/promises';
* import { open } from 'fs/promises';
*
* const fd = await open('/dev/input/event0');
* // Create a stream from some character device.
@ -174,7 +153,7 @@ declare module "fs/promises" {
* An example to read the last 10 bytes of a file which is 100 bytes long:
*
* ```js
* import { open } from 'node:fs/promises';
* import { open } from 'fs/promises';
*
* const fd = await open('sample.txt');
* fd.createReadStream({ start: 90, end: 99 });
@ -185,9 +164,9 @@ declare module "fs/promises" {
/**
* `options` may also include a `start` option to allow writing data at some
* 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`.
*
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
* then the file descriptor won't be closed, even if there's an error.
@ -213,7 +192,7 @@ declare module "fs/promises" {
* device. The specific implementation is operating system and device specific.
* Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail.
* @since v10.0.0
* @return Fulfills with `undefined` upon success.
* @return Fufills with `undefined` upon success.
*/
sync(): Promise<void>;
/**
@ -229,38 +208,8 @@ declare module "fs/promises" {
* integer, the current file position will remain unchanged.
* @return Fulfills upon success with an object with two properties:
*/
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;
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>>;
/**
* Asynchronously reads the entire contents of a file.
*
@ -279,7 +228,7 @@ declare module "fs/promises" {
options?: {
encoding?: null | undefined;
flag?: OpenMode | undefined;
} | null,
} | null
): Promise<Buffer>;
/**
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
@ -290,10 +239,10 @@ declare module "fs/promises" {
readFile(
options:
| {
encoding: BufferEncoding;
flag?: OpenMode | undefined;
}
| BufferEncoding,
encoding: BufferEncoding;
flag?: OpenMode | undefined;
}
| BufferEncoding
): Promise<string>;
/**
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
@ -304,27 +253,11 @@ declare module "fs/promises" {
readFile(
options?:
| (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
* @return Fulfills with an {fs.Stats} for the file.
@ -332,12 +265,12 @@ declare module "fs/promises" {
stat(
opts?: StatOptions & {
bigint?: false | undefined;
},
}
): Promise<Stats>;
stat(
opts: StatOptions & {
bigint: true;
},
}
): Promise<BigIntStats>;
stat(opts?: StatOptions): Promise<Stats | BigIntStats>;
/**
@ -349,7 +282,7 @@ declare module "fs/promises" {
* The following example retains only the first four bytes of the file:
*
* ```js
* import { open } from 'node:fs/promises';
* import { open } from 'fs/promises';
*
* let filehandle = null;
* try {
@ -370,58 +303,55 @@ declare module "fs/promises" {
*/
truncate(len?: number): Promise<void>;
/**
* Change the file system timestamps of the object referenced by the `FileHandle` then fulfills the promise with no arguments upon success.
* Change the file system timestamps of the object referenced by the `FileHandle` then resolves the promise with no arguments upon success.
* @since v10.0.0
*/
utimes(atime: TimeLike, mtime: TimeLike): Promise<void>;
utimes(atime: string | number | Date, mtime: string | number | Date): 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 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.
* [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.
*
* If `options` is a string, then it specifies the `encoding`.
*
* The `FileHandle` has to support writing.
*
* It is unsafe to use `filehandle.writeFile()` multiple times on the same file
* without waiting for the promise to be fulfilled (or rejected).
* without waiting for the promise to be resolved (or rejected).
*
* 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
* current position till the end of the file. It doesn't always write from the
* beginning of the file.
* @since v10.0.0
*/
writeFile(
data: string | Uint8Array,
options?:
| (ObjectEncodingOptions & FlagAndOpenMode & Abortable & { flush?: boolean | undefined })
| BufferEncoding
| null,
): Promise<void>;
writeFile(data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode & Abortable) | BufferEncoding | null): Promise<void>;
/**
* Write `buffer` to the file.
*
* The promise is fulfilled with an object containing two properties:
* If `buffer` is a plain object, it must have an own (not inherited) `toString`function property.
*
* 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 fulfilled (or rejected). For this
* scenario, use `filehandle.createWriteStream()`.
* without waiting for the promise to be resolved (or rejected). For this
* scenario, use `fs.createWriteStream()`.
*
* On Linux, positional writes do not work when the file is opened in append mode.
* The kernel ignores the position argument and always appends the data to
* the end of the file.
* @since v10.0.0
* @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.
* @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.
*/
write<TBuffer extends Uint8Array>(
buffer: TBuffer,
offset?: number | null,
length?: number | null,
position?: number | null,
position?: number | null
): Promise<{
bytesWritten: number;
buffer: TBuffer;
@ -429,7 +359,7 @@ declare module "fs/promises" {
write(
data: string,
position?: number | null,
encoding?: BufferEncoding | null,
encoding?: BufferEncoding | null
): Promise<{
bytesWritten: number;
buffer: string;
@ -437,32 +367,32 @@ declare module "fs/promises" {
/**
* Write an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s to the file.
*
* The promise is fulfilled with an object containing a two properties:
* The promise is resolved 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 fulfilled (or rejected).
* for the promise to be resolved (or rejected).
*
* On Linux, positional writes don't work when the file is opened in append mode.
* The kernel ignores the position argument and always appends the data to
* the end of the file.
* @since v12.9.0
* @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
* @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
* position.
*/
writev(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
writev(buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<WriteVResult>;
/**
* Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s
* @since v13.13.0, v12.17.0
* @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position.
* @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.
* @return Fulfills upon success an object containing two properties:
*/
readv(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise<ReadVResult>;
readv(buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<ReadVResult>;
/**
* Closes the file handle after waiting for any pending operation on the handle to
* complete.
*
* ```js
* import { open } from 'node:fs/promises';
* import { open } from 'fs/promises';
*
* let filehandle;
* try {
@ -475,27 +405,24 @@ declare module "fs/promises" {
* @return Fulfills with `undefined` upon success.
*/
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. `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`.
* 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`).
*
* If the accessibility check is successful, the promise is fulfilled with no
* If the accessibility check is successful, the promise is resolved with no
* value. If any of the accessibility checks fail, the promise is rejected
* 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
* written by the current process.
*
* ```js
* import { access, constants } from 'node:fs/promises';
* import { access } from 'fs/promises';
* import { constants } from 'fs';
*
* try {
* await access('/etc/passwd', constants.R_OK | constants.W_OK);
@ -524,13 +451,14 @@ declare module "fs/promises" {
* will be made to remove the destination.
*
* ```js
* import { copyFile, constants } from 'node:fs/promises';
* import { constants } from 'fs';
* import { copyFile } from 'fs/promises';
*
* try {
* await copyFile('source.txt', 'destination.txt');
* console.log('source.txt was copied to destination.txt');
* } catch {
* console.error('The file could not be copied');
* console.log('The file could not be copied');
* }
*
* // By using COPYFILE_EXCL, the operation will fail if destination.txt exists.
@ -538,7 +466,7 @@ declare module "fs/promises" {
* await copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL);
* console.log('source.txt was copied to destination.txt');
* } catch {
* console.error('The file could not be copied');
* console.log('The file could not be copied');
* }
* ```
* @since v10.0.0
@ -600,19 +528,6 @@ declare module "fs/promises" {
* and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fsPromises.mkdir()` when `path` is a directory
* that exists results in a
* 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
* @return Upon success, fulfills with `undefined` if `recursive` is `false`, or the first directory path created if `recursive` is `true`.
*/
@ -620,7 +535,7 @@ declare module "fs/promises" {
path: PathLike,
options: MakeDirectoryOptions & {
recursive: true;
},
}
): Promise<string | undefined>;
/**
* Asynchronous mkdir(2) - create a directory.
@ -633,9 +548,9 @@ declare module "fs/promises" {
options?:
| Mode
| (MakeDirectoryOptions & {
recursive?: false | undefined;
})
| null,
recursive?: false | undefined;
})
| null
): Promise<void>;
/**
* Asynchronous mkdir(2) - create a directory.
@ -652,10 +567,10 @@ declare module "fs/promises" {
* the filenames. If the `encoding` is set to `'buffer'`, the filenames returned
* will be passed as `Buffer` objects.
*
* If `options.withFileTypes` is set to `true`, the returned array will contain `fs.Dirent` objects.
* If `options.withFileTypes` is set to `true`, the resolved array will contain `fs.Dirent` objects.
*
* ```js
* import { readdir } from 'node:fs/promises';
* import { readdir } from 'fs/promises';
*
* try {
* const files = await readdir(path);
@ -672,11 +587,10 @@ declare module "fs/promises" {
path: PathLike,
options?:
| (ObjectEncodingOptions & {
withFileTypes?: false | undefined;
recursive?: boolean | undefined;
})
withFileTypes?: false | undefined;
})
| BufferEncoding
| null,
| null
): Promise<string[]>;
/**
* Asynchronous readdir(3) - read a directory.
@ -687,11 +601,10 @@ declare module "fs/promises" {
path: PathLike,
options:
| {
encoding: "buffer";
withFileTypes?: false | undefined;
recursive?: boolean | undefined;
}
| "buffer",
encoding: 'buffer';
withFileTypes?: false | undefined;
}
| 'buffer'
): Promise<Buffer[]>;
/**
* Asynchronous readdir(3) - read a directory.
@ -702,11 +615,10 @@ declare module "fs/promises" {
path: PathLike,
options?:
| (ObjectEncodingOptions & {
withFileTypes?: false | undefined;
recursive?: boolean | undefined;
})
withFileTypes?: false | undefined;
})
| BufferEncoding
| null,
| null
): Promise<string[] | Buffer[]>;
/**
* Asynchronous readdir(3) - read a directory.
@ -717,12 +629,11 @@ declare module "fs/promises" {
path: PathLike,
options: ObjectEncodingOptions & {
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
* fulfilled with the`linkString` upon success.
* resolved with the`linkString` upon success.
*
* The optional `options` argument can be a string specifying an encoding, or an
* object with an `encoding` property specifying the character encoding to use for
@ -747,14 +658,11 @@ declare module "fs/promises" {
/**
* Creates a symbolic link.
*
* 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.
* 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.
* @since v10.0.0
* @param [type='null']
* @param [type='file']
* @return Fulfills with `undefined` upon success.
*/
function symlink(target: PathLike, path: PathLike, type?: string | null): Promise<void>;
@ -769,13 +677,13 @@ declare module "fs/promises" {
path: PathLike,
opts?: StatOptions & {
bigint?: false | undefined;
},
}
): Promise<Stats>;
function lstat(
path: PathLike,
opts: StatOptions & {
bigint: true;
},
}
): Promise<BigIntStats>;
function lstat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
/**
@ -786,32 +694,15 @@ declare module "fs/promises" {
path: PathLike,
opts?: StatOptions & {
bigint?: false | undefined;
},
}
): Promise<Stats>;
function stat(
path: PathLike,
opts: StatOptions & {
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.
* @since v10.0.0
@ -853,7 +744,7 @@ declare module "fs/promises" {
* @since v14.5.0, v12.19.0
* @return Fulfills with `undefined` upon success.
*/
function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise<void>;
function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
/**
* Changes the ownership of a file.
* @since v10.0.0
@ -867,11 +758,11 @@ declare module "fs/promises" {
*
* * Values can be either numbers representing Unix epoch time, `Date`s, or a
* 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: TimeLike, mtime: TimeLike): Promise<void>;
function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
/**
* Determines the actual location of `path` using the same semantics as the`fs.realpath.native()` function.
*
@ -900,10 +791,7 @@ declare module "fs/promises" {
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
function realpath(
path: PathLike,
options?: ObjectEncodingOptions | BufferEncoding | null,
): Promise<string | Buffer>;
function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
/**
* Creates a unique temporary directory. A unique directory name is generated by
* appending six random characters to the end of the provided `prefix`. Due to
@ -915,12 +803,10 @@ declare module "fs/promises" {
* object with an `encoding` property specifying the character encoding to use.
*
* ```js
* import { mkdtemp } from 'node:fs/promises';
* import { join } from 'node:path';
* import { tmpdir } from 'node:os';
* import { mkdtemp } from 'fs/promises';
*
* try {
* await mkdtemp(join(tmpdir(), 'foo-'));
* await mkdtemp(path.join(os.tmpdir(), 'foo-'));
* } catch (err) {
* console.error(err);
* }
@ -929,9 +815,9 @@ declare module "fs/promises" {
* The `fsPromises.mkdtemp()` method will append the six randomly selected
* characters directly to the `prefix` string. For instance, given a directory`/tmp`, if the intention is to create a temporary directory _within_`/tmp`, the`prefix` must end with a trailing
* platform-specific path separator
* (`require('node:path').sep`).
* (`require('path').sep`).
* @since v10.0.0
* @return Fulfills with a string containing the file system path of the newly created temporary directory.
* @return Fulfills with a string containing the filesystem path of the newly created temporary directory.
*/
function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
/**
@ -947,9 +833,7 @@ declare module "fs/promises" {
*/
function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
/**
* 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.
* 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.
*
* The `encoding` option is ignored if `data` is a buffer.
*
@ -964,15 +848,15 @@ declare module "fs/promises" {
*
* Similarly to `fsPromises.readFile` \- `fsPromises.writeFile` is a convenience
* method that performs multiple `write` calls internally to write the buffer
* passed to it. For performance sensitive code consider using `fs.createWriteStream()` or `filehandle.createWriteStream()`.
* passed to it. For performance sensitive code consider using `fs.createWriteStream()`.
*
* It is possible to use an `AbortSignal` to cancel an `fsPromises.writeFile()`.
* Cancelation is "best effort", and some amount of data is likely still
* to be written.
*
* ```js
* import { writeFile } from 'node:fs/promises';
* import { Buffer } from 'node:buffer';
* import { writeFile } from 'fs/promises';
* import { Buffer } from 'buffer';
*
* try {
* const controller = new AbortController();
@ -998,19 +882,14 @@ declare module "fs/promises" {
*/
function writeFile(
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>;
/**
* Asynchronously append data to a file, creating the file if it does not yet
@ -1026,11 +905,7 @@ declare module "fs/promises" {
* @param path filename or {FileHandle}
* @return Fulfills with `undefined` upon success.
*/
function appendFile(
path: PathLike | FileHandle,
data: string | Uint8Array,
options?: (ObjectEncodingOptions & FlagAndOpenMode & { flush?: boolean | undefined }) | BufferEncoding | null,
): Promise<void>;
function appendFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding | null): Promise<void>;
/**
* Asynchronously reads the entire contents of a file.
*
@ -1044,25 +919,11 @@ declare module "fs/promises" {
* with an error. On FreeBSD, a representation of the directory's contents will be
* returned.
*
* 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
* request is aborted the promise returned is rejected with an `AbortError`:
*
* ```js
* import { readFile } from 'node:fs/promises';
* import { readFile } from 'fs/promises';
*
* try {
* const controller = new AbortController();
@ -1091,10 +952,10 @@ declare module "fs/promises" {
path: PathLike | FileHandle,
options?:
| ({
encoding?: null | undefined;
flag?: OpenMode | undefined;
} & Abortable)
| null,
encoding?: null | undefined;
flag?: OpenMode | undefined;
} & Abortable)
| null
): Promise<Buffer>;
/**
* Asynchronously reads the entire contents of a file.
@ -1107,10 +968,10 @@ declare module "fs/promises" {
path: PathLike | FileHandle,
options:
| ({
encoding: BufferEncoding;
flag?: OpenMode | undefined;
} & Abortable)
| BufferEncoding,
encoding: BufferEncoding;
flag?: OpenMode | undefined;
} & Abortable)
| BufferEncoding
): Promise<string>;
/**
* Asynchronously reads the entire contents of a file.
@ -1122,15 +983,12 @@ declare module "fs/promises" {
function readFile(
path: PathLike | FileHandle,
options?:
| (
& ObjectEncodingOptions
& Abortable
& {
flag?: OpenMode | undefined;
}
)
| (ObjectEncodingOptions &
Abortable & {
flag?: OpenMode | undefined;
})
| BufferEncoding
| null,
| null
): Promise<string | Buffer>;
/**
* Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail.
@ -1144,7 +1002,7 @@ declare module "fs/promises" {
* Example using async iteration:
*
* ```js
* import { opendir } from 'node:fs/promises';
* import { opendir } from 'fs/promises';
*
* try {
* const dir = await opendir('./');
@ -1165,7 +1023,7 @@ declare module "fs/promises" {
* Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
*
* ```js
* const { watch } = require('node:fs/promises');
* const { watch } = require('fs/promises');
*
* const ac = new AbortController();
* const { signal } = ac;
@ -1188,16 +1046,16 @@ declare module "fs/promises" {
* disappears in the directory.
*
* All the `caveats` for `fs.watch()` also apply to `fsPromises.watch()`.
* @since v15.9.0, v14.18.0
* @since v15.9.0
* @return of objects with the properties:
*/
function watch(
filename: PathLike,
options:
| (WatchOptions & {
encoding: "buffer";
})
| "buffer",
encoding: 'buffer';
})
| 'buffer'
): AsyncIterable<FileChangeInfo<Buffer>>;
/**
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
@ -1216,10 +1074,7 @@ declare module "fs/promises" {
* If `persistent` is not supplied, the default of `true` is used.
* If `recursive` is not supplied, the default of `false` is used.
*/
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>>;
/**
* Asynchronously copies the entire directory structure from `src` to `dest`,
* including subdirectories and files.
@ -1234,6 +1089,6 @@ declare module "fs/promises" {
*/
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';
}

615
node_modules/@types/node/globals.d.ts generated vendored Normal file → Executable file
View File

@ -1,411 +1,286 @@
export {}; // Make this a module
// #region Fetch and friends
// Conditional type aliases, used at the end of this file.
// Will either be empty if lib-dom is included, or the undici version otherwise.
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 _ResponseInit = typeof globalThis extends { onmessage: any } ? {}
: import("undici-types").ResponseInit;
type _File = typeof globalThis extends { onmessage: any } ? {} : import("node:buffer").File;
// #endregion Fetch and friends
declare global {
// Declare "static" methods in Error
interface ErrorConstructor {
/** Create .stack property on a target object */
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
/**
* Optional override for formatting stack traces
*
* @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
*/
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
stackTraceLimit: number;
}
/*-----------------------------------------------*
* *
* GLOBAL *
* *
------------------------------------------------*/
// For backwards compability
interface NodeRequire extends NodeJS.Require {}
interface RequireResolve extends NodeJS.RequireResolve {}
interface NodeModule extends NodeJS.Module {}
var process: NodeJS.Process;
var console: Console;
var __filename: string;
var __dirname: string;
var require: NodeRequire;
var module: NodeModule;
// Same as module.exports
var exports: any;
// Declare "static" methods in Error
interface ErrorConstructor {
/** Create .stack property on a target object */
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
/**
* Only available if `--expose-gc` is passed to the process.
*/
var gc: undefined | (() => void);
// #region borrowed
// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
/** A controller object that allows you to abort one or more DOM requests as and when desired. */
interface AbortController {
/**
* Returns the AbortSignal object associated with this object.
*/
readonly signal: AbortSignal;
/**
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
*/
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 extends EventTarget {
/**
* 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;
}
var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
: {
prototype: AbortController;
new(): AbortController;
};
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 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> {
/**
* Takes an integer value and returns the item at that index,
* allowing for positive and negative integers.
* Negative integers count back from the last item in the array.
*/
at(index: number): T | undefined;
}
interface String extends RelativeIndexable<string> {}
interface Array<T> extends RelativeIndexable<T> {}
interface ReadonlyArray<T> extends RelativeIndexable<T> {}
interface Int8Array extends RelativeIndexable<number> {}
interface Uint8Array extends RelativeIndexable<number> {}
interface Uint8ClampedArray extends RelativeIndexable<number> {}
interface Int16Array extends RelativeIndexable<number> {}
interface Uint16Array extends RelativeIndexable<number> {}
interface Int32Array extends RelativeIndexable<number> {}
interface Uint32Array extends RelativeIndexable<number> {}
interface Float32Array extends RelativeIndexable<number> {}
interface Float64Array extends RelativeIndexable<number> {}
interface BigInt64Array extends RelativeIndexable<bigint> {}
interface BigUint64Array extends RelativeIndexable<bigint> {}
// #endregion ArrayLike.at() end
/**
* @since v17.0.0
* Optional override for formatting stack traces
*
* Creates a deep clone of an object.
* @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
*/
function structuredClone<T>(
value: T,
transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> },
): T;
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
/*----------------------------------------------*
* *
* GLOBAL INTERFACES *
* *
*-----------------------------------------------*/
namespace NodeJS {
interface CallSite {
/**
* Value of "this"
*/
getThis(): unknown;
stackTraceLimit: number;
}
/**
* Type of "this" as a string.
* This is the name of the function stored in the constructor field of
* "this", if available. Otherwise the object's [[Class]] internal
* property.
*/
getTypeName(): string | null;
/*-----------------------------------------------*
* *
* GLOBAL *
* *
------------------------------------------------*/
/**
* Current function
*/
getFunction(): Function | undefined;
// For backwards compability
interface NodeRequire extends NodeJS.Require { }
interface RequireResolve extends NodeJS.RequireResolve { }
interface NodeModule extends NodeJS.Module { }
/**
* Name of the current function, typically its name property.
* If a name property is not available an attempt will be made to try
* to infer a name from the function's context.
*/
getFunctionName(): string | null;
declare var process: NodeJS.Process;
declare var console: Console;
/**
* Name of the property [of "this" or one of its prototypes] that holds
* the current function
*/
getMethodName(): string | null;
declare var __filename: string;
declare var __dirname: string;
/**
* Name of the script [if this function was defined in a script]
*/
getFileName(): string | undefined;
declare var require: NodeRequire;
declare var module: NodeModule;
/**
* Current line number [if this function was defined in a script]
*/
getLineNumber(): number | null;
// Same as module.exports
declare var exports: any;
/**
* Current column number [if this function was defined in a script]
*/
getColumnNumber(): number | null;
/**
* Only available if `--expose-gc` is passed to the process.
*/
declare var gc: undefined | (() => void);
/**
* A call site object representing the location where eval was called
* [if this function was created using a call to eval]
*/
getEvalOrigin(): string | undefined;
//#region borrowed
// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
/** A controller object that allows you to abort one or more DOM requests as and when desired. */
interface AbortController {
/**
* Returns the AbortSignal object associated with this object.
*/
/**
* Is this a toplevel invocation, that is, is "this" the global object?
*/
isToplevel(): boolean;
readonly signal: AbortSignal;
/**
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
*/
abort(): void;
}
/**
* Does this call take place in code defined by a call to eval?
*/
isEval(): boolean;
/** 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 {
/**
* Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
*/
readonly aborted: boolean;
}
/**
* Is this call in native V8 code?
*/
isNative(): boolean;
declare var AbortController: {
prototype: AbortController;
new(): AbortController;
};
/**
* Is this a constructor call?
*/
isConstructor(): boolean;
declare var AbortSignal: {
prototype: AbortSignal;
new(): AbortSignal;
// TODO: Add abort() static
timeout(milliseconds: number): AbortSignal;
};
//#endregion borrowed
/**
* is this an async call (i.e. await, Promise.all(), or Promise.any())?
*/
isAsync(): boolean;
//#region ArrayLike.at()
interface RelativeIndexable<T> {
/**
* Takes an integer value and returns the item at that index,
* allowing for positive and negative integers.
* Negative integers count back from the last item in the array.
*/
at(index: number): T | undefined;
}
interface String extends RelativeIndexable<string> {}
interface Array<T> extends RelativeIndexable<T> {}
interface ReadonlyArray<T> extends RelativeIndexable<T> {}
interface Int8Array extends RelativeIndexable<number> {}
interface Uint8Array extends RelativeIndexable<number> {}
interface Uint8ClampedArray extends RelativeIndexable<number> {}
interface Int16Array extends RelativeIndexable<number> {}
interface Uint16Array extends RelativeIndexable<number> {}
interface Int32Array extends RelativeIndexable<number> {}
interface Uint32Array extends RelativeIndexable<number> {}
interface Float32Array extends RelativeIndexable<number> {}
interface Float64Array extends RelativeIndexable<number> {}
interface BigInt64Array extends RelativeIndexable<bigint> {}
interface BigUint64Array extends RelativeIndexable<bigint> {}
//#endregion ArrayLike.at() end
/**
* is this an async call to Promise.all()?
*/
isPromiseAll(): boolean;
/*----------------------------------------------*
* *
* GLOBAL INTERFACES *
* *
*-----------------------------------------------*/
declare namespace NodeJS {
interface CallSite {
/**
* Value of "this"
*/
getThis(): unknown;
/**
* returns the index of the promise element that was followed in
* Promise.all() or Promise.any() for async stack traces, or null
* if the CallSite is not an async
*/
getPromiseIndex(): number | null;
/**
* Type of "this" as a string.
* This is the name of the function stored in the constructor field of
* "this", if available. Otherwise the object's [[Class]] internal
* property.
*/
getTypeName(): string | null;
getScriptNameOrSourceURL(): string;
getScriptHash(): string;
/**
* Current function
*/
getFunction(): Function | undefined;
getEnclosingColumnNumber(): number;
getEnclosingLineNumber(): number;
getPosition(): number;
/**
* Name of the current function, typically its name property.
* If a name property is not available an attempt will be made to try
* to infer a name from the function's context.
*/
getFunctionName(): string | null;
toString(): string;
}
/**
* Name of the property [of "this" or one of its prototypes] that holds
* the current function
*/
getMethodName(): string | null;
interface ErrnoException extends Error {
errno?: number | undefined;
code?: string | undefined;
path?: string | undefined;
syscall?: string | undefined;
}
/**
* Name of the script [if this function was defined in a script]
*/
getFileName(): string | null;
interface ReadableStream extends EventEmitter {
readable: boolean;
read(size?: number): string | Buffer;
setEncoding(encoding: BufferEncoding): this;
pause(): this;
resume(): this;
isPaused(): boolean;
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined }): T;
unpipe(destination?: WritableStream): this;
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
wrap(oldStream: ReadableStream): this;
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
}
/**
* Current line number [if this function was defined in a script]
*/
getLineNumber(): number | null;
interface WritableStream extends EventEmitter {
writable: boolean;
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
end(cb?: () => void): this;
end(data: string | Uint8Array, cb?: () => void): this;
end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
}
/**
* Current column number [if this function was defined in a script]
*/
getColumnNumber(): number | null;
interface ReadWriteStream extends ReadableStream, WritableStream {}
/**
* A call site object representing the location where eval was called
* [if this function was created using a call to eval]
*/
getEvalOrigin(): string | undefined;
interface RefCounted {
ref(): this;
unref(): this;
}
/**
* Is this a toplevel invocation, that is, is "this" the global object?
*/
isToplevel(): boolean;
type TypedArray =
| Uint8Array
| Uint8ClampedArray
| Uint16Array
| Uint32Array
| Int8Array
| Int16Array
| Int32Array
| BigUint64Array
| BigInt64Array
| Float32Array
| Float64Array;
type ArrayBufferView = TypedArray | DataView;
/**
* Does this call take place in code defined by a call to eval?
*/
isEval(): boolean;
interface Require {
(id: string): any;
resolve: RequireResolve;
cache: Dict<NodeModule>;
/**
* @deprecated
*/
extensions: RequireExtensions;
main: Module | undefined;
}
/**
* Is this call in native V8 code?
*/
isNative(): boolean;
interface RequireResolve {
(id: string, options?: { paths?: string[] | undefined }): string;
paths(request: string): string[] | null;
}
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;
}
interface Module {
/**
* `true` if the module is running during the Node.js preload
*/
isPreloading: boolean;
exports: any;
require: Require;
id: string;
filename: string;
loaded: boolean;
/** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */
parent: Module | null | undefined;
children: Module[];
/**
* @since v11.14.0
*
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
*/
path: string;
paths: string[];
}
interface Dict<T> {
[key: string]: T | undefined;
}
interface ReadOnlyDict<T> {
readonly [key: string]: T | undefined;
}
/**
* Is this a constructor call?
*/
isConstructor(): boolean;
}
interface RequestInit extends _RequestInit {}
interface ErrnoException extends Error {
errno?: number | undefined;
code?: string | undefined;
path?: string | undefined;
syscall?: string | undefined;
}
function fetch(
input: string | URL | globalThis.Request,
init?: RequestInit,
): Promise<Response>;
interface ReadableStream extends EventEmitter {
readable: boolean;
read(size?: number): string | Buffer;
setEncoding(encoding: BufferEncoding): this;
pause(): this;
resume(): this;
isPaused(): boolean;
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T;
unpipe(destination?: WritableStream): this;
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
wrap(oldStream: ReadableStream): this;
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
}
interface Request extends _Request {}
var Request: typeof globalThis extends {
onmessage: any;
Request: infer T;
} ? T
: typeof import("undici-types").Request;
interface WritableStream extends EventEmitter {
writable: boolean;
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
end(cb?: () => void): void;
end(data: string | Uint8Array, cb?: () => void): void;
end(str: string, encoding?: BufferEncoding, cb?: () => void): void;
}
interface ResponseInit extends _ResponseInit {}
interface ReadWriteStream extends ReadableStream, WritableStream { }
interface Response extends _Response {}
var Response: typeof globalThis extends {
onmessage: any;
Response: infer T;
} ? T
: typeof import("undici-types").Response;
interface RefCounted {
ref(): this;
unref(): this;
}
interface FormData extends _FormData {}
var FormData: typeof globalThis extends {
onmessage: any;
FormData: infer T;
} ? T
: typeof import("undici-types").FormData;
type TypedArray =
| Uint8Array
| Uint8ClampedArray
| Uint16Array
| Uint32Array
| Int8Array
| Int16Array
| Int32Array
| BigUint64Array
| BigInt64Array
| Float32Array
| Float64Array;
type ArrayBufferView = TypedArray | DataView;
interface Headers extends _Headers {}
var Headers: typeof globalThis extends {
onmessage: any;
Headers: infer T;
} ? T
: typeof import("undici-types").Headers;
interface Require {
(id: string): any;
resolve: RequireResolve;
cache: Dict<NodeModule>;
/**
* @deprecated
*/
extensions: RequireExtensions;
main: Module | undefined;
}
interface File extends _File {}
var File: typeof globalThis extends {
onmessage: any;
File: infer T;
} ? T
: typeof import("node:buffer").File;
interface RequireResolve {
(id: string, options?: { paths?: string[] | undefined; }): string;
paths(request: string): string[] | null;
}
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;
}
interface Module {
/**
* `true` if the module is running during the Node.js preload
*/
isPreloading: boolean;
exports: any;
require: Require;
id: string;
filename: string;
loaded: boolean;
/** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */
parent: Module | null | undefined;
children: Module[];
/**
* @since v11.14.0
*
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
*/
path: string;
paths: string[];
}
interface Dict<T> {
[key: string]: T | undefined;
}
interface ReadOnlyDict<T> {
readonly [key: string]: T | undefined;
}
}

0
node_modules/@types/node/globals.global.d.ts generated vendored Normal file → Executable file
View File

954
node_modules/@types/node/http.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

1129
node_modules/@types/node/http2.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

267
node_modules/@types/node/https.d.ts generated vendored Normal file → Executable file
View File

@ -1,22 +1,19 @@
/**
* 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/v20.2.0/lib/https.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.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";
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;
type RequestOptions = http.RequestOptions &
tls.SecureContextOptions & {
rejectUnauthorized?: boolean | undefined; // Defaults to true
servername?: string | undefined; // SNI TLS Extension
};
@ -49,24 +46,14 @@ declare module "https" {
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: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
addListener(
event: "newSession",
event: 'newSession',
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
addListener(
event: "OCSPRequest",
event: 'OCSPRequest',
listener: (
certificate: Buffer,
issuer: Buffer,
@ -74,80 +61,74 @@ declare module "https" {
) => void,
): this;
addListener(
event: "resumeSession",
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: '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",
event: 'connect',
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
addListener(event: "request", listener: http.RequestListener<Request, Response>): this;
addListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
addListener(
event: "upgrade",
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: 'keylog', line: Buffer, tlsSocket: tls.TLSSocket): boolean;
emit(
event: "newSession",
event: 'newSession',
sessionId: Buffer,
sessionData: Buffer,
callback: (err: Error, resp: Buffer) => void,
): boolean;
emit(
event: "OCSPRequest",
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: '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",
event: 'checkContinue',
req: InstanceType<Request>,
res: InstanceType<Response> & {
req: InstanceType<Request>;
},
res: InstanceType<Response> & { req: InstanceType<Request> },
): boolean;
emit(
event: "checkExpectation",
event: 'checkExpectation',
req: InstanceType<Request>,
res: InstanceType<Response> & {
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: 'clientError', err: Error, socket: Duplex): boolean;
emit(event: 'connect', req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
emit(
event: "request",
event: 'request',
req: InstanceType<Request>,
res: InstanceType<Response> & {
req: InstanceType<Request>;
},
res: InstanceType<Response> & { req: InstanceType<Request> },
): boolean;
emit(event: "upgrade", req: InstanceType<Request>, socket: Duplex, head: Buffer): 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: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
on(
event: "newSession",
event: 'newSession',
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
on(
event: "OCSPRequest",
event: 'OCSPRequest',
listener: (
certificate: Buffer,
issuer: Buffer,
@ -155,29 +136,29 @@ declare module "https" {
) => void,
): this;
on(
event: "resumeSession",
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;
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: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
once(
event: "newSession",
event: 'newSession',
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
once(
event: "OCSPRequest",
event: 'OCSPRequest',
listener: (
certificate: Buffer,
issuer: Buffer,
@ -185,29 +166,29 @@ declare module "https" {
) => void,
): this;
once(
event: "resumeSession",
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;
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: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
prependListener(
event: "newSession",
event: 'newSession',
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
prependListener(
event: "OCSPRequest",
event: 'OCSPRequest',
listener: (
certificate: Buffer,
issuer: Buffer,
@ -215,35 +196,35 @@ declare module "https" {
) => void,
): this;
prependListener(
event: "resumeSession",
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: '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",
event: 'connect',
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
prependListener(event: "request", listener: http.RequestListener<Request, Response>): this;
prependListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
prependListener(
event: "upgrade",
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: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
prependOnceListener(
event: "newSession",
event: 'newSession',
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
prependOnceListener(
event: "OCSPRequest",
event: 'OCSPRequest',
listener: (
certificate: Buffer,
issuer: Buffer,
@ -251,37 +232,37 @@ declare module "https" {
) => void,
): this;
prependOnceListener(
event: "resumeSession",
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: '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",
event: 'connect',
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
prependOnceListener(event: "request", listener: http.RequestListener<Request, Response>): this;
prependOnceListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
prependOnceListener(
event: "upgrade",
event: 'upgrade',
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
}
/**
* ```js
* // curl -k https://localhost:8000/
* const https = require('node:https');
* const fs = require('node:fs');
* const https = require('https');
* const fs = require('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')
* };
*
* https.createServer(options, (req, res) => {
@ -293,12 +274,12 @@ declare module "https" {
* Or
*
* ```js
* const https = require('node:https');
* const fs = require('node:fs');
* const https = require('https');
* const fs = require('fs');
*
* const options = {
* pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
* passphrase: 'sample',
* passphrase: 'sample'
* };
*
* https.createServer(options, (req, res) => {
@ -334,13 +315,13 @@ declare module "https" {
* upload a file with a POST request, then write to the `ClientRequest` object.
*
* ```js
* const https = require('node:https');
* const https = require('https');
*
* const options = {
* hostname: 'encrypted.google.com',
* port: 443,
* path: '/',
* method: 'GET',
* method: 'GET'
* };
*
* const req = https.request(options, (res) => {
@ -367,7 +348,7 @@ declare module "https" {
* path: '/',
* method: 'GET',
* 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')
* };
* options.agent = new https.Agent(options);
*
@ -386,7 +367,7 @@ declare module "https" {
* method: 'GET',
* key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
* cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
* agent: false,
* agent: false
* };
*
* const req = https.request(options, (res) => {
@ -407,9 +388,9 @@ declare module "https" {
* Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`):
*
* ```js
* const tls = require('node:tls');
* const https = require('node:https');
* const crypto = require('node:crypto');
* const tls = require('tls');
* const https = require('https');
* const crypto = require('crypto');
*
* function sha256(s) {
* return crypto.createHash('sha256').update(s).digest('base64');
@ -426,7 +407,7 @@ declare module "https" {
* return err;
* }
*
* // Pin the public key, similar to HPKP pin-sha256 pinning
* // Pin the public key, similar to HPKP pin-sha25 pinning
* const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU=';
* if (sha256(cert.pubkey) !== pubkey256) {
* const msg = 'Certificate verification error: ' +
@ -517,7 +498,7 @@ declare module "https" {
* string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
*
* ```js
* const https = require('node:https');
* const https = require('https');
*
* https.get('https://encrypted.google.com/', (res) => {
* console.log('statusCode:', res.statusCode);
@ -545,6 +526,6 @@ declare module "https" {
): http.ClientRequest;
let globalAgent: Agent;
}
declare module "node:https" {
export * from "https";
declare module 'node:https' {
export * from 'https';
}

47
node_modules/@types/node/index.d.ts generated vendored Normal file → Executable file
View File

@ -1,3 +1,48 @@
// 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>
// 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
/**
* License for programmatically and manually incorporated
* documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc
@ -47,7 +92,6 @@
/// <reference path="dns/promises.d.ts" />
/// <reference path="dns/promises.d.ts" />
/// <reference path="domain.d.ts" />
/// <reference path="dom-events.d.ts" />
/// <reference path="events.d.ts" />
/// <reference path="fs.d.ts" />
/// <reference path="fs/promises.d.ts" />
@ -64,7 +108,6 @@
/// <reference path="punycode.d.ts" />
/// <reference path="querystring.d.ts" />
/// <reference path="readline.d.ts" />
/// <reference path="readline/promises.d.ts" />
/// <reference path="repl.d.ts" />
/// <reference path="stream.d.ts" />
/// <reference path="stream/promises.d.ts" />

40
node_modules/@types/node/inspector.d.ts generated vendored Normal file → Executable file
View File

@ -1,26 +1,21 @@
// eslint-disable-next-line dt-header
// Type definitions for inspector
// These definitions are auto-generated.
// Please see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/19330
// for more information.
// tslint:disable:max-line-length
/**
* The `node:inspector` module provides an API for interacting with the V8
* inspector.
* The `inspector` module provides an API for interacting with the V8 inspector.
*
* It can be accessed using:
*
* ```js
* import * as inspector from 'node:inspector/promises';
* const inspector = require('inspector');
* ```
*
* or
*
* ```js
* import * as inspector from 'node:inspector';
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/inspector.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/inspector.js)
*/
declare module 'inspector' {
import EventEmitter = require('node:events');
@ -1693,7 +1688,7 @@ declare module 'inspector' {
/**
* Controls how the trace buffer stores data.
*/
recordMode?: string | undefined;
recordMode?: string;
/**
* Included category filters.
*/
@ -1783,6 +1778,13 @@ declare module 'inspector' {
* @since v8.0.0
*/
connect(): void;
/**
* Connects a session to the main thread inspector back-end.
* An exception will be thrown if this API was not called on a Worker
* thread.
* @since v12.11.0
*/
connectToMainThread(): void;
/**
* Immediately close the session. All pending message callbacks will be called
* with an error. `session.connect()` will need to be called to be able to send
@ -2694,7 +2696,7 @@ declare module 'inspector' {
prependOnceListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this;
}
/**
* Activate inspector on host and port. Equivalent to`node --inspect=[[host:]port]`, but can be done programmatically after node has
* Activate inspector on host and port. Equivalent to `node --inspect=[[host:]port]`, but can be done programmatically after node has
* started.
*
* If wait is `true`, will block until a client has connected to the inspect port
@ -2704,9 +2706,8 @@ declare module 'inspector' {
* @param [port='what was specified on the CLI'] Port to listen on for inspector connections. Optional.
* @param [host='what was specified on the CLI'] Host to listen on for inspector connections. Optional.
* @param [wait=false] Block until a client has connected. Optional.
* @returns Disposable that calls `inspector.close()`.
*/
function open(port?: number, host?: string, wait?: boolean): Disposable;
function open(port?: number, host?: string, wait?: boolean): void;
/**
* Deactivate the inspector. Blocks until there are no active connections.
*/
@ -2717,12 +2718,12 @@ declare module 'inspector' {
* ```console
* $ node --inspect -p 'inspector.url()'
* Debugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34
* For help, see: https://nodejs.org/en/docs/inspector
* For help see https://nodejs.org/en/docs/inspector
* ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34
*
* $ node --inspect=localhost:3000 -p 'inspector.url()'
* Debugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a
* For help, see: https://nodejs.org/en/docs/inspector
* For help see https://nodejs.org/en/docs/inspector
* ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a
*
* $ node -p 'inspector.url()'
@ -2738,10 +2739,7 @@ declare module 'inspector' {
*/
function waitForDebugger(): void;
}
/**
* The inspector module provides an API for interacting with the V8 inspector.
*/
declare module 'node:inspector' {
import inspector = require('inspector');
export = inspector;
import EventEmitter = require('inspector');
export = EventEmitter;
}

241
node_modules/@types/node/module.d.ts generated vendored Normal file → Executable file
View File

@ -1,10 +1,8 @@
/**
* @since v0.3.7
* @experimental
*/
declare module "module" {
import { URL } from "node:url";
import { MessagePort } from "node:worker_threads";
declare module 'module' {
import { URL } from 'node:url';
namespace Module {
/**
* The `module.syncBuiltinESMExports()` method updates all the live bindings for
@ -12,9 +10,9 @@ declare module "module" {
* does not add or remove exported names from the `ES Modules`.
*
* ```js
* const fs = require('node:fs');
* const assert = require('node:assert');
* const { syncBuiltinESMExports } = require('node:module');
* const fs = require('fs');
* const assert = require('assert');
* const { syncBuiltinESMExports } = require('module');
*
* fs.readFile = newAPI;
*
@ -28,7 +26,7 @@ declare module "module" {
*
* syncBuiltinESMExports();
*
* import('node:fs').then((esmFS) => {
* import('fs').then((esmFS) => {
* // It syncs the existing readFile property with the new value
* assert.strictEqual(esmFS.readFile, newAPI);
* // readFileSync has been deleted from the required fs
@ -46,7 +44,6 @@ declare module "module" {
* `path` is the resolved path for the file for which a corresponding source map
* should be fetched.
* @since v13.7.0, v12.17.0
* @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise.
*/
function findSourceMap(path: string, error?: Error): SourceMap;
interface SourceMapPayload {
@ -65,24 +62,6 @@ declare module "module" {
originalLine: number;
originalColumn: number;
}
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;
}
/**
* @since v13.7.0, v12.17.0
*/
@ -93,170 +72,12 @@ declare module "module" {
readonly payload: SourceMapPayload;
constructor(payload: SourceMapPayload);
/**
* 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
* 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:
*/
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 | {};
findEntry(line: number, column: number): SourceMapping;
}
/** @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 {}
class Module {
@ -264,52 +85,30 @@ declare module "module" {
static wrap(code: string): string;
static createRequire(path: string | URL): NodeRequire;
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);
}
global {
interface ImportMeta {
/**
* The directory name of the current module. This is the same as the `path.dirname()` of the `import.meta.filename`.
* **Caveat:** only present on `file:` modules.
*/
dirname: string;
/**
* The full absolute path and filename of the current module, with symlinks resolved.
* This is the same as the `url.fileURLToPath()` of the `import.meta.url`.
* **Caveat:** only local modules support this property. Modules not using the `file:` protocol will not provide it.
*/
filename: string;
/**
* The absolute `file:` URL of the module.
*/
url: string;
/**
* @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.
*
* 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.
* @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.
*/
resolve(specifier: string, parent?: string | URL | undefined): string;
resolve?(specified: string, parent?: string | URL): Promise<string>;
}
}
export = Module;
}
declare module "node:module" {
import module = require("module");
declare module 'node:module' {
import module = require('module');
export = module;
}

370
node_modules/@types/node/net.d.ts generated vendored Normal file → Executable file
View File

@ -1,26 +1,22 @@
/**
* > Stability: 2 - Stable
*
* The `node:net` module provides an asynchronous network API for creating stream-based
* The `net` module provides an asynchronous network API for creating stream-based
* TCP or `IPC` servers ({@link createServer}) and clients
* ({@link createConnection}).
*
* It can be accessed using:
*
* ```js
* const net = require('node:net');
* const net = require('net');
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/net.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.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.LookupAllOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: dns.LookupAddress[]) => 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.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void;
interface AddressInfo {
address: string;
family: string;
@ -61,20 +57,12 @@ declare module "net" {
noDelay?: boolean | undefined;
keepAlive?: boolean | undefined;
keepAliveInitialDelay?: number | undefined;
/**
* @since v18.13.0
*/
autoSelectFamily?: boolean | undefined;
/**
* @since v18.13.0
*/
autoSelectFamilyAttemptTimeout?: number | undefined;
}
interface IpcSocketConnectOpts extends ConnectOpts {
path: string;
}
type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
type SocketReadyState = "opening" | "open" | "readOnly" | "writeOnly" | "closed";
type SocketReadyState = 'opening' | 'open' | 'readOnly' | 'writeOnly' | 'closed';
/**
* This class is an abstraction of a TCP socket or a streaming `IPC` endpoint
* (uses named pipes on Windows, and Unix domain sockets otherwise). It is also
@ -91,12 +79,6 @@ declare module "net" {
*/
class Socket extends stream.Duplex {
constructor(options?: SocketConstructorOpts);
/**
* 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
* case of a string. It defaults to UTF8 encoding.
@ -149,14 +131,6 @@ declare module "net" {
* @return The socket itself.
*/
pause(): this;
/**
* 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()`.
* @return The socket itself.
@ -234,21 +208,12 @@ declare module "net" {
*/
unref(): this;
/**
* 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.
* @since v0.9.1
* @return The socket itself.
*/
ref(): this;
/**
* 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
* may contain strings whose length after encoding is not yet known. So this number
@ -285,12 +250,6 @@ declare module "net" {
* @since v6.1.0
*/
readonly connecting: boolean;
/**
* 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.
*/
@ -307,18 +266,9 @@ declare module "net" {
* @since v0.9.6
*/
readonly localPort?: number;
/**
* 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`.
* @see {https://nodejs.org/api/net.html#socketreadystate}
* @since v0.5.0
*/
readonly readyState: SocketReadyState;
@ -329,20 +279,17 @@ declare module "net" {
*/
readonly remoteAddress?: string | undefined;
/**
* The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. Value may be `undefined` if
* the socket is destroyed (for example, if the client disconnected).
* The string representation of the remote IP family. `'IPv4'` or `'IPv6'`.
* @since v0.11.14
*/
readonly remoteFamily?: string | undefined;
/**
* The numeric representation of the remote port. For example, `80` or `21`. Value may be `undefined` if
* the socket is destroyed (for example, if the client disconnected).
* The numeric representation of the remote port. For example, `80` or `21`.
* @since v0.5.10
*/
readonly remotePort?: number | undefined;
/**
* The socket timeout in milliseconds as set by `socket.setTimeout()`.
* It is `undefined` if a timeout has not been set.
* 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;
@ -368,84 +315,68 @@ declare module "net" {
* 5. end
* 6. error
* 7. lookup
* 8. ready
* 9. timeout
* 8. 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;
}
interface ListenOptions extends Abortable {
port?: number | undefined;
@ -491,14 +422,6 @@ declare module "net" {
*/
keepAliveInitialDelay?: number | undefined;
}
interface DropArgument {
localAddress?: string;
localPort?: number;
localFamily?: string;
remoteAddress?: string;
remotePort?: number;
remoteFamily?: string;
}
/**
* This class is used to create a TCP or `IPC` server.
* @since v0.1.90
@ -538,7 +461,7 @@ declare module "net" {
* ```js
* server.on('error', (e) => {
* if (e.code === 'EADDRINUSE') {
* console.error('Address in use, retrying...');
* console.log('Address in use, retrying...');
* setTimeout(() => {
* server.close();
* server.listen(PORT, HOST);
@ -603,7 +526,7 @@ declare module "net" {
*/
getConnections(cb: (error: Error | null, count: number) => void): void;
/**
* 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.
* @since v0.9.1
*/
@ -635,61 +558,49 @@ declare module "net" {
* 2. connection
* 3. error
* 4. listening
* 5. drop
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "connection", listener: (socket: Socket) => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "listening", listener: () => void): this;
addListener(event: "drop", listener: (data?: DropArgument) => void): this;
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;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "close"): boolean;
emit(event: "connection", socket: Socket): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "listening"): boolean;
emit(event: "drop", data?: DropArgument): boolean;
emit(event: 'close'): boolean;
emit(event: 'connection', socket: Socket): boolean;
emit(event: 'error', err: Error): boolean;
emit(event: 'listening'): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: () => void): this;
on(event: "connection", listener: (socket: Socket) => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "listening", listener: () => void): this;
on(event: "drop", listener: (data?: DropArgument) => void): this;
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;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "connection", listener: (socket: Socket) => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "listening", listener: () => void): this;
once(event: "drop", listener: (data?: DropArgument) => void): this;
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;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "connection", listener: (socket: Socket) => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "listening", listener: () => void): this;
prependListener(event: "drop", listener: (data?: DropArgument) => void): this;
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;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "connection", listener: (socket: Socket) => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "listening", listener: () => void): this;
prependOnceListener(event: "drop", listener: (data?: DropArgument) => void): this;
/**
* Calls {@link Server.close()} and returns a promise that fulfills when the server has closed.
* @since v20.5.0
*/
[Symbol.asyncDispose](): Promise<void>;
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;
}
type IPVersion = "ipv4" | "ipv6";
type IPVersion = 'ipv4' | 'ipv6';
/**
* The `BlockList` object can be used with some network APIs to specify rules for
* disabling inbound or outbound access to specific IP addresses, IP ranges, or
* IP subnets.
* @since v15.0.0, v14.18.0
* @since v15.0.0
*/
class BlockList {
/**
* Adds a rule to block the given IP address.
* @since v15.0.0, v14.18.0
* @since v15.0.0
* @param address An IPv4 or IPv6 address.
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
*/
@ -697,7 +608,7 @@ declare module "net" {
addAddress(address: SocketAddress): void;
/**
* Adds a rule to block a range of IP addresses from `start` (inclusive) to`end` (inclusive).
* @since v15.0.0, v14.18.0
* @since v15.0.0
* @param start The starting IPv4 or IPv6 address in the range.
* @param end The ending IPv4 or IPv6 address in the range.
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
@ -706,7 +617,7 @@ declare module "net" {
addRange(start: SocketAddress, end: SocketAddress): void;
/**
* Adds a rule to block a range of IP addresses specified as a subnet mask.
* @since v15.0.0, v14.18.0
* @since v15.0.0
* @param net The network IPv4 or IPv6 address.
* @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`.
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
@ -730,7 +641,7 @@ declare module "net" {
* console.log(blockList.check('::ffff:7b7b:7b7b', 'ipv6')); // Prints: true
* console.log(blockList.check('::ffff:123.123.123.123', 'ipv6')); // Prints: true
* ```
* @since v15.0.0, v14.18.0
* @since v15.0.0
* @param address The IP address to check
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
*/
@ -761,11 +672,11 @@ declare module "net" {
*
* The server can be a TCP server or an `IPC` server, depending on what it `listen()` to.
*
* Here is an example of a TCP echo server which listens for connections
* Here is an example of an TCP echo server which listens for connections
* on port 8124:
*
* ```js
* const net = require('node:net');
* const net = require('net');
* const server = net.createServer((c) => {
* // 'connection' listener.
* console.log('client connected');
@ -785,8 +696,8 @@ declare module "net" {
*
* Test this by using `telnet`:
*
* ```bash
* telnet localhost 8124
* ```console
* $ telnet localhost 8124
* ```
*
* To listen on the socket `/tmp/echo.sock`:
@ -799,8 +710,8 @@ declare module "net" {
*
* Use `nc` to connect to a Unix domain socket server:
*
* ```bash
* nc -U /tmp/echo.sock
* ```console
* $ nc -U /tmp/echo.sock
* ```
* @since v0.5.0
* @param connectionListener Automatically set as a listener for the {@link 'connection'} event.
@ -840,61 +751,19 @@ declare module "net" {
function createConnection(port: number, host?: string, connectionListener?: () => void): Socket;
function createConnection(path: string, connectionListener?: () => void): Socket;
/**
* 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
* ```
* 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.
* @since v0.3.0
*/
function isIP(input: string): number;
/**
* 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
* ```
* Returns `true` if input is a version 4 IP address, otherwise returns `false`.
* @since v0.3.0
*/
function isIPv4(input: string): boolean;
/**
* Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`.
*
* ```js
* net.isIPv6('::1'); // returns true
* net.isIPv6('fhqwhgads'); // returns false
* ```
* Returns `true` if input is a version 6 IP address, otherwise returns `false`.
* @since v0.3.0
*/
function isIPv6(input: string): boolean;
@ -920,30 +789,29 @@ declare module "net" {
port?: number | undefined;
}
/**
* @since v15.14.0, v14.18.0
* @since v15.14.0
*/
class SocketAddress {
constructor(options: SocketAddressInitOptions);
/**
* Either \`'ipv4'\` or \`'ipv6'\`.
* @since v15.14.0, v14.18.0
* @since v15.14.0
*/
readonly address: string;
/**
* Either \`'ipv4'\` or \`'ipv6'\`.
* @since v15.14.0, v14.18.0
* @since v15.14.0
*/
readonly family: IPVersion;
/**
* @since v15.14.0, v14.18.0
* @since v15.14.0
*/
readonly port: number;
/**
* @since v15.14.0, v14.18.0
* @since v15.14.0
*/
readonly flowlabel: number;
}
}
declare module "node:net" {
export * from "net";
declare module 'node:net' {
export * from 'net';
}

67
node_modules/@types/node/os.d.ts generated vendored Normal file → Executable file
View File

@ -1,13 +1,13 @@
/**
* The `node:os` module provides operating system-related utility methods and
* The `os` module provides operating system-related utility methods and
* properties. It can be accessed using:
*
* ```js
* const os = require('node:os');
* const os = require('os');
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/os.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/os.js)
*/
declare module "os" {
declare module 'os' {
interface CpuInfo {
model: string;
speed: number;
@ -27,18 +27,17 @@ declare module "os" {
cidr: string | null;
}
interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase {
family: "IPv4";
scopeid?: undefined;
family: 'IPv4';
}
interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase {
family: "IPv6";
family: 'IPv6';
scopeid: number;
}
interface UserInfo<T> {
username: T;
uid: number;
gid: number;
shell: T | null;
shell: T;
homedir: T;
}
type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6;
@ -75,7 +74,6 @@ declare module "os" {
function totalmem(): number;
/**
* 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.
*
* The properties included on each object include:
*
@ -89,8 +87,8 @@ declare module "os" {
* nice: 0,
* sys: 30340,
* idle: 1070356870,
* irq: 0,
* },
* irq: 0
* }
* },
* {
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
@ -100,8 +98,8 @@ declare module "os" {
* nice: 0,
* sys: 26980,
* idle: 1071569080,
* irq: 0,
* },
* irq: 0
* }
* },
* {
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
@ -111,8 +109,8 @@ declare module "os" {
* nice: 0,
* sys: 21750,
* idle: 1070919370,
* irq: 0,
* },
* irq: 0
* }
* },
* {
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
@ -122,28 +120,17 @@ declare module "os" {
* nice: 0,
* sys: 19430,
* idle: 1070905480,
* irq: 20,
* },
* irq: 20
* }
* },
* ]
* ```
*
* `nice` values are POSIX-only. On Windows, the `nice` values of all processors
* 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
*/
function cpus(): CpuInfo[];
/**
* 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
* returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.
@ -239,7 +226,7 @@ declare module "os" {
* Throws a `SystemError` if a user has no `username` or `homedir`.
* @since v6.0.0
*/
function userInfo(options: { encoding: "buffer" }): UserInfo<Buffer>;
function userInfo(options: { encoding: 'buffer' }): UserInfo<Buffer>;
function userInfo(options?: { encoding: BufferEncoding }): UserInfo<string>;
type SignalConstants = {
[key in NodeJS.Signals]: number;
@ -400,8 +387,7 @@ declare module "os" {
const EOL: string;
/**
* Returns the operating system CPU architecture for which the Node.js binary was
* compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`,`'mips'`, `'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`,
* and `'x64'`.
* compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`.
*
* The return value is equivalent to `process.arch`.
* @since v0.5.0
@ -416,9 +402,8 @@ declare module "os" {
*/
function version(): string;
/**
* 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'`.
* 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'`.
*
* The return value is equivalent to `process.platform`.
*
@ -427,14 +412,6 @@ declare module "os" {
* @since v0.5.0
*/
function platform(): NodeJS.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
* string.
@ -448,7 +425,7 @@ declare module "os" {
* Possible values are `'BE'` for big endian and `'LE'` for little endian.
* @since v0.9.4
*/
function endianness(): "BE" | "LE";
function endianness(): 'BE' | 'LE';
/**
* Returns the scheduling priority for the process specified by `pid`. If `pid` is
* not provided or is `0`, the priority of the current process is returned.
@ -473,6 +450,6 @@ declare module "os" {
function setPriority(priority: number): void;
function setPriority(pid: number, priority: number): void;
}
declare module "node:os" {
export * from "os";
declare module 'node:os' {
export * from 'os';
}

192
node_modules/@types/node/package.json generated vendored Normal file → Executable file
View File

@ -1,215 +1,220 @@
{
"name": "@types/node",
"version": "20.11.6",
"description": "TypeScript definitions for node",
"version": "16.11.64",
"description": "TypeScript definitions for Node.js",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
"license": "MIT",
"contributors": [
{
"name": "Microsoft TypeScript",
"githubUsername": "Microsoft",
"url": "https://github.com/Microsoft"
"url": "https://github.com/Microsoft",
"githubUsername": "Microsoft"
},
{
"name": "DefinitelyTyped",
"url": "https://github.com/DefinitelyTyped",
"githubUsername": "DefinitelyTyped"
},
{
"name": "Alberto Schiabel",
"githubUsername": "jkomyno",
"url": "https://github.com/jkomyno"
"url": "https://github.com/jkomyno",
"githubUsername": "jkomyno"
},
{
"name": "Alvis HT Tang",
"githubUsername": "alvis",
"url": "https://github.com/alvis"
"url": "https://github.com/alvis",
"githubUsername": "alvis"
},
{
"name": "Andrew Makarov",
"githubUsername": "r3nya",
"url": "https://github.com/r3nya"
"url": "https://github.com/r3nya",
"githubUsername": "r3nya"
},
{
"name": "Benjamin Toueg",
"githubUsername": "btoueg",
"url": "https://github.com/btoueg"
"url": "https://github.com/btoueg",
"githubUsername": "btoueg"
},
{
"name": "Chigozirim C.",
"githubUsername": "smac89",
"url": "https://github.com/smac89"
"url": "https://github.com/smac89",
"githubUsername": "smac89"
},
{
"name": "David Junger",
"githubUsername": "touffy",
"url": "https://github.com/touffy"
"url": "https://github.com/touffy",
"githubUsername": "touffy"
},
{
"name": "Deividas Bakanas",
"githubUsername": "DeividasBakanas",
"url": "https://github.com/DeividasBakanas"
"url": "https://github.com/DeividasBakanas",
"githubUsername": "DeividasBakanas"
},
{
"name": "Eugene Y. Q. Shen",
"githubUsername": "eyqs",
"url": "https://github.com/eyqs"
"url": "https://github.com/eyqs",
"githubUsername": "eyqs"
},
{
"name": "Hannes Magnusson",
"githubUsername": "Hannes-Magnusson-CK",
"url": "https://github.com/Hannes-Magnusson-CK"
"url": "https://github.com/Hannes-Magnusson-CK",
"githubUsername": "Hannes-Magnusson-CK"
},
{
"name": "Huw",
"githubUsername": "hoo29",
"url": "https://github.com/hoo29"
"url": "https://github.com/hoo29",
"githubUsername": "hoo29"
},
{
"name": "Kelvin Jin",
"githubUsername": "kjin",
"url": "https://github.com/kjin"
"url": "https://github.com/kjin",
"githubUsername": "kjin"
},
{
"name": "Klaus Meinhardt",
"githubUsername": "ajafff",
"url": "https://github.com/ajafff"
"url": "https://github.com/ajafff",
"githubUsername": "ajafff"
},
{
"name": "Lishude",
"githubUsername": "islishude",
"url": "https://github.com/islishude"
"url": "https://github.com/islishude",
"githubUsername": "islishude"
},
{
"name": "Mariusz Wiktorczyk",
"githubUsername": "mwiktorczyk",
"url": "https://github.com/mwiktorczyk"
"url": "https://github.com/mwiktorczyk",
"githubUsername": "mwiktorczyk"
},
{
"name": "Mohsen Azimi",
"githubUsername": "mohsen1",
"url": "https://github.com/mohsen1"
"url": "https://github.com/mohsen1",
"githubUsername": "mohsen1"
},
{
"name": "Nicolas Even",
"githubUsername": "n-e",
"url": "https://github.com/n-e"
"url": "https://github.com/n-e",
"githubUsername": "n-e"
},
{
"name": "Nikita Galkin",
"githubUsername": "galkin",
"url": "https://github.com/galkin"
"url": "https://github.com/galkin",
"githubUsername": "galkin"
},
{
"name": "Parambir Singh",
"githubUsername": "parambirs",
"url": "https://github.com/parambirs"
"url": "https://github.com/parambirs",
"githubUsername": "parambirs"
},
{
"name": "Sebastian Silbermann",
"githubUsername": "eps1lon",
"url": "https://github.com/eps1lon"
"url": "https://github.com/eps1lon",
"githubUsername": "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",
"githubUsername": "ThomasdenH",
"url": "https://github.com/ThomasdenH"
"url": "https://github.com/ThomasdenH",
"githubUsername": "ThomasdenH"
},
{
"name": "Wilco Bakker",
"githubUsername": "WilcoBakker",
"url": "https://github.com/WilcoBakker"
"url": "https://github.com/WilcoBakker",
"githubUsername": "WilcoBakker"
},
{
"name": "wwwy3y3",
"githubUsername": "wwwy3y3",
"url": "https://github.com/wwwy3y3"
"url": "https://github.com/wwwy3y3",
"githubUsername": "wwwy3y3"
},
{
"name": "Samuel Ainsworth",
"githubUsername": "samuela",
"url": "https://github.com/samuela"
"url": "https://github.com/samuela",
"githubUsername": "samuela"
},
{
"name": "Kyle Uehlein",
"githubUsername": "kuehlein",
"url": "https://github.com/kuehlein"
"url": "https://github.com/kuehlein",
"githubUsername": "kuehlein"
},
{
"name": "Thanik Bhongbhibhat",
"githubUsername": "bhongy",
"url": "https://github.com/bhongy"
"url": "https://github.com/bhongy",
"githubUsername": "bhongy"
},
{
"name": "Marcin Kopacz",
"githubUsername": "chyzwar",
"url": "https://github.com/chyzwar"
"url": "https://github.com/chyzwar",
"githubUsername": "chyzwar"
},
{
"name": "Trivikram Kamat",
"githubUsername": "trivikr",
"url": "https://github.com/trivikr"
"url": "https://github.com/trivikr",
"githubUsername": "trivikr"
},
{
"name": "Junxiao Shi",
"githubUsername": "yoursunny",
"url": "https://github.com/yoursunny"
"url": "https://github.com/yoursunny",
"githubUsername": "yoursunny"
},
{
"name": "Ilia Baryshnikov",
"githubUsername": "qwelias",
"url": "https://github.com/qwelias"
"url": "https://github.com/qwelias",
"githubUsername": "qwelias"
},
{
"name": "ExE Boss",
"githubUsername": "ExE-Boss",
"url": "https://github.com/ExE-Boss"
"url": "https://github.com/ExE-Boss",
"githubUsername": "ExE-Boss"
},
{
"name": "Piotr Błażejewicz",
"githubUsername": "peterblazejewicz",
"url": "https://github.com/peterblazejewicz"
"url": "https://github.com/peterblazejewicz",
"githubUsername": "peterblazejewicz"
},
{
"name": "Anna Henningsen",
"githubUsername": "addaleax",
"url": "https://github.com/addaleax"
"url": "https://github.com/addaleax",
"githubUsername": "addaleax"
},
{
"name": "Victor Perin",
"githubUsername": "victorperin",
"url": "https://github.com/victorperin"
"url": "https://github.com/victorperin",
"githubUsername": "victorperin"
},
{
"name": "Yongsheng Zhang",
"githubUsername": "ZYSzys",
"url": "https://github.com/ZYSzys"
"url": "https://github.com/ZYSzys",
"githubUsername": "ZYSzys"
},
{
"name": "NodeJS Contributors",
"githubUsername": "NodeJS",
"url": "https://github.com/NodeJS"
"url": "https://github.com/NodeJS",
"githubUsername": "NodeJS"
},
{
"name": "Linus Unnebäck",
"githubUsername": "LinusU",
"url": "https://github.com/LinusU"
"url": "https://github.com/LinusU",
"githubUsername": "LinusU"
},
{
"name": "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"
"url": "https://github.com/wafuwafu13",
"githubUsername": "wafuwafu13"
}
],
"main": "",
"types": "index.d.ts",
"typesVersions": {
"<=4.8": {
"<4.9.0-0": {
"*": [
"ts4.8/*"
]
@ -221,10 +226,7 @@
"directory": "types/node"
},
"scripts": {},
"dependencies": {
"undici-types": "~5.26.4"
},
"typesPublisherContentHash": "4672df994f41fe8261bb8674f0ae453a191329e23938a5bf005572caa3a878fc",
"typeScriptVersion": "4.6",
"nonNpm": true
"dependencies": {},
"typesPublisherContentHash": "ee1afca298a6f737a7b417dcc5bdf25fb305bf10e06a5b5b5becdb6cde8ee564",
"typeScriptVersion": "4.1"
}

40
node_modules/@types/node/path.d.ts generated vendored Normal file → Executable file
View File

@ -1,21 +1,21 @@
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 `node:path` module provides utilities for working with file and directory
* paths. It can be accessed using:
* The `path` module provides utilities for working with file and directory paths.
* It can be accessed using:
*
* ```js
* const path = require('node:path');
* const path = require('path');
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/path.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/path.js)
*/
declare module "path" {
declare module 'path' {
namespace path {
/**
* A parsed path object generated by path.parse() or consumed by path.format().
@ -90,7 +90,7 @@ declare module "path" {
* the current working directory is used as well. The resulting path is normalized,
* and trailing slashes are removed unless the path gets resolved to the root directory.
*
* @param paths A sequence of paths or path segments.
* @param paths string paths to join.
* @throws {TypeError} if any of the arguments is not a string.
*/
resolve(...paths: string[]): string;
@ -122,10 +122,10 @@ declare module "path" {
* Often used to extract the file name from a fully qualified path.
*
* @param path the path to evaluate.
* @param suffix optionally, an extension to remove from the result.
* @param ext optionally, an extension to remove from the result.
* @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string.
*/
basename(path: string, suffix?: string): string;
basename(path: string, ext?: 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.
@ -137,11 +137,11 @@ declare module "path" {
/**
* The platform-specific file separator. '\\' or '/'.
*/
readonly sep: "\\" | "/";
readonly sep: '\\' | '/';
/**
* The platform-specific file delimiter. ';' or ':'.
*/
readonly delimiter: ";" | ":";
readonly delimiter: ';' | ':';
/**
* Returns an object from a path string - the opposite of format().
*
@ -177,15 +177,15 @@ declare module "path" {
const path: path.PlatformPath;
export = 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");
declare module 'node:path/posix' {
import path = require('path/posix');
export = path;
}
declare module "node:path/win32" {
import path = require("path/win32");
declare module 'node:path/win32' {
import path = require('path/win32');
export = path;
}

131
node_modules/@types/node/perf_hooks.d.ts generated vendored Normal file → Executable file
View File

@ -7,10 +7,9 @@
* * [High Resolution Time](https://www.w3.org/TR/hr-time-2)
* * [Performance Timeline](https://w3c.github.io/performance-timeline/)
* * [User Timing](https://www.w3.org/TR/user-timing/)
* * [Resource Timing](https://www.w3.org/TR/resource-timing-2/)
*
* ```js
* const { PerformanceObserver, performance } = require('node:perf_hooks');
* const { PerformanceObserver, performance } = require('perf_hooks');
*
* const obs = new PerformanceObserver((items) => {
* console.log(items.getEntries()[0].duration);
@ -27,11 +26,11 @@
* performance.measure('A to B', 'A', 'B');
* });
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/perf_hooks.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/perf_hooks.js)
*/
declare module "perf_hooks" {
import { AsyncResource } from "node:async_hooks";
type EntryType = "node" | "mark" | "measure" | "gc" | "function" | "http2" | "http" | "dns" | "net";
declare module 'perf_hooks' {
import { AsyncResource } from 'node:async_hooks';
type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http';
interface NodeGCPerformanceDetail {
/**
* When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies
@ -47,7 +46,6 @@ declare module "perf_hooks" {
readonly flags?: number | undefined;
}
/**
* The constructor of this class is not exposed to users directly.
* @since v8.5.0
*/
class PerformanceEntry {
@ -87,24 +85,6 @@ declare module "perf_hooks" {
* @since v16.0.0
*/
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._
@ -166,10 +146,7 @@ declare module "perf_hooks" {
* @param util1 The result of a previous call to eventLoopUtilization()
* @param util2 The result of a previous call to eventLoopUtilization() prior to util1
*/
type EventLoopUtilityFunction = (
util1?: EventLoopUtilization,
util2?: EventLoopUtilization,
) => EventLoopUtilization;
type EventLoopUtilityFunction = (util1?: EventLoopUtilization, util2?: EventLoopUtilization) => EventLoopUtilization;
interface MarkOptions {
/**
* Additional optional detail to include with the mark.
@ -249,9 +226,8 @@ declare module "perf_hooks" {
* and whose performanceEntry.duration is always 0.
* Performance marks are used to mark specific significant moments in the Performance Timeline.
* @param name
* @return The PerformanceMark entry that was created
*/
mark(name?: string, options?: MarkOptions): PerformanceMark;
mark(name?: string, options?: MarkOptions): void;
/**
* Creates a new PerformanceMeasure entry in the Performance Timeline.
* A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure',
@ -266,10 +242,9 @@ declare module "perf_hooks" {
* @param name
* @param startMark
* @param endMark
* @return The PerformanceMeasure entry that was created
*/
measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure;
measure(name: string, options: MeasureOptions): PerformanceMeasure;
measure(name: string, startMark?: string, endMark?: string): void;
measure(name: string, options: MeasureOptions): void;
/**
* An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones.
*/
@ -303,8 +278,8 @@ declare module "perf_hooks" {
* ```js
* const {
* performance,
* PerformanceObserver,
* } = require('node:perf_hooks');
* PerformanceObserver
* } = require('perf_hooks');
*
* const obs = new PerformanceObserver((perfObserverList, observer) => {
* console.log(perfObserverList.getEntries());
@ -314,20 +289,16 @@ declare module "perf_hooks" {
* * name: 'test',
* * entryType: 'mark',
* * startTime: 81.465639,
* * duration: 0,
* * detail: null
* * duration: 0
* * },
* * PerformanceEntry {
* * name: 'meow',
* * entryType: 'mark',
* * startTime: 81.860064,
* * duration: 0,
* * detail: null
* * duration: 0
* * }
* * ]
*
* performance.clearMarks();
* performance.clearMeasures();
* observer.disconnect();
* });
* obs.observe({ type: 'mark' });
@ -346,8 +317,8 @@ declare module "perf_hooks" {
* ```js
* const {
* performance,
* PerformanceObserver,
* } = require('node:perf_hooks');
* PerformanceObserver
* } = require('perf_hooks');
*
* const obs = new PerformanceObserver((perfObserverList, observer) => {
* console.log(perfObserverList.getEntriesByName('meow'));
@ -357,8 +328,7 @@ declare module "perf_hooks" {
* * name: 'meow',
* * entryType: 'mark',
* * startTime: 98.545991,
* * duration: 0,
* * detail: null
* * duration: 0
* * }
* * ]
*
@ -371,15 +341,11 @@ declare module "perf_hooks" {
* * name: 'test',
* * entryType: 'mark',
* * startTime: 63.518931,
* * duration: 0,
* * detail: null
* * duration: 0
* * }
* * ]
*
* console.log(perfObserverList.getEntriesByName('test', 'measure')); // []
*
* performance.clearMarks();
* performance.clearMeasures();
* observer.disconnect();
* });
* obs.observe({ entryTypes: ['mark', 'measure'] });
@ -397,8 +363,8 @@ declare module "perf_hooks" {
* ```js
* const {
* performance,
* PerformanceObserver,
* } = require('node:perf_hooks');
* PerformanceObserver
* } = require('perf_hooks');
*
* const obs = new PerformanceObserver((perfObserverList, observer) => {
* console.log(perfObserverList.getEntriesByType('mark'));
@ -408,20 +374,16 @@ declare module "perf_hooks" {
* * name: 'test',
* * entryType: 'mark',
* * startTime: 55.897834,
* * duration: 0,
* * detail: null
* * duration: 0
* * },
* * PerformanceEntry {
* * name: 'meow',
* * entryType: 'mark',
* * startTime: 56.350146,
* * duration: 0,
* * detail: null
* * duration: 0
* * }
* * ]
*
* performance.clearMarks();
* performance.clearMeasures();
* observer.disconnect();
* });
* obs.observe({ type: 'mark' });
@ -434,9 +396,6 @@ declare module "perf_hooks" {
getEntriesByType(type: EntryType): PerformanceEntry[];
}
type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void;
/**
* @since v8.5.0
*/
class PerformanceObserver extends AsyncResource {
constructor(callback: PerformanceObserverCallback);
/**
@ -450,11 +409,11 @@ declare module "perf_hooks" {
* ```js
* const {
* performance,
* PerformanceObserver,
* } = require('node:perf_hooks');
* PerformanceObserver
* } = require('perf_hooks');
*
* const obs = new PerformanceObserver((list, observer) => {
* // Called once asynchronously. `list` contains three items.
* // Called three times synchronously. `list` contains one item.
* });
* obs.observe({ type: 'mark' });
*
@ -466,13 +425,13 @@ declare module "perf_hooks" {
observe(
options:
| {
entryTypes: readonly EntryType[];
buffered?: boolean | undefined;
}
entryTypes: ReadonlyArray<EntryType>;
buffered?: boolean | undefined;
}
| {
type: EntryType;
buffered?: boolean | undefined;
},
type: EntryType;
buffered?: boolean | undefined;
}
): void;
}
namespace constants {
@ -557,7 +516,7 @@ declare module "perf_hooks" {
}
interface RecordableHistogram extends Histogram {
/**
* @since v15.9.0, v14.18.0
* @since v15.9.0
* @param val The amount to record in the histogram.
*/
record(val: number | bigint): void;
@ -566,14 +525,9 @@ declare module "perf_hooks" {
* previous call to `recordDelta()` and records that amount in the histogram.
*
* ## Examples
* @since v15.9.0, v14.18.0
* @since v15.9.0
*/
recordDelta(): void;
/**
* Adds the values from `other` to this histogram.
* @since v17.4.0, v16.14.0
*/
add(other: RecordableHistogram): void;
}
/**
* _This property is an extension by Node.js. It is not available in Web browsers._
@ -588,7 +542,7 @@ declare module "perf_hooks" {
* detect.
*
* ```js
* const { monitorEventLoopDelay } = require('node:perf_hooks');
* const { monitorEventLoopDelay } = require('perf_hooks');
* const h = monitorEventLoopDelay({ resolution: 20 });
* h.enable();
* // Do something.
@ -623,23 +577,10 @@ declare module "perf_hooks" {
}
/**
* Returns a `RecordableHistogram`.
* @since v15.9.0, v14.18.0
* @since v15.9.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';
}

498
node_modules/@types/node/process.d.ts generated vendored Normal file → Executable file
View File

@ -1,6 +1,6 @@
declare module "process" {
import * as tty from "node:tty";
import { Worker } from "node:worker_threads";
declare module 'process' {
import * as tty from 'node:tty';
import { Worker } from 'node:worker_threads';
global {
var process: NodeJS.Process;
namespace NodeJS {
@ -48,70 +48,47 @@ declare module "process" {
modules: string;
openssl: string;
}
type Platform =
| "aix"
| "android"
| "darwin"
| "freebsd"
| "haiku"
| "linux"
| "openbsd"
| "sunos"
| "win32"
| "cygwin"
| "netbsd";
type Architecture =
| "arm"
| "arm64"
| "ia32"
| "mips"
| "mipsel"
| "ppc"
| "ppc64"
| "riscv64"
| "s390"
| "s390x"
| "x64";
type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
type Signals =
| "SIGABRT"
| "SIGALRM"
| "SIGBUS"
| "SIGCHLD"
| "SIGCONT"
| "SIGFPE"
| "SIGHUP"
| "SIGILL"
| "SIGINT"
| "SIGIO"
| "SIGIOT"
| "SIGKILL"
| "SIGPIPE"
| "SIGPOLL"
| "SIGPROF"
| "SIGPWR"
| "SIGQUIT"
| "SIGSEGV"
| "SIGSTKFLT"
| "SIGSTOP"
| "SIGSYS"
| "SIGTERM"
| "SIGTRAP"
| "SIGTSTP"
| "SIGTTIN"
| "SIGTTOU"
| "SIGUNUSED"
| "SIGURG"
| "SIGUSR1"
| "SIGUSR2"
| "SIGVTALRM"
| "SIGWINCH"
| "SIGXCPU"
| "SIGXFSZ"
| "SIGBREAK"
| "SIGLOST"
| "SIGINFO";
type UncaughtExceptionOrigin = "uncaughtException" | "unhandledRejection";
type MultipleResolveType = "resolve" | "reject";
| 'SIGABRT'
| 'SIGALRM'
| 'SIGBUS'
| 'SIGCHLD'
| 'SIGCONT'
| 'SIGFPE'
| 'SIGHUP'
| 'SIGILL'
| 'SIGINT'
| 'SIGIO'
| 'SIGIOT'
| 'SIGKILL'
| 'SIGPIPE'
| 'SIGPOLL'
| 'SIGPROF'
| 'SIGPWR'
| 'SIGQUIT'
| 'SIGSEGV'
| 'SIGSTKFLT'
| 'SIGSTOP'
| 'SIGSYS'
| 'SIGTERM'
| 'SIGTRAP'
| 'SIGTSTP'
| 'SIGTTIN'
| 'SIGTTOU'
| 'SIGUNUSED'
| 'SIGURG'
| 'SIGUSR1'
| 'SIGUSR2'
| 'SIGVTALRM'
| 'SIGWINCH'
| 'SIGXCPU'
| 'SIGXFSZ'
| 'SIGBREAK'
| 'SIGLOST'
| 'SIGINFO';
type UncaughtExceptionOrigin = 'uncaughtException' | 'unhandledRejection';
type MultipleResolveType = 'resolve' | 'reject';
type BeforeExitListener = (code: number) => void;
type DisconnectListener = () => void;
type ExitListener = (code: number) => void;
@ -119,17 +96,13 @@ declare module "process" {
type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void;
/**
* Most of the time the unhandledRejection will be an Error, but this should not be relied upon
* as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error.
* as *anything* can be thrown/rejected, it is therefore unsafe to assume the the value is an Error.
*/
type UnhandledRejectionListener = (reason: unknown, promise: Promise<unknown>) => void;
type WarningListener = (warning: Error) => void;
type MessageListener = (message: unknown, sendHandle: unknown) => void;
type SignalsListener = (signal: Signals) => void;
type MultipleResolveListener = (
type: MultipleResolveType,
promise: Promise<unknown>,
value: unknown,
) => void;
type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<unknown>, value: unknown) => void;
type WorkerListener = (worker: Worker) => void;
interface Socket extends ReadWriteStream {
isTTY?: true | undefined;
@ -276,7 +249,7 @@ declare module "process" {
* For example, to copy `process.stdin` to `process.stdout`:
*
* ```js
* import { stdin, stdout } from 'node:process';
* import { stdin, stdout } from 'process';
*
* stdin.pipe(stdout);
* ```
@ -323,7 +296,7 @@ declare module "process" {
* For example, assuming the following script for `process-args.js`:
*
* ```js
* import { argv } from 'node:process';
* import { argv } from 'process';
*
* // print process.argv
* argv.forEach((val, index) => {
@ -333,8 +306,8 @@ declare module "process" {
*
* Launching the Node.js process as:
*
* ```bash
* node process-args.js one two=three four
* ```console
* $ node process-args.js one two=three four
* ```
*
* Would generate the output:
@ -370,8 +343,8 @@ declare module "process" {
* the script name. These options are useful in order to spawn child processes with
* the same execution environment as the parent.
*
* ```bash
* node --harmony script.js --version
* ```console
* $ node --harmony script.js --version
* ```
*
* Results in `process.execArgv`:
@ -415,7 +388,7 @@ declare module "process" {
* the specified `directory` does not exist).
*
* ```js
* import { chdir, cwd } from 'node:process';
* import { chdir, cwd } from 'process';
*
* console.log(`Starting directory: ${cwd()}`);
* try {
@ -435,7 +408,7 @@ declare module "process" {
* process.
*
* ```js
* import { cwd } from 'node:process';
* import { cwd } from 'process';
*
* console.log(`Current directory: ${cwd()}`);
* ```
@ -446,7 +419,7 @@ declare module "process" {
* The port used by the Node.js debugger when enabled.
*
* ```js
* import process from 'node:process';
* import process from 'process';
*
* process.debugPort = 5858;
* ```
@ -458,12 +431,12 @@ declare module "process" {
* specific process warnings. These can be listened for by adding a handler to the `'warning'` event.
*
* ```js
* import { emitWarning } from 'node:process';
* import { emitWarning } from 'process';
*
* // Emit a warning with a code and additional detail.
* emitWarning('Something happened!', {
* code: 'MY_WARNING',
* detail: 'This is some additional information',
* detail: 'This is some additional information'
* });
* // Emits:
* // (node:56338) [MY_WARNING] Warning: Something happened!
@ -473,7 +446,7 @@ declare module "process" {
* In this example, an `Error` object is generated internally by`process.emitWarning()` and passed through to the `'warning'` handler.
*
* ```js
* import process from 'node:process';
* import process from 'process';
*
* process.on('warning', (warning) => {
* console.warn(warning.name); // 'Warning'
@ -518,14 +491,14 @@ declare module "process" {
* to other `Worker` threads.
* In other words, the following example would not work:
*
* ```bash
* node -e 'process.env.foo = "bar"' &#x26;&#x26; echo $foo
* ```console
* $ node -e 'process.env.foo = "bar"' &#x26;&#x26; echo $foo
* ```
*
* While the following will:
*
* ```js
* import { env } from 'node:process';
* import { env } from 'process';
*
* env.foo = 'bar';
* console.log(env.foo);
@ -536,7 +509,7 @@ declare module "process" {
* throw an error when the value is not a string, number, or boolean.
*
* ```js
* import { env } from 'node:process';
* import { env } from 'process';
*
* env.test = null;
* console.log(env.test);
@ -549,7 +522,7 @@ declare module "process" {
* Use `delete` to delete a property from `process.env`.
*
* ```js
* import { env } from 'node:process';
* import { env } from 'process';
*
* env.TEST = 1;
* delete env.TEST;
@ -560,7 +533,7 @@ declare module "process" {
* On Windows operating systems, environment variables are case-insensitive.
*
* ```js
* import { env } from 'node:process';
* import { env } from 'process';
*
* env.TEST = 1;
* console.log(env.test);
@ -569,11 +542,10 @@ declare module "process" {
*
* Unless explicitly specified when creating a `Worker` instance,
* each `Worker` thread has its own copy of `process.env`, based on its
* parent thread's `process.env`, or whatever was specified as the `env` option
* parent threads `process.env`, or whatever was specified as the `env` option
* to the `Worker` constructor. Changes to `process.env` will not be visible
* across `Worker` threads, and only the main thread can make changes that
* are visible to the operating system or to native add-ons. On Windows, a copy of`process.env` on a `Worker` instance operates in a case-sensitive manner
* unlike the main thread.
* are visible to the operating system or to native add-ons.
* @since v0.1.27
*/
env: ProcessEnv;
@ -587,7 +559,7 @@ declare module "process" {
* To exit with a 'failure' code:
*
* ```js
* import { exit } from 'node:process';
* import { exit } from 'process';
*
* exit(1);
* ```
@ -606,7 +578,7 @@ declare module "process" {
* truncated and lost:
*
* ```js
* import { exit } from 'node:process';
* import { exit } from 'process';
*
* // This is an example of what *not* to do:
* if (someConditionNotMet()) {
@ -617,13 +589,13 @@ declare module "process" {
*
* The reason this is problematic is because writes to `process.stdout` in Node.js
* are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js
* event loop. Calling `process.exit()`, however, forces the process to exit _before_ those additional writes to `stdout` can be performed.
* event loop. Calling `process.exit()`, however, forces the process to exit_before_ those additional writes to `stdout` can be performed.
*
* Rather than calling `process.exit()` directly, the code _should_ set the`process.exitCode` and allow the process to exit naturally by avoiding
* scheduling any additional work for the event loop:
*
* ```js
* import process from 'node:process';
* import process from 'process';
*
* // How to properly set the exit code while letting
* // the process exit gracefully.
@ -640,7 +612,7 @@ declare module "process" {
* In `Worker` threads, this function stops the current thread rather
* than the current process.
* @since v0.1.13
* @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed.
* @param [code=0] The exit code.
*/
exit(code?: number): never;
/**
@ -669,7 +641,7 @@ declare module "process" {
* Android).
* @since v0.1.31
*/
getgid?: () => number;
getgid(): number;
/**
* The `process.setgid()` method sets the group identity of the process. (See [`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a
* numeric ID or a group name
@ -696,7 +668,7 @@ declare module "process" {
* @since v0.1.31
* @param id The group name or ID
*/
setgid?: (id: number | string) => void;
setgid(id: number | string): void;
/**
* The `process.getuid()` method returns the numeric user identity of the process.
* (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)
@ -713,7 +685,7 @@ declare module "process" {
* Android).
* @since v0.1.28
*/
getuid?: () => number;
getuid(): number;
/**
* The `process.setuid(id)` method sets the user identity of the process. (See [`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a
* numeric ID or a username string.
@ -739,7 +711,7 @@ declare module "process" {
* This feature is not available in `Worker` threads.
* @since v0.1.28
*/
setuid?: (id: number | string) => void;
setuid(id: number | string): void;
/**
* The `process.geteuid()` method returns the numerical effective user identity of
* the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)
@ -756,7 +728,7 @@ declare module "process" {
* Android).
* @since v2.0.0
*/
geteuid?: () => number;
geteuid(): number;
/**
* The `process.seteuid()` method sets the effective user identity of the process.
* (See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username
@ -783,7 +755,7 @@ declare module "process" {
* @since v2.0.0
* @param id A user name or ID
*/
seteuid?: (id: number | string) => void;
seteuid(id: number | string): void;
/**
* The `process.getegid()` method returns the numerical effective group identity
* of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)
@ -800,7 +772,7 @@ declare module "process" {
* Android).
* @since v2.0.0
*/
getegid?: () => number;
getegid(): number;
/**
* The `process.setegid()` method sets the effective group identity of the process.
* (See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group
@ -827,7 +799,7 @@ declare module "process" {
* @since v2.0.0
* @param id A group name or ID
*/
setegid?: (id: number | string) => void;
setegid(id: number | string): void;
/**
* The `process.getgroups()` method returns an array with the supplementary group
* IDs. POSIX leaves it unspecified if the effective group ID is included but
@ -845,7 +817,7 @@ declare module "process" {
* Android).
* @since v0.9.4
*/
getgroups?: () => number[];
getgroups(): number[];
/**
* The `process.setgroups()` method sets the supplementary group IDs for the
* Node.js process. This is a privileged operation that requires the Node.js
@ -871,7 +843,7 @@ declare module "process" {
* This feature is not available in `Worker` threads.
* @since v0.9.4
*/
setgroups?: (groups: ReadonlyArray<string | number>) => void;
setgroups(groups: ReadonlyArray<string | number>): void;
/**
* The `process.setUncaughtExceptionCaptureCallback()` function sets a function
* that will be invoked when an uncaught exception occurs, which will receive the
@ -896,29 +868,11 @@ declare module "process" {
* @since v9.3.0
*/
hasUncaughtExceptionCaptureCallback(): boolean;
/**
* The `process.sourceMapsEnabled` property returns whether the [Source Map v3](https://sourcemaps.info/spec.html) support for stack traces is enabled.
* @since v20.7.0
* @experimental
*/
readonly sourceMapsEnabled: boolean;
/**
* This function enables or disables the [Source Map v3](https://sourcemaps.info/spec.html) support for
* stack traces.
*
* It provides same features as launching Node.js process with commandline options`--enable-source-maps`.
*
* Only source maps in JavaScript files that are loaded after source maps has been
* enabled will be parsed and loaded.
* @since v16.6.0, v14.18.0
* @experimental
*/
setSourceMapsEnabled(value: boolean): void;
/**
* The `process.version` property contains the Node.js version string.
*
* ```js
* import { version } from 'node:process';
* import { version } from 'process';
*
* console.log(`Version: ${version}`);
* // Version: v14.8.0
@ -935,7 +889,7 @@ declare module "process" {
* to load modules that were compiled against a different module ABI version.
*
* ```js
* import { versions } from 'node:process';
* import { versions } from 'process';
*
* console.log(versions);
* ```
@ -943,39 +897,30 @@ declare module "process" {
* Will generate an object similar to:
*
* ```console
* { node: '20.2.0',
* acorn: '8.8.2',
* ada: '2.4.0',
* ares: '1.19.0',
* base64: '0.5.0',
* brotli: '1.0.9',
* cjs_module_lexer: '1.2.2',
* cldr: '43.0',
* icu: '73.1',
* llhttp: '8.1.0',
* modules: '115',
* napi: '8',
* nghttp2: '1.52.0',
* nghttp3: '0.7.0',
* ngtcp2: '0.8.1',
* openssl: '3.0.8+quic',
* simdutf: '3.2.9',
* tz: '2023c',
* undici: '5.22.0',
* unicode: '15.0',
* uv: '1.44.2',
* uvwasi: '0.0.16',
* v8: '11.3.244.8-node.9',
* zlib: '1.2.13' }
* { node: '11.13.0',
* v8: '7.0.276.38-node.18',
* uv: '1.27.0',
* zlib: '1.2.11',
* brotli: '1.0.7',
* ares: '1.15.0',
* modules: '67',
* nghttp2: '1.34.0',
* napi: '4',
* llhttp: '1.1.1',
* openssl: '1.1.1b',
* cldr: '34.0',
* icu: '63.1',
* tz: '2018e',
* unicode: '11.0' }
* ```
* @since v0.2.0
*/
readonly versions: ProcessVersions;
/**
* The `process.config` property returns a frozen `Object` containing the
* JavaScript representation of the configure options used to compile the current
* Node.js executable. This is the same as the `config.gypi` file that was produced
* when running the `./configure` script.
* The `process.config` property returns an `Object` containing the JavaScript
* representation of the configure options used to compile the current Node.js
* executable. This is the same as the `config.gypi` file that was produced when
* running the `./configure` script.
*
* An example of the possible output looks like:
*
@ -997,6 +942,7 @@ declare module "process" {
* node_shared_http_parser: 'false',
* node_shared_libuv: 'false',
* node_shared_zlib: 'false',
* node_use_dtrace: 'false',
* node_use_openssl: 'true',
* node_shared_openssl: 'false',
* strict_aliasing: 'true',
@ -1005,6 +951,13 @@ declare module "process" {
* }
* }
* ```
*
* The `process.config` property is **not** read-only and there are existing
* modules in the ecosystem that are known to extend, modify, or entirely replace
* the value of `process.config`.
*
* Modifying the `process.config` property, or any child-property of the`process.config` object has been deprecated. The `process.config` will be made
* read-only in a future release.
* @since v0.7.7
*/
readonly config: ProcessConfig;
@ -1023,7 +976,7 @@ declare module "process" {
* other than kill the target process.
*
* ```js
* import process, { kill } from 'node:process';
* import process, { kill } from 'process';
*
* process.on('SIGHUP', () => {
* console.log('Got SIGHUP signal.');
@ -1048,7 +1001,7 @@ declare module "process" {
* The `process.pid` property returns the PID of the process.
*
* ```js
* import { pid } from 'node:process';
* import { pid } from 'process';
*
* console.log(`This process is pid ${pid}`);
* ```
@ -1060,7 +1013,7 @@ declare module "process" {
* current process.
*
* ```js
* import { ppid } from 'node:process';
* import { ppid } from 'process';
*
* console.log(`The parent process is pid ${ppid}`);
* ```
@ -1087,19 +1040,19 @@ declare module "process" {
title: string;
/**
* The operating system CPU architecture for which the Node.js binary was compiled.
* Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, and `'x64'`.
* Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`,`'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`.
*
* ```js
* import { arch } from 'node:process';
* import { arch } from 'process';
*
* console.log(`This processor architecture is ${arch}`);
* ```
* @since v0.5.0
*/
readonly arch: Architecture;
readonly arch: string;
/**
* The `process.platform` property returns a string identifying the operating
* system platform for which the Node.js binary was compiled.
* system platform on which the Node.js process is running.
*
* Currently possible values are:
*
@ -1112,7 +1065,7 @@ declare module "process" {
* * `'win32'`
*
* ```js
* import { platform } from 'node:process';
* import { platform } from 'process';
*
* console.log(`This platform is ${platform}`);
* ```
@ -1135,17 +1088,6 @@ declare module "process" {
*/
mainModule?: Module | undefined;
memoryUsage: MemoryUsageFn;
/**
* Gets the amount of memory available to the process (in bytes) based on
* limits imposed by the OS. If there is no such constraint, or the constraint
* is unknown, `undefined` is returned.
*
* See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more
* information.
* @since v19.6.0, v18.15.0
* @experimental
*/
constrainedMemory(): number | undefined;
/**
* The `process.cpuUsage()` method returns the user and system CPU time usage of
* the current process, in an object with properties `user` and `system`, whose
@ -1157,7 +1099,7 @@ declare module "process" {
* argument to the function, to get a diff reading.
*
* ```js
* import { cpuUsage } from 'node:process';
* import { cpuUsage } from 'process';
*
* const startUsage = cpuUsage();
* // { user: 38579, system: 6986 }
@ -1181,7 +1123,7 @@ declare module "process" {
* See the [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick) guide for more background.
*
* ```js
* import { nextTick } from 'node:process';
* import { nextTick } from 'process';
*
* console.log('start');
* nextTick(() => {
@ -1199,7 +1141,7 @@ declare module "process" {
* I/O has occurred:
*
* ```js
* import { nextTick } from 'node:process';
* import { nextTick } from 'process';
*
* function MyThing(options) {
* this.setupOptions(options);
@ -1247,7 +1189,7 @@ declare module "process" {
* The following approach is much better:
*
* ```js
* import { nextTick } from 'node:process';
* import { nextTick } from 'process';
*
* function definitelyAsync(arg, cb) {
* if (arg) {
@ -1272,10 +1214,10 @@ declare module "process" {
* ```js
* {
* name: 'node',
* lts: 'Hydrogen',
* sourceUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz',
* headersUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz',
* libUrl: 'https://nodejs.org/download/release/v18.12.0/win-x64/node.lib'
* lts: 'Erbium',
* sourceUrl: 'https://nodejs.org/download/release/v12.18.1/node-v12.18.1.tar.gz',
* headersUrl: 'https://nodejs.org/download/release/v12.18.1/node-v12.18.1-headers.tar.gz',
* libUrl: 'https://nodejs.org/download/release/v12.18.1/win-x64/node.lib'
* }
* ```
*
@ -1316,28 +1258,11 @@ declare module "process" {
*/
uptime(): number;
hrtime: HRTime;
/**
* If the Node.js process was spawned with an IPC channel, the process.channel property is a reference to the IPC channel.
* If no IPC channel exists, this property is undefined.
* @since v7.1.0
*/
channel?: {
/**
* This method makes the IPC channel keep the event loop of the process running if .unref() has been called before.
* @since v7.1.0
*/
ref(): void;
/**
* This method makes the IPC channel not keep the event loop of the process running, and lets it finish even while the channel is open.
* @since v7.1.0
*/
unref(): void;
};
/**
* If Node.js is spawned with an IPC channel, the `process.send()` method can be
* used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object.
*
* If Node.js was not spawned with an IPC channel, `process.send` will be `undefined`.
* If Node.js was not spawned with an IPC channel, `process.send` will be`undefined`.
*
* The message goes through serialization and parsing. The resulting message might
* not be the same as what is originally sent.
@ -1350,7 +1275,7 @@ declare module "process" {
options?: {
swallowErrors?: boolean | undefined;
},
callback?: (error: Error | null) => void,
callback?: (error: Error | null) => void
): boolean;
/**
* If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.disconnect()` method will close the
@ -1396,7 +1321,7 @@ declare module "process" {
* dashes:
*
* ```js
* import { allowedNodeEnvironmentFlags } from 'node:process';
* import { allowedNodeEnvironmentFlags } from 'process';
*
* allowedNodeEnvironmentFlags.forEach((flag) => {
* // -r
@ -1422,7 +1347,7 @@ declare module "process" {
report?: ProcessReport | undefined;
/**
* ```js
* import { resourceUsage } from 'node:process';
* import { resourceUsage } from 'process';
*
* console.log(resourceUsage());
* /*
@ -1459,103 +1384,98 @@ declare module "process" {
*/
traceDeprecation: boolean;
/* EventEmitter */
addListener(event: "beforeExit", listener: BeforeExitListener): this;
addListener(event: "disconnect", listener: DisconnectListener): this;
addListener(event: "exit", listener: ExitListener): this;
addListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
addListener(event: "warning", listener: WarningListener): this;
addListener(event: "message", listener: MessageListener): this;
addListener(event: 'beforeExit', listener: BeforeExitListener): this;
addListener(event: 'disconnect', listener: DisconnectListener): this;
addListener(event: 'exit', listener: ExitListener): this;
addListener(event: 'rejectionHandled', listener: RejectionHandledListener): this;
addListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
addListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
addListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
addListener(event: 'warning', listener: WarningListener): this;
addListener(event: 'message', listener: MessageListener): this;
addListener(event: Signals, listener: SignalsListener): this;
addListener(event: "multipleResolves", listener: MultipleResolveListener): this;
addListener(event: "worker", listener: WorkerListener): this;
emit(event: "beforeExit", code: number): boolean;
emit(event: "disconnect"): boolean;
emit(event: "exit", code: number): boolean;
emit(event: "rejectionHandled", promise: Promise<unknown>): boolean;
emit(event: "uncaughtException", error: Error): boolean;
emit(event: "uncaughtExceptionMonitor", error: Error): boolean;
emit(event: "unhandledRejection", reason: unknown, promise: Promise<unknown>): boolean;
emit(event: "warning", warning: Error): boolean;
emit(event: "message", message: unknown, sendHandle: unknown): this;
emit(event: Signals, signal?: Signals): boolean;
emit(
event: "multipleResolves",
type: MultipleResolveType,
promise: Promise<unknown>,
value: unknown,
): this;
emit(event: "worker", listener: WorkerListener): this;
on(event: "beforeExit", listener: BeforeExitListener): this;
on(event: "disconnect", listener: DisconnectListener): this;
on(event: "exit", listener: ExitListener): this;
on(event: "rejectionHandled", listener: RejectionHandledListener): this;
on(event: "uncaughtException", listener: UncaughtExceptionListener): this;
on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
on(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
on(event: "warning", listener: WarningListener): this;
on(event: "message", listener: MessageListener): this;
addListener(event: 'multipleResolves', listener: MultipleResolveListener): this;
addListener(event: 'worker', listener: WorkerListener): this;
emit(event: 'beforeExit', code: number): boolean;
emit(event: 'disconnect'): boolean;
emit(event: 'exit', code: number): boolean;
emit(event: 'rejectionHandled', promise: Promise<unknown>): boolean;
emit(event: 'uncaughtException', error: Error): boolean;
emit(event: 'uncaughtExceptionMonitor', error: Error): boolean;
emit(event: 'unhandledRejection', reason: unknown, promise: Promise<unknown>): boolean;
emit(event: 'warning', warning: Error): boolean;
emit(event: 'message', message: unknown, sendHandle: unknown): this;
emit(event: Signals, signal: Signals): boolean;
emit(event: 'multipleResolves', type: MultipleResolveType, promise: Promise<unknown>, value: unknown): this;
emit(event: 'worker', listener: WorkerListener): this;
on(event: 'beforeExit', listener: BeforeExitListener): this;
on(event: 'disconnect', listener: DisconnectListener): this;
on(event: 'exit', listener: ExitListener): this;
on(event: 'rejectionHandled', listener: RejectionHandledListener): this;
on(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
on(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
on(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
on(event: 'warning', listener: WarningListener): this;
on(event: 'message', listener: MessageListener): this;
on(event: Signals, listener: SignalsListener): this;
on(event: "multipleResolves", listener: MultipleResolveListener): this;
on(event: "worker", listener: WorkerListener): this;
on(event: 'multipleResolves', listener: MultipleResolveListener): this;
on(event: 'worker', listener: WorkerListener): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "beforeExit", listener: BeforeExitListener): this;
once(event: "disconnect", listener: DisconnectListener): this;
once(event: "exit", listener: ExitListener): this;
once(event: "rejectionHandled", listener: RejectionHandledListener): this;
once(event: "uncaughtException", listener: UncaughtExceptionListener): this;
once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
once(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
once(event: "warning", listener: WarningListener): this;
once(event: "message", listener: MessageListener): this;
once(event: 'beforeExit', listener: BeforeExitListener): this;
once(event: 'disconnect', listener: DisconnectListener): this;
once(event: 'exit', listener: ExitListener): this;
once(event: 'rejectionHandled', listener: RejectionHandledListener): this;
once(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
once(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
once(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
once(event: 'warning', listener: WarningListener): this;
once(event: 'message', listener: MessageListener): this;
once(event: Signals, listener: SignalsListener): this;
once(event: "multipleResolves", listener: MultipleResolveListener): this;
once(event: "worker", listener: WorkerListener): this;
once(event: 'multipleResolves', listener: MultipleResolveListener): this;
once(event: 'worker', listener: WorkerListener): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "beforeExit", listener: BeforeExitListener): this;
prependListener(event: "disconnect", listener: DisconnectListener): this;
prependListener(event: "exit", listener: ExitListener): this;
prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
prependListener(event: "warning", listener: WarningListener): this;
prependListener(event: "message", listener: MessageListener): this;
prependListener(event: 'beforeExit', listener: BeforeExitListener): this;
prependListener(event: 'disconnect', listener: DisconnectListener): this;
prependListener(event: 'exit', listener: ExitListener): this;
prependListener(event: 'rejectionHandled', listener: RejectionHandledListener): this;
prependListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
prependListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
prependListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
prependListener(event: 'warning', listener: WarningListener): this;
prependListener(event: 'message', listener: MessageListener): this;
prependListener(event: Signals, listener: SignalsListener): this;
prependListener(event: "multipleResolves", listener: MultipleResolveListener): this;
prependListener(event: "worker", listener: WorkerListener): this;
prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this;
prependOnceListener(event: "disconnect", listener: DisconnectListener): this;
prependOnceListener(event: "exit", listener: ExitListener): this;
prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
prependOnceListener(event: "warning", listener: WarningListener): this;
prependOnceListener(event: "message", listener: MessageListener): this;
prependListener(event: 'multipleResolves', listener: MultipleResolveListener): this;
prependListener(event: 'worker', listener: WorkerListener): this;
prependOnceListener(event: 'beforeExit', listener: BeforeExitListener): this;
prependOnceListener(event: 'disconnect', listener: DisconnectListener): this;
prependOnceListener(event: 'exit', listener: ExitListener): this;
prependOnceListener(event: 'rejectionHandled', listener: RejectionHandledListener): this;
prependOnceListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
prependOnceListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
prependOnceListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
prependOnceListener(event: 'warning', listener: WarningListener): this;
prependOnceListener(event: 'message', listener: MessageListener): this;
prependOnceListener(event: Signals, listener: SignalsListener): this;
prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this;
prependOnceListener(event: "worker", listener: WorkerListener): this;
listeners(event: "beforeExit"): BeforeExitListener[];
listeners(event: "disconnect"): DisconnectListener[];
listeners(event: "exit"): ExitListener[];
listeners(event: "rejectionHandled"): RejectionHandledListener[];
listeners(event: "uncaughtException"): UncaughtExceptionListener[];
listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[];
listeners(event: "unhandledRejection"): UnhandledRejectionListener[];
listeners(event: "warning"): WarningListener[];
listeners(event: "message"): MessageListener[];
prependOnceListener(event: 'multipleResolves', listener: MultipleResolveListener): this;
prependOnceListener(event: 'worker', listener: WorkerListener): this;
listeners(event: 'beforeExit'): BeforeExitListener[];
listeners(event: 'disconnect'): DisconnectListener[];
listeners(event: 'exit'): ExitListener[];
listeners(event: 'rejectionHandled'): RejectionHandledListener[];
listeners(event: 'uncaughtException'): UncaughtExceptionListener[];
listeners(event: 'uncaughtExceptionMonitor'): UncaughtExceptionListener[];
listeners(event: 'unhandledRejection'): UnhandledRejectionListener[];
listeners(event: 'warning'): WarningListener[];
listeners(event: 'message'): MessageListener[];
listeners(event: Signals): SignalsListener[];
listeners(event: "multipleResolves"): MultipleResolveListener[];
listeners(event: "worker"): WorkerListener[];
listeners(event: 'multipleResolves'): MultipleResolveListener[];
listeners(event: 'worker'): WorkerListener[];
}
}
}
export = process;
}
declare module "node:process" {
import process = require("process");
declare module 'node:process' {
import process = require('process');
export = process;
}

10
node_modules/@types/node/punycode.d.ts generated vendored Normal file → Executable file
View File

@ -24,9 +24,9 @@
* made available to developers as a convenience. Fixes or other modifications to
* the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
* @deprecated Since v7.0.0 - Deprecated
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/punycode.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/punycode.js)
*/
declare module "punycode" {
declare module 'punycode' {
/**
* The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only
* characters to the equivalent string of Unicode codepoints.
@ -101,7 +101,7 @@ declare module "punycode" {
* Users currently depending on the punycode module should switch to using
* the userland-provided Punycode.js module instead.
*/
encode(codePoints: readonly number[]): string;
encode(codePoints: ReadonlyArray<number>): string;
}
/**
* @deprecated since v7.0.0
@ -112,6 +112,6 @@ declare module "punycode" {
*/
const version: string;
}
declare module "node:punycode" {
export * from "punycode";
declare module 'node:punycode' {
export * from 'punycode';
}

36
node_modules/@types/node/querystring.d.ts generated vendored Normal file → Executable file
View File

@ -1,17 +1,17 @@
/**
* The `node:querystring` module provides utilities for parsing and formatting URL
* The `querystring` module provides utilities for parsing and formatting URL
* query strings. It can be accessed using:
*
* ```js
* const querystring = require('node:querystring');
* const querystring = require('querystring');
* ```
*
* `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)
* 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)
*/
declare module "querystring" {
declare module 'querystring' {
interface StringifyOptions {
encodeURIComponent?: ((str: string) => string) | undefined;
}
@ -20,17 +20,7 @@ declare module "querystring" {
decodeURIComponent?: ((str: string) => string) | undefined;
}
interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> {}
interface ParsedUrlQueryInput extends
NodeJS.Dict<
| string
| number
| boolean
| readonly string[]
| readonly number[]
| readonly boolean[]
| null
>
{}
interface ParsedUrlQueryInput extends NodeJS.Dict<string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<boolean> | null> {}
/**
* The `querystring.stringify()` method produces a URL query string from a
* given `obj` by iterating through the object's "own properties".
@ -74,10 +64,10 @@ declare module "querystring" {
*
* For example, the query string `'foo=bar&#x26;abc=xyz&#x26;abc=123'` is parsed into:
*
* ```json
* ```js
* {
* "foo": "bar",
* "abc": ["xyz", "123"]
* foo: 'bar',
* abc: ['xyz', '123']
* }
* ```
*
@ -136,6 +126,6 @@ declare module "querystring" {
*/
function unescape(str: string): string;
}
declare module "node:querystring" {
export * from "querystring";
declare module 'node:querystring' {
export * from 'querystring';
}

326
node_modules/@types/node/readline.d.ts generated vendored Normal file → Executable file
View File

@ -1,42 +1,36 @@
/**
* 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:
* 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:
*
* ```js
* import * as readline from 'node:readline/promises';
* const readline = require('readline');
* ```
*
* To use the callback and sync APIs:
* The following simple example illustrates the basic use of the `readline` module.
*
* ```js
* import * as readline from 'node:readline';
* ```
* const readline = require('readline');
*
* The following simple example illustrates the basic use of the `node:readline`module.
* const rl = readline.createInterface({
* input: process.stdin,
* output: process.stdout
* });
*
* ```js
* import * as readline from 'node:readline/promises';
* import { stdin as input, stdout as output } from 'node:process';
* 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}`);
*
* 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();
* rl.close();
* });
* ```
*
* Once this code is invoked, the Node.js application will not terminate until the`readline.Interface` is closed because the interface waits for data to be
* received on the `input` stream.
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/readline.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/readline.js)
*/
declare module "readline" {
import { Abortable, EventEmitter } from "node:events";
import * as promises from "node:readline/promises";
export { promises };
export interface Key {
declare module 'readline' {
import { Abortable, EventEmitter } from 'node:events';
interface Key {
sequence?: string | undefined;
name?: string | undefined;
ctrl?: boolean | undefined;
@ -50,7 +44,7 @@ declare module "readline" {
* and is read from, the `input` stream.
* @since v0.1.104
*/
export class Interface extends EventEmitter {
class Interface extends EventEmitter {
readonly terminal: boolean;
/**
* The current input data being processed by node.
@ -73,7 +67,7 @@ declare module "readline" {
* const showResults = debounce(() => {
* console.log(
* '\n',
* values.filter((val) => val.startsWith(rl.line)).join(' '),
* values.filter((val) => val.startsWith(rl.line)).join(' ')
* );
* }, 300);
* process.stdin.on('keypress', (c, k) => {
@ -99,26 +93,21 @@ declare module "readline" {
* > Instances of the `readline.Interface` class are constructed using the
* > `readline.createInterface()` method.
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor
* @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
*/
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);
/**
* NOTE: According to the documentation:
*
* > Instances of the `readline.Interface` class are constructed using the
* > `readline.createInterface()` method.
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor
* @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
*/
protected constructor(options: ReadLineOptions);
/**
* The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`.
* @since v15.3.0, v14.17.0
* @since v15.3.0
* @return the current prompt string
*/
getPrompt(): string;
@ -128,13 +117,13 @@ declare module "readline" {
*/
setPrompt(prompt: string): void;
/**
* 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
* 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
* location at which to provide input.
*
* When called, `rl.prompt()` will resume the `input` stream if it has been
* paused.
*
* If the `Interface` was created with `output` set to `null` or`undefined` the prompt is not written.
* If the `readline.Interface` was created with `output` set to `null` or`undefined` the prompt is not written.
* @since v0.1.98
* @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`.
*/
@ -146,14 +135,12 @@ declare module "readline" {
* When called, `rl.question()` will resume the `input` stream if it has been
* paused.
*
* If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
* If the `readline.Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
*
* The `callback` function passed to `rl.question()` does not follow the typical
* pattern of accepting an `Error` object or `null` as the first argument.
* The `callback` is called with the provided answer as the only argument.
*
* An error will be thrown if calling `rl.question()` after `rl.close()`.
*
* Example usage:
*
* ```js
@ -178,6 +165,25 @@ declare module "readline" {
*
* setTimeout(() => ac.abort(), 10000);
* ```
*
* 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
* @param query A statement or query to write to `output`, prepended to the prompt.
* @param callback A callback function that is invoked with the user's input in response to the `query`.
@ -188,7 +194,7 @@ declare module "readline" {
* The `rl.pause()` method pauses the `input` stream, allowing it to be resumed
* later if necessary.
*
* Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `Interface` instance.
* Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `readline.Interface` instance.
* @since v0.3.4
*/
pause(): this;
@ -198,12 +204,12 @@ declare module "readline" {
*/
resume(): this;
/**
* The `rl.close()` method closes the `Interface` instance and
* The `rl.close()` method closes the `readline.Interface` instance and
* relinquishes control over the `input` and `output` streams. When called,
* the `'close'` event will be emitted.
*
* Calling `rl.close()` does not immediately stop other events (including `'line'`)
* from being emitted by the `Interface` instance.
* from being emitted by the `readline.Interface` instance.
* @since v0.1.98
*/
close(): void;
@ -218,7 +224,7 @@ declare module "readline" {
* When called, `rl.write()` will resume the `input` stream if it has been
* paused.
*
* If the `Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written.
* If the `readline.Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written.
*
* ```js
* rl.write('Delete this!');
@ -250,69 +256,66 @@ declare module "readline" {
* 8. history
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "line", listener: (input: string) => void): this;
addListener(event: "pause", listener: () => void): this;
addListener(event: "resume", listener: () => void): this;
addListener(event: "SIGCONT", listener: () => void): this;
addListener(event: "SIGINT", listener: () => void): this;
addListener(event: "SIGTSTP", listener: () => void): this;
addListener(event: "history", listener: (history: string[]) => void): this;
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>;
}
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 {
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 {
input: NodeJS.ReadableStream;
output?: NodeJS.WritableStream | undefined;
completer?: Completer | AsyncCompleter | undefined;
@ -341,10 +344,10 @@ declare module "readline" {
* The `readline.createInterface()` method creates a new `readline.Interface`instance.
*
* ```js
* const readline = require('node:readline');
* const readline = require('readline');
* const rl = readline.createInterface({
* input: process.stdin,
* output: process.stdout,
* output: process.stdout
* });
* ```
*
@ -363,17 +366,18 @@ declare module "readline" {
* (`process.stdout` does this automatically when it is a TTY).
*
* When creating a `readline.Interface` using `stdin` as input, the program
* 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()`.
* 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();
* ```
* @since v0.1.98
*/
export function createInterface(
input: NodeJS.ReadableStream,
output?: NodeJS.WritableStream,
completer?: Completer | AsyncCompleter,
terminal?: boolean,
): Interface;
export function createInterface(options: ReadLineOptions): Interface;
function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
function createInterface(options: ReadLineOptions): Interface;
/**
* The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input.
*
@ -390,6 +394,41 @@ declare module "readline" {
* if (process.stdin.isTTY)
* process.stdin.setRawMode(true);
* ```
* @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`.
*
* ## Example: Tiny CLI
*
@ -397,11 +436,11 @@ declare module "readline" {
* implement a small command-line interface:
*
* ```js
* const readline = require('node:readline');
* const readline = require('readline');
* const rl = readline.createInterface({
* input: process.stdin,
* output: process.stdout,
* prompt: 'OHAI> ',
* prompt: 'OHAI> '
* });
*
* rl.prompt();
@ -429,15 +468,15 @@ declare module "readline" {
* well as a `for await...of` loop:
*
* ```js
* const fs = require('node:fs');
* const readline = require('node:readline');
* const fs = require('fs');
* const readline = require('readline');
*
* async function processLineByLine() {
* const fileStream = fs.createReadStream('input.txt');
*
* const rl = readline.createInterface({
* input: fileStream,
* crlfDelay: Infinity,
* crlfDelay: Infinity
* });
* // Note: we use the crlfDelay option to recognize all instances of CR LF
* // ('\r\n') in input.txt as a single line break.
@ -454,12 +493,12 @@ declare module "readline" {
* Alternatively, one could use the `'line'` event:
*
* ```js
* const fs = require('node:fs');
* const readline = require('node:readline');
* const fs = require('fs');
* const readline = require('readline');
*
* const rl = readline.createInterface({
* input: fs.createReadStream('sample.txt'),
* crlfDelay: Infinity,
* crlfDelay: Infinity
* });
*
* rl.on('line', (line) => {
@ -470,15 +509,15 @@ declare module "readline" {
* Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied:
*
* ```js
* const { once } = require('node:events');
* const { createReadStream } = require('node:fs');
* const { createInterface } = require('node:readline');
* const { once } = require('events');
* const { createReadStream } = require('fs');
* const { createInterface } = require('readline');
*
* (async function processLineByLine() {
* try {
* const rl = createInterface({
* input: createReadStream('big-file.txt'),
* crlfDelay: Infinity,
* crlfDelay: Infinity
* });
*
* rl.on('line', (line) => {
@ -494,46 +533,11 @@ declare module "readline" {
* })();
* ```
* @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`.
*/
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;
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';
}

View File

@ -1,150 +0,0 @@
/**
* @since v17.0.0
* @experimental
*/
declare module "readline/promises" {
import { AsyncCompleter, Completer, Direction, Interface as _Interface, ReadLineOptions } from "node:readline";
import { Abortable } from "node:events";
/**
* Instances of the `readlinePromises.Interface` class are constructed using the`readlinePromises.createInterface()` method. Every instance is associated with a
* single `input` `Readable` stream and a single `output` `Writable` stream.
* The `output` stream is used to print prompts for user input that arrives on,
* and is read from, the `input` stream.
* @since v17.0.0
*/
class Interface extends _Interface {
/**
* The `rl.question()` method displays the `query` by writing it to the `output`,
* waits for user input to be provided on `input`, then invokes the `callback`function passing the provided input as the first argument.
*
* When called, `rl.question()` will resume the `input` stream if it has been
* paused.
*
* If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
*
* If the question is called after `rl.close()`, it returns a rejected promise.
*
* Example usage:
*
* ```js
* const answer = await rl.question('What is your favorite food? ');
* console.log(`Oh, so your favorite food is ${answer}`);
* ```
*
* Using an `AbortSignal` to cancel a question.
*
* ```js
* const signal = AbortSignal.timeout(10_000);
*
* signal.addEventListener('abort', () => {
* console.log('The food question timed out');
* }, { once: true });
*
* const answer = await rl.question('What is your favorite food? ', { signal });
* console.log(`Oh, so your favorite food is ${answer}`);
* ```
* @since v17.0.0
* @param query A statement or query to write to `output`, prepended to the prompt.
* @return A promise that is fulfilled with the user's input in response to the `query`.
*/
question(query: string): Promise<string>;
question(query: string, options: Abortable): Promise<string>;
}
/**
* @since v17.0.0
*/
class Readline {
/**
* @param stream A TTY stream.
*/
constructor(
stream: NodeJS.WritableStream,
options?: {
autoCommit?: boolean;
},
);
/**
* The `rl.clearLine()` method adds to the internal list of pending action an
* action that clears current line of the associated `stream` in a specified
* direction identified by `dir`.
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor.
* @since v17.0.0
* @return this
*/
clearLine(dir: Direction): this;
/**
* The `rl.clearScreenDown()` method adds to the internal list of pending action an
* action that clears the associated stream from the current position of the
* cursor down.
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor.
* @since v17.0.0
* @return this
*/
clearScreenDown(): this;
/**
* The `rl.commit()` method sends all the pending actions to the associated`stream` and clears the internal list of pending actions.
* @since v17.0.0
*/
commit(): Promise<void>;
/**
* The `rl.cursorTo()` method adds to the internal list of pending action an action
* that moves cursor to the specified position in the associated `stream`.
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor.
* @since v17.0.0
* @return this
*/
cursorTo(x: number, y?: number): this;
/**
* The `rl.moveCursor()` method adds to the internal list of pending action an
* action that moves the cursor _relative_ to its current position in the
* associated `stream`.
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor.
* @since v17.0.0
* @return this
*/
moveCursor(dx: number, dy: number): this;
/**
* The `rl.rollback` methods clears the internal list of pending actions without
* sending it to the associated `stream`.
* @since v17.0.0
* @return this
*/
rollback(): this;
}
/**
* The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface`instance.
*
* ```js
* const readlinePromises = require('node:readline/promises');
* const rl = readlinePromises.createInterface({
* input: process.stdin,
* output: process.stdout,
* });
* ```
*
* Once the `readlinePromises.Interface` instance is created, the most common case
* is to listen for the `'line'` event:
*
* ```js
* rl.on('line', (line) => {
* console.log(`Received: ${line}`);
* });
* ```
*
* If `terminal` is `true` for this instance then the `output` stream will get
* the best compatibility if it defines an `output.columns` property and emits
* a `'resize'` event on the `output` if or when the columns ever change
* (`process.stdout` does this automatically when it is a TTY).
* @since v17.0.0
*/
function createInterface(
input: NodeJS.ReadableStream,
output?: NodeJS.WritableStream,
completer?: Completer | AsyncCompleter,
terminal?: boolean,
): Interface;
function createInterface(options: ReadLineOptions): Interface;
}
declare module "node:readline/promises" {
export * from "readline/promises";
}

170
node_modules/@types/node/repl.d.ts generated vendored Normal file → Executable file
View File

@ -1,17 +1,17 @@
/**
* 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:
* 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:
*
* ```js
* const repl = require('node:repl');
* const repl = require('repl');
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/repl.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/repl.js)
*/
declare module "repl" {
import { AsyncCompleter, Completer, Interface } from "node:readline";
import { Context } from "node:vm";
import { InspectOptions } from "node:util";
declare module 'repl' {
import { Interface, Completer, AsyncCompleter } from 'node:readline';
import { Context } from 'node:vm';
import { InspectOptions } from 'node:util';
interface ReplOptions {
/**
* The input prompt to display.
@ -41,8 +41,8 @@ declare module "repl" {
* error with `repl.Recoverable` to indicate the input was incomplete and prompt for
* additional lines.
*
* @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
* @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
*/
eval?: REPLEval | undefined;
/**
@ -74,13 +74,13 @@ declare module "repl" {
* The function to invoke to format the output of each command before writing to `output`.
* Default: a wrapper for `util.inspect`.
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_customizing_repl_output
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_customizing_repl_output
*/
writer?: REPLWriter | undefined;
/**
* An optional function used for custom Tab auto completion.
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#readline_use_of_the_completer_function
* @see https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function
*/
completer?: Completer | AsyncCompleter | undefined;
/**
@ -99,13 +99,7 @@ declare module "repl" {
*/
breakEvalOnSigint?: boolean | 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;
/**
* This is the default "writer" value, if none is passed in the REPL options,
@ -130,7 +124,7 @@ declare module "repl" {
* or directly using the JavaScript `new` keyword.
*
* ```js
* const repl = require('node:repl');
* const repl = require('repl');
*
* const options = { useColors: true };
*
@ -168,33 +162,33 @@ declare module "repl" {
/**
* A value indicating whether the REPL is currently in "editor mode".
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_commands_and_special_keys
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_commands_and_special_keys
*/
readonly editorMode: boolean;
/**
* A value indicating whether the `_` variable has been assigned.
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly underscoreAssigned: boolean;
/**
* The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL).
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly last: any;
/**
* A value indicating whether the `_error` variable has been assigned.
*
* @since v9.8.0
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly underscoreErrAssigned: boolean;
/**
* The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL).
*
* @since v9.8.0
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly lastError: any;
/**
@ -246,7 +240,7 @@ declare module "repl" {
*
* `REPLServer` cannot be subclassed due to implementation specifics in NodeJS.
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_class_replserver
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_class_replserver
*/
private constructor();
/**
@ -257,7 +251,7 @@ declare module "repl" {
* The following example shows two new commands added to the REPL instance:
*
* ```js
* const repl = require('node:repl');
* const repl = require('repl');
*
* const replServer = repl.start({ prompt: '> ' });
* replServer.defineCommand('sayhello', {
@ -266,7 +260,7 @@ declare module "repl" {
* this.clearBufferedCommand();
* console.log(`Hello, ${name}!`);
* this.displayPrompt();
* },
* }
* });
* replServer.defineCommand('saybye', function saybye() {
* console.log('Goodbye!');
@ -283,7 +277,7 @@ declare module "repl" {
* Goodbye!
* ```
* @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.
*/
defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void;
@ -332,65 +326,65 @@ declare module "repl" {
* 9. reset
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "line", listener: (input: string) => void): this;
addListener(event: "pause", listener: () => void): this;
addListener(event: "resume", listener: () => void): this;
addListener(event: "SIGCONT", listener: () => void): this;
addListener(event: "SIGINT", listener: () => void): this;
addListener(event: "SIGTSTP", listener: () => void): this;
addListener(event: "exit", listener: () => void): this;
addListener(event: "reset", listener: (context: Context) => void): this;
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;
}
/**
* A flag passed in the REPL options. Evaluates expressions in sloppy mode.
@ -407,7 +401,7 @@ declare module "repl" {
* If `options` is a string, then it specifies the input prompt:
*
* ```js
* const repl = require('node:repl');
* const repl = require('repl');
*
* // a Unix style prompt
* repl.start('$ ');
@ -418,13 +412,13 @@ declare module "repl" {
/**
* Indicates a recoverable error that a `REPLServer` can use to support multi-line input.
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_recoverable_errors
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_recoverable_errors
*/
class Recoverable extends SyntaxError {
err: Error;
constructor(err: Error);
}
}
declare module "node:repl" {
export * from "repl";
declare module 'node:repl' {
export * from 'repl';
}

2167
node_modules/@types/node/stream.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

18
node_modules/@types/node/stream/consumers.d.ts generated vendored Normal file → Executable file
View File

@ -1,12 +1,12 @@
declare module "stream/consumers" {
declare module 'stream/consumers' {
import { Readable } from 'node:stream';
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>;
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<NodeBlob>;
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';
}

71
node_modules/@types/node/stream/promises.d.ts generated vendored Normal file → Executable file
View File

@ -1,83 +1,42 @@
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>,
>(
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>>(
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,
transform1: T1,
transform2: T2,
destination: B,
options?: PipelineOptions,
options?: PipelineOptions
): PipelinePromise<B>;
function pipeline<
A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
T2 extends PipelineTransform<T1, any>,
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<
A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
T2 extends PipelineTransform<T1, any>,
T3 extends PipelineTransform<T2, 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,
stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>
): Promise<void>;
}
declare module "node:stream/promises" {
export * from "stream/promises";
declare module 'node:stream/promises' {
export * from 'stream/promises';
}

124
node_modules/@types/node/stream/web.d.ts generated vendored Normal file → Executable file
View File

@ -1,6 +1,7 @@
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> {
readable: ReadableStream<R>;
/**
@ -14,6 +15,7 @@ declare module "stream/web" {
*/
writable: WritableStream<W>;
}
interface StreamPipeOptions {
preventAbort?: boolean;
preventCancel?: boolean;
@ -61,14 +63,17 @@ declare module "stream/web" {
preventClose?: boolean;
signal?: AbortSignal;
}
interface ReadableStreamGenericReader {
readonly closed: Promise<undefined>;
cancel(reason?: any): Promise<void>;
}
interface ReadableStreamDefaultReadValueResult<T> {
done: false;
value: T;
}
interface ReadableStreamDefaultReadDoneResult {
done: true;
value?: undefined;
@ -77,61 +82,66 @@ declare module "stream/web" {
type ReadableStreamDefaultReadResult<T> =
| ReadableStreamDefaultReadValueResult<T>
| 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 {
autoAllocateChunkSize?: number;
cancel?: ReadableStreamErrorCallback;
pull?: ReadableByteStreamControllerCallback;
start?: ReadableByteStreamControllerCallback;
type: "bytes";
type: 'bytes';
}
interface UnderlyingSource<R = any> {
cancel?: UnderlyingSourceCancelCallback;
pull?: UnderlyingSourcePullCallback<R>;
start?: UnderlyingSourceStartCallback<R>;
type?: undefined;
}
interface UnderlyingSink<W = any> {
abort?: UnderlyingSinkAbortCallback;
close?: UnderlyingSinkCloseCallback;
@ -139,40 +149,45 @@ declare module "stream/web" {
type?: undefined;
write?: UnderlyingSinkWriteCallback<W>;
}
interface ReadableStreamErrorCallback {
(reason: any): void | PromiseLike<void>;
}
/** This Streams API interface represents a readable stream of byte data. */
interface ReadableStream<R = any> {
readonly locked: boolean;
cancel(reason?: any): Promise<void>;
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>];
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 {
read(): Promise<ReadableStreamDefaultReadResult<R>>;
releaseLock(): void;
}
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 {
readonly byobRequest: undefined;
readonly desiredSize: number | null;
@ -180,20 +195,24 @@ declare module "stream/web" {
enqueue(chunk: ArrayBufferView): void;
error(error?: any): void;
}
const ReadableByteStreamController: {
prototype: ReadableByteStreamController;
new(): ReadableByteStreamController;
new (): ReadableByteStreamController;
};
interface ReadableStreamDefaultController<R = any> {
readonly desiredSize: number | null;
close(): void;
enqueue(chunk?: R): void;
error(e?: any): void;
}
const ReadableStreamDefaultController: {
prototype: ReadableStreamDefaultController;
new(): ReadableStreamDefaultController;
new (): ReadableStreamDefaultController;
};
interface Transformer<I = any, O = any> {
flush?: TransformerFlushCallback<O>;
readableType?: undefined;
@ -201,28 +220,33 @@ declare module "stream/web" {
transform?: TransformerTransformCallback<I, O>;
writableType?: undefined;
}
interface TransformStream<I = any, O = any> {
readonly readable: ReadableStream<O>;
readonly writable: WritableStream<I>;
}
const TransformStream: {
prototype: TransformStream;
new<I = any, O = any>(
new <I = any, O = any>(
transformer?: Transformer<I, O>,
writableStrategy?: QueuingStrategy<I>,
readableStrategy?: QueuingStrategy<O>,
): TransformStream<I, O>;
};
interface TransformStreamDefaultController<O = any> {
readonly desiredSize: number | null;
enqueue(chunk?: O): void;
error(reason?: any): void;
terminate(): void;
}
const TransformStreamDefaultController: {
prototype: TransformStreamDefaultController;
new(): TransformStreamDefaultController;
new (): TransformStreamDefaultController;
};
/**
* This Streams API interface provides a standard abstraction for writing
* streaming data to a destination, known as a sink. This object comes with
@ -234,10 +258,12 @@ declare module "stream/web" {
close(): Promise<void>;
getWriter(): WritableStreamDefaultWriter<W>;
}
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>;
};
/**
* This Streams API interface is the object returned by
* WritableStream.getWriter() and once created locks the < writer to the
@ -253,10 +279,12 @@ declare module "stream/web" {
releaseLock(): void;
write(chunk?: W): Promise<void>;
}
const WritableStreamDefaultWriter: {
prototype: WritableStreamDefaultWriter;
new<W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
new <W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
};
/**
* This Streams API interface represents a controller allowing control of a
* WritableStream's state. When constructing a WritableStream, the
@ -266,17 +294,21 @@ declare module "stream/web" {
interface WritableStreamDefaultController {
error(e?: any): void;
}
const WritableStreamDefaultController: {
prototype: WritableStreamDefaultController;
new(): WritableStreamDefaultController;
new (): WritableStreamDefaultController;
};
interface QueuingStrategy<T = any> {
highWaterMark?: number;
size?: QueuingStrategySize<T>;
}
interface QueuingStrategySize<T = any> {
(chunk?: T): number;
}
interface QueuingStrategyInit {
/**
* Creates a new ByteLengthQueuingStrategy with the provided high water
@ -289,6 +321,7 @@ declare module "stream/web" {
*/
highWaterMark: number;
}
/**
* This Streams API interface provides a built-in byte length queuing
* strategy that can be used when constructing streams.
@ -297,10 +330,12 @@ declare module "stream/web" {
readonly highWaterMark: number;
readonly size: QueuingStrategySize<ArrayBufferView>;
}
const ByteLengthQueuingStrategy: {
prototype: ByteLengthQueuingStrategy;
new(init: QueuingStrategyInit): ByteLengthQueuingStrategy;
new (init: QueuingStrategyInit): ByteLengthQueuingStrategy;
};
/**
* This Streams API interface provides a built-in byte length queuing
* strategy that can be used when constructing streams.
@ -309,26 +344,32 @@ declare module "stream/web" {
readonly highWaterMark: number;
readonly size: QueuingStrategySize;
}
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>;
readonly writable: WritableStream<string>;
readonly [Symbol.toStringTag]: string;
}
const TextEncoderStream: {
prototype: TextEncoderStream;
new(): TextEncoderStream;
new (): TextEncoderStream;
};
interface TextDecoderOptions {
fatal?: boolean;
ignoreBOM?: boolean;
}
type BufferSource = ArrayBufferView | ArrayBuffer;
interface TextDecoderStream {
/** Returns encoding's name, lower cased. */
readonly encoding: string;
@ -340,27 +381,12 @@ declare module "stream/web" {
readonly writable: WritableStream<BufferSource>;
readonly [Symbol.toStringTag]: string;
}
const TextDecoderStream: {
prototype: TextDecoderStream;
new(encoding?: string, options?: TextDecoderOptions): TextDecoderStream;
};
interface CompressionStream<R = any, W = any> {
readonly readable: ReadableStream<R>;
readonly writable: WritableStream<W>;
}
const CompressionStream: {
prototype: CompressionStream;
new<R = any, W = any>(format: string): CompressionStream<R, W>;
};
interface DecompressionStream<R = any, W = any> {
readonly readable: ReadableStream<R>;
readonly writable: WritableStream<W>;
}
const DecompressionStream: {
prototype: DecompressionStream;
new<R = any, W = any>(format: string): DecompressionStream<R, W>;
new (label?: string, options?: TextDecoderOptions): TextDecoderStream;
};
}
declare module "node:stream/web" {
export * from "stream/web";
declare module 'node:stream/web' {
export * from 'stream/web';
}

28
node_modules/@types/node/string_decoder.d.ts generated vendored Normal file → Executable file
View File

@ -1,23 +1,23 @@
/**
* 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
* 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
* characters. It can be accessed using:
*
* ```js
* const { StringDecoder } = require('node:string_decoder');
* const { StringDecoder } = require('string_decoder');
* ```
*
* The following example shows the basic use of the `StringDecoder` class.
*
* ```js
* const { StringDecoder } = require('node:string_decoder');
* const { StringDecoder } = require('string_decoder');
* const decoder = new StringDecoder('utf8');
*
* const cent = Buffer.from([0xC2, 0xA2]);
* console.log(decoder.write(cent)); // Prints: ¢
* console.log(decoder.write(cent));
*
* const euro = Buffer.from([0xE2, 0x82, 0xAC]);
* console.log(decoder.write(euro)); // Prints: €
* console.log(decoder.write(euro));
* ```
*
* When a `Buffer` instance is written to the `StringDecoder` instance, an
@ -29,16 +29,16 @@
* symbol (``) are written over three separate operations:
*
* ```js
* const { StringDecoder } = require('node:string_decoder');
* const { StringDecoder } = require('string_decoder');
* const decoder = new StringDecoder('utf8');
*
* decoder.write(Buffer.from([0xE2]));
* decoder.write(Buffer.from([0x82]));
* console.log(decoder.end(Buffer.from([0xAC]))); // Prints: €
* console.log(decoder.end(Buffer.from([0xAC])));
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/string_decoder.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/string_decoder.js)
*/
declare module "string_decoder" {
declare module 'string_decoder' {
class StringDecoder {
constructor(encoding?: BufferEncoding);
/**
@ -46,7 +46,7 @@ declare module "string_decoder" {
* the end of the `Buffer`, or `TypedArray`, or `DataView` are omitted from the
* returned string and stored in an internal buffer for the next call to`stringDecoder.write()` or `stringDecoder.end()`.
* @since v0.1.99
* @param buffer The bytes to decode.
* @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
*/
write(buffer: Buffer): string;
/**
@ -57,11 +57,11 @@ declare module "string_decoder" {
* If the `buffer` argument is provided, one final call to `stringDecoder.write()`is performed before returning the remaining input.
* After `end()` is called, the `stringDecoder` object can be reused for new input.
* @since v0.9.3
* @param buffer The bytes to decode.
* @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
*/
end(buffer?: Buffer): string;
}
}
declare module "node:string_decoder" {
export * from "string_decoder";
declare module 'node:string_decoder' {
export * from 'string_decoder';
}

1471
node_modules/@types/node/test.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

178
node_modules/@types/node/timers.d.ts generated vendored Normal file → Executable file
View File

@ -1,20 +1,16 @@
/**
* 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('node:timers')` to use the API.
* globals, there is no need to call `require('timers')` to use the API.
*
* The timer functions within Node.js implement a similar API as the timers API
* provided by Web Browsers but use a different internal implementation that is
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/timers.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/timers.js)
*/
declare module "timers" {
import { Abortable } from "node:events";
import {
setImmediate as setImmediatePromise,
setInterval as setIntervalPromise,
setTimeout as setTimeoutPromise,
} from "node:timers/promises";
declare module 'timers' {
import { Abortable } from 'node:events';
import { setTimeout as setTimeoutPromise, setImmediate as setImmediatePromise, setInterval as setIntervalPromise } from 'node:timers/promises';
interface TimerOptions extends Abortable {
/**
* Set to `false` to indicate that the scheduled `Timeout`
@ -37,74 +33,15 @@ declare module "timers" {
refresh(): this;
[Symbol.toPrimitive](): number;
}
/**
* 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;
interface Immediate extends RefCounted {
/**
* If true, the `Immediate` object will keep the Node.js event loop active.
* @since v11.0.0
*/
hasRef(): boolean;
_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;
}
/**
* 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;
interface Timeout extends Timer {
/**
* If true, the `Timeout` object will keep the Node.js event loop active.
* @since v11.0.0
@ -123,118 +60,35 @@ declare module "timers" {
*/
refresh(): this;
[Symbol.toPrimitive](): number;
/**
* Cancels the timeout.
* @since v20.5.0
*/
[Symbol.dispose](): void;
}
}
/**
* 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;
function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
// util.promisify no rest args compability
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
// tslint:disable-next-line void-return
function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
namespace setTimeout {
const __promisify__: typeof setTimeoutPromise;
}
/**
* 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;
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
// util.promisify no rest args compability
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
// tslint:disable-next-line void-return
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timer;
namespace setInterval {
const __promisify__: typeof setIntervalPromise;
}
/**
* 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;
function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
// util.promisify no rest args compability
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
// tslint:disable-next-line void-return
function setImmediate(callback: (args: void) => void): NodeJS.Immediate;
namespace setImmediate {
const __promisify__: typeof setImmediatePromise;
}
/**
* 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';
}

35
node_modules/@types/node/timers/promises.d.ts generated vendored Normal file → Executable file
View File

@ -1,6 +1,6 @@
/**
* The `timers/promises` API provides an alternative set of timer functions
* that return `Promise` objects. The API is accessible via`require('node:timers/promises')`.
* that return `Promise` objects. The API is accessible via`require('timers/promises')`.
*
* ```js
* import {
@ -11,8 +11,8 @@
* ```
* @since v15.0.0
*/
declare module "timers/promises" {
import { TimerOptions } from "node:timers";
declare module 'timers/promises' {
import { TimerOptions } from 'node:timers';
/**
* ```js
* import {
@ -44,8 +44,6 @@ declare module "timers/promises" {
function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
/**
* 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.
*
* ```js
* import {
@ -64,30 +62,7 @@ declare module "timers/promises" {
* @since v15.9.0
*/
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';
}

411
node_modules/@types/node/tls.d.ts generated vendored Normal file → Executable file
View File

@ -1,17 +1,16 @@
/**
* The `node:tls` module provides an implementation of the Transport Layer Security
* The `tls` module provides an implementation of the Transport Layer Security
* (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL.
* The module can be accessed using:
*
* ```js
* const tls = require('node:tls');
* const tls = require('tls');
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/tls.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/tls.js)
*/
declare module "tls" {
import { X509Certificate } from "node:crypto";
import * as net from "node:net";
import * as stream from "stream";
declare module 'tls' {
import { X509Certificate } from 'node:crypto';
import * as net from 'node:net';
const CLIENT_RENEG_LIMIT: number;
const CLIENT_RENEG_WINDOW: number;
interface Certificate {
@ -41,100 +40,21 @@ declare module "tls" {
CN: string;
}
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;
/**
* The date-time the certificate is valid from.
*/
subjectaltname: string;
infoAccess: NodeJS.Dict<string[]>;
modulus: string;
exponent: string;
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;
/**
* 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;
ext_key_usage: string[];
serialNumber: string;
raw: Buffer;
}
interface DetailedPeerCertificate extends PeerCertificate {
/**
* The issuer certificate object.
* For self-signed certificates, this may be a circular reference.
*/
issuerCertificate: DetailedPeerCertificate;
}
interface CipherNameAndProtocol {
@ -212,7 +132,7 @@ declare module "tls" {
*
* Instances of `tls.TLSSocket` implement the duplex `Stream` interface.
*
* 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.
* @since v0.11.4
*/
@ -222,8 +142,8 @@ declare module "tls" {
*/
constructor(socket: net.Socket, options?: TLSSocketOptions);
/**
* This property is `true` if the peer certificate was signed by one of the CAs
* specified when creating the `tls.TLSSocket` instance, otherwise `false`.
* Returns `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
*/
authorized: boolean;
@ -259,13 +179,13 @@ declare module "tls" {
/**
* Returns an object containing information on the negotiated cipher suite.
*
* For example, a TLSv1.2 protocol with AES256-SHA cipher:
* For example:
*
* ```json
* {
* "name": "AES256-SHA",
* "standardName": "TLS_RSA_WITH_AES_256_CBC_SHA",
* "version": "SSLv3"
* "name": "AES128-SHA256",
* "standardName": "TLS_RSA_WITH_AES_128_CBC_SHA256",
* "version": "TLSv1.2"
* }
* ```
*
@ -396,7 +316,7 @@ declare module "tls" {
rejectUnauthorized?: boolean | undefined;
requestCert?: boolean | undefined;
},
callback: (err: Error | null) => void,
callback: (err: Error | null) => void
): undefined | boolean;
/**
* The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size.
@ -422,9 +342,9 @@ declare module "tls" {
* When enabled, TLS packet trace information is written to `stderr`. This can be
* used to debug TLS connection problems.
*
* 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.
* 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.
* @since v12.2.0
*/
enableTrace(): void;
@ -453,7 +373,7 @@ declare module "tls" {
* 128,
* 'client finished');
*
* /*
*
* Example return value of keyingMaterial:
* <Buffer 76 26 af 99 c5 56 8e 42 09 91 ef 9f 93 cb ad 6c 7b 65 f8 53 f1 d8 d9
* 12 5a 33 b8 b5 25 df 7b 37 9f e0 e2 4f b8 67 83 a3 2f cd 5d 41 42 4c 91
@ -472,35 +392,35 @@ declare module "tls" {
*/
exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer;
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
addListener(event: "secureConnect", listener: () => void): this;
addListener(event: "session", listener: (session: Buffer) => void): this;
addListener(event: "keylog", listener: (line: Buffer) => void): this;
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;
}
interface CommonConnectionOptions {
/**
@ -561,6 +481,7 @@ declare module "tls" {
*/
ticketKeys?: Buffer | undefined;
/**
*
* @param socket
* @param identity identity parameter sent from the client.
* @return pre-shared key that must either be
@ -595,7 +516,7 @@ declare module "tls" {
host?: string | undefined;
port?: number | undefined;
path?: string | undefined; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored.
socket?: stream.Duplex | undefined; // Establish secure connection on a given socket rather than creating a new socket
socket?: net.Socket | undefined; // Establish secure connection on a given socket rather than creating a new socket
checkServerIdentity?: typeof checkServerIdentity | undefined;
servername?: string | undefined; // SNI TLS Extension
session?: Buffer | undefined;
@ -636,8 +557,7 @@ declare module "tls" {
* used.
* @since v0.5.3
* @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), or a TLS context object created
* with {@link createSecureContext} itself.
* @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc).
*/
addContext(hostname: string, context: SecureContextOptions): void;
/**
@ -676,118 +596,47 @@ declare module "tls" {
* 6. keylog
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
addListener(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
): this;
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;
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: () => 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;
emit(event: 'tlsClientError', err: Error, tlsSocket: TLSSocket): boolean;
emit(event: 'newSession', sessionId: Buffer, sessionData: Buffer, callback: () => void): boolean;
emit(event: 'OCSPRequest', certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean;
emit(event: 'resumeSession', sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void): boolean;
emit(event: 'secureConnection', tlsSocket: TLSSocket): boolean;
emit(event: 'keylog', line: Buffer, tlsSocket: TLSSocket): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
on(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
on(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
): this;
on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
on(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this;
on(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
on(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
on(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this;
on(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this;
on(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
once(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
): this;
once(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
once(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
): this;
once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
once(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this;
once(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
once(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
once(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this;
once(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this;
once(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
prependListener(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
): this;
prependListener(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
prependListener(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
): this;
prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
prependListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this;
prependListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
prependListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
prependListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this;
prependListener(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this;
prependListener(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
prependOnceListener(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
): this;
prependOnceListener(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
prependOnceListener(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
): this;
prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
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;
}
/**
* @deprecated since v0.11.3 Use `tls.TLSSocket` instead.
@ -796,19 +645,8 @@ declare module "tls" {
encrypted: TLSSocket;
cleartext: TLSSocket;
}
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
* the well-known CAs curated by Mozilla. Mozilla's CAs are completely
@ -850,9 +688,12 @@ declare module "tls" {
*/
crl?: string | Buffer | Array<string | Buffer> | undefined;
/**
* `'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.
* 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.
*/
dhparam?: string | Buffer | undefined;
/**
@ -881,7 +722,7 @@ declare module "tls" {
* object.passphrase is optional. Encrypted keys will be decrypted with
* object.passphrase if provided, or options.passphrase if it is not.
*/
key?: string | Buffer | Array<string | Buffer | KeyObject> | undefined;
key?: string | Buffer | Array<Buffer | KeyObject> | undefined;
/**
* Name of an OpenSSL engine to get private key from. Should be used
* together with privateKeyIdentifier.
@ -972,19 +813,13 @@ declare module "tls" {
* Returns [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on
* failure. On success, returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type).
*
* 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
* This function can be overwritten by providing alternative function as part of
* the `options.checkServerIdentity` option passed to `tls.connect()`. The
* overwriting function can call `tls.checkServerIdentity()` of course, to augment
* the checks done with additional verification.
*
* This function is only called if the certificate passed all other checks, such as
* 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
* @param hostname The host name or IP address to verify the certificate against.
* @param cert A `certificate object` representing the peer's certificate.
@ -994,14 +829,14 @@ declare module "tls" {
* Creates a new {@link Server}. The `secureConnectionListener`, if provided, is
* automatically set as a listener for the `'secureConnection'` event.
*
* The `ticketKeys` options is automatically shared between `node:cluster` module
* The `ticketKeys` options is automatically shared between `cluster` module
* workers.
*
* The following illustrates a simple echo server:
*
* ```js
* const tls = require('node:tls');
* const fs = require('node:fs');
* const tls = require('tls');
* const fs = require('fs');
*
* const options = {
* key: fs.readFileSync('server-key.pem'),
@ -1011,7 +846,7 @@ declare module "tls" {
* requestCert: true,
*
* // This is necessary only if the client uses a self-signed certificate.
* ca: [ fs.readFileSync('client-cert.pem') ],
* ca: [ fs.readFileSync('client-cert.pem') ]
* };
*
* const server = tls.createServer(options, (socket) => {
@ -1046,8 +881,8 @@ declare module "tls" {
*
* ```js
* // Assumes an echo server that is listening on port 8000.
* const tls = require('node:tls');
* const fs = require('node:fs');
* const tls = require('tls');
* const fs = require('fs');
*
* const options = {
* // Necessary only if the server requires client certificate authentication.
@ -1078,12 +913,7 @@ declare module "tls" {
* @since v0.11.3
*/
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;
/**
* Creates a new secure pair object with two streams, one of which reads and writes
@ -1118,12 +948,7 @@ declare module "tls" {
* @param requestCert `true` to specify whether a server should request a certificate from a connecting client. Only applies when `isServer` is `true`.
* @param rejectUnauthorized If not `false` a server automatically reject clients with invalid certificates. Only applies when `isServer` is `true`.
*/
function createSecurePair(
context?: SecureContext,
isServer?: boolean,
requestCert?: boolean,
rejectUnauthorized?: boolean,
): SecurePair;
function createSecurePair(context?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
/**
* {@link createServer} sets the default value of the `honorCipherOrder` option
* to `true`, other APIs that create secure contexts leave it unset.
@ -1133,19 +958,12 @@ declare module "tls" {
* APIs that create secure contexts have no default value.
*
* The `tls.createSecureContext()` method creates a `SecureContext` object. It is
* 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.
* usable as an argument to several `tls` APIs, such as {@link createServer} and `server.addContext()`, but has no public methods.
*
* A key is _required_ for ciphers that use certificates. Either `key` or`pfx` can be used to provide it.
*
* If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of
* 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
*/
function createSecureContext(options?: SecureContextOptions): SecureContext;
@ -1154,8 +972,6 @@ declare module "tls" {
* lower-case for historical reasons, but must be uppercased to be used in
* the `ciphers` option of {@link createSecureContext}.
*
* 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
* TLSv1.2 and below.
*
@ -1191,20 +1007,13 @@ declare module "tls" {
* are provided, the lowest minimum is used.
*/
let DEFAULT_MIN_VERSION: SecureVersion;
/**
* 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
* format) used for verifying peer certificates. This is the default value
* of the ca option to tls.createSecureContext().
*/
const rootCertificates: readonly string[];
const rootCertificates: ReadonlyArray<string>;
}
declare module "node:tls" {
export * from "tls";
declare module 'node:tls' {
export * from 'tls';
}

45
node_modules/@types/node/trace_events.d.ts generated vendored Normal file → Executable file
View File

@ -1,9 +1,9 @@
/**
* The `node:trace_events` module provides a mechanism to centralize tracing
* information generated by V8, Node.js core, and userspace code.
* The `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 `node:trace_events` module. The `--trace-event-categories` flag
* or by using the `trace_events` module. The `--trace-event-categories` flag
* accepts a list of comma-separated category names.
*
* The available categories are:
@ -13,19 +13,9 @@
* The `async_hooks` events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property.
* * `node.bootstrap`: Enables capture of Node.js bootstrap milestones.
* * `node.console`: Enables capture of `console.time()` and `console.count()`output.
* * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool
* synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`.
* * `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.
* * `node.perf.usertiming`: Enables capture of only Performance API User Timing
* measures and marks.
@ -33,9 +23,8 @@
* measurements.
* * `node.promises.rejections`: Enables capture of trace data tracking the number
* of unhandled Promise rejections and handled-after-rejections.
* * `node.vm.script`: Enables capture of trace data for the `node:vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
* * `node.vm.script`: Enables capture of trace data for the `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.
*
* By default the `node`, `node.async_hooks`, and `v8` categories are enabled.
*
@ -54,10 +43,10 @@
* node --trace-event-categories v8,node,node.async_hooks
* ```
*
* Alternatively, trace events may be enabled using the `node:trace_events` module:
* Alternatively, trace events may be enabled using the `trace_events` module:
*
* ```js
* const trace_events = require('node:trace_events');
* const trace_events = require('trace_events');
* const tracing = trace_events.createTracing({ categories: ['node.perf'] });
* tracing.enable(); // Enable trace event capture for the 'node.perf' category
*
@ -77,16 +66,6 @@
* node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
* ```
*
* 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
* as the one used by `process.hrtime()`.
* However the trace-event timestamps are expressed in microseconds,
@ -94,9 +73,9 @@
*
* The features from this module are not available in `Worker` threads.
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/trace_events.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/trace_events.js)
*/
declare module "trace_events" {
declare module 'trace_events' {
/**
* The `Tracing` object is used to enable or disable tracing for sets of
* categories. Instances are created using the
@ -143,7 +122,7 @@ declare module "trace_events" {
* Creates and returns a `Tracing` object for the given set of `categories`.
*
* ```js
* const trace_events = require('node:trace_events');
* const trace_events = require('trace_events');
* const categories = ['node.perf', 'node.async_hooks'];
* const tracing = trace_events.createTracing({ categories });
* tracing.enable();
@ -163,7 +142,7 @@ declare module "trace_events" {
* Given the file `test.js` below, the command`node --trace-event-categories node.perf test.js` will print`'node.async_hooks,node.perf'` to the console.
*
* ```js
* const trace_events = require('node:trace_events');
* const trace_events = require('trace_events');
* const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });
* const t2 = trace_events.createTracing({ categories: ['node.perf'] });
* const t3 = trace_events.createTracing({ categories: ['v8'] });
@ -177,6 +156,6 @@ declare module "trace_events" {
*/
function getEnabledCategories(): string | undefined;
}
declare module "node:trace_events" {
export * from "trace_events";
declare module 'node:trace_events' {
export * from 'trace_events';
}

286
node_modules/@types/node/ts4.8/assert.d.ts generated vendored Normal file → Executable file
View File

@ -1,9 +1,9 @@
/**
* The `node:assert` module provides a set of assertion functions for verifying
* The `assert` module provides a set of assertion functions for verifying
* invariants.
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/assert.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/assert.js)
*/
declare module "assert" {
declare module 'assert' {
/**
* An alias of {@link ok}.
* @since v0.5.9
@ -12,29 +12,15 @@ declare module "assert" {
function assert(value: unknown, message?: string | Error): asserts value;
namespace assert {
/**
* Indicates the failure of an assertion. All errors thrown by the `node:assert`module will be instances of the `AssertionError` class.
* Indicates the failure of an assertion. All errors thrown by the `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;
/**
* Value is always `ERR_ASSERTION` to show that the error is an assertion error.
*/
code: "ERR_ASSERTION";
code: 'ERR_ASSERTION';
constructor(options?: {
/** If provided, the error message is set to this value. */
message?: string | undefined;
@ -45,15 +31,14 @@ declare module "assert" {
/** The `operator` property on the error instance. */
operator?: string | undefined;
/** If provided, the generated stack trace omits frames before this function. */
// eslint-disable-next-line @typescript-eslint/ban-types
// tslint:disable-next-line:ban-types
stackStartFn?: Function | undefined;
});
}
/**
* This feature is deprecated and will be removed in a future version.
* Please consider using alternatives such as the `mock` helper function.
* This feature is currently experimental and behavior might still change.
* @since v14.2.0, v12.19.0
* @deprecated Deprecated
* @experimental
*/
class CallTracker {
/**
@ -62,7 +47,7 @@ declare module "assert" {
* error.
*
* ```js
* import assert from 'node:assert';
* import assert from 'assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
@ -80,44 +65,26 @@ declare module "assert" {
*/
calls(exact?: number): () => void;
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
/**
* 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
* the functions that have not been called the expected number of times.
*
* ```js
* import assert from 'node:assert';
* import assert from 'assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
*
* function func() {}
*
* function foo() {}
*
* // Returns a function that wraps func() that must be called exact times
* // before tracker.verify().
* const callsfunc = tracker.calls(func, 2);
*
* // Returns an array containing information on callsfunc()
* console.log(tracker.report());
* tracker.report();
* // [
* // {
* // message: 'Expected the func function to be executed 2 time(s) but was
@ -130,39 +97,15 @@ declare module "assert" {
* // ]
* ```
* @since v14.2.0, v12.19.0
* @return An Array of objects containing information about the wrapper functions returned by `calls`.
* @return 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
* have not been called the expected number of times.
*
* ```js
* import assert from 'node:assert';
* import assert from 'assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
@ -182,10 +125,6 @@ declare module "assert" {
*/
verify(): void;
}
interface CallTrackerCall {
thisArg: object;
arguments: unknown[];
}
interface CallTrackerReportInformation {
message: string;
/** The actual number of times the function was called. */
@ -197,14 +136,14 @@ declare module "assert" {
/** A stack trace of the function. */
stack: object;
}
type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error;
type AssertPredicate = RegExp | (new () => object) | ((thrown: unknown) => boolean) | object | Error;
/**
* Throws an `AssertionError` with the provided error message or a default
* error message. If the `message` parameter is an instance of an `Error` then
* it will be thrown instead of the `AssertionError`.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.fail();
* // AssertionError [ERR_ASSERTION]: Failed
@ -228,8 +167,8 @@ declare module "assert" {
expected: unknown,
message?: string | Error,
operator?: string,
// eslint-disable-next-line @typescript-eslint/ban-types
stackStartFn?: Function,
// tslint:disable-next-line:ban-types
stackStartFn?: Function
): never;
/**
* Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`.
@ -242,7 +181,7 @@ declare module "assert" {
* thrown in a file! See below for further details.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.ok(true);
* // OK
@ -277,7 +216,7 @@ declare module "assert" {
* ```
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* // Using `assert()` works the same:
* assert(0);
@ -298,11 +237,11 @@ declare module "assert" {
* > Stability: 3 - Legacy: Use {@link strictEqual} instead.
*
* Tests shallow, coercive equality between the `actual` and `expected` parameters
* 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`.
* 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`.
*
* ```js
* import assert from 'node:assert';
* import assert from 'assert';
*
* assert.equal(1, 1);
* // OK, 1 == 1
@ -331,11 +270,12 @@ declare module "assert" {
*
* > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
*
* 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`.
* 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`.
*
* ```js
* import assert from 'node:assert';
* import assert from 'assert';
*
* assert.notEqual(1, 2);
* // OK
@ -382,24 +322,24 @@ declare module "assert" {
* Tests for any deep inequality. Opposite of {@link deepEqual}.
*
* ```js
* import assert from 'node:assert';
* import assert from 'assert';
*
* const obj1 = {
* a: {
* b: 1,
* },
* b: 1
* }
* };
* const obj2 = {
* a: {
* b: 2,
* },
* b: 2
* }
* };
* const obj3 = {
* a: {
* b: 1,
* },
* b: 1
* }
* };
* const obj4 = { __proto__: obj1 };
* const obj4 = Object.create(obj1);
*
* assert.notDeepEqual(obj1, obj1);
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
@ -422,10 +362,10 @@ declare module "assert" {
function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
/**
* Tests strict equality between the `actual` and `expected` parameters as
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
* determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.strictEqual(1, 2);
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
@ -460,10 +400,10 @@ declare module "assert" {
function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
/**
* Tests strict inequality between the `actual` and `expected` parameters as
* determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
* determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.notStrictEqual(1, 2);
* // OK
@ -494,7 +434,7 @@ declare module "assert" {
* Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
* // OK
@ -525,14 +465,14 @@ declare module "assert" {
* Custom validation object/error instance:
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* const err = new TypeError('Wrong value');
* err.code = 404;
* err.foo = 'bar';
* err.info = {
* nested: true,
* baz: 'text',
* baz: 'text'
* };
* err.reg = /abc/i;
*
@ -545,16 +485,16 @@ declare module "assert" {
* message: 'Wrong value',
* info: {
* 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:
* assert.throws(
* throws(
* () => {
* throw err;
* },
@ -568,17 +508,17 @@ declare module "assert" {
* info: {
* nested: true,
* // It is not possible to use regular expressions for nested properties!
* baz: 'text',
* baz: 'text'
* },
* // The `reg` property contains a regular expression and only if the
* // validation object contains an identical regular expression, it is going
* // to pass.
* reg: /abc/i,
* },
* reg: /abc/i
* }
* );
*
* // Fails due to the different `message` and `name` properties:
* assert.throws(
* throws(
* () => {
* const otherErr = new Error('Not found');
* // Copy all enumerable properties from `err` to `otherErr`.
@ -589,20 +529,20 @@ declare module "assert" {
* },
* // The error's `message` and `name` properties will also be checked when using
* // an error as validation object.
* err,
* err
* );
* ```
*
* Validate instanceof using constructor:
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.throws(
* () => {
* throw new Error('Wrong value');
* },
* Error,
* Error
* );
* ```
*
@ -612,13 +552,13 @@ declare module "assert" {
* therefore also include the error name.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.throws(
* () => {
* throw new Error('Wrong value');
* },
* /^Error: Wrong value$/,
* /^Error: Wrong value$/
* );
* ```
*
@ -628,7 +568,7 @@ declare module "assert" {
* It will otherwise fail with an `AssertionError`.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.throws(
* () => {
@ -644,7 +584,7 @@ declare module "assert" {
* // possible.
* return true;
* },
* 'unexpected error',
* 'unexpected error'
* );
* ```
*
@ -654,7 +594,7 @@ declare module "assert" {
* a string as the second argument gets considered:
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* function throwingFirst() {
* throw new Error('First');
@ -710,20 +650,20 @@ declare module "assert" {
* propagated back to the caller.
*
* 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.
*
* The following, for instance, will throw the `TypeError` because there is no
* matching error type in the assertion:
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
* SyntaxError,
* SyntaxError
* );
* ```
*
@ -731,27 +671,27 @@ declare module "assert" {
* 'Got unwanted exception...':
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
* TypeError,
* TypeError
* );
* ```
*
* If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message:
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
* /Wrong value/,
* 'Whoops',
* 'Whoops'
* );
* // Throws: AssertionError: Got unwanted exception: Whoops
* ```
@ -765,7 +705,7 @@ declare module "assert" {
* from the error passed to `ifError()` including the potential new frames for`ifError()` itself.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.ifError(null);
* // OK
@ -811,7 +751,7 @@ declare module "assert" {
* If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* await assert.rejects(
* async () => {
@ -819,13 +759,13 @@ declare module "assert" {
* },
* {
* name: 'TypeError',
* message: 'Wrong value',
* },
* message: 'Wrong value'
* }
* );
* ```
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* await assert.rejects(
* async () => {
@ -835,16 +775,16 @@ declare module "assert" {
* assert.strictEqual(err.name, 'TypeError');
* assert.strictEqual(err.message, 'Wrong value');
* return true;
* },
* }
* );
* ```
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.rejects(
* Promise.reject(new Error('Wrong value')),
* Error,
* Error
* ).then(() => {
* // ...
* });
@ -857,11 +797,7 @@ declare module "assert" {
* @since v10.0.0
*/
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>;
/**
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
* calls the function and awaits the returned promise to complete. It will then
@ -878,24 +814,24 @@ declare module "assert" {
* error messages as expressive as possible.
*
* 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.
*
* Besides the async nature to await the completion behaves identically to {@link doesNotThrow}.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* await assert.doesNotReject(
* async () => {
* throw new TypeError('Wrong value');
* },
* SyntaxError,
* SyntaxError
* );
* ```
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
* .then(() => {
@ -904,20 +840,13 @@ declare module "assert" {
* ```
* @since v10.0.0
*/
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>;
/**
* Expects the `string` input to match the regular expression.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.match('I will fail', /pass/);
* // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
@ -940,7 +869,7 @@ declare module "assert" {
* Expects the `string` input not to match the regular expression.
*
* ```js
* import assert from 'node:assert/strict';
* import assert from 'assert/strict';
*
* assert.doesNotMatch('I will fail', /fail/);
* // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...
@ -959,38 +888,25 @@ declare module "assert" {
* @since v13.6.0, v12.16.0
*/
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;
}

8
node_modules/@types/node/ts4.8/assert/strict.d.ts generated vendored Normal file → Executable file
View File

@ -1,8 +1,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;
}

126
node_modules/@types/node/ts4.8/async_hooks.d.ts generated vendored Normal file → Executable file
View File

@ -1,27 +1,19 @@
/**
* 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:
* The `async_hooks` module provides an API to track asynchronous resources. It
* can be accessed using:
*
* ```js
* import async_hooks from 'node:async_hooks';
* import async_hooks from 'async_hooks';
* ```
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/async_hooks.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/async_hooks.js)
*/
declare module "async_hooks" {
declare module 'async_hooks' {
/**
* ```js
* import { executionAsyncId } from 'node:async_hooks';
* import fs from 'node:fs';
* import { executionAsyncId } from 'async_hooks';
*
* console.log(executionAsyncId()); // 1 - bootstrap
* const path = '.';
* fs.open(path, 'r', (err, fd) => {
* console.log(executionAsyncId()); // 6 - open()
* });
@ -59,8 +51,8 @@ declare module "async_hooks" {
* but having an object representing the top-level can be helpful.
*
* ```js
* import { open } from 'node:fs';
* import { executionAsyncId, executionAsyncResource } from 'node:async_hooks';
* import { open } from 'fs';
* import { executionAsyncId, executionAsyncResource } from 'async_hooks';
*
* console.log(executionAsyncId(), executionAsyncResource()); // 1 {}
* open(new URL(import.meta.url), 'r', (err, fd) => {
@ -72,11 +64,11 @@ declare module "async_hooks" {
* use of a tracking `Map` to store the metadata:
*
* ```js
* import { createServer } from 'node:http';
* import { createServer } from 'http';
* import {
* executionAsyncId,
* executionAsyncResource,
* createHook,
* createHook
* } from 'async_hooks';
* const sym = Symbol('state'); // Private symbol to avoid pollution
*
@ -86,7 +78,7 @@ declare module "async_hooks" {
* if (cr) {
* resource[sym] = cr[sym];
* }
* },
* }
* }).enable();
*
* const server = createServer((req, res) => {
@ -175,11 +167,11 @@ declare module "async_hooks" {
* specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
*
* ```js
* import { createHook } from 'node:async_hooks';
* import { createHook } from 'async_hooks';
*
* const asyncHook = createHook({
* init(asyncId, type, triggerAsyncId, resource) { },
* destroy(asyncId) { },
* destroy(asyncId) { }
* });
* ```
*
@ -231,13 +223,13 @@ declare module "async_hooks" {
* The following is an overview of the `AsyncResource` API.
*
* ```js
* import { AsyncResource, executionAsyncId } from 'node:async_hooks';
* import { AsyncResource, executionAsyncId } from 'async_hooks';
*
* // AsyncResource() is meant to be extended. Instantiating a
* // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
* // async_hook.executionAsyncId() is used.
* const asyncResource = new AsyncResource(
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false },
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }
* );
*
* // Run a function in the execution context of the resource. This will
@ -271,6 +263,9 @@ declare module "async_hooks" {
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
* @param fn The function to bind to the current execution context.
* @param type An optional name to associate with the underlying `AsyncResource`.
@ -278,14 +273,23 @@ declare module "async_hooks" {
static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(
fn: Func,
type?: string,
thisArg?: ThisArg,
): Func;
thisArg?: ThisArg
): Func & {
asyncResource: AsyncResource;
};
/**
* 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;
bind<Func extends (...args: any[]) => any>(
fn: Func
): Func & {
asyncResource: AsyncResource;
};
/**
* Call the provided function with the provided arguments in the execution context
* of the async resource. This will establish the context, trigger the AsyncHooks
@ -296,11 +300,7 @@ declare module "async_hooks" {
* @param thisArg The receiver to be used for the function call.
* @param args Optional arguments to pass to the function.
*/
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;
/**
* 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
@ -314,6 +314,7 @@ declare module "async_hooks" {
*/
asyncId(): number;
/**
*
* @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.
*/
triggerAsyncId(): number;
@ -321,17 +322,17 @@ declare module "async_hooks" {
/**
* This class creates stores that stay coherent through asynchronous operations.
*
* 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.
* 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.
*
* The following example uses `AsyncLocalStorage` to build a simple logger
* that assigns IDs to incoming HTTP requests and includes them in messages
* logged within each request.
*
* ```js
* import http from 'node:http';
* import { AsyncLocalStorage } from 'node:async_hooks';
* import http from 'http';
* import { AsyncLocalStorage } from 'async_hooks';
*
* const asyncLocalStorage = new AsyncLocalStorage();
*
@ -363,48 +364,10 @@ declare module "async_hooks" {
*
* Each instance of `AsyncLocalStorage` maintains an independent storage context.
* Multiple instances can safely exist simultaneously without risk of interfering
* with each other's data.
* with each other data.
* @since v13.10.0, v12.17.0
*/
class AsyncLocalStorage<T> {
/**
* 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
* to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
@ -432,9 +395,8 @@ declare module "async_hooks" {
getStore(): T | undefined;
/**
* Runs a function synchronously within a context and returns its
* return value. The store is not accessible outside of the callback function.
* The store is accessible to any asynchronous operations created within the
* callback.
* return value. The store is not accessible outside of the callback function or
* the asynchronous operations created within the callback.
*
* The optional `args` are passed to the callback function.
*
@ -448,9 +410,6 @@ declare module "async_hooks" {
* try {
* asyncLocalStorage.run(store, () => {
* asyncLocalStorage.getStore(); // Returns the store object
* setTimeout(() => {
* asyncLocalStorage.getStore(); // Returns the store object
* }, 200);
* throw new Error();
* });
* } catch (e) {
@ -460,7 +419,6 @@ declare module "async_hooks" {
* ```
* @since v13.10.0, v12.17.0
*/
run<R>(store: T, callback: () => R): R;
run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
/**
* Runs a function synchronously outside of a context and returns its
@ -534,6 +492,6 @@ declare module "async_hooks" {
enterWith(store: T): void;
}
}
declare module "node:async_hooks" {
export * from "async_hooks";
declare module 'node:async_hooks' {
export * from 'async_hooks';
}

402
node_modules/@types/node/ts4.8/buffer.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

562
node_modules/@types/node/ts4.8/child_process.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

252
node_modules/@types/node/ts4.8/cluster.d.ts generated vendored Normal file → Executable file
View File

@ -1,19 +1,18 @@
/**
* 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.
* 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.
*
* The cluster module allows easy creation of child processes that all share
* server ports.
*
* ```js
* import cluster from 'node:cluster';
* import http from 'node:http';
* import { availableParallelism } from 'node:os';
* import process from 'node:process';
* import cluster from 'cluster';
* import http from 'http';
* import { cpus } from 'os';
* import process from 'process';
*
* const numCPUs = availableParallelism();
* const numCPUs = cpus().length;
*
* if (cluster.isPrimary) {
* console.log(`Primary ${process.pid} is running`);
@ -50,13 +49,12 @@
* ```
*
* 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/v20.2.0/lib/cluster.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.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";
type SerializationType = "json" | "advanced";
declare module 'cluster' {
import * as child from 'node:child_process';
import EventEmitter = require('node:events');
import * as net from 'node:net';
export interface ClusterSettings {
execArgv?: string[] | undefined; // default: process.execArgv
exec?: string | undefined;
@ -66,14 +64,11 @@ declare module "cluster" {
uid?: number | undefined;
gid?: number | undefined;
inspectPort?: number | (() => number) | undefined;
serialization?: SerializationType | undefined;
cwd?: string | undefined;
windowsHide?: boolean | undefined;
}
export interface Address {
address: string;
port: number;
addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6"
addressType: number | 'udp4' | 'udp6'; // 4, 6, -1, "udp4", "udp6"
}
/**
* A `Worker` object contains all public information and method about a worker.
@ -104,9 +99,9 @@ declare module "cluster" {
/**
* Send a message to a worker or primary, optionally with a handle.
*
* In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
* 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()`.
*
* This example will echo back all messages from the primary:
*
@ -125,25 +120,22 @@ declare module "cluster" {
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
*/
send(message: 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 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`.
* 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`.
*
* The `kill()` function kills the worker process without waiting for a graceful
* disconnect, it has the same behavior as `worker.process.kill()`.
* 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()`.
*
* This method is aliased as `worker.destroy()` for backwards compatibility.
* Causes `.exitedAfterDisconnect` to be set.
*
* This method is aliased as `worker.destroy()` for backward compatibility.
*
* In a worker, `process.kill()` exists, but it is not this function;
* it is `kill()`.
@ -196,7 +188,7 @@ declare module "cluster" {
* });
*
* } else if (cluster.isWorker) {
* const net = require('node:net');
* const net = require('net');
* const server = net.createServer((socket) => {
* // Connections never end
* });
@ -226,12 +218,12 @@ declare module "cluster" {
* because of exiting or being signaled). Otherwise, it returns `false`.
*
* ```js
* import cluster from 'node:cluster';
* import http from 'node:http';
* import { availableParallelism } from 'node:os';
* import process from 'node:process';
* import cluster from 'cluster';
* import http from 'http';
* import { cpus } from 'os';
* import process from 'process';
*
* const numCPUs = availableParallelism();
* const numCPUs = cpus().length;
*
* if (cluster.isPrimary) {
* console.log(`Primary ${process.pid} is running`);
@ -261,8 +253,7 @@ declare module "cluster" {
*/
isDead(): boolean;
/**
* This property is `true` if the worker exited due to `.disconnect()`.
* If the worker exited any other way, it is `false`. If the
* 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
* worker has not exited, it is `undefined`.
*
* The boolean `worker.exitedAfterDisconnect` allows distinguishing between
@ -292,47 +283,47 @@ declare module "cluster" {
* 6. online
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "disconnect", listener: () => void): this;
addListener(event: "error", listener: (error: Error) => void): this;
addListener(event: "exit", listener: (code: number, signal: string) => void): this;
addListener(event: "listening", listener: (address: Address) => void): this;
addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
addListener(event: "online", listener: () => void): this;
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;
}
export interface Cluster extends EventEmitter {
disconnect(callback?: () => void): void;
@ -364,69 +355,60 @@ declare module "cluster" {
* 7. setup
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "disconnect", listener: (worker: Worker) => void): this;
addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
addListener(event: "fork", listener: (worker: Worker) => void): this;
addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
addListener(
event: "message",
listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
): this; // the handle is a net.Socket or net.Server object, or undefined.
addListener(event: "online", listener: (worker: Worker) => void): this;
addListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
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;
}
const cluster: Cluster;
export default 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';
}

43
node_modules/@types/node/ts4.8/console.d.ts generated vendored Normal file → Executable file
View File

@ -1,11 +1,11 @@
/**
* The `node:console` module provides a simple debugging console that is similar to
* the JavaScript console mechanism provided by web browsers.
* The `console` module provides a simple debugging console that is similar to the
* JavaScript console mechanism provided by web browsers.
*
* The module exports two specific components:
*
* * A `Console` class with methods such as `console.log()`, `console.error()`, and`console.warn()` that can be used to write to any Node.js stream.
* * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('node: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('console')`.
*
* _**Warning**_: The global console object's methods are neither consistently
* synchronous like the browser APIs they resemble, nor are they consistently
@ -53,14 +53,14 @@
* myConsole.warn(`Danger ${name}! Danger!`);
* // Prints: Danger Will Robinson! Danger!, to err
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/console.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.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 {
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
interface Console {
@ -123,7 +123,7 @@ declare module "node:console" {
* >
* ```
* @since v8.3.0
* @param [label='default'] The display label for the counter.
* @param label The display label for the counter.
*/
count(label?: string): void;
/**
@ -141,7 +141,7 @@ declare module "node:console" {
* >
* ```
* @since v8.3.0
* @param [label='default'] The display label for the counter.
* @param label The display label for the counter.
*/
countReset(label?: string): void;
/**
@ -221,7 +221,7 @@ declare module "node:console" {
log(message?: any, ...optionalParams: any[]): void;
/**
* Try to construct a table with the columns of the properties of `tabularData`(or use `properties`) and rows of `tabularData` and log it. Falls back to just
* logging the argument if it can't be parsed as tabular.
* logging the argument if it cant be parsed as tabular.
*
* ```js
* // These can't be parsed as tabular data
@ -250,14 +250,13 @@ declare module "node:console" {
* @since v10.0.0
* @param properties Alternate properties for constructing the table.
*/
table(tabularData: any, properties?: readonly string[]): void;
table(tabularData: any, properties?: ReadonlyArray<string>): void;
/**
* Starts a timer that can be used to compute the duration of an operation. Timers
* are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in
* suitable time units to `stdout`. For example, if the elapsed
* time is 3869ms, `console.timeEnd()` displays "3.869s".
* @since v0.1.104
* @param [label='default']
*/
time(label?: string): void;
/**
@ -265,13 +264,12 @@ declare module "node:console" {
* prints the result to `stdout`:
*
* ```js
* console.time('bunch-of-stuff');
* // Do a bunch of stuff.
* console.timeEnd('bunch-of-stuff');
* // Prints: bunch-of-stuff: 225.438ms
* console.time('100-elements');
* for (let i = 0; i < 100; i++) {}
* console.timeEnd('100-elements');
* // prints 100-elements: 225.438ms
* ```
* @since v0.1.104
* @param [label='default']
*/
timeEnd(label?: string): void;
/**
@ -287,7 +285,6 @@ declare module "node:console" {
* console.timeEnd('process');
* ```
* @since v10.7.0
* @param [label='default']
*/
timeLog(label?: string, ...data: any[]): void;
/**
@ -395,7 +392,7 @@ declare module "node:console" {
stdout: NodeJS.WritableStream;
stderr?: NodeJS.WritableStream | undefined;
ignoreErrors?: boolean | undefined;
colorMode?: boolean | "auto" | undefined;
colorMode?: boolean | 'auto' | undefined;
inspectOptions?: InspectOptions | undefined;
/**
* Set group indentation
@ -405,8 +402,8 @@ declare module "node:console" {
}
interface ConsoleConstructor {
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;
}
}
var console: Console;

23
node_modules/@types/node/ts4.8/constants.d.ts generated vendored Normal file → Executable file
View File

@ -1,19 +1,18 @@
/** @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;
}

1694
node_modules/@types/node/ts4.8/crypto.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

177
node_modules/@types/node/ts4.8/dgram.d.ts generated vendored Normal file → Executable file
View File

@ -1,13 +1,13 @@
/**
* The `node:dgram` module provides an implementation of UDP datagram sockets.
* The `dgram` module provides an implementation of UDP datagram sockets.
*
* ```js
* import dgram from 'node:dgram';
* import dgram from 'dgram';
*
* const server = dgram.createSocket('udp4');
*
* server.on('error', (err) => {
* console.error(`server error:\n${err.stack}`);
* console.log(`server error:\n${err.stack}`);
* server.close();
* });
*
@ -23,15 +23,15 @@
* server.bind(41234);
* // Prints: server listening 0.0.0.0:41234
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dgram.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/dgram.js)
*/
declare module "dgram" {
import { AddressInfo } from "node:net";
import * as dns from "node:dns";
import { Abortable, EventEmitter } from "node:events";
declare module 'dgram' {
import { AddressInfo } from 'node:net';
import * as dns from 'node:dns';
import { EventEmitter, Abortable } from 'node:events';
interface RemoteInfo {
address: string;
family: "IPv4" | "IPv6";
family: 'IPv4' | 'IPv6';
port: number;
size: number;
}
@ -41,7 +41,7 @@ declare module "dgram" {
exclusive?: boolean | undefined;
fd?: number | undefined;
}
type SocketType = "udp4" | "udp6";
type SocketType = 'udp4' | 'udp6';
interface SocketOptions extends Abortable {
type: SocketType;
reuseAddr?: boolean | undefined;
@ -51,13 +51,7 @@ declare module "dgram" {
ipv6Only?: boolean | undefined;
recvBufferSize?: number | undefined;
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;
}
/**
* Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram
@ -104,8 +98,8 @@ declare module "dgram" {
* When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur:
*
* ```js
* import cluster from 'node:cluster';
* import dgram from 'node:dgram';
* import cluster from 'cluster';
* import dgram from 'dgram';
*
* if (cluster.isPrimary) {
* cluster.fork(); // Works ok.
@ -122,7 +116,7 @@ declare module "dgram" {
addMembership(multicastAddress: string, multicastInterface?: string): void;
/**
* 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.
*
* This method throws `EBADF` if called on an unbound socket.
* @since v0.1.99
@ -148,12 +142,12 @@ declare module "dgram" {
* Example of a UDP server listening on port 41234:
*
* ```js
* import dgram from 'node:dgram';
* import dgram from 'dgram';
*
* const server = dgram.createSocket('udp4');
*
* server.on('error', (err) => {
* console.error(`server error:\n${err.stack}`);
* console.log(`server error:\n${err.stack}`);
* server.close();
* });
*
@ -227,16 +221,6 @@ declare module "dgram" {
* @return the `SO_SNDBUF` socket send buffer size in bytes.
*/
getSendBufferSize(): number;
/**
* @since v18.8.0, v16.19.0
* @return Number of bytes queued for sending.
*/
getSendQueueSize(): number;
/**
* @since v18.8.0, v16.19.0
* @return Number of send requests currently in the queue awaiting to be processed.
*/
getSendQueueCount(): number;
/**
* By default, binding a socket will cause it to block the Node.js process from
* exiting as long as the socket is open. The `socket.unref()` method can be used
@ -276,7 +260,7 @@ declare module "dgram" {
*
* The `address` argument is a string. If the value of `address` is a host name,
* DNS will be used to resolve the address of the host. If `address` is not
* provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default.
* provided or otherwise falsy, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default.
*
* If the socket has not been previously bound with a call to `bind`, the socket
* is assigned a random port number and is bound to the "all interfaces" address
@ -300,8 +284,8 @@ declare module "dgram" {
* Example of sending a UDP packet to a port on `localhost`;
*
* ```js
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
* import dgram from 'dgram';
* import { Buffer } from 'buffer';
*
* const message = Buffer.from('Some bytes');
* const client = dgram.createSocket('udp4');
@ -313,8 +297,8 @@ declare module "dgram" {
* Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`;
*
* ```js
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
* import dgram from 'dgram';
* import { Buffer } from 'buffer';
*
* const buf1 = Buffer.from('Some ');
* const buf2 = Buffer.from('bytes');
@ -332,8 +316,8 @@ declare module "dgram" {
* Example of sending a UDP packet using a socket connected to a port on`localhost`:
*
* ```js
* import dgram from 'node:dgram';
* import { Buffer } from 'node:buffer';
* import dgram from 'dgram';
* import { Buffer } from 'buffer';
*
* const message = Buffer.from('Some bytes');
* const client = dgram.createSocket('udp4');
@ -351,42 +335,12 @@ declare module "dgram" {
* @param address Destination host name or IP address.
* @param callback Called when the message has been sent.
*/
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;
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;
/**
* Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP
* packets may be sent to a local interface's broadcast address.
@ -497,7 +451,7 @@ declare module "dgram" {
* TTL. If the TTL is decremented to 0 by a router, it will not be forwarded.
* Changing TTL values is typically done for network probes or when multicasting.
*
* The `ttl` argument may be between 1 and 255\. The default on most systems
* The `ttl` argument may be between between 1 and 255\. The default on most systems
* is 64.
*
* This method throws `EBADF` if called on an unbound socket.
@ -511,7 +465,7 @@ declare module "dgram" {
* process active, allowing the process to exit even if the socket is still
* listening.
*
* Calling `socket.unref()` multiple times will have no additional effect.
* Calling `socket.unref()` multiple times will have no addition effect.
*
* The `socket.unref()` method returns a reference to the socket so calls can be
* chained.
@ -549,48 +503,43 @@ declare module "dgram" {
* 5. message
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "connect", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "listening", listener: () => void): this;
addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
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;
/**
* Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
* @since v20.5.0
*/
[Symbol.asyncDispose](): Promise<void>;
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;
}
}
declare module "node:dgram" {
export * from "dgram";
declare module 'node:dgram' {
export * from 'dgram';
}

443
node_modules/@types/node/ts4.8/diagnostics_channel.d.ts generated vendored Normal file → Executable file
View File

@ -1,11 +1,11 @@
/**
* The `node:diagnostics_channel` module provides an API to create named channels
* The `diagnostics_channel` module provides an API to create named channels
* to report arbitrary message data for diagnostics purposes.
*
* It can be accessed using:
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import diagnostics_channel from 'diagnostics_channel';
* ```
*
* It is intended that a module writer wanting to report diagnostics messages
@ -19,11 +19,10 @@
* channels are used along with the shape of the message data. Channel names
* should generally include the module name to avoid collisions with data from
* other modules.
* @since v15.1.0, v14.17.0
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/diagnostics_channel.js)
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/diagnostics_channel.js)
*/
declare module "diagnostics_channel" {
import { AsyncLocalStorage } from "node:async_hooks";
declare module 'diagnostics_channel' {
/**
* Check if there are active subscribers to the named channel. This is helpful if
* the message you want to send might be expensive to prepare.
@ -32,7 +31,7 @@ declare module "diagnostics_channel" {
* performance-sensitive code.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import diagnostics_channel from 'diagnostics_channel';
*
* if (diagnostics_channel.hasSubscribers('my-channel')) {
* // There are subscribers, prepare and publish message
@ -42,14 +41,14 @@ declare module "diagnostics_channel" {
* @param name The channel name
* @return If there are active subscribers
*/
function hasSubscribers(name: string | symbol): boolean;
function hasSubscribers(name: string): boolean;
/**
* This is the primary entry-point for anyone wanting to publish to a named
* This is the primary entry-point for anyone wanting to interact with a named
* channel. It produces a channel object which is optimized to reduce overhead at
* publish time as much as possible.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import diagnostics_channel from 'diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
* ```
@ -57,86 +56,19 @@ declare module "diagnostics_channel" {
* @param name The channel name
* @return The named channel object
*/
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;
/**
* Creates a `TracingChannel` wrapper for the given `TracingChannel Channels`. If a name is given, the corresponding tracing
* channels will be created in the form of `tracing:${name}:${eventType}` where`eventType` corresponds to the types of `TracingChannel Channels`.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channelsByName = diagnostics_channel.tracingChannel('my-channel');
*
* // or...
*
* const channelsByCollection = diagnostics_channel.tracingChannel({
* start: diagnostics_channel.channel('tracing:my-channel:start'),
* end: diagnostics_channel.channel('tracing:my-channel:end'),
* asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'),
* asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'),
* error: diagnostics_channel.channel('tracing:my-channel:error'),
* });
* ```
* @since v19.9.0
* @experimental
* @param nameOrChannels Channel name or object containing all the `TracingChannel Channels`
* @return Collection of channels to trace with
*/
function tracingChannel<
StoreType = unknown,
ContextType extends object = StoreType extends object ? StoreType : object,
>(
nameOrChannels: string | TracingChannelCollection<StoreType, ContextType>,
): TracingChannel<StoreType, ContextType>;
function channel(name: string): Channel;
type ChannelListener = (message: unknown, name: string) => void;
/**
* The class `Channel` represents an individual named channel within the data
* pipeline. It is used to track subscribers and to publish messages when there
* pipeline. It is use to track subscribers and to publish messages when there
* are subscribers present. It exists as a separate object to avoid channel
* lookups at publish time, enabling very fast publish speeds and allowing
* for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly
* with `new Channel(name)` is not supported.
* @since v15.1.0, v14.17.0
*/
class Channel<StoreType = unknown, ContextType = StoreType> {
readonly name: string | symbol;
class Channel {
readonly name: string;
/**
* Check if there are active subscribers to this channel. This is helpful if
* the message you want to send might be expensive to prepare.
@ -145,7 +77,7 @@ declare module "diagnostics_channel" {
* performance-sensitive code.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import diagnostics_channel from 'diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
*
@ -156,18 +88,19 @@ declare module "diagnostics_channel" {
* @since v15.1.0, v14.17.0
*/
readonly hasSubscribers: boolean;
private constructor(name: string | symbol);
private constructor(name: string);
/**
* Publish a message to any subscribers to the channel. This will trigger
* message handlers synchronously so they will execute within the same context.
* 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';
* import diagnostics_channel from 'diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
*
* channel.publish({
* some: 'message',
* some: 'message'
* });
* ```
* @since v15.1.0, v14.17.0
@ -180,7 +113,7 @@ declare module "diagnostics_channel" {
* errors thrown in the message handler will trigger an `'uncaughtException'`.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import diagnostics_channel from 'diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
*
@ -189,7 +122,6 @@ declare module "diagnostics_channel" {
* });
* ```
* @since v15.1.0, v14.17.0
* @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)}
* @param onMessage The handler to receive channel messages
*/
subscribe(onMessage: ChannelListener): void;
@ -197,7 +129,7 @@ declare module "diagnostics_channel" {
* Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import diagnostics_channel from 'diagnostics_channel';
*
* const channel = diagnostics_channel.channel('my-channel');
*
@ -210,336 +142,11 @@ declare module "diagnostics_channel" {
* channel.unsubscribe(onMessage);
* ```
* @since v15.1.0, v14.17.0
* @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)}
* @param onMessage The previous subscribed handler to remove
* @return `true` if the handler was found, `false` otherwise.
*/
unsubscribe(onMessage: ChannelListener): void;
/**
* When `channel.runStores(context, ...)` is called, the given context data
* will be applied to any store bound to the channel. If the store has already been
* bound the previous `transform` function will be replaced with the new one.
* The `transform` function may be omitted to set the given context data as the
* context directly.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const store = new AsyncLocalStorage();
*
* const channel = diagnostics_channel.channel('my-channel');
*
* channel.bindStore(store, (data) => {
* return { data };
* });
* ```
* @since v19.9.0
* @experimental
* @param store The store to which to bind the context data
* @param transform Transform context data before setting the store context
*/
bindStore(store: AsyncLocalStorage<StoreType>, transform?: (context: ContextType) => StoreType): void;
/**
* Remove a message handler previously registered to this channel with `channel.bindStore(store)`.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const store = new AsyncLocalStorage();
*
* const channel = diagnostics_channel.channel('my-channel');
*
* channel.bindStore(store);
* channel.unbindStore(store);
* ```
* @since v19.9.0
* @experimental
* @param store The store to unbind from the channel.
* @return `true` if the store was found, `false` otherwise.
*/
unbindStore(store: any): void;
/**
* Applies the given data to any AsyncLocalStorage instances bound to the channel
* for the duration of the given function, then publishes to the channel within
* the scope of that data is applied to the stores.
*
* If a transform function was given to `channel.bindStore(store)` it will be
* applied to transform the message data before it becomes the context value for
* the store. The prior storage context is accessible from within the transform
* function in cases where context linking is required.
*
* The context applied to the store should be accessible in any async code which
* continues from execution which began during the given function, however
* there are some situations in which `context loss` may occur.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const store = new AsyncLocalStorage();
*
* const channel = diagnostics_channel.channel('my-channel');
*
* channel.bindStore(store, (message) => {
* const parent = store.getStore();
* return new Span(message, parent);
* });
* channel.runStores({ some: 'message' }, () => {
* store.getStore(); // Span({ some: 'message' })
* });
* ```
* @since v19.9.0
* @experimental
* @param context Message to send to subscribers and bind to stores
* @param fn Handler to run within the entered storage context
* @param thisArg The receiver to be used for the function call.
* @param args Optional arguments to pass to the function.
*/
runStores(): void;
}
interface TracingChannelSubscribers<ContextType extends object> {
start: (message: ContextType) => void;
end: (
message: ContextType & {
error?: unknown;
result?: unknown;
},
) => void;
asyncStart: (
message: ContextType & {
error?: unknown;
result?: unknown;
},
) => void;
asyncEnd: (
message: ContextType & {
error?: unknown;
result?: unknown;
},
) => void;
error: (
message: ContextType & {
error: unknown;
},
) => void;
}
interface TracingChannelCollection<StoreType = unknown, ContextType = StoreType> {
start: Channel<StoreType, ContextType>;
end: Channel<StoreType, ContextType>;
asyncStart: Channel<StoreType, ContextType>;
asyncEnd: Channel<StoreType, ContextType>;
error: Channel<StoreType, ContextType>;
}
/**
* The class `TracingChannel` is a collection of `TracingChannel Channels` which
* together express a single traceable action. It is used to formalize and
* simplify the process of producing events for tracing application flow.{@link tracingChannel} is used to construct a`TracingChannel`. As with `Channel` it is recommended to create and reuse a
* single `TracingChannel` at the top-level of the file rather than creating them
* dynamically.
* @since v19.9.0
* @experimental
*/
class TracingChannel<StoreType = unknown, ContextType extends object = {}> implements TracingChannelCollection {
start: Channel<StoreType, ContextType>;
end: Channel<StoreType, ContextType>;
asyncStart: Channel<StoreType, ContextType>;
asyncEnd: Channel<StoreType, ContextType>;
error: Channel<StoreType, ContextType>;
/**
* Helper to subscribe a collection of functions to the corresponding channels.
* This is the same as calling `channel.subscribe(onMessage)` on each channel
* individually.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.subscribe({
* start(message) {
* // Handle start message
* },
* end(message) {
* // Handle end message
* },
* asyncStart(message) {
* // Handle asyncStart message
* },
* asyncEnd(message) {
* // Handle asyncEnd message
* },
* error(message) {
* // Handle error message
* },
* });
* ```
* @since v19.9.0
* @experimental
* @param subscribers Set of `TracingChannel Channels` subscribers
*/
subscribe(subscribers: TracingChannelSubscribers<ContextType>): void;
/**
* Helper to unsubscribe a collection of functions from the corresponding channels.
* This is the same as calling `channel.unsubscribe(onMessage)` on each channel
* individually.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.unsubscribe({
* start(message) {
* // Handle start message
* },
* end(message) {
* // Handle end message
* },
* asyncStart(message) {
* // Handle asyncStart message
* },
* asyncEnd(message) {
* // Handle asyncEnd message
* },
* error(message) {
* // Handle error message
* },
* });
* ```
* @since v19.9.0
* @experimental
* @param subscribers Set of `TracingChannel Channels` subscribers
* @return `true` if all handlers were successfully unsubscribed, and `false` otherwise.
*/
unsubscribe(subscribers: TracingChannelSubscribers<ContextType>): void;
/**
* Trace a synchronous function call. This will always produce a `start event` and `end event` around the execution and may produce an `error event` if the given function throws an error.
* This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
* events should have any bound stores set to match this trace context.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.traceSync(() => {
* // Do something
* }, {
* some: 'thing',
* });
* ```
* @since v19.9.0
* @experimental
* @param fn Function to wrap a trace around
* @param context Shared object to correlate events through
* @param thisArg The receiver to be used for the function call
* @param args Optional arguments to pass to the function
* @return The return value of the given function
*/
traceSync<ThisArg = any, Args extends any[] = any[]>(
fn: (this: ThisArg, ...args: Args) => any,
context?: ContextType,
thisArg?: ThisArg,
...args: Args
): void;
/**
* Trace a promise-returning function call. This will always produce a `start event` and `end event` around the synchronous portion of the
* function execution, and will produce an `asyncStart event` and `asyncEnd event` when a promise continuation is reached. It may also
* produce an `error event` if the given function throws an error or the
* returned promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
* events should have any bound stores set to match this trace context.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.tracePromise(async () => {
* // Do something
* }, {
* some: 'thing',
* });
* ```
* @since v19.9.0
* @experimental
* @param fn Promise-returning function to wrap a trace around
* @param context Shared object to correlate trace events through
* @param thisArg The receiver to be used for the function call
* @param args Optional arguments to pass to the function
* @return Chained from promise returned by the given function
*/
tracePromise<ThisArg = any, Args extends any[] = any[]>(
fn: (this: ThisArg, ...args: Args) => Promise<any>,
context?: ContextType,
thisArg?: ThisArg,
...args: Args
): void;
/**
* Trace a callback-receiving function call. This will always produce a `start event` and `end event` around the synchronous portion of the
* function execution, and will produce a `asyncStart event` and `asyncEnd event` around the callback execution. It may also produce an `error event` if the given function throws an error or
* the returned
* promise rejects. This will run the given function using `channel.runStores(context, ...)` on the `start` channel which ensures all
* events should have any bound stores set to match this trace context.
*
* The `position` will be -1 by default to indicate the final argument should
* be used as the callback.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
*
* channels.traceCallback((arg1, callback) => {
* // Do something
* callback(null, 'result');
* }, 1, {
* some: 'thing',
* }, thisArg, arg1, callback);
* ```
*
* The callback will also be run with `channel.runStores(context, ...)` which
* enables context loss recovery in some cases.
*
* ```js
* import diagnostics_channel from 'node:diagnostics_channel';
* import { AsyncLocalStorage } from 'node:async_hooks';
*
* const channels = diagnostics_channel.tracingChannel('my-channel');
* const myStore = new AsyncLocalStorage();
*
* // The start channel sets the initial store data to something
* // and stores that store data value on the trace context object
* channels.start.bindStore(myStore, (data) => {
* const span = new Span(data);
* data.span = span;
* return span;
* });
*
* // Then asyncStart can restore from that data it stored previously
* channels.asyncStart.bindStore(myStore, (data) => {
* return data.span;
* });
* ```
* @since v19.9.0
* @experimental
* @param fn callback using function to wrap a trace around
* @param position Zero-indexed argument position of expected callback
* @param context Shared object to correlate trace events through
* @param thisArg The receiver to be used for the function call
* @param args Optional arguments to pass to the function
* @return The return value of the given function
*/
traceCallback<Fn extends (this: any, ...args: any) => any>(
fn: Fn,
position: number | undefined,
context: ContextType | undefined,
thisArg: any,
...args: Parameters<Fn>
): void;
}
}
declare module "node:diagnostics_channel" {
export * from "diagnostics_channel";
declare module 'node:diagnostics_channel' {
export * from 'diagnostics_channel';
}

329
node_modules/@types/node/ts4.8/dns.d.ts generated vendored Normal file → Executable file
View File

@ -1,5 +1,5 @@
/**
* The `node:dns` module enables name resolution. For example, use it to look up IP
* The `dns` module enables name resolution. For example, use it to look up IP
* addresses of host names.
*
* Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
@ -9,7 +9,7 @@
* system do, use {@link lookup}.
*
* ```js
* const dns = require('node:dns');
* const dns = require('dns');
*
* dns.lookup('example.org', (err, address, family) => {
* console.log('address: %j family: IPv%s', address, family);
@ -17,13 +17,13 @@
* // address: "93.184.216.34" family: IPv4
* ```
*
* All other functions in the `node:dns` module connect to an actual DNS server to
* All other functions in the `dns` module connect to an actual DNS server to
* perform name resolution. They will always use the network to perform DNS
* 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
* DNS queries, bypassing other name-resolution facilities.
*
* ```js
* const dns = require('node:dns');
* const dns = require('dns');
*
* dns.resolve4('archive.org', (err, addresses) => {
* if (err) throw err;
@ -42,10 +42,10 @@
* ```
*
* See the `Implementation considerations section` for more information.
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dns.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.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.
export const ADDRCONFIG: number;
export const V4MAPPED: number;
@ -58,9 +58,6 @@ declare module "dns" {
family?: number | undefined;
hints?: number | undefined;
all?: boolean | undefined;
/**
* @default true
*/
verbatim?: boolean | undefined;
}
export interface LookupOneOptions extends LookupOptions {
@ -76,8 +73,8 @@ declare module "dns" {
/**
* Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
* AAAA (IPv6) record. All `option` properties are optional. If `options` is an
* 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.
* integer, then it must be `4` or `6` if `options` is not provided, then IPv4
* and IPv6 addresses are both returned if found.
*
* With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the
* properties `address` and `family`.
@ -89,14 +86,14 @@ declare module "dns" {
*
* `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
* 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
* time to consult the `Implementation considerations section` before using`dns.lookup()`.
*
* Example usage:
*
* ```js
* const dns = require('node:dns');
* const dns = require('dns');
* const options = {
* family: 6,
* hints: dns.ADDRCONFIG | dns.V4MAPPED,
@ -115,30 +112,11 @@ declare module "dns" {
* If this method is invoked as its `util.promisify()` ed version, and `all`is not set to `true`, it returns a `Promise` for an `Object` with `address` and`family` properties.
* @since v0.1.90
*/
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 {
function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
@ -154,7 +132,7 @@ declare module "dns" {
* On an error, `err` is an `Error` object, where `err.code` is the error code.
*
* ```js
* const dns = require('node:dns');
* const dns = require('dns');
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
* console.log(hostname, service);
* // Prints: localhost ssh
@ -164,15 +142,11 @@ declare module "dns" {
* If this method is invoked as its `util.promisify()` ed version, it returns a`Promise` for an `Object` with `hostname` and `service` properties.
* @since v0.11.14
*/
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<{
hostname: string;
service: string;
@ -191,13 +165,13 @@ declare module "dns" {
/** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
export interface AnyARecord extends RecordWithTtl {
type: "A";
type: 'A';
}
export interface AnyAaaaRecord extends RecordWithTtl {
type: "AAAA";
type: 'AAAA';
}
export interface CaaRecord {
critical: number;
critial: number;
issue?: string | undefined;
issuewild?: string | undefined;
iodef?: string | undefined;
@ -209,7 +183,7 @@ declare module "dns" {
exchange: string;
}
export interface AnyMxRecord extends MxRecord {
type: "MX";
type: 'MX';
}
export interface NaptrRecord {
flags: string;
@ -220,7 +194,7 @@ declare module "dns" {
preference: number;
}
export interface AnyNaptrRecord extends NaptrRecord {
type: "NAPTR";
type: 'NAPTR';
}
export interface SoaRecord {
nsname: string;
@ -232,7 +206,7 @@ declare module "dns" {
minttl: number;
}
export interface AnySoaRecord extends SoaRecord {
type: "SOA";
type: 'SOA';
}
export interface SrvRecord {
priority: number;
@ -241,35 +215,25 @@ declare module "dns" {
name: string;
}
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;
/**
* Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
* of the resource records. The `callback` function has arguments`(err, records)`. When successful, `records` will be an array of resource
@ -282,85 +246,32 @@ declare module "dns" {
* @param hostname Host name to resolve.
* @param [rrtype='A'] Resource record type.
*/
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[]>;
}
/**
* Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the`hostname`. The `addresses` argument passed to the `callback` function
@ -368,45 +279,23 @@ declare module "dns" {
* @since v0.1.16
* @param hostname Host name to resolve.
*/
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 {
function __promisify__(hostname: string): Promise<string[]>;
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
}
/**
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
* Uses the DNS protocol to resolve a IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
* will contain an array of IPv6 addresses.
* @since v0.1.16
* @param hostname Host name to resolve.
*/
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 {
function __promisify__(hostname: string): Promise<string[]>;
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
@ -417,10 +306,7 @@ declare module "dns" {
* will contain an array of canonical name records available for the `hostname`(e.g. `['bar.example.com']`).
* @since v0.3.2
*/
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 {
function __promisify__(hostname: string): Promise<string[]>;
}
@ -428,12 +314,9 @@ declare module "dns" {
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. The`addresses` argument passed to the `callback` function
* will contain an array of 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, v14.17.0
* @since v15.0.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 {
function __promisify__(hostname: string): Promise<CaaRecord[]>;
}
@ -442,15 +325,12 @@ declare module "dns" {
* contain an array of objects containing both a `priority` and `exchange`property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
* @since v0.1.27
*/
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 {
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:
*
* * `flags`
@ -472,10 +352,7 @@ declare module "dns" {
* ```
* @since v0.9.12
*/
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 {
function __promisify__(hostname: string): Promise<NaptrRecord[]>;
}
@ -484,10 +361,7 @@ declare module "dns" {
* contain an array of name server records available for `hostname`(e.g. `['ns1.example.com', 'ns2.example.com']`).
* @since v0.1.90
*/
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 {
function __promisify__(hostname: string): Promise<string[]>;
}
@ -496,10 +370,7 @@ declare module "dns" {
* be an array of strings containing the reply records.
* @since v6.0.0
*/
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 {
function __promisify__(hostname: string): Promise<string[]>;
}
@ -529,10 +400,7 @@ declare module "dns" {
* ```
* @since v0.11.10
*/
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 {
function __promisify__(hostname: string): Promise<SoaRecord>;
}
@ -555,10 +423,7 @@ declare module "dns" {
* ```
* @since v0.1.27
*/
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 {
function __promisify__(hostname: string): Promise<SrvRecord[]>;
}
@ -569,10 +434,7 @@ declare module "dns" {
* treated separately.
* @since v0.1.27
*/
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 {
function __promisify__(hostname: string): Promise<string[][]>;
}
@ -606,10 +468,7 @@ declare module "dns" {
* DNS server operators may choose not to respond to `ANY`queries. It may be better to call individual methods like {@link resolve4},{@link resolveMx}, and so on. For more details, see [RFC
* 8482](https://tools.ietf.org/html/rfc8482).
*/
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 {
function __promisify__(hostname: string): Promise<AnyRecord[]>;
}
@ -621,18 +480,7 @@ declare module "dns" {
* one of the `DNS error codes`.
* @since v0.1.16
*/
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";
export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
/**
* Sets the IP address and port of servers to be used when performing DNS
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
@ -661,7 +509,7 @@ declare module "dns" {
* @since v0.11.3
* @param servers array of `RFC 5952` formatted addresses
*/
export function setServers(servers: readonly string[]): void;
export function setServers(servers: ReadonlyArray<string>): void;
/**
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
* that are currently configured for DNS resolution. A string will include a port
@ -679,18 +527,16 @@ declare module "dns" {
*/
export function getServers(): string[];
/**
* Set the default value of `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
* Set the default value of `verbatim` in {@link lookup}. The value could be:
* - `ipv4first`: sets default `verbatim` `false`.
* - `verbatim`: sets default `verbatim` `true`.
*
* * `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'`.
* 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'.
*/
export function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void;
export function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
// Error codes
export const NODATA: string;
export const FORMERR: string;
@ -731,7 +577,7 @@ declare module "dns" {
* other resolvers:
*
* ```js
* const { Resolver } = require('node:dns');
* const { Resolver } = require('dns');
* const resolver = new Resolver();
* resolver.setServers(['4.4.4.4']);
*
@ -741,7 +587,7 @@ declare module "dns" {
* });
* ```
*
* The following methods from the `node:dns` module are available:
* The following methods from the `dns` module are available:
*
* * `resolver.getServers()`
* * `resolver.resolve()`
@ -774,7 +620,6 @@ declare module "dns" {
resolve4: typeof resolve4;
resolve6: typeof resolve6;
resolveAny: typeof resolveAny;
resolveCaa: typeof resolveCaa;
resolveCname: typeof resolveCname;
resolveMx: typeof resolveMx;
resolveNaptr: typeof resolveNaptr;
@ -789,13 +634,13 @@ declare module "dns" {
* This allows programs to specify outbound interfaces when used on multi-homed
* systems.
*
* 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.
*
* The resolver will use the v4 local address when making requests to IPv4 DNS
* servers, and the v6 local address when making requests to IPv6 DNS servers.
* The `rrtype` of resolution requests has no impact on the local address used.
* @since v15.1.0, v14.17.0
* @since v15.1.0
* @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
* @param [ipv6='::0'] A string representation of an IPv6 address.
*/
@ -804,6 +649,6 @@ declare module "dns" {
}
export { dnsPromises as promises };
}
declare module "node:dns" {
export * from "dns";
declare module 'node:dns' {
export * from 'dns';
}

137
node_modules/@types/node/ts4.8/dns/promises.d.ts generated vendored Normal file → Executable file
View File

@ -1,26 +1,26 @@
/**
* 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('node:dns').promises` or `require('node:dns/promises')`.
* via `require('dns').promises` or `require('dns/promises')`.
* @since v10.6.0
*/
declare module "dns/promises" {
declare module 'dns/promises' {
import {
LookupAddress,
LookupOneOptions,
LookupAllOptions,
LookupOptions,
AnyRecord,
CaaRecord,
LookupAddress,
LookupAllOptions,
LookupOneOptions,
LookupOptions,
MxRecord,
NaptrRecord,
SoaRecord,
SrvRecord,
ResolveWithTtlOptions,
RecordWithTtl,
ResolveOptions,
ResolverOptions,
ResolveWithTtlOptions,
SoaRecord,
SrvRecord,
} from "node:dns";
} from 'node:dns';
/**
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
* that are currently configured for DNS resolution. A string will include a port
@ -52,7 +52,7 @@ declare module "dns/promises" {
*
* `dnsPromises.lookup()` does not necessarily have anything to do with the DNS
* 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
* take some time to consult the `Implementation considerations section` before
* using `dnsPromises.lookup()`.
@ -60,7 +60,7 @@ declare module "dns/promises" {
* Example usage:
*
* ```js
* const dns = require('node:dns');
* const dns = require('dns');
* const dnsPromises = dns.promises;
* const options = {
* family: 6,
@ -96,7 +96,7 @@ declare module "dns/promises" {
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code.
*
* ```js
* const dnsPromises = require('node:dns').promises;
* const dnsPromises = require('dns').promises;
* dnsPromises.lookupService('127.0.0.1', 22).then((result) => {
* console.log(result.hostname, result.service);
* // Prints: localhost ssh
@ -106,7 +106,7 @@ declare module "dns/promises" {
*/
function lookupService(
address: string,
port: number,
port: number
): Promise<{
hostname: string;
service: string;
@ -125,22 +125,19 @@ declare module "dns/promises" {
* @param [rrtype='A'] Resource record type.
*/
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[]>;
/**
* Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv4
* addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
@ -192,7 +189,7 @@ declare module "dns/promises" {
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success,
* the `Promise` is resolved with an array of objects containing available
* 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, v14.17.0
* @since v15.0.0
*/
function resolveCaa(hostname: string): Promise<CaaRecord[]>;
/**
@ -209,7 +206,7 @@ declare module "dns/promises" {
*/
function resolveMx(hostname: string): Promise<MxRecord[]>;
/**
* 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:
*
* * `flags`
@ -307,14 +304,6 @@ declare module "dns/promises" {
* @since v10.6.0
*/
function reverse(ip: string): Promise<string[]>;
/**
* 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
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
@ -341,63 +330,18 @@ declare module "dns/promises" {
* @since v10.6.0
* @param servers array of `RFC 5952` formatted addresses
*/
function setServers(servers: readonly string[]): void;
function setServers(servers: ReadonlyArray<string>): void;
/**
* Set the default value of `verbatim` in `dns.lookup()` and `dnsPromises.lookup()`. The value could be:
* Set the default value of `verbatim` in {@link lookup}. The value could be:
* - `ipv4first`: sets default `verbatim` `false`.
* - `verbatim`: sets default `verbatim` `true`.
*
* * `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;
/**
* 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
* 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'.
*/
function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
class Resolver {
constructor(options?: ResolverOptions);
cancel(): void;
@ -406,7 +350,6 @@ declare module "dns/promises" {
resolve4: typeof resolve4;
resolve6: typeof resolve6;
resolveAny: typeof resolveAny;
resolveCaa: typeof resolveCaa;
resolveCname: typeof resolveCname;
resolveMx: typeof resolveMx;
resolveNaptr: typeof resolveNaptr;
@ -420,6 +363,6 @@ declare module "dns/promises" {
setServers: typeof setServers;
}
}
declare module "node:dns/promises" {
export * from "dns/promises";
declare module 'node:dns/promises' {
export * from 'dns/promises';
}

View File

@ -1,122 +0,0 @@
export {}; // Don't export anything!
//// DOM-like Events
// NB: The Event / EventTarget / EventListener implementations below were copied
// from lib.dom.d.ts, then edited to reflect Node's documentation at
// https://nodejs.org/api/events.html#class-eventtarget.
// Please read that link to understand important implementation differences.
// This conditional type will be the existing global Event in a browser, or
// the copy below in a Node environment.
type __Event = typeof globalThis extends { onmessage: any; Event: any } ? {}
: {
/** This is not used in Node.js and is provided purely for completeness. */
readonly bubbles: boolean;
/** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */
cancelBubble: () => void;
/** True if the event was created with the cancelable option */
readonly cancelable: boolean;
/** This is not used in Node.js and is provided purely for completeness. */
readonly composed: boolean;
/** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */
composedPath(): [EventTarget?];
/** Alias for event.target. */
readonly currentTarget: EventTarget | null;
/** Is true if cancelable is true and event.preventDefault() has been called. */
readonly defaultPrevented: boolean;
/** This is not used in Node.js and is provided purely for completeness. */
readonly eventPhase: 0 | 2;
/** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */
readonly isTrusted: boolean;
/** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */
preventDefault(): void;
/** This is not used in Node.js and is provided purely for completeness. */
returnValue: boolean;
/** Alias for event.target. */
readonly srcElement: EventTarget | null;
/** Stops the invocation of event listeners after the current one completes. */
stopImmediatePropagation(): void;
/** This is not used in Node.js and is provided purely for completeness. */
stopPropagation(): void;
/** The `EventTarget` dispatching the event */
readonly target: EventTarget | null;
/** The millisecond timestamp when the Event object was created. */
readonly timeStamp: number;
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */
readonly type: string;
};
// See comment above explaining conditional type
type __EventTarget = typeof globalThis extends { onmessage: any; EventTarget: any } ? {}
: {
/**
* Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
*
* If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched.
*
* The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification.
* Specifically, the `capture` option is used as part of the key when registering a `listener`.
* Any individual `listener` may be added once with `capture = false`, and once with `capture = true`.
*/
addEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: AddEventListenerOptions | boolean,
): void;
/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
dispatchEvent(event: Event): boolean;
/** Removes the event listener in target's event listener list with the same type, callback, and options. */
removeEventListener(
type: string,
listener: EventListener | EventListenerObject,
options?: EventListenerOptions | boolean,
): void;
};
interface EventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
}
interface EventListenerOptions {
/** Not directly used by Node.js. Added for API completeness. Default: `false`. */
capture?: boolean;
}
interface AddEventListenerOptions extends EventListenerOptions {
/** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */
once?: boolean;
/** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
passive?: boolean;
}
interface EventListener {
(evt: Event): void;
}
interface EventListenerObject {
handleEvent(object: Event): void;
}
import {} from "events"; // Make this an ambient declaration
declare global {
/** An event which takes place in the DOM. */
interface Event extends __Event {}
var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
: {
prototype: __Event;
new(type: string, eventInitDict?: EventInit): __Event;
};
/**
* EventTarget is a DOM interface implemented by objects that can
* receive events and may have listeners for them.
*/
interface EventTarget extends __EventTarget {}
var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
: {
prototype: __EventTarget;
new(): __EventTarget;
};
}

16
node_modules/@types/node/ts4.8/domain.d.ts generated vendored Normal file → Executable file
View File

@ -12,10 +12,10 @@
* will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
* exit immediately with an error code.
* @deprecated Since v1.4.2 - Deprecated
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/domain.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/domain.js)
*/
declare module "domain" {
import EventEmitter = require("node:events");
declare module 'domain' {
import EventEmitter = require('node:events');
/**
* The `Domain` class encapsulates the functionality of routing errors and
* uncaught exceptions to the active `Domain` object.
@ -56,15 +56,15 @@ declare module "domain" {
exit(): void;
/**
* Run the supplied function in the context of the domain, implicitly
* binding all event emitters, timers, and low-level requests that are
* binding all event emitters, timers, and lowlevel requests that are
* created in that context. Optionally, arguments can be passed to
* the function.
*
* This is the most basic way to use a domain.
*
* ```js
* const domain = require('node:domain');
* const fs = require('node:fs');
* const domain = require('domain');
* const fs = require('fs');
* const d = domain.create();
* d.on('error', (er) => {
* console.error('Caught error!', er);
@ -165,6 +165,6 @@ declare module "domain" {
}
function create(): Domain;
}
declare module "node:domain" {
export * from "domain";
declare module 'node:domain' {
export * from 'domain';
}

394
node_modules/@types/node/ts4.8/events.d.ts generated vendored Normal file → Executable file
View File

@ -22,7 +22,7 @@
* the `eventEmitter.emit()` method is used to trigger the event.
*
* ```js
* import { EventEmitter } from 'node:events';
* const EventEmitter = require('events');
*
* class MyEmitter extends EventEmitter {}
*
@ -32,61 +32,25 @@
* });
* myEmitter.emit('event');
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/events.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/events.js)
*/
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;
// }
declare module 'events' {
interface EventEmitterOptions {
/**
* Enables automatic capturing of promise rejection.
*/
captureRejections?: boolean | undefined;
}
// Any EventTarget with a Node-style `once` function
interface _NodeEventTarget {
interface NodeEventTarget {
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
}
// Any EventTarget with a DOM-style `addEventListener`
interface _DOMEventTarget {
interface DOMEventTarget {
addEventListener(
eventName: string,
listener: (...args: any[]) => void,
opts?: {
once: boolean;
},
}
): any;
}
interface StaticEventEmitterOptions {
@ -94,10 +58,10 @@ declare module "events" {
}
interface EventEmitter extends NodeJS.EventEmitter {}
/**
* The `EventEmitter` class is defined and exposed by the `node:events` module:
* The `EventEmitter` class is defined and exposed by the `events` module:
*
* ```js
* import { EventEmitter } from 'node:events';
* const EventEmitter = require('events');
* ```
*
* All `EventEmitter`s emit the event `'newListener'` when new listeners are
@ -108,9 +72,6 @@ declare module "events" {
*/
class EventEmitter {
constructor(options?: EventEmitterOptions);
[EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
/**
* Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
* event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
@ -121,28 +82,31 @@ declare module "events" {
* semantics and does not listen to the `'error'` event.
*
* ```js
* import { once, EventEmitter } from 'node:events';
* import process from 'node:process';
* const { once, EventEmitter } = require('events');
*
* const ee = new EventEmitter();
* async function run() {
* 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.error('error happened', err);
* try {
* await once(ee, 'myevent');
* } catch (err) {
* console.log('error happened', err);
* }
* }
*
* run();
* ```
*
* The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the
@ -150,13 +114,13 @@ declare module "events" {
* special handling:
*
* ```js
* import { EventEmitter, once } from 'node:events';
* const { EventEmitter, once } = require('events');
*
* const ee = new EventEmitter();
*
* once(ee, 'error')
* .then(([err]) => console.log('ok', err.message))
* .catch((err) => console.error('error', err.message));
* .catch((err) => console.log('error', err.message));
*
* ee.emit('error', new Error('boom'));
*
@ -166,7 +130,7 @@ declare module "events" {
* An `AbortSignal` can be used to cancel waiting for the event:
*
* ```js
* import { EventEmitter, once } from 'node:events';
* const { EventEmitter, once } = require('events');
*
* const ee = new EventEmitter();
* const ac = new AbortController();
@ -190,32 +154,29 @@ declare module "events" {
* ```
* @since v11.13.0, v10.16.0
*/
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
* import { on, EventEmitter } from 'node:events';
* import process from 'node:process';
* const { on, EventEmitter } = require('events');
*
* const ee = new EventEmitter();
* (async () => {
* 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
* })();
* ```
*
* Returns an `AsyncIterator` that iterates `eventName` events. It will throw
@ -226,9 +187,7 @@ declare module "events" {
* An `AbortSignal` can be used to cancel waiting on events:
*
* ```js
* import { on, EventEmitter } from 'node:events';
* import process from 'node:process';
*
* const { on, EventEmitter } = require('events');
* const ac = new AbortController();
*
* (async () => {
@ -255,17 +214,12 @@ declare module "events" {
* @param eventName The name of the event being listened for
* @return that iterates `eventName` events emitted by the `emitter`
*/
static on(
emitter: NodeJS.EventEmitter,
eventName: string,
options?: StaticEventEmitterOptions,
): AsyncIterableIterator<any>;
static on(emitter: NodeJS.EventEmitter, eventName: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>;
/**
* A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
*
* ```js
* import { EventEmitter, listenerCount } from 'node:events';
*
* const { EventEmitter, listenerCount } = require('events');
* const myEmitter = new EventEmitter();
* myEmitter.on('event', () => {});
* myEmitter.on('event', () => {});
@ -288,56 +242,30 @@ declare module "events" {
* event target. This is useful for debugging and diagnostic purposes.
*
* ```js
* import { getEventListeners, EventEmitter } from 'node:events';
* const { getEventListeners, EventEmitter } = require('events');
*
* {
* const ee = new EventEmitter();
* const listener = () => console.log('Events are fun');
* ee.on('foo', listener);
* console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
* getEventListeners(ee, 'foo'); // [listener]
* }
* {
* const et = new EventTarget();
* const listener = () => console.log('Events are fun');
* et.addEventListener('foo', listener);
* console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
* getEventListeners(et, 'foo'); // [listener]
* }
* ```
* @since v15.2.0, v14.17.0
* @since v15.2.0
*/
static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
/**
* Returns the currently set max amount of listeners.
*
* 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;
static getEventListeners(emitter: DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
/**
* ```js
* import { setMaxListeners, EventEmitter } from 'node:events';
* const {
* setMaxListeners,
* EventEmitter
* } = require('events');
*
* const target = new EventTarget();
* const emitter = new EventEmitter();
@ -349,103 +277,26 @@ declare module "events" {
* @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;
static setMaxListeners(n?: number, ...eventTargets: Array<DOMEventTarget | NodeJS.EventEmitter>): void;
/**
* Listens once to the `abort` event on the provided `signal`.
* 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.
*
* 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
* 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;
/**
* 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
* Sets or gets the default captureRejection value for all emitters.
*/
// 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 {
// Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4
export { internal as EventEmitter };
@ -455,89 +306,10 @@ declare module "events" {
*/
signal?: AbortSignal | undefined;
}
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;
}
}
global {
namespace NodeJS {
interface EventEmitter {
[EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
/**
* Alias for `emitter.on(eventName, listener)`.
* @since v0.1.26
@ -561,7 +333,6 @@ declare module "events" {
* event listener to the beginning of the listeners array.
*
* ```js
* import { EventEmitter } from 'node:events';
* const myEE = new EventEmitter();
* myEE.on('foo', () => console.log('a'));
* myEE.prependListener('foo', () => console.log('b'));
@ -591,7 +362,6 @@ declare module "events" {
* event listener to the beginning of the listeners array.
*
* ```js
* import { EventEmitter } from 'node:events';
* const myEE = new EventEmitter();
* myEE.once('foo', () => console.log('a'));
* myEE.prependOnceListener('foo', () => console.log('b'));
@ -623,12 +393,10 @@ declare module "events" {
* called multiple times to remove each instance.
*
* 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();
*
* const callbackA = () => {
@ -669,7 +437,6 @@ declare module "events" {
* recently added instance. In the example the `once('ping')`listener is removed:
*
* ```js
* import { EventEmitter } from 'node:events';
* const ee = new EventEmitter();
*
* function pong() {
@ -738,7 +505,6 @@ declare module "events" {
* including any wrappers (such as those created by `.once()`).
*
* ```js
* import { EventEmitter } from 'node:events';
* const emitter = new EventEmitter();
* emitter.once('log', () => console.log('log once'));
*
@ -771,7 +537,7 @@ declare module "events" {
* Returns `true` if the event had listeners, `false` otherwise.
*
* ```js
* import { EventEmitter } from 'node:events';
* const EventEmitter = require('events');
* const myEmitter = new EventEmitter();
*
* // First listener
@ -806,14 +572,11 @@ declare module "events" {
*/
emit(eventName: string | symbol, ...args: any[]): boolean;
/**
* 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.
* Returns the number of listeners listening to the event named `eventName`.
* @since v3.2.0
* @param eventName The name of the event being listened for
* @param listener The event handler function
*/
listenerCount(eventName: string | symbol, listener?: Function): number;
listenerCount(eventName: string | symbol): number;
/**
* Adds the `listener` function to the _beginning_ of the listeners array for the
* event named `eventName`. No checks are made to see if the `listener` has
@ -833,7 +596,7 @@ declare module "events" {
*/
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): 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
* 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.
*
* ```js
@ -853,8 +616,7 @@ declare module "events" {
* listeners. The values in the array are strings or `Symbol`s.
*
* ```js
* import { EventEmitter } from 'node:events';
*
* const EventEmitter = require('events');
* const myEE = new EventEmitter();
* myEE.on('foo', () => {});
* myEE.on('bar', () => {});
@ -873,7 +635,7 @@ declare module "events" {
}
export = EventEmitter;
}
declare module "node:events" {
import events = require("events");
declare module 'node:events' {
import events = require('events');
export = events;
}

1374
node_modules/@types/node/ts4.8/fs.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

411
node_modules/@types/node/ts4.8/fs/promises.d.ts generated vendored Normal file → Executable file
View File

@ -8,13 +8,11 @@
* concurrent modifications on the same file or data corruption may occur.
* @since v10.0.0
*/
declare module "fs/promises" {
import { Abortable } from "node:events";
import { Stream } from "node:stream";
import { ReadableStream } from "node:stream/web";
declare module 'fs/promises' {
import { Abortable } from 'node:events';
import { Stream } from 'node:stream';
import {
BigIntStats,
BigIntStatsFs,
BufferEncodingOption,
constants as fsConstants,
CopyOptions,
@ -30,30 +28,26 @@ declare module "fs/promises" {
ReadVResult,
RmDirOptions,
RmOptions,
StatFsOptions,
StatOptions,
Stats,
StatsFs,
TimeLike,
WatchEventType,
WatchOptions,
WriteStream,
WriteVResult,
} from "node:fs";
import { Interface as ReadlineInterface } from "node:readline";
} from 'node:fs';
interface FileChangeInfo<T extends string | Buffer> {
eventType: WatchEventType;
filename: T | null;
filename: T;
}
interface FlagAndOpenMode {
mode?: Mode | undefined;
flag?: OpenMode | undefined;
}
interface FileReadResult<T extends NodeJS.ArrayBufferView> {
interface FileReadResult<T extends ArrayBufferView> {
bytesRead: number;
buffer: T;
}
interface FileReadOptions<T extends NodeJS.ArrayBufferView = Buffer> {
interface FileReadOptions<T extends ArrayBufferView = Buffer> {
/**
* @default `Buffer.alloc(0xffff)`
*/
@ -81,15 +75,6 @@ declare module "fs/promises" {
autoClose?: boolean | undefined;
emitClose?: boolean | undefined;
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
interface FileHandle {
@ -106,13 +91,7 @@ declare module "fs/promises" {
* @since v10.0.0
* @return Fulfills with `undefined` upon success.
*/
appendFile(
data: string | Uint8Array,
options?:
| (ObjectEncodingOptions & FlagAndOpenMode & { flush?: boolean | undefined })
| BufferEncoding
| null,
): Promise<void>;
appendFile(data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding | null): Promise<void>;
/**
* Changes the ownership of the file. A wrapper for [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html).
* @since v10.0.0
@ -129,8 +108,8 @@ declare module "fs/promises" {
*/
chmod(mode: Mode): Promise<void>;
/**
* Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream
* returned by this method has a default `highWaterMark` of 64 KiB.
* Unlike the 16 kb default `highWaterMark` for a `stream.Readable`, the stream
* returned by this method has a default `highWaterMark` of 64 kb.
*
* `options` can include `start` and `end` values to read a range of bytes from
* the file instead of the entire file. Both `start` and `end` are inclusive and
@ -148,7 +127,7 @@ declare module "fs/promises" {
* destroyed. Set the `emitClose` option to `false` to change this behavior.
*
* ```js
* import { open } from 'node:fs/promises';
* import { open } from 'fs/promises';
*
* const fd = await open('/dev/input/event0');
* // Create a stream from some character device.
@ -174,7 +153,7 @@ declare module "fs/promises" {
* An example to read the last 10 bytes of a file which is 100 bytes long:
*
* ```js
* import { open } from 'node:fs/promises';
* import { open } from 'fs/promises';
*
* const fd = await open('sample.txt');
* fd.createReadStream({ start: 90, end: 99 });
@ -185,9 +164,9 @@ declare module "fs/promises" {
/**
* `options` may also include a `start` option to allow writing data at some
* 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`.
*
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
* then the file descriptor won't be closed, even if there's an error.
@ -213,7 +192,7 @@ declare module "fs/promises" {
* device. The specific implementation is operating system and device specific.
* Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail.
* @since v10.0.0
* @return Fulfills with `undefined` upon success.
* @return Fufills with `undefined` upon success.
*/
sync(): Promise<void>;
/**
@ -229,38 +208,8 @@ declare module "fs/promises" {
* integer, the current file position will remain unchanged.
* @return Fulfills upon success with an object with two properties:
*/
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;
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>>;
/**
* Asynchronously reads the entire contents of a file.
*
@ -279,7 +228,7 @@ declare module "fs/promises" {
options?: {
encoding?: null | undefined;
flag?: OpenMode | undefined;
} | null,
} | null
): Promise<Buffer>;
/**
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
@ -290,10 +239,10 @@ declare module "fs/promises" {
readFile(
options:
| {
encoding: BufferEncoding;
flag?: OpenMode | undefined;
}
| BufferEncoding,
encoding: BufferEncoding;
flag?: OpenMode | undefined;
}
| BufferEncoding
): Promise<string>;
/**
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
@ -304,27 +253,11 @@ declare module "fs/promises" {
readFile(
options?:
| (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
* @return Fulfills with an {fs.Stats} for the file.
@ -332,12 +265,12 @@ declare module "fs/promises" {
stat(
opts?: StatOptions & {
bigint?: false | undefined;
},
}
): Promise<Stats>;
stat(
opts: StatOptions & {
bigint: true;
},
}
): Promise<BigIntStats>;
stat(opts?: StatOptions): Promise<Stats | BigIntStats>;
/**
@ -349,7 +282,7 @@ declare module "fs/promises" {
* The following example retains only the first four bytes of the file:
*
* ```js
* import { open } from 'node:fs/promises';
* import { open } from 'fs/promises';
*
* let filehandle = null;
* try {
@ -370,58 +303,55 @@ declare module "fs/promises" {
*/
truncate(len?: number): Promise<void>;
/**
* Change the file system timestamps of the object referenced by the `FileHandle` then fulfills the promise with no arguments upon success.
* Change the file system timestamps of the object referenced by the `FileHandle` then resolves the promise with no arguments upon success.
* @since v10.0.0
*/
utimes(atime: TimeLike, mtime: TimeLike): Promise<void>;
utimes(atime: string | number | Date, mtime: string | number | Date): 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 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.
* [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.
*
* If `options` is a string, then it specifies the `encoding`.
*
* The `FileHandle` has to support writing.
*
* It is unsafe to use `filehandle.writeFile()` multiple times on the same file
* without waiting for the promise to be fulfilled (or rejected).
* without waiting for the promise to be resolved (or rejected).
*
* 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
* current position till the end of the file. It doesn't always write from the
* beginning of the file.
* @since v10.0.0
*/
writeFile(
data: string | Uint8Array,
options?:
| (ObjectEncodingOptions & FlagAndOpenMode & Abortable & { flush?: boolean | undefined })
| BufferEncoding
| null,
): Promise<void>;
writeFile(data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode & Abortable) | BufferEncoding | null): Promise<void>;
/**
* Write `buffer` to the file.
*
* The promise is fulfilled with an object containing two properties:
* If `buffer` is a plain object, it must have an own (not inherited) `toString`function property.
*
* 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 fulfilled (or rejected). For this
* scenario, use `filehandle.createWriteStream()`.
* without waiting for the promise to be resolved (or rejected). For this
* scenario, use `fs.createWriteStream()`.
*
* On Linux, positional writes do not work when the file is opened in append mode.
* The kernel ignores the position argument and always appends the data to
* the end of the file.
* @since v10.0.0
* @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.
* @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.
*/
write<TBuffer extends Uint8Array>(
buffer: TBuffer,
offset?: number | null,
length?: number | null,
position?: number | null,
position?: number | null
): Promise<{
bytesWritten: number;
buffer: TBuffer;
@ -429,7 +359,7 @@ declare module "fs/promises" {
write(
data: string,
position?: number | null,
encoding?: BufferEncoding | null,
encoding?: BufferEncoding | null
): Promise<{
bytesWritten: number;
buffer: string;
@ -437,32 +367,32 @@ declare module "fs/promises" {
/**
* Write an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s to the file.
*
* The promise is fulfilled with an object containing a two properties:
* The promise is resolved 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 fulfilled (or rejected).
* for the promise to be resolved (or rejected).
*
* On Linux, positional writes don't work when the file is opened in append mode.
* The kernel ignores the position argument and always appends the data to
* the end of the file.
* @since v12.9.0
* @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
* @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
* position.
*/
writev(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
writev(buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<WriteVResult>;
/**
* Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s
* @since v13.13.0, v12.17.0
* @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position.
* @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.
* @return Fulfills upon success an object containing two properties:
*/
readv(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise<ReadVResult>;
readv(buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<ReadVResult>;
/**
* Closes the file handle after waiting for any pending operation on the handle to
* complete.
*
* ```js
* import { open } from 'node:fs/promises';
* import { open } from 'fs/promises';
*
* let filehandle;
* try {
@ -475,27 +405,24 @@ declare module "fs/promises" {
* @return Fulfills with `undefined` upon success.
*/
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. `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`.
* 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`).
*
* If the accessibility check is successful, the promise is fulfilled with no
* If the accessibility check is successful, the promise is resolved with no
* value. If any of the accessibility checks fail, the promise is rejected
* 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
* written by the current process.
*
* ```js
* import { access, constants } from 'node:fs/promises';
* import { access } from 'fs/promises';
* import { constants } from 'fs';
*
* try {
* await access('/etc/passwd', constants.R_OK | constants.W_OK);
@ -524,13 +451,14 @@ declare module "fs/promises" {
* will be made to remove the destination.
*
* ```js
* import { copyFile, constants } from 'node:fs/promises';
* import { constants } from 'fs';
* import { copyFile } from 'fs/promises';
*
* try {
* await copyFile('source.txt', 'destination.txt');
* console.log('source.txt was copied to destination.txt');
* } catch {
* console.error('The file could not be copied');
* console.log('The file could not be copied');
* }
*
* // By using COPYFILE_EXCL, the operation will fail if destination.txt exists.
@ -538,7 +466,7 @@ declare module "fs/promises" {
* await copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL);
* console.log('source.txt was copied to destination.txt');
* } catch {
* console.error('The file could not be copied');
* console.log('The file could not be copied');
* }
* ```
* @since v10.0.0
@ -600,19 +528,6 @@ declare module "fs/promises" {
* and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fsPromises.mkdir()` when `path` is a directory
* that exists results in a
* 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
* @return Upon success, fulfills with `undefined` if `recursive` is `false`, or the first directory path created if `recursive` is `true`.
*/
@ -620,7 +535,7 @@ declare module "fs/promises" {
path: PathLike,
options: MakeDirectoryOptions & {
recursive: true;
},
}
): Promise<string | undefined>;
/**
* Asynchronous mkdir(2) - create a directory.
@ -633,9 +548,9 @@ declare module "fs/promises" {
options?:
| Mode
| (MakeDirectoryOptions & {
recursive?: false | undefined;
})
| null,
recursive?: false | undefined;
})
| null
): Promise<void>;
/**
* Asynchronous mkdir(2) - create a directory.
@ -652,10 +567,10 @@ declare module "fs/promises" {
* the filenames. If the `encoding` is set to `'buffer'`, the filenames returned
* will be passed as `Buffer` objects.
*
* If `options.withFileTypes` is set to `true`, the returned array will contain `fs.Dirent` objects.
* If `options.withFileTypes` is set to `true`, the resolved array will contain `fs.Dirent` objects.
*
* ```js
* import { readdir } from 'node:fs/promises';
* import { readdir } from 'fs/promises';
*
* try {
* const files = await readdir(path);
@ -672,11 +587,10 @@ declare module "fs/promises" {
path: PathLike,
options?:
| (ObjectEncodingOptions & {
withFileTypes?: false | undefined;
recursive?: boolean | undefined;
})
withFileTypes?: false | undefined;
})
| BufferEncoding
| null,
| null
): Promise<string[]>;
/**
* Asynchronous readdir(3) - read a directory.
@ -687,11 +601,10 @@ declare module "fs/promises" {
path: PathLike,
options:
| {
encoding: "buffer";
withFileTypes?: false | undefined;
recursive?: boolean | undefined;
}
| "buffer",
encoding: 'buffer';
withFileTypes?: false | undefined;
}
| 'buffer'
): Promise<Buffer[]>;
/**
* Asynchronous readdir(3) - read a directory.
@ -702,11 +615,10 @@ declare module "fs/promises" {
path: PathLike,
options?:
| (ObjectEncodingOptions & {
withFileTypes?: false | undefined;
recursive?: boolean | undefined;
})
withFileTypes?: false | undefined;
})
| BufferEncoding
| null,
| null
): Promise<string[] | Buffer[]>;
/**
* Asynchronous readdir(3) - read a directory.
@ -717,12 +629,11 @@ declare module "fs/promises" {
path: PathLike,
options: ObjectEncodingOptions & {
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
* fulfilled with the`linkString` upon success.
* resolved with the`linkString` upon success.
*
* The optional `options` argument can be a string specifying an encoding, or an
* object with an `encoding` property specifying the character encoding to use for
@ -747,14 +658,11 @@ declare module "fs/promises" {
/**
* Creates a symbolic link.
*
* 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.
* 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.
* @since v10.0.0
* @param [type='null']
* @param [type='file']
* @return Fulfills with `undefined` upon success.
*/
function symlink(target: PathLike, path: PathLike, type?: string | null): Promise<void>;
@ -769,13 +677,13 @@ declare module "fs/promises" {
path: PathLike,
opts?: StatOptions & {
bigint?: false | undefined;
},
}
): Promise<Stats>;
function lstat(
path: PathLike,
opts: StatOptions & {
bigint: true;
},
}
): Promise<BigIntStats>;
function lstat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
/**
@ -786,32 +694,15 @@ declare module "fs/promises" {
path: PathLike,
opts?: StatOptions & {
bigint?: false | undefined;
},
}
): Promise<Stats>;
function stat(
path: PathLike,
opts: StatOptions & {
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.
* @since v10.0.0
@ -853,7 +744,7 @@ declare module "fs/promises" {
* @since v14.5.0, v12.19.0
* @return Fulfills with `undefined` upon success.
*/
function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise<void>;
function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
/**
* Changes the ownership of a file.
* @since v10.0.0
@ -867,11 +758,11 @@ declare module "fs/promises" {
*
* * Values can be either numbers representing Unix epoch time, `Date`s, or a
* 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: TimeLike, mtime: TimeLike): Promise<void>;
function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
/**
* Determines the actual location of `path` using the same semantics as the`fs.realpath.native()` function.
*
@ -900,10 +791,7 @@ declare module "fs/promises" {
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
*/
function realpath(
path: PathLike,
options?: ObjectEncodingOptions | BufferEncoding | null,
): Promise<string | Buffer>;
function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
/**
* Creates a unique temporary directory. A unique directory name is generated by
* appending six random characters to the end of the provided `prefix`. Due to
@ -915,12 +803,10 @@ declare module "fs/promises" {
* object with an `encoding` property specifying the character encoding to use.
*
* ```js
* import { mkdtemp } from 'node:fs/promises';
* import { join } from 'node:path';
* import { tmpdir } from 'node:os';
* import { mkdtemp } from 'fs/promises';
*
* try {
* await mkdtemp(join(tmpdir(), 'foo-'));
* await mkdtemp(path.join(os.tmpdir(), 'foo-'));
* } catch (err) {
* console.error(err);
* }
@ -929,9 +815,9 @@ declare module "fs/promises" {
* The `fsPromises.mkdtemp()` method will append the six randomly selected
* characters directly to the `prefix` string. For instance, given a directory`/tmp`, if the intention is to create a temporary directory _within_`/tmp`, the`prefix` must end with a trailing
* platform-specific path separator
* (`require('node:path').sep`).
* (`require('path').sep`).
* @since v10.0.0
* @return Fulfills with a string containing the file system path of the newly created temporary directory.
* @return Fulfills with a string containing the filesystem path of the newly created temporary directory.
*/
function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
/**
@ -947,9 +833,7 @@ declare module "fs/promises" {
*/
function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
/**
* 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.
* 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.
*
* The `encoding` option is ignored if `data` is a buffer.
*
@ -964,15 +848,15 @@ declare module "fs/promises" {
*
* Similarly to `fsPromises.readFile` \- `fsPromises.writeFile` is a convenience
* method that performs multiple `write` calls internally to write the buffer
* passed to it. For performance sensitive code consider using `fs.createWriteStream()` or `filehandle.createWriteStream()`.
* passed to it. For performance sensitive code consider using `fs.createWriteStream()`.
*
* It is possible to use an `AbortSignal` to cancel an `fsPromises.writeFile()`.
* Cancelation is "best effort", and some amount of data is likely still
* to be written.
*
* ```js
* import { writeFile } from 'node:fs/promises';
* import { Buffer } from 'node:buffer';
* import { writeFile } from 'fs/promises';
* import { Buffer } from 'buffer';
*
* try {
* const controller = new AbortController();
@ -998,19 +882,14 @@ declare module "fs/promises" {
*/
function writeFile(
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>;
/**
* Asynchronously append data to a file, creating the file if it does not yet
@ -1026,11 +905,7 @@ declare module "fs/promises" {
* @param path filename or {FileHandle}
* @return Fulfills with `undefined` upon success.
*/
function appendFile(
path: PathLike | FileHandle,
data: string | Uint8Array,
options?: (ObjectEncodingOptions & FlagAndOpenMode & { flush?: boolean | undefined }) | BufferEncoding | null,
): Promise<void>;
function appendFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding | null): Promise<void>;
/**
* Asynchronously reads the entire contents of a file.
*
@ -1044,25 +919,11 @@ declare module "fs/promises" {
* with an error. On FreeBSD, a representation of the directory's contents will be
* returned.
*
* 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
* request is aborted the promise returned is rejected with an `AbortError`:
*
* ```js
* import { readFile } from 'node:fs/promises';
* import { readFile } from 'fs/promises';
*
* try {
* const controller = new AbortController();
@ -1091,10 +952,10 @@ declare module "fs/promises" {
path: PathLike | FileHandle,
options?:
| ({
encoding?: null | undefined;
flag?: OpenMode | undefined;
} & Abortable)
| null,
encoding?: null | undefined;
flag?: OpenMode | undefined;
} & Abortable)
| null
): Promise<Buffer>;
/**
* Asynchronously reads the entire contents of a file.
@ -1107,10 +968,10 @@ declare module "fs/promises" {
path: PathLike | FileHandle,
options:
| ({
encoding: BufferEncoding;
flag?: OpenMode | undefined;
} & Abortable)
| BufferEncoding,
encoding: BufferEncoding;
flag?: OpenMode | undefined;
} & Abortable)
| BufferEncoding
): Promise<string>;
/**
* Asynchronously reads the entire contents of a file.
@ -1122,15 +983,12 @@ declare module "fs/promises" {
function readFile(
path: PathLike | FileHandle,
options?:
| (
& ObjectEncodingOptions
& Abortable
& {
flag?: OpenMode | undefined;
}
)
| (ObjectEncodingOptions &
Abortable & {
flag?: OpenMode | undefined;
})
| BufferEncoding
| null,
| null
): Promise<string | Buffer>;
/**
* Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail.
@ -1144,7 +1002,7 @@ declare module "fs/promises" {
* Example using async iteration:
*
* ```js
* import { opendir } from 'node:fs/promises';
* import { opendir } from 'fs/promises';
*
* try {
* const dir = await opendir('./');
@ -1165,7 +1023,7 @@ declare module "fs/promises" {
* Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
*
* ```js
* const { watch } = require('node:fs/promises');
* const { watch } = require('fs/promises');
*
* const ac = new AbortController();
* const { signal } = ac;
@ -1188,16 +1046,16 @@ declare module "fs/promises" {
* disappears in the directory.
*
* All the `caveats` for `fs.watch()` also apply to `fsPromises.watch()`.
* @since v15.9.0, v14.18.0
* @since v15.9.0
* @return of objects with the properties:
*/
function watch(
filename: PathLike,
options:
| (WatchOptions & {
encoding: "buffer";
})
| "buffer",
encoding: 'buffer';
})
| 'buffer'
): AsyncIterable<FileChangeInfo<Buffer>>;
/**
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
@ -1216,10 +1074,7 @@ declare module "fs/promises" {
* If `persistent` is not supplied, the default of `true` is used.
* If `recursive` is not supplied, the default of `false` is used.
*/
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>>;
/**
* Asynchronously copies the entire directory structure from `src` to `dest`,
* including subdirectories and files.
@ -1234,6 +1089,6 @@ declare module "fs/promises" {
*/
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';
}

613
node_modules/@types/node/ts4.8/globals.d.ts generated vendored Normal file → Executable file
View File

@ -1,411 +1,284 @@
export {}; // Make this a module
// #region Fetch and friends
// Conditional type aliases, used at the end of this file.
// Will either be empty if lib-dom is included, or the undici version otherwise.
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 _ResponseInit = typeof globalThis extends { onmessage: any } ? {}
: import("undici-types").ResponseInit;
type _File = typeof globalThis extends { onmessage: any } ? {} : import("node:buffer").File;
// #endregion Fetch and friends
declare global {
// Declare "static" methods in Error
interface ErrorConstructor {
/** Create .stack property on a target object */
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
/**
* Optional override for formatting stack traces
*
* @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
*/
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
stackTraceLimit: number;
}
/*-----------------------------------------------*
* *
* GLOBAL *
* *
------------------------------------------------*/
// For backwards compability
interface NodeRequire extends NodeJS.Require {}
interface RequireResolve extends NodeJS.RequireResolve {}
interface NodeModule extends NodeJS.Module {}
var process: NodeJS.Process;
var console: Console;
var __filename: string;
var __dirname: string;
var require: NodeRequire;
var module: NodeModule;
// Same as module.exports
var exports: any;
// Declare "static" methods in Error
interface ErrorConstructor {
/** Create .stack property on a target object */
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
/**
* Only available if `--expose-gc` is passed to the process.
*/
var gc: undefined | (() => void);
// #region borrowed
// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
/** A controller object that allows you to abort one or more DOM requests as and when desired. */
interface AbortController {
/**
* Returns the AbortSignal object associated with this object.
*/
readonly signal: AbortSignal;
/**
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
*/
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 extends EventTarget {
/**
* 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;
}
var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
: {
prototype: AbortController;
new(): AbortController;
};
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 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> {
/**
* Takes an integer value and returns the item at that index,
* allowing for positive and negative integers.
* Negative integers count back from the last item in the array.
*/
at(index: number): T | undefined;
}
interface String extends RelativeIndexable<string> {}
interface Array<T> extends RelativeIndexable<T> {}
interface ReadonlyArray<T> extends RelativeIndexable<T> {}
interface Int8Array extends RelativeIndexable<number> {}
interface Uint8Array extends RelativeIndexable<number> {}
interface Uint8ClampedArray extends RelativeIndexable<number> {}
interface Int16Array extends RelativeIndexable<number> {}
interface Uint16Array extends RelativeIndexable<number> {}
interface Int32Array extends RelativeIndexable<number> {}
interface Uint32Array extends RelativeIndexable<number> {}
interface Float32Array extends RelativeIndexable<number> {}
interface Float64Array extends RelativeIndexable<number> {}
interface BigInt64Array extends RelativeIndexable<bigint> {}
interface BigUint64Array extends RelativeIndexable<bigint> {}
// #endregion ArrayLike.at() end
/**
* @since v17.0.0
* Optional override for formatting stack traces
*
* Creates a deep clone of an object.
* @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
*/
function structuredClone<T>(
value: T,
transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> },
): T;
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
/*----------------------------------------------*
* *
* GLOBAL INTERFACES *
* *
*-----------------------------------------------*/
namespace NodeJS {
interface CallSite {
/**
* Value of "this"
*/
getThis(): unknown;
stackTraceLimit: number;
}
/**
* Type of "this" as a string.
* This is the name of the function stored in the constructor field of
* "this", if available. Otherwise the object's [[Class]] internal
* property.
*/
getTypeName(): string | null;
/*-----------------------------------------------*
* *
* GLOBAL *
* *
------------------------------------------------*/
/**
* Current function
*/
getFunction(): Function | undefined;
// For backwards compability
interface NodeRequire extends NodeJS.Require { }
interface RequireResolve extends NodeJS.RequireResolve { }
interface NodeModule extends NodeJS.Module { }
/**
* Name of the current function, typically its name property.
* If a name property is not available an attempt will be made to try
* to infer a name from the function's context.
*/
getFunctionName(): string | null;
declare var process: NodeJS.Process;
declare var console: Console;
/**
* Name of the property [of "this" or one of its prototypes] that holds
* the current function
*/
getMethodName(): string | null;
declare var __filename: string;
declare var __dirname: string;
/**
* Name of the script [if this function was defined in a script]
*/
getFileName(): string | undefined;
declare var require: NodeRequire;
declare var module: NodeModule;
/**
* Current line number [if this function was defined in a script]
*/
getLineNumber(): number | null;
// Same as module.exports
declare var exports: any;
/**
* Current column number [if this function was defined in a script]
*/
getColumnNumber(): number | null;
/**
* Only available if `--expose-gc` is passed to the process.
*/
declare var gc: undefined | (() => void);
/**
* A call site object representing the location where eval was called
* [if this function was created using a call to eval]
*/
getEvalOrigin(): string | undefined;
//#region borrowed
// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
/** A controller object that allows you to abort one or more DOM requests as and when desired. */
interface AbortController {
/**
* Returns the AbortSignal object associated with this object.
*/
/**
* Is this a toplevel invocation, that is, is "this" the global object?
*/
isToplevel(): boolean;
readonly signal: AbortSignal;
/**
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
*/
abort(): void;
}
/**
* Does this call take place in code defined by a call to eval?
*/
isEval(): boolean;
/** 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 {
/**
* Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
*/
readonly aborted: boolean;
}
/**
* Is this call in native V8 code?
*/
isNative(): boolean;
declare var AbortController: {
prototype: AbortController;
new(): AbortController;
};
/**
* Is this a constructor call?
*/
isConstructor(): boolean;
declare var AbortSignal: {
prototype: AbortSignal;
new(): AbortSignal;
// TODO: Add abort() static
};
//#endregion borrowed
/**
* is this an async call (i.e. await, Promise.all(), or Promise.any())?
*/
isAsync(): boolean;
//#region ArrayLike.at()
interface RelativeIndexable<T> {
/**
* Takes an integer value and returns the item at that index,
* allowing for positive and negative integers.
* Negative integers count back from the last item in the array.
*/
at(index: number): T | undefined;
}
interface String extends RelativeIndexable<string> {}
interface Array<T> extends RelativeIndexable<T> {}
interface Int8Array extends RelativeIndexable<number> {}
interface Uint8Array extends RelativeIndexable<number> {}
interface Uint8ClampedArray extends RelativeIndexable<number> {}
interface Int16Array extends RelativeIndexable<number> {}
interface Uint16Array extends RelativeIndexable<number> {}
interface Int32Array extends RelativeIndexable<number> {}
interface Uint32Array extends RelativeIndexable<number> {}
interface Float32Array extends RelativeIndexable<number> {}
interface Float64Array extends RelativeIndexable<number> {}
interface BigInt64Array extends RelativeIndexable<bigint> {}
interface BigUint64Array extends RelativeIndexable<bigint> {}
//#endregion ArrayLike.at() end
/**
* is this an async call to Promise.all()?
*/
isPromiseAll(): boolean;
/*----------------------------------------------*
* *
* GLOBAL INTERFACES *
* *
*-----------------------------------------------*/
declare namespace NodeJS {
interface CallSite {
/**
* Value of "this"
*/
getThis(): unknown;
/**
* returns the index of the promise element that was followed in
* Promise.all() or Promise.any() for async stack traces, or null
* if the CallSite is not an async
*/
getPromiseIndex(): number | null;
/**
* Type of "this" as a string.
* This is the name of the function stored in the constructor field of
* "this", if available. Otherwise the object's [[Class]] internal
* property.
*/
getTypeName(): string | null;
getScriptNameOrSourceURL(): string;
getScriptHash(): string;
/**
* Current function
*/
getFunction(): Function | undefined;
getEnclosingColumnNumber(): number;
getEnclosingLineNumber(): number;
getPosition(): number;
/**
* Name of the current function, typically its name property.
* If a name property is not available an attempt will be made to try
* to infer a name from the function's context.
*/
getFunctionName(): string | null;
toString(): string;
}
/**
* Name of the property [of "this" or one of its prototypes] that holds
* the current function
*/
getMethodName(): string | null;
interface ErrnoException extends Error {
errno?: number | undefined;
code?: string | undefined;
path?: string | undefined;
syscall?: string | undefined;
}
/**
* Name of the script [if this function was defined in a script]
*/
getFileName(): string | null;
interface ReadableStream extends EventEmitter {
readable: boolean;
read(size?: number): string | Buffer;
setEncoding(encoding: BufferEncoding): this;
pause(): this;
resume(): this;
isPaused(): boolean;
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined }): T;
unpipe(destination?: WritableStream): this;
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
wrap(oldStream: ReadableStream): this;
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
}
/**
* Current line number [if this function was defined in a script]
*/
getLineNumber(): number | null;
interface WritableStream extends EventEmitter {
writable: boolean;
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
end(cb?: () => void): this;
end(data: string | Uint8Array, cb?: () => void): this;
end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
}
/**
* Current column number [if this function was defined in a script]
*/
getColumnNumber(): number | null;
interface ReadWriteStream extends ReadableStream, WritableStream {}
/**
* A call site object representing the location where eval was called
* [if this function was created using a call to eval]
*/
getEvalOrigin(): string | undefined;
interface RefCounted {
ref(): this;
unref(): this;
}
/**
* Is this a toplevel invocation, that is, is "this" the global object?
*/
isToplevel(): boolean;
type TypedArray =
| Uint8Array
| Uint8ClampedArray
| Uint16Array
| Uint32Array
| Int8Array
| Int16Array
| Int32Array
| BigUint64Array
| BigInt64Array
| Float32Array
| Float64Array;
type ArrayBufferView = TypedArray | DataView;
/**
* Does this call take place in code defined by a call to eval?
*/
isEval(): boolean;
interface Require {
(id: string): any;
resolve: RequireResolve;
cache: Dict<NodeModule>;
/**
* @deprecated
*/
extensions: RequireExtensions;
main: Module | undefined;
}
/**
* Is this call in native V8 code?
*/
isNative(): boolean;
interface RequireResolve {
(id: string, options?: { paths?: string[] | undefined }): string;
paths(request: string): string[] | null;
}
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;
}
interface Module {
/**
* `true` if the module is running during the Node.js preload
*/
isPreloading: boolean;
exports: any;
require: Require;
id: string;
filename: string;
loaded: boolean;
/** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */
parent: Module | null | undefined;
children: Module[];
/**
* @since v11.14.0
*
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
*/
path: string;
paths: string[];
}
interface Dict<T> {
[key: string]: T | undefined;
}
interface ReadOnlyDict<T> {
readonly [key: string]: T | undefined;
}
/**
* Is this a constructor call?
*/
isConstructor(): boolean;
}
interface RequestInit extends _RequestInit {}
interface ErrnoException extends Error {
errno?: number | undefined;
code?: string | undefined;
path?: string | undefined;
syscall?: string | undefined;
}
function fetch(
input: string | URL | globalThis.Request,
init?: RequestInit,
): Promise<Response>;
interface ReadableStream extends EventEmitter {
readable: boolean;
read(size?: number): string | Buffer;
setEncoding(encoding: BufferEncoding): this;
pause(): this;
resume(): this;
isPaused(): boolean;
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T;
unpipe(destination?: WritableStream): this;
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
wrap(oldStream: ReadableStream): this;
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
}
interface Request extends _Request {}
var Request: typeof globalThis extends {
onmessage: any;
Request: infer T;
} ? T
: typeof import("undici-types").Request;
interface WritableStream extends EventEmitter {
writable: boolean;
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
end(cb?: () => void): void;
end(data: string | Uint8Array, cb?: () => void): void;
end(str: string, encoding?: BufferEncoding, cb?: () => void): void;
}
interface ResponseInit extends _ResponseInit {}
interface ReadWriteStream extends ReadableStream, WritableStream { }
interface Response extends _Response {}
var Response: typeof globalThis extends {
onmessage: any;
Response: infer T;
} ? T
: typeof import("undici-types").Response;
interface RefCounted {
ref(): this;
unref(): this;
}
interface FormData extends _FormData {}
var FormData: typeof globalThis extends {
onmessage: any;
FormData: infer T;
} ? T
: typeof import("undici-types").FormData;
type TypedArray =
| Uint8Array
| Uint8ClampedArray
| Uint16Array
| Uint32Array
| Int8Array
| Int16Array
| Int32Array
| BigUint64Array
| BigInt64Array
| Float32Array
| Float64Array;
type ArrayBufferView = TypedArray | DataView;
interface Headers extends _Headers {}
var Headers: typeof globalThis extends {
onmessage: any;
Headers: infer T;
} ? T
: typeof import("undici-types").Headers;
interface Require {
(id: string): any;
resolve: RequireResolve;
cache: Dict<NodeModule>;
/**
* @deprecated
*/
extensions: RequireExtensions;
main: Module | undefined;
}
interface File extends _File {}
var File: typeof globalThis extends {
onmessage: any;
File: infer T;
} ? T
: typeof import("node:buffer").File;
interface RequireResolve {
(id: string, options?: { paths?: string[] | undefined; }): string;
paths(request: string): string[] | null;
}
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;
}
interface Module {
/**
* `true` if the module is running during the Node.js preload
*/
isPreloading: boolean;
exports: any;
require: Require;
id: string;
filename: string;
loaded: boolean;
/** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */
parent: Module | null | undefined;
children: Module[];
/**
* @since v11.14.0
*
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
*/
path: string;
paths: string[];
}
interface Dict<T> {
[key: string]: T | undefined;
}
interface ReadOnlyDict<T> {
readonly [key: string]: T | undefined;
}
}

0
node_modules/@types/node/ts4.8/globals.global.d.ts generated vendored Normal file → Executable file
View File

954
node_modules/@types/node/ts4.8/http.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

1129
node_modules/@types/node/ts4.8/http2.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

267
node_modules/@types/node/ts4.8/https.d.ts generated vendored Normal file → Executable file
View File

@ -1,22 +1,19 @@
/**
* 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/v20.2.0/lib/https.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.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";
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;
type RequestOptions = http.RequestOptions &
tls.SecureContextOptions & {
rejectUnauthorized?: boolean | undefined; // Defaults to true
servername?: string | undefined; // SNI TLS Extension
};
@ -49,24 +46,14 @@ declare module "https" {
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: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
addListener(
event: "newSession",
event: 'newSession',
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
addListener(
event: "OCSPRequest",
event: 'OCSPRequest',
listener: (
certificate: Buffer,
issuer: Buffer,
@ -74,80 +61,74 @@ declare module "https" {
) => void,
): this;
addListener(
event: "resumeSession",
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: '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",
event: 'connect',
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
addListener(event: "request", listener: http.RequestListener<Request, Response>): this;
addListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
addListener(
event: "upgrade",
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: 'keylog', line: Buffer, tlsSocket: tls.TLSSocket): boolean;
emit(
event: "newSession",
event: 'newSession',
sessionId: Buffer,
sessionData: Buffer,
callback: (err: Error, resp: Buffer) => void,
): boolean;
emit(
event: "OCSPRequest",
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: '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",
event: 'checkContinue',
req: InstanceType<Request>,
res: InstanceType<Response> & {
req: InstanceType<Request>;
},
res: InstanceType<Response> & { req: InstanceType<Request> },
): boolean;
emit(
event: "checkExpectation",
event: 'checkExpectation',
req: InstanceType<Request>,
res: InstanceType<Response> & {
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: 'clientError', err: Error, socket: Duplex): boolean;
emit(event: 'connect', req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
emit(
event: "request",
event: 'request',
req: InstanceType<Request>,
res: InstanceType<Response> & {
req: InstanceType<Request>;
},
res: InstanceType<Response> & { req: InstanceType<Request> },
): boolean;
emit(event: "upgrade", req: InstanceType<Request>, socket: Duplex, head: Buffer): 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: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
on(
event: "newSession",
event: 'newSession',
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
on(
event: "OCSPRequest",
event: 'OCSPRequest',
listener: (
certificate: Buffer,
issuer: Buffer,
@ -155,29 +136,29 @@ declare module "https" {
) => void,
): this;
on(
event: "resumeSession",
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;
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: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
once(
event: "newSession",
event: 'newSession',
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
once(
event: "OCSPRequest",
event: 'OCSPRequest',
listener: (
certificate: Buffer,
issuer: Buffer,
@ -185,29 +166,29 @@ declare module "https" {
) => void,
): this;
once(
event: "resumeSession",
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;
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: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
prependListener(
event: "newSession",
event: 'newSession',
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
prependListener(
event: "OCSPRequest",
event: 'OCSPRequest',
listener: (
certificate: Buffer,
issuer: Buffer,
@ -215,35 +196,35 @@ declare module "https" {
) => void,
): this;
prependListener(
event: "resumeSession",
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: '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",
event: 'connect',
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
prependListener(event: "request", listener: http.RequestListener<Request, Response>): this;
prependListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
prependListener(
event: "upgrade",
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: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
prependOnceListener(
event: "newSession",
event: 'newSession',
listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
): this;
prependOnceListener(
event: "OCSPRequest",
event: 'OCSPRequest',
listener: (
certificate: Buffer,
issuer: Buffer,
@ -251,37 +232,37 @@ declare module "https" {
) => void,
): this;
prependOnceListener(
event: "resumeSession",
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: '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",
event: 'connect',
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
prependOnceListener(event: "request", listener: http.RequestListener<Request, Response>): this;
prependOnceListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
prependOnceListener(
event: "upgrade",
event: 'upgrade',
listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
): this;
}
/**
* ```js
* // curl -k https://localhost:8000/
* const https = require('node:https');
* const fs = require('node:fs');
* const https = require('https');
* const fs = require('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')
* };
*
* https.createServer(options, (req, res) => {
@ -293,12 +274,12 @@ declare module "https" {
* Or
*
* ```js
* const https = require('node:https');
* const fs = require('node:fs');
* const https = require('https');
* const fs = require('fs');
*
* const options = {
* pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
* passphrase: 'sample',
* passphrase: 'sample'
* };
*
* https.createServer(options, (req, res) => {
@ -334,13 +315,13 @@ declare module "https" {
* upload a file with a POST request, then write to the `ClientRequest` object.
*
* ```js
* const https = require('node:https');
* const https = require('https');
*
* const options = {
* hostname: 'encrypted.google.com',
* port: 443,
* path: '/',
* method: 'GET',
* method: 'GET'
* };
*
* const req = https.request(options, (res) => {
@ -367,7 +348,7 @@ declare module "https" {
* path: '/',
* method: 'GET',
* 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')
* };
* options.agent = new https.Agent(options);
*
@ -386,7 +367,7 @@ declare module "https" {
* method: 'GET',
* key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
* cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
* agent: false,
* agent: false
* };
*
* const req = https.request(options, (res) => {
@ -407,9 +388,9 @@ declare module "https" {
* Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`):
*
* ```js
* const tls = require('node:tls');
* const https = require('node:https');
* const crypto = require('node:crypto');
* const tls = require('tls');
* const https = require('https');
* const crypto = require('crypto');
*
* function sha256(s) {
* return crypto.createHash('sha256').update(s).digest('base64');
@ -426,7 +407,7 @@ declare module "https" {
* return err;
* }
*
* // Pin the public key, similar to HPKP pin-sha256 pinning
* // Pin the public key, similar to HPKP pin-sha25 pinning
* const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU=';
* if (sha256(cert.pubkey) !== pubkey256) {
* const msg = 'Certificate verification error: ' +
@ -517,7 +498,7 @@ declare module "https" {
* string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
*
* ```js
* const https = require('node:https');
* const https = require('https');
*
* https.get('https://encrypted.google.com/', (res) => {
* console.log('statusCode:', res.statusCode);
@ -545,6 +526,6 @@ declare module "https" {
): http.ClientRequest;
let globalAgent: Agent;
}
declare module "node:https" {
export * from "https";
declare module 'node:https' {
export * from 'https';
}

4
node_modules/@types/node/ts4.8/index.d.ts generated vendored Normal file → Executable file
View File

@ -22,7 +22,7 @@
* IN THE SOFTWARE.
*/
// NOTE: These definitions support NodeJS and TypeScript 4.8 and earlier.
// NOTE: These definitions support NodeJS and TypeScript 4.8 and earlier
// Reference required types from the default lib:
/// <reference lib="es2020" />
@ -47,7 +47,6 @@
/// <reference path="dns/promises.d.ts" />
/// <reference path="dns/promises.d.ts" />
/// <reference path="domain.d.ts" />
/// <reference path="dom-events.d.ts" />
/// <reference path="events.d.ts" />
/// <reference path="fs.d.ts" />
/// <reference path="fs/promises.d.ts" />
@ -64,7 +63,6 @@
/// <reference path="punycode.d.ts" />
/// <reference path="querystring.d.ts" />
/// <reference path="readline.d.ts" />
/// <reference path="readline/promises.d.ts" />
/// <reference path="repl.d.ts" />
/// <reference path="stream.d.ts" />
/// <reference path="stream/promises.d.ts" />

40
node_modules/@types/node/ts4.8/inspector.d.ts generated vendored Normal file → Executable file
View File

@ -1,26 +1,21 @@
// eslint-disable-next-line dt-header
// Type definitions for inspector
// These definitions are auto-generated.
// Please see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/19330
// for more information.
// tslint:disable:max-line-length
/**
* The `node:inspector` module provides an API for interacting with the V8
* inspector.
* The `inspector` module provides an API for interacting with the V8 inspector.
*
* It can be accessed using:
*
* ```js
* import * as inspector from 'node:inspector/promises';
* const inspector = require('inspector');
* ```
*
* or
*
* ```js
* import * as inspector from 'node:inspector';
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/inspector.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/inspector.js)
*/
declare module 'inspector' {
import EventEmitter = require('node:events');
@ -1693,7 +1688,7 @@ declare module 'inspector' {
/**
* Controls how the trace buffer stores data.
*/
recordMode?: string | undefined;
recordMode?: string;
/**
* Included category filters.
*/
@ -1783,6 +1778,13 @@ declare module 'inspector' {
* @since v8.0.0
*/
connect(): void;
/**
* Connects a session to the main thread inspector back-end.
* An exception will be thrown if this API was not called on a Worker
* thread.
* @since v12.11.0
*/
connectToMainThread(): void;
/**
* Immediately close the session. All pending message callbacks will be called
* with an error. `session.connect()` will need to be called to be able to send
@ -2694,7 +2696,7 @@ declare module 'inspector' {
prependOnceListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this;
}
/**
* Activate inspector on host and port. Equivalent to`node --inspect=[[host:]port]`, but can be done programmatically after node has
* Activate inspector on host and port. Equivalent to `node --inspect=[[host:]port]`, but can be done programmatically after node has
* started.
*
* If wait is `true`, will block until a client has connected to the inspect port
@ -2704,9 +2706,8 @@ declare module 'inspector' {
* @param [port='what was specified on the CLI'] Port to listen on for inspector connections. Optional.
* @param [host='what was specified on the CLI'] Host to listen on for inspector connections. Optional.
* @param [wait=false] Block until a client has connected. Optional.
* @returns Disposable that calls `inspector.close()`.
*/
function open(port?: number, host?: string, wait?: boolean): Disposable;
function open(port?: number, host?: string, wait?: boolean): void;
/**
* Deactivate the inspector. Blocks until there are no active connections.
*/
@ -2717,12 +2718,12 @@ declare module 'inspector' {
* ```console
* $ node --inspect -p 'inspector.url()'
* Debugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34
* For help, see: https://nodejs.org/en/docs/inspector
* For help see https://nodejs.org/en/docs/inspector
* ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34
*
* $ node --inspect=localhost:3000 -p 'inspector.url()'
* Debugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a
* For help, see: https://nodejs.org/en/docs/inspector
* For help see https://nodejs.org/en/docs/inspector
* ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a
*
* $ node -p 'inspector.url()'
@ -2738,10 +2739,7 @@ declare module 'inspector' {
*/
function waitForDebugger(): void;
}
/**
* The inspector module provides an API for interacting with the V8 inspector.
*/
declare module 'node:inspector' {
import inspector = require('inspector');
export = inspector;
import EventEmitter = require('inspector');
export = EventEmitter;
}

241
node_modules/@types/node/ts4.8/module.d.ts generated vendored Normal file → Executable file
View File

@ -1,10 +1,8 @@
/**
* @since v0.3.7
* @experimental
*/
declare module "module" {
import { URL } from "node:url";
import { MessagePort } from "node:worker_threads";
declare module 'module' {
import { URL } from 'node:url';
namespace Module {
/**
* The `module.syncBuiltinESMExports()` method updates all the live bindings for
@ -12,9 +10,9 @@ declare module "module" {
* does not add or remove exported names from the `ES Modules`.
*
* ```js
* const fs = require('node:fs');
* const assert = require('node:assert');
* const { syncBuiltinESMExports } = require('node:module');
* const fs = require('fs');
* const assert = require('assert');
* const { syncBuiltinESMExports } = require('module');
*
* fs.readFile = newAPI;
*
@ -28,7 +26,7 @@ declare module "module" {
*
* syncBuiltinESMExports();
*
* import('node:fs').then((esmFS) => {
* import('fs').then((esmFS) => {
* // It syncs the existing readFile property with the new value
* assert.strictEqual(esmFS.readFile, newAPI);
* // readFileSync has been deleted from the required fs
@ -46,7 +44,6 @@ declare module "module" {
* `path` is the resolved path for the file for which a corresponding source map
* should be fetched.
* @since v13.7.0, v12.17.0
* @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise.
*/
function findSourceMap(path: string, error?: Error): SourceMap;
interface SourceMapPayload {
@ -65,24 +62,6 @@ declare module "module" {
originalLine: number;
originalColumn: number;
}
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;
}
/**
* @since v13.7.0, v12.17.0
*/
@ -93,170 +72,12 @@ declare module "module" {
readonly payload: SourceMapPayload;
constructor(payload: SourceMapPayload);
/**
* 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
* 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:
*/
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 | {};
findEntry(line: number, column: number): SourceMapping;
}
/** @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 {}
class Module {
@ -264,52 +85,30 @@ declare module "module" {
static wrap(code: string): string;
static createRequire(path: string | URL): NodeRequire;
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);
}
global {
interface ImportMeta {
/**
* The directory name of the current module. This is the same as the `path.dirname()` of the `import.meta.filename`.
* **Caveat:** only present on `file:` modules.
*/
dirname: string;
/**
* The full absolute path and filename of the current module, with symlinks resolved.
* This is the same as the `url.fileURLToPath()` of the `import.meta.url`.
* **Caveat:** only local modules support this property. Modules not using the `file:` protocol will not provide it.
*/
filename: string;
/**
* The absolute `file:` URL of the module.
*/
url: string;
/**
* @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.
*
* 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.
* @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.
*/
resolve(specifier: string, parent?: string | URL | undefined): string;
resolve?(specified: string, parent?: string | URL): Promise<string>;
}
}
export = Module;
}
declare module "node:module" {
import module = require("module");
declare module 'node:module' {
import module = require('module');
export = module;
}

370
node_modules/@types/node/ts4.8/net.d.ts generated vendored Normal file → Executable file
View File

@ -1,26 +1,22 @@
/**
* > Stability: 2 - Stable
*
* The `node:net` module provides an asynchronous network API for creating stream-based
* The `net` module provides an asynchronous network API for creating stream-based
* TCP or `IPC` servers ({@link createServer}) and clients
* ({@link createConnection}).
*
* It can be accessed using:
*
* ```js
* const net = require('node:net');
* const net = require('net');
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/net.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.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.LookupAllOptions,
callback: (err: NodeJS.ErrnoException | null, addresses: dns.LookupAddress[]) => 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.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void;
interface AddressInfo {
address: string;
family: string;
@ -61,20 +57,12 @@ declare module "net" {
noDelay?: boolean | undefined;
keepAlive?: boolean | undefined;
keepAliveInitialDelay?: number | undefined;
/**
* @since v18.13.0
*/
autoSelectFamily?: boolean | undefined;
/**
* @since v18.13.0
*/
autoSelectFamilyAttemptTimeout?: number | undefined;
}
interface IpcSocketConnectOpts extends ConnectOpts {
path: string;
}
type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
type SocketReadyState = "opening" | "open" | "readOnly" | "writeOnly" | "closed";
type SocketReadyState = 'opening' | 'open' | 'readOnly' | 'writeOnly' | 'closed';
/**
* This class is an abstraction of a TCP socket or a streaming `IPC` endpoint
* (uses named pipes on Windows, and Unix domain sockets otherwise). It is also
@ -91,12 +79,6 @@ declare module "net" {
*/
class Socket extends stream.Duplex {
constructor(options?: SocketConstructorOpts);
/**
* 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
* case of a string. It defaults to UTF8 encoding.
@ -149,14 +131,6 @@ declare module "net" {
* @return The socket itself.
*/
pause(): this;
/**
* 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()`.
* @return The socket itself.
@ -234,21 +208,12 @@ declare module "net" {
*/
unref(): this;
/**
* 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.
* @since v0.9.1
* @return The socket itself.
*/
ref(): this;
/**
* 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
* may contain strings whose length after encoding is not yet known. So this number
@ -285,12 +250,6 @@ declare module "net" {
* @since v6.1.0
*/
readonly connecting: boolean;
/**
* 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.
*/
@ -307,18 +266,9 @@ declare module "net" {
* @since v0.9.6
*/
readonly localPort?: number;
/**
* 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`.
* @see {https://nodejs.org/api/net.html#socketreadystate}
* @since v0.5.0
*/
readonly readyState: SocketReadyState;
@ -329,20 +279,17 @@ declare module "net" {
*/
readonly remoteAddress?: string | undefined;
/**
* The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. Value may be `undefined` if
* the socket is destroyed (for example, if the client disconnected).
* The string representation of the remote IP family. `'IPv4'` or `'IPv6'`.
* @since v0.11.14
*/
readonly remoteFamily?: string | undefined;
/**
* The numeric representation of the remote port. For example, `80` or `21`. Value may be `undefined` if
* the socket is destroyed (for example, if the client disconnected).
* The numeric representation of the remote port. For example, `80` or `21`.
* @since v0.5.10
*/
readonly remotePort?: number | undefined;
/**
* The socket timeout in milliseconds as set by `socket.setTimeout()`.
* It is `undefined` if a timeout has not been set.
* 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;
@ -368,84 +315,68 @@ declare module "net" {
* 5. end
* 6. error
* 7. lookup
* 8. ready
* 9. timeout
* 8. 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;
}
interface ListenOptions extends Abortable {
port?: number | undefined;
@ -491,14 +422,6 @@ declare module "net" {
*/
keepAliveInitialDelay?: number | undefined;
}
interface DropArgument {
localAddress?: string;
localPort?: number;
localFamily?: string;
remoteAddress?: string;
remotePort?: number;
remoteFamily?: string;
}
/**
* This class is used to create a TCP or `IPC` server.
* @since v0.1.90
@ -538,7 +461,7 @@ declare module "net" {
* ```js
* server.on('error', (e) => {
* if (e.code === 'EADDRINUSE') {
* console.error('Address in use, retrying...');
* console.log('Address in use, retrying...');
* setTimeout(() => {
* server.close();
* server.listen(PORT, HOST);
@ -603,7 +526,7 @@ declare module "net" {
*/
getConnections(cb: (error: Error | null, count: number) => void): void;
/**
* 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.
* @since v0.9.1
*/
@ -635,61 +558,49 @@ declare module "net" {
* 2. connection
* 3. error
* 4. listening
* 5. drop
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "connection", listener: (socket: Socket) => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "listening", listener: () => void): this;
addListener(event: "drop", listener: (data?: DropArgument) => void): this;
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;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "close"): boolean;
emit(event: "connection", socket: Socket): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "listening"): boolean;
emit(event: "drop", data?: DropArgument): boolean;
emit(event: 'close'): boolean;
emit(event: 'connection', socket: Socket): boolean;
emit(event: 'error', err: Error): boolean;
emit(event: 'listening'): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "close", listener: () => void): this;
on(event: "connection", listener: (socket: Socket) => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "listening", listener: () => void): this;
on(event: "drop", listener: (data?: DropArgument) => void): this;
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;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "close", listener: () => void): this;
once(event: "connection", listener: (socket: Socket) => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "listening", listener: () => void): this;
once(event: "drop", listener: (data?: DropArgument) => void): this;
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;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "connection", listener: (socket: Socket) => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "listening", listener: () => void): this;
prependListener(event: "drop", listener: (data?: DropArgument) => void): this;
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;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "connection", listener: (socket: Socket) => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "listening", listener: () => void): this;
prependOnceListener(event: "drop", listener: (data?: DropArgument) => void): this;
/**
* Calls {@link Server.close()} and returns a promise that fulfills when the server has closed.
* @since v20.5.0
*/
[Symbol.asyncDispose](): Promise<void>;
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;
}
type IPVersion = "ipv4" | "ipv6";
type IPVersion = 'ipv4' | 'ipv6';
/**
* The `BlockList` object can be used with some network APIs to specify rules for
* disabling inbound or outbound access to specific IP addresses, IP ranges, or
* IP subnets.
* @since v15.0.0, v14.18.0
* @since v15.0.0
*/
class BlockList {
/**
* Adds a rule to block the given IP address.
* @since v15.0.0, v14.18.0
* @since v15.0.0
* @param address An IPv4 or IPv6 address.
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
*/
@ -697,7 +608,7 @@ declare module "net" {
addAddress(address: SocketAddress): void;
/**
* Adds a rule to block a range of IP addresses from `start` (inclusive) to`end` (inclusive).
* @since v15.0.0, v14.18.0
* @since v15.0.0
* @param start The starting IPv4 or IPv6 address in the range.
* @param end The ending IPv4 or IPv6 address in the range.
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
@ -706,7 +617,7 @@ declare module "net" {
addRange(start: SocketAddress, end: SocketAddress): void;
/**
* Adds a rule to block a range of IP addresses specified as a subnet mask.
* @since v15.0.0, v14.18.0
* @since v15.0.0
* @param net The network IPv4 or IPv6 address.
* @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`.
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
@ -730,7 +641,7 @@ declare module "net" {
* console.log(blockList.check('::ffff:7b7b:7b7b', 'ipv6')); // Prints: true
* console.log(blockList.check('::ffff:123.123.123.123', 'ipv6')); // Prints: true
* ```
* @since v15.0.0, v14.18.0
* @since v15.0.0
* @param address The IP address to check
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
*/
@ -761,11 +672,11 @@ declare module "net" {
*
* The server can be a TCP server or an `IPC` server, depending on what it `listen()` to.
*
* Here is an example of a TCP echo server which listens for connections
* Here is an example of an TCP echo server which listens for connections
* on port 8124:
*
* ```js
* const net = require('node:net');
* const net = require('net');
* const server = net.createServer((c) => {
* // 'connection' listener.
* console.log('client connected');
@ -785,8 +696,8 @@ declare module "net" {
*
* Test this by using `telnet`:
*
* ```bash
* telnet localhost 8124
* ```console
* $ telnet localhost 8124
* ```
*
* To listen on the socket `/tmp/echo.sock`:
@ -799,8 +710,8 @@ declare module "net" {
*
* Use `nc` to connect to a Unix domain socket server:
*
* ```bash
* nc -U /tmp/echo.sock
* ```console
* $ nc -U /tmp/echo.sock
* ```
* @since v0.5.0
* @param connectionListener Automatically set as a listener for the {@link 'connection'} event.
@ -840,61 +751,19 @@ declare module "net" {
function createConnection(port: number, host?: string, connectionListener?: () => void): Socket;
function createConnection(path: string, connectionListener?: () => void): Socket;
/**
* 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
* ```
* 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.
* @since v0.3.0
*/
function isIP(input: string): number;
/**
* 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
* ```
* Returns `true` if input is a version 4 IP address, otherwise returns `false`.
* @since v0.3.0
*/
function isIPv4(input: string): boolean;
/**
* Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`.
*
* ```js
* net.isIPv6('::1'); // returns true
* net.isIPv6('fhqwhgads'); // returns false
* ```
* Returns `true` if input is a version 6 IP address, otherwise returns `false`.
* @since v0.3.0
*/
function isIPv6(input: string): boolean;
@ -920,30 +789,29 @@ declare module "net" {
port?: number | undefined;
}
/**
* @since v15.14.0, v14.18.0
* @since v15.14.0
*/
class SocketAddress {
constructor(options: SocketAddressInitOptions);
/**
* Either \`'ipv4'\` or \`'ipv6'\`.
* @since v15.14.0, v14.18.0
* @since v15.14.0
*/
readonly address: string;
/**
* Either \`'ipv4'\` or \`'ipv6'\`.
* @since v15.14.0, v14.18.0
* @since v15.14.0
*/
readonly family: IPVersion;
/**
* @since v15.14.0, v14.18.0
* @since v15.14.0
*/
readonly port: number;
/**
* @since v15.14.0, v14.18.0
* @since v15.14.0
*/
readonly flowlabel: number;
}
}
declare module "node:net" {
export * from "net";
declare module 'node:net' {
export * from 'net';
}

66
node_modules/@types/node/ts4.8/os.d.ts generated vendored Normal file → Executable file
View File

@ -1,13 +1,13 @@
/**
* The `node:os` module provides operating system-related utility methods and
* The `os` module provides operating system-related utility methods and
* properties. It can be accessed using:
*
* ```js
* const os = require('node:os');
* const os = require('os');
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/os.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/os.js)
*/
declare module "os" {
declare module 'os' {
interface CpuInfo {
model: string;
speed: number;
@ -27,18 +27,18 @@ declare module "os" {
cidr: string | null;
}
interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase {
family: "IPv4";
family: 'IPv4';
scopeid?: undefined;
}
interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase {
family: "IPv6";
family: 'IPv6';
scopeid: number;
}
interface UserInfo<T> {
username: T;
uid: number;
gid: number;
shell: T | null;
shell: T;
homedir: T;
}
type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6;
@ -75,7 +75,6 @@ declare module "os" {
function totalmem(): number;
/**
* 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.
*
* The properties included on each object include:
*
@ -89,8 +88,8 @@ declare module "os" {
* nice: 0,
* sys: 30340,
* idle: 1070356870,
* irq: 0,
* },
* irq: 0
* }
* },
* {
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
@ -100,8 +99,8 @@ declare module "os" {
* nice: 0,
* sys: 26980,
* idle: 1071569080,
* irq: 0,
* },
* irq: 0
* }
* },
* {
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
@ -111,8 +110,8 @@ declare module "os" {
* nice: 0,
* sys: 21750,
* idle: 1070919370,
* irq: 0,
* },
* irq: 0
* }
* },
* {
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
@ -122,28 +121,17 @@ declare module "os" {
* nice: 0,
* sys: 19430,
* idle: 1070905480,
* irq: 20,
* },
* irq: 20
* }
* },
* ]
* ```
*
* `nice` values are POSIX-only. On Windows, the `nice` values of all processors
* 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
*/
function cpus(): CpuInfo[];
/**
* 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
* returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.
@ -239,7 +227,7 @@ declare module "os" {
* Throws a `SystemError` if a user has no `username` or `homedir`.
* @since v6.0.0
*/
function userInfo(options: { encoding: "buffer" }): UserInfo<Buffer>;
function userInfo(options: { encoding: 'buffer' }): UserInfo<Buffer>;
function userInfo(options?: { encoding: BufferEncoding }): UserInfo<string>;
type SignalConstants = {
[key in NodeJS.Signals]: number;
@ -400,8 +388,7 @@ declare module "os" {
const EOL: string;
/**
* Returns the operating system CPU architecture for which the Node.js binary was
* compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`,`'mips'`, `'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`,
* and `'x64'`.
* compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`.
*
* The return value is equivalent to `process.arch`.
* @since v0.5.0
@ -416,9 +403,8 @@ declare module "os" {
*/
function version(): string;
/**
* 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'`.
* 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'`.
*
* The return value is equivalent to `process.platform`.
*
@ -427,14 +413,6 @@ declare module "os" {
* @since v0.5.0
*/
function platform(): NodeJS.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
* string.
@ -448,7 +426,7 @@ declare module "os" {
* Possible values are `'BE'` for big endian and `'LE'` for little endian.
* @since v0.9.4
*/
function endianness(): "BE" | "LE";
function endianness(): 'BE' | 'LE';
/**
* Returns the scheduling priority for the process specified by `pid`. If `pid` is
* not provided or is `0`, the priority of the current process is returned.
@ -473,6 +451,6 @@ declare module "os" {
function setPriority(priority: number): void;
function setPriority(pid: number, priority: number): void;
}
declare module "node:os" {
export * from "os";
declare module 'node:os' {
export * from 'os';
}

40
node_modules/@types/node/ts4.8/path.d.ts generated vendored Normal file → Executable file
View File

@ -1,21 +1,21 @@
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 `node:path` module provides utilities for working with file and directory
* paths. It can be accessed using:
* The `path` module provides utilities for working with file and directory paths.
* It can be accessed using:
*
* ```js
* const path = require('node:path');
* const path = require('path');
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/path.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/path.js)
*/
declare module "path" {
declare module 'path' {
namespace path {
/**
* A parsed path object generated by path.parse() or consumed by path.format().
@ -90,7 +90,7 @@ declare module "path" {
* the current working directory is used as well. The resulting path is normalized,
* and trailing slashes are removed unless the path gets resolved to the root directory.
*
* @param paths A sequence of paths or path segments.
* @param paths string paths to join.
* @throws {TypeError} if any of the arguments is not a string.
*/
resolve(...paths: string[]): string;
@ -122,10 +122,10 @@ declare module "path" {
* Often used to extract the file name from a fully qualified path.
*
* @param path the path to evaluate.
* @param suffix optionally, an extension to remove from the result.
* @param ext optionally, an extension to remove from the result.
* @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string.
*/
basename(path: string, suffix?: string): string;
basename(path: string, ext?: 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.
@ -137,11 +137,11 @@ declare module "path" {
/**
* The platform-specific file separator. '\\' or '/'.
*/
readonly sep: "\\" | "/";
readonly sep: '\\' | '/';
/**
* The platform-specific file delimiter. ';' or ':'.
*/
readonly delimiter: ";" | ":";
readonly delimiter: ';' | ':';
/**
* Returns an object from a path string - the opposite of format().
*
@ -177,15 +177,15 @@ declare module "path" {
const path: path.PlatformPath;
export = 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");
declare module 'node:path/posix' {
import path = require('path/posix');
export = path;
}
declare module "node:path/win32" {
import path = require("path/win32");
declare module 'node:path/win32' {
import path = require('path/win32');
export = path;
}

131
node_modules/@types/node/ts4.8/perf_hooks.d.ts generated vendored Normal file → Executable file
View File

@ -7,10 +7,9 @@
* * [High Resolution Time](https://www.w3.org/TR/hr-time-2)
* * [Performance Timeline](https://w3c.github.io/performance-timeline/)
* * [User Timing](https://www.w3.org/TR/user-timing/)
* * [Resource Timing](https://www.w3.org/TR/resource-timing-2/)
*
* ```js
* const { PerformanceObserver, performance } = require('node:perf_hooks');
* const { PerformanceObserver, performance } = require('perf_hooks');
*
* const obs = new PerformanceObserver((items) => {
* console.log(items.getEntries()[0].duration);
@ -27,11 +26,11 @@
* performance.measure('A to B', 'A', 'B');
* });
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/perf_hooks.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/perf_hooks.js)
*/
declare module "perf_hooks" {
import { AsyncResource } from "node:async_hooks";
type EntryType = "node" | "mark" | "measure" | "gc" | "function" | "http2" | "http" | "dns" | "net";
declare module 'perf_hooks' {
import { AsyncResource } from 'node:async_hooks';
type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http';
interface NodeGCPerformanceDetail {
/**
* When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies
@ -47,7 +46,6 @@ declare module "perf_hooks" {
readonly flags?: number | undefined;
}
/**
* The constructor of this class is not exposed to users directly.
* @since v8.5.0
*/
class PerformanceEntry {
@ -87,24 +85,6 @@ declare module "perf_hooks" {
* @since v16.0.0
*/
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._
@ -166,10 +146,7 @@ declare module "perf_hooks" {
* @param util1 The result of a previous call to eventLoopUtilization()
* @param util2 The result of a previous call to eventLoopUtilization() prior to util1
*/
type EventLoopUtilityFunction = (
util1?: EventLoopUtilization,
util2?: EventLoopUtilization,
) => EventLoopUtilization;
type EventLoopUtilityFunction = (util1?: EventLoopUtilization, util2?: EventLoopUtilization) => EventLoopUtilization;
interface MarkOptions {
/**
* Additional optional detail to include with the mark.
@ -249,9 +226,8 @@ declare module "perf_hooks" {
* and whose performanceEntry.duration is always 0.
* Performance marks are used to mark specific significant moments in the Performance Timeline.
* @param name
* @return The PerformanceMark entry that was created
*/
mark(name?: string, options?: MarkOptions): PerformanceMark;
mark(name?: string, options?: MarkOptions): void;
/**
* Creates a new PerformanceMeasure entry in the Performance Timeline.
* A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure',
@ -266,10 +242,9 @@ declare module "perf_hooks" {
* @param name
* @param startMark
* @param endMark
* @return The PerformanceMeasure entry that was created
*/
measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure;
measure(name: string, options: MeasureOptions): PerformanceMeasure;
measure(name: string, startMark?: string, endMark?: string): void;
measure(name: string, options: MeasureOptions): void;
/**
* An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones.
*/
@ -303,8 +278,8 @@ declare module "perf_hooks" {
* ```js
* const {
* performance,
* PerformanceObserver,
* } = require('node:perf_hooks');
* PerformanceObserver
* } = require('perf_hooks');
*
* const obs = new PerformanceObserver((perfObserverList, observer) => {
* console.log(perfObserverList.getEntries());
@ -314,20 +289,16 @@ declare module "perf_hooks" {
* * name: 'test',
* * entryType: 'mark',
* * startTime: 81.465639,
* * duration: 0,
* * detail: null
* * duration: 0
* * },
* * PerformanceEntry {
* * name: 'meow',
* * entryType: 'mark',
* * startTime: 81.860064,
* * duration: 0,
* * detail: null
* * duration: 0
* * }
* * ]
*
* performance.clearMarks();
* performance.clearMeasures();
* observer.disconnect();
* });
* obs.observe({ type: 'mark' });
@ -346,8 +317,8 @@ declare module "perf_hooks" {
* ```js
* const {
* performance,
* PerformanceObserver,
* } = require('node:perf_hooks');
* PerformanceObserver
* } = require('perf_hooks');
*
* const obs = new PerformanceObserver((perfObserverList, observer) => {
* console.log(perfObserverList.getEntriesByName('meow'));
@ -357,8 +328,7 @@ declare module "perf_hooks" {
* * name: 'meow',
* * entryType: 'mark',
* * startTime: 98.545991,
* * duration: 0,
* * detail: null
* * duration: 0
* * }
* * ]
*
@ -371,15 +341,11 @@ declare module "perf_hooks" {
* * name: 'test',
* * entryType: 'mark',
* * startTime: 63.518931,
* * duration: 0,
* * detail: null
* * duration: 0
* * }
* * ]
*
* console.log(perfObserverList.getEntriesByName('test', 'measure')); // []
*
* performance.clearMarks();
* performance.clearMeasures();
* observer.disconnect();
* });
* obs.observe({ entryTypes: ['mark', 'measure'] });
@ -397,8 +363,8 @@ declare module "perf_hooks" {
* ```js
* const {
* performance,
* PerformanceObserver,
* } = require('node:perf_hooks');
* PerformanceObserver
* } = require('perf_hooks');
*
* const obs = new PerformanceObserver((perfObserverList, observer) => {
* console.log(perfObserverList.getEntriesByType('mark'));
@ -408,20 +374,16 @@ declare module "perf_hooks" {
* * name: 'test',
* * entryType: 'mark',
* * startTime: 55.897834,
* * duration: 0,
* * detail: null
* * duration: 0
* * },
* * PerformanceEntry {
* * name: 'meow',
* * entryType: 'mark',
* * startTime: 56.350146,
* * duration: 0,
* * detail: null
* * duration: 0
* * }
* * ]
*
* performance.clearMarks();
* performance.clearMeasures();
* observer.disconnect();
* });
* obs.observe({ type: 'mark' });
@ -434,9 +396,6 @@ declare module "perf_hooks" {
getEntriesByType(type: EntryType): PerformanceEntry[];
}
type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void;
/**
* @since v8.5.0
*/
class PerformanceObserver extends AsyncResource {
constructor(callback: PerformanceObserverCallback);
/**
@ -450,11 +409,11 @@ declare module "perf_hooks" {
* ```js
* const {
* performance,
* PerformanceObserver,
* } = require('node:perf_hooks');
* PerformanceObserver
* } = require('perf_hooks');
*
* const obs = new PerformanceObserver((list, observer) => {
* // Called once asynchronously. `list` contains three items.
* // Called three times synchronously. `list` contains one item.
* });
* obs.observe({ type: 'mark' });
*
@ -466,13 +425,13 @@ declare module "perf_hooks" {
observe(
options:
| {
entryTypes: readonly EntryType[];
buffered?: boolean | undefined;
}
entryTypes: ReadonlyArray<EntryType>;
buffered?: boolean | undefined;
}
| {
type: EntryType;
buffered?: boolean | undefined;
},
type: EntryType;
buffered?: boolean | undefined;
}
): void;
}
namespace constants {
@ -557,7 +516,7 @@ declare module "perf_hooks" {
}
interface RecordableHistogram extends Histogram {
/**
* @since v15.9.0, v14.18.0
* @since v15.9.0
* @param val The amount to record in the histogram.
*/
record(val: number | bigint): void;
@ -566,14 +525,9 @@ declare module "perf_hooks" {
* previous call to `recordDelta()` and records that amount in the histogram.
*
* ## Examples
* @since v15.9.0, v14.18.0
* @since v15.9.0
*/
recordDelta(): void;
/**
* Adds the values from `other` to this histogram.
* @since v17.4.0, v16.14.0
*/
add(other: RecordableHistogram): void;
}
/**
* _This property is an extension by Node.js. It is not available in Web browsers._
@ -588,7 +542,7 @@ declare module "perf_hooks" {
* detect.
*
* ```js
* const { monitorEventLoopDelay } = require('node:perf_hooks');
* const { monitorEventLoopDelay } = require('perf_hooks');
* const h = monitorEventLoopDelay({ resolution: 20 });
* h.enable();
* // Do something.
@ -623,23 +577,10 @@ declare module "perf_hooks" {
}
/**
* Returns a `RecordableHistogram`.
* @since v15.9.0, v14.18.0
* @since v15.9.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';
}

498
node_modules/@types/node/ts4.8/process.d.ts generated vendored Normal file → Executable file
View File

@ -1,6 +1,6 @@
declare module "process" {
import * as tty from "node:tty";
import { Worker } from "node:worker_threads";
declare module 'process' {
import * as tty from 'node:tty';
import { Worker } from 'node:worker_threads';
global {
var process: NodeJS.Process;
namespace NodeJS {
@ -48,70 +48,47 @@ declare module "process" {
modules: string;
openssl: string;
}
type Platform =
| "aix"
| "android"
| "darwin"
| "freebsd"
| "haiku"
| "linux"
| "openbsd"
| "sunos"
| "win32"
| "cygwin"
| "netbsd";
type Architecture =
| "arm"
| "arm64"
| "ia32"
| "mips"
| "mipsel"
| "ppc"
| "ppc64"
| "riscv64"
| "s390"
| "s390x"
| "x64";
type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
type Signals =
| "SIGABRT"
| "SIGALRM"
| "SIGBUS"
| "SIGCHLD"
| "SIGCONT"
| "SIGFPE"
| "SIGHUP"
| "SIGILL"
| "SIGINT"
| "SIGIO"
| "SIGIOT"
| "SIGKILL"
| "SIGPIPE"
| "SIGPOLL"
| "SIGPROF"
| "SIGPWR"
| "SIGQUIT"
| "SIGSEGV"
| "SIGSTKFLT"
| "SIGSTOP"
| "SIGSYS"
| "SIGTERM"
| "SIGTRAP"
| "SIGTSTP"
| "SIGTTIN"
| "SIGTTOU"
| "SIGUNUSED"
| "SIGURG"
| "SIGUSR1"
| "SIGUSR2"
| "SIGVTALRM"
| "SIGWINCH"
| "SIGXCPU"
| "SIGXFSZ"
| "SIGBREAK"
| "SIGLOST"
| "SIGINFO";
type UncaughtExceptionOrigin = "uncaughtException" | "unhandledRejection";
type MultipleResolveType = "resolve" | "reject";
| 'SIGABRT'
| 'SIGALRM'
| 'SIGBUS'
| 'SIGCHLD'
| 'SIGCONT'
| 'SIGFPE'
| 'SIGHUP'
| 'SIGILL'
| 'SIGINT'
| 'SIGIO'
| 'SIGIOT'
| 'SIGKILL'
| 'SIGPIPE'
| 'SIGPOLL'
| 'SIGPROF'
| 'SIGPWR'
| 'SIGQUIT'
| 'SIGSEGV'
| 'SIGSTKFLT'
| 'SIGSTOP'
| 'SIGSYS'
| 'SIGTERM'
| 'SIGTRAP'
| 'SIGTSTP'
| 'SIGTTIN'
| 'SIGTTOU'
| 'SIGUNUSED'
| 'SIGURG'
| 'SIGUSR1'
| 'SIGUSR2'
| 'SIGVTALRM'
| 'SIGWINCH'
| 'SIGXCPU'
| 'SIGXFSZ'
| 'SIGBREAK'
| 'SIGLOST'
| 'SIGINFO';
type UncaughtExceptionOrigin = 'uncaughtException' | 'unhandledRejection';
type MultipleResolveType = 'resolve' | 'reject';
type BeforeExitListener = (code: number) => void;
type DisconnectListener = () => void;
type ExitListener = (code: number) => void;
@ -119,17 +96,13 @@ declare module "process" {
type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void;
/**
* Most of the time the unhandledRejection will be an Error, but this should not be relied upon
* as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error.
* as *anything* can be thrown/rejected, it is therefore unsafe to assume the the value is an Error.
*/
type UnhandledRejectionListener = (reason: unknown, promise: Promise<unknown>) => void;
type WarningListener = (warning: Error) => void;
type MessageListener = (message: unknown, sendHandle: unknown) => void;
type SignalsListener = (signal: Signals) => void;
type MultipleResolveListener = (
type: MultipleResolveType,
promise: Promise<unknown>,
value: unknown,
) => void;
type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<unknown>, value: unknown) => void;
type WorkerListener = (worker: Worker) => void;
interface Socket extends ReadWriteStream {
isTTY?: true | undefined;
@ -276,7 +249,7 @@ declare module "process" {
* For example, to copy `process.stdin` to `process.stdout`:
*
* ```js
* import { stdin, stdout } from 'node:process';
* import { stdin, stdout } from 'process';
*
* stdin.pipe(stdout);
* ```
@ -323,7 +296,7 @@ declare module "process" {
* For example, assuming the following script for `process-args.js`:
*
* ```js
* import { argv } from 'node:process';
* import { argv } from 'process';
*
* // print process.argv
* argv.forEach((val, index) => {
@ -333,8 +306,8 @@ declare module "process" {
*
* Launching the Node.js process as:
*
* ```bash
* node process-args.js one two=three four
* ```console
* $ node process-args.js one two=three four
* ```
*
* Would generate the output:
@ -370,8 +343,8 @@ declare module "process" {
* the script name. These options are useful in order to spawn child processes with
* the same execution environment as the parent.
*
* ```bash
* node --harmony script.js --version
* ```console
* $ node --harmony script.js --version
* ```
*
* Results in `process.execArgv`:
@ -415,7 +388,7 @@ declare module "process" {
* the specified `directory` does not exist).
*
* ```js
* import { chdir, cwd } from 'node:process';
* import { chdir, cwd } from 'process';
*
* console.log(`Starting directory: ${cwd()}`);
* try {
@ -435,7 +408,7 @@ declare module "process" {
* process.
*
* ```js
* import { cwd } from 'node:process';
* import { cwd } from 'process';
*
* console.log(`Current directory: ${cwd()}`);
* ```
@ -446,7 +419,7 @@ declare module "process" {
* The port used by the Node.js debugger when enabled.
*
* ```js
* import process from 'node:process';
* import process from 'process';
*
* process.debugPort = 5858;
* ```
@ -458,12 +431,12 @@ declare module "process" {
* specific process warnings. These can be listened for by adding a handler to the `'warning'` event.
*
* ```js
* import { emitWarning } from 'node:process';
* import { emitWarning } from 'process';
*
* // Emit a warning with a code and additional detail.
* emitWarning('Something happened!', {
* code: 'MY_WARNING',
* detail: 'This is some additional information',
* detail: 'This is some additional information'
* });
* // Emits:
* // (node:56338) [MY_WARNING] Warning: Something happened!
@ -473,7 +446,7 @@ declare module "process" {
* In this example, an `Error` object is generated internally by`process.emitWarning()` and passed through to the `'warning'` handler.
*
* ```js
* import process from 'node:process';
* import process from 'process';
*
* process.on('warning', (warning) => {
* console.warn(warning.name); // 'Warning'
@ -518,14 +491,14 @@ declare module "process" {
* to other `Worker` threads.
* In other words, the following example would not work:
*
* ```bash
* node -e 'process.env.foo = "bar"' &#x26;&#x26; echo $foo
* ```console
* $ node -e 'process.env.foo = "bar"' &#x26;&#x26; echo $foo
* ```
*
* While the following will:
*
* ```js
* import { env } from 'node:process';
* import { env } from 'process';
*
* env.foo = 'bar';
* console.log(env.foo);
@ -536,7 +509,7 @@ declare module "process" {
* throw an error when the value is not a string, number, or boolean.
*
* ```js
* import { env } from 'node:process';
* import { env } from 'process';
*
* env.test = null;
* console.log(env.test);
@ -549,7 +522,7 @@ declare module "process" {
* Use `delete` to delete a property from `process.env`.
*
* ```js
* import { env } from 'node:process';
* import { env } from 'process';
*
* env.TEST = 1;
* delete env.TEST;
@ -560,7 +533,7 @@ declare module "process" {
* On Windows operating systems, environment variables are case-insensitive.
*
* ```js
* import { env } from 'node:process';
* import { env } from 'process';
*
* env.TEST = 1;
* console.log(env.test);
@ -569,11 +542,10 @@ declare module "process" {
*
* Unless explicitly specified when creating a `Worker` instance,
* each `Worker` thread has its own copy of `process.env`, based on its
* parent thread's `process.env`, or whatever was specified as the `env` option
* parent threads `process.env`, or whatever was specified as the `env` option
* to the `Worker` constructor. Changes to `process.env` will not be visible
* across `Worker` threads, and only the main thread can make changes that
* are visible to the operating system or to native add-ons. On Windows, a copy of`process.env` on a `Worker` instance operates in a case-sensitive manner
* unlike the main thread.
* are visible to the operating system or to native add-ons.
* @since v0.1.27
*/
env: ProcessEnv;
@ -587,7 +559,7 @@ declare module "process" {
* To exit with a 'failure' code:
*
* ```js
* import { exit } from 'node:process';
* import { exit } from 'process';
*
* exit(1);
* ```
@ -606,7 +578,7 @@ declare module "process" {
* truncated and lost:
*
* ```js
* import { exit } from 'node:process';
* import { exit } from 'process';
*
* // This is an example of what *not* to do:
* if (someConditionNotMet()) {
@ -617,13 +589,13 @@ declare module "process" {
*
* The reason this is problematic is because writes to `process.stdout` in Node.js
* are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js
* event loop. Calling `process.exit()`, however, forces the process to exit _before_ those additional writes to `stdout` can be performed.
* event loop. Calling `process.exit()`, however, forces the process to exit_before_ those additional writes to `stdout` can be performed.
*
* Rather than calling `process.exit()` directly, the code _should_ set the`process.exitCode` and allow the process to exit naturally by avoiding
* scheduling any additional work for the event loop:
*
* ```js
* import process from 'node:process';
* import process from 'process';
*
* // How to properly set the exit code while letting
* // the process exit gracefully.
@ -640,7 +612,7 @@ declare module "process" {
* In `Worker` threads, this function stops the current thread rather
* than the current process.
* @since v0.1.13
* @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed.
* @param [code=0] The exit code.
*/
exit(code?: number): never;
/**
@ -669,7 +641,7 @@ declare module "process" {
* Android).
* @since v0.1.31
*/
getgid?: () => number;
getgid(): number;
/**
* The `process.setgid()` method sets the group identity of the process. (See [`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a
* numeric ID or a group name
@ -696,7 +668,7 @@ declare module "process" {
* @since v0.1.31
* @param id The group name or ID
*/
setgid?: (id: number | string) => void;
setgid(id: number | string): void;
/**
* The `process.getuid()` method returns the numeric user identity of the process.
* (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)
@ -713,7 +685,7 @@ declare module "process" {
* Android).
* @since v0.1.28
*/
getuid?: () => number;
getuid(): number;
/**
* The `process.setuid(id)` method sets the user identity of the process. (See [`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a
* numeric ID or a username string.
@ -739,7 +711,7 @@ declare module "process" {
* This feature is not available in `Worker` threads.
* @since v0.1.28
*/
setuid?: (id: number | string) => void;
setuid(id: number | string): void;
/**
* The `process.geteuid()` method returns the numerical effective user identity of
* the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)
@ -756,7 +728,7 @@ declare module "process" {
* Android).
* @since v2.0.0
*/
geteuid?: () => number;
geteuid(): number;
/**
* The `process.seteuid()` method sets the effective user identity of the process.
* (See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username
@ -783,7 +755,7 @@ declare module "process" {
* @since v2.0.0
* @param id A user name or ID
*/
seteuid?: (id: number | string) => void;
seteuid(id: number | string): void;
/**
* The `process.getegid()` method returns the numerical effective group identity
* of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)
@ -800,7 +772,7 @@ declare module "process" {
* Android).
* @since v2.0.0
*/
getegid?: () => number;
getegid(): number;
/**
* The `process.setegid()` method sets the effective group identity of the process.
* (See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group
@ -827,7 +799,7 @@ declare module "process" {
* @since v2.0.0
* @param id A group name or ID
*/
setegid?: (id: number | string) => void;
setegid(id: number | string): void;
/**
* The `process.getgroups()` method returns an array with the supplementary group
* IDs. POSIX leaves it unspecified if the effective group ID is included but
@ -845,7 +817,7 @@ declare module "process" {
* Android).
* @since v0.9.4
*/
getgroups?: () => number[];
getgroups(): number[];
/**
* The `process.setgroups()` method sets the supplementary group IDs for the
* Node.js process. This is a privileged operation that requires the Node.js
@ -871,7 +843,7 @@ declare module "process" {
* This feature is not available in `Worker` threads.
* @since v0.9.4
*/
setgroups?: (groups: ReadonlyArray<string | number>) => void;
setgroups(groups: ReadonlyArray<string | number>): void;
/**
* The `process.setUncaughtExceptionCaptureCallback()` function sets a function
* that will be invoked when an uncaught exception occurs, which will receive the
@ -896,29 +868,11 @@ declare module "process" {
* @since v9.3.0
*/
hasUncaughtExceptionCaptureCallback(): boolean;
/**
* The `process.sourceMapsEnabled` property returns whether the [Source Map v3](https://sourcemaps.info/spec.html) support for stack traces is enabled.
* @since v20.7.0
* @experimental
*/
readonly sourceMapsEnabled: boolean;
/**
* This function enables or disables the [Source Map v3](https://sourcemaps.info/spec.html) support for
* stack traces.
*
* It provides same features as launching Node.js process with commandline options`--enable-source-maps`.
*
* Only source maps in JavaScript files that are loaded after source maps has been
* enabled will be parsed and loaded.
* @since v16.6.0, v14.18.0
* @experimental
*/
setSourceMapsEnabled(value: boolean): void;
/**
* The `process.version` property contains the Node.js version string.
*
* ```js
* import { version } from 'node:process';
* import { version } from 'process';
*
* console.log(`Version: ${version}`);
* // Version: v14.8.0
@ -935,7 +889,7 @@ declare module "process" {
* to load modules that were compiled against a different module ABI version.
*
* ```js
* import { versions } from 'node:process';
* import { versions } from 'process';
*
* console.log(versions);
* ```
@ -943,39 +897,30 @@ declare module "process" {
* Will generate an object similar to:
*
* ```console
* { node: '20.2.0',
* acorn: '8.8.2',
* ada: '2.4.0',
* ares: '1.19.0',
* base64: '0.5.0',
* brotli: '1.0.9',
* cjs_module_lexer: '1.2.2',
* cldr: '43.0',
* icu: '73.1',
* llhttp: '8.1.0',
* modules: '115',
* napi: '8',
* nghttp2: '1.52.0',
* nghttp3: '0.7.0',
* ngtcp2: '0.8.1',
* openssl: '3.0.8+quic',
* simdutf: '3.2.9',
* tz: '2023c',
* undici: '5.22.0',
* unicode: '15.0',
* uv: '1.44.2',
* uvwasi: '0.0.16',
* v8: '11.3.244.8-node.9',
* zlib: '1.2.13' }
* { node: '11.13.0',
* v8: '7.0.276.38-node.18',
* uv: '1.27.0',
* zlib: '1.2.11',
* brotli: '1.0.7',
* ares: '1.15.0',
* modules: '67',
* nghttp2: '1.34.0',
* napi: '4',
* llhttp: '1.1.1',
* openssl: '1.1.1b',
* cldr: '34.0',
* icu: '63.1',
* tz: '2018e',
* unicode: '11.0' }
* ```
* @since v0.2.0
*/
readonly versions: ProcessVersions;
/**
* The `process.config` property returns a frozen `Object` containing the
* JavaScript representation of the configure options used to compile the current
* Node.js executable. This is the same as the `config.gypi` file that was produced
* when running the `./configure` script.
* The `process.config` property returns an `Object` containing the JavaScript
* representation of the configure options used to compile the current Node.js
* executable. This is the same as the `config.gypi` file that was produced when
* running the `./configure` script.
*
* An example of the possible output looks like:
*
@ -997,6 +942,7 @@ declare module "process" {
* node_shared_http_parser: 'false',
* node_shared_libuv: 'false',
* node_shared_zlib: 'false',
* node_use_dtrace: 'false',
* node_use_openssl: 'true',
* node_shared_openssl: 'false',
* strict_aliasing: 'true',
@ -1005,6 +951,13 @@ declare module "process" {
* }
* }
* ```
*
* The `process.config` property is **not** read-only and there are existing
* modules in the ecosystem that are known to extend, modify, or entirely replace
* the value of `process.config`.
*
* Modifying the `process.config` property, or any child-property of the`process.config` object has been deprecated. The `process.config` will be made
* read-only in a future release.
* @since v0.7.7
*/
readonly config: ProcessConfig;
@ -1023,7 +976,7 @@ declare module "process" {
* other than kill the target process.
*
* ```js
* import process, { kill } from 'node:process';
* import process, { kill } from 'process';
*
* process.on('SIGHUP', () => {
* console.log('Got SIGHUP signal.');
@ -1048,7 +1001,7 @@ declare module "process" {
* The `process.pid` property returns the PID of the process.
*
* ```js
* import { pid } from 'node:process';
* import { pid } from 'process';
*
* console.log(`This process is pid ${pid}`);
* ```
@ -1060,7 +1013,7 @@ declare module "process" {
* current process.
*
* ```js
* import { ppid } from 'node:process';
* import { ppid } from 'process';
*
* console.log(`The parent process is pid ${ppid}`);
* ```
@ -1087,19 +1040,19 @@ declare module "process" {
title: string;
/**
* The operating system CPU architecture for which the Node.js binary was compiled.
* Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, and `'x64'`.
* Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`,`'ppc64'`, `'s390'`, `'s390x'`, `'x32'`, and `'x64'`.
*
* ```js
* import { arch } from 'node:process';
* import { arch } from 'process';
*
* console.log(`This processor architecture is ${arch}`);
* ```
* @since v0.5.0
*/
readonly arch: Architecture;
readonly arch: string;
/**
* The `process.platform` property returns a string identifying the operating
* system platform for which the Node.js binary was compiled.
* system platform on which the Node.js process is running.
*
* Currently possible values are:
*
@ -1112,7 +1065,7 @@ declare module "process" {
* * `'win32'`
*
* ```js
* import { platform } from 'node:process';
* import { platform } from 'process';
*
* console.log(`This platform is ${platform}`);
* ```
@ -1135,17 +1088,6 @@ declare module "process" {
*/
mainModule?: Module | undefined;
memoryUsage: MemoryUsageFn;
/**
* Gets the amount of memory available to the process (in bytes) based on
* limits imposed by the OS. If there is no such constraint, or the constraint
* is unknown, `undefined` is returned.
*
* See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more
* information.
* @since v19.6.0, v18.15.0
* @experimental
*/
constrainedMemory(): number | undefined;
/**
* The `process.cpuUsage()` method returns the user and system CPU time usage of
* the current process, in an object with properties `user` and `system`, whose
@ -1157,7 +1099,7 @@ declare module "process" {
* argument to the function, to get a diff reading.
*
* ```js
* import { cpuUsage } from 'node:process';
* import { cpuUsage } from 'process';
*
* const startUsage = cpuUsage();
* // { user: 38579, system: 6986 }
@ -1181,7 +1123,7 @@ declare module "process" {
* See the [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick) guide for more background.
*
* ```js
* import { nextTick } from 'node:process';
* import { nextTick } from 'process';
*
* console.log('start');
* nextTick(() => {
@ -1199,7 +1141,7 @@ declare module "process" {
* I/O has occurred:
*
* ```js
* import { nextTick } from 'node:process';
* import { nextTick } from 'process';
*
* function MyThing(options) {
* this.setupOptions(options);
@ -1247,7 +1189,7 @@ declare module "process" {
* The following approach is much better:
*
* ```js
* import { nextTick } from 'node:process';
* import { nextTick } from 'process';
*
* function definitelyAsync(arg, cb) {
* if (arg) {
@ -1272,10 +1214,10 @@ declare module "process" {
* ```js
* {
* name: 'node',
* lts: 'Hydrogen',
* sourceUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz',
* headersUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz',
* libUrl: 'https://nodejs.org/download/release/v18.12.0/win-x64/node.lib'
* lts: 'Erbium',
* sourceUrl: 'https://nodejs.org/download/release/v12.18.1/node-v12.18.1.tar.gz',
* headersUrl: 'https://nodejs.org/download/release/v12.18.1/node-v12.18.1-headers.tar.gz',
* libUrl: 'https://nodejs.org/download/release/v12.18.1/win-x64/node.lib'
* }
* ```
*
@ -1316,28 +1258,11 @@ declare module "process" {
*/
uptime(): number;
hrtime: HRTime;
/**
* If the Node.js process was spawned with an IPC channel, the process.channel property is a reference to the IPC channel.
* If no IPC channel exists, this property is undefined.
* @since v7.1.0
*/
channel?: {
/**
* This method makes the IPC channel keep the event loop of the process running if .unref() has been called before.
* @since v7.1.0
*/
ref(): void;
/**
* This method makes the IPC channel not keep the event loop of the process running, and lets it finish even while the channel is open.
* @since v7.1.0
*/
unref(): void;
};
/**
* If Node.js is spawned with an IPC channel, the `process.send()` method can be
* used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object.
*
* If Node.js was not spawned with an IPC channel, `process.send` will be `undefined`.
* If Node.js was not spawned with an IPC channel, `process.send` will be`undefined`.
*
* The message goes through serialization and parsing. The resulting message might
* not be the same as what is originally sent.
@ -1350,7 +1275,7 @@ declare module "process" {
options?: {
swallowErrors?: boolean | undefined;
},
callback?: (error: Error | null) => void,
callback?: (error: Error | null) => void
): boolean;
/**
* If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.disconnect()` method will close the
@ -1396,7 +1321,7 @@ declare module "process" {
* dashes:
*
* ```js
* import { allowedNodeEnvironmentFlags } from 'node:process';
* import { allowedNodeEnvironmentFlags } from 'process';
*
* allowedNodeEnvironmentFlags.forEach((flag) => {
* // -r
@ -1422,7 +1347,7 @@ declare module "process" {
report?: ProcessReport | undefined;
/**
* ```js
* import { resourceUsage } from 'node:process';
* import { resourceUsage } from 'process';
*
* console.log(resourceUsage());
* /*
@ -1459,103 +1384,98 @@ declare module "process" {
*/
traceDeprecation: boolean;
/* EventEmitter */
addListener(event: "beforeExit", listener: BeforeExitListener): this;
addListener(event: "disconnect", listener: DisconnectListener): this;
addListener(event: "exit", listener: ExitListener): this;
addListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
addListener(event: "warning", listener: WarningListener): this;
addListener(event: "message", listener: MessageListener): this;
addListener(event: 'beforeExit', listener: BeforeExitListener): this;
addListener(event: 'disconnect', listener: DisconnectListener): this;
addListener(event: 'exit', listener: ExitListener): this;
addListener(event: 'rejectionHandled', listener: RejectionHandledListener): this;
addListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
addListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
addListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
addListener(event: 'warning', listener: WarningListener): this;
addListener(event: 'message', listener: MessageListener): this;
addListener(event: Signals, listener: SignalsListener): this;
addListener(event: "multipleResolves", listener: MultipleResolveListener): this;
addListener(event: "worker", listener: WorkerListener): this;
emit(event: "beforeExit", code: number): boolean;
emit(event: "disconnect"): boolean;
emit(event: "exit", code: number): boolean;
emit(event: "rejectionHandled", promise: Promise<unknown>): boolean;
emit(event: "uncaughtException", error: Error): boolean;
emit(event: "uncaughtExceptionMonitor", error: Error): boolean;
emit(event: "unhandledRejection", reason: unknown, promise: Promise<unknown>): boolean;
emit(event: "warning", warning: Error): boolean;
emit(event: "message", message: unknown, sendHandle: unknown): this;
emit(event: Signals, signal?: Signals): boolean;
emit(
event: "multipleResolves",
type: MultipleResolveType,
promise: Promise<unknown>,
value: unknown,
): this;
emit(event: "worker", listener: WorkerListener): this;
on(event: "beforeExit", listener: BeforeExitListener): this;
on(event: "disconnect", listener: DisconnectListener): this;
on(event: "exit", listener: ExitListener): this;
on(event: "rejectionHandled", listener: RejectionHandledListener): this;
on(event: "uncaughtException", listener: UncaughtExceptionListener): this;
on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
on(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
on(event: "warning", listener: WarningListener): this;
on(event: "message", listener: MessageListener): this;
addListener(event: 'multipleResolves', listener: MultipleResolveListener): this;
addListener(event: 'worker', listener: WorkerListener): this;
emit(event: 'beforeExit', code: number): boolean;
emit(event: 'disconnect'): boolean;
emit(event: 'exit', code: number): boolean;
emit(event: 'rejectionHandled', promise: Promise<unknown>): boolean;
emit(event: 'uncaughtException', error: Error): boolean;
emit(event: 'uncaughtExceptionMonitor', error: Error): boolean;
emit(event: 'unhandledRejection', reason: unknown, promise: Promise<unknown>): boolean;
emit(event: 'warning', warning: Error): boolean;
emit(event: 'message', message: unknown, sendHandle: unknown): this;
emit(event: Signals, signal: Signals): boolean;
emit(event: 'multipleResolves', type: MultipleResolveType, promise: Promise<unknown>, value: unknown): this;
emit(event: 'worker', listener: WorkerListener): this;
on(event: 'beforeExit', listener: BeforeExitListener): this;
on(event: 'disconnect', listener: DisconnectListener): this;
on(event: 'exit', listener: ExitListener): this;
on(event: 'rejectionHandled', listener: RejectionHandledListener): this;
on(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
on(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
on(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
on(event: 'warning', listener: WarningListener): this;
on(event: 'message', listener: MessageListener): this;
on(event: Signals, listener: SignalsListener): this;
on(event: "multipleResolves", listener: MultipleResolveListener): this;
on(event: "worker", listener: WorkerListener): this;
on(event: 'multipleResolves', listener: MultipleResolveListener): this;
on(event: 'worker', listener: WorkerListener): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "beforeExit", listener: BeforeExitListener): this;
once(event: "disconnect", listener: DisconnectListener): this;
once(event: "exit", listener: ExitListener): this;
once(event: "rejectionHandled", listener: RejectionHandledListener): this;
once(event: "uncaughtException", listener: UncaughtExceptionListener): this;
once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
once(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
once(event: "warning", listener: WarningListener): this;
once(event: "message", listener: MessageListener): this;
once(event: 'beforeExit', listener: BeforeExitListener): this;
once(event: 'disconnect', listener: DisconnectListener): this;
once(event: 'exit', listener: ExitListener): this;
once(event: 'rejectionHandled', listener: RejectionHandledListener): this;
once(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
once(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
once(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
once(event: 'warning', listener: WarningListener): this;
once(event: 'message', listener: MessageListener): this;
once(event: Signals, listener: SignalsListener): this;
once(event: "multipleResolves", listener: MultipleResolveListener): this;
once(event: "worker", listener: WorkerListener): this;
once(event: 'multipleResolves', listener: MultipleResolveListener): this;
once(event: 'worker', listener: WorkerListener): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: "beforeExit", listener: BeforeExitListener): this;
prependListener(event: "disconnect", listener: DisconnectListener): this;
prependListener(event: "exit", listener: ExitListener): this;
prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
prependListener(event: "warning", listener: WarningListener): this;
prependListener(event: "message", listener: MessageListener): this;
prependListener(event: 'beforeExit', listener: BeforeExitListener): this;
prependListener(event: 'disconnect', listener: DisconnectListener): this;
prependListener(event: 'exit', listener: ExitListener): this;
prependListener(event: 'rejectionHandled', listener: RejectionHandledListener): this;
prependListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
prependListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
prependListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
prependListener(event: 'warning', listener: WarningListener): this;
prependListener(event: 'message', listener: MessageListener): this;
prependListener(event: Signals, listener: SignalsListener): this;
prependListener(event: "multipleResolves", listener: MultipleResolveListener): this;
prependListener(event: "worker", listener: WorkerListener): this;
prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this;
prependOnceListener(event: "disconnect", listener: DisconnectListener): this;
prependOnceListener(event: "exit", listener: ExitListener): this;
prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
prependOnceListener(event: "warning", listener: WarningListener): this;
prependOnceListener(event: "message", listener: MessageListener): this;
prependListener(event: 'multipleResolves', listener: MultipleResolveListener): this;
prependListener(event: 'worker', listener: WorkerListener): this;
prependOnceListener(event: 'beforeExit', listener: BeforeExitListener): this;
prependOnceListener(event: 'disconnect', listener: DisconnectListener): this;
prependOnceListener(event: 'exit', listener: ExitListener): this;
prependOnceListener(event: 'rejectionHandled', listener: RejectionHandledListener): this;
prependOnceListener(event: 'uncaughtException', listener: UncaughtExceptionListener): this;
prependOnceListener(event: 'uncaughtExceptionMonitor', listener: UncaughtExceptionListener): this;
prependOnceListener(event: 'unhandledRejection', listener: UnhandledRejectionListener): this;
prependOnceListener(event: 'warning', listener: WarningListener): this;
prependOnceListener(event: 'message', listener: MessageListener): this;
prependOnceListener(event: Signals, listener: SignalsListener): this;
prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this;
prependOnceListener(event: "worker", listener: WorkerListener): this;
listeners(event: "beforeExit"): BeforeExitListener[];
listeners(event: "disconnect"): DisconnectListener[];
listeners(event: "exit"): ExitListener[];
listeners(event: "rejectionHandled"): RejectionHandledListener[];
listeners(event: "uncaughtException"): UncaughtExceptionListener[];
listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[];
listeners(event: "unhandledRejection"): UnhandledRejectionListener[];
listeners(event: "warning"): WarningListener[];
listeners(event: "message"): MessageListener[];
prependOnceListener(event: 'multipleResolves', listener: MultipleResolveListener): this;
prependOnceListener(event: 'worker', listener: WorkerListener): this;
listeners(event: 'beforeExit'): BeforeExitListener[];
listeners(event: 'disconnect'): DisconnectListener[];
listeners(event: 'exit'): ExitListener[];
listeners(event: 'rejectionHandled'): RejectionHandledListener[];
listeners(event: 'uncaughtException'): UncaughtExceptionListener[];
listeners(event: 'uncaughtExceptionMonitor'): UncaughtExceptionListener[];
listeners(event: 'unhandledRejection'): UnhandledRejectionListener[];
listeners(event: 'warning'): WarningListener[];
listeners(event: 'message'): MessageListener[];
listeners(event: Signals): SignalsListener[];
listeners(event: "multipleResolves"): MultipleResolveListener[];
listeners(event: "worker"): WorkerListener[];
listeners(event: 'multipleResolves'): MultipleResolveListener[];
listeners(event: 'worker'): WorkerListener[];
}
}
}
export = process;
}
declare module "node:process" {
import process = require("process");
declare module 'node:process' {
import process = require('process');
export = process;
}

10
node_modules/@types/node/ts4.8/punycode.d.ts generated vendored Normal file → Executable file
View File

@ -24,9 +24,9 @@
* made available to developers as a convenience. Fixes or other modifications to
* the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
* @deprecated Since v7.0.0 - Deprecated
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/punycode.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/punycode.js)
*/
declare module "punycode" {
declare module 'punycode' {
/**
* The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only
* characters to the equivalent string of Unicode codepoints.
@ -101,7 +101,7 @@ declare module "punycode" {
* Users currently depending on the punycode module should switch to using
* the userland-provided Punycode.js module instead.
*/
encode(codePoints: readonly number[]): string;
encode(codePoints: ReadonlyArray<number>): string;
}
/**
* @deprecated since v7.0.0
@ -112,6 +112,6 @@ declare module "punycode" {
*/
const version: string;
}
declare module "node:punycode" {
export * from "punycode";
declare module 'node:punycode' {
export * from 'punycode';
}

36
node_modules/@types/node/ts4.8/querystring.d.ts generated vendored Normal file → Executable file
View File

@ -1,17 +1,17 @@
/**
* The `node:querystring` module provides utilities for parsing and formatting URL
* The `querystring` module provides utilities for parsing and formatting URL
* query strings. It can be accessed using:
*
* ```js
* const querystring = require('node:querystring');
* const querystring = require('querystring');
* ```
*
* `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)
* 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)
*/
declare module "querystring" {
declare module 'querystring' {
interface StringifyOptions {
encodeURIComponent?: ((str: string) => string) | undefined;
}
@ -20,17 +20,7 @@ declare module "querystring" {
decodeURIComponent?: ((str: string) => string) | undefined;
}
interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> {}
interface ParsedUrlQueryInput extends
NodeJS.Dict<
| string
| number
| boolean
| readonly string[]
| readonly number[]
| readonly boolean[]
| null
>
{}
interface ParsedUrlQueryInput extends NodeJS.Dict<string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<boolean> | null> {}
/**
* The `querystring.stringify()` method produces a URL query string from a
* given `obj` by iterating through the object's "own properties".
@ -74,10 +64,10 @@ declare module "querystring" {
*
* For example, the query string `'foo=bar&#x26;abc=xyz&#x26;abc=123'` is parsed into:
*
* ```json
* ```js
* {
* "foo": "bar",
* "abc": ["xyz", "123"]
* foo: 'bar',
* abc: ['xyz', '123']
* }
* ```
*
@ -136,6 +126,6 @@ declare module "querystring" {
*/
function unescape(str: string): string;
}
declare module "node:querystring" {
export * from "querystring";
declare module 'node:querystring' {
export * from 'querystring';
}

326
node_modules/@types/node/ts4.8/readline.d.ts generated vendored Normal file → Executable file
View File

@ -1,42 +1,36 @@
/**
* 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:
* 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:
*
* ```js
* import * as readline from 'node:readline/promises';
* const readline = require('readline');
* ```
*
* To use the callback and sync APIs:
* The following simple example illustrates the basic use of the `readline` module.
*
* ```js
* import * as readline from 'node:readline';
* ```
* const readline = require('readline');
*
* The following simple example illustrates the basic use of the `node:readline`module.
* const rl = readline.createInterface({
* input: process.stdin,
* output: process.stdout
* });
*
* ```js
* import * as readline from 'node:readline/promises';
* import { stdin as input, stdout as output } from 'node:process';
* 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}`);
*
* 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();
* rl.close();
* });
* ```
*
* Once this code is invoked, the Node.js application will not terminate until the`readline.Interface` is closed because the interface waits for data to be
* received on the `input` stream.
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/readline.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/readline.js)
*/
declare module "readline" {
import { Abortable, EventEmitter } from "node:events";
import * as promises from "node:readline/promises";
export { promises };
export interface Key {
declare module 'readline' {
import { Abortable, EventEmitter } from 'node:events';
interface Key {
sequence?: string | undefined;
name?: string | undefined;
ctrl?: boolean | undefined;
@ -50,7 +44,7 @@ declare module "readline" {
* and is read from, the `input` stream.
* @since v0.1.104
*/
export class Interface extends EventEmitter {
class Interface extends EventEmitter {
readonly terminal: boolean;
/**
* The current input data being processed by node.
@ -73,7 +67,7 @@ declare module "readline" {
* const showResults = debounce(() => {
* console.log(
* '\n',
* values.filter((val) => val.startsWith(rl.line)).join(' '),
* values.filter((val) => val.startsWith(rl.line)).join(' ')
* );
* }, 300);
* process.stdin.on('keypress', (c, k) => {
@ -99,26 +93,21 @@ declare module "readline" {
* > Instances of the `readline.Interface` class are constructed using the
* > `readline.createInterface()` method.
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor
* @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
*/
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);
/**
* NOTE: According to the documentation:
*
* > Instances of the `readline.Interface` class are constructed using the
* > `readline.createInterface()` method.
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor
* @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
*/
protected constructor(options: ReadLineOptions);
/**
* The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`.
* @since v15.3.0, v14.17.0
* @since v15.3.0
* @return the current prompt string
*/
getPrompt(): string;
@ -128,13 +117,13 @@ declare module "readline" {
*/
setPrompt(prompt: string): void;
/**
* 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
* 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
* location at which to provide input.
*
* When called, `rl.prompt()` will resume the `input` stream if it has been
* paused.
*
* If the `Interface` was created with `output` set to `null` or`undefined` the prompt is not written.
* If the `readline.Interface` was created with `output` set to `null` or`undefined` the prompt is not written.
* @since v0.1.98
* @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`.
*/
@ -146,14 +135,12 @@ declare module "readline" {
* When called, `rl.question()` will resume the `input` stream if it has been
* paused.
*
* If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
* If the `readline.Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
*
* The `callback` function passed to `rl.question()` does not follow the typical
* pattern of accepting an `Error` object or `null` as the first argument.
* The `callback` is called with the provided answer as the only argument.
*
* An error will be thrown if calling `rl.question()` after `rl.close()`.
*
* Example usage:
*
* ```js
@ -178,6 +165,25 @@ declare module "readline" {
*
* setTimeout(() => ac.abort(), 10000);
* ```
*
* 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
* @param query A statement or query to write to `output`, prepended to the prompt.
* @param callback A callback function that is invoked with the user's input in response to the `query`.
@ -188,7 +194,7 @@ declare module "readline" {
* The `rl.pause()` method pauses the `input` stream, allowing it to be resumed
* later if necessary.
*
* Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `Interface` instance.
* Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `readline.Interface` instance.
* @since v0.3.4
*/
pause(): this;
@ -198,12 +204,12 @@ declare module "readline" {
*/
resume(): this;
/**
* The `rl.close()` method closes the `Interface` instance and
* The `rl.close()` method closes the `readline.Interface` instance and
* relinquishes control over the `input` and `output` streams. When called,
* the `'close'` event will be emitted.
*
* Calling `rl.close()` does not immediately stop other events (including `'line'`)
* from being emitted by the `Interface` instance.
* from being emitted by the `readline.Interface` instance.
* @since v0.1.98
*/
close(): void;
@ -218,7 +224,7 @@ declare module "readline" {
* When called, `rl.write()` will resume the `input` stream if it has been
* paused.
*
* If the `Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written.
* If the `readline.Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written.
*
* ```js
* rl.write('Delete this!');
@ -250,69 +256,66 @@ declare module "readline" {
* 8. history
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "line", listener: (input: string) => void): this;
addListener(event: "pause", listener: () => void): this;
addListener(event: "resume", listener: () => void): this;
addListener(event: "SIGCONT", listener: () => void): this;
addListener(event: "SIGINT", listener: () => void): this;
addListener(event: "SIGTSTP", listener: () => void): this;
addListener(event: "history", listener: (history: string[]) => void): this;
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>;
}
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 {
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 {
input: NodeJS.ReadableStream;
output?: NodeJS.WritableStream | undefined;
completer?: Completer | AsyncCompleter | undefined;
@ -341,10 +344,10 @@ declare module "readline" {
* The `readline.createInterface()` method creates a new `readline.Interface`instance.
*
* ```js
* const readline = require('node:readline');
* const readline = require('readline');
* const rl = readline.createInterface({
* input: process.stdin,
* output: process.stdout,
* output: process.stdout
* });
* ```
*
@ -363,17 +366,18 @@ declare module "readline" {
* (`process.stdout` does this automatically when it is a TTY).
*
* When creating a `readline.Interface` using `stdin` as input, the program
* 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()`.
* 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();
* ```
* @since v0.1.98
*/
export function createInterface(
input: NodeJS.ReadableStream,
output?: NodeJS.WritableStream,
completer?: Completer | AsyncCompleter,
terminal?: boolean,
): Interface;
export function createInterface(options: ReadLineOptions): Interface;
function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
function createInterface(options: ReadLineOptions): Interface;
/**
* The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input.
*
@ -390,6 +394,41 @@ declare module "readline" {
* if (process.stdin.isTTY)
* process.stdin.setRawMode(true);
* ```
* @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`.
*
* ## Example: Tiny CLI
*
@ -397,11 +436,11 @@ declare module "readline" {
* implement a small command-line interface:
*
* ```js
* const readline = require('node:readline');
* const readline = require('readline');
* const rl = readline.createInterface({
* input: process.stdin,
* output: process.stdout,
* prompt: 'OHAI> ',
* prompt: 'OHAI> '
* });
*
* rl.prompt();
@ -429,15 +468,15 @@ declare module "readline" {
* well as a `for await...of` loop:
*
* ```js
* const fs = require('node:fs');
* const readline = require('node:readline');
* const fs = require('fs');
* const readline = require('readline');
*
* async function processLineByLine() {
* const fileStream = fs.createReadStream('input.txt');
*
* const rl = readline.createInterface({
* input: fileStream,
* crlfDelay: Infinity,
* crlfDelay: Infinity
* });
* // Note: we use the crlfDelay option to recognize all instances of CR LF
* // ('\r\n') in input.txt as a single line break.
@ -454,12 +493,12 @@ declare module "readline" {
* Alternatively, one could use the `'line'` event:
*
* ```js
* const fs = require('node:fs');
* const readline = require('node:readline');
* const fs = require('fs');
* const readline = require('readline');
*
* const rl = readline.createInterface({
* input: fs.createReadStream('sample.txt'),
* crlfDelay: Infinity,
* crlfDelay: Infinity
* });
*
* rl.on('line', (line) => {
@ -470,15 +509,15 @@ declare module "readline" {
* Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied:
*
* ```js
* const { once } = require('node:events');
* const { createReadStream } = require('node:fs');
* const { createInterface } = require('node:readline');
* const { once } = require('events');
* const { createReadStream } = require('fs');
* const { createInterface } = require('readline');
*
* (async function processLineByLine() {
* try {
* const rl = createInterface({
* input: createReadStream('big-file.txt'),
* crlfDelay: Infinity,
* crlfDelay: Infinity
* });
*
* rl.on('line', (line) => {
@ -494,46 +533,11 @@ declare module "readline" {
* })();
* ```
* @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`.
*/
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;
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';
}

View File

@ -1,150 +0,0 @@
/**
* @since v17.0.0
* @experimental
*/
declare module "readline/promises" {
import { AsyncCompleter, Completer, Direction, Interface as _Interface, ReadLineOptions } from "node:readline";
import { Abortable } from "node:events";
/**
* Instances of the `readlinePromises.Interface` class are constructed using the`readlinePromises.createInterface()` method. Every instance is associated with a
* single `input` `Readable` stream and a single `output` `Writable` stream.
* The `output` stream is used to print prompts for user input that arrives on,
* and is read from, the `input` stream.
* @since v17.0.0
*/
class Interface extends _Interface {
/**
* The `rl.question()` method displays the `query` by writing it to the `output`,
* waits for user input to be provided on `input`, then invokes the `callback`function passing the provided input as the first argument.
*
* When called, `rl.question()` will resume the `input` stream if it has been
* paused.
*
* If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
*
* If the question is called after `rl.close()`, it returns a rejected promise.
*
* Example usage:
*
* ```js
* const answer = await rl.question('What is your favorite food? ');
* console.log(`Oh, so your favorite food is ${answer}`);
* ```
*
* Using an `AbortSignal` to cancel a question.
*
* ```js
* const signal = AbortSignal.timeout(10_000);
*
* signal.addEventListener('abort', () => {
* console.log('The food question timed out');
* }, { once: true });
*
* const answer = await rl.question('What is your favorite food? ', { signal });
* console.log(`Oh, so your favorite food is ${answer}`);
* ```
* @since v17.0.0
* @param query A statement or query to write to `output`, prepended to the prompt.
* @return A promise that is fulfilled with the user's input in response to the `query`.
*/
question(query: string): Promise<string>;
question(query: string, options: Abortable): Promise<string>;
}
/**
* @since v17.0.0
*/
class Readline {
/**
* @param stream A TTY stream.
*/
constructor(
stream: NodeJS.WritableStream,
options?: {
autoCommit?: boolean;
},
);
/**
* The `rl.clearLine()` method adds to the internal list of pending action an
* action that clears current line of the associated `stream` in a specified
* direction identified by `dir`.
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor.
* @since v17.0.0
* @return this
*/
clearLine(dir: Direction): this;
/**
* The `rl.clearScreenDown()` method adds to the internal list of pending action an
* action that clears the associated stream from the current position of the
* cursor down.
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor.
* @since v17.0.0
* @return this
*/
clearScreenDown(): this;
/**
* The `rl.commit()` method sends all the pending actions to the associated`stream` and clears the internal list of pending actions.
* @since v17.0.0
*/
commit(): Promise<void>;
/**
* The `rl.cursorTo()` method adds to the internal list of pending action an action
* that moves cursor to the specified position in the associated `stream`.
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor.
* @since v17.0.0
* @return this
*/
cursorTo(x: number, y?: number): this;
/**
* The `rl.moveCursor()` method adds to the internal list of pending action an
* action that moves the cursor _relative_ to its current position in the
* associated `stream`.
* Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor.
* @since v17.0.0
* @return this
*/
moveCursor(dx: number, dy: number): this;
/**
* The `rl.rollback` methods clears the internal list of pending actions without
* sending it to the associated `stream`.
* @since v17.0.0
* @return this
*/
rollback(): this;
}
/**
* The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface`instance.
*
* ```js
* const readlinePromises = require('node:readline/promises');
* const rl = readlinePromises.createInterface({
* input: process.stdin,
* output: process.stdout,
* });
* ```
*
* Once the `readlinePromises.Interface` instance is created, the most common case
* is to listen for the `'line'` event:
*
* ```js
* rl.on('line', (line) => {
* console.log(`Received: ${line}`);
* });
* ```
*
* If `terminal` is `true` for this instance then the `output` stream will get
* the best compatibility if it defines an `output.columns` property and emits
* a `'resize'` event on the `output` if or when the columns ever change
* (`process.stdout` does this automatically when it is a TTY).
* @since v17.0.0
*/
function createInterface(
input: NodeJS.ReadableStream,
output?: NodeJS.WritableStream,
completer?: Completer | AsyncCompleter,
terminal?: boolean,
): Interface;
function createInterface(options: ReadLineOptions): Interface;
}
declare module "node:readline/promises" {
export * from "readline/promises";
}

170
node_modules/@types/node/ts4.8/repl.d.ts generated vendored Normal file → Executable file
View File

@ -1,17 +1,17 @@
/**
* 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:
* 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:
*
* ```js
* const repl = require('node:repl');
* const repl = require('repl');
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/repl.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/repl.js)
*/
declare module "repl" {
import { AsyncCompleter, Completer, Interface } from "node:readline";
import { Context } from "node:vm";
import { InspectOptions } from "node:util";
declare module 'repl' {
import { Interface, Completer, AsyncCompleter } from 'node:readline';
import { Context } from 'node:vm';
import { InspectOptions } from 'node:util';
interface ReplOptions {
/**
* The input prompt to display.
@ -41,8 +41,8 @@ declare module "repl" {
* error with `repl.Recoverable` to indicate the input was incomplete and prompt for
* additional lines.
*
* @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
* @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
*/
eval?: REPLEval | undefined;
/**
@ -74,13 +74,13 @@ declare module "repl" {
* The function to invoke to format the output of each command before writing to `output`.
* Default: a wrapper for `util.inspect`.
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_customizing_repl_output
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_customizing_repl_output
*/
writer?: REPLWriter | undefined;
/**
* An optional function used for custom Tab auto completion.
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#readline_use_of_the_completer_function
* @see https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function
*/
completer?: Completer | AsyncCompleter | undefined;
/**
@ -99,13 +99,7 @@ declare module "repl" {
*/
breakEvalOnSigint?: boolean | 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;
/**
* This is the default "writer" value, if none is passed in the REPL options,
@ -130,7 +124,7 @@ declare module "repl" {
* or directly using the JavaScript `new` keyword.
*
* ```js
* const repl = require('node:repl');
* const repl = require('repl');
*
* const options = { useColors: true };
*
@ -168,33 +162,33 @@ declare module "repl" {
/**
* A value indicating whether the REPL is currently in "editor mode".
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_commands_and_special_keys
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_commands_and_special_keys
*/
readonly editorMode: boolean;
/**
* A value indicating whether the `_` variable has been assigned.
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly underscoreAssigned: boolean;
/**
* The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL).
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly last: any;
/**
* A value indicating whether the `_error` variable has been assigned.
*
* @since v9.8.0
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly underscoreErrAssigned: boolean;
/**
* The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL).
*
* @since v9.8.0
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
*/
readonly lastError: any;
/**
@ -246,7 +240,7 @@ declare module "repl" {
*
* `REPLServer` cannot be subclassed due to implementation specifics in NodeJS.
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_class_replserver
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_class_replserver
*/
private constructor();
/**
@ -257,7 +251,7 @@ declare module "repl" {
* The following example shows two new commands added to the REPL instance:
*
* ```js
* const repl = require('node:repl');
* const repl = require('repl');
*
* const replServer = repl.start({ prompt: '> ' });
* replServer.defineCommand('sayhello', {
@ -266,7 +260,7 @@ declare module "repl" {
* this.clearBufferedCommand();
* console.log(`Hello, ${name}!`);
* this.displayPrompt();
* },
* }
* });
* replServer.defineCommand('saybye', function saybye() {
* console.log('Goodbye!');
@ -283,7 +277,7 @@ declare module "repl" {
* Goodbye!
* ```
* @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.
*/
defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void;
@ -332,65 +326,65 @@ declare module "repl" {
* 9. reset
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "line", listener: (input: string) => void): this;
addListener(event: "pause", listener: () => void): this;
addListener(event: "resume", listener: () => void): this;
addListener(event: "SIGCONT", listener: () => void): this;
addListener(event: "SIGINT", listener: () => void): this;
addListener(event: "SIGTSTP", listener: () => void): this;
addListener(event: "exit", listener: () => void): this;
addListener(event: "reset", listener: (context: Context) => void): this;
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;
}
/**
* A flag passed in the REPL options. Evaluates expressions in sloppy mode.
@ -407,7 +401,7 @@ declare module "repl" {
* If `options` is a string, then it specifies the input prompt:
*
* ```js
* const repl = require('node:repl');
* const repl = require('repl');
*
* // a Unix style prompt
* repl.start('$ ');
@ -418,13 +412,13 @@ declare module "repl" {
/**
* Indicates a recoverable error that a `REPLServer` can use to support multi-line input.
*
* @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_recoverable_errors
* @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_recoverable_errors
*/
class Recoverable extends SyntaxError {
err: Error;
constructor(err: Error);
}
}
declare module "node:repl" {
export * from "repl";
declare module 'node:repl' {
export * from 'repl';
}

2167
node_modules/@types/node/ts4.8/stream.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

32
node_modules/@types/node/ts4.8/stream/consumers.d.ts generated vendored Normal file → Executable file
View File

@ -1,12 +1,24 @@
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>;
// 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 "node:stream/consumers" {
export * from "stream/consumers";
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';
}

71
node_modules/@types/node/ts4.8/stream/promises.d.ts generated vendored Normal file → Executable file
View File

@ -1,83 +1,42 @@
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>,
>(
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>>(
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,
transform1: T1,
transform2: T2,
destination: B,
options?: PipelineOptions,
options?: PipelineOptions
): PipelinePromise<B>;
function pipeline<
A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
T2 extends PipelineTransform<T1, any>,
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<
A extends PipelineSource<any>,
T1 extends PipelineTransform<A, any>,
T2 extends PipelineTransform<T1, any>,
T3 extends PipelineTransform<T2, 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,
stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>
): Promise<void>;
}
declare module "node:stream/promises" {
export * from "stream/promises";
declare module 'node:stream/promises' {
export * from 'stream/promises';
}

124
node_modules/@types/node/ts4.8/stream/web.d.ts generated vendored Normal file → Executable file
View File

@ -1,6 +1,7 @@
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> {
readable: ReadableStream<R>;
/**
@ -14,6 +15,7 @@ declare module "stream/web" {
*/
writable: WritableStream<W>;
}
interface StreamPipeOptions {
preventAbort?: boolean;
preventCancel?: boolean;
@ -61,14 +63,17 @@ declare module "stream/web" {
preventClose?: boolean;
signal?: AbortSignal;
}
interface ReadableStreamGenericReader {
readonly closed: Promise<undefined>;
cancel(reason?: any): Promise<void>;
}
interface ReadableStreamDefaultReadValueResult<T> {
done: false;
value: T;
}
interface ReadableStreamDefaultReadDoneResult {
done: true;
value?: undefined;
@ -77,61 +82,66 @@ declare module "stream/web" {
type ReadableStreamDefaultReadResult<T> =
| ReadableStreamDefaultReadValueResult<T>
| 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 {
autoAllocateChunkSize?: number;
cancel?: ReadableStreamErrorCallback;
pull?: ReadableByteStreamControllerCallback;
start?: ReadableByteStreamControllerCallback;
type: "bytes";
type: 'bytes';
}
interface UnderlyingSource<R = any> {
cancel?: UnderlyingSourceCancelCallback;
pull?: UnderlyingSourcePullCallback<R>;
start?: UnderlyingSourceStartCallback<R>;
type?: undefined;
}
interface UnderlyingSink<W = any> {
abort?: UnderlyingSinkAbortCallback;
close?: UnderlyingSinkCloseCallback;
@ -139,40 +149,45 @@ declare module "stream/web" {
type?: undefined;
write?: UnderlyingSinkWriteCallback<W>;
}
interface ReadableStreamErrorCallback {
(reason: any): void | PromiseLike<void>;
}
/** This Streams API interface represents a readable stream of byte data. */
interface ReadableStream<R = any> {
readonly locked: boolean;
cancel(reason?: any): Promise<void>;
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>];
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 {
read(): Promise<ReadableStreamDefaultReadResult<R>>;
releaseLock(): void;
}
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 {
readonly byobRequest: undefined;
readonly desiredSize: number | null;
@ -180,20 +195,24 @@ declare module "stream/web" {
enqueue(chunk: ArrayBufferView): void;
error(error?: any): void;
}
const ReadableByteStreamController: {
prototype: ReadableByteStreamController;
new(): ReadableByteStreamController;
new (): ReadableByteStreamController;
};
interface ReadableStreamDefaultController<R = any> {
readonly desiredSize: number | null;
close(): void;
enqueue(chunk?: R): void;
error(e?: any): void;
}
const ReadableStreamDefaultController: {
prototype: ReadableStreamDefaultController;
new(): ReadableStreamDefaultController;
new (): ReadableStreamDefaultController;
};
interface Transformer<I = any, O = any> {
flush?: TransformerFlushCallback<O>;
readableType?: undefined;
@ -201,28 +220,33 @@ declare module "stream/web" {
transform?: TransformerTransformCallback<I, O>;
writableType?: undefined;
}
interface TransformStream<I = any, O = any> {
readonly readable: ReadableStream<O>;
readonly writable: WritableStream<I>;
}
const TransformStream: {
prototype: TransformStream;
new<I = any, O = any>(
new <I = any, O = any>(
transformer?: Transformer<I, O>,
writableStrategy?: QueuingStrategy<I>,
readableStrategy?: QueuingStrategy<O>,
): TransformStream<I, O>;
};
interface TransformStreamDefaultController<O = any> {
readonly desiredSize: number | null;
enqueue(chunk?: O): void;
error(reason?: any): void;
terminate(): void;
}
const TransformStreamDefaultController: {
prototype: TransformStreamDefaultController;
new(): TransformStreamDefaultController;
new (): TransformStreamDefaultController;
};
/**
* This Streams API interface provides a standard abstraction for writing
* streaming data to a destination, known as a sink. This object comes with
@ -234,10 +258,12 @@ declare module "stream/web" {
close(): Promise<void>;
getWriter(): WritableStreamDefaultWriter<W>;
}
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>;
};
/**
* This Streams API interface is the object returned by
* WritableStream.getWriter() and once created locks the < writer to the
@ -253,10 +279,12 @@ declare module "stream/web" {
releaseLock(): void;
write(chunk?: W): Promise<void>;
}
const WritableStreamDefaultWriter: {
prototype: WritableStreamDefaultWriter;
new<W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
new <W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
};
/**
* This Streams API interface represents a controller allowing control of a
* WritableStream's state. When constructing a WritableStream, the
@ -266,17 +294,21 @@ declare module "stream/web" {
interface WritableStreamDefaultController {
error(e?: any): void;
}
const WritableStreamDefaultController: {
prototype: WritableStreamDefaultController;
new(): WritableStreamDefaultController;
new (): WritableStreamDefaultController;
};
interface QueuingStrategy<T = any> {
highWaterMark?: number;
size?: QueuingStrategySize<T>;
}
interface QueuingStrategySize<T = any> {
(chunk?: T): number;
}
interface QueuingStrategyInit {
/**
* Creates a new ByteLengthQueuingStrategy with the provided high water
@ -289,6 +321,7 @@ declare module "stream/web" {
*/
highWaterMark: number;
}
/**
* This Streams API interface provides a built-in byte length queuing
* strategy that can be used when constructing streams.
@ -297,10 +330,12 @@ declare module "stream/web" {
readonly highWaterMark: number;
readonly size: QueuingStrategySize<ArrayBufferView>;
}
const ByteLengthQueuingStrategy: {
prototype: ByteLengthQueuingStrategy;
new(init: QueuingStrategyInit): ByteLengthQueuingStrategy;
new (init: QueuingStrategyInit): ByteLengthQueuingStrategy;
};
/**
* This Streams API interface provides a built-in byte length queuing
* strategy that can be used when constructing streams.
@ -309,26 +344,32 @@ declare module "stream/web" {
readonly highWaterMark: number;
readonly size: QueuingStrategySize;
}
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>;
readonly writable: WritableStream<string>;
readonly [Symbol.toStringTag]: string;
}
const TextEncoderStream: {
prototype: TextEncoderStream;
new(): TextEncoderStream;
new (): TextEncoderStream;
};
interface TextDecoderOptions {
fatal?: boolean;
ignoreBOM?: boolean;
}
type BufferSource = ArrayBufferView | ArrayBuffer;
interface TextDecoderStream {
/** Returns encoding's name, lower cased. */
readonly encoding: string;
@ -340,27 +381,12 @@ declare module "stream/web" {
readonly writable: WritableStream<BufferSource>;
readonly [Symbol.toStringTag]: string;
}
const TextDecoderStream: {
prototype: TextDecoderStream;
new(encoding?: string, options?: TextDecoderOptions): TextDecoderStream;
};
interface CompressionStream<R = any, W = any> {
readonly readable: ReadableStream<R>;
readonly writable: WritableStream<W>;
}
const CompressionStream: {
prototype: CompressionStream;
new<R = any, W = any>(format: string): CompressionStream<R, W>;
};
interface DecompressionStream<R = any, W = any> {
readonly readable: ReadableStream<R>;
readonly writable: WritableStream<W>;
}
const DecompressionStream: {
prototype: DecompressionStream;
new<R = any, W = any>(format: string): DecompressionStream<R, W>;
new (label?: string, options?: TextDecoderOptions): TextDecoderStream;
};
}
declare module "node:stream/web" {
export * from "stream/web";
declare module 'node:stream/web' {
export * from 'stream/web';
}

28
node_modules/@types/node/ts4.8/string_decoder.d.ts generated vendored Normal file → Executable file
View File

@ -1,23 +1,23 @@
/**
* 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
* 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
* characters. It can be accessed using:
*
* ```js
* const { StringDecoder } = require('node:string_decoder');
* const { StringDecoder } = require('string_decoder');
* ```
*
* The following example shows the basic use of the `StringDecoder` class.
*
* ```js
* const { StringDecoder } = require('node:string_decoder');
* const { StringDecoder } = require('string_decoder');
* const decoder = new StringDecoder('utf8');
*
* const cent = Buffer.from([0xC2, 0xA2]);
* console.log(decoder.write(cent)); // Prints: ¢
* console.log(decoder.write(cent));
*
* const euro = Buffer.from([0xE2, 0x82, 0xAC]);
* console.log(decoder.write(euro)); // Prints: €
* console.log(decoder.write(euro));
* ```
*
* When a `Buffer` instance is written to the `StringDecoder` instance, an
@ -29,16 +29,16 @@
* symbol (``) are written over three separate operations:
*
* ```js
* const { StringDecoder } = require('node:string_decoder');
* const { StringDecoder } = require('string_decoder');
* const decoder = new StringDecoder('utf8');
*
* decoder.write(Buffer.from([0xE2]));
* decoder.write(Buffer.from([0x82]));
* console.log(decoder.end(Buffer.from([0xAC]))); // Prints: €
* console.log(decoder.end(Buffer.from([0xAC])));
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/string_decoder.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/string_decoder.js)
*/
declare module "string_decoder" {
declare module 'string_decoder' {
class StringDecoder {
constructor(encoding?: BufferEncoding);
/**
@ -46,7 +46,7 @@ declare module "string_decoder" {
* the end of the `Buffer`, or `TypedArray`, or `DataView` are omitted from the
* returned string and stored in an internal buffer for the next call to`stringDecoder.write()` or `stringDecoder.end()`.
* @since v0.1.99
* @param buffer The bytes to decode.
* @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
*/
write(buffer: Buffer): string;
/**
@ -57,11 +57,11 @@ declare module "string_decoder" {
* If the `buffer` argument is provided, one final call to `stringDecoder.write()`is performed before returning the remaining input.
* After `end()` is called, the `stringDecoder` object can be reused for new input.
* @since v0.9.3
* @param buffer The bytes to decode.
* @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
*/
end(buffer?: Buffer): string;
}
}
declare module "node:string_decoder" {
export * from "string_decoder";
declare module 'node:string_decoder' {
export * from 'string_decoder';
}

1471
node_modules/@types/node/ts4.8/test.d.ts generated vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

178
node_modules/@types/node/ts4.8/timers.d.ts generated vendored Normal file → Executable file
View File

@ -1,20 +1,16 @@
/**
* 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('node:timers')` to use the API.
* globals, there is no need to call `require('timers')` to use the API.
*
* The timer functions within Node.js implement a similar API as the timers API
* provided by Web Browsers but use a different internal implementation that is
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/timers.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/timers.js)
*/
declare module "timers" {
import { Abortable } from "node:events";
import {
setImmediate as setImmediatePromise,
setInterval as setIntervalPromise,
setTimeout as setTimeoutPromise,
} from "node:timers/promises";
declare module 'timers' {
import { Abortable } from 'node:events';
import { setTimeout as setTimeoutPromise, setImmediate as setImmediatePromise, setInterval as setIntervalPromise } from 'node:timers/promises';
interface TimerOptions extends Abortable {
/**
* Set to `false` to indicate that the scheduled `Timeout`
@ -37,74 +33,15 @@ declare module "timers" {
refresh(): this;
[Symbol.toPrimitive](): number;
}
/**
* 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;
interface Immediate extends RefCounted {
/**
* If true, the `Immediate` object will keep the Node.js event loop active.
* @since v11.0.0
*/
hasRef(): boolean;
_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;
}
/**
* 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;
interface Timeout extends Timer {
/**
* If true, the `Timeout` object will keep the Node.js event loop active.
* @since v11.0.0
@ -123,118 +60,35 @@ declare module "timers" {
*/
refresh(): this;
[Symbol.toPrimitive](): number;
/**
* Cancels the timeout.
* @since v20.5.0
*/
[Symbol.dispose](): void;
}
}
/**
* 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;
function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
// util.promisify no rest args compability
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
// tslint:disable-next-line void-return
function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
namespace setTimeout {
const __promisify__: typeof setTimeoutPromise;
}
/**
* 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;
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
// util.promisify no rest args compability
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
// tslint:disable-next-line void-return
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timer;
namespace setInterval {
const __promisify__: typeof setIntervalPromise;
}
/**
* 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;
function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
// util.promisify no rest args compability
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
// tslint:disable-next-line void-return
function setImmediate(callback: (args: void) => void): NodeJS.Immediate;
namespace setImmediate {
const __promisify__: typeof setImmediatePromise;
}
/**
* 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';
}

35
node_modules/@types/node/ts4.8/timers/promises.d.ts generated vendored Normal file → Executable file
View File

@ -1,6 +1,6 @@
/**
* The `timers/promises` API provides an alternative set of timer functions
* that return `Promise` objects. The API is accessible via`require('node:timers/promises')`.
* that return `Promise` objects. The API is accessible via`require('timers/promises')`.
*
* ```js
* import {
@ -11,8 +11,8 @@
* ```
* @since v15.0.0
*/
declare module "timers/promises" {
import { TimerOptions } from "node:timers";
declare module 'timers/promises' {
import { TimerOptions } from 'node:timers';
/**
* ```js
* import {
@ -44,8 +44,6 @@ declare module "timers/promises" {
function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
/**
* 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.
*
* ```js
* import {
@ -64,30 +62,7 @@ declare module "timers/promises" {
* @since v15.9.0
*/
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';
}

411
node_modules/@types/node/ts4.8/tls.d.ts generated vendored Normal file → Executable file
View File

@ -1,17 +1,16 @@
/**
* The `node:tls` module provides an implementation of the Transport Layer Security
* The `tls` module provides an implementation of the Transport Layer Security
* (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL.
* The module can be accessed using:
*
* ```js
* const tls = require('node:tls');
* const tls = require('tls');
* ```
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/tls.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/tls.js)
*/
declare module "tls" {
import { X509Certificate } from "node:crypto";
import * as net from "node:net";
import * as stream from "stream";
declare module 'tls' {
import { X509Certificate } from 'node:crypto';
import * as net from 'node:net';
const CLIENT_RENEG_LIMIT: number;
const CLIENT_RENEG_WINDOW: number;
interface Certificate {
@ -41,100 +40,21 @@ declare module "tls" {
CN: string;
}
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;
/**
* The date-time the certificate is valid from.
*/
subjectaltname: string;
infoAccess: NodeJS.Dict<string[]>;
modulus: string;
exponent: string;
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;
/**
* 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;
ext_key_usage: string[];
serialNumber: string;
raw: Buffer;
}
interface DetailedPeerCertificate extends PeerCertificate {
/**
* The issuer certificate object.
* For self-signed certificates, this may be a circular reference.
*/
issuerCertificate: DetailedPeerCertificate;
}
interface CipherNameAndProtocol {
@ -212,7 +132,7 @@ declare module "tls" {
*
* Instances of `tls.TLSSocket` implement the duplex `Stream` interface.
*
* 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.
* @since v0.11.4
*/
@ -222,8 +142,8 @@ declare module "tls" {
*/
constructor(socket: net.Socket, options?: TLSSocketOptions);
/**
* This property is `true` if the peer certificate was signed by one of the CAs
* specified when creating the `tls.TLSSocket` instance, otherwise `false`.
* Returns `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
*/
authorized: boolean;
@ -259,13 +179,13 @@ declare module "tls" {
/**
* Returns an object containing information on the negotiated cipher suite.
*
* For example, a TLSv1.2 protocol with AES256-SHA cipher:
* For example:
*
* ```json
* {
* "name": "AES256-SHA",
* "standardName": "TLS_RSA_WITH_AES_256_CBC_SHA",
* "version": "SSLv3"
* "name": "AES128-SHA256",
* "standardName": "TLS_RSA_WITH_AES_128_CBC_SHA256",
* "version": "TLSv1.2"
* }
* ```
*
@ -396,7 +316,7 @@ declare module "tls" {
rejectUnauthorized?: boolean | undefined;
requestCert?: boolean | undefined;
},
callback: (err: Error | null) => void,
callback: (err: Error | null) => void
): undefined | boolean;
/**
* The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size.
@ -422,9 +342,9 @@ declare module "tls" {
* When enabled, TLS packet trace information is written to `stderr`. This can be
* used to debug TLS connection problems.
*
* 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.
* 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.
* @since v12.2.0
*/
enableTrace(): void;
@ -453,7 +373,7 @@ declare module "tls" {
* 128,
* 'client finished');
*
* /*
*
* Example return value of keyingMaterial:
* <Buffer 76 26 af 99 c5 56 8e 42 09 91 ef 9f 93 cb ad 6c 7b 65 f8 53 f1 d8 d9
* 12 5a 33 b8 b5 25 df 7b 37 9f e0 e2 4f b8 67 83 a3 2f cd 5d 41 42 4c 91
@ -472,35 +392,35 @@ declare module "tls" {
*/
exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer;
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
addListener(event: "secureConnect", listener: () => void): this;
addListener(event: "session", listener: (session: Buffer) => void): this;
addListener(event: "keylog", listener: (line: Buffer) => void): this;
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;
}
interface CommonConnectionOptions {
/**
@ -561,6 +481,7 @@ declare module "tls" {
*/
ticketKeys?: Buffer | undefined;
/**
*
* @param socket
* @param identity identity parameter sent from the client.
* @return pre-shared key that must either be
@ -595,7 +516,7 @@ declare module "tls" {
host?: string | undefined;
port?: number | undefined;
path?: string | undefined; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored.
socket?: stream.Duplex | undefined; // Establish secure connection on a given socket rather than creating a new socket
socket?: net.Socket | undefined; // Establish secure connection on a given socket rather than creating a new socket
checkServerIdentity?: typeof checkServerIdentity | undefined;
servername?: string | undefined; // SNI TLS Extension
session?: Buffer | undefined;
@ -636,8 +557,7 @@ declare module "tls" {
* used.
* @since v0.5.3
* @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), or a TLS context object created
* with {@link createSecureContext} itself.
* @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc).
*/
addContext(hostname: string, context: SecureContextOptions): void;
/**
@ -676,118 +596,47 @@ declare module "tls" {
* 6. keylog
*/
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
addListener(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
): this;
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;
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: () => 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;
emit(event: 'tlsClientError', err: Error, tlsSocket: TLSSocket): boolean;
emit(event: 'newSession', sessionId: Buffer, sessionData: Buffer, callback: () => void): boolean;
emit(event: 'OCSPRequest', certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean;
emit(event: 'resumeSession', sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void): boolean;
emit(event: 'secureConnection', tlsSocket: TLSSocket): boolean;
emit(event: 'keylog', line: Buffer, tlsSocket: TLSSocket): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
on(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
on(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
): this;
on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
on(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this;
on(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
on(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
on(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this;
on(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this;
on(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
once(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
): this;
once(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
once(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
): this;
once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
once(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this;
once(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
once(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
once(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this;
once(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this;
once(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
prependListener(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
): this;
prependListener(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
prependListener(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
): this;
prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
prependListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: TLSSocket) => void): this;
prependListener(event: 'newSession', listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this;
prependListener(event: 'OCSPRequest', listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
prependListener(event: 'resumeSession', listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void): this;
prependListener(event: 'secureConnection', listener: (tlsSocket: TLSSocket) => void): this;
prependListener(event: 'keylog', listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
prependOnceListener(
event: "newSession",
listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void,
): this;
prependOnceListener(
event: "OCSPRequest",
listener: (
certificate: Buffer,
issuer: Buffer,
callback: (err: Error | null, resp: Buffer) => void,
) => void,
): this;
prependOnceListener(
event: "resumeSession",
listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void,
): this;
prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
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;
}
/**
* @deprecated since v0.11.3 Use `tls.TLSSocket` instead.
@ -796,19 +645,8 @@ declare module "tls" {
encrypted: TLSSocket;
cleartext: TLSSocket;
}
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
* the well-known CAs curated by Mozilla. Mozilla's CAs are completely
@ -850,9 +688,12 @@ declare module "tls" {
*/
crl?: string | Buffer | Array<string | Buffer> | undefined;
/**
* `'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.
* 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.
*/
dhparam?: string | Buffer | undefined;
/**
@ -881,7 +722,7 @@ declare module "tls" {
* object.passphrase is optional. Encrypted keys will be decrypted with
* object.passphrase if provided, or options.passphrase if it is not.
*/
key?: string | Buffer | Array<string | Buffer | KeyObject> | undefined;
key?: string | Buffer | Array<Buffer | KeyObject> | undefined;
/**
* Name of an OpenSSL engine to get private key from. Should be used
* together with privateKeyIdentifier.
@ -972,19 +813,13 @@ declare module "tls" {
* Returns [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on
* failure. On success, returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type).
*
* 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
* This function can be overwritten by providing alternative function as part of
* the `options.checkServerIdentity` option passed to `tls.connect()`. The
* overwriting function can call `tls.checkServerIdentity()` of course, to augment
* the checks done with additional verification.
*
* This function is only called if the certificate passed all other checks, such as
* 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
* @param hostname The host name or IP address to verify the certificate against.
* @param cert A `certificate object` representing the peer's certificate.
@ -994,14 +829,14 @@ declare module "tls" {
* Creates a new {@link Server}. The `secureConnectionListener`, if provided, is
* automatically set as a listener for the `'secureConnection'` event.
*
* The `ticketKeys` options is automatically shared between `node:cluster` module
* The `ticketKeys` options is automatically shared between `cluster` module
* workers.
*
* The following illustrates a simple echo server:
*
* ```js
* const tls = require('node:tls');
* const fs = require('node:fs');
* const tls = require('tls');
* const fs = require('fs');
*
* const options = {
* key: fs.readFileSync('server-key.pem'),
@ -1011,7 +846,7 @@ declare module "tls" {
* requestCert: true,
*
* // This is necessary only if the client uses a self-signed certificate.
* ca: [ fs.readFileSync('client-cert.pem') ],
* ca: [ fs.readFileSync('client-cert.pem') ]
* };
*
* const server = tls.createServer(options, (socket) => {
@ -1046,8 +881,8 @@ declare module "tls" {
*
* ```js
* // Assumes an echo server that is listening on port 8000.
* const tls = require('node:tls');
* const fs = require('node:fs');
* const tls = require('tls');
* const fs = require('fs');
*
* const options = {
* // Necessary only if the server requires client certificate authentication.
@ -1078,12 +913,7 @@ declare module "tls" {
* @since v0.11.3
*/
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;
/**
* Creates a new secure pair object with two streams, one of which reads and writes
@ -1118,12 +948,7 @@ declare module "tls" {
* @param requestCert `true` to specify whether a server should request a certificate from a connecting client. Only applies when `isServer` is `true`.
* @param rejectUnauthorized If not `false` a server automatically reject clients with invalid certificates. Only applies when `isServer` is `true`.
*/
function createSecurePair(
context?: SecureContext,
isServer?: boolean,
requestCert?: boolean,
rejectUnauthorized?: boolean,
): SecurePair;
function createSecurePair(context?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
/**
* {@link createServer} sets the default value of the `honorCipherOrder` option
* to `true`, other APIs that create secure contexts leave it unset.
@ -1133,19 +958,12 @@ declare module "tls" {
* APIs that create secure contexts have no default value.
*
* The `tls.createSecureContext()` method creates a `SecureContext` object. It is
* 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.
* usable as an argument to several `tls` APIs, such as {@link createServer} and `server.addContext()`, but has no public methods.
*
* A key is _required_ for ciphers that use certificates. Either `key` or`pfx` can be used to provide it.
*
* If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of
* 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
*/
function createSecureContext(options?: SecureContextOptions): SecureContext;
@ -1154,8 +972,6 @@ declare module "tls" {
* lower-case for historical reasons, but must be uppercased to be used in
* the `ciphers` option of {@link createSecureContext}.
*
* 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
* TLSv1.2 and below.
*
@ -1191,20 +1007,13 @@ declare module "tls" {
* are provided, the lowest minimum is used.
*/
let DEFAULT_MIN_VERSION: SecureVersion;
/**
* 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
* format) used for verifying peer certificates. This is the default value
* of the ca option to tls.createSecureContext().
*/
const rootCertificates: readonly string[];
const rootCertificates: ReadonlyArray<string>;
}
declare module "node:tls" {
export * from "tls";
declare module 'node:tls' {
export * from 'tls';
}

45
node_modules/@types/node/ts4.8/trace_events.d.ts generated vendored Normal file → Executable file
View File

@ -1,9 +1,9 @@
/**
* The `node:trace_events` module provides a mechanism to centralize tracing
* information generated by V8, Node.js core, and userspace code.
* The `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 `node:trace_events` module. The `--trace-event-categories` flag
* or by using the `trace_events` module. The `--trace-event-categories` flag
* accepts a list of comma-separated category names.
*
* The available categories are:
@ -13,19 +13,9 @@
* The `async_hooks` events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property.
* * `node.bootstrap`: Enables capture of Node.js bootstrap milestones.
* * `node.console`: Enables capture of `console.time()` and `console.count()`output.
* * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool
* synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`.
* * `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.
* * `node.perf.usertiming`: Enables capture of only Performance API User Timing
* measures and marks.
@ -33,9 +23,8 @@
* measurements.
* * `node.promises.rejections`: Enables capture of trace data tracking the number
* of unhandled Promise rejections and handled-after-rejections.
* * `node.vm.script`: Enables capture of trace data for the `node:vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
* * `node.vm.script`: Enables capture of trace data for the `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.
*
* By default the `node`, `node.async_hooks`, and `v8` categories are enabled.
*
@ -54,10 +43,10 @@
* node --trace-event-categories v8,node,node.async_hooks
* ```
*
* Alternatively, trace events may be enabled using the `node:trace_events` module:
* Alternatively, trace events may be enabled using the `trace_events` module:
*
* ```js
* const trace_events = require('node:trace_events');
* const trace_events = require('trace_events');
* const tracing = trace_events.createTracing({ categories: ['node.perf'] });
* tracing.enable(); // Enable trace event capture for the 'node.perf' category
*
@ -77,16 +66,6 @@
* node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
* ```
*
* 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
* as the one used by `process.hrtime()`.
* However the trace-event timestamps are expressed in microseconds,
@ -94,9 +73,9 @@
*
* The features from this module are not available in `Worker` threads.
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/trace_events.js)
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/trace_events.js)
*/
declare module "trace_events" {
declare module 'trace_events' {
/**
* The `Tracing` object is used to enable or disable tracing for sets of
* categories. Instances are created using the
@ -143,7 +122,7 @@ declare module "trace_events" {
* Creates and returns a `Tracing` object for the given set of `categories`.
*
* ```js
* const trace_events = require('node:trace_events');
* const trace_events = require('trace_events');
* const categories = ['node.perf', 'node.async_hooks'];
* const tracing = trace_events.createTracing({ categories });
* tracing.enable();
@ -163,7 +142,7 @@ declare module "trace_events" {
* Given the file `test.js` below, the command`node --trace-event-categories node.perf test.js` will print`'node.async_hooks,node.perf'` to the console.
*
* ```js
* const trace_events = require('node:trace_events');
* const trace_events = require('trace_events');
* const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });
* const t2 = trace_events.createTracing({ categories: ['node.perf'] });
* const t3 = trace_events.createTracing({ categories: ['v8'] });
@ -177,6 +156,6 @@ declare module "trace_events" {
*/
function getEnabledCategories(): string | undefined;
}
declare module "node:trace_events" {
export * from "trace_events";
declare module 'node:trace_events' {
export * from 'trace_events';
}

Some files were not shown because too many files have changed in this diff Show More