Сделал подсчет часов для Итого акад.часов
This commit is contained in:
parent
1460f71fbb
commit
3dd74b4259
25
node_modules/.package-lock.json
generated
vendored
Normal file
25
node_modules/.package-lock.json
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "convert_xml_plan_to_json",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "25.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.5.0.tgz",
|
||||||
|
"integrity": "sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~7.18.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/undici-types": {
|
||||||
|
"version": "7.18.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
|
||||||
|
"integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
node_modules/@types/node/LICENSE
generated
vendored
Normal file
21
node_modules/@types/node/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE
|
||||||
15
node_modules/@types/node/README.md
generated
vendored
Normal file
15
node_modules/@types/node/README.md
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Installation
|
||||||
|
> `npm install --save @types/node`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for node (https://nodejs.org/).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
||||||
|
|
||||||
|
### Additional Details
|
||||||
|
* Last updated: Thu, 12 Mar 2026 15:47:58 GMT
|
||||||
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [David Junger](https://github.com/touffy), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Sebastian Silbermann](https://github.com/eps1lon), [Wilco Bakker](https://github.com/WilcoBakker), [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), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), [Dmitry Semigradsky](https://github.com/Semigradsky), [René](https://github.com/Renegade334), and [Yagiz Nizipli](https://github.com/anonrig).
|
||||||
955
node_modules/@types/node/assert.d.ts
generated
vendored
Normal file
955
node_modules/@types/node/assert.d.ts
generated
vendored
Normal file
@ -0,0 +1,955 @@
|
|||||||
|
/**
|
||||||
|
* The `node:assert` module provides a set of assertion functions for verifying
|
||||||
|
* invariants.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/assert.js)
|
||||||
|
*/
|
||||||
|
declare module "node:assert" {
|
||||||
|
import strict = require("node:assert/strict");
|
||||||
|
/**
|
||||||
|
* An alias of {@link assert.ok}.
|
||||||
|
* @since v0.5.9
|
||||||
|
* @param value The input that is checked for being truthy.
|
||||||
|
*/
|
||||||
|
function assert(value: unknown, message?: string | Error): asserts value;
|
||||||
|
const kOptions: unique symbol;
|
||||||
|
namespace assert {
|
||||||
|
type AssertMethodNames =
|
||||||
|
| "deepEqual"
|
||||||
|
| "deepStrictEqual"
|
||||||
|
| "doesNotMatch"
|
||||||
|
| "doesNotReject"
|
||||||
|
| "doesNotThrow"
|
||||||
|
| "equal"
|
||||||
|
| "fail"
|
||||||
|
| "ifError"
|
||||||
|
| "match"
|
||||||
|
| "notDeepEqual"
|
||||||
|
| "notDeepStrictEqual"
|
||||||
|
| "notEqual"
|
||||||
|
| "notStrictEqual"
|
||||||
|
| "ok"
|
||||||
|
| "partialDeepStrictEqual"
|
||||||
|
| "rejects"
|
||||||
|
| "strictEqual"
|
||||||
|
| "throws";
|
||||||
|
interface AssertOptions {
|
||||||
|
/**
|
||||||
|
* If set to `'full'`, shows the full diff in assertion errors.
|
||||||
|
* @default 'simple'
|
||||||
|
*/
|
||||||
|
diff?: "simple" | "full" | undefined;
|
||||||
|
/**
|
||||||
|
* If set to `true`, non-strict methods behave like their
|
||||||
|
* corresponding strict methods.
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
|
strict?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* If set to `true`, skips prototype and constructor
|
||||||
|
* comparison in deep equality checks.
|
||||||
|
* @since v24.9.0
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
skipPrototype?: boolean | undefined;
|
||||||
|
}
|
||||||
|
interface Assert extends Pick<typeof assert, AssertMethodNames> {
|
||||||
|
readonly [kOptions]: AssertOptions & { strict: false };
|
||||||
|
}
|
||||||
|
interface AssertStrict extends Pick<typeof strict, AssertMethodNames> {
|
||||||
|
readonly [kOptions]: AssertOptions & { strict: true };
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The `Assert` class allows creating independent assertion instances with custom options.
|
||||||
|
* @since v24.6.0
|
||||||
|
*/
|
||||||
|
var Assert: {
|
||||||
|
/**
|
||||||
|
* Creates a new assertion instance. The `diff` option controls the verbosity of diffs in assertion error messages.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { Assert } = require('node:assert');
|
||||||
|
* const assertInstance = new Assert({ diff: 'full' });
|
||||||
|
* assertInstance.deepStrictEqual({ a: 1 }, { a: 2 });
|
||||||
|
* // Shows a full diff in the error message.
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* **Important**: When destructuring assertion methods from an `Assert` instance,
|
||||||
|
* the methods lose their connection to the instance's configuration options (such
|
||||||
|
* as `diff`, `strict`, and `skipPrototype` settings).
|
||||||
|
* The destructured methods will fall back to default behavior instead.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const myAssert = new Assert({ diff: 'full' });
|
||||||
|
*
|
||||||
|
* // This works as expected - uses 'full' diff
|
||||||
|
* myAssert.strictEqual({ a: 1 }, { b: { c: 1 } });
|
||||||
|
*
|
||||||
|
* // This loses the 'full' diff setting - falls back to default 'simple' diff
|
||||||
|
* const { strictEqual } = myAssert;
|
||||||
|
* strictEqual({ a: 1 }, { b: { c: 1 } });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The `skipPrototype` option affects all deep equality methods:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* class Foo {
|
||||||
|
* constructor(a) {
|
||||||
|
* this.a = a;
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class Bar {
|
||||||
|
* constructor(a) {
|
||||||
|
* this.a = a;
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* const foo = new Foo(1);
|
||||||
|
* const bar = new Bar(1);
|
||||||
|
*
|
||||||
|
* // Default behavior - fails due to different constructors
|
||||||
|
* const assert1 = new Assert();
|
||||||
|
* assert1.deepStrictEqual(foo, bar); // AssertionError
|
||||||
|
*
|
||||||
|
* // Skip prototype comparison - passes if properties are equal
|
||||||
|
* const assert2 = new Assert({ skipPrototype: true });
|
||||||
|
* assert2.deepStrictEqual(foo, bar); // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* When destructured, methods lose access to the instance's `this` context and revert to default assertion behavior
|
||||||
|
* (diff: 'simple', non-strict mode).
|
||||||
|
* To maintain custom options when using destructured methods, avoid
|
||||||
|
* destructuring and call methods directly on the instance.
|
||||||
|
* @since v24.6.0
|
||||||
|
*/
|
||||||
|
new(
|
||||||
|
options?: AssertOptions & { strict?: true | undefined },
|
||||||
|
): AssertStrict;
|
||||||
|
new(
|
||||||
|
options: AssertOptions,
|
||||||
|
): Assert;
|
||||||
|
};
|
||||||
|
interface AssertionErrorOptions {
|
||||||
|
/**
|
||||||
|
* If provided, the error message is set to this value.
|
||||||
|
*/
|
||||||
|
message?: string | undefined;
|
||||||
|
/**
|
||||||
|
* The `actual` property on the error instance.
|
||||||
|
*/
|
||||||
|
actual?: unknown;
|
||||||
|
/**
|
||||||
|
* The `expected` property on the error instance.
|
||||||
|
*/
|
||||||
|
expected?: unknown;
|
||||||
|
/**
|
||||||
|
* The `operator` property on the error instance.
|
||||||
|
*/
|
||||||
|
operator?: string | undefined;
|
||||||
|
/**
|
||||||
|
* If provided, the generated stack trace omits frames before this function.
|
||||||
|
*/
|
||||||
|
stackStartFn?: Function | undefined;
|
||||||
|
/**
|
||||||
|
* If set to `'full'`, shows the full diff in assertion errors.
|
||||||
|
* @default 'simple'
|
||||||
|
*/
|
||||||
|
diff?: "simple" | "full" | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
|
||||||
|
*/
|
||||||
|
class AssertionError extends Error {
|
||||||
|
constructor(options: AssertionErrorOptions);
|
||||||
|
/**
|
||||||
|
* Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
|
||||||
|
*/
|
||||||
|
actual: unknown;
|
||||||
|
/**
|
||||||
|
* Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
|
||||||
|
*/
|
||||||
|
expected: unknown;
|
||||||
|
/**
|
||||||
|
* 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";
|
||||||
|
/**
|
||||||
|
* Set to the passed in operator value.
|
||||||
|
*/
|
||||||
|
operator: string;
|
||||||
|
}
|
||||||
|
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';
|
||||||
|
*
|
||||||
|
* assert.fail();
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Failed
|
||||||
|
*
|
||||||
|
* assert.fail('boom');
|
||||||
|
* // AssertionError [ERR_ASSERTION]: boom
|
||||||
|
*
|
||||||
|
* assert.fail(new TypeError('need array'));
|
||||||
|
* // TypeError: need array
|
||||||
|
* ```
|
||||||
|
* @since v0.1.21
|
||||||
|
* @param [message='Failed']
|
||||||
|
*/
|
||||||
|
function fail(message?: string | Error): never;
|
||||||
|
/**
|
||||||
|
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
|
||||||
|
*
|
||||||
|
* If `value` is not truthy, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is `undefined`, a default
|
||||||
|
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
||||||
|
* If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``.
|
||||||
|
*
|
||||||
|
* Be aware that in the `repl` the error message will be different to the one
|
||||||
|
* thrown in a file! See below for further details.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* assert.ok(true);
|
||||||
|
* // OK
|
||||||
|
* assert.ok(1);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.ok();
|
||||||
|
* // AssertionError: No value argument passed to `assert.ok()`
|
||||||
|
*
|
||||||
|
* assert.ok(false, 'it\'s false');
|
||||||
|
* // AssertionError: it's false
|
||||||
|
*
|
||||||
|
* // In the repl:
|
||||||
|
* assert.ok(typeof 123 === 'string');
|
||||||
|
* // AssertionError: false == true
|
||||||
|
*
|
||||||
|
* // In a file (e.g. test.js):
|
||||||
|
* assert.ok(typeof 123 === 'string');
|
||||||
|
* // AssertionError: The expression evaluated to a falsy value:
|
||||||
|
* //
|
||||||
|
* // assert.ok(typeof 123 === 'string')
|
||||||
|
*
|
||||||
|
* assert.ok(false);
|
||||||
|
* // AssertionError: The expression evaluated to a falsy value:
|
||||||
|
* //
|
||||||
|
* // assert.ok(false)
|
||||||
|
*
|
||||||
|
* assert.ok(0);
|
||||||
|
* // AssertionError: The expression evaluated to a falsy value:
|
||||||
|
* //
|
||||||
|
* // assert.ok(0)
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* // Using `assert()` works the same:
|
||||||
|
* assert(2 + 2 > 5);;
|
||||||
|
* // AssertionError: The expression evaluated to a falsy value:
|
||||||
|
* //
|
||||||
|
* // assert(2 + 2 > 5)
|
||||||
|
* ```
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function ok(value: unknown, message?: string | Error): asserts value;
|
||||||
|
/**
|
||||||
|
* **Strict assertion mode**
|
||||||
|
*
|
||||||
|
* An alias of {@link strictEqual}.
|
||||||
|
*
|
||||||
|
* **Legacy assertion mode**
|
||||||
|
*
|
||||||
|
* > 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`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert';
|
||||||
|
*
|
||||||
|
* assert.equal(1, 1);
|
||||||
|
* // OK, 1 == 1
|
||||||
|
* assert.equal(1, '1');
|
||||||
|
* // OK, 1 == '1'
|
||||||
|
* assert.equal(NaN, NaN);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.equal(1, 2);
|
||||||
|
* // AssertionError: 1 == 2
|
||||||
|
* assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
|
||||||
|
* // AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are not equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
|
||||||
|
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function equal(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* **Strict assertion mode**
|
||||||
|
*
|
||||||
|
* An alias of {@link notStrictEqual}.
|
||||||
|
*
|
||||||
|
* **Legacy assertion mode**
|
||||||
|
*
|
||||||
|
* > 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`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert';
|
||||||
|
*
|
||||||
|
* assert.notEqual(1, 2);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.notEqual(1, 1);
|
||||||
|
* // AssertionError: 1 != 1
|
||||||
|
*
|
||||||
|
* assert.notEqual(1, '1');
|
||||||
|
* // AssertionError: 1 != '1'
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error
|
||||||
|
* message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* **Strict assertion mode**
|
||||||
|
*
|
||||||
|
* An alias of {@link deepStrictEqual}.
|
||||||
|
*
|
||||||
|
* **Legacy assertion mode**
|
||||||
|
*
|
||||||
|
* > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead.
|
||||||
|
*
|
||||||
|
* Tests for deep equality between the `actual` and `expected` parameters. Consider
|
||||||
|
* using {@link deepStrictEqual} instead. {@link deepEqual} can have
|
||||||
|
* surprising results.
|
||||||
|
*
|
||||||
|
* _Deep equality_ means that the enumerable "own" properties of child objects
|
||||||
|
* are also recursively evaluated by the following rules.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* **Strict assertion mode**
|
||||||
|
*
|
||||||
|
* An alias of {@link notDeepStrictEqual}.
|
||||||
|
*
|
||||||
|
* **Legacy assertion mode**
|
||||||
|
*
|
||||||
|
* > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead.
|
||||||
|
*
|
||||||
|
* Tests for any deep inequality. Opposite of {@link deepEqual}.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert';
|
||||||
|
*
|
||||||
|
* const obj1 = {
|
||||||
|
* a: {
|
||||||
|
* b: 1,
|
||||||
|
* },
|
||||||
|
* };
|
||||||
|
* const obj2 = {
|
||||||
|
* a: {
|
||||||
|
* b: 2,
|
||||||
|
* },
|
||||||
|
* };
|
||||||
|
* const obj3 = {
|
||||||
|
* a: {
|
||||||
|
* b: 1,
|
||||||
|
* },
|
||||||
|
* };
|
||||||
|
* const obj4 = { __proto__: obj1 };
|
||||||
|
*
|
||||||
|
* assert.notDeepEqual(obj1, obj1);
|
||||||
|
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
|
||||||
|
*
|
||||||
|
* assert.notDeepEqual(obj1, obj2);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.notDeepEqual(obj1, obj3);
|
||||||
|
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
|
||||||
|
*
|
||||||
|
* assert.notDeepEqual(obj1, obj4);
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are deeply equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
|
||||||
|
* error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
|
||||||
|
* instead of the `AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
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).
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* assert.strictEqual(1, 2);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
|
||||||
|
* //
|
||||||
|
* // 1 !== 2
|
||||||
|
*
|
||||||
|
* assert.strictEqual(1, 1);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.strictEqual('Hello foobar', 'Hello World!');
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
|
||||||
|
* // + actual - expected
|
||||||
|
* //
|
||||||
|
* // + 'Hello foobar'
|
||||||
|
* // - 'Hello World!'
|
||||||
|
* // ^
|
||||||
|
*
|
||||||
|
* const apples = 1;
|
||||||
|
* const oranges = 2;
|
||||||
|
* assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2
|
||||||
|
*
|
||||||
|
* assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
|
||||||
|
* // TypeError: Inputs are not identical
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are not strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
|
||||||
|
* default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
|
||||||
|
* instead of the `AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
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).
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* assert.notStrictEqual(1, 2);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.notStrictEqual(1, 1);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to:
|
||||||
|
* //
|
||||||
|
* // 1
|
||||||
|
*
|
||||||
|
* assert.notStrictEqual(1, '1');
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
|
||||||
|
* default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
|
||||||
|
* instead of the `AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Tests for deep equality between the `actual` and `expected` parameters.
|
||||||
|
* "Deep" equality means that the enumerable "own" properties of child objects
|
||||||
|
* are recursively evaluated also by the following rules.
|
||||||
|
* @since v1.2.0
|
||||||
|
*/
|
||||||
|
function deepStrictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
||||||
|
/**
|
||||||
|
* Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are deeply and strictly equal, an `AssertionError` is thrown
|
||||||
|
* with a `message` property set equal to the value of the `message` parameter. If
|
||||||
|
* the `message` parameter is undefined, a default error message is assigned. If
|
||||||
|
* the `message` parameter is an instance of an `Error` then it will be thrown
|
||||||
|
* instead of the `AssertionError`.
|
||||||
|
* @since v1.2.0
|
||||||
|
*/
|
||||||
|
function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Expects the function `fn` to throw an error.
|
||||||
|
*
|
||||||
|
* 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), a validation function,
|
||||||
|
* a validation object where each property will be tested for strict deep equality,
|
||||||
|
* or an instance of error where each property will be tested for strict deep
|
||||||
|
* equality including the non-enumerable `message` and `name` properties. When
|
||||||
|
* using an object, it is also possible to use a regular expression, when
|
||||||
|
* validating against a string property. See below for examples.
|
||||||
|
*
|
||||||
|
* If specified, `message` will be appended to the message provided by the `AssertionError` if the `fn` call fails to throw or in case the error validation
|
||||||
|
* fails.
|
||||||
|
*
|
||||||
|
* Custom validation object/error instance:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* const err = new TypeError('Wrong value');
|
||||||
|
* err.code = 404;
|
||||||
|
* err.foo = 'bar';
|
||||||
|
* err.info = {
|
||||||
|
* nested: true,
|
||||||
|
* baz: 'text',
|
||||||
|
* };
|
||||||
|
* err.reg = /abc/i;
|
||||||
|
*
|
||||||
|
* assert.throws(
|
||||||
|
* () => {
|
||||||
|
* throw err;
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* name: 'TypeError',
|
||||||
|
* message: 'Wrong value',
|
||||||
|
* info: {
|
||||||
|
* nested: true,
|
||||||
|
* 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(
|
||||||
|
* () => {
|
||||||
|
* throw err;
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* // The `name` and `message` properties are strings and using regular
|
||||||
|
* // expressions on those will match against the string. If they fail, an
|
||||||
|
* // error is thrown.
|
||||||
|
* name: /^TypeError$/,
|
||||||
|
* message: /Wrong/,
|
||||||
|
* foo: 'bar',
|
||||||
|
* info: {
|
||||||
|
* nested: true,
|
||||||
|
* // It is not possible to use regular expressions for nested properties!
|
||||||
|
* 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,
|
||||||
|
* },
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* // Fails due to the different `message` and `name` properties:
|
||||||
|
* assert.throws(
|
||||||
|
* () => {
|
||||||
|
* const otherErr = new Error('Not found');
|
||||||
|
* // Copy all enumerable properties from `err` to `otherErr`.
|
||||||
|
* for (const [key, value] of Object.entries(err)) {
|
||||||
|
* otherErr[key] = value;
|
||||||
|
* }
|
||||||
|
* throw otherErr;
|
||||||
|
* },
|
||||||
|
* // The error's `message` and `name` properties will also be checked when using
|
||||||
|
* // an error as validation object.
|
||||||
|
* err,
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Validate instanceof using constructor:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* assert.throws(
|
||||||
|
* () => {
|
||||||
|
* throw new Error('Wrong value');
|
||||||
|
* },
|
||||||
|
* Error,
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions):
|
||||||
|
*
|
||||||
|
* Using a regular expression runs `.toString` on the error object, and will
|
||||||
|
* therefore also include the error name.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* assert.throws(
|
||||||
|
* () => {
|
||||||
|
* throw new Error('Wrong value');
|
||||||
|
* },
|
||||||
|
* /^Error: Wrong value$/,
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Custom error validation:
|
||||||
|
*
|
||||||
|
* The function must return `true` to indicate all internal validations passed.
|
||||||
|
* It will otherwise fail with an `AssertionError`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* assert.throws(
|
||||||
|
* () => {
|
||||||
|
* throw new Error('Wrong value');
|
||||||
|
* },
|
||||||
|
* (err) => {
|
||||||
|
* assert(err instanceof Error);
|
||||||
|
* assert(/value/.test(err));
|
||||||
|
* // Avoid returning anything from validation functions besides `true`.
|
||||||
|
* // Otherwise, it's not clear what part of the validation failed. Instead,
|
||||||
|
* // throw an error about the specific validation that failed (as done in this
|
||||||
|
* // example) and add as much helpful debugging information to that error as
|
||||||
|
* // possible.
|
||||||
|
* return true;
|
||||||
|
* },
|
||||||
|
* 'unexpected error',
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* `error` cannot be a string. If a string is provided as the second
|
||||||
|
* argument, then `error` is assumed to be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Using the same
|
||||||
|
* message as the thrown error message is going to result in an `ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
|
||||||
|
* a string as the second argument gets considered:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* function throwingFirst() {
|
||||||
|
* throw new Error('First');
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* function throwingSecond() {
|
||||||
|
* throw new Error('Second');
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* function notThrowing() {}
|
||||||
|
*
|
||||||
|
* // The second argument is a string and the input function threw an Error.
|
||||||
|
* // The first case will not throw as it does not match for the error message
|
||||||
|
* // thrown by the input function!
|
||||||
|
* assert.throws(throwingFirst, 'Second');
|
||||||
|
* // In the next example the message has no benefit over the message from the
|
||||||
|
* // error and since it is not clear if the user intended to actually match
|
||||||
|
* // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error.
|
||||||
|
* assert.throws(throwingSecond, 'Second');
|
||||||
|
* // TypeError [ERR_AMBIGUOUS_ARGUMENT]
|
||||||
|
*
|
||||||
|
* // The string is only used (as message) in case the function does not throw:
|
||||||
|
* assert.throws(notThrowing, 'Second');
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Missing expected exception: Second
|
||||||
|
*
|
||||||
|
* // If it was intended to match for the error message do this instead:
|
||||||
|
* // It does not throw because the error messages match.
|
||||||
|
* assert.throws(throwingSecond, /Second$/);
|
||||||
|
*
|
||||||
|
* // If the error message does not match, an AssertionError is thrown.
|
||||||
|
* assert.throws(throwingFirst, /Second$/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Due to the confusing error-prone notation, avoid a string as the second
|
||||||
|
* argument.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function throws(block: () => unknown, message?: string | Error): void;
|
||||||
|
function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Asserts that the function `fn` does not throw an error.
|
||||||
|
*
|
||||||
|
* Using `assert.doesNotThrow()` is actually not useful because there
|
||||||
|
* is no benefit in catching an error and then rethrowing it. Instead, consider
|
||||||
|
* adding a comment next to the specific code path that should not throw and keep
|
||||||
|
* error messages as expressive as possible.
|
||||||
|
*
|
||||||
|
* When `assert.doesNotThrow()` is called, it will immediately call the `fn` function.
|
||||||
|
*
|
||||||
|
* If an error is thrown and it is the same type as that specified by the `error` parameter, then an `AssertionError` is thrown. If the error is of a
|
||||||
|
* different type, or if the `error` parameter is undefined, the error is
|
||||||
|
* 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
|
||||||
|
* 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';
|
||||||
|
*
|
||||||
|
* assert.doesNotThrow(
|
||||||
|
* () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* SyntaxError,
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* However, the following will result in an `AssertionError` with the message
|
||||||
|
* 'Got unwanted exception...':
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* assert.doesNotThrow(
|
||||||
|
* () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* 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';
|
||||||
|
*
|
||||||
|
* assert.doesNotThrow(
|
||||||
|
* () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* /Wrong value/,
|
||||||
|
* 'Whoops',
|
||||||
|
* );
|
||||||
|
* // Throws: AssertionError: Got unwanted exception: Whoops
|
||||||
|
* ```
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function doesNotThrow(block: () => unknown, message?: string | Error): void;
|
||||||
|
function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Throws `value` if `value` is not `undefined` or `null`. This is useful when
|
||||||
|
* testing the `error` argument in callbacks. The stack trace contains all frames
|
||||||
|
* from the error passed to `ifError()` including the potential new frames for `ifError()` itself.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* assert.ifError(null);
|
||||||
|
* // OK
|
||||||
|
* assert.ifError(0);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0
|
||||||
|
* assert.ifError('error');
|
||||||
|
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error'
|
||||||
|
* assert.ifError(new Error());
|
||||||
|
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error
|
||||||
|
*
|
||||||
|
* // Create some random error frames.
|
||||||
|
* let err;
|
||||||
|
* (function errorFrame() {
|
||||||
|
* err = new Error('test error');
|
||||||
|
* })();
|
||||||
|
*
|
||||||
|
* (function ifErrorFrame() {
|
||||||
|
* assert.ifError(err);
|
||||||
|
* })();
|
||||||
|
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
|
||||||
|
* // at ifErrorFrame
|
||||||
|
* // at errorFrame
|
||||||
|
* ```
|
||||||
|
* @since v0.1.97
|
||||||
|
*/
|
||||||
|
function ifError(value: unknown): asserts value is null | undefined;
|
||||||
|
/**
|
||||||
|
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
|
||||||
|
* calls the function and awaits the returned promise to complete. It will then
|
||||||
|
* check that the promise is rejected.
|
||||||
|
*
|
||||||
|
* If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the
|
||||||
|
* function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v25.x/api/errors.html#err_invalid_return_value)
|
||||||
|
* error. In both cases the error handler is skipped.
|
||||||
|
*
|
||||||
|
* Besides the async nature to await the completion behaves identically to {@link throws}.
|
||||||
|
*
|
||||||
|
* 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), a validation function,
|
||||||
|
* an object where each property will be tested for, or an instance of error where
|
||||||
|
* each property will be tested for including the non-enumerable `message` and `name` properties.
|
||||||
|
*
|
||||||
|
* If specified, `message` will be the message provided by the `{@link AssertionError}` if the `asyncFn` fails to reject.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* await assert.rejects(
|
||||||
|
* async () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* name: 'TypeError',
|
||||||
|
* message: 'Wrong value',
|
||||||
|
* },
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* await assert.rejects(
|
||||||
|
* async () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* (err) => {
|
||||||
|
* assert.strictEqual(err.name, 'TypeError');
|
||||||
|
* assert.strictEqual(err.message, 'Wrong value');
|
||||||
|
* return true;
|
||||||
|
* },
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* assert.rejects(
|
||||||
|
* Promise.reject(new Error('Wrong value')),
|
||||||
|
* Error,
|
||||||
|
* ).then(() => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* `error` cannot be a string. If a string is provided as the second argument, then `error` is assumed to
|
||||||
|
* be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Please read the
|
||||||
|
* example in {@link throws} carefully if using a string as the second argument gets considered.
|
||||||
|
* @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>;
|
||||||
|
/**
|
||||||
|
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
|
||||||
|
* calls the function and awaits the returned promise to complete. It will then
|
||||||
|
* check that the promise is not rejected.
|
||||||
|
*
|
||||||
|
* If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
|
||||||
|
* the function does not return a promise, `assert.doesNotReject()` will return a
|
||||||
|
* rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v25.x/api/errors.html#err_invalid_return_value) error. In both cases
|
||||||
|
* the error handler is skipped.
|
||||||
|
*
|
||||||
|
* Using `assert.doesNotReject()` is actually not useful because there is little
|
||||||
|
* benefit in catching a rejection and then rejecting it again. Instead, consider
|
||||||
|
* adding a comment next to the specific code path that should not reject and keep
|
||||||
|
* 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
|
||||||
|
* 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';
|
||||||
|
*
|
||||||
|
* await assert.doesNotReject(
|
||||||
|
* async () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* SyntaxError,
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
|
||||||
|
* .then(() => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @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>;
|
||||||
|
/**
|
||||||
|
* Expects the `string` input to match the regular expression.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* assert.match('I will fail', /pass/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
|
||||||
|
*
|
||||||
|
* assert.match(123, /pass/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
|
||||||
|
*
|
||||||
|
* assert.match('I will pass', /pass/);
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
||||||
|
* to the value of the `message` parameter. If the `message` parameter is
|
||||||
|
* undefined, a default error message is assigned. If the `message` parameter is an
|
||||||
|
* instance of an [Error](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
||||||
|
* @since v13.6.0, v12.16.0
|
||||||
|
*/
|
||||||
|
function match(value: string, regExp: RegExp, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Expects the `string` input not to match the regular expression.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
*
|
||||||
|
* assert.doesNotMatch('I will fail', /fail/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...
|
||||||
|
*
|
||||||
|
* assert.doesNotMatch(123, /pass/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
|
||||||
|
*
|
||||||
|
* assert.doesNotMatch('I will pass', /different/);
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
|
||||||
|
* to the value of the `message` parameter. If the `message` parameter is
|
||||||
|
* undefined, a default error message is assigned. If the `message` parameter is an
|
||||||
|
* instance of an [Error](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
|
||||||
|
* @since v13.6.0, v12.16.0
|
||||||
|
*/
|
||||||
|
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Tests for partial deep equality between the `actual` and `expected` parameters.
|
||||||
|
* "Deep" equality means that the enumerable "own" properties of child objects
|
||||||
|
* are recursively evaluated also by the following rules. "Partial" equality means
|
||||||
|
* that only properties that exist on the `expected` parameter are going to be
|
||||||
|
* compared.
|
||||||
|
*
|
||||||
|
* This method always passes the same test cases as `assert.deepStrictEqual()`,
|
||||||
|
* behaving as a super set of it.
|
||||||
|
* @since v22.13.0
|
||||||
|
*/
|
||||||
|
function partialDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
}
|
||||||
|
namespace assert {
|
||||||
|
export { strict };
|
||||||
|
}
|
||||||
|
export = assert;
|
||||||
|
}
|
||||||
|
declare module "assert" {
|
||||||
|
import assert = require("node:assert");
|
||||||
|
export = assert;
|
||||||
|
}
|
||||||
105
node_modules/@types/node/assert/strict.d.ts
generated
vendored
Normal file
105
node_modules/@types/node/assert/strict.d.ts
generated
vendored
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
/**
|
||||||
|
* In strict assertion mode, non-strict methods behave like their corresponding
|
||||||
|
* strict methods. For example, `assert.deepEqual()` will behave like
|
||||||
|
* `assert.deepStrictEqual()`.
|
||||||
|
*
|
||||||
|
* In strict assertion mode, error messages for objects display a diff. In legacy
|
||||||
|
* assertion mode, error messages for objects display the objects, often truncated.
|
||||||
|
*
|
||||||
|
* To use strict assertion mode:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { strict as assert } from 'node:assert';
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert/strict';
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Example error diff:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { strict as assert } from 'node:assert';
|
||||||
|
*
|
||||||
|
* assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
|
||||||
|
* // AssertionError: Expected inputs to be strictly deep-equal:
|
||||||
|
* // + actual - expected ... Lines skipped
|
||||||
|
* //
|
||||||
|
* // [
|
||||||
|
* // [
|
||||||
|
* // ...
|
||||||
|
* // 2,
|
||||||
|
* // + 3
|
||||||
|
* // - '3'
|
||||||
|
* // ],
|
||||||
|
* // ...
|
||||||
|
* // 5
|
||||||
|
* // ]
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS`
|
||||||
|
* environment variables. This will also deactivate the colors in the REPL. For
|
||||||
|
* more on color support in terminal environments, read the tty
|
||||||
|
* [`getColorDepth()`](https://nodejs.org/docs/latest-v25.x/api/tty.html#writestreamgetcolordepthenv) documentation.
|
||||||
|
* @since v15.0.0
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/assert/strict.js)
|
||||||
|
*/
|
||||||
|
declare module "node:assert/strict" {
|
||||||
|
import {
|
||||||
|
Assert,
|
||||||
|
AssertionError,
|
||||||
|
AssertionErrorOptions,
|
||||||
|
AssertOptions,
|
||||||
|
AssertPredicate,
|
||||||
|
AssertStrict,
|
||||||
|
deepStrictEqual,
|
||||||
|
doesNotMatch,
|
||||||
|
doesNotReject,
|
||||||
|
doesNotThrow,
|
||||||
|
fail,
|
||||||
|
ifError,
|
||||||
|
match,
|
||||||
|
notDeepStrictEqual,
|
||||||
|
notStrictEqual,
|
||||||
|
ok,
|
||||||
|
partialDeepStrictEqual,
|
||||||
|
rejects,
|
||||||
|
strictEqual,
|
||||||
|
throws,
|
||||||
|
} from "node:assert";
|
||||||
|
function strict(value: unknown, message?: string | Error): asserts value;
|
||||||
|
namespace strict {
|
||||||
|
export {
|
||||||
|
Assert,
|
||||||
|
AssertionError,
|
||||||
|
AssertionErrorOptions,
|
||||||
|
AssertOptions,
|
||||||
|
AssertPredicate,
|
||||||
|
AssertStrict,
|
||||||
|
deepStrictEqual,
|
||||||
|
deepStrictEqual as deepEqual,
|
||||||
|
doesNotMatch,
|
||||||
|
doesNotReject,
|
||||||
|
doesNotThrow,
|
||||||
|
fail,
|
||||||
|
ifError,
|
||||||
|
match,
|
||||||
|
notDeepStrictEqual,
|
||||||
|
notDeepStrictEqual as notDeepEqual,
|
||||||
|
notStrictEqual,
|
||||||
|
notStrictEqual as notEqual,
|
||||||
|
ok,
|
||||||
|
partialDeepStrictEqual,
|
||||||
|
rejects,
|
||||||
|
strict,
|
||||||
|
strictEqual,
|
||||||
|
strictEqual as equal,
|
||||||
|
throws,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export = strict;
|
||||||
|
}
|
||||||
|
declare module "assert/strict" {
|
||||||
|
import strict = require("node:assert/strict");
|
||||||
|
export = strict;
|
||||||
|
}
|
||||||
623
node_modules/@types/node/async_hooks.d.ts
generated
vendored
Normal file
623
node_modules/@types/node/async_hooks.d.ts
generated
vendored
Normal file
@ -0,0 +1,623 @@
|
|||||||
|
/**
|
||||||
|
* We strongly discourage the use of the `async_hooks` API.
|
||||||
|
* Other APIs that can cover most of its use cases include:
|
||||||
|
*
|
||||||
|
* * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v25.x/api/async_context.html#class-asynclocalstorage) tracks async context
|
||||||
|
* * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v25.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
|
||||||
|
*
|
||||||
|
* The `node:async_hooks` module provides an API to track asynchronous resources.
|
||||||
|
* It can be accessed using:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import async_hooks from 'node:async_hooks';
|
||||||
|
* ```
|
||||||
|
* @experimental
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/async_hooks.js)
|
||||||
|
*/
|
||||||
|
declare module "node:async_hooks" {
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* import { executionAsyncId } from 'node:async_hooks';
|
||||||
|
* import fs from 'node:fs';
|
||||||
|
*
|
||||||
|
* console.log(executionAsyncId()); // 1 - bootstrap
|
||||||
|
* const path = '.';
|
||||||
|
* fs.open(path, 'r', (err, fd) => {
|
||||||
|
* console.log(executionAsyncId()); // 6 - open()
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The ID returned from `executionAsyncId()` is related to execution timing, not
|
||||||
|
* causality (which is covered by `triggerAsyncId()`):
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const server = net.createServer((conn) => {
|
||||||
|
* // Returns the ID of the server, not of the new connection, because the
|
||||||
|
* // callback runs in the execution scope of the server's MakeCallback().
|
||||||
|
* async_hooks.executionAsyncId();
|
||||||
|
*
|
||||||
|
* }).listen(port, () => {
|
||||||
|
* // Returns the ID of a TickObject (process.nextTick()) because all
|
||||||
|
* // callbacks passed to .listen() are wrapped in a nextTick().
|
||||||
|
* async_hooks.executionAsyncId();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Promise contexts may not get precise `executionAsyncIds` by default.
|
||||||
|
* See the section on [promise execution tracking](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#promise-execution-tracking).
|
||||||
|
* @since v8.1.0
|
||||||
|
* @return The `asyncId` of the current execution context. Useful to track when something calls.
|
||||||
|
*/
|
||||||
|
function executionAsyncId(): number;
|
||||||
|
/**
|
||||||
|
* Resource objects returned by `executionAsyncResource()` are most often internal
|
||||||
|
* Node.js handle objects with undocumented APIs. Using any functions or properties
|
||||||
|
* on the object is likely to crash your application and should be avoided.
|
||||||
|
*
|
||||||
|
* Using `executionAsyncResource()` in the top-level execution context will
|
||||||
|
* return an empty object as there is no handle or request object to use,
|
||||||
|
* but having an object representing the top-level can be helpful.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { open } from 'node:fs';
|
||||||
|
* import { executionAsyncId, executionAsyncResource } from 'node:async_hooks';
|
||||||
|
*
|
||||||
|
* console.log(executionAsyncId(), executionAsyncResource()); // 1 {}
|
||||||
|
* open(new URL(import.meta.url), 'r', (err, fd) => {
|
||||||
|
* console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* This can be used to implement continuation local storage without the
|
||||||
|
* use of a tracking `Map` to store the metadata:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { createServer } from 'node:http';
|
||||||
|
* import {
|
||||||
|
* executionAsyncId,
|
||||||
|
* executionAsyncResource,
|
||||||
|
* createHook,
|
||||||
|
* } from 'node:async_hooks';
|
||||||
|
* const sym = Symbol('state'); // Private symbol to avoid pollution
|
||||||
|
*
|
||||||
|
* createHook({
|
||||||
|
* init(asyncId, type, triggerAsyncId, resource) {
|
||||||
|
* const cr = executionAsyncResource();
|
||||||
|
* if (cr) {
|
||||||
|
* resource[sym] = cr[sym];
|
||||||
|
* }
|
||||||
|
* },
|
||||||
|
* }).enable();
|
||||||
|
*
|
||||||
|
* const server = createServer((req, res) => {
|
||||||
|
* executionAsyncResource()[sym] = { state: req.url };
|
||||||
|
* setTimeout(function() {
|
||||||
|
* res.end(JSON.stringify(executionAsyncResource()[sym]));
|
||||||
|
* }, 100);
|
||||||
|
* }).listen(3000);
|
||||||
|
* ```
|
||||||
|
* @since v13.9.0, v12.17.0
|
||||||
|
* @return The resource representing the current execution. Useful to store data within the resource.
|
||||||
|
*/
|
||||||
|
function executionAsyncResource(): object;
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* const server = net.createServer((conn) => {
|
||||||
|
* // The resource that caused (or triggered) this callback to be called
|
||||||
|
* // was that of the new connection. Thus the return value of triggerAsyncId()
|
||||||
|
* // is the asyncId of "conn".
|
||||||
|
* async_hooks.triggerAsyncId();
|
||||||
|
*
|
||||||
|
* }).listen(port, () => {
|
||||||
|
* // Even though all callbacks passed to .listen() are wrapped in a nextTick()
|
||||||
|
* // the callback itself exists because the call to the server's .listen()
|
||||||
|
* // was made. So the return value would be the ID of the server.
|
||||||
|
* async_hooks.triggerAsyncId();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Promise contexts may not get valid `triggerAsyncId`s by default. See
|
||||||
|
* the section on [promise execution tracking](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html#promise-execution-tracking).
|
||||||
|
* @return The ID of the resource responsible for calling the callback that is currently being executed.
|
||||||
|
*/
|
||||||
|
function triggerAsyncId(): number;
|
||||||
|
interface HookCallbacks {
|
||||||
|
/**
|
||||||
|
* Called when a class is constructed that has the possibility to emit an asynchronous event.
|
||||||
|
* @param asyncId A unique ID for the async resource
|
||||||
|
* @param type The type of the async resource
|
||||||
|
* @param triggerAsyncId The unique ID of the async resource in whose execution context this async resource was created
|
||||||
|
* @param resource Reference to the resource representing the async operation, needs to be released during destroy
|
||||||
|
*/
|
||||||
|
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
|
||||||
|
/**
|
||||||
|
* When an asynchronous operation is initiated or completes a callback is called to notify the user.
|
||||||
|
* The before callback is called just before said callback is executed.
|
||||||
|
* @param asyncId the unique identifier assigned to the resource about to execute the callback.
|
||||||
|
*/
|
||||||
|
before?(asyncId: number): void;
|
||||||
|
/**
|
||||||
|
* Called immediately after the callback specified in `before` is completed.
|
||||||
|
*
|
||||||
|
* If an uncaught exception occurs during execution of the callback, then `after` will run after the `'uncaughtException'` event is emitted or a `domain`'s handler runs.
|
||||||
|
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
|
||||||
|
*/
|
||||||
|
after?(asyncId: number): void;
|
||||||
|
/**
|
||||||
|
* Called when a promise has resolve() called. This may not be in the same execution id
|
||||||
|
* as the promise itself.
|
||||||
|
* @param asyncId the unique id for the promise that was resolve()d.
|
||||||
|
*/
|
||||||
|
promiseResolve?(asyncId: number): void;
|
||||||
|
/**
|
||||||
|
* Called after the resource corresponding to asyncId is destroyed
|
||||||
|
* @param asyncId a unique ID for the async resource
|
||||||
|
*/
|
||||||
|
destroy?(asyncId: number): void;
|
||||||
|
}
|
||||||
|
interface AsyncHook {
|
||||||
|
/**
|
||||||
|
* Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
|
||||||
|
*/
|
||||||
|
enable(): this;
|
||||||
|
/**
|
||||||
|
* Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
|
||||||
|
*/
|
||||||
|
disable(): this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Registers functions to be called for different lifetime events of each async
|
||||||
|
* operation.
|
||||||
|
*
|
||||||
|
* The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the
|
||||||
|
* respective asynchronous event during a resource's lifetime.
|
||||||
|
*
|
||||||
|
* All callbacks are optional. For example, if only resource cleanup needs to
|
||||||
|
* be tracked, then only the `destroy` callback needs to be passed. The
|
||||||
|
* specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { createHook } from 'node:async_hooks';
|
||||||
|
*
|
||||||
|
* const asyncHook = createHook({
|
||||||
|
* init(asyncId, type, triggerAsyncId, resource) { },
|
||||||
|
* destroy(asyncId) { },
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The callbacks will be inherited via the prototype chain:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* class MyAsyncCallbacks {
|
||||||
|
* init(asyncId, type, triggerAsyncId, resource) { }
|
||||||
|
* destroy(asyncId) {}
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class MyAddedCallbacks extends MyAsyncCallbacks {
|
||||||
|
* before(asyncId) { }
|
||||||
|
* after(asyncId) { }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* const asyncHook = async_hooks.createHook(new MyAddedCallbacks());
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Because promises are asynchronous resources whose lifecycle is tracked
|
||||||
|
* via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises.
|
||||||
|
* @since v8.1.0
|
||||||
|
* @param callbacks The `Hook Callbacks` to register
|
||||||
|
* @return Instance used for disabling and enabling hooks
|
||||||
|
*/
|
||||||
|
function createHook(callbacks: HookCallbacks): AsyncHook;
|
||||||
|
interface AsyncResourceOptions {
|
||||||
|
/**
|
||||||
|
* The ID of the execution context that created this async event.
|
||||||
|
* @default executionAsyncId()
|
||||||
|
*/
|
||||||
|
triggerAsyncId?: number | undefined;
|
||||||
|
/**
|
||||||
|
* Disables automatic `emitDestroy` when the object is garbage collected.
|
||||||
|
* This usually does not need to be set (even if `emitDestroy` is called
|
||||||
|
* manually), unless the resource's `asyncId` is retrieved and the
|
||||||
|
* sensitive API's `emitDestroy` is called with it.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
requireManualDestroy?: boolean | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The class `AsyncResource` is designed to be extended by the embedder's async
|
||||||
|
* resources. Using this, users can easily trigger the lifetime events of their
|
||||||
|
* own resources.
|
||||||
|
*
|
||||||
|
* The `init` hook will trigger when an `AsyncResource` is instantiated.
|
||||||
|
*
|
||||||
|
* The following is an overview of the `AsyncResource` API.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { AsyncResource, executionAsyncId } from 'node: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 },
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* // Run a function in the execution context of the resource. This will
|
||||||
|
* // * establish the context of the resource
|
||||||
|
* // * trigger the AsyncHooks before callbacks
|
||||||
|
* // * call the provided function `fn` with the supplied arguments
|
||||||
|
* // * trigger the AsyncHooks after callbacks
|
||||||
|
* // * restore the original execution context
|
||||||
|
* asyncResource.runInAsyncScope(fn, thisArg, ...args);
|
||||||
|
*
|
||||||
|
* // Call AsyncHooks destroy callbacks.
|
||||||
|
* asyncResource.emitDestroy();
|
||||||
|
*
|
||||||
|
* // Return the unique ID assigned to the AsyncResource instance.
|
||||||
|
* asyncResource.asyncId();
|
||||||
|
*
|
||||||
|
* // Return the trigger ID for the AsyncResource instance.
|
||||||
|
* asyncResource.triggerAsyncId();
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
class AsyncResource {
|
||||||
|
/**
|
||||||
|
* AsyncResource() is meant to be extended. Instantiating a
|
||||||
|
* new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
||||||
|
* async_hook.executionAsyncId() is used.
|
||||||
|
* @param type The type of async event.
|
||||||
|
* @param triggerAsyncId The ID of the execution context that created
|
||||||
|
* this async event (default: `executionAsyncId()`), or an
|
||||||
|
* AsyncResourceOptions object (since v9.3.0)
|
||||||
|
*/
|
||||||
|
constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);
|
||||||
|
/**
|
||||||
|
* Binds the given function to the current execution context.
|
||||||
|
* @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`.
|
||||||
|
*/
|
||||||
|
static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(
|
||||||
|
fn: Func,
|
||||||
|
type?: string,
|
||||||
|
thisArg?: ThisArg,
|
||||||
|
): Func;
|
||||||
|
/**
|
||||||
|
* Binds the given function to execute to this `AsyncResource`'s scope.
|
||||||
|
* @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;
|
||||||
|
/**
|
||||||
|
* Call the provided function with the provided arguments in the execution context
|
||||||
|
* of the async resource. This will establish the context, trigger the AsyncHooks
|
||||||
|
* before callbacks, call the function, trigger the AsyncHooks after callbacks, and
|
||||||
|
* then restore the original execution context.
|
||||||
|
* @since v9.6.0
|
||||||
|
* @param fn The function to call in the execution context of this async resource.
|
||||||
|
* @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;
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
* @return A reference to `asyncResource`.
|
||||||
|
*/
|
||||||
|
emitDestroy(): this;
|
||||||
|
/**
|
||||||
|
* @return The unique `asyncId` assigned to the resource.
|
||||||
|
*/
|
||||||
|
asyncId(): number;
|
||||||
|
/**
|
||||||
|
* @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.
|
||||||
|
*/
|
||||||
|
triggerAsyncId(): number;
|
||||||
|
}
|
||||||
|
interface AsyncLocalStorageOptions {
|
||||||
|
/**
|
||||||
|
* The default value to be used when no store is provided.
|
||||||
|
*/
|
||||||
|
defaultValue?: any;
|
||||||
|
/**
|
||||||
|
* A name for the `AsyncLocalStorage` value.
|
||||||
|
*/
|
||||||
|
name?: string | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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';
|
||||||
|
*
|
||||||
|
* const asyncLocalStorage = new AsyncLocalStorage();
|
||||||
|
*
|
||||||
|
* function logWithId(msg) {
|
||||||
|
* const id = asyncLocalStorage.getStore();
|
||||||
|
* console.log(`${id !== undefined ? id : '-'}:`, msg);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* let idSeq = 0;
|
||||||
|
* http.createServer((req, res) => {
|
||||||
|
* asyncLocalStorage.run(idSeq++, () => {
|
||||||
|
* logWithId('start');
|
||||||
|
* // Imagine any chain of async operations here
|
||||||
|
* setImmediate(() => {
|
||||||
|
* logWithId('finish');
|
||||||
|
* res.end();
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* }).listen(8080);
|
||||||
|
*
|
||||||
|
* http.get('http://localhost:8080');
|
||||||
|
* http.get('http://localhost:8080');
|
||||||
|
* // Prints:
|
||||||
|
* // 0: start
|
||||||
|
* // 0: finish
|
||||||
|
* // 1: start
|
||||||
|
* // 1: finish
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Each instance of `AsyncLocalStorage` maintains an independent storage context.
|
||||||
|
* Multiple instances can safely exist simultaneously without risk of interfering
|
||||||
|
* with each other's data.
|
||||||
|
* @since v13.10.0, v12.17.0
|
||||||
|
*/
|
||||||
|
class AsyncLocalStorage<T> {
|
||||||
|
/**
|
||||||
|
* Creates a new instance of `AsyncLocalStorage`. Store is only provided within a
|
||||||
|
* `run()` call or after an `enterWith()` call.
|
||||||
|
*/
|
||||||
|
constructor(options?: AsyncLocalStorageOptions);
|
||||||
|
/**
|
||||||
|
* Binds the given function to the current execution context.
|
||||||
|
* @since v19.8.0
|
||||||
|
* @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
|
||||||
|
* @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.
|
||||||
|
*
|
||||||
|
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
|
||||||
|
* instance will be exited.
|
||||||
|
*
|
||||||
|
* Calling `asyncLocalStorage.disable()` is required before the `asyncLocalStorage` can be garbage collected. This does not apply to stores
|
||||||
|
* provided by the `asyncLocalStorage`, as those objects are garbage collected
|
||||||
|
* along with the corresponding async resources.
|
||||||
|
*
|
||||||
|
* Use this method when the `asyncLocalStorage` is not in use anymore
|
||||||
|
* in the current process.
|
||||||
|
* @since v13.10.0, v12.17.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
disable(): void;
|
||||||
|
/**
|
||||||
|
* Returns the current store.
|
||||||
|
* If called outside of an asynchronous context initialized by
|
||||||
|
* calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it
|
||||||
|
* returns `undefined`.
|
||||||
|
* @since v13.10.0, v12.17.0
|
||||||
|
*/
|
||||||
|
getStore(): T | undefined;
|
||||||
|
/**
|
||||||
|
* The name of the `AsyncLocalStorage` instance if provided.
|
||||||
|
* @since v24.0.0
|
||||||
|
*/
|
||||||
|
readonly name: string;
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* The optional `args` are passed to the callback function.
|
||||||
|
*
|
||||||
|
* If the callback function throws an error, the error is thrown by `run()` too.
|
||||||
|
* The stacktrace is not impacted by this call and the context is exited.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const store = { id: 2 };
|
||||||
|
* try {
|
||||||
|
* asyncLocalStorage.run(store, () => {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the store object
|
||||||
|
* setTimeout(() => {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the store object
|
||||||
|
* }, 200);
|
||||||
|
* throw new Error();
|
||||||
|
* });
|
||||||
|
* } catch (e) {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns undefined
|
||||||
|
* // The error will be caught here
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @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
|
||||||
|
* return value. The store is not accessible within the callback function or
|
||||||
|
* the asynchronous operations created within the callback. Any `getStore()` call done within the callback function will always return `undefined`.
|
||||||
|
*
|
||||||
|
* The optional `args` are passed to the callback function.
|
||||||
|
*
|
||||||
|
* If the callback function throws an error, the error is thrown by `exit()` too.
|
||||||
|
* The stacktrace is not impacted by this call and the context is re-entered.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // Within a call to run
|
||||||
|
* try {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the store object or value
|
||||||
|
* asyncLocalStorage.exit(() => {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns undefined
|
||||||
|
* throw new Error();
|
||||||
|
* });
|
||||||
|
* } catch (e) {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the same object or value
|
||||||
|
* // The error will be caught here
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v13.10.0, v12.17.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R;
|
||||||
|
/**
|
||||||
|
* Transitions into the context for the remainder of the current
|
||||||
|
* synchronous execution and then persists the store through any following
|
||||||
|
* asynchronous calls.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const store = { id: 1 };
|
||||||
|
* // Replaces previous store with the given store object
|
||||||
|
* asyncLocalStorage.enterWith(store);
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the store object
|
||||||
|
* someAsyncOperation(() => {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the same object
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* This transition will continue for the _entire_ synchronous execution.
|
||||||
|
* This means that if, for example, the context is entered within an event
|
||||||
|
* handler subsequent event handlers will also run within that context unless
|
||||||
|
* specifically bound to another context with an `AsyncResource`. That is why `run()` should be preferred over `enterWith()` unless there are strong reasons
|
||||||
|
* to use the latter method.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const store = { id: 1 };
|
||||||
|
*
|
||||||
|
* emitter.on('my-event', () => {
|
||||||
|
* asyncLocalStorage.enterWith(store);
|
||||||
|
* });
|
||||||
|
* emitter.on('my-event', () => {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the same object
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* asyncLocalStorage.getStore(); // Returns undefined
|
||||||
|
* emitter.emit('my-event');
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the same object
|
||||||
|
* ```
|
||||||
|
* @since v13.11.0, v12.17.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
enterWith(store: T): void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @since v17.2.0, v16.14.0
|
||||||
|
* @return A map of provider types to the corresponding numeric id.
|
||||||
|
* This map contains all the event types that might be emitted by the `async_hooks.init()` event.
|
||||||
|
*/
|
||||||
|
namespace asyncWrapProviders {
|
||||||
|
const NONE: number;
|
||||||
|
const DIRHANDLE: number;
|
||||||
|
const DNSCHANNEL: number;
|
||||||
|
const ELDHISTOGRAM: number;
|
||||||
|
const FILEHANDLE: number;
|
||||||
|
const FILEHANDLECLOSEREQ: number;
|
||||||
|
const FIXEDSIZEBLOBCOPY: number;
|
||||||
|
const FSEVENTWRAP: number;
|
||||||
|
const FSREQCALLBACK: number;
|
||||||
|
const FSREQPROMISE: number;
|
||||||
|
const GETADDRINFOREQWRAP: number;
|
||||||
|
const GETNAMEINFOREQWRAP: number;
|
||||||
|
const HEAPSNAPSHOT: number;
|
||||||
|
const HTTP2SESSION: number;
|
||||||
|
const HTTP2STREAM: number;
|
||||||
|
const HTTP2PING: number;
|
||||||
|
const HTTP2SETTINGS: number;
|
||||||
|
const HTTPINCOMINGMESSAGE: number;
|
||||||
|
const HTTPCLIENTREQUEST: number;
|
||||||
|
const JSSTREAM: number;
|
||||||
|
const JSUDPWRAP: number;
|
||||||
|
const MESSAGEPORT: number;
|
||||||
|
const PIPECONNECTWRAP: number;
|
||||||
|
const PIPESERVERWRAP: number;
|
||||||
|
const PIPEWRAP: number;
|
||||||
|
const PROCESSWRAP: number;
|
||||||
|
const PROMISE: number;
|
||||||
|
const QUERYWRAP: number;
|
||||||
|
const SHUTDOWNWRAP: number;
|
||||||
|
const SIGNALWRAP: number;
|
||||||
|
const STATWATCHER: number;
|
||||||
|
const STREAMPIPE: number;
|
||||||
|
const TCPCONNECTWRAP: number;
|
||||||
|
const TCPSERVERWRAP: number;
|
||||||
|
const TCPWRAP: number;
|
||||||
|
const TTYWRAP: number;
|
||||||
|
const UDPSENDWRAP: number;
|
||||||
|
const UDPWRAP: number;
|
||||||
|
const SIGINTWATCHDOG: number;
|
||||||
|
const WORKER: number;
|
||||||
|
const WORKERHEAPSNAPSHOT: number;
|
||||||
|
const WRITEWRAP: number;
|
||||||
|
const ZLIB: number;
|
||||||
|
const CHECKPRIMEREQUEST: number;
|
||||||
|
const PBKDF2REQUEST: number;
|
||||||
|
const KEYPAIRGENREQUEST: number;
|
||||||
|
const KEYGENREQUEST: number;
|
||||||
|
const KEYEXPORTREQUEST: number;
|
||||||
|
const CIPHERREQUEST: number;
|
||||||
|
const DERIVEBITSREQUEST: number;
|
||||||
|
const HASHREQUEST: number;
|
||||||
|
const RANDOMBYTESREQUEST: number;
|
||||||
|
const RANDOMPRIMEREQUEST: number;
|
||||||
|
const SCRYPTREQUEST: number;
|
||||||
|
const SIGNREQUEST: number;
|
||||||
|
const TLSWRAP: number;
|
||||||
|
const VERIFYREQUEST: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module "async_hooks" {
|
||||||
|
export * from "node:async_hooks";
|
||||||
|
}
|
||||||
466
node_modules/@types/node/buffer.buffer.d.ts
generated
vendored
Normal file
466
node_modules/@types/node/buffer.buffer.d.ts
generated
vendored
Normal file
@ -0,0 +1,466 @@
|
|||||||
|
declare module "node:buffer" {
|
||||||
|
type ImplicitArrayBuffer<T extends WithImplicitCoercion<ArrayBufferLike>> = T extends
|
||||||
|
{ valueOf(): infer V extends ArrayBufferLike } ? V : T;
|
||||||
|
global {
|
||||||
|
interface BufferConstructor {
|
||||||
|
// see buffer.d.ts for implementation shared with all TypeScript versions
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocates a new buffer containing the given {str}.
|
||||||
|
*
|
||||||
|
* @param str String to store in buffer.
|
||||||
|
* @param encoding encoding to use, optional. Default is 'utf8'
|
||||||
|
* @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
|
||||||
|
*/
|
||||||
|
new(str: string, encoding?: BufferEncoding): Buffer<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* Allocates a new buffer of {size} octets.
|
||||||
|
*
|
||||||
|
* @param size count of octets to allocate.
|
||||||
|
* @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
|
||||||
|
*/
|
||||||
|
new(size: number): Buffer<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* Allocates a new buffer containing the given {array} of octets.
|
||||||
|
*
|
||||||
|
* @param array The octets to store.
|
||||||
|
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
||||||
|
*/
|
||||||
|
new(array: ArrayLike<number>): Buffer<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* Produces a Buffer backed by the same allocated memory as
|
||||||
|
* the given {ArrayBuffer}/{SharedArrayBuffer}.
|
||||||
|
*
|
||||||
|
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
||||||
|
* @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
|
||||||
|
*/
|
||||||
|
new<TArrayBuffer extends ArrayBufferLike = ArrayBuffer>(arrayBuffer: TArrayBuffer): Buffer<TArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`.
|
||||||
|
* Array entries outside that range will be truncated to fit into it.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.
|
||||||
|
* const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If `array` is an `Array`-like object (that is, one with a `length` property of
|
||||||
|
* type `number`), it is treated as if it is an array, unless it is a `Buffer` or
|
||||||
|
* a `Uint8Array`. This means all other `TypedArray` variants get treated as an
|
||||||
|
* `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use
|
||||||
|
* `Buffer.copyBytesFrom()`.
|
||||||
|
*
|
||||||
|
* A `TypeError` will be thrown if `array` is not an `Array` or another type
|
||||||
|
* appropriate for `Buffer.from()` variants.
|
||||||
|
*
|
||||||
|
* `Buffer.from(array)` and `Buffer.from(string)` may also use the internal
|
||||||
|
* `Buffer` pool like `Buffer.allocUnsafe()` does.
|
||||||
|
* @since v5.10.0
|
||||||
|
*/
|
||||||
|
from(array: WithImplicitCoercion<ArrayLike<number>>): Buffer<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* This creates a view of the `ArrayBuffer` without copying the underlying
|
||||||
|
* memory. For example, when passed a reference to the `.buffer` property of a
|
||||||
|
* `TypedArray` instance, the newly created `Buffer` will share the same
|
||||||
|
* allocated memory as the `TypedArray`'s underlying `ArrayBuffer`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const arr = new Uint16Array(2);
|
||||||
|
*
|
||||||
|
* arr[0] = 5000;
|
||||||
|
* arr[1] = 4000;
|
||||||
|
*
|
||||||
|
* // Shares memory with `arr`.
|
||||||
|
* const buf = Buffer.from(arr.buffer);
|
||||||
|
*
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints: <Buffer 88 13 a0 0f>
|
||||||
|
*
|
||||||
|
* // Changing the original Uint16Array changes the Buffer also.
|
||||||
|
* arr[1] = 6000;
|
||||||
|
*
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints: <Buffer 88 13 70 17>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The optional `byteOffset` and `length` arguments specify a memory range within
|
||||||
|
* the `arrayBuffer` that will be shared by the `Buffer`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const ab = new ArrayBuffer(10);
|
||||||
|
* const buf = Buffer.from(ab, 0, 2);
|
||||||
|
*
|
||||||
|
* console.log(buf.length);
|
||||||
|
* // Prints: 2
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer` or a
|
||||||
|
* `SharedArrayBuffer` or another type appropriate for `Buffer.from()`
|
||||||
|
* variants.
|
||||||
|
*
|
||||||
|
* It is important to remember that a backing `ArrayBuffer` can cover a range
|
||||||
|
* of memory that extends beyond the bounds of a `TypedArray` view. A new
|
||||||
|
* `Buffer` created using the `buffer` property of a `TypedArray` may extend
|
||||||
|
* beyond the range of the `TypedArray`:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const arrA = Uint8Array.from([0x63, 0x64, 0x65, 0x66]); // 4 elements
|
||||||
|
* const arrB = new Uint8Array(arrA.buffer, 1, 2); // 2 elements
|
||||||
|
* console.log(arrA.buffer === arrB.buffer); // true
|
||||||
|
*
|
||||||
|
* const buf = Buffer.from(arrB.buffer);
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints: <Buffer 63 64 65 66>
|
||||||
|
* ```
|
||||||
|
* @since v5.10.0
|
||||||
|
* @param arrayBuffer An `ArrayBuffer`, `SharedArrayBuffer`, for example the
|
||||||
|
* `.buffer` property of a `TypedArray`.
|
||||||
|
* @param byteOffset Index of first byte to expose. **Default:** `0`.
|
||||||
|
* @param length Number of bytes to expose. **Default:**
|
||||||
|
* `arrayBuffer.byteLength - byteOffset`.
|
||||||
|
*/
|
||||||
|
from<TArrayBuffer extends WithImplicitCoercion<ArrayBufferLike>>(
|
||||||
|
arrayBuffer: TArrayBuffer,
|
||||||
|
byteOffset?: number,
|
||||||
|
length?: number,
|
||||||
|
): Buffer<ImplicitArrayBuffer<TArrayBuffer>>;
|
||||||
|
/**
|
||||||
|
* Creates a new `Buffer` containing `string`. The `encoding` parameter identifies
|
||||||
|
* the character encoding to be used when converting `string` into bytes.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const buf1 = Buffer.from('this is a tést');
|
||||||
|
* const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');
|
||||||
|
*
|
||||||
|
* console.log(buf1.toString());
|
||||||
|
* // Prints: this is a tést
|
||||||
|
* console.log(buf2.toString());
|
||||||
|
* // Prints: this is a tést
|
||||||
|
* console.log(buf1.toString('latin1'));
|
||||||
|
* // Prints: this is a tést
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* A `TypeError` will be thrown if `string` is not a string or another type
|
||||||
|
* appropriate for `Buffer.from()` variants.
|
||||||
|
*
|
||||||
|
* `Buffer.from(string)` may also use the internal `Buffer` pool like
|
||||||
|
* `Buffer.allocUnsafe()` does.
|
||||||
|
* @since v5.10.0
|
||||||
|
* @param string A string to encode.
|
||||||
|
* @param encoding The encoding of `string`. **Default:** `'utf8'`.
|
||||||
|
*/
|
||||||
|
from(string: WithImplicitCoercion<string>, encoding?: BufferEncoding): Buffer<ArrayBuffer>;
|
||||||
|
from(arrayOrString: WithImplicitCoercion<ArrayLike<number> | string>): Buffer<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* Creates a new Buffer using the passed {data}
|
||||||
|
* @param values to create a new Buffer
|
||||||
|
*/
|
||||||
|
of(...items: number[]): Buffer<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together.
|
||||||
|
*
|
||||||
|
* If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned.
|
||||||
|
*
|
||||||
|
* If `totalLength` is not provided, it is calculated from the `Buffer` instances
|
||||||
|
* in `list` by adding their lengths.
|
||||||
|
*
|
||||||
|
* If `totalLength` is provided, it is coerced to an unsigned integer. If the
|
||||||
|
* combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
|
||||||
|
* truncated to `totalLength`. If the combined length of the `Buffer`s in `list` is
|
||||||
|
* less than `totalLength`, the remaining space is filled with zeros.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* // Create a single `Buffer` from a list of three `Buffer` instances.
|
||||||
|
*
|
||||||
|
* const buf1 = Buffer.alloc(10);
|
||||||
|
* const buf2 = Buffer.alloc(14);
|
||||||
|
* const buf3 = Buffer.alloc(18);
|
||||||
|
* const totalLength = buf1.length + buf2.length + buf3.length;
|
||||||
|
*
|
||||||
|
* console.log(totalLength);
|
||||||
|
* // Prints: 42
|
||||||
|
*
|
||||||
|
* const bufA = Buffer.concat([buf1, buf2, buf3], totalLength);
|
||||||
|
*
|
||||||
|
* console.log(bufA);
|
||||||
|
* // Prints: <Buffer 00 00 00 00 ...>
|
||||||
|
* console.log(bufA.length);
|
||||||
|
* // Prints: 42
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
|
||||||
|
* @since v0.7.11
|
||||||
|
* @param list List of `Buffer` or {@link Uint8Array} instances to concatenate.
|
||||||
|
* @param totalLength Total length of the `Buffer` instances in `list` when concatenated.
|
||||||
|
*/
|
||||||
|
concat(list: readonly Uint8Array[], totalLength?: number): Buffer<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* Copies the underlying memory of `view` into a new `Buffer`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const u16 = new Uint16Array([0, 0xffff]);
|
||||||
|
* const buf = Buffer.copyBytesFrom(u16, 1, 1);
|
||||||
|
* u16[1] = 0;
|
||||||
|
* console.log(buf.length); // 2
|
||||||
|
* console.log(buf[0]); // 255
|
||||||
|
* console.log(buf[1]); // 255
|
||||||
|
* ```
|
||||||
|
* @since v19.8.0
|
||||||
|
* @param view The {TypedArray} to copy.
|
||||||
|
* @param [offset=0] The starting offset within `view`.
|
||||||
|
* @param [length=view.length - offset] The number of elements from `view` to copy.
|
||||||
|
*/
|
||||||
|
copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const buf = Buffer.alloc(5);
|
||||||
|
*
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints: <Buffer 00 00 00 00 00>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
|
||||||
|
*
|
||||||
|
* If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const buf = Buffer.alloc(5, 'a');
|
||||||
|
*
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints: <Buffer 61 61 61 61 61>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If both `fill` and `encoding` are specified, the allocated `Buffer` will be
|
||||||
|
* initialized by calling `buf.fill(fill, encoding)`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
|
||||||
|
*
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints: <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance
|
||||||
|
* contents will never contain sensitive data from previous allocations, including
|
||||||
|
* data that might not have been allocated for `Buffer`s.
|
||||||
|
*
|
||||||
|
* A `TypeError` will be thrown if `size` is not a number.
|
||||||
|
* @since v5.10.0
|
||||||
|
* @param size The desired length of the new `Buffer`.
|
||||||
|
* @param [fill=0] A value to pre-fill the new `Buffer` with.
|
||||||
|
* @param [encoding='utf8'] If `fill` is a string, this is its encoding.
|
||||||
|
*/
|
||||||
|
alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
|
||||||
|
*
|
||||||
|
* The underlying memory for `Buffer` instances created in this way is _not_
|
||||||
|
* _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const buf = Buffer.allocUnsafe(10);
|
||||||
|
*
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints (contents may vary): <Buffer a0 8b 28 3f 01 00 00 00 50 32>
|
||||||
|
*
|
||||||
|
* buf.fill(0);
|
||||||
|
*
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints: <Buffer 00 00 00 00 00 00 00 00 00 00>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* A `TypeError` will be thrown if `size` is not a number.
|
||||||
|
*
|
||||||
|
* The `Buffer` module pre-allocates an internal `Buffer` instance of
|
||||||
|
* size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`,
|
||||||
|
* and `Buffer.concat()` only when `size` is less than `Buffer.poolSize >>> 1` (floor of `Buffer.poolSize` divided by two).
|
||||||
|
*
|
||||||
|
* Use of this pre-allocated internal memory pool is a key difference between
|
||||||
|
* calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
|
||||||
|
* Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less
|
||||||
|
* than or equal to half `Buffer.poolSize`. The
|
||||||
|
* difference is subtle but can be important when an application requires the
|
||||||
|
* additional performance that `Buffer.allocUnsafe()` provides.
|
||||||
|
* @since v5.10.0
|
||||||
|
* @param size The desired length of the new `Buffer`.
|
||||||
|
*/
|
||||||
|
allocUnsafe(size: number): Buffer<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. A zero-length `Buffer` is created if
|
||||||
|
* `size` is 0.
|
||||||
|
*
|
||||||
|
* The underlying memory for `Buffer` instances created in this way is _not_
|
||||||
|
* _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize
|
||||||
|
* such `Buffer` instances with zeroes.
|
||||||
|
*
|
||||||
|
* When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
|
||||||
|
* allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This
|
||||||
|
* allows applications to avoid the garbage collection overhead of creating many
|
||||||
|
* individually allocated `Buffer` instances. This approach improves both
|
||||||
|
* performance and memory usage by eliminating the need to track and clean up as
|
||||||
|
* many individual `ArrayBuffer` objects.
|
||||||
|
*
|
||||||
|
* However, in the case where a developer may need to retain a small chunk of
|
||||||
|
* memory from a pool for an indeterminate amount of time, it may be appropriate
|
||||||
|
* to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and
|
||||||
|
* then copying out the relevant bits.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* // Need to keep around a few small chunks of memory.
|
||||||
|
* const store = [];
|
||||||
|
*
|
||||||
|
* socket.on('readable', () => {
|
||||||
|
* let data;
|
||||||
|
* while (null !== (data = readable.read())) {
|
||||||
|
* // Allocate for retained data.
|
||||||
|
* const sb = Buffer.allocUnsafeSlow(10);
|
||||||
|
*
|
||||||
|
* // Copy the data into the new allocation.
|
||||||
|
* data.copy(sb, 0, 0, 10);
|
||||||
|
*
|
||||||
|
* store.push(sb);
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* A `TypeError` will be thrown if `size` is not a number.
|
||||||
|
* @since v5.12.0
|
||||||
|
* @param size The desired length of the new `Buffer`.
|
||||||
|
*/
|
||||||
|
allocUnsafeSlow(size: number): Buffer<ArrayBuffer>;
|
||||||
|
}
|
||||||
|
interface Buffer<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> extends Uint8Array<TArrayBuffer> {
|
||||||
|
// see buffer.d.ts for implementation shared with all TypeScript versions
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new `Buffer` that references the same memory as the original, but
|
||||||
|
* offset and cropped by the `start` and `end` indices.
|
||||||
|
*
|
||||||
|
* This method is not compatible with the `Uint8Array.prototype.slice()`,
|
||||||
|
* which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const buf = Buffer.from('buffer');
|
||||||
|
*
|
||||||
|
* const copiedBuf = Uint8Array.prototype.slice.call(buf);
|
||||||
|
* copiedBuf[0]++;
|
||||||
|
* console.log(copiedBuf.toString());
|
||||||
|
* // Prints: cuffer
|
||||||
|
*
|
||||||
|
* console.log(buf.toString());
|
||||||
|
* // Prints: buffer
|
||||||
|
*
|
||||||
|
* // With buf.slice(), the original buffer is modified.
|
||||||
|
* const notReallyCopiedBuf = buf.slice();
|
||||||
|
* notReallyCopiedBuf[0]++;
|
||||||
|
* console.log(notReallyCopiedBuf.toString());
|
||||||
|
* // Prints: cuffer
|
||||||
|
* console.log(buf.toString());
|
||||||
|
* // Also prints: cuffer (!)
|
||||||
|
* ```
|
||||||
|
* @since v0.3.0
|
||||||
|
* @deprecated Use `subarray` instead.
|
||||||
|
* @param [start=0] Where the new `Buffer` will start.
|
||||||
|
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
||||||
|
*/
|
||||||
|
slice(start?: number, end?: number): Buffer<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* Returns a new `Buffer` that references the same memory as the original, but
|
||||||
|
* offset and cropped by the `start` and `end` indices.
|
||||||
|
*
|
||||||
|
* Specifying `end` greater than `buf.length` will return the same result as
|
||||||
|
* that of `end` equal to `buf.length`.
|
||||||
|
*
|
||||||
|
* This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray).
|
||||||
|
*
|
||||||
|
* Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte
|
||||||
|
* // from the original `Buffer`.
|
||||||
|
*
|
||||||
|
* const buf1 = Buffer.allocUnsafe(26);
|
||||||
|
*
|
||||||
|
* for (let i = 0; i < 26; i++) {
|
||||||
|
* // 97 is the decimal ASCII value for 'a'.
|
||||||
|
* buf1[i] = i + 97;
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* const buf2 = buf1.subarray(0, 3);
|
||||||
|
*
|
||||||
|
* console.log(buf2.toString('ascii', 0, buf2.length));
|
||||||
|
* // Prints: abc
|
||||||
|
*
|
||||||
|
* buf1[0] = 33;
|
||||||
|
*
|
||||||
|
* console.log(buf2.toString('ascii', 0, buf2.length));
|
||||||
|
* // Prints: !bc
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Specifying negative indexes causes the slice to be generated relative to the
|
||||||
|
* end of `buf` rather than the beginning.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const buf = Buffer.from('buffer');
|
||||||
|
*
|
||||||
|
* console.log(buf.subarray(-6, -1).toString());
|
||||||
|
* // Prints: buffe
|
||||||
|
* // (Equivalent to buf.subarray(0, 5).)
|
||||||
|
*
|
||||||
|
* console.log(buf.subarray(-6, -2).toString());
|
||||||
|
* // Prints: buff
|
||||||
|
* // (Equivalent to buf.subarray(0, 4).)
|
||||||
|
*
|
||||||
|
* console.log(buf.subarray(-5, -2).toString());
|
||||||
|
* // Prints: uff
|
||||||
|
* // (Equivalent to buf.subarray(1, 4).)
|
||||||
|
* ```
|
||||||
|
* @since v3.0.0
|
||||||
|
* @param [start=0] Where the new `Buffer` will start.
|
||||||
|
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
||||||
|
*/
|
||||||
|
subarray(start?: number, end?: number): Buffer<TArrayBuffer>;
|
||||||
|
}
|
||||||
|
// TODO: remove globals in future version
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedBuffer = Buffer<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type AllowSharedBuffer = Buffer<ArrayBufferLike>;
|
||||||
|
}
|
||||||
|
}
|
||||||
1810
node_modules/@types/node/buffer.d.ts
generated
vendored
Normal file
1810
node_modules/@types/node/buffer.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1433
node_modules/@types/node/child_process.d.ts
generated
vendored
Normal file
1433
node_modules/@types/node/child_process.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
486
node_modules/@types/node/cluster.d.ts
generated
vendored
Normal file
486
node_modules/@types/node/cluster.d.ts
generated
vendored
Normal file
@ -0,0 +1,486 @@
|
|||||||
|
/**
|
||||||
|
* Clusters of Node.js processes can be used to run multiple instances of Node.js
|
||||||
|
* that can distribute workloads among their application threads. When process isolation
|
||||||
|
* is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html)
|
||||||
|
* module instead, which allows running multiple application threads within a single Node.js instance.
|
||||||
|
*
|
||||||
|
* The cluster module allows easy creation of child processes that all share
|
||||||
|
* server ports.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import cluster from 'node:cluster';
|
||||||
|
* import http from 'node:http';
|
||||||
|
* import { availableParallelism } from 'node:os';
|
||||||
|
* import process from 'node:process';
|
||||||
|
*
|
||||||
|
* const numCPUs = availableParallelism();
|
||||||
|
*
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* console.log(`Primary ${process.pid} is running`);
|
||||||
|
*
|
||||||
|
* // Fork workers.
|
||||||
|
* for (let i = 0; i < numCPUs; i++) {
|
||||||
|
* cluster.fork();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* cluster.on('exit', (worker, code, signal) => {
|
||||||
|
* console.log(`worker ${worker.process.pid} died`);
|
||||||
|
* });
|
||||||
|
* } else {
|
||||||
|
* // Workers can share any TCP connection
|
||||||
|
* // In this case it is an HTTP server
|
||||||
|
* http.createServer((req, res) => {
|
||||||
|
* res.writeHead(200);
|
||||||
|
* res.end('hello world\n');
|
||||||
|
* }).listen(8000);
|
||||||
|
*
|
||||||
|
* console.log(`Worker ${process.pid} started`);
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Running Node.js will now share port 8000 between the workers:
|
||||||
|
*
|
||||||
|
* ```console
|
||||||
|
* $ node server.js
|
||||||
|
* Primary 3596 is running
|
||||||
|
* Worker 4324 started
|
||||||
|
* Worker 4520 started
|
||||||
|
* Worker 6056 started
|
||||||
|
* Worker 5644 started
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/cluster.js)
|
||||||
|
*/
|
||||||
|
declare module "node:cluster" {
|
||||||
|
import * as child_process from "node:child_process";
|
||||||
|
import { EventEmitter, InternalEventEmitter } from "node:events";
|
||||||
|
class Worker implements EventEmitter {
|
||||||
|
constructor(options?: cluster.WorkerOptions);
|
||||||
|
/**
|
||||||
|
* Each new worker is given its own unique id, this id is stored in the `id`.
|
||||||
|
*
|
||||||
|
* While a worker is alive, this is the key that indexes it in `cluster.workers`.
|
||||||
|
* @since v0.8.0
|
||||||
|
*/
|
||||||
|
id: number;
|
||||||
|
/**
|
||||||
|
* All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v25.x/api/child_process.html#child_processforkmodulepath-args-options), the returned object
|
||||||
|
* from this function is stored as `.process`. In a worker, the global `process` is stored.
|
||||||
|
*
|
||||||
|
* See: [Child Process module](https://nodejs.org/docs/latest-v25.x/api/child_process.html#child_processforkmodulepath-args-options).
|
||||||
|
*
|
||||||
|
* Workers will call `process.exit(0)` if the `'disconnect'` event occurs
|
||||||
|
* on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
|
||||||
|
* accidental disconnection.
|
||||||
|
* @since v0.7.0
|
||||||
|
*/
|
||||||
|
process: child_process.ChildProcess;
|
||||||
|
/**
|
||||||
|
* Send a message to a worker or primary, optionally with a handle.
|
||||||
|
*
|
||||||
|
* In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-v25.x/api/child_process.html#subprocesssendmessage-sendhandle-options-callback).
|
||||||
|
*
|
||||||
|
* In 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:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* const worker = cluster.fork();
|
||||||
|
* worker.send('hi there');
|
||||||
|
*
|
||||||
|
* } else if (cluster.isWorker) {
|
||||||
|
* process.on('message', (msg) => {
|
||||||
|
* process.send(msg);
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.7.0
|
||||||
|
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles.
|
||||||
|
*/
|
||||||
|
send(message: child_process.Serializable, callback?: (error: Error | null) => void): boolean;
|
||||||
|
send(
|
||||||
|
message: child_process.Serializable,
|
||||||
|
sendHandle: child_process.SendHandle,
|
||||||
|
callback?: (error: Error | null) => void,
|
||||||
|
): boolean;
|
||||||
|
send(
|
||||||
|
message: child_process.Serializable,
|
||||||
|
sendHandle: child_process.SendHandle,
|
||||||
|
options?: child_process.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`.
|
||||||
|
*
|
||||||
|
* The `kill()` function kills the worker process without waiting for a graceful
|
||||||
|
* disconnect, it has the same behavior as `worker.process.kill()`.
|
||||||
|
*
|
||||||
|
* This method is aliased as `worker.destroy()` for backwards compatibility.
|
||||||
|
*
|
||||||
|
* In a worker, `process.kill()` exists, but it is not this function;
|
||||||
|
* it is [`kill()`](https://nodejs.org/docs/latest-v25.x/api/process.html#processkillpid-signal).
|
||||||
|
* @since v0.9.12
|
||||||
|
* @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
|
||||||
|
*/
|
||||||
|
kill(signal?: string): void;
|
||||||
|
destroy(signal?: string): void;
|
||||||
|
/**
|
||||||
|
* In a worker, this function will close all servers, wait for the `'close'` event
|
||||||
|
* on those servers, and then disconnect the IPC channel.
|
||||||
|
*
|
||||||
|
* In the primary, an internal message is sent to the worker causing it to call `.disconnect()` on itself.
|
||||||
|
*
|
||||||
|
* Causes `.exitedAfterDisconnect` to be set.
|
||||||
|
*
|
||||||
|
* After a server is closed, it will no longer accept new connections,
|
||||||
|
* but connections may be accepted by any other listening worker. Existing
|
||||||
|
* connections will be allowed to close as usual. When no more connections exist,
|
||||||
|
* see `server.close()`, the IPC channel to the worker will close allowing it
|
||||||
|
* to die gracefully.
|
||||||
|
*
|
||||||
|
* The above applies _only_ to server connections, client connections are not
|
||||||
|
* automatically closed by workers, and disconnect does not wait for them to close
|
||||||
|
* before exiting.
|
||||||
|
*
|
||||||
|
* In a worker, `process.disconnect` exists, but it is not this function;
|
||||||
|
* it is `disconnect()`.
|
||||||
|
*
|
||||||
|
* Because long living server connections may block workers from disconnecting, it
|
||||||
|
* may be useful to send a message, so application specific actions may be taken to
|
||||||
|
* close them. It also may be useful to implement a timeout, killing a worker if
|
||||||
|
* the `'disconnect'` event has not been emitted after some time.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import net from 'node:net';
|
||||||
|
*
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* const worker = cluster.fork();
|
||||||
|
* let timeout;
|
||||||
|
*
|
||||||
|
* worker.on('listening', (address) => {
|
||||||
|
* worker.send('shutdown');
|
||||||
|
* worker.disconnect();
|
||||||
|
* timeout = setTimeout(() => {
|
||||||
|
* worker.kill();
|
||||||
|
* }, 2000);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* worker.on('disconnect', () => {
|
||||||
|
* clearTimeout(timeout);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* } else if (cluster.isWorker) {
|
||||||
|
* const server = net.createServer((socket) => {
|
||||||
|
* // Connections never end
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.listen(8000);
|
||||||
|
*
|
||||||
|
* process.on('message', (msg) => {
|
||||||
|
* if (msg === 'shutdown') {
|
||||||
|
* // Initiate graceful close of any connections to server
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.7.7
|
||||||
|
* @return A reference to `worker`.
|
||||||
|
*/
|
||||||
|
disconnect(): this;
|
||||||
|
/**
|
||||||
|
* This function returns `true` if the worker is connected to its primary via its
|
||||||
|
* IPC channel, `false` otherwise. A worker is connected to its primary after it
|
||||||
|
* has been created. It is disconnected after the `'disconnect'` event is emitted.
|
||||||
|
* @since v0.11.14
|
||||||
|
*/
|
||||||
|
isConnected(): boolean;
|
||||||
|
/**
|
||||||
|
* This function returns `true` if the worker's process has terminated (either
|
||||||
|
* 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';
|
||||||
|
*
|
||||||
|
* const numCPUs = availableParallelism();
|
||||||
|
*
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* console.log(`Primary ${process.pid} is running`);
|
||||||
|
*
|
||||||
|
* // Fork workers.
|
||||||
|
* for (let i = 0; i < numCPUs; i++) {
|
||||||
|
* cluster.fork();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* cluster.on('fork', (worker) => {
|
||||||
|
* console.log('worker is dead:', worker.isDead());
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* cluster.on('exit', (worker, code, signal) => {
|
||||||
|
* console.log('worker is dead:', worker.isDead());
|
||||||
|
* });
|
||||||
|
* } else {
|
||||||
|
* // Workers can share any TCP connection. In this case, it is an HTTP server.
|
||||||
|
* http.createServer((req, res) => {
|
||||||
|
* res.writeHead(200);
|
||||||
|
* res.end(`Current process\n ${process.pid}`);
|
||||||
|
* process.kill(process.pid);
|
||||||
|
* }).listen(8000);
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.11.14
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
* worker has not exited, it is `undefined`.
|
||||||
|
*
|
||||||
|
* The boolean `worker.exitedAfterDisconnect` allows distinguishing between
|
||||||
|
* voluntary and accidental exit, the primary may choose not to respawn a worker
|
||||||
|
* based on this value.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* cluster.on('exit', (worker, code, signal) => {
|
||||||
|
* if (worker.exitedAfterDisconnect === true) {
|
||||||
|
* console.log('Oh, it was just voluntary – no need to worry');
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // kill worker
|
||||||
|
* worker.kill();
|
||||||
|
* ```
|
||||||
|
* @since v6.0.0
|
||||||
|
*/
|
||||||
|
exitedAfterDisconnect: boolean;
|
||||||
|
}
|
||||||
|
interface Worker extends InternalEventEmitter<cluster.WorkerEventMap> {}
|
||||||
|
type _Worker = Worker;
|
||||||
|
namespace cluster {
|
||||||
|
interface Worker extends _Worker {}
|
||||||
|
interface WorkerOptions {
|
||||||
|
id?: number | undefined;
|
||||||
|
process?: child_process.ChildProcess | undefined;
|
||||||
|
state?: string | undefined;
|
||||||
|
}
|
||||||
|
interface WorkerEventMap {
|
||||||
|
"disconnect": [];
|
||||||
|
"error": [error: Error];
|
||||||
|
"exit": [code: number, signal: string];
|
||||||
|
"listening": [address: Address];
|
||||||
|
"message": [message: any, handle: child_process.SendHandle];
|
||||||
|
"online": [];
|
||||||
|
}
|
||||||
|
interface ClusterSettings {
|
||||||
|
/**
|
||||||
|
* List of string arguments passed to the Node.js executable.
|
||||||
|
* @default process.execArgv
|
||||||
|
*/
|
||||||
|
execArgv?: string[] | undefined;
|
||||||
|
/**
|
||||||
|
* File path to worker file.
|
||||||
|
* @default process.argv[1]
|
||||||
|
*/
|
||||||
|
exec?: string | undefined;
|
||||||
|
/**
|
||||||
|
* String arguments passed to worker.
|
||||||
|
* @default process.argv.slice(2)
|
||||||
|
*/
|
||||||
|
args?: readonly string[] | undefined;
|
||||||
|
/**
|
||||||
|
* Whether or not to send output to parent's stdio.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
silent?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must
|
||||||
|
* contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child_prcess.spawn()`](https://nodejs.org/docs/latest-v25.x/api/child_process.html#child_processspawncommand-args-options)'s
|
||||||
|
* [`stdio`](https://nodejs.org/docs/latest-v25.x/api/child_process.html#optionsstdio).
|
||||||
|
*/
|
||||||
|
stdio?: any[] | undefined;
|
||||||
|
/**
|
||||||
|
* Sets the user identity of the process. (See [`setuid(2)`](https://man7.org/linux/man-pages/man2/setuid.2.html).)
|
||||||
|
*/
|
||||||
|
uid?: number | undefined;
|
||||||
|
/**
|
||||||
|
* Sets the group identity of the process. (See [`setgid(2)`](https://man7.org/linux/man-pages/man2/setgid.2.html).)
|
||||||
|
*/
|
||||||
|
gid?: number | undefined;
|
||||||
|
/**
|
||||||
|
* Sets inspector port of worker. This can be a number, or a function that takes no arguments and returns a number.
|
||||||
|
* By default each worker gets its own port, incremented from the primary's `process.debugPort`.
|
||||||
|
*/
|
||||||
|
inspectPort?: number | (() => number) | undefined;
|
||||||
|
/**
|
||||||
|
* Specify the kind of serialization used for sending messages between processes. Possible values are `'json'` and `'advanced'`.
|
||||||
|
* See [Advanced serialization for `child_process`](https://nodejs.org/docs/latest-v25.x/api/child_process.html#advanced-serialization) for more details.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
serialization?: "json" | "advanced" | undefined;
|
||||||
|
/**
|
||||||
|
* Current working directory of the worker process.
|
||||||
|
* @default undefined (inherits from parent process)
|
||||||
|
*/
|
||||||
|
cwd?: string | undefined;
|
||||||
|
/**
|
||||||
|
* Hide the forked processes console window that would normally be created on Windows systems.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
windowsHide?: boolean | undefined;
|
||||||
|
}
|
||||||
|
interface Address {
|
||||||
|
address: string;
|
||||||
|
port: number;
|
||||||
|
/**
|
||||||
|
* The `addressType` is one of:
|
||||||
|
*
|
||||||
|
* * `4` (TCPv4)
|
||||||
|
* * `6` (TCPv6)
|
||||||
|
* * `-1` (Unix domain socket)
|
||||||
|
* * `'udp4'` or `'udp6'` (UDPv4 or UDPv6)
|
||||||
|
*/
|
||||||
|
addressType: 4 | 6 | -1 | "udp4" | "udp6";
|
||||||
|
}
|
||||||
|
interface ClusterEventMap {
|
||||||
|
"disconnect": [worker: Worker];
|
||||||
|
"exit": [worker: Worker, code: number, signal: string];
|
||||||
|
"fork": [worker: Worker];
|
||||||
|
"listening": [worker: Worker, address: Address];
|
||||||
|
"message": [worker: Worker, message: any, handle: child_process.SendHandle];
|
||||||
|
"online": [worker: Worker];
|
||||||
|
"setup": [settings: ClusterSettings];
|
||||||
|
}
|
||||||
|
interface Cluster extends InternalEventEmitter<ClusterEventMap> {
|
||||||
|
/**
|
||||||
|
* A `Worker` object contains all public information and method about a worker.
|
||||||
|
* In the primary it can be obtained using `cluster.workers`. In a worker
|
||||||
|
* it can be obtained using `cluster.worker`.
|
||||||
|
* @since v0.7.0
|
||||||
|
*/
|
||||||
|
Worker: typeof Worker;
|
||||||
|
disconnect(callback?: () => void): void;
|
||||||
|
/**
|
||||||
|
* Spawn a new worker process.
|
||||||
|
*
|
||||||
|
* This can only be called from the primary process.
|
||||||
|
* @param env Key/value pairs to add to worker process environment.
|
||||||
|
* @since v0.6.0
|
||||||
|
*/
|
||||||
|
fork(env?: any): Worker;
|
||||||
|
/** @deprecated since v16.0.0 - use isPrimary. */
|
||||||
|
readonly isMaster: boolean;
|
||||||
|
/**
|
||||||
|
* True if the process is a primary. This is determined by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID`
|
||||||
|
* is undefined, then `isPrimary` is `true`.
|
||||||
|
* @since v16.0.0
|
||||||
|
*/
|
||||||
|
readonly isPrimary: boolean;
|
||||||
|
/**
|
||||||
|
* True if the process is not a primary (it is the negation of `cluster.isPrimary`).
|
||||||
|
* @since v0.6.0
|
||||||
|
*/
|
||||||
|
readonly isWorker: boolean;
|
||||||
|
/**
|
||||||
|
* The scheduling policy, either `cluster.SCHED_RR` for round-robin or `cluster.SCHED_NONE` to leave it to the operating system. This is a
|
||||||
|
* global setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v25.x/api/cluster.html#clustersetupprimarysettings)
|
||||||
|
* is called, whichever comes first.
|
||||||
|
*
|
||||||
|
* `SCHED_RR` is the default on all operating systems except Windows. Windows will change to `SCHED_RR` once libuv is able to effectively distribute
|
||||||
|
* IOCP handles without incurring a large performance hit.
|
||||||
|
*
|
||||||
|
* `cluster.schedulingPolicy` can also be set through the `NODE_CLUSTER_SCHED_POLICY` environment variable. Valid values are `'rr'` and `'none'`.
|
||||||
|
* @since v0.11.2
|
||||||
|
*/
|
||||||
|
schedulingPolicy: number;
|
||||||
|
/**
|
||||||
|
* After calling [`.setupPrimary()`](https://nodejs.org/docs/latest-v25.x/api/cluster.html#clustersetupprimarysettings)
|
||||||
|
* (or [`.fork()`](https://nodejs.org/docs/latest-v25.x/api/cluster.html#clusterforkenv)) this settings object will contain
|
||||||
|
* the settings, including the default values.
|
||||||
|
*
|
||||||
|
* This object is not intended to be changed or set manually.
|
||||||
|
* @since v0.7.1
|
||||||
|
*/
|
||||||
|
readonly settings: ClusterSettings;
|
||||||
|
/** @deprecated since v16.0.0 - use [`.setupPrimary()`](https://nodejs.org/docs/latest-v25.x/api/cluster.html#clustersetupprimarysettings) instead. */
|
||||||
|
setupMaster(settings?: ClusterSettings): void;
|
||||||
|
/**
|
||||||
|
* `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`.
|
||||||
|
*
|
||||||
|
* Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v25.x/api/cluster.html#clusterforkenv)
|
||||||
|
* and have no effect on workers that are already running.
|
||||||
|
*
|
||||||
|
* The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to
|
||||||
|
* [`.fork()`](https://nodejs.org/docs/latest-v25.x/api/cluster.html#clusterforkenv).
|
||||||
|
*
|
||||||
|
* The defaults above apply to the first call only; the defaults for later calls are the current values at the time of
|
||||||
|
* `cluster.setupPrimary()` is called.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import cluster from 'node:cluster';
|
||||||
|
*
|
||||||
|
* cluster.setupPrimary({
|
||||||
|
* exec: 'worker.js',
|
||||||
|
* args: ['--use', 'https'],
|
||||||
|
* silent: true,
|
||||||
|
* });
|
||||||
|
* cluster.fork(); // https worker
|
||||||
|
* cluster.setupPrimary({
|
||||||
|
* exec: 'worker.js',
|
||||||
|
* args: ['--use', 'http'],
|
||||||
|
* });
|
||||||
|
* cluster.fork(); // http worker
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* This can only be called from the primary process.
|
||||||
|
* @since v16.0.0
|
||||||
|
*/
|
||||||
|
setupPrimary(settings?: ClusterSettings): void;
|
||||||
|
/**
|
||||||
|
* A reference to the current worker object. Not available in the primary process.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import cluster from 'node:cluster';
|
||||||
|
*
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* console.log('I am primary');
|
||||||
|
* cluster.fork();
|
||||||
|
* cluster.fork();
|
||||||
|
* } else if (cluster.isWorker) {
|
||||||
|
* console.log(`I am worker #${cluster.worker.id}`);
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.7.0
|
||||||
|
*/
|
||||||
|
readonly worker?: Worker;
|
||||||
|
/**
|
||||||
|
* A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process.
|
||||||
|
*
|
||||||
|
* A worker is removed from `cluster.workers` after the worker has disconnected _and_ exited. The order between these two events cannot be determined in advance. However, it
|
||||||
|
* is guaranteed that the removal from the `cluster.workers` list happens before the last `'disconnect'` or `'exit'` event is emitted.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import cluster from 'node:cluster';
|
||||||
|
*
|
||||||
|
* for (const worker of Object.values(cluster.workers)) {
|
||||||
|
* worker.send('big announcement to all workers');
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.7.0
|
||||||
|
*/
|
||||||
|
readonly workers?: NodeJS.Dict<Worker>;
|
||||||
|
readonly SCHED_NONE: number;
|
||||||
|
readonly SCHED_RR: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var cluster: cluster.Cluster;
|
||||||
|
export = cluster;
|
||||||
|
}
|
||||||
|
declare module "cluster" {
|
||||||
|
import cluster = require("node:cluster");
|
||||||
|
export = cluster;
|
||||||
|
}
|
||||||
21
node_modules/@types/node/compatibility/iterators.d.ts
generated
vendored
Normal file
21
node_modules/@types/node/compatibility/iterators.d.ts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Backwards-compatible iterator interfaces, augmented with iterator helper methods by lib.esnext.iterator in TypeScript 5.6.
|
||||||
|
// The IterableIterator interface does not contain these methods, which creates assignability issues in places where IteratorObjects
|
||||||
|
// are expected (eg. DOM-compatible APIs) if lib.esnext.iterator is loaded.
|
||||||
|
// Also ensures that iterators returned by the Node API, which inherit from Iterator.prototype, correctly expose the iterator helper methods
|
||||||
|
// if lib.esnext.iterator is loaded.
|
||||||
|
// TODO: remove once this package no longer supports TS 5.5, and replace NodeJS.BuiltinIteratorReturn with BuiltinIteratorReturn.
|
||||||
|
|
||||||
|
// Placeholders for TS <5.6
|
||||||
|
interface IteratorObject<T, TReturn, TNext> {}
|
||||||
|
interface AsyncIteratorObject<T, TReturn, TNext> {}
|
||||||
|
|
||||||
|
declare namespace NodeJS {
|
||||||
|
// Populate iterator methods for TS <5.6
|
||||||
|
interface Iterator<T, TReturn, TNext> extends globalThis.Iterator<T, TReturn, TNext> {}
|
||||||
|
interface AsyncIterator<T, TReturn, TNext> extends globalThis.AsyncIterator<T, TReturn, TNext> {}
|
||||||
|
|
||||||
|
// Polyfill for TS 5.6's instrinsic BuiltinIteratorReturn type, required for DOM-compatible iterators
|
||||||
|
type BuiltinIteratorReturn = ReturnType<any[][typeof Symbol.iterator]> extends
|
||||||
|
globalThis.Iterator<any, infer TReturn> ? TReturn
|
||||||
|
: any;
|
||||||
|
}
|
||||||
151
node_modules/@types/node/console.d.ts
generated
vendored
Normal file
151
node_modules/@types/node/console.d.ts
generated
vendored
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
/**
|
||||||
|
* The `node:console` module provides a simple debugging console that is similar to
|
||||||
|
* the JavaScript console mechanism provided by web browsers.
|
||||||
|
*
|
||||||
|
* The module exports two specific components:
|
||||||
|
*
|
||||||
|
* * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream.
|
||||||
|
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v25.x/api/process.html#processstdout) and
|
||||||
|
* [`process.stderr`](https://nodejs.org/docs/latest-v25.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module.
|
||||||
|
*
|
||||||
|
* _**Warning**_: The global console object's methods are neither consistently
|
||||||
|
* synchronous like the browser APIs they resemble, nor are they consistently
|
||||||
|
* asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v25.x/api/process.html#a-note-on-process-io) for
|
||||||
|
* more information.
|
||||||
|
*
|
||||||
|
* Example using the global `console`:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* console.log('hello world');
|
||||||
|
* // Prints: hello world, to stdout
|
||||||
|
* console.log('hello %s', 'world');
|
||||||
|
* // Prints: hello world, to stdout
|
||||||
|
* console.error(new Error('Whoops, something bad happened'));
|
||||||
|
* // Prints error message and stack trace to stderr:
|
||||||
|
* // Error: Whoops, something bad happened
|
||||||
|
* // at [eval]:5:15
|
||||||
|
* // at Script.runInThisContext (node:vm:132:18)
|
||||||
|
* // at Object.runInThisContext (node:vm:309:38)
|
||||||
|
* // at node:internal/process/execution:77:19
|
||||||
|
* // at [eval]-wrapper:6:22
|
||||||
|
* // at evalScript (node:internal/process/execution:76:60)
|
||||||
|
* // at node:internal/main/eval_string:23:3
|
||||||
|
*
|
||||||
|
* const name = 'Will Robinson';
|
||||||
|
* console.warn(`Danger ${name}! Danger!`);
|
||||||
|
* // Prints: Danger Will Robinson! Danger!, to stderr
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Example using the `Console` class:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const out = getStreamSomehow();
|
||||||
|
* const err = getStreamSomehow();
|
||||||
|
* const myConsole = new console.Console(out, err);
|
||||||
|
*
|
||||||
|
* myConsole.log('hello world');
|
||||||
|
* // Prints: hello world, to out
|
||||||
|
* myConsole.log('hello %s', 'world');
|
||||||
|
* // Prints: hello world, to out
|
||||||
|
* myConsole.error(new Error('Whoops, something bad happened'));
|
||||||
|
* // Prints: [Error: Whoops, something bad happened], to err
|
||||||
|
*
|
||||||
|
* const name = 'Will Robinson';
|
||||||
|
* myConsole.warn(`Danger ${name}! Danger!`);
|
||||||
|
* // Prints: Danger Will Robinson! Danger!, to err
|
||||||
|
* ```
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/console.js)
|
||||||
|
*/
|
||||||
|
declare module "node:console" {
|
||||||
|
import { InspectOptions } from "node:util";
|
||||||
|
namespace console {
|
||||||
|
interface ConsoleOptions {
|
||||||
|
stdout: NodeJS.WritableStream;
|
||||||
|
stderr?: NodeJS.WritableStream | undefined;
|
||||||
|
/**
|
||||||
|
* Ignore errors when writing to the underlying streams.
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
|
ignoreErrors?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Set color support for this `Console` instance. Setting to true enables coloring while inspecting
|
||||||
|
* values. Setting to `false` disables coloring while inspecting values. Setting to `'auto'` makes color
|
||||||
|
* support depend on the value of the `isTTY` property and the value returned by `getColorDepth()` on the
|
||||||
|
* respective stream. This option can not be used, if `inspectOptions.colors` is set as well.
|
||||||
|
* @default 'auto'
|
||||||
|
*/
|
||||||
|
colorMode?: boolean | "auto" | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies options that are passed along to
|
||||||
|
* [`util.inspect()`](https://nodejs.org/docs/latest-v25.x/api/util.html#utilinspectobject-options).
|
||||||
|
*/
|
||||||
|
inspectOptions?: InspectOptions | ReadonlyMap<NodeJS.WritableStream, InspectOptions> | undefined;
|
||||||
|
/**
|
||||||
|
* Set group indentation.
|
||||||
|
* @default 2
|
||||||
|
*/
|
||||||
|
groupIndentation?: number | undefined;
|
||||||
|
}
|
||||||
|
interface Console {
|
||||||
|
readonly Console: {
|
||||||
|
prototype: Console;
|
||||||
|
new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
|
||||||
|
new(options: ConsoleOptions): Console;
|
||||||
|
};
|
||||||
|
assert(condition?: unknown, ...data: any[]): void;
|
||||||
|
clear(): void;
|
||||||
|
count(label?: string): void;
|
||||||
|
countReset(label?: string): void;
|
||||||
|
debug(...data: any[]): void;
|
||||||
|
dir(item?: any, options?: InspectOptions): void;
|
||||||
|
dirxml(...data: any[]): void;
|
||||||
|
error(...data: any[]): void;
|
||||||
|
group(...data: any[]): void;
|
||||||
|
groupCollapsed(...data: any[]): void;
|
||||||
|
groupEnd(): void;
|
||||||
|
info(...data: any[]): void;
|
||||||
|
log(...data: any[]): void;
|
||||||
|
table(tabularData?: any, properties?: string[]): void;
|
||||||
|
time(label?: string): void;
|
||||||
|
timeEnd(label?: string): void;
|
||||||
|
timeLog(label?: string, ...data: any[]): void;
|
||||||
|
trace(...data: any[]): void;
|
||||||
|
warn(...data: any[]): void;
|
||||||
|
/**
|
||||||
|
* This method does not display anything unless used in the inspector. The `console.profile()`
|
||||||
|
* method starts a JavaScript CPU profile with an optional label until {@link profileEnd}
|
||||||
|
* is called. The profile is then added to the Profile panel of the inspector.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* console.profile('MyLabel');
|
||||||
|
* // Some code
|
||||||
|
* console.profileEnd('MyLabel');
|
||||||
|
* // Adds the profile 'MyLabel' to the Profiles panel of the inspector.
|
||||||
|
* ```
|
||||||
|
* @since v8.0.0
|
||||||
|
*/
|
||||||
|
profile(label?: string): void;
|
||||||
|
/**
|
||||||
|
* This method does not display anything unless used in the inspector. Stops the current
|
||||||
|
* JavaScript CPU profiling session if one has been started and prints the report to the
|
||||||
|
* Profiles panel of the inspector. See {@link profile} for an example.
|
||||||
|
*
|
||||||
|
* If this method is called without a label, the most recently started profile is stopped.
|
||||||
|
* @since v8.0.0
|
||||||
|
*/
|
||||||
|
profileEnd(label?: string): void;
|
||||||
|
/**
|
||||||
|
* This method does not display anything unless used in the inspector. The `console.timeStamp()`
|
||||||
|
* method adds an event with the label `'label'` to the Timeline panel of the inspector.
|
||||||
|
* @since v8.0.0
|
||||||
|
*/
|
||||||
|
timeStamp(label?: string): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var console: console.Console;
|
||||||
|
export = console;
|
||||||
|
}
|
||||||
|
declare module "console" {
|
||||||
|
import console = require("node:console");
|
||||||
|
export = console;
|
||||||
|
}
|
||||||
20
node_modules/@types/node/constants.d.ts
generated
vendored
Normal file
20
node_modules/@types/node/constants.d.ts
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* @deprecated The `node:constants` module is deprecated. When requiring access to constants
|
||||||
|
* relevant to specific Node.js builtin modules, developers should instead refer
|
||||||
|
* to the `constants` property exposed by the relevant module. For instance,
|
||||||
|
* `require('node:fs').constants` and `require('node:os').constants`.
|
||||||
|
*/
|
||||||
|
declare module "node:constants" {
|
||||||
|
const constants:
|
||||||
|
& typeof import("node:os").constants.dlopen
|
||||||
|
& typeof import("node:os").constants.errno
|
||||||
|
& typeof import("node:os").constants.priority
|
||||||
|
& typeof import("node:os").constants.signals
|
||||||
|
& typeof import("node:fs").constants
|
||||||
|
& typeof import("node:crypto").constants;
|
||||||
|
export = constants;
|
||||||
|
}
|
||||||
|
declare module "constants" {
|
||||||
|
import constants = require("node:constants");
|
||||||
|
export = constants;
|
||||||
|
}
|
||||||
4065
node_modules/@types/node/crypto.d.ts
generated
vendored
Normal file
4065
node_modules/@types/node/crypto.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
564
node_modules/@types/node/dgram.d.ts
generated
vendored
Normal file
564
node_modules/@types/node/dgram.d.ts
generated
vendored
Normal file
@ -0,0 +1,564 @@
|
|||||||
|
/**
|
||||||
|
* The `node:dgram` module provides an implementation of UDP datagram sockets.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import dgram from 'node:dgram';
|
||||||
|
*
|
||||||
|
* const server = dgram.createSocket('udp4');
|
||||||
|
*
|
||||||
|
* server.on('error', (err) => {
|
||||||
|
* console.error(`server error:\n${err.stack}`);
|
||||||
|
* server.close();
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.on('message', (msg, rinfo) => {
|
||||||
|
* console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.on('listening', () => {
|
||||||
|
* const address = server.address();
|
||||||
|
* console.log(`server listening ${address.address}:${address.port}`);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.bind(41234);
|
||||||
|
* // Prints: server listening 0.0.0.0:41234
|
||||||
|
* ```
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/dgram.js)
|
||||||
|
*/
|
||||||
|
declare module "node:dgram" {
|
||||||
|
import { NonSharedBuffer } from "node:buffer";
|
||||||
|
import * as dns from "node:dns";
|
||||||
|
import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
|
||||||
|
import { AddressInfo, BlockList } from "node:net";
|
||||||
|
interface RemoteInfo {
|
||||||
|
address: string;
|
||||||
|
family: "IPv4" | "IPv6";
|
||||||
|
port: number;
|
||||||
|
size: number;
|
||||||
|
}
|
||||||
|
interface BindOptions {
|
||||||
|
port?: number | undefined;
|
||||||
|
address?: string | undefined;
|
||||||
|
exclusive?: boolean | undefined;
|
||||||
|
fd?: number | undefined;
|
||||||
|
}
|
||||||
|
type SocketType = "udp4" | "udp6";
|
||||||
|
interface SocketOptions extends Abortable {
|
||||||
|
type: SocketType;
|
||||||
|
reuseAddr?: boolean | undefined;
|
||||||
|
reusePort?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
receiveBlockList?: BlockList | undefined;
|
||||||
|
sendBlockList?: BlockList | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram
|
||||||
|
* messages. When `address` and `port` are not passed to `socket.bind()` the
|
||||||
|
* method will bind the socket to the "all interfaces" address on a random port
|
||||||
|
* (it does the right thing for both `udp4` and `udp6` sockets). The bound address
|
||||||
|
* and port can be retrieved using `socket.address().address` and `socket.address().port`.
|
||||||
|
*
|
||||||
|
* If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.close()` on the socket:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const controller = new AbortController();
|
||||||
|
* const { signal } = controller;
|
||||||
|
* const server = dgram.createSocket({ type: 'udp4', signal });
|
||||||
|
* server.on('message', (msg, rinfo) => {
|
||||||
|
* console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
|
||||||
|
* });
|
||||||
|
* // Later, when you want to close the server.
|
||||||
|
* controller.abort();
|
||||||
|
* ```
|
||||||
|
* @since v0.11.13
|
||||||
|
* @param options Available options are:
|
||||||
|
* @param callback Attached as a listener for `'message'` events. Optional.
|
||||||
|
*/
|
||||||
|
function createSocket(type: SocketType, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket;
|
||||||
|
function createSocket(options: SocketOptions, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket;
|
||||||
|
interface SocketEventMap {
|
||||||
|
"close": [];
|
||||||
|
"connect": [];
|
||||||
|
"error": [err: Error];
|
||||||
|
"listening": [];
|
||||||
|
"message": [msg: NonSharedBuffer, rinfo: RemoteInfo];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Encapsulates the datagram functionality.
|
||||||
|
*
|
||||||
|
* New instances of `dgram.Socket` are created using {@link createSocket}.
|
||||||
|
* The `new` keyword is not to be used to create `dgram.Socket` instances.
|
||||||
|
* @since v0.1.99
|
||||||
|
*/
|
||||||
|
class Socket implements EventEmitter {
|
||||||
|
/**
|
||||||
|
* Tells the kernel to join a multicast group at the given `multicastAddress` and `multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the `multicastInterface` argument is not
|
||||||
|
* specified, the operating system will choose
|
||||||
|
* one interface and will add membership to it. To add membership to every
|
||||||
|
* available interface, call `addMembership` multiple times, once per interface.
|
||||||
|
*
|
||||||
|
* When called on an unbound socket, this method will implicitly bind to a random
|
||||||
|
* port, listening on all interfaces.
|
||||||
|
*
|
||||||
|
* 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';
|
||||||
|
*
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* cluster.fork(); // Works ok.
|
||||||
|
* cluster.fork(); // Fails with EADDRINUSE.
|
||||||
|
* } else {
|
||||||
|
* const s = dgram.createSocket('udp4');
|
||||||
|
* s.bind(1234, () => {
|
||||||
|
* s.addMembership('224.0.0.114');
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.6.9
|
||||||
|
*/
|
||||||
|
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.
|
||||||
|
*
|
||||||
|
* This method throws `EBADF` if called on an unbound socket.
|
||||||
|
* @since v0.1.99
|
||||||
|
*/
|
||||||
|
address(): AddressInfo;
|
||||||
|
/**
|
||||||
|
* For UDP sockets, causes the `dgram.Socket` to listen for datagram
|
||||||
|
* messages on a named `port` and optional `address`. If `port` is not
|
||||||
|
* specified or is `0`, the operating system will attempt to bind to a
|
||||||
|
* random port. If `address` is not specified, the operating system will
|
||||||
|
* attempt to listen on all addresses. Once binding is complete, a `'listening'` event is emitted and the optional `callback` function is
|
||||||
|
* called.
|
||||||
|
*
|
||||||
|
* Specifying both a `'listening'` event listener and passing a `callback` to the `socket.bind()` method is not harmful but not very
|
||||||
|
* useful.
|
||||||
|
*
|
||||||
|
* A bound datagram socket keeps the Node.js process running to receive
|
||||||
|
* datagram messages.
|
||||||
|
*
|
||||||
|
* If binding fails, an `'error'` event is generated. In rare case (e.g.
|
||||||
|
* attempting to bind with a closed socket), an `Error` may be thrown.
|
||||||
|
*
|
||||||
|
* Example of a UDP server listening on port 41234:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import dgram from 'node:dgram';
|
||||||
|
*
|
||||||
|
* const server = dgram.createSocket('udp4');
|
||||||
|
*
|
||||||
|
* server.on('error', (err) => {
|
||||||
|
* console.error(`server error:\n${err.stack}`);
|
||||||
|
* server.close();
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.on('message', (msg, rinfo) => {
|
||||||
|
* console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.on('listening', () => {
|
||||||
|
* const address = server.address();
|
||||||
|
* console.log(`server listening ${address.address}:${address.port}`);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.bind(41234);
|
||||||
|
* // Prints: server listening 0.0.0.0:41234
|
||||||
|
* ```
|
||||||
|
* @since v0.1.99
|
||||||
|
* @param callback with no parameters. Called when binding is complete.
|
||||||
|
*/
|
||||||
|
bind(port?: number, address?: string, callback?: () => void): this;
|
||||||
|
bind(port?: number, callback?: () => void): this;
|
||||||
|
bind(callback?: () => void): this;
|
||||||
|
bind(options: BindOptions, callback?: () => void): this;
|
||||||
|
/**
|
||||||
|
* Close the underlying socket and stop listening for data on it. If a callback is
|
||||||
|
* provided, it is added as a listener for the `'close'` event.
|
||||||
|
* @since v0.1.99
|
||||||
|
* @param callback Called when the socket has been closed.
|
||||||
|
*/
|
||||||
|
close(callback?: () => void): this;
|
||||||
|
/**
|
||||||
|
* Associates the `dgram.Socket` to a remote address and port. Every
|
||||||
|
* message sent by this handle is automatically sent to that destination. Also,
|
||||||
|
* the socket will only receive messages from that remote peer.
|
||||||
|
* Trying to call `connect()` on an already connected socket will result
|
||||||
|
* in an `ERR_SOCKET_DGRAM_IS_CONNECTED` exception. If `address` is not
|
||||||
|
* provided, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets)
|
||||||
|
* will be used by default. Once the connection is complete, a `'connect'` event
|
||||||
|
* is emitted and the optional `callback` function is called. In case of failure,
|
||||||
|
* the `callback` is called or, failing this, an `'error'` event is emitted.
|
||||||
|
* @since v12.0.0
|
||||||
|
* @param callback Called when the connection is completed or on error.
|
||||||
|
*/
|
||||||
|
connect(port: number, address?: string, callback?: () => void): void;
|
||||||
|
connect(port: number, callback: () => void): void;
|
||||||
|
/**
|
||||||
|
* A synchronous function that disassociates a connected `dgram.Socket` from
|
||||||
|
* its remote address. Trying to call `disconnect()` on an unbound or already
|
||||||
|
* disconnected socket will result in an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception.
|
||||||
|
* @since v12.0.0
|
||||||
|
*/
|
||||||
|
disconnect(): void;
|
||||||
|
/**
|
||||||
|
* Instructs the kernel to leave a multicast group at `multicastAddress` using the `IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
|
||||||
|
* kernel when the socket is closed or the process terminates, so most apps will
|
||||||
|
* never have reason to call this.
|
||||||
|
*
|
||||||
|
* If `multicastInterface` is not specified, the operating system will attempt to
|
||||||
|
* drop membership on all valid interfaces.
|
||||||
|
* @since v0.6.9
|
||||||
|
*/
|
||||||
|
dropMembership(multicastAddress: string, multicastInterface?: string): void;
|
||||||
|
/**
|
||||||
|
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
|
||||||
|
* @since v8.7.0
|
||||||
|
* @return the `SO_RCVBUF` socket receive buffer size in bytes.
|
||||||
|
*/
|
||||||
|
getRecvBufferSize(): number;
|
||||||
|
/**
|
||||||
|
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
|
||||||
|
* @since v8.7.0
|
||||||
|
* @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
|
||||||
|
* to exclude the socket from the reference counting that keeps the Node.js
|
||||||
|
* process active. The `socket.ref()` method adds the socket back to the reference
|
||||||
|
* counting and restores the default behavior.
|
||||||
|
*
|
||||||
|
* Calling `socket.ref()` multiples times will have no additional effect.
|
||||||
|
*
|
||||||
|
* The `socket.ref()` method returns a reference to the socket so calls can be
|
||||||
|
* chained.
|
||||||
|
* @since v0.9.1
|
||||||
|
*/
|
||||||
|
ref(): this;
|
||||||
|
/**
|
||||||
|
* Returns an object containing the `address`, `family`, and `port` of the remote
|
||||||
|
* endpoint. This method throws an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception
|
||||||
|
* if the socket is not connected.
|
||||||
|
* @since v12.0.0
|
||||||
|
*/
|
||||||
|
remoteAddress(): AddressInfo;
|
||||||
|
/**
|
||||||
|
* Broadcasts a datagram on the socket.
|
||||||
|
* For connectionless sockets, the destination `port` and `address` must be
|
||||||
|
* specified. Connected sockets, on the other hand, will use their associated
|
||||||
|
* remote endpoint, so the `port` and `address` arguments must not be set.
|
||||||
|
*
|
||||||
|
* The `msg` argument contains the message to be sent.
|
||||||
|
* Depending on its type, different behavior can apply. If `msg` is a `Buffer`,
|
||||||
|
* any `TypedArray` or a `DataView`,
|
||||||
|
* the `offset` and `length` specify the offset within the `Buffer` where the
|
||||||
|
* message begins and the number of bytes in the message, respectively.
|
||||||
|
* If `msg` is a `String`, then it is automatically converted to a `Buffer` with `'utf8'` encoding. With messages that
|
||||||
|
* contain multi-byte characters, `offset` and `length` will be calculated with
|
||||||
|
* respect to `byte length` and not the character position.
|
||||||
|
* If `msg` is an array, `offset` and `length` must not be specified.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.)
|
||||||
|
*
|
||||||
|
* An optional `callback` function may be specified to as a way of reporting
|
||||||
|
* DNS errors or for determining when it is safe to reuse the `buf` object.
|
||||||
|
* DNS lookups delay the time to send for at least one tick of the
|
||||||
|
* Node.js event loop.
|
||||||
|
*
|
||||||
|
* The only way to know for sure that the datagram has been sent is by using a `callback`. If an error occurs and a `callback` is given, the error will be
|
||||||
|
* passed as the first argument to the `callback`. If a `callback` is not given,
|
||||||
|
* the error is emitted as an `'error'` event on the `socket` object.
|
||||||
|
*
|
||||||
|
* Offset and length are optional but both _must_ be set if either are used.
|
||||||
|
* They are supported only when the first argument is a `Buffer`, a `TypedArray`,
|
||||||
|
* or a `DataView`.
|
||||||
|
*
|
||||||
|
* This method throws `ERR_SOCKET_BAD_PORT` if called on an unbound socket.
|
||||||
|
*
|
||||||
|
* Example of sending a UDP packet to a port on `localhost`;
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import dgram from 'node:dgram';
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const message = Buffer.from('Some bytes');
|
||||||
|
* const client = dgram.createSocket('udp4');
|
||||||
|
* client.send(message, 41234, 'localhost', (err) => {
|
||||||
|
* client.close();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* 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';
|
||||||
|
*
|
||||||
|
* const buf1 = Buffer.from('Some ');
|
||||||
|
* const buf2 = Buffer.from('bytes');
|
||||||
|
* const client = dgram.createSocket('udp4');
|
||||||
|
* client.send([buf1, buf2], 41234, (err) => {
|
||||||
|
* client.close();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Sending multiple buffers might be faster or slower depending on the
|
||||||
|
* application and operating system. Run benchmarks to
|
||||||
|
* determine the optimal strategy on a case-by-case basis. Generally speaking,
|
||||||
|
* however, sending multiple buffers is faster.
|
||||||
|
*
|
||||||
|
* 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';
|
||||||
|
*
|
||||||
|
* const message = Buffer.from('Some bytes');
|
||||||
|
* const client = dgram.createSocket('udp4');
|
||||||
|
* client.connect(41234, 'localhost', (err) => {
|
||||||
|
* client.send(message, (err) => {
|
||||||
|
* client.close();
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v0.1.99
|
||||||
|
* @param msg Message to be sent.
|
||||||
|
* @param offset Offset in the buffer where the message starts.
|
||||||
|
* @param length Number of bytes in the message.
|
||||||
|
* @param port Destination port.
|
||||||
|
* @param address Destination host name or IP address.
|
||||||
|
* @param callback Called when the message has been sent.
|
||||||
|
*/
|
||||||
|
send(
|
||||||
|
msg: string | NodeJS.ArrayBufferView | readonly any[],
|
||||||
|
port?: number,
|
||||||
|
address?: string,
|
||||||
|
callback?: (error: Error | null, bytes: number) => void,
|
||||||
|
): void;
|
||||||
|
send(
|
||||||
|
msg: string | NodeJS.ArrayBufferView | readonly any[],
|
||||||
|
port?: number,
|
||||||
|
callback?: (error: Error | null, bytes: number) => void,
|
||||||
|
): void;
|
||||||
|
send(
|
||||||
|
msg: string | NodeJS.ArrayBufferView | readonly any[],
|
||||||
|
callback?: (error: Error | null, bytes: number) => void,
|
||||||
|
): void;
|
||||||
|
send(
|
||||||
|
msg: string | NodeJS.ArrayBufferView,
|
||||||
|
offset: number,
|
||||||
|
length: number,
|
||||||
|
port?: number,
|
||||||
|
address?: string,
|
||||||
|
callback?: (error: Error | null, bytes: number) => void,
|
||||||
|
): void;
|
||||||
|
send(
|
||||||
|
msg: string | NodeJS.ArrayBufferView,
|
||||||
|
offset: number,
|
||||||
|
length: number,
|
||||||
|
port?: number,
|
||||||
|
callback?: (error: Error | null, bytes: number) => void,
|
||||||
|
): void;
|
||||||
|
send(
|
||||||
|
msg: string | NodeJS.ArrayBufferView,
|
||||||
|
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.
|
||||||
|
*
|
||||||
|
* This method throws `EBADF` if called on an unbound socket.
|
||||||
|
* @since v0.6.9
|
||||||
|
*/
|
||||||
|
setBroadcast(flag: boolean): void;
|
||||||
|
/**
|
||||||
|
* _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC
|
||||||
|
* 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_
|
||||||
|
* _with a scope index is written as `'IP%scope'` where scope is an interface name_
|
||||||
|
* _or interface number._
|
||||||
|
*
|
||||||
|
* Sets the default outgoing multicast interface of the socket to a chosen
|
||||||
|
* interface or back to system interface selection. The `multicastInterface` must
|
||||||
|
* be a valid string representation of an IP from the socket's family.
|
||||||
|
*
|
||||||
|
* For IPv4 sockets, this should be the IP configured for the desired physical
|
||||||
|
* interface. All packets sent to multicast on the socket will be sent on the
|
||||||
|
* interface determined by the most recent successful use of this call.
|
||||||
|
*
|
||||||
|
* For IPv6 sockets, `multicastInterface` should include a scope to indicate the
|
||||||
|
* interface as in the examples that follow. In IPv6, individual `send` calls can
|
||||||
|
* also use explicit scope in addresses, so only packets sent to a multicast
|
||||||
|
* address without specifying an explicit scope are affected by the most recent
|
||||||
|
* successful use of this call.
|
||||||
|
*
|
||||||
|
* This method throws `EBADF` if called on an unbound socket.
|
||||||
|
*
|
||||||
|
* #### Example: IPv6 outgoing multicast interface
|
||||||
|
*
|
||||||
|
* On most systems, where scope format uses the interface name:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const socket = dgram.createSocket('udp6');
|
||||||
|
*
|
||||||
|
* socket.bind(1234, () => {
|
||||||
|
* socket.setMulticastInterface('::%eth1');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* On Windows, where scope format uses an interface number:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const socket = dgram.createSocket('udp6');
|
||||||
|
*
|
||||||
|
* socket.bind(1234, () => {
|
||||||
|
* socket.setMulticastInterface('::%2');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* #### Example: IPv4 outgoing multicast interface
|
||||||
|
*
|
||||||
|
* All systems use an IP of the host on the desired physical interface:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const socket = dgram.createSocket('udp4');
|
||||||
|
*
|
||||||
|
* socket.bind(1234, () => {
|
||||||
|
* socket.setMulticastInterface('10.0.0.2');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v8.6.0
|
||||||
|
*/
|
||||||
|
setMulticastInterface(multicastInterface: string): void;
|
||||||
|
/**
|
||||||
|
* Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`,
|
||||||
|
* multicast packets will also be received on the local interface.
|
||||||
|
*
|
||||||
|
* This method throws `EBADF` if called on an unbound socket.
|
||||||
|
* @since v0.3.8
|
||||||
|
*/
|
||||||
|
setMulticastLoopback(flag: boolean): boolean;
|
||||||
|
/**
|
||||||
|
* Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for
|
||||||
|
* "Time to Live", in this context it specifies the number of IP hops that a
|
||||||
|
* packet is allowed to travel through, specifically for multicast traffic. Each
|
||||||
|
* router or gateway that forwards a packet decrements the TTL. If the TTL is
|
||||||
|
* decremented to 0 by a router, it will not be forwarded.
|
||||||
|
*
|
||||||
|
* The `ttl` argument may be between 0 and 255\. The default on most systems is `1`.
|
||||||
|
*
|
||||||
|
* This method throws `EBADF` if called on an unbound socket.
|
||||||
|
* @since v0.3.8
|
||||||
|
*/
|
||||||
|
setMulticastTTL(ttl: number): number;
|
||||||
|
/**
|
||||||
|
* Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer
|
||||||
|
* in bytes.
|
||||||
|
*
|
||||||
|
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
|
||||||
|
* @since v8.7.0
|
||||||
|
*/
|
||||||
|
setRecvBufferSize(size: number): void;
|
||||||
|
/**
|
||||||
|
* Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer
|
||||||
|
* in bytes.
|
||||||
|
*
|
||||||
|
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
|
||||||
|
* @since v8.7.0
|
||||||
|
*/
|
||||||
|
setSendBufferSize(size: number): void;
|
||||||
|
/**
|
||||||
|
* Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live",
|
||||||
|
* in this context it specifies the number of IP hops that a packet is allowed to
|
||||||
|
* travel through. Each router or gateway that forwards a packet decrements the
|
||||||
|
* 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
|
||||||
|
* is 64.
|
||||||
|
*
|
||||||
|
* This method throws `EBADF` if called on an unbound socket.
|
||||||
|
* @since v0.1.101
|
||||||
|
*/
|
||||||
|
setTTL(ttl: number): 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
|
||||||
|
* to exclude the socket from the reference counting that keeps the Node.js
|
||||||
|
* process active, allowing the process to exit even if the socket is still
|
||||||
|
* listening.
|
||||||
|
*
|
||||||
|
* Calling `socket.unref()` multiple times will have no additional effect.
|
||||||
|
*
|
||||||
|
* The `socket.unref()` method returns a reference to the socket so calls can be
|
||||||
|
* chained.
|
||||||
|
* @since v0.9.1
|
||||||
|
*/
|
||||||
|
unref(): this;
|
||||||
|
/**
|
||||||
|
* Tells the kernel to join a source-specific multicast channel at the given `sourceAddress` and `groupAddress`, using the `multicastInterface` with the `IP_ADD_SOURCE_MEMBERSHIP` socket
|
||||||
|
* option. If the `multicastInterface` argument
|
||||||
|
* is not specified, the operating system will choose one interface and will add
|
||||||
|
* membership to it. To add membership to every available interface, call `socket.addSourceSpecificMembership()` multiple times, once per interface.
|
||||||
|
*
|
||||||
|
* When called on an unbound socket, this method will implicitly bind to a random
|
||||||
|
* port, listening on all interfaces.
|
||||||
|
* @since v13.1.0, v12.16.0
|
||||||
|
*/
|
||||||
|
addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
|
||||||
|
/**
|
||||||
|
* Instructs the kernel to leave a source-specific multicast channel at the given `sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP` socket option. This method is
|
||||||
|
* automatically called by the kernel when the
|
||||||
|
* socket is closed or the process terminates, so most apps will never have
|
||||||
|
* reason to call this.
|
||||||
|
*
|
||||||
|
* If `multicastInterface` is not specified, the operating system will attempt to
|
||||||
|
* drop membership on all valid interfaces.
|
||||||
|
* @since v13.1.0, v12.16.0
|
||||||
|
*/
|
||||||
|
dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
|
||||||
|
/**
|
||||||
|
* Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
|
||||||
|
* @since v20.5.0
|
||||||
|
*/
|
||||||
|
[Symbol.asyncDispose](): Promise<void>;
|
||||||
|
}
|
||||||
|
interface Socket extends InternalEventEmitter<SocketEventMap> {}
|
||||||
|
}
|
||||||
|
declare module "dgram" {
|
||||||
|
export * from "node:dgram";
|
||||||
|
}
|
||||||
576
node_modules/@types/node/diagnostics_channel.d.ts
generated
vendored
Normal file
576
node_modules/@types/node/diagnostics_channel.d.ts
generated
vendored
Normal file
@ -0,0 +1,576 @@
|
|||||||
|
/**
|
||||||
|
* The `node: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';
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* It is intended that a module writer wanting to report diagnostics messages
|
||||||
|
* will create one or many top-level channels to report messages through.
|
||||||
|
* Channels may also be acquired at runtime but it is not encouraged
|
||||||
|
* due to the additional overhead of doing so. Channels may be exported for
|
||||||
|
* convenience, but as long as the name is known it can be acquired anywhere.
|
||||||
|
*
|
||||||
|
* If you intend for your module to produce diagnostics data for others to
|
||||||
|
* consume it is recommended that you include documentation of what named
|
||||||
|
* 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/v25.x/lib/diagnostics_channel.js)
|
||||||
|
*/
|
||||||
|
declare module "node:diagnostics_channel" {
|
||||||
|
import { AsyncLocalStorage } from "node:async_hooks";
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This API is optional but helpful when trying to publish messages from very
|
||||||
|
* performance-sensitive code.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import diagnostics_channel from 'node:diagnostics_channel';
|
||||||
|
*
|
||||||
|
* if (diagnostics_channel.hasSubscribers('my-channel')) {
|
||||||
|
* // There are subscribers, prepare and publish message
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v15.1.0, v14.17.0
|
||||||
|
* @param name The channel name
|
||||||
|
* @return If there are active subscribers
|
||||||
|
*/
|
||||||
|
function hasSubscribers(name: string | symbol): boolean;
|
||||||
|
/**
|
||||||
|
* This is the primary entry-point for anyone wanting to publish to a named
|
||||||
|
* channel. It produces a channel object which is optimized to reduce overhead at
|
||||||
|
* publish time as much as possible.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import diagnostics_channel from 'node:diagnostics_channel';
|
||||||
|
*
|
||||||
|
* const channel = diagnostics_channel.channel('my-channel');
|
||||||
|
* ```
|
||||||
|
* @since v15.1.0, v14.17.0
|
||||||
|
* @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>;
|
||||||
|
/**
|
||||||
|
* The class `Channel` represents an individual named channel within the data
|
||||||
|
* pipeline. It is used to track subscribers and to publish messages when there
|
||||||
|
* are subscribers present. It exists as a separate object to avoid channel
|
||||||
|
* 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;
|
||||||
|
/**
|
||||||
|
* Check if there are active subscribers to this channel. This is helpful if
|
||||||
|
* the message you want to send might be expensive to prepare.
|
||||||
|
*
|
||||||
|
* This API is optional but helpful when trying to publish messages from very
|
||||||
|
* performance-sensitive code.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import diagnostics_channel from 'node:diagnostics_channel';
|
||||||
|
*
|
||||||
|
* const channel = diagnostics_channel.channel('my-channel');
|
||||||
|
*
|
||||||
|
* if (channel.hasSubscribers) {
|
||||||
|
* // There are subscribers, prepare and publish message
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v15.1.0, v14.17.0
|
||||||
|
*/
|
||||||
|
readonly hasSubscribers: boolean;
|
||||||
|
private constructor(name: string | symbol);
|
||||||
|
/**
|
||||||
|
* Publish a message to any subscribers to the channel. This will trigger
|
||||||
|
* message handlers synchronously so they will execute within the same context.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import diagnostics_channel from 'node:diagnostics_channel';
|
||||||
|
*
|
||||||
|
* const channel = diagnostics_channel.channel('my-channel');
|
||||||
|
*
|
||||||
|
* channel.publish({
|
||||||
|
* some: 'message',
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v15.1.0, v14.17.0
|
||||||
|
* @param message The message to send to the channel subscribers
|
||||||
|
*/
|
||||||
|
publish(message: unknown): void;
|
||||||
|
/**
|
||||||
|
* Register a message handler to subscribe to this channel. This message handler
|
||||||
|
* 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';
|
||||||
|
*
|
||||||
|
* const channel = diagnostics_channel.channel('my-channel');
|
||||||
|
*
|
||||||
|
* channel.subscribe((message, name) => {
|
||||||
|
* // Received data
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v15.1.0, v14.17.0
|
||||||
|
* @param onMessage The handler to receive channel messages
|
||||||
|
*/
|
||||||
|
subscribe(onMessage: ChannelListener): void;
|
||||||
|
/**
|
||||||
|
* Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import diagnostics_channel from 'node:diagnostics_channel';
|
||||||
|
*
|
||||||
|
* const channel = diagnostics_channel.channel('my-channel');
|
||||||
|
*
|
||||||
|
* function onMessage(message, name) {
|
||||||
|
* // Received data
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* channel.subscribe(onMessage);
|
||||||
|
*
|
||||||
|
* channel.unsubscribe(onMessage);
|
||||||
|
* ```
|
||||||
|
* @since v15.1.0, v14.17.0
|
||||||
|
* @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: AsyncLocalStorage<StoreType>): boolean;
|
||||||
|
/**
|
||||||
|
* 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<ThisArg = any, Args extends any[] = any[], Result = any>(
|
||||||
|
context: ContextType,
|
||||||
|
fn: (this: ThisArg, ...args: Args) => Result,
|
||||||
|
thisArg?: ThisArg,
|
||||||
|
...args: Args
|
||||||
|
): Result;
|
||||||
|
}
|
||||||
|
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.
|
||||||
|
*
|
||||||
|
* To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
|
||||||
|
* which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
|
||||||
|
*
|
||||||
|
* ```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[], Result = any>(
|
||||||
|
fn: (this: ThisArg, ...args: Args) => Result,
|
||||||
|
context?: ContextType,
|
||||||
|
thisArg?: ThisArg,
|
||||||
|
...args: Args
|
||||||
|
): Result;
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
|
||||||
|
* which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
|
||||||
|
*
|
||||||
|
* ```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[], Result = any>(
|
||||||
|
fn: (this: ThisArg, ...args: Args) => Promise<Result>,
|
||||||
|
context?: ContextType,
|
||||||
|
thisArg?: ThisArg,
|
||||||
|
...args: Args
|
||||||
|
): Promise<Result>;
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* To ensure only correct trace graphs are formed, events will only be published if subscribers are present prior to starting the trace. Subscriptions
|
||||||
|
* which are added after the trace begins will not receive future events from that trace, only future traces will be seen.
|
||||||
|
*
|
||||||
|
* ```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<ThisArg = any, Args extends any[] = any[], Result = any>(
|
||||||
|
fn: (this: ThisArg, ...args: Args) => Result,
|
||||||
|
position?: number,
|
||||||
|
context?: ContextType,
|
||||||
|
thisArg?: ThisArg,
|
||||||
|
...args: Args
|
||||||
|
): Result;
|
||||||
|
/**
|
||||||
|
* `true` if any of the individual channels has a subscriber, `false` if not.
|
||||||
|
*
|
||||||
|
* This is a helper method available on a {@link TracingChannel} instance to check
|
||||||
|
* if any of the [TracingChannel Channels](https://nodejs.org/api/diagnostics_channel.html#tracingchannel-channels) have subscribers.
|
||||||
|
* A `true` is returned if any of them have at least one subscriber, a `false` is returned otherwise.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const diagnostics_channel = require('node:diagnostics_channel');
|
||||||
|
*
|
||||||
|
* const channels = diagnostics_channel.tracingChannel('my-channel');
|
||||||
|
*
|
||||||
|
* if (channels.hasSubscribers) {
|
||||||
|
* // Do something
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v22.0.0, v20.13.0
|
||||||
|
*/
|
||||||
|
readonly hasSubscribers: boolean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module "diagnostics_channel" {
|
||||||
|
export * from "node:diagnostics_channel";
|
||||||
|
}
|
||||||
922
node_modules/@types/node/dns.d.ts
generated
vendored
Normal file
922
node_modules/@types/node/dns.d.ts
generated
vendored
Normal file
@ -0,0 +1,922 @@
|
|||||||
|
/**
|
||||||
|
* The `node: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
|
||||||
|
* DNS protocol for lookups. {@link lookup} uses the operating system
|
||||||
|
* facilities to perform name resolution. It may not need to perform any network
|
||||||
|
* communication. To perform name resolution the way other applications on the same
|
||||||
|
* system do, use {@link lookup}.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import dns from 'node:dns';
|
||||||
|
*
|
||||||
|
* dns.lookup('example.org', (err, address, family) => {
|
||||||
|
* console.log('address: %j family: IPv%s', address, family);
|
||||||
|
* });
|
||||||
|
* // address: "93.184.216.34" family: IPv4
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* All other functions in the `node:dns` module connect to an actual DNS server to
|
||||||
|
* perform name resolution. They will always use the network to perform DNS
|
||||||
|
* 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
|
||||||
|
* import dns from 'node:dns';
|
||||||
|
*
|
||||||
|
* dns.resolve4('archive.org', (err, addresses) => {
|
||||||
|
* if (err) throw err;
|
||||||
|
*
|
||||||
|
* console.log(`addresses: ${JSON.stringify(addresses)}`);
|
||||||
|
*
|
||||||
|
* addresses.forEach((a) => {
|
||||||
|
* dns.reverse(a, (err, hostnames) => {
|
||||||
|
* if (err) {
|
||||||
|
* throw err;
|
||||||
|
* }
|
||||||
|
* console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* See the [Implementation considerations section](https://nodejs.org/docs/latest-v25.x/api/dns.html#implementation-considerations) for more information.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/dns.js)
|
||||||
|
*/
|
||||||
|
declare module "node:dns" {
|
||||||
|
// Supported getaddrinfo flags.
|
||||||
|
/**
|
||||||
|
* Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are
|
||||||
|
* only returned if the current system has at least one IPv4 address configured.
|
||||||
|
*/
|
||||||
|
const ADDRCONFIG: number;
|
||||||
|
/**
|
||||||
|
* If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported
|
||||||
|
* on some operating systems (e.g. FreeBSD 10.1).
|
||||||
|
*/
|
||||||
|
const V4MAPPED: number;
|
||||||
|
/**
|
||||||
|
* If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
|
||||||
|
* well as IPv4 mapped IPv6 addresses.
|
||||||
|
*/
|
||||||
|
const ALL: number;
|
||||||
|
interface LookupOptions {
|
||||||
|
/**
|
||||||
|
* The record family. Must be `4`, `6`, or `0`. For backward compatibility reasons, `'IPv4'` and `'IPv6'` are interpreted
|
||||||
|
* as `4` and `6` respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value `0` is used
|
||||||
|
* with `{ all: true } (see below)`, both IPv4 and IPv6 addresses are returned.
|
||||||
|
* @default 0
|
||||||
|
*/
|
||||||
|
family?: number | "IPv4" | "IPv6" | undefined;
|
||||||
|
/**
|
||||||
|
* One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v25.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be
|
||||||
|
* passed by bitwise `OR`ing their values.
|
||||||
|
*/
|
||||||
|
hints?: number | undefined;
|
||||||
|
/**
|
||||||
|
* When `true`, the callback returns all resolved addresses in an array. Otherwise, returns a single address.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
all?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted
|
||||||
|
* by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6
|
||||||
|
* addresses before IPv4 addresses. Default value is configurable using
|
||||||
|
* {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--dns-result-orderorder).
|
||||||
|
* @default `verbatim` (addresses are not reordered)
|
||||||
|
* @since v22.1.0
|
||||||
|
*/
|
||||||
|
order?: "ipv4first" | "ipv6first" | "verbatim" | undefined;
|
||||||
|
/**
|
||||||
|
* When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4
|
||||||
|
* addresses are placed before IPv6 addresses. This option will be deprecated in favor of `order`. When both are specified,
|
||||||
|
* `order` has higher precedence. New code should only use `order`. Default value is configurable using {@link setDefaultResultOrder}
|
||||||
|
* @default true (addresses are not reordered)
|
||||||
|
* @deprecated Please use `order` option
|
||||||
|
*/
|
||||||
|
verbatim?: boolean | undefined;
|
||||||
|
}
|
||||||
|
interface LookupOneOptions extends LookupOptions {
|
||||||
|
all?: false | undefined;
|
||||||
|
}
|
||||||
|
interface LookupAllOptions extends LookupOptions {
|
||||||
|
all: true;
|
||||||
|
}
|
||||||
|
interface LookupAddress {
|
||||||
|
/**
|
||||||
|
* A string representation of an IPv4 or IPv6 address.
|
||||||
|
*/
|
||||||
|
address: string;
|
||||||
|
/**
|
||||||
|
* `4` or `6`, denoting the family of `address`, or `0` if the address is not an IPv4 or IPv6 address. `0` is a likely indicator of a
|
||||||
|
* bug in the name resolution service used by the operating system.
|
||||||
|
*/
|
||||||
|
family: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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`.
|
||||||
|
*
|
||||||
|
* On error, `err` is an `Error` object, where `err.code` is the error code.
|
||||||
|
* Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
|
||||||
|
* the host name does not exist but also when the lookup fails in other ways
|
||||||
|
* such as no available file descriptors.
|
||||||
|
*
|
||||||
|
* `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
|
||||||
|
* important consequences on the behavior of any Node.js program. Please take some
|
||||||
|
* time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v25.x/api/dns.html#implementation-considerations)
|
||||||
|
* before using `dns.lookup()`.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import dns from 'node:dns';
|
||||||
|
* const options = {
|
||||||
|
* family: 6,
|
||||||
|
* hints: dns.ADDRCONFIG | dns.V4MAPPED,
|
||||||
|
* };
|
||||||
|
* dns.lookup('example.com', options, (err, address, family) =>
|
||||||
|
* console.log('address: %j family: IPv%s', address, family));
|
||||||
|
* // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
|
||||||
|
*
|
||||||
|
* // When options.all is true, the result will be an Array.
|
||||||
|
* options.all = true;
|
||||||
|
* dns.lookup('example.com', options, (err, addresses) =>
|
||||||
|
* console.log('addresses: %j', addresses));
|
||||||
|
* // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v25.x/api/util.html#utilpromisifyoriginal) ed
|
||||||
|
* version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties.
|
||||||
|
* @since v0.1.90
|
||||||
|
*/
|
||||||
|
function lookup(
|
||||||
|
hostname: string,
|
||||||
|
family: number,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
||||||
|
): void;
|
||||||
|
function lookup(
|
||||||
|
hostname: string,
|
||||||
|
options: LookupOneOptions,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
||||||
|
): void;
|
||||||
|
function lookup(
|
||||||
|
hostname: string,
|
||||||
|
options: LookupAllOptions,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void,
|
||||||
|
): void;
|
||||||
|
function lookup(
|
||||||
|
hostname: string,
|
||||||
|
options: LookupOptions,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void,
|
||||||
|
): void;
|
||||||
|
function lookup(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
||||||
|
): void;
|
||||||
|
namespace lookup {
|
||||||
|
function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
|
||||||
|
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
|
||||||
|
function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Resolves the given `address` and `port` into a host name and service using
|
||||||
|
* the operating system's underlying `getnameinfo` implementation.
|
||||||
|
*
|
||||||
|
* If `address` is not a valid IP address, a `TypeError` will be thrown.
|
||||||
|
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown.
|
||||||
|
*
|
||||||
|
* On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-error) object,
|
||||||
|
* where `err.code` is the error code.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import dns from 'node:dns';
|
||||||
|
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
|
||||||
|
* console.log(hostname, service);
|
||||||
|
* // Prints: localhost ssh
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v25.x/api/util.html#utilpromisifyoriginal) ed
|
||||||
|
* version, it returns a `Promise` for an `Object` with `hostname` and `service` properties.
|
||||||
|
* @since v0.11.14
|
||||||
|
*/
|
||||||
|
function lookupService(
|
||||||
|
address: string,
|
||||||
|
port: number,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void,
|
||||||
|
): void;
|
||||||
|
namespace lookupService {
|
||||||
|
function __promisify__(
|
||||||
|
address: string,
|
||||||
|
port: number,
|
||||||
|
): Promise<{
|
||||||
|
hostname: string;
|
||||||
|
service: string;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
interface ResolveOptions {
|
||||||
|
ttl: boolean;
|
||||||
|
}
|
||||||
|
interface ResolveWithTtlOptions extends ResolveOptions {
|
||||||
|
ttl: true;
|
||||||
|
}
|
||||||
|
interface RecordWithTtl {
|
||||||
|
address: string;
|
||||||
|
ttl: number;
|
||||||
|
}
|
||||||
|
interface AnyARecord extends RecordWithTtl {
|
||||||
|
type: "A";
|
||||||
|
}
|
||||||
|
interface AnyAaaaRecord extends RecordWithTtl {
|
||||||
|
type: "AAAA";
|
||||||
|
}
|
||||||
|
interface CaaRecord {
|
||||||
|
critical: number;
|
||||||
|
issue?: string | undefined;
|
||||||
|
issuewild?: string | undefined;
|
||||||
|
iodef?: string | undefined;
|
||||||
|
contactemail?: string | undefined;
|
||||||
|
contactphone?: string | undefined;
|
||||||
|
}
|
||||||
|
interface AnyCaaRecord extends CaaRecord {
|
||||||
|
type: "CAA";
|
||||||
|
}
|
||||||
|
interface MxRecord {
|
||||||
|
priority: number;
|
||||||
|
exchange: string;
|
||||||
|
}
|
||||||
|
interface AnyMxRecord extends MxRecord {
|
||||||
|
type: "MX";
|
||||||
|
}
|
||||||
|
interface NaptrRecord {
|
||||||
|
flags: string;
|
||||||
|
service: string;
|
||||||
|
regexp: string;
|
||||||
|
replacement: string;
|
||||||
|
order: number;
|
||||||
|
preference: number;
|
||||||
|
}
|
||||||
|
interface AnyNaptrRecord extends NaptrRecord {
|
||||||
|
type: "NAPTR";
|
||||||
|
}
|
||||||
|
interface SoaRecord {
|
||||||
|
nsname: string;
|
||||||
|
hostmaster: string;
|
||||||
|
serial: number;
|
||||||
|
refresh: number;
|
||||||
|
retry: number;
|
||||||
|
expire: number;
|
||||||
|
minttl: number;
|
||||||
|
}
|
||||||
|
interface AnySoaRecord extends SoaRecord {
|
||||||
|
type: "SOA";
|
||||||
|
}
|
||||||
|
interface SrvRecord {
|
||||||
|
priority: number;
|
||||||
|
weight: number;
|
||||||
|
port: number;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
interface AnySrvRecord extends SrvRecord {
|
||||||
|
type: "SRV";
|
||||||
|
}
|
||||||
|
interface TlsaRecord {
|
||||||
|
certUsage: number;
|
||||||
|
selector: number;
|
||||||
|
match: number;
|
||||||
|
data: ArrayBuffer;
|
||||||
|
}
|
||||||
|
interface AnyTlsaRecord extends TlsaRecord {
|
||||||
|
type: "TLSA";
|
||||||
|
}
|
||||||
|
interface AnyTxtRecord {
|
||||||
|
type: "TXT";
|
||||||
|
entries: string[];
|
||||||
|
}
|
||||||
|
interface AnyNsRecord {
|
||||||
|
type: "NS";
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
interface AnyPtrRecord {
|
||||||
|
type: "PTR";
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
interface AnyCnameRecord {
|
||||||
|
type: "CNAME";
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
type AnyRecord =
|
||||||
|
| AnyARecord
|
||||||
|
| AnyAaaaRecord
|
||||||
|
| AnyCaaRecord
|
||||||
|
| AnyCnameRecord
|
||||||
|
| AnyMxRecord
|
||||||
|
| AnyNaptrRecord
|
||||||
|
| AnyNsRecord
|
||||||
|
| AnyPtrRecord
|
||||||
|
| AnySoaRecord
|
||||||
|
| AnySrvRecord
|
||||||
|
| AnyTlsaRecord
|
||||||
|
| 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
|
||||||
|
* records. The type and structure of individual results varies based on `rrtype`:
|
||||||
|
*
|
||||||
|
* <omitted>
|
||||||
|
*
|
||||||
|
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-error) object,
|
||||||
|
* where `err.code` is one of the `DNS error codes`.
|
||||||
|
* @since v0.1.27
|
||||||
|
* @param hostname Host name to resolve.
|
||||||
|
* @param [rrtype='A'] Resource record type.
|
||||||
|
*/
|
||||||
|
function resolve(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
||||||
|
): void;
|
||||||
|
function resolve(
|
||||||
|
hostname: string,
|
||||||
|
rrtype: "A" | "AAAA" | "CNAME" | "NS" | "PTR",
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
||||||
|
): void;
|
||||||
|
function resolve(
|
||||||
|
hostname: string,
|
||||||
|
rrtype: "ANY",
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
|
||||||
|
): void;
|
||||||
|
function resolve(
|
||||||
|
hostname: string,
|
||||||
|
rrtype: "CAA",
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, address: CaaRecord[]) => void,
|
||||||
|
): void;
|
||||||
|
function resolve(
|
||||||
|
hostname: string,
|
||||||
|
rrtype: "MX",
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
|
||||||
|
): void;
|
||||||
|
function resolve(
|
||||||
|
hostname: string,
|
||||||
|
rrtype: "NAPTR",
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
|
||||||
|
): void;
|
||||||
|
function resolve(
|
||||||
|
hostname: string,
|
||||||
|
rrtype: "SOA",
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void,
|
||||||
|
): void;
|
||||||
|
function resolve(
|
||||||
|
hostname: string,
|
||||||
|
rrtype: "SRV",
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
|
||||||
|
): void;
|
||||||
|
function resolve(
|
||||||
|
hostname: string,
|
||||||
|
rrtype: "TLSA",
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: TlsaRecord[]) => void,
|
||||||
|
): void;
|
||||||
|
function resolve(
|
||||||
|
hostname: string,
|
||||||
|
rrtype: "TXT",
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
|
||||||
|
): void;
|
||||||
|
function resolve(
|
||||||
|
hostname: string,
|
||||||
|
rrtype: string,
|
||||||
|
callback: (
|
||||||
|
err: NodeJS.ErrnoException | null,
|
||||||
|
addresses:
|
||||||
|
| string[]
|
||||||
|
| CaaRecord[]
|
||||||
|
| MxRecord[]
|
||||||
|
| NaptrRecord[]
|
||||||
|
| SoaRecord
|
||||||
|
| SrvRecord[]
|
||||||
|
| TlsaRecord[]
|
||||||
|
| string[][]
|
||||||
|
| AnyRecord[],
|
||||||
|
) => void,
|
||||||
|
): void;
|
||||||
|
namespace resolve {
|
||||||
|
function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
|
||||||
|
function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
|
||||||
|
function __promisify__(hostname: string, rrtype: "CAA"): Promise<CaaRecord[]>;
|
||||||
|
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: "TLSA"): Promise<TlsaRecord[]>;
|
||||||
|
function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
|
||||||
|
function __promisify__(
|
||||||
|
hostname: string,
|
||||||
|
rrtype: string,
|
||||||
|
): Promise<
|
||||||
|
| string[]
|
||||||
|
| CaaRecord[]
|
||||||
|
| MxRecord[]
|
||||||
|
| NaptrRecord[]
|
||||||
|
| SoaRecord
|
||||||
|
| SrvRecord[]
|
||||||
|
| TlsaRecord[]
|
||||||
|
| string[][]
|
||||||
|
| AnyRecord[]
|
||||||
|
>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the `hostname`. The `addresses` argument passed to the `callback` function
|
||||||
|
* will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
|
||||||
|
* @since v0.1.16
|
||||||
|
* @param hostname Host name to resolve.
|
||||||
|
*/
|
||||||
|
function resolve4(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
||||||
|
): void;
|
||||||
|
function resolve4(
|
||||||
|
hostname: string,
|
||||||
|
options: ResolveWithTtlOptions,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
|
||||||
|
): void;
|
||||||
|
function resolve4(
|
||||||
|
hostname: string,
|
||||||
|
options: ResolveOptions,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
|
||||||
|
): void;
|
||||||
|
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
|
||||||
|
* will contain an array of IPv6 addresses.
|
||||||
|
* @since v0.1.16
|
||||||
|
* @param hostname Host name to resolve.
|
||||||
|
*/
|
||||||
|
function resolve6(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
||||||
|
): void;
|
||||||
|
function resolve6(
|
||||||
|
hostname: string,
|
||||||
|
options: ResolveWithTtlOptions,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
|
||||||
|
): void;
|
||||||
|
function resolve6(
|
||||||
|
hostname: string,
|
||||||
|
options: ResolveOptions,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
|
||||||
|
): void;
|
||||||
|
namespace resolve6 {
|
||||||
|
function __promisify__(hostname: string): Promise<string[]>;
|
||||||
|
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
||||||
|
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The `addresses` argument passed to the `callback` function
|
||||||
|
* will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`).
|
||||||
|
* @since v0.3.2
|
||||||
|
*/
|
||||||
|
function resolveCname(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
||||||
|
): void;
|
||||||
|
namespace resolveCname {
|
||||||
|
function __promisify__(hostname: string): Promise<string[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
function resolveCaa(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void,
|
||||||
|
): void;
|
||||||
|
namespace resolveCaa {
|
||||||
|
function __promisify__(hostname: string): Promise<CaaRecord[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
|
||||||
|
* contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
|
||||||
|
* @since v0.1.27
|
||||||
|
*/
|
||||||
|
function resolveMx(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
|
||||||
|
): void;
|
||||||
|
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
|
||||||
|
* objects with the following properties:
|
||||||
|
*
|
||||||
|
* * `flags`
|
||||||
|
* * `service`
|
||||||
|
* * `regexp`
|
||||||
|
* * `replacement`
|
||||||
|
* * `order`
|
||||||
|
* * `preference`
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* flags: 's',
|
||||||
|
* service: 'SIP+D2U',
|
||||||
|
* regexp: '',
|
||||||
|
* replacement: '_sip._udp.example.com',
|
||||||
|
* order: 30,
|
||||||
|
* preference: 100
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.9.12
|
||||||
|
*/
|
||||||
|
function resolveNaptr(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
|
||||||
|
): void;
|
||||||
|
namespace resolveNaptr {
|
||||||
|
function __promisify__(hostname: string): Promise<NaptrRecord[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
|
||||||
|
* contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`).
|
||||||
|
* @since v0.1.90
|
||||||
|
*/
|
||||||
|
function resolveNs(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
||||||
|
): void;
|
||||||
|
namespace resolveNs {
|
||||||
|
function __promisify__(hostname: string): Promise<string[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
|
||||||
|
* be an array of strings containing the reply records.
|
||||||
|
* @since v6.0.0
|
||||||
|
*/
|
||||||
|
function resolvePtr(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
||||||
|
): void;
|
||||||
|
namespace resolvePtr {
|
||||||
|
function __promisify__(hostname: string): Promise<string[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
|
||||||
|
* the `hostname`. The `address` argument passed to the `callback` function will
|
||||||
|
* be an object with the following properties:
|
||||||
|
*
|
||||||
|
* * `nsname`
|
||||||
|
* * `hostmaster`
|
||||||
|
* * `serial`
|
||||||
|
* * `refresh`
|
||||||
|
* * `retry`
|
||||||
|
* * `expire`
|
||||||
|
* * `minttl`
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* nsname: 'ns.example.com',
|
||||||
|
* hostmaster: 'root.example.com',
|
||||||
|
* serial: 2013101809,
|
||||||
|
* refresh: 10000,
|
||||||
|
* retry: 2400,
|
||||||
|
* expire: 604800,
|
||||||
|
* minttl: 3600
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.11.10
|
||||||
|
*/
|
||||||
|
function resolveSoa(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void,
|
||||||
|
): void;
|
||||||
|
namespace resolveSoa {
|
||||||
|
function __promisify__(hostname: string): Promise<SoaRecord>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
|
||||||
|
* be an array of objects with the following properties:
|
||||||
|
*
|
||||||
|
* * `priority`
|
||||||
|
* * `weight`
|
||||||
|
* * `port`
|
||||||
|
* * `name`
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* priority: 10,
|
||||||
|
* weight: 5,
|
||||||
|
* port: 21223,
|
||||||
|
* name: 'service.example.com'
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.1.27
|
||||||
|
*/
|
||||||
|
function resolveSrv(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
|
||||||
|
): void;
|
||||||
|
namespace resolveSrv {
|
||||||
|
function __promisify__(hostname: string): Promise<SrvRecord[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve certificate associations (`TLSA` records) for
|
||||||
|
* the `hostname`. The `records` argument passed to the `callback` function is an
|
||||||
|
* array of objects with these properties:
|
||||||
|
*
|
||||||
|
* * `certUsage`
|
||||||
|
* * `selector`
|
||||||
|
* * `match`
|
||||||
|
* * `data`
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* certUsage: 3,
|
||||||
|
* selector: 1,
|
||||||
|
* match: 1,
|
||||||
|
* data: [ArrayBuffer]
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v23.9.0, v22.15.0
|
||||||
|
*/
|
||||||
|
function resolveTlsa(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: TlsaRecord[]) => void,
|
||||||
|
): void;
|
||||||
|
namespace resolveTlsa {
|
||||||
|
function __promisify__(hostname: string): Promise<TlsaRecord[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a
|
||||||
|
* two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
|
||||||
|
* one record. Depending on the use case, these could be either joined together or
|
||||||
|
* treated separately.
|
||||||
|
* @since v0.1.27
|
||||||
|
*/
|
||||||
|
function resolveTxt(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
|
||||||
|
): void;
|
||||||
|
namespace resolveTxt {
|
||||||
|
function __promisify__(hostname: string): Promise<string[][]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
|
||||||
|
* The `ret` argument passed to the `callback` function will be an array containing
|
||||||
|
* various types of records. Each object has a property `type` that indicates the
|
||||||
|
* type of the current record. And depending on the `type`, additional properties
|
||||||
|
* will be present on the object:
|
||||||
|
*
|
||||||
|
* <omitted>
|
||||||
|
*
|
||||||
|
* Here is an example of the `ret` object passed to the callback:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* [ { type: 'A', address: '127.0.0.1', ttl: 299 },
|
||||||
|
* { type: 'CNAME', value: 'example.com' },
|
||||||
|
* { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
|
||||||
|
* { type: 'NS', value: 'ns1.example.com' },
|
||||||
|
* { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
|
||||||
|
* { type: 'SOA',
|
||||||
|
* nsname: 'ns1.example.com',
|
||||||
|
* hostmaster: 'admin.example.com',
|
||||||
|
* serial: 156696742,
|
||||||
|
* refresh: 900,
|
||||||
|
* retry: 900,
|
||||||
|
* expire: 1800,
|
||||||
|
* minttl: 60 } ]
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* DNS server operators may choose not to respond to `ANY` queries. It may be better to call individual methods like {@link resolve4}, {@link resolveMx}, and so on. For more details, see
|
||||||
|
* [RFC 8482](https://tools.ietf.org/html/rfc8482).
|
||||||
|
*/
|
||||||
|
function resolveAny(
|
||||||
|
hostname: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
|
||||||
|
): void;
|
||||||
|
namespace resolveAny {
|
||||||
|
function __promisify__(hostname: string): Promise<AnyRecord[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
|
||||||
|
* array of host names.
|
||||||
|
*
|
||||||
|
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-error) object, where `err.code` is
|
||||||
|
* one of the [DNS error codes](https://nodejs.org/docs/latest-v25.x/api/dns.html#error-codes).
|
||||||
|
* @since v0.1.16
|
||||||
|
*/
|
||||||
|
function reverse(
|
||||||
|
ip: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void,
|
||||||
|
): void;
|
||||||
|
/**
|
||||||
|
* Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v25.x/api/dns.html#dnspromiseslookuphostname-options).
|
||||||
|
* The value could be:
|
||||||
|
*
|
||||||
|
* * `ipv4first`: for `order` defaulting to `ipv4first`.
|
||||||
|
* * `ipv6first`: for `order` defaulting to `ipv6first`.
|
||||||
|
* * `verbatim`: for `order` defaulting to `verbatim`.
|
||||||
|
* @since v18.17.0
|
||||||
|
*/
|
||||||
|
function getDefaultResultOrder(): "ipv4first" | "ipv6first" | "verbatim";
|
||||||
|
/**
|
||||||
|
* Sets the IP address and port of servers to be used when performing DNS
|
||||||
|
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
|
||||||
|
* addresses. If the port is the IANA default DNS port (53) it can be omitted.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* dns.setServers([
|
||||||
|
* '4.4.4.4',
|
||||||
|
* '[2001:4860:4860::8888]',
|
||||||
|
* '4.4.4.4:1053',
|
||||||
|
* '[2001:4860:4860::8888]:1053',
|
||||||
|
* ]);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* An error will be thrown if an invalid address is provided.
|
||||||
|
*
|
||||||
|
* The `dns.setServers()` method must not be called while a DNS query is in
|
||||||
|
* progress.
|
||||||
|
*
|
||||||
|
* The {@link setServers} method affects only {@link resolve}, `dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}).
|
||||||
|
*
|
||||||
|
* This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
|
||||||
|
* That is, if attempting to resolve with the first server provided results in a `NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
|
||||||
|
* subsequent servers provided. Fallback DNS servers will only be used if the
|
||||||
|
* earlier ones time out or result in some other error.
|
||||||
|
* @since v0.11.3
|
||||||
|
* @param servers array of [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952#section-6) formatted addresses
|
||||||
|
*/
|
||||||
|
function setServers(servers: readonly string[]): void;
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* section if a custom port is used.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* [
|
||||||
|
* '4.4.4.4',
|
||||||
|
* '2001:4860:4860::8888',
|
||||||
|
* '4.4.4.4:1053',
|
||||||
|
* '[2001:4860:4860::8888]:1053',
|
||||||
|
* ]
|
||||||
|
* ```
|
||||||
|
* @since v0.11.3
|
||||||
|
*/
|
||||||
|
function getServers(): string[];
|
||||||
|
/**
|
||||||
|
* Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v25.x/api/dns.html#dnspromiseslookuphostname-options).
|
||||||
|
* The value could be:
|
||||||
|
*
|
||||||
|
* * `ipv4first`: sets default `order` to `ipv4first`.
|
||||||
|
* * `ipv6first`: sets default `order` to `ipv6first`.
|
||||||
|
* * `verbatim`: sets default `order` to `verbatim`.
|
||||||
|
*
|
||||||
|
* The default is `verbatim` and {@link setDefaultResultOrder} have higher
|
||||||
|
* priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--dns-result-orderorder). When using
|
||||||
|
* [worker threads](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main
|
||||||
|
* thread won't affect the default dns orders in workers.
|
||||||
|
* @since v16.4.0, v14.18.0
|
||||||
|
* @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.
|
||||||
|
*/
|
||||||
|
function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
|
||||||
|
// Error codes
|
||||||
|
const NODATA: "ENODATA";
|
||||||
|
const FORMERR: "EFORMERR";
|
||||||
|
const SERVFAIL: "ESERVFAIL";
|
||||||
|
const NOTFOUND: "ENOTFOUND";
|
||||||
|
const NOTIMP: "ENOTIMP";
|
||||||
|
const REFUSED: "EREFUSED";
|
||||||
|
const BADQUERY: "EBADQUERY";
|
||||||
|
const BADNAME: "EBADNAME";
|
||||||
|
const BADFAMILY: "EBADFAMILY";
|
||||||
|
const BADRESP: "EBADRESP";
|
||||||
|
const CONNREFUSED: "ECONNREFUSED";
|
||||||
|
const TIMEOUT: "ETIMEOUT";
|
||||||
|
const EOF: "EOF";
|
||||||
|
const FILE: "EFILE";
|
||||||
|
const NOMEM: "ENOMEM";
|
||||||
|
const DESTRUCTION: "EDESTRUCTION";
|
||||||
|
const BADSTR: "EBADSTR";
|
||||||
|
const BADFLAGS: "EBADFLAGS";
|
||||||
|
const NONAME: "ENONAME";
|
||||||
|
const BADHINTS: "EBADHINTS";
|
||||||
|
const NOTINITIALIZED: "ENOTINITIALIZED";
|
||||||
|
const LOADIPHLPAPI: "ELOADIPHLPAPI";
|
||||||
|
const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS";
|
||||||
|
const CANCELLED: "ECANCELLED";
|
||||||
|
interface ResolverOptions {
|
||||||
|
/**
|
||||||
|
* Query timeout in milliseconds, or `-1` to use the default timeout.
|
||||||
|
*/
|
||||||
|
timeout?: number | undefined;
|
||||||
|
/**
|
||||||
|
* The number of tries the resolver will try contacting each name server before giving up.
|
||||||
|
* @default 4
|
||||||
|
*/
|
||||||
|
tries?: number | undefined;
|
||||||
|
/**
|
||||||
|
* The max retry timeout, in milliseconds.
|
||||||
|
* @default 0
|
||||||
|
*/
|
||||||
|
maxTimeout?: number | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* An independent resolver for DNS requests.
|
||||||
|
*
|
||||||
|
* Creating a new resolver uses the default server settings. Setting
|
||||||
|
* the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v25.x/api/dns.html#dnssetserversservers) does not affect
|
||||||
|
* other resolvers:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Resolver } from 'node:dns';
|
||||||
|
* 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', (err, addresses) => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The following methods from the `node:dns` module 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 v8.3.0
|
||||||
|
*/
|
||||||
|
class Resolver {
|
||||||
|
constructor(options?: ResolverOptions);
|
||||||
|
/**
|
||||||
|
* Cancel all outstanding DNS queries made by this resolver. The corresponding
|
||||||
|
* callbacks will be called with an error with code `ECANCELLED`.
|
||||||
|
* @since v8.3.0
|
||||||
|
*/
|
||||||
|
cancel(): void;
|
||||||
|
getServers: typeof getServers;
|
||||||
|
resolve: typeof resolve;
|
||||||
|
resolve4: typeof resolve4;
|
||||||
|
resolve6: typeof resolve6;
|
||||||
|
resolveAny: typeof resolveAny;
|
||||||
|
resolveCaa: typeof resolveCaa;
|
||||||
|
resolveCname: typeof resolveCname;
|
||||||
|
resolveMx: typeof resolveMx;
|
||||||
|
resolveNaptr: typeof resolveNaptr;
|
||||||
|
resolveNs: typeof resolveNs;
|
||||||
|
resolvePtr: typeof resolvePtr;
|
||||||
|
resolveSoa: typeof resolveSoa;
|
||||||
|
resolveSrv: typeof resolveSrv;
|
||||||
|
resolveTlsa: typeof resolveTlsa;
|
||||||
|
resolveTxt: typeof resolveTxt;
|
||||||
|
reverse: typeof reverse;
|
||||||
|
/**
|
||||||
|
* The resolver instance will send its requests from the specified IP address.
|
||||||
|
* 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
|
||||||
|
* 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
|
||||||
|
* @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
|
||||||
|
* @param [ipv6='::0'] A string representation of an IPv6 address.
|
||||||
|
*/
|
||||||
|
setLocalAddress(ipv4?: string, ipv6?: string): void;
|
||||||
|
setServers: typeof setServers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module "node:dns" {
|
||||||
|
export * as promises from "node:dns/promises";
|
||||||
|
}
|
||||||
|
declare module "dns" {
|
||||||
|
export * from "node:dns";
|
||||||
|
}
|
||||||
503
node_modules/@types/node/dns/promises.d.ts
generated
vendored
Normal file
503
node_modules/@types/node/dns/promises.d.ts
generated
vendored
Normal file
@ -0,0 +1,503 @@
|
|||||||
|
/**
|
||||||
|
* 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 `import { promises as dnsPromises } from 'node:dns'` or `import dnsPromises from 'node:dns/promises'`.
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
declare module "node:dns/promises" {
|
||||||
|
import {
|
||||||
|
AnyRecord,
|
||||||
|
CaaRecord,
|
||||||
|
LookupAddress,
|
||||||
|
LookupAllOptions,
|
||||||
|
LookupOneOptions,
|
||||||
|
LookupOptions,
|
||||||
|
MxRecord,
|
||||||
|
NaptrRecord,
|
||||||
|
RecordWithTtl,
|
||||||
|
ResolveOptions,
|
||||||
|
ResolverOptions,
|
||||||
|
ResolveWithTtlOptions,
|
||||||
|
SoaRecord,
|
||||||
|
SrvRecord,
|
||||||
|
TlsaRecord,
|
||||||
|
} 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
|
||||||
|
* section if a custom port is used.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* [
|
||||||
|
* '4.4.4.4',
|
||||||
|
* '2001:4860:4860::8888',
|
||||||
|
* '4.4.4.4:1053',
|
||||||
|
* '[2001:4860:4860::8888]:1053',
|
||||||
|
* ]
|
||||||
|
* ```
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function getServers(): string[];
|
||||||
|
/**
|
||||||
|
* 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 not provided, then IPv4
|
||||||
|
* and IPv6 addresses are both returned if found.
|
||||||
|
*
|
||||||
|
* With the `all` option set to `true`, the `Promise` is resolved with `addresses` being an array of objects with the properties `address` and `family`.
|
||||||
|
*
|
||||||
|
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is the error code.
|
||||||
|
* Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
|
||||||
|
* the host name does not exist but also when the lookup fails in other ways
|
||||||
|
* such as no available file descriptors.
|
||||||
|
*
|
||||||
|
* [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options) 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 important consequences on the behavior of any Node.js program. Please
|
||||||
|
* take some time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations) before
|
||||||
|
* using `dnsPromises.lookup()`.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import dns from 'node:dns';
|
||||||
|
* const dnsPromises = dns.promises;
|
||||||
|
* const options = {
|
||||||
|
* family: 6,
|
||||||
|
* hints: dns.ADDRCONFIG | dns.V4MAPPED,
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* dnsPromises.lookup('example.com', options).then((result) => {
|
||||||
|
* console.log('address: %j family: IPv%s', result.address, result.family);
|
||||||
|
* // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // When options.all is true, the result will be an Array.
|
||||||
|
* options.all = true;
|
||||||
|
* dnsPromises.lookup('example.com', options).then((result) => {
|
||||||
|
* console.log('addresses: %j', result);
|
||||||
|
* // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function lookup(hostname: string, family: number): Promise<LookupAddress>;
|
||||||
|
function lookup(hostname: string, options: LookupOneOptions): Promise<LookupAddress>;
|
||||||
|
function lookup(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
|
||||||
|
function lookup(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
|
||||||
|
function lookup(hostname: string): Promise<LookupAddress>;
|
||||||
|
/**
|
||||||
|
* Resolves the given `address` and `port` into a host name and service using
|
||||||
|
* the operating system's underlying `getnameinfo` implementation.
|
||||||
|
*
|
||||||
|
* If `address` is not a valid IP address, a `TypeError` will be thrown.
|
||||||
|
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown.
|
||||||
|
*
|
||||||
|
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is the error code.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import dnsPromises from 'node:dns';
|
||||||
|
* dnsPromises.lookupService('127.0.0.1', 22).then((result) => {
|
||||||
|
* console.log(result.hostname, result.service);
|
||||||
|
* // Prints: localhost ssh
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function lookupService(
|
||||||
|
address: string,
|
||||||
|
port: number,
|
||||||
|
): Promise<{
|
||||||
|
hostname: string;
|
||||||
|
service: string;
|
||||||
|
}>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
|
||||||
|
* of the resource records. When successful, the `Promise` is resolved with an
|
||||||
|
* array of resource records. The type and structure of individual results vary
|
||||||
|
* based on `rrtype`:
|
||||||
|
*
|
||||||
|
* <omitted>
|
||||||
|
*
|
||||||
|
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code`
|
||||||
|
* is one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes).
|
||||||
|
* @since v10.6.0
|
||||||
|
* @param hostname Host name to resolve.
|
||||||
|
* @param [rrtype='A'] Resource record type.
|
||||||
|
*/
|
||||||
|
function resolve(hostname: string): Promise<string[]>;
|
||||||
|
function resolve(hostname: string, rrtype: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
|
||||||
|
function resolve(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
|
||||||
|
function resolve(hostname: string, rrtype: "CAA"): Promise<CaaRecord[]>;
|
||||||
|
function resolve(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
|
||||||
|
function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
|
||||||
|
function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
|
||||||
|
function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
|
||||||
|
function resolve(hostname: string, rrtype: "TLSA"): Promise<TlsaRecord[]>;
|
||||||
|
function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>;
|
||||||
|
function resolve(hostname: string, rrtype: string): Promise<
|
||||||
|
| string[]
|
||||||
|
| CaaRecord[]
|
||||||
|
| MxRecord[]
|
||||||
|
| NaptrRecord[]
|
||||||
|
| SoaRecord
|
||||||
|
| SrvRecord[]
|
||||||
|
| TlsaRecord[]
|
||||||
|
| 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']`).
|
||||||
|
* @since v10.6.0
|
||||||
|
* @param hostname Host name to resolve.
|
||||||
|
*/
|
||||||
|
function resolve4(hostname: string): Promise<string[]>;
|
||||||
|
function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
||||||
|
function resolve4(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv6
|
||||||
|
* addresses.
|
||||||
|
* @since v10.6.0
|
||||||
|
* @param hostname Host name to resolve.
|
||||||
|
*/
|
||||||
|
function resolve6(hostname: string): Promise<string[]>;
|
||||||
|
function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
||||||
|
function resolve6(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
|
||||||
|
* On success, the `Promise` is resolved with an array containing various types of
|
||||||
|
* records. Each object has a property `type` that indicates the type of the
|
||||||
|
* current record. And depending on the `type`, additional properties will be
|
||||||
|
* present on the object:
|
||||||
|
*
|
||||||
|
* <omitted>
|
||||||
|
*
|
||||||
|
* Here is an example of the result object:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* [ { type: 'A', address: '127.0.0.1', ttl: 299 },
|
||||||
|
* { type: 'CNAME', value: 'example.com' },
|
||||||
|
* { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
|
||||||
|
* { type: 'NS', value: 'ns1.example.com' },
|
||||||
|
* { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
|
||||||
|
* { type: 'SOA',
|
||||||
|
* nsname: 'ns1.example.com',
|
||||||
|
* hostmaster: 'admin.example.com',
|
||||||
|
* serial: 156696742,
|
||||||
|
* refresh: 900,
|
||||||
|
* retry: 900,
|
||||||
|
* expire: 1800,
|
||||||
|
* minttl: 60 } ]
|
||||||
|
* ```
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveAny(hostname: string): Promise<AnyRecord[]>;
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
function resolveCaa(hostname: string): Promise<CaaRecord[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve `CNAME` records for the `hostname`. On success,
|
||||||
|
* the `Promise` is resolved with an array of canonical name records available for
|
||||||
|
* the `hostname` (e.g. `['bar.example.com']`).
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveCname(hostname: string): Promise<string[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects
|
||||||
|
* containing both a `priority` and `exchange` property (e.g.`[{priority: 10, exchange: 'mx.example.com'}, ...]`).
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
* of objects with the following properties:
|
||||||
|
*
|
||||||
|
* * `flags`
|
||||||
|
* * `service`
|
||||||
|
* * `regexp`
|
||||||
|
* * `replacement`
|
||||||
|
* * `order`
|
||||||
|
* * `preference`
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* flags: 's',
|
||||||
|
* service: 'SIP+D2U',
|
||||||
|
* regexp: '',
|
||||||
|
* replacement: '_sip._udp.example.com',
|
||||||
|
* order: 30,
|
||||||
|
* preference: 100
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveNaptr(hostname: string): Promise<NaptrRecord[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. On success, the `Promise` is resolved with an array of name server
|
||||||
|
* records available for `hostname` (e.g.`['ns1.example.com', 'ns2.example.com']`).
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveNs(hostname: string): Promise<string[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. On success, the `Promise` is resolved with an array of strings
|
||||||
|
* containing the reply records.
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolvePtr(hostname: string): Promise<string[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
|
||||||
|
* the `hostname`. On success, the `Promise` is resolved with an object with the
|
||||||
|
* following properties:
|
||||||
|
*
|
||||||
|
* * `nsname`
|
||||||
|
* * `hostmaster`
|
||||||
|
* * `serial`
|
||||||
|
* * `refresh`
|
||||||
|
* * `retry`
|
||||||
|
* * `expire`
|
||||||
|
* * `minttl`
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* nsname: 'ns.example.com',
|
||||||
|
* hostmaster: 'root.example.com',
|
||||||
|
* serial: 2013101809,
|
||||||
|
* refresh: 10000,
|
||||||
|
* retry: 2400,
|
||||||
|
* expire: 604800,
|
||||||
|
* minttl: 3600
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveSoa(hostname: string): Promise<SoaRecord>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects with
|
||||||
|
* the following properties:
|
||||||
|
*
|
||||||
|
* * `priority`
|
||||||
|
* * `weight`
|
||||||
|
* * `port`
|
||||||
|
* * `name`
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* priority: 10,
|
||||||
|
* weight: 5,
|
||||||
|
* port: 21223,
|
||||||
|
* name: 'service.example.com'
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveSrv(hostname: string): Promise<SrvRecord[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve certificate associations (`TLSA` records) for
|
||||||
|
* the `hostname`. On success, the `Promise` is resolved with an array of objectsAdd commentMore actions
|
||||||
|
* with these properties:
|
||||||
|
*
|
||||||
|
* * `certUsage`
|
||||||
|
* * `selector`
|
||||||
|
* * `match`
|
||||||
|
* * `data`
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* certUsage: 3,
|
||||||
|
* selector: 1,
|
||||||
|
* match: 1,
|
||||||
|
* data: [ArrayBuffer]
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v23.9.0, v22.15.0
|
||||||
|
*/
|
||||||
|
function resolveTlsa(hostname: string): Promise<TlsaRecord[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. On success, the `Promise` is resolved with a two-dimensional array
|
||||||
|
* of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
|
||||||
|
* one record. Depending on the use case, these could be either joined together or
|
||||||
|
* treated separately.
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveTxt(hostname: string): Promise<string[][]>;
|
||||||
|
/**
|
||||||
|
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
|
||||||
|
* array of host names.
|
||||||
|
*
|
||||||
|
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code`
|
||||||
|
* is one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes).
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function reverse(ip: string): Promise<string[]>;
|
||||||
|
/**
|
||||||
|
* Get the default value for `verbatim` in {@link lookup} and [dnsPromises.lookup()](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options).
|
||||||
|
* 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
|
||||||
|
* addresses. If the port is the IANA default DNS port (53) it can be omitted.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* dnsPromises.setServers([
|
||||||
|
* '4.4.4.4',
|
||||||
|
* '[2001:4860:4860::8888]',
|
||||||
|
* '4.4.4.4:1053',
|
||||||
|
* '[2001:4860:4860::8888]:1053',
|
||||||
|
* ]);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* An error will be thrown if an invalid address is provided.
|
||||||
|
*
|
||||||
|
* The `dnsPromises.setServers()` method must not be called while a DNS query is in
|
||||||
|
* progress.
|
||||||
|
*
|
||||||
|
* This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
|
||||||
|
* That is, if attempting to resolve with the first server provided results in a `NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
|
||||||
|
* subsequent servers provided. Fallback DNS servers will only be used if the
|
||||||
|
* earlier ones time out or result in some other error.
|
||||||
|
* @since v10.6.0
|
||||||
|
* @param servers array of `RFC 5952` formatted addresses
|
||||||
|
*/
|
||||||
|
function setServers(servers: readonly string[]): void;
|
||||||
|
/**
|
||||||
|
* Set the default value of `order` in `dns.lookup()` and `{@link lookup}`. The value could be:
|
||||||
|
*
|
||||||
|
* * `ipv4first`: sets default `order` to `ipv4first`.
|
||||||
|
* * `ipv6first`: sets default `order` to `ipv6first`.
|
||||||
|
* * `verbatim`: sets default `order` to `verbatim`.
|
||||||
|
*
|
||||||
|
* The default is `verbatim` and [dnsPromises.setDefaultResultOrder()](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetdefaultresultorderorder)
|
||||||
|
* have higher priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder).
|
||||||
|
* When using [worker threads](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html), [`dnsPromises.setDefaultResultOrder()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetdefaultresultorderorder)
|
||||||
|
* from the main thread won't affect the default dns orders in workers.
|
||||||
|
* @since v16.4.0, v14.18.0
|
||||||
|
* @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.
|
||||||
|
*/
|
||||||
|
function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
|
||||||
|
// Error codes
|
||||||
|
const NODATA: "ENODATA";
|
||||||
|
const FORMERR: "EFORMERR";
|
||||||
|
const SERVFAIL: "ESERVFAIL";
|
||||||
|
const NOTFOUND: "ENOTFOUND";
|
||||||
|
const NOTIMP: "ENOTIMP";
|
||||||
|
const REFUSED: "EREFUSED";
|
||||||
|
const BADQUERY: "EBADQUERY";
|
||||||
|
const BADNAME: "EBADNAME";
|
||||||
|
const BADFAMILY: "EBADFAMILY";
|
||||||
|
const BADRESP: "EBADRESP";
|
||||||
|
const CONNREFUSED: "ECONNREFUSED";
|
||||||
|
const TIMEOUT: "ETIMEOUT";
|
||||||
|
const EOF: "EOF";
|
||||||
|
const FILE: "EFILE";
|
||||||
|
const NOMEM: "ENOMEM";
|
||||||
|
const DESTRUCTION: "EDESTRUCTION";
|
||||||
|
const BADSTR: "EBADSTR";
|
||||||
|
const BADFLAGS: "EBADFLAGS";
|
||||||
|
const NONAME: "ENONAME";
|
||||||
|
const BADHINTS: "EBADHINTS";
|
||||||
|
const NOTINITIALIZED: "ENOTINITIALIZED";
|
||||||
|
const LOADIPHLPAPI: "ELOADIPHLPAPI";
|
||||||
|
const ADDRGETNETWORKPARAMS: "EADDRGETNETWORKPARAMS";
|
||||||
|
const CANCELLED: "ECANCELLED";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An independent resolver for DNS requests.
|
||||||
|
*
|
||||||
|
* Creating a new resolver uses the default server settings. Setting
|
||||||
|
* the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetserversservers) does not affect
|
||||||
|
* other resolvers:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { promises } from 'node:dns';
|
||||||
|
* const resolver = new promises.Resolver();
|
||||||
|
* resolver.setServers(['4.4.4.4']);
|
||||||
|
*
|
||||||
|
* // This request will use the server at 4.4.4.4, independent of global settings.
|
||||||
|
* resolver.resolve4('example.org').then((addresses) => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Alternatively, the same code can be written using async-await style.
|
||||||
|
* (async function() {
|
||||||
|
* const addresses = await resolver.resolve4('example.org');
|
||||||
|
* })();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The following methods from the `dnsPromises` API are available:
|
||||||
|
*
|
||||||
|
* * `resolver.getServers()`
|
||||||
|
* * `resolver.resolve()`
|
||||||
|
* * `resolver.resolve4()`
|
||||||
|
* * `resolver.resolve6()`
|
||||||
|
* * `resolver.resolveAny()`
|
||||||
|
* * `resolver.resolveCaa()`
|
||||||
|
* * `resolver.resolveCname()`
|
||||||
|
* * `resolver.resolveMx()`
|
||||||
|
* * `resolver.resolveNaptr()`
|
||||||
|
* * `resolver.resolveNs()`
|
||||||
|
* * `resolver.resolvePtr()`
|
||||||
|
* * `resolver.resolveSoa()`
|
||||||
|
* * `resolver.resolveSrv()`
|
||||||
|
* * `resolver.resolveTxt()`
|
||||||
|
* * `resolver.reverse()`
|
||||||
|
* * `resolver.setServers()`
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
class Resolver {
|
||||||
|
constructor(options?: ResolverOptions);
|
||||||
|
/**
|
||||||
|
* Cancel all outstanding DNS queries made by this resolver. The corresponding
|
||||||
|
* callbacks will be called with an error with code `ECANCELLED`.
|
||||||
|
* @since v8.3.0
|
||||||
|
*/
|
||||||
|
cancel(): void;
|
||||||
|
getServers: typeof getServers;
|
||||||
|
resolve: typeof resolve;
|
||||||
|
resolve4: typeof resolve4;
|
||||||
|
resolve6: typeof resolve6;
|
||||||
|
resolveAny: typeof resolveAny;
|
||||||
|
resolveCaa: typeof resolveCaa;
|
||||||
|
resolveCname: typeof resolveCname;
|
||||||
|
resolveMx: typeof resolveMx;
|
||||||
|
resolveNaptr: typeof resolveNaptr;
|
||||||
|
resolveNs: typeof resolveNs;
|
||||||
|
resolvePtr: typeof resolvePtr;
|
||||||
|
resolveSoa: typeof resolveSoa;
|
||||||
|
resolveSrv: typeof resolveSrv;
|
||||||
|
resolveTlsa: typeof resolveTlsa;
|
||||||
|
resolveTxt: typeof resolveTxt;
|
||||||
|
reverse: typeof reverse;
|
||||||
|
/**
|
||||||
|
* The resolver instance will send its requests from the specified IP address.
|
||||||
|
* 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
|
||||||
|
* 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
|
||||||
|
* @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
|
||||||
|
* @param [ipv6='::0'] A string representation of an IPv6 address.
|
||||||
|
*/
|
||||||
|
setLocalAddress(ipv4?: string, ipv6?: string): void;
|
||||||
|
setServers: typeof setServers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module "dns/promises" {
|
||||||
|
export * from "node:dns/promises";
|
||||||
|
}
|
||||||
166
node_modules/@types/node/domain.d.ts
generated
vendored
Normal file
166
node_modules/@types/node/domain.d.ts
generated
vendored
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
/**
|
||||||
|
* **This module is pending deprecation.** Once a replacement API has been
|
||||||
|
* finalized, this module will be fully deprecated. Most developers should
|
||||||
|
* **not** have cause to use this module. Users who absolutely must have
|
||||||
|
* the functionality that domains provide may rely on it for the time being
|
||||||
|
* but should expect to have to migrate to a different solution
|
||||||
|
* in the future.
|
||||||
|
*
|
||||||
|
* Domains provide a way to handle multiple different IO operations as a
|
||||||
|
* single group. If any of the event emitters or callbacks registered to a
|
||||||
|
* domain emit an `'error'` event, or throw an error, then the domain object
|
||||||
|
* will be notified, rather than losing the context of the error in the `process.on('uncaughtException')` handler, or causing the program to
|
||||||
|
* exit immediately with an error code.
|
||||||
|
* @deprecated Since v1.4.2 - Deprecated
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/domain.js)
|
||||||
|
*/
|
||||||
|
declare module "node:domain" {
|
||||||
|
import { EventEmitter } from "node:events";
|
||||||
|
/**
|
||||||
|
* The `Domain` class encapsulates the functionality of routing errors and
|
||||||
|
* uncaught exceptions to the active `Domain` object.
|
||||||
|
*
|
||||||
|
* To handle the errors that it catches, listen to its `'error'` event.
|
||||||
|
*/
|
||||||
|
class Domain extends EventEmitter {
|
||||||
|
/**
|
||||||
|
* An array of event emitters that have been explicitly added to the domain.
|
||||||
|
*/
|
||||||
|
members: EventEmitter[];
|
||||||
|
/**
|
||||||
|
* The `enter()` method is plumbing used by the `run()`, `bind()`, and `intercept()` methods to set the active domain. It sets `domain.active` and `process.domain` to the domain, and implicitly
|
||||||
|
* pushes the domain onto the domain
|
||||||
|
* stack managed by the domain module (see {@link exit} for details on the
|
||||||
|
* domain stack). The call to `enter()` delimits the beginning of a chain of
|
||||||
|
* asynchronous calls and I/O operations bound to a domain.
|
||||||
|
*
|
||||||
|
* Calling `enter()` changes only the active domain, and does not alter the domain
|
||||||
|
* itself. `enter()` and `exit()` can be called an arbitrary number of times on a
|
||||||
|
* single domain.
|
||||||
|
*/
|
||||||
|
enter(): void;
|
||||||
|
/**
|
||||||
|
* The `exit()` method exits the current domain, popping it off the domain stack.
|
||||||
|
* Any time execution is going to switch to the context of a different chain of
|
||||||
|
* asynchronous calls, it's important to ensure that the current domain is exited.
|
||||||
|
* The call to `exit()` delimits either the end of or an interruption to the chain
|
||||||
|
* of asynchronous calls and I/O operations bound to a domain.
|
||||||
|
*
|
||||||
|
* If there are multiple, nested domains bound to the current execution context, `exit()` will exit any domains nested within this domain.
|
||||||
|
*
|
||||||
|
* Calling `exit()` changes only the active domain, and does not alter the domain
|
||||||
|
* itself. `enter()` and `exit()` can be called an arbitrary number of times on a
|
||||||
|
* single 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
|
||||||
|
* created in that context. Optionally, arguments can be passed to
|
||||||
|
* the function.
|
||||||
|
*
|
||||||
|
* This is the most basic way to use a domain.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import domain from 'node:domain';
|
||||||
|
* import fs from 'node:fs';
|
||||||
|
* const d = domain.create();
|
||||||
|
* d.on('error', (er) => {
|
||||||
|
* console.error('Caught error!', er);
|
||||||
|
* });
|
||||||
|
* d.run(() => {
|
||||||
|
* process.nextTick(() => {
|
||||||
|
* setTimeout(() => { // Simulating some various async stuff
|
||||||
|
* fs.open('non-existent file', 'r', (er, fd) => {
|
||||||
|
* if (er) throw er;
|
||||||
|
* // proceed...
|
||||||
|
* });
|
||||||
|
* }, 100);
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* In this example, the `d.on('error')` handler will be triggered, rather
|
||||||
|
* than crashing the program.
|
||||||
|
*/
|
||||||
|
run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
|
||||||
|
/**
|
||||||
|
* Explicitly adds an emitter to the domain. If any event handlers called by
|
||||||
|
* the emitter throw an error, or if the emitter emits an `'error'` event, it
|
||||||
|
* will be routed to the domain's `'error'` event, just like with implicit
|
||||||
|
* binding.
|
||||||
|
*
|
||||||
|
* If the `EventEmitter` was already bound to a domain, it is removed from that
|
||||||
|
* one, and bound to this one instead.
|
||||||
|
* @param emitter emitter to be added to the domain
|
||||||
|
*/
|
||||||
|
add(emitter: EventEmitter): void;
|
||||||
|
/**
|
||||||
|
* The opposite of {@link add}. Removes domain handling from the
|
||||||
|
* specified emitter.
|
||||||
|
* @param emitter emitter to be removed from the domain
|
||||||
|
*/
|
||||||
|
remove(emitter: EventEmitter): void;
|
||||||
|
/**
|
||||||
|
* The returned function will be a wrapper around the supplied callback
|
||||||
|
* function. When the returned function is called, any errors that are
|
||||||
|
* thrown will be routed to the domain's `'error'` event.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const d = domain.create();
|
||||||
|
*
|
||||||
|
* function readSomeFile(filename, cb) {
|
||||||
|
* fs.readFile(filename, 'utf8', d.bind((er, data) => {
|
||||||
|
* // If this throws, it will also be passed to the domain.
|
||||||
|
* return cb(er, data ? JSON.parse(data) : null);
|
||||||
|
* }));
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* d.on('error', (er) => {
|
||||||
|
* // An error occurred somewhere. If we throw it now, it will crash the program
|
||||||
|
* // with the normal line number and stack message.
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @param callback The callback function
|
||||||
|
* @return The bound function
|
||||||
|
*/
|
||||||
|
bind<T extends Function>(callback: T): T;
|
||||||
|
/**
|
||||||
|
* This method is almost identical to {@link bind}. However, in
|
||||||
|
* addition to catching thrown errors, it will also intercept `Error` objects sent as the first argument to the function.
|
||||||
|
*
|
||||||
|
* In this way, the common `if (err) return callback(err);` pattern can be replaced
|
||||||
|
* with a single error handler in a single place.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const d = domain.create();
|
||||||
|
*
|
||||||
|
* function readSomeFile(filename, cb) {
|
||||||
|
* fs.readFile(filename, 'utf8', d.intercept((data) => {
|
||||||
|
* // Note, the first argument is never passed to the
|
||||||
|
* // callback since it is assumed to be the 'Error' argument
|
||||||
|
* // and thus intercepted by the domain.
|
||||||
|
*
|
||||||
|
* // If this throws, it will also be passed to the domain
|
||||||
|
* // so the error-handling logic can be moved to the 'error'
|
||||||
|
* // event on the domain instead of being repeated throughout
|
||||||
|
* // the program.
|
||||||
|
* return cb(null, JSON.parse(data));
|
||||||
|
* }));
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* d.on('error', (er) => {
|
||||||
|
* // An error occurred somewhere. If we throw it now, it will crash the program
|
||||||
|
* // with the normal line number and stack message.
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @param callback The callback function
|
||||||
|
* @return The intercepted function
|
||||||
|
*/
|
||||||
|
intercept<T extends Function>(callback: T): T;
|
||||||
|
}
|
||||||
|
function create(): Domain;
|
||||||
|
}
|
||||||
|
declare module "domain" {
|
||||||
|
export * from "node:domain";
|
||||||
|
}
|
||||||
1047
node_modules/@types/node/events.d.ts
generated
vendored
Normal file
1047
node_modules/@types/node/events.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4678
node_modules/@types/node/fs.d.ts
generated
vendored
Normal file
4678
node_modules/@types/node/fs.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1329
node_modules/@types/node/fs/promises.d.ts
generated
vendored
Normal file
1329
node_modules/@types/node/fs/promises.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
150
node_modules/@types/node/globals.d.ts
generated
vendored
Normal file
150
node_modules/@types/node/globals.d.ts
generated
vendored
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
declare var global: typeof globalThis;
|
||||||
|
|
||||||
|
declare var process: NodeJS.Process;
|
||||||
|
|
||||||
|
interface ErrorConstructor {
|
||||||
|
/**
|
||||||
|
* Creates a `.stack` property on `targetObject`, which when accessed returns
|
||||||
|
* a string representing the location in the code at which
|
||||||
|
* `Error.captureStackTrace()` was called.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const myObject = {};
|
||||||
|
* Error.captureStackTrace(myObject);
|
||||||
|
* myObject.stack; // Similar to `new Error().stack`
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The first line of the trace will be prefixed with
|
||||||
|
* `${myObject.name}: ${myObject.message}`.
|
||||||
|
*
|
||||||
|
* The optional `constructorOpt` argument accepts a function. If given, all frames
|
||||||
|
* above `constructorOpt`, including `constructorOpt`, will be omitted from the
|
||||||
|
* generated stack trace.
|
||||||
|
*
|
||||||
|
* The `constructorOpt` argument is useful for hiding implementation
|
||||||
|
* details of error generation from the user. For instance:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* function a() {
|
||||||
|
* b();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* function b() {
|
||||||
|
* c();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* function c() {
|
||||||
|
* // Create an error without stack trace to avoid calculating the stack trace twice.
|
||||||
|
* const { stackTraceLimit } = Error;
|
||||||
|
* Error.stackTraceLimit = 0;
|
||||||
|
* const error = new Error();
|
||||||
|
* Error.stackTraceLimit = stackTraceLimit;
|
||||||
|
*
|
||||||
|
* // Capture the stack trace above function b
|
||||||
|
* Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
|
||||||
|
* throw error;
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* a();
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
||||||
|
/**
|
||||||
|
* @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
||||||
|
*/
|
||||||
|
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
||||||
|
/**
|
||||||
|
* The `Error.stackTraceLimit` property specifies the number of stack frames
|
||||||
|
* collected by a stack trace (whether generated by `new Error().stack` or
|
||||||
|
* `Error.captureStackTrace(obj)`).
|
||||||
|
*
|
||||||
|
* The default value is `10` but may be set to any valid JavaScript number. Changes
|
||||||
|
* will affect any stack trace captured _after_ the value has been changed.
|
||||||
|
*
|
||||||
|
* If set to a non-number value, or set to a negative number, stack traces will
|
||||||
|
* not capture any frames.
|
||||||
|
*/
|
||||||
|
stackTraceLimit: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable this API with the `--expose-gc` CLI flag.
|
||||||
|
*/
|
||||||
|
declare var gc: NodeJS.GCFunction | undefined;
|
||||||
|
|
||||||
|
declare namespace NodeJS {
|
||||||
|
interface CallSite {
|
||||||
|
getColumnNumber(): number | null;
|
||||||
|
getEnclosingColumnNumber(): number | null;
|
||||||
|
getEnclosingLineNumber(): number | null;
|
||||||
|
getEvalOrigin(): string | undefined;
|
||||||
|
getFileName(): string | null;
|
||||||
|
getFunction(): Function | undefined;
|
||||||
|
getFunctionName(): string | null;
|
||||||
|
getLineNumber(): number | null;
|
||||||
|
getMethodName(): string | null;
|
||||||
|
getPosition(): number;
|
||||||
|
getPromiseIndex(): number | null;
|
||||||
|
getScriptHash(): string;
|
||||||
|
getScriptNameOrSourceURL(): string | null;
|
||||||
|
getThis(): unknown;
|
||||||
|
getTypeName(): string | null;
|
||||||
|
isAsync(): boolean;
|
||||||
|
isConstructor(): boolean;
|
||||||
|
isEval(): boolean;
|
||||||
|
isNative(): boolean;
|
||||||
|
isPromiseAll(): boolean;
|
||||||
|
isToplevel(): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ErrnoException extends Error {
|
||||||
|
errno?: number | undefined;
|
||||||
|
code?: string | undefined;
|
||||||
|
path?: string | undefined;
|
||||||
|
syscall?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RefCounted {
|
||||||
|
ref(): this;
|
||||||
|
unref(): this;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Dict<T> {
|
||||||
|
[key: string]: T | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ReadOnlyDict<T> {
|
||||||
|
readonly [key: string]: T | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
type PartialOptions<T> = { [K in keyof T]?: T[K] | undefined };
|
||||||
|
|
||||||
|
interface GCFunction {
|
||||||
|
(minor?: boolean): void;
|
||||||
|
(options: NodeJS.GCOptions & { execution: "async" }): Promise<void>;
|
||||||
|
(options: NodeJS.GCOptions): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GCOptions {
|
||||||
|
execution?: "sync" | "async" | undefined;
|
||||||
|
flavor?: "regular" | "last-resort" | undefined;
|
||||||
|
type?: "major-snapshot" | "major" | "minor" | undefined;
|
||||||
|
filename?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** An iterable iterator returned by the Node.js API. */
|
||||||
|
interface Iterator<T, TReturn = undefined, TNext = any> extends IteratorObject<T, TReturn, TNext> {
|
||||||
|
[Symbol.iterator](): NodeJS.Iterator<T, TReturn, TNext>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** An async iterable iterator returned by the Node.js API. */
|
||||||
|
interface AsyncIterator<T, TReturn = undefined, TNext = any> extends AsyncIteratorObject<T, TReturn, TNext> {
|
||||||
|
[Symbol.asyncIterator](): NodeJS.AsyncIterator<T, TReturn, TNext>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The [`BufferSource`](https://webidl.spec.whatwg.org/#BufferSource) type from the Web IDL specification. */
|
||||||
|
type BufferSource = NonSharedArrayBufferView | ArrayBuffer;
|
||||||
|
|
||||||
|
/** The [`AllowSharedBufferSource`](https://webidl.spec.whatwg.org/#AllowSharedBufferSource) type from the Web IDL specification. */
|
||||||
|
type AllowSharedBufferSource = ArrayBufferView | ArrayBufferLike;
|
||||||
|
}
|
||||||
101
node_modules/@types/node/globals.typedarray.d.ts
generated
vendored
Normal file
101
node_modules/@types/node/globals.typedarray.d.ts
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
export {}; // Make this a module
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
namespace NodeJS {
|
||||||
|
type TypedArray<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> =
|
||||||
|
| Uint8Array<TArrayBuffer>
|
||||||
|
| Uint8ClampedArray<TArrayBuffer>
|
||||||
|
| Uint16Array<TArrayBuffer>
|
||||||
|
| Uint32Array<TArrayBuffer>
|
||||||
|
| Int8Array<TArrayBuffer>
|
||||||
|
| Int16Array<TArrayBuffer>
|
||||||
|
| Int32Array<TArrayBuffer>
|
||||||
|
| BigUint64Array<TArrayBuffer>
|
||||||
|
| BigInt64Array<TArrayBuffer>
|
||||||
|
| Float16Array<TArrayBuffer>
|
||||||
|
| Float32Array<TArrayBuffer>
|
||||||
|
| Float64Array<TArrayBuffer>;
|
||||||
|
type ArrayBufferView<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> =
|
||||||
|
| TypedArray<TArrayBuffer>
|
||||||
|
| DataView<TArrayBuffer>;
|
||||||
|
|
||||||
|
// The following aliases are required to allow use of non-shared ArrayBufferViews in @types/node
|
||||||
|
// while maintaining compatibility with TS <=5.6.
|
||||||
|
// TODO: remove once @types/node no longer supports TS 5.6, and replace with native types.
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedUint8Array = Uint8Array<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedUint8ClampedArray = Uint8ClampedArray<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedUint16Array = Uint16Array<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedUint32Array = Uint32Array<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedInt8Array = Int8Array<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedInt16Array = Int16Array<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedInt32Array = Int32Array<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedBigUint64Array = BigUint64Array<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedBigInt64Array = BigInt64Array<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedFloat16Array = Float16Array<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedFloat32Array = Float32Array<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedFloat64Array = Float64Array<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedDataView = DataView<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedTypedArray = TypedArray<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedArrayBufferView = ArrayBufferView<ArrayBuffer>;
|
||||||
|
}
|
||||||
|
}
|
||||||
2188
node_modules/@types/node/http.d.ts
generated
vendored
Normal file
2188
node_modules/@types/node/http.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2480
node_modules/@types/node/http2.d.ts
generated
vendored
Normal file
2480
node_modules/@types/node/http2.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
405
node_modules/@types/node/https.d.ts
generated
vendored
Normal file
405
node_modules/@types/node/https.d.ts
generated
vendored
Normal file
@ -0,0 +1,405 @@
|
|||||||
|
/**
|
||||||
|
* HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
|
||||||
|
* separate module.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/https.js)
|
||||||
|
*/
|
||||||
|
declare module "node:https" {
|
||||||
|
import * as http from "node:http";
|
||||||
|
import { Duplex } from "node:stream";
|
||||||
|
import * as tls from "node:tls";
|
||||||
|
import { URL } from "node:url";
|
||||||
|
interface ServerOptions<
|
||||||
|
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
||||||
|
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
||||||
|
> extends http.ServerOptions<Request, Response>, tls.TlsOptions {}
|
||||||
|
interface RequestOptions extends http.RequestOptions, tls.SecureContextOptions {
|
||||||
|
checkServerIdentity?:
|
||||||
|
| ((hostname: string, cert: tls.DetailedPeerCertificate) => Error | undefined)
|
||||||
|
| undefined;
|
||||||
|
rejectUnauthorized?: boolean | undefined; // Defaults to true
|
||||||
|
servername?: string | undefined; // SNI TLS Extension
|
||||||
|
}
|
||||||
|
interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
|
||||||
|
maxCachedSessions?: number | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information.
|
||||||
|
*
|
||||||
|
* Like `http.Agent`, the `createConnection(options[, callback])` method can be overridden
|
||||||
|
* to customize how TLS connections are established.
|
||||||
|
*
|
||||||
|
* > See `agent.createConnection()` for details on overriding this method,
|
||||||
|
* > including asynchronous socket creation with a callback.
|
||||||
|
* @since v0.4.5
|
||||||
|
*/
|
||||||
|
class Agent extends http.Agent {
|
||||||
|
constructor(options?: AgentOptions);
|
||||||
|
options: AgentOptions;
|
||||||
|
createConnection(
|
||||||
|
options: RequestOptions,
|
||||||
|
callback?: (err: Error | null, stream: Duplex) => void,
|
||||||
|
): Duplex | null | undefined;
|
||||||
|
getName(options?: RequestOptions): string;
|
||||||
|
}
|
||||||
|
interface ServerEventMap<
|
||||||
|
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
||||||
|
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
||||||
|
> extends http.ServerEventMap<Request, Response>, tls.ServerEventMap {}
|
||||||
|
/**
|
||||||
|
* See `http.Server` for more information.
|
||||||
|
* @since v0.3.4
|
||||||
|
*/
|
||||||
|
class Server<
|
||||||
|
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
||||||
|
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
||||||
|
> extends tls.Server {
|
||||||
|
constructor(requestListener?: http.RequestListener<Request, Response>);
|
||||||
|
constructor(
|
||||||
|
options: ServerOptions<Request, Response>,
|
||||||
|
requestListener?: http.RequestListener<Request, Response>,
|
||||||
|
);
|
||||||
|
/**
|
||||||
|
* Closes all connections connected to this server.
|
||||||
|
* @since v18.2.0
|
||||||
|
*/
|
||||||
|
closeAllConnections(): void;
|
||||||
|
/**
|
||||||
|
* Closes all connections connected to this server which are not sending a request or waiting for a response.
|
||||||
|
* @since v18.2.0
|
||||||
|
*/
|
||||||
|
closeIdleConnections(): void;
|
||||||
|
// #region InternalEventEmitter
|
||||||
|
addListener<E extends keyof ServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
||||||
|
): this;
|
||||||
|
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
emit<E extends keyof ServerEventMap>(eventName: E, ...args: ServerEventMap<Request, Response>[E]): boolean;
|
||||||
|
emit(eventName: string | symbol, ...args: any[]): boolean;
|
||||||
|
listenerCount<E extends keyof ServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener?: (...args: ServerEventMap<Request, Response>[E]) => void,
|
||||||
|
): number;
|
||||||
|
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
||||||
|
listeners<E extends keyof ServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
): ((...args: ServerEventMap<Request, Response>[E]) => void)[];
|
||||||
|
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
||||||
|
off<E extends keyof ServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
||||||
|
): this;
|
||||||
|
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
on<E extends keyof ServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
||||||
|
): this;
|
||||||
|
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
once<E extends keyof ServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
||||||
|
): this;
|
||||||
|
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
prependListener<E extends keyof ServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
||||||
|
): this;
|
||||||
|
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
prependOnceListener<E extends keyof ServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
||||||
|
): this;
|
||||||
|
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
rawListeners<E extends keyof ServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
): ((...args: ServerEventMap<Request, Response>[E]) => void)[];
|
||||||
|
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
||||||
|
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
||||||
|
removeAllListeners<E extends keyof ServerEventMap>(eventName?: E): this;
|
||||||
|
removeAllListeners(eventName?: string | symbol): this;
|
||||||
|
removeListener<E extends keyof ServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: ServerEventMap<Request, Response>[E]) => void,
|
||||||
|
): this;
|
||||||
|
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
// #endregion
|
||||||
|
}
|
||||||
|
interface Server<
|
||||||
|
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
||||||
|
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
||||||
|
> extends http.Server<Request, Response> {}
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* // curl -k https://localhost:8000/
|
||||||
|
* import https from 'node:https';
|
||||||
|
* import fs from 'node:fs';
|
||||||
|
*
|
||||||
|
* const options = {
|
||||||
|
* key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
|
||||||
|
* cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* https.createServer(options, (req, res) => {
|
||||||
|
* res.writeHead(200);
|
||||||
|
* res.end('hello world\n');
|
||||||
|
* }).listen(8000);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Or
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import https from 'node:https';
|
||||||
|
* import fs from 'node:fs';
|
||||||
|
*
|
||||||
|
* const options = {
|
||||||
|
* pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
|
||||||
|
* passphrase: 'sample',
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* https.createServer(options, (req, res) => {
|
||||||
|
* res.writeHead(200);
|
||||||
|
* res.end('hello world\n');
|
||||||
|
* }).listen(8000);
|
||||||
|
* ```
|
||||||
|
* @since v0.3.4
|
||||||
|
* @param options Accepts `options` from `createServer`, `createSecureContext` and `createServer`.
|
||||||
|
* @param requestListener A listener to be added to the `'request'` event.
|
||||||
|
*/
|
||||||
|
function createServer<
|
||||||
|
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
||||||
|
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
||||||
|
>(requestListener?: http.RequestListener<Request, Response>): Server<Request, Response>;
|
||||||
|
function createServer<
|
||||||
|
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
|
||||||
|
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
|
||||||
|
>(
|
||||||
|
options: ServerOptions<Request, Response>,
|
||||||
|
requestListener?: http.RequestListener<Request, Response>,
|
||||||
|
): Server<Request, Response>;
|
||||||
|
/**
|
||||||
|
* Makes a request to a secure web server.
|
||||||
|
*
|
||||||
|
* The following additional `options` from `tls.connect()` are also accepted: `ca`, `cert`, `ciphers`, `clientCertEngine`, `crl`, `dhparam`, `ecdhCurve`, `honorCipherOrder`, `key`, `passphrase`,
|
||||||
|
* `pfx`, `rejectUnauthorized`, `secureOptions`, `secureProtocol`, `servername`, `sessionIdContext`, `highWaterMark`.
|
||||||
|
*
|
||||||
|
* `options` can be an object, a string, or a `URL` object. If `options` is a
|
||||||
|
* string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
|
||||||
|
*
|
||||||
|
* `https.request()` returns an instance of the `http.ClientRequest` class. The `ClientRequest` instance is a writable stream. If one needs to
|
||||||
|
* upload a file with a POST request, then write to the `ClientRequest` object.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import https from 'node:https';
|
||||||
|
*
|
||||||
|
* const options = {
|
||||||
|
* hostname: 'encrypted.google.com',
|
||||||
|
* port: 443,
|
||||||
|
* path: '/',
|
||||||
|
* method: 'GET',
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* const req = https.request(options, (res) => {
|
||||||
|
* console.log('statusCode:', res.statusCode);
|
||||||
|
* console.log('headers:', res.headers);
|
||||||
|
*
|
||||||
|
* res.on('data', (d) => {
|
||||||
|
* process.stdout.write(d);
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* req.on('error', (e) => {
|
||||||
|
* console.error(e);
|
||||||
|
* });
|
||||||
|
* req.end();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Example using options from `tls.connect()`:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const options = {
|
||||||
|
* hostname: 'encrypted.google.com',
|
||||||
|
* port: 443,
|
||||||
|
* path: '/',
|
||||||
|
* method: 'GET',
|
||||||
|
* key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
|
||||||
|
* cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
|
||||||
|
* };
|
||||||
|
* options.agent = new https.Agent(options);
|
||||||
|
*
|
||||||
|
* const req = https.request(options, (res) => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Alternatively, opt out of connection pooling by not using an `Agent`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const options = {
|
||||||
|
* hostname: 'encrypted.google.com',
|
||||||
|
* port: 443,
|
||||||
|
* path: '/',
|
||||||
|
* method: 'GET',
|
||||||
|
* key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
|
||||||
|
* cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
|
||||||
|
* agent: false,
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* const req = https.request(options, (res) => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Example using a `URL` as `options`:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const options = new URL('https://abc:xyz@example.com');
|
||||||
|
*
|
||||||
|
* const req = https.request(options, (res) => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`):
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import tls from 'node:tls';
|
||||||
|
* import https from 'node:https';
|
||||||
|
* import crypto from 'node:crypto';
|
||||||
|
*
|
||||||
|
* function sha256(s) {
|
||||||
|
* return crypto.createHash('sha256').update(s).digest('base64');
|
||||||
|
* }
|
||||||
|
* const options = {
|
||||||
|
* hostname: 'github.com',
|
||||||
|
* port: 443,
|
||||||
|
* path: '/',
|
||||||
|
* method: 'GET',
|
||||||
|
* checkServerIdentity: function(host, cert) {
|
||||||
|
* // Make sure the certificate is issued to the host we are connected to
|
||||||
|
* const err = tls.checkServerIdentity(host, cert);
|
||||||
|
* if (err) {
|
||||||
|
* return err;
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // Pin the public key, similar to HPKP pin-sha256 pinning
|
||||||
|
* const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU=';
|
||||||
|
* if (sha256(cert.pubkey) !== pubkey256) {
|
||||||
|
* const msg = 'Certificate verification error: ' +
|
||||||
|
* `The public key of '${cert.subject.CN}' ` +
|
||||||
|
* 'does not match our pinned fingerprint';
|
||||||
|
* return new Error(msg);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // Pin the exact certificate, rather than the pub key
|
||||||
|
* const cert256 = '25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:' +
|
||||||
|
* 'D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16';
|
||||||
|
* if (cert.fingerprint256 !== cert256) {
|
||||||
|
* const msg = 'Certificate verification error: ' +
|
||||||
|
* `The certificate of '${cert.subject.CN}' ` +
|
||||||
|
* 'does not match our pinned fingerprint';
|
||||||
|
* return new Error(msg);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // This loop is informational only.
|
||||||
|
* // Print the certificate and public key fingerprints of all certs in the
|
||||||
|
* // chain. Its common to pin the public key of the issuer on the public
|
||||||
|
* // internet, while pinning the public key of the service in sensitive
|
||||||
|
* // environments.
|
||||||
|
* do {
|
||||||
|
* console.log('Subject Common Name:', cert.subject.CN);
|
||||||
|
* console.log(' Certificate SHA256 fingerprint:', cert.fingerprint256);
|
||||||
|
*
|
||||||
|
* hash = crypto.createHash('sha256');
|
||||||
|
* console.log(' Public key ping-sha256:', sha256(cert.pubkey));
|
||||||
|
*
|
||||||
|
* lastprint256 = cert.fingerprint256;
|
||||||
|
* cert = cert.issuerCertificate;
|
||||||
|
* } while (cert.fingerprint256 !== lastprint256);
|
||||||
|
*
|
||||||
|
* },
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* options.agent = new https.Agent(options);
|
||||||
|
* const req = https.request(options, (res) => {
|
||||||
|
* console.log('All OK. Server matched our pinned cert or public key');
|
||||||
|
* console.log('statusCode:', res.statusCode);
|
||||||
|
* // Print the HPKP values
|
||||||
|
* console.log('headers:', res.headers['public-key-pins']);
|
||||||
|
*
|
||||||
|
* res.on('data', (d) => {});
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* req.on('error', (e) => {
|
||||||
|
* console.error(e.message);
|
||||||
|
* });
|
||||||
|
* req.end();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Outputs for example:
|
||||||
|
*
|
||||||
|
* ```text
|
||||||
|
* Subject Common Name: github.com
|
||||||
|
* Certificate SHA256 fingerprint: 25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16
|
||||||
|
* Public key ping-sha256: pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU=
|
||||||
|
* Subject Common Name: DigiCert SHA2 Extended Validation Server CA
|
||||||
|
* Certificate SHA256 fingerprint: 40:3E:06:2A:26:53:05:91:13:28:5B:AF:80:A0:D4:AE:42:2C:84:8C:9F:78:FA:D0:1F:C9:4B:C5:B8:7F:EF:1A
|
||||||
|
* Public key ping-sha256: RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho=
|
||||||
|
* Subject Common Name: DigiCert High Assurance EV Root CA
|
||||||
|
* Certificate SHA256 fingerprint: 74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF
|
||||||
|
* Public key ping-sha256: WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18=
|
||||||
|
* All OK. Server matched our pinned cert or public key
|
||||||
|
* statusCode: 200
|
||||||
|
* headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho=";
|
||||||
|
* pin-sha256="k2v657xBsOVe1PQRwOsHsw3bsGT2VzIqz5K+59sNQws="; pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="IQBnNBEiFuhj+8x6X8XLgh01V9Ic5/V3IRQLNFFc7v4=";
|
||||||
|
* pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0="; pin-sha256="LvRiGEjRqfzurezaWuj8Wie2gyHMrW5Q06LspMnox7A="; includeSubDomains
|
||||||
|
* ```
|
||||||
|
* @since v0.3.6
|
||||||
|
* @param options Accepts all `options` from `request`, with some differences in default values:
|
||||||
|
*/
|
||||||
|
function request(
|
||||||
|
options: RequestOptions | string | URL,
|
||||||
|
callback?: (res: http.IncomingMessage) => void,
|
||||||
|
): http.ClientRequest;
|
||||||
|
function request(
|
||||||
|
url: string | URL,
|
||||||
|
options: RequestOptions,
|
||||||
|
callback?: (res: http.IncomingMessage) => void,
|
||||||
|
): http.ClientRequest;
|
||||||
|
/**
|
||||||
|
* Like `http.get()` but for HTTPS.
|
||||||
|
*
|
||||||
|
* `options` can be an object, a string, or a `URL` object. If `options` is a
|
||||||
|
* 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
|
||||||
|
* import https from 'node:https';
|
||||||
|
*
|
||||||
|
* https.get('https://encrypted.google.com/', (res) => {
|
||||||
|
* console.log('statusCode:', res.statusCode);
|
||||||
|
* console.log('headers:', res.headers);
|
||||||
|
*
|
||||||
|
* res.on('data', (d) => {
|
||||||
|
* process.stdout.write(d);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* }).on('error', (e) => {
|
||||||
|
* console.error(e);
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v0.3.6
|
||||||
|
* @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`.
|
||||||
|
*/
|
||||||
|
function get(
|
||||||
|
options: RequestOptions | string | URL,
|
||||||
|
callback?: (res: http.IncomingMessage) => void,
|
||||||
|
): http.ClientRequest;
|
||||||
|
function get(
|
||||||
|
url: string | URL,
|
||||||
|
options: RequestOptions,
|
||||||
|
callback?: (res: http.IncomingMessage) => void,
|
||||||
|
): http.ClientRequest;
|
||||||
|
let globalAgent: Agent;
|
||||||
|
}
|
||||||
|
declare module "https" {
|
||||||
|
export * from "node:https";
|
||||||
|
}
|
||||||
115
node_modules/@types/node/index.d.ts
generated
vendored
Normal file
115
node_modules/@types/node/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/**
|
||||||
|
* License for programmatically and manually incorporated
|
||||||
|
* documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc
|
||||||
|
*
|
||||||
|
* Copyright Node.js contributors. All rights reserved.
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to
|
||||||
|
* deal in the Software without restriction, including without limitation the
|
||||||
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
* sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
* IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// NOTE: These definitions support Node.js and TypeScript 5.8+.
|
||||||
|
|
||||||
|
// Reference required TypeScript libraries:
|
||||||
|
/// <reference lib="es2020" />
|
||||||
|
/// <reference lib="esnext.disposable" />
|
||||||
|
/// <reference lib="esnext.float16" />
|
||||||
|
|
||||||
|
// Iterator definitions required for compatibility with TypeScript <5.6:
|
||||||
|
/// <reference path="compatibility/iterators.d.ts" />
|
||||||
|
|
||||||
|
// Definitions for Node.js modules specific to TypeScript 5.7+:
|
||||||
|
/// <reference path="globals.typedarray.d.ts" />
|
||||||
|
/// <reference path="buffer.buffer.d.ts" />
|
||||||
|
|
||||||
|
// Definitions for Node.js modules that are not specific to any version of TypeScript:
|
||||||
|
/// <reference path="globals.d.ts" />
|
||||||
|
/// <reference path="web-globals/abortcontroller.d.ts" />
|
||||||
|
/// <reference path="web-globals/blob.d.ts" />
|
||||||
|
/// <reference path="web-globals/console.d.ts" />
|
||||||
|
/// <reference path="web-globals/crypto.d.ts" />
|
||||||
|
/// <reference path="web-globals/domexception.d.ts" />
|
||||||
|
/// <reference path="web-globals/encoding.d.ts" />
|
||||||
|
/// <reference path="web-globals/events.d.ts" />
|
||||||
|
/// <reference path="web-globals/fetch.d.ts" />
|
||||||
|
/// <reference path="web-globals/importmeta.d.ts" />
|
||||||
|
/// <reference path="web-globals/messaging.d.ts" />
|
||||||
|
/// <reference path="web-globals/navigator.d.ts" />
|
||||||
|
/// <reference path="web-globals/performance.d.ts" />
|
||||||
|
/// <reference path="web-globals/storage.d.ts" />
|
||||||
|
/// <reference path="web-globals/streams.d.ts" />
|
||||||
|
/// <reference path="web-globals/timers.d.ts" />
|
||||||
|
/// <reference path="web-globals/url.d.ts" />
|
||||||
|
/// <reference path="assert.d.ts" />
|
||||||
|
/// <reference path="assert/strict.d.ts" />
|
||||||
|
/// <reference path="async_hooks.d.ts" />
|
||||||
|
/// <reference path="buffer.d.ts" />
|
||||||
|
/// <reference path="child_process.d.ts" />
|
||||||
|
/// <reference path="cluster.d.ts" />
|
||||||
|
/// <reference path="console.d.ts" />
|
||||||
|
/// <reference path="constants.d.ts" />
|
||||||
|
/// <reference path="crypto.d.ts" />
|
||||||
|
/// <reference path="dgram.d.ts" />
|
||||||
|
/// <reference path="diagnostics_channel.d.ts" />
|
||||||
|
/// <reference path="dns.d.ts" />
|
||||||
|
/// <reference path="dns/promises.d.ts" />
|
||||||
|
/// <reference path="domain.d.ts" />
|
||||||
|
/// <reference path="events.d.ts" />
|
||||||
|
/// <reference path="fs.d.ts" />
|
||||||
|
/// <reference path="fs/promises.d.ts" />
|
||||||
|
/// <reference path="http.d.ts" />
|
||||||
|
/// <reference path="http2.d.ts" />
|
||||||
|
/// <reference path="https.d.ts" />
|
||||||
|
/// <reference path="inspector.d.ts" />
|
||||||
|
/// <reference path="inspector.generated.d.ts" />
|
||||||
|
/// <reference path="inspector/promises.d.ts" />
|
||||||
|
/// <reference path="module.d.ts" />
|
||||||
|
/// <reference path="net.d.ts" />
|
||||||
|
/// <reference path="os.d.ts" />
|
||||||
|
/// <reference path="path.d.ts" />
|
||||||
|
/// <reference path="path/posix.d.ts" />
|
||||||
|
/// <reference path="path/win32.d.ts" />
|
||||||
|
/// <reference path="perf_hooks.d.ts" />
|
||||||
|
/// <reference path="process.d.ts" />
|
||||||
|
/// <reference path="punycode.d.ts" />
|
||||||
|
/// <reference path="querystring.d.ts" />
|
||||||
|
/// <reference path="quic.d.ts" />
|
||||||
|
/// <reference path="readline.d.ts" />
|
||||||
|
/// <reference path="readline/promises.d.ts" />
|
||||||
|
/// <reference path="repl.d.ts" />
|
||||||
|
/// <reference path="sea.d.ts" />
|
||||||
|
/// <reference path="sqlite.d.ts" />
|
||||||
|
/// <reference path="stream.d.ts" />
|
||||||
|
/// <reference path="stream/consumers.d.ts" />
|
||||||
|
/// <reference path="stream/promises.d.ts" />
|
||||||
|
/// <reference path="stream/web.d.ts" />
|
||||||
|
/// <reference path="string_decoder.d.ts" />
|
||||||
|
/// <reference path="test.d.ts" />
|
||||||
|
/// <reference path="test/reporters.d.ts" />
|
||||||
|
/// <reference path="timers.d.ts" />
|
||||||
|
/// <reference path="timers/promises.d.ts" />
|
||||||
|
/// <reference path="tls.d.ts" />
|
||||||
|
/// <reference path="trace_events.d.ts" />
|
||||||
|
/// <reference path="tty.d.ts" />
|
||||||
|
/// <reference path="url.d.ts" />
|
||||||
|
/// <reference path="util.d.ts" />
|
||||||
|
/// <reference path="util/types.d.ts" />
|
||||||
|
/// <reference path="v8.d.ts" />
|
||||||
|
/// <reference path="vm.d.ts" />
|
||||||
|
/// <reference path="wasi.d.ts" />
|
||||||
|
/// <reference path="worker_threads.d.ts" />
|
||||||
|
/// <reference path="zlib.d.ts" />
|
||||||
269
node_modules/@types/node/inspector.d.ts
generated
vendored
Normal file
269
node_modules/@types/node/inspector.d.ts
generated
vendored
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
/**
|
||||||
|
* The `node:inspector` module provides an API for interacting with the V8
|
||||||
|
* inspector.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/inspector.js)
|
||||||
|
*/
|
||||||
|
declare module "node:inspector" {
|
||||||
|
import { EventEmitter } from "node:events";
|
||||||
|
/**
|
||||||
|
* The `inspector.Session` is used for dispatching messages to the V8 inspector
|
||||||
|
* back-end and receiving message responses and notifications.
|
||||||
|
*/
|
||||||
|
class Session extends EventEmitter {
|
||||||
|
/**
|
||||||
|
* Create a new instance of the inspector.Session class.
|
||||||
|
* The inspector session needs to be connected through `session.connect()` before the messages can be dispatched to the inspector backend.
|
||||||
|
*/
|
||||||
|
constructor();
|
||||||
|
/**
|
||||||
|
* Connects a session to the inspector back-end.
|
||||||
|
*/
|
||||||
|
connect(): void;
|
||||||
|
/**
|
||||||
|
* Connects a session to the inspector back-end.
|
||||||
|
* An exception will be thrown if this API was not called on a Worker thread.
|
||||||
|
* @since v12.11.0
|
||||||
|
*/
|
||||||
|
connectToMainThread(): void;
|
||||||
|
/**
|
||||||
|
* Immediately close the session. All pending message callbacks will be called with an error.
|
||||||
|
* `session.connect()` will need to be called to be able to send messages again.
|
||||||
|
* Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints.
|
||||||
|
*/
|
||||||
|
disconnect(): void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* and flow control has been passed to the debugger client.
|
||||||
|
*
|
||||||
|
* See the [security warning](https://nodejs.org/docs/latest-v25.x/api/cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure)
|
||||||
|
* regarding the `host` parameter usage.
|
||||||
|
* @param port Port to listen on for inspector connections. Defaults to what was specified on the CLI.
|
||||||
|
* @param host Host to listen on for inspector connections. Defaults to what was specified on the CLI.
|
||||||
|
* @param wait Block until a client has connected. Defaults to what was specified on the CLI.
|
||||||
|
* @returns Disposable that calls `inspector.close()`.
|
||||||
|
*/
|
||||||
|
function open(port?: number, host?: string, wait?: boolean): Disposable;
|
||||||
|
/**
|
||||||
|
* Deactivate the inspector. Blocks until there are no active connections.
|
||||||
|
*/
|
||||||
|
function close(): void;
|
||||||
|
/**
|
||||||
|
* Return the URL of the active inspector, or `undefined` if there is none.
|
||||||
|
*
|
||||||
|
* ```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
|
||||||
|
* 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
|
||||||
|
* ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a
|
||||||
|
*
|
||||||
|
* $ node -p 'inspector.url()'
|
||||||
|
* undefined
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
function url(): string | undefined;
|
||||||
|
/**
|
||||||
|
* Blocks until a client (existing or connected later) has sent `Runtime.runIfWaitingForDebugger` command.
|
||||||
|
*
|
||||||
|
* An exception will be thrown if there is no active inspector.
|
||||||
|
* @since v12.7.0
|
||||||
|
*/
|
||||||
|
function waitForDebugger(): void;
|
||||||
|
// These methods are exposed by the V8 inspector console API (inspector/v8-console.h).
|
||||||
|
// The method signatures differ from those of the Node.js console, and are deliberately
|
||||||
|
// typed permissively.
|
||||||
|
interface InspectorConsole {
|
||||||
|
debug(...data: any[]): void;
|
||||||
|
error(...data: any[]): void;
|
||||||
|
info(...data: any[]): void;
|
||||||
|
log(...data: any[]): void;
|
||||||
|
warn(...data: any[]): void;
|
||||||
|
dir(...data: any[]): void;
|
||||||
|
dirxml(...data: any[]): void;
|
||||||
|
table(...data: any[]): void;
|
||||||
|
trace(...data: any[]): void;
|
||||||
|
group(...data: any[]): void;
|
||||||
|
groupCollapsed(...data: any[]): void;
|
||||||
|
groupEnd(...data: any[]): void;
|
||||||
|
clear(...data: any[]): void;
|
||||||
|
count(label?: any): void;
|
||||||
|
countReset(label?: any): void;
|
||||||
|
assert(value?: any, ...data: any[]): void;
|
||||||
|
profile(label?: any): void;
|
||||||
|
profileEnd(label?: any): void;
|
||||||
|
time(label?: any): void;
|
||||||
|
timeLog(label?: any): void;
|
||||||
|
timeStamp(label?: any): void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* An object to send messages to the remote inspector console.
|
||||||
|
* @since v11.0.0
|
||||||
|
*/
|
||||||
|
const console: InspectorConsole;
|
||||||
|
// DevTools protocol event broadcast methods
|
||||||
|
namespace Network {
|
||||||
|
/**
|
||||||
|
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
||||||
|
*
|
||||||
|
* Broadcasts the `Network.requestWillBeSent` event to connected frontends. This event indicates that
|
||||||
|
* the application is about to send an HTTP request.
|
||||||
|
* @since v22.6.0
|
||||||
|
*/
|
||||||
|
function requestWillBeSent(params: RequestWillBeSentEventDataType): void;
|
||||||
|
/**
|
||||||
|
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
||||||
|
*
|
||||||
|
* Broadcasts the `Network.dataReceived` event to connected frontends, or buffers the data if
|
||||||
|
* `Network.streamResourceContent` command was not invoked for the given request yet.
|
||||||
|
*
|
||||||
|
* Also enables `Network.getResponseBody` command to retrieve the response data.
|
||||||
|
* @since v24.2.0
|
||||||
|
*/
|
||||||
|
function dataReceived(params: DataReceivedEventDataType): void;
|
||||||
|
/**
|
||||||
|
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
||||||
|
*
|
||||||
|
* Enables `Network.getRequestPostData` command to retrieve the request data.
|
||||||
|
* @since v24.3.0
|
||||||
|
*/
|
||||||
|
function dataSent(params: unknown): void;
|
||||||
|
/**
|
||||||
|
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
||||||
|
*
|
||||||
|
* Broadcasts the `Network.responseReceived` event to connected frontends. This event indicates that
|
||||||
|
* HTTP response is available.
|
||||||
|
* @since v22.6.0
|
||||||
|
*/
|
||||||
|
function responseReceived(params: ResponseReceivedEventDataType): void;
|
||||||
|
/**
|
||||||
|
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
||||||
|
*
|
||||||
|
* Broadcasts the `Network.loadingFinished` event to connected frontends. This event indicates that
|
||||||
|
* HTTP request has finished loading.
|
||||||
|
* @since v22.6.0
|
||||||
|
*/
|
||||||
|
function loadingFinished(params: LoadingFinishedEventDataType): void;
|
||||||
|
/**
|
||||||
|
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
||||||
|
*
|
||||||
|
* Broadcasts the `Network.loadingFailed` event to connected frontends. This event indicates that
|
||||||
|
* HTTP request has failed to load.
|
||||||
|
* @since v22.7.0
|
||||||
|
*/
|
||||||
|
function loadingFailed(params: LoadingFailedEventDataType): void;
|
||||||
|
/**
|
||||||
|
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
||||||
|
*
|
||||||
|
* Broadcasts the `Network.webSocketCreated` event to connected frontends. This event indicates that
|
||||||
|
* a WebSocket connection has been initiated.
|
||||||
|
* @since v24.7.0
|
||||||
|
*/
|
||||||
|
function webSocketCreated(params: WebSocketCreatedEventDataType): void;
|
||||||
|
/**
|
||||||
|
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
||||||
|
*
|
||||||
|
* Broadcasts the `Network.webSocketHandshakeResponseReceived` event to connected frontends.
|
||||||
|
* This event indicates that the WebSocket handshake response has been received.
|
||||||
|
* @since v24.7.0
|
||||||
|
*/
|
||||||
|
function webSocketHandshakeResponseReceived(params: WebSocketHandshakeResponseReceivedEventDataType): void;
|
||||||
|
/**
|
||||||
|
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
||||||
|
*
|
||||||
|
* Broadcasts the `Network.webSocketClosed` event to connected frontends.
|
||||||
|
* This event indicates that a WebSocket connection has been closed.
|
||||||
|
* @since v24.7.0
|
||||||
|
*/
|
||||||
|
function webSocketClosed(params: WebSocketClosedEventDataType): void;
|
||||||
|
}
|
||||||
|
namespace NetworkResources {
|
||||||
|
/**
|
||||||
|
* This feature is only available with the `--experimental-inspector-network-resource` flag enabled.
|
||||||
|
*
|
||||||
|
* The inspector.NetworkResources.put method is used to provide a response for a loadNetworkResource
|
||||||
|
* request issued via the Chrome DevTools Protocol (CDP).
|
||||||
|
* This is typically triggered when a source map is specified by URL, and a DevTools frontend—such as
|
||||||
|
* Chrome—requests the resource to retrieve the source map.
|
||||||
|
*
|
||||||
|
* This method allows developers to predefine the resource content to be served in response to such CDP requests.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const inspector = require('node:inspector');
|
||||||
|
* // By preemptively calling put to register the resource, a source map can be resolved when
|
||||||
|
* // a loadNetworkResource request is made from the frontend.
|
||||||
|
* async function setNetworkResources() {
|
||||||
|
* const mapUrl = 'http://localhost:3000/dist/app.js.map';
|
||||||
|
* const tsUrl = 'http://localhost:3000/src/app.ts';
|
||||||
|
* const distAppJsMap = await fetch(mapUrl).then((res) => res.text());
|
||||||
|
* const srcAppTs = await fetch(tsUrl).then((res) => res.text());
|
||||||
|
* inspector.NetworkResources.put(mapUrl, distAppJsMap);
|
||||||
|
* inspector.NetworkResources.put(tsUrl, srcAppTs);
|
||||||
|
* };
|
||||||
|
* setNetworkResources().then(() => {
|
||||||
|
* require('./dist/app');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* For more details, see the official CDP documentation: [Network.loadNetworkResource](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-loadNetworkResource)
|
||||||
|
* @since v24.5.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
function put(url: string, data: string): void;
|
||||||
|
}
|
||||||
|
namespace DOMStorage {
|
||||||
|
/**
|
||||||
|
* This feature is only available with the
|
||||||
|
* `--experimental-storage-inspection` flag enabled.
|
||||||
|
*
|
||||||
|
* Broadcasts the `DOMStorage.domStorageItemAdded` event to connected frontends.
|
||||||
|
* This event indicates that a new item has been added to the storage.
|
||||||
|
* @since v25.5.0
|
||||||
|
*/
|
||||||
|
function domStorageItemAdded(params: DomStorageItemAddedEventDataType): void;
|
||||||
|
/**
|
||||||
|
* This feature is only available with the
|
||||||
|
* `--experimental-storage-inspection` flag enabled.
|
||||||
|
*
|
||||||
|
* Broadcasts the `DOMStorage.domStorageItemRemoved` event to connected frontends.
|
||||||
|
* This event indicates that an item has been removed from the storage.
|
||||||
|
* @since v25.5.0
|
||||||
|
*/
|
||||||
|
function domStorageItemRemoved(params: DomStorageItemRemovedEventDataType): void;
|
||||||
|
/**
|
||||||
|
* This feature is only available with the
|
||||||
|
* `--experimental-storage-inspection` flag enabled.
|
||||||
|
|
||||||
|
* Broadcasts the `DOMStorage.domStorageItemUpdated` event to connected frontends.
|
||||||
|
* This event indicates that a storage item has been updated.
|
||||||
|
* @since v25.5.0
|
||||||
|
*/
|
||||||
|
function domStorageItemUpdated(params: DomStorageItemUpdatedEventDataType): void;
|
||||||
|
/**
|
||||||
|
* This feature is only available with the
|
||||||
|
* `--experimental-storage-inspection` flag enabled.
|
||||||
|
*
|
||||||
|
* Broadcasts the `DOMStorage.domStorageItemsCleared` event to connected
|
||||||
|
* frontends. This event indicates that all items have been cleared from the
|
||||||
|
* storage.
|
||||||
|
* @since v25.5.0
|
||||||
|
*/
|
||||||
|
function domStorageItemsCleared(params: DomStorageItemsClearedEventDataType): void;
|
||||||
|
/**
|
||||||
|
* This feature is only available with the
|
||||||
|
* `--experimental-storage-inspection` flag enabled.
|
||||||
|
* @since v25.5.0
|
||||||
|
*/
|
||||||
|
function registerStorage(params: unknown): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module "inspector" {
|
||||||
|
export * from "node:inspector";
|
||||||
|
}
|
||||||
4401
node_modules/@types/node/inspector.generated.d.ts
generated
vendored
Normal file
4401
node_modules/@types/node/inspector.generated.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
41
node_modules/@types/node/inspector/promises.d.ts
generated
vendored
Normal file
41
node_modules/@types/node/inspector/promises.d.ts
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* The `node:inspector/promises` module provides an API for interacting with the V8
|
||||||
|
* inspector.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/inspector/promises.js)
|
||||||
|
* @since v19.0.0
|
||||||
|
*/
|
||||||
|
declare module "node:inspector/promises" {
|
||||||
|
import { EventEmitter } from "node:events";
|
||||||
|
export { close, console, NetworkResources, open, url, waitForDebugger } from "node:inspector";
|
||||||
|
/**
|
||||||
|
* The `inspector.Session` is used for dispatching messages to the V8 inspector
|
||||||
|
* back-end and receiving message responses and notifications.
|
||||||
|
* @since v19.0.0
|
||||||
|
*/
|
||||||
|
export class Session extends EventEmitter {
|
||||||
|
/**
|
||||||
|
* Create a new instance of the inspector.Session class.
|
||||||
|
* The inspector session needs to be connected through `session.connect()` before the messages can be dispatched to the inspector backend.
|
||||||
|
*/
|
||||||
|
constructor();
|
||||||
|
/**
|
||||||
|
* Connects a session to the inspector back-end.
|
||||||
|
*/
|
||||||
|
connect(): void;
|
||||||
|
/**
|
||||||
|
* Connects a session to the inspector back-end.
|
||||||
|
* An exception will be thrown if this API was not called on a Worker thread.
|
||||||
|
* @since v12.11.0
|
||||||
|
*/
|
||||||
|
connectToMainThread(): void;
|
||||||
|
/**
|
||||||
|
* Immediately close the session. All pending message callbacks will be called with an error.
|
||||||
|
* `session.connect()` will need to be called to be able to send messages again.
|
||||||
|
* Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints.
|
||||||
|
*/
|
||||||
|
disconnect(): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module "inspector/promises" {
|
||||||
|
export * from "node:inspector/promises";
|
||||||
|
}
|
||||||
757
node_modules/@types/node/module.d.ts
generated
vendored
Normal file
757
node_modules/@types/node/module.d.ts
generated
vendored
Normal file
@ -0,0 +1,757 @@
|
|||||||
|
/**
|
||||||
|
* @since v0.3.7
|
||||||
|
*/
|
||||||
|
declare module "node:module" {
|
||||||
|
import { URL } from "node:url";
|
||||||
|
class Module {
|
||||||
|
constructor(id: string, parent?: Module);
|
||||||
|
}
|
||||||
|
interface Module extends NodeJS.Module {}
|
||||||
|
namespace Module {
|
||||||
|
export { Module };
|
||||||
|
}
|
||||||
|
namespace Module {
|
||||||
|
/**
|
||||||
|
* A list of the names of all modules provided by Node.js. Can be used to verify
|
||||||
|
* if a module is maintained by a third party or not.
|
||||||
|
*
|
||||||
|
* Note: the list doesn't contain prefix-only modules like `node:test`.
|
||||||
|
* @since v9.3.0, v8.10.0, v6.13.0
|
||||||
|
*/
|
||||||
|
const builtinModules: readonly string[];
|
||||||
|
/**
|
||||||
|
* @since v12.2.0
|
||||||
|
* @param path Filename to be used to construct the require
|
||||||
|
* function. Must be a file URL object, file URL string, or absolute path
|
||||||
|
* string.
|
||||||
|
*/
|
||||||
|
function createRequire(path: string | URL): NodeJS.Require;
|
||||||
|
namespace constants {
|
||||||
|
/**
|
||||||
|
* The following constants are returned as the `status` field in the object returned by
|
||||||
|
* {@link enableCompileCache} to indicate the result of the attempt to enable the
|
||||||
|
* [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache).
|
||||||
|
* @since v22.8.0
|
||||||
|
*/
|
||||||
|
namespace compileCacheStatus {
|
||||||
|
/**
|
||||||
|
* Node.js has enabled the compile cache successfully. The directory used to store the
|
||||||
|
* compile cache will be returned in the `directory` field in the
|
||||||
|
* returned object.
|
||||||
|
*/
|
||||||
|
const ENABLED: number;
|
||||||
|
/**
|
||||||
|
* The compile cache has already been enabled before, either by a previous call to
|
||||||
|
* {@link enableCompileCache}, or by the `NODE_COMPILE_CACHE=dir`
|
||||||
|
* environment variable. The directory used to store the
|
||||||
|
* compile cache will be returned in the `directory` field in the
|
||||||
|
* returned object.
|
||||||
|
*/
|
||||||
|
const ALREADY_ENABLED: number;
|
||||||
|
/**
|
||||||
|
* Node.js fails to enable the compile cache. This can be caused by the lack of
|
||||||
|
* permission to use the specified directory, or various kinds of file system errors.
|
||||||
|
* The detail of the failure will be returned in the `message` field in the
|
||||||
|
* returned object.
|
||||||
|
*/
|
||||||
|
const FAILED: number;
|
||||||
|
/**
|
||||||
|
* Node.js cannot enable the compile cache because the environment variable
|
||||||
|
* `NODE_DISABLE_COMPILE_CACHE=1` has been set.
|
||||||
|
*/
|
||||||
|
const DISABLED: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
interface EnableCompileCacheOptions {
|
||||||
|
/**
|
||||||
|
* Optional. Directory to store the compile cache. If not specified,
|
||||||
|
* the directory specified by the `NODE_COMPILE_CACHE=dir` environment variable
|
||||||
|
* will be used if it's set, or `path.join(os.tmpdir(), 'node-compile-cache')`
|
||||||
|
* otherwise.
|
||||||
|
* @since v25.0.0
|
||||||
|
*/
|
||||||
|
directory?: string | undefined;
|
||||||
|
/**
|
||||||
|
* Optional. If `true`, enables portable compile cache so that
|
||||||
|
* the cache can be reused even if the project directory is moved. This is a best-effort
|
||||||
|
* feature. If not specified, it will depend on whether the environment variable
|
||||||
|
* `NODE_COMPILE_CACHE_PORTABLE=1` is set.
|
||||||
|
* @since v25.0.0
|
||||||
|
*/
|
||||||
|
portable?: boolean | undefined;
|
||||||
|
}
|
||||||
|
interface EnableCompileCacheResult {
|
||||||
|
/**
|
||||||
|
* One of the {@link constants.compileCacheStatus}
|
||||||
|
*/
|
||||||
|
status: number;
|
||||||
|
/**
|
||||||
|
* If Node.js cannot enable the compile cache, this contains
|
||||||
|
* the error message. Only set if `status` is `module.constants.compileCacheStatus.FAILED`.
|
||||||
|
*/
|
||||||
|
message?: string;
|
||||||
|
/**
|
||||||
|
* If the compile cache is enabled, this contains the directory
|
||||||
|
* where the compile cache is stored. Only set if `status` is
|
||||||
|
* `module.constants.compileCacheStatus.ENABLED` or
|
||||||
|
* `module.constants.compileCacheStatus.ALREADY_ENABLED`.
|
||||||
|
*/
|
||||||
|
directory?: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Enable [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache)
|
||||||
|
* in the current Node.js instance.
|
||||||
|
*
|
||||||
|
* For general use cases, it's recommended to call `module.enableCompileCache()` without
|
||||||
|
* specifying the `options.directory`, so that the directory can be overridden by the
|
||||||
|
* `NODE_COMPILE_CACHE` environment variable when necessary.
|
||||||
|
*
|
||||||
|
* Since compile cache is supposed to be a optimization that is not mission critical, this
|
||||||
|
* method is designed to not throw any exception when the compile cache cannot be enabled.
|
||||||
|
* Instead, it will return an object containing an error message in the `message` field to
|
||||||
|
* aid debugging. If compile cache is enabled successfully, the `directory` field in the
|
||||||
|
* returned object contains the path to the directory where the compile cache is stored. The
|
||||||
|
* `status` field in the returned object would be one of the `module.constants.compileCacheStatus`
|
||||||
|
* values to indicate the result of the attempt to enable the
|
||||||
|
* [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache).
|
||||||
|
*
|
||||||
|
* This method only affects the current Node.js instance. To enable it in child worker threads,
|
||||||
|
* either call this method in child worker threads too, or set the
|
||||||
|
* `process.env.NODE_COMPILE_CACHE` value to compile cache directory so the behavior can
|
||||||
|
* be inherited into the child workers. The directory can be obtained either from the
|
||||||
|
* `directory` field returned by this method, or with {@link getCompileCacheDir}.
|
||||||
|
* @since v22.8.0
|
||||||
|
* @param options Optional. If a string is passed, it is considered to be `options.directory`.
|
||||||
|
*/
|
||||||
|
function enableCompileCache(options?: string | EnableCompileCacheOptions): EnableCompileCacheResult;
|
||||||
|
/**
|
||||||
|
* Flush the [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache)
|
||||||
|
* accumulated from modules already loaded
|
||||||
|
* in the current Node.js instance to disk. This returns after all the flushing
|
||||||
|
* file system operations come to an end, no matter they succeed or not. If there
|
||||||
|
* are any errors, this will fail silently, since compile cache misses should not
|
||||||
|
* interfere with the actual operation of the application.
|
||||||
|
* @since v22.10.0
|
||||||
|
*/
|
||||||
|
function flushCompileCache(): void;
|
||||||
|
/**
|
||||||
|
* @since v22.8.0
|
||||||
|
* @return Path to the [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache)
|
||||||
|
* directory if it is enabled, or `undefined` otherwise.
|
||||||
|
*/
|
||||||
|
function getCompileCacheDir(): string | undefined;
|
||||||
|
/**
|
||||||
|
* ```text
|
||||||
|
* /path/to/project
|
||||||
|
* ├ packages/
|
||||||
|
* ├ bar/
|
||||||
|
* ├ bar.js
|
||||||
|
* └ package.json // name = '@foo/bar'
|
||||||
|
* └ qux/
|
||||||
|
* ├ node_modules/
|
||||||
|
* └ some-package/
|
||||||
|
* └ package.json // name = 'some-package'
|
||||||
|
* ├ qux.js
|
||||||
|
* └ package.json // name = '@foo/qux'
|
||||||
|
* ├ main.js
|
||||||
|
* └ package.json // name = '@foo'
|
||||||
|
* ```
|
||||||
|
* ```js
|
||||||
|
* // /path/to/project/packages/bar/bar.js
|
||||||
|
* import { findPackageJSON } from 'node:module';
|
||||||
|
*
|
||||||
|
* findPackageJSON('..', import.meta.url);
|
||||||
|
* // '/path/to/project/package.json'
|
||||||
|
* // Same result when passing an absolute specifier instead:
|
||||||
|
* findPackageJSON(new URL('../', import.meta.url));
|
||||||
|
* findPackageJSON(import.meta.resolve('../'));
|
||||||
|
*
|
||||||
|
* findPackageJSON('some-package', import.meta.url);
|
||||||
|
* // '/path/to/project/packages/bar/node_modules/some-package/package.json'
|
||||||
|
* // When passing an absolute specifier, you might get a different result if the
|
||||||
|
* // resolved module is inside a subfolder that has nested `package.json`.
|
||||||
|
* findPackageJSON(import.meta.resolve('some-package'));
|
||||||
|
* // '/path/to/project/packages/bar/node_modules/some-package/some-subfolder/package.json'
|
||||||
|
*
|
||||||
|
* findPackageJSON('@foo/qux', import.meta.url);
|
||||||
|
* // '/path/to/project/packages/qux/package.json'
|
||||||
|
* ```
|
||||||
|
* @since v22.14.0
|
||||||
|
* @param specifier The specifier for the module whose `package.json` to
|
||||||
|
* retrieve. When passing a _bare specifier_, the `package.json` at the root of
|
||||||
|
* the package is returned. When passing a _relative specifier_ or an _absolute specifier_,
|
||||||
|
* the closest parent `package.json` is returned.
|
||||||
|
* @param base The absolute location (`file:` URL string or FS path) of the
|
||||||
|
* containing module. For CJS, use `__filename` (not `__dirname`!); for ESM, use
|
||||||
|
* `import.meta.url`. You do not need to pass it if `specifier` is an _absolute specifier_.
|
||||||
|
* @returns A path if the `package.json` is found. When `startLocation`
|
||||||
|
* is a package, the package's root `package.json`; when a relative or unresolved, the closest
|
||||||
|
* `package.json` to the `startLocation`.
|
||||||
|
*/
|
||||||
|
function findPackageJSON(specifier: string | URL, base?: string | URL): string | undefined;
|
||||||
|
/**
|
||||||
|
* @since v18.6.0, v16.17.0
|
||||||
|
*/
|
||||||
|
function isBuiltin(moduleName: string): boolean;
|
||||||
|
interface RegisterOptions<Data> {
|
||||||
|
/**
|
||||||
|
* If you want to resolve `specifier` relative to a
|
||||||
|
* base URL, such as `import.meta.url`, you can pass that URL here. This
|
||||||
|
* property is ignored if the `parentURL` is supplied as the second argument.
|
||||||
|
* @default 'data:'
|
||||||
|
*/
|
||||||
|
parentURL?: string | URL | undefined;
|
||||||
|
/**
|
||||||
|
* Any arbitrary, cloneable JavaScript value to pass into the
|
||||||
|
* {@link initialize} hook.
|
||||||
|
*/
|
||||||
|
data?: Data | undefined;
|
||||||
|
/**
|
||||||
|
* [Transferable objects](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#portpostmessagevalue-transferlist)
|
||||||
|
* to be passed into the `initialize` hook.
|
||||||
|
*/
|
||||||
|
transferList?: any[] | undefined;
|
||||||
|
}
|
||||||
|
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
||||||
|
/**
|
||||||
|
* Register a module that exports hooks that customize Node.js module
|
||||||
|
* resolution and loading behavior. See
|
||||||
|
* [Customization hooks](https://nodejs.org/docs/latest-v25.x/api/module.html#customization-hooks).
|
||||||
|
*
|
||||||
|
* This feature requires `--allow-worker` if used with the
|
||||||
|
* [Permission Model](https://nodejs.org/docs/latest-v25.x/api/permissions.html#permission-model).
|
||||||
|
* @since v20.6.0, v18.19.0
|
||||||
|
* @param specifier Customization hooks to be registered; this should be
|
||||||
|
* the same string that would be passed to `import()`, except that if it is
|
||||||
|
* relative, it is resolved relative to `parentURL`.
|
||||||
|
* @param parentURL f you want to resolve `specifier` relative to a base
|
||||||
|
* URL, such as `import.meta.url`, you can pass that URL here.
|
||||||
|
*/
|
||||||
|
function register<Data = any>(
|
||||||
|
specifier: string | URL,
|
||||||
|
parentURL?: string | URL,
|
||||||
|
options?: RegisterOptions<Data>,
|
||||||
|
): void;
|
||||||
|
function register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
|
||||||
|
interface RegisterHooksOptions {
|
||||||
|
/**
|
||||||
|
* See [load hook](https://nodejs.org/docs/latest-v25.x/api/module.html#loadurl-context-nextload).
|
||||||
|
* @default undefined
|
||||||
|
*/
|
||||||
|
load?: LoadHookSync | undefined;
|
||||||
|
/**
|
||||||
|
* See [resolve hook](https://nodejs.org/docs/latest-v25.x/api/module.html#resolvespecifier-context-nextresolve).
|
||||||
|
* @default undefined
|
||||||
|
*/
|
||||||
|
resolve?: ResolveHookSync | undefined;
|
||||||
|
}
|
||||||
|
interface ModuleHooks {
|
||||||
|
/**
|
||||||
|
* Deregister the hook instance.
|
||||||
|
*/
|
||||||
|
deregister(): void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Register [hooks](https://nodejs.org/docs/latest-v25.x/api/module.html#customization-hooks)
|
||||||
|
* that customize Node.js module resolution and loading behavior.
|
||||||
|
* @since v22.15.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
function registerHooks(options: RegisterHooksOptions): ModuleHooks;
|
||||||
|
interface StripTypeScriptTypesOptions {
|
||||||
|
/**
|
||||||
|
* Possible values are:
|
||||||
|
* * `'strip'` Only strip type annotations without performing the transformation of TypeScript features.
|
||||||
|
* * `'transform'` Strip type annotations and transform TypeScript features to JavaScript.
|
||||||
|
* @default 'strip'
|
||||||
|
*/
|
||||||
|
mode?: "strip" | "transform" | undefined;
|
||||||
|
/**
|
||||||
|
* Only when `mode` is `'transform'`, if `true`, a source map
|
||||||
|
* will be generated for the transformed code.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
sourceMap?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the source url used in the source map.
|
||||||
|
*/
|
||||||
|
sourceUrl?: string | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* `module.stripTypeScriptTypes()` removes type annotations from TypeScript code. It
|
||||||
|
* can be used to strip type annotations from TypeScript code before running it
|
||||||
|
* with `vm.runInContext()` or `vm.compileFunction()`.
|
||||||
|
* By default, it will throw an error if the code contains TypeScript features
|
||||||
|
* that require transformation such as `Enums`,
|
||||||
|
* see [type-stripping](https://nodejs.org/docs/latest-v25.x/api/typescript.md#type-stripping) for more information.
|
||||||
|
* When mode is `'transform'`, it also transforms TypeScript features to JavaScript,
|
||||||
|
* see [transform TypeScript features](https://nodejs.org/docs/latest-v25.x/api/typescript.md#typescript-features) for more information.
|
||||||
|
* When mode is `'strip'`, source maps are not generated, because locations are preserved.
|
||||||
|
* If `sourceMap` is provided, when mode is `'strip'`, an error will be thrown.
|
||||||
|
*
|
||||||
|
* _WARNING_: The output of this function should not be considered stable across Node.js versions,
|
||||||
|
* due to changes in the TypeScript parser.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { stripTypeScriptTypes } from 'node:module';
|
||||||
|
* const code = 'const a: number = 1;';
|
||||||
|
* const strippedCode = stripTypeScriptTypes(code);
|
||||||
|
* console.log(strippedCode);
|
||||||
|
* // Prints: const a = 1;
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If `sourceUrl` is provided, it will be used appended as a comment at the end of the output:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { stripTypeScriptTypes } from 'node:module';
|
||||||
|
* const code = 'const a: number = 1;';
|
||||||
|
* const strippedCode = stripTypeScriptTypes(code, { mode: 'strip', sourceUrl: 'source.ts' });
|
||||||
|
* console.log(strippedCode);
|
||||||
|
* // Prints: const a = 1\n\n//# sourceURL=source.ts;
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* When `mode` is `'transform'`, the code is transformed to JavaScript:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { stripTypeScriptTypes } from 'node:module';
|
||||||
|
* const code = `
|
||||||
|
* namespace MathUtil {
|
||||||
|
* export const add = (a: number, b: number) => a + b;
|
||||||
|
* }`;
|
||||||
|
* const strippedCode = stripTypeScriptTypes(code, { mode: 'transform', sourceMap: true });
|
||||||
|
* console.log(strippedCode);
|
||||||
|
* // Prints:
|
||||||
|
* // var MathUtil;
|
||||||
|
* // (function(MathUtil) {
|
||||||
|
* // MathUtil.add = (a, b)=>a + b;
|
||||||
|
* // })(MathUtil || (MathUtil = {}));
|
||||||
|
* // # sourceMappingURL=data:application/json;base64, ...
|
||||||
|
* ```
|
||||||
|
* @since v22.13.0
|
||||||
|
* @param code The code to strip type annotations from.
|
||||||
|
* @returns The code with type annotations stripped.
|
||||||
|
*/
|
||||||
|
function stripTypeScriptTypes(code: string, options?: StripTypeScriptTypesOptions): string;
|
||||||
|
/* eslint-enable @definitelytyped/no-unnecessary-generics */
|
||||||
|
/**
|
||||||
|
* The `module.syncBuiltinESMExports()` method updates all the live bindings for
|
||||||
|
* builtin `ES Modules` to match the properties of the `CommonJS` exports. It
|
||||||
|
* does not add or remove exported names from the `ES Modules`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import fs from 'node:fs';
|
||||||
|
* import assert from 'node:assert';
|
||||||
|
* import { syncBuiltinESMExports } from 'node:module';
|
||||||
|
*
|
||||||
|
* fs.readFile = newAPI;
|
||||||
|
*
|
||||||
|
* delete fs.readFileSync;
|
||||||
|
*
|
||||||
|
* function newAPI() {
|
||||||
|
* // ...
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* fs.newAPI = newAPI;
|
||||||
|
*
|
||||||
|
* syncBuiltinESMExports();
|
||||||
|
*
|
||||||
|
* import('node: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
|
||||||
|
* assert.strictEqual('readFileSync' in fs, false);
|
||||||
|
* // syncBuiltinESMExports() does not remove readFileSync from esmFS
|
||||||
|
* assert.strictEqual('readFileSync' in esmFS, true);
|
||||||
|
* // syncBuiltinESMExports() does not add names
|
||||||
|
* assert.strictEqual(esmFS.newAPI, undefined);
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v12.12.0
|
||||||
|
*/
|
||||||
|
function syncBuiltinESMExports(): void;
|
||||||
|
interface ImportAttributes extends NodeJS.Dict<string> {
|
||||||
|
type?: string | undefined;
|
||||||
|
}
|
||||||
|
type ImportPhase = "source" | "evaluation";
|
||||||
|
type ModuleFormat =
|
||||||
|
| "addon"
|
||||||
|
| "builtin"
|
||||||
|
| "commonjs"
|
||||||
|
| "commonjs-typescript"
|
||||||
|
| "json"
|
||||||
|
| "module"
|
||||||
|
| "module-typescript"
|
||||||
|
| "wasm";
|
||||||
|
type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
|
||||||
|
type InitializeHook<Data = any> = (data: Data) => void | Promise<void>;
|
||||||
|
interface ResolveHookContext {
|
||||||
|
conditions: string[];
|
||||||
|
importAttributes: ImportAttributes;
|
||||||
|
parentURL: string | undefined;
|
||||||
|
}
|
||||||
|
interface ResolveFnOutput {
|
||||||
|
format?: string | null | undefined;
|
||||||
|
importAttributes?: ImportAttributes | undefined;
|
||||||
|
shortCircuit?: boolean | undefined;
|
||||||
|
url: string;
|
||||||
|
}
|
||||||
|
type ResolveHook = (
|
||||||
|
specifier: string,
|
||||||
|
context: ResolveHookContext,
|
||||||
|
nextResolve: (
|
||||||
|
specifier: string,
|
||||||
|
context?: Partial<ResolveHookContext>,
|
||||||
|
) => ResolveFnOutput | Promise<ResolveFnOutput>,
|
||||||
|
) => ResolveFnOutput | Promise<ResolveFnOutput>;
|
||||||
|
type ResolveHookSync = (
|
||||||
|
specifier: string,
|
||||||
|
context: ResolveHookContext,
|
||||||
|
nextResolve: (
|
||||||
|
specifier: string,
|
||||||
|
context?: Partial<ResolveHookContext>,
|
||||||
|
) => ResolveFnOutput,
|
||||||
|
) => ResolveFnOutput;
|
||||||
|
interface LoadHookContext {
|
||||||
|
conditions: string[];
|
||||||
|
format: string | null | undefined;
|
||||||
|
importAttributes: ImportAttributes;
|
||||||
|
}
|
||||||
|
interface LoadFnOutput {
|
||||||
|
format: string | null | undefined;
|
||||||
|
shortCircuit?: boolean | undefined;
|
||||||
|
source?: ModuleSource | undefined;
|
||||||
|
}
|
||||||
|
type LoadHook = (
|
||||||
|
url: string,
|
||||||
|
context: LoadHookContext,
|
||||||
|
nextLoad: (
|
||||||
|
url: string,
|
||||||
|
context?: Partial<LoadHookContext>,
|
||||||
|
) => LoadFnOutput | Promise<LoadFnOutput>,
|
||||||
|
) => LoadFnOutput | Promise<LoadFnOutput>;
|
||||||
|
type LoadHookSync = (
|
||||||
|
url: string,
|
||||||
|
context: LoadHookContext,
|
||||||
|
nextLoad: (
|
||||||
|
url: string,
|
||||||
|
context?: Partial<LoadHookContext>,
|
||||||
|
) => LoadFnOutput,
|
||||||
|
) => LoadFnOutput;
|
||||||
|
interface SourceMapsSupport {
|
||||||
|
/**
|
||||||
|
* If the source maps support is enabled
|
||||||
|
*/
|
||||||
|
enabled: boolean;
|
||||||
|
/**
|
||||||
|
* If the support is enabled for files in `node_modules`.
|
||||||
|
*/
|
||||||
|
nodeModules: boolean;
|
||||||
|
/**
|
||||||
|
* If the support is enabled for generated code from `eval` or `new Function`.
|
||||||
|
*/
|
||||||
|
generatedCode: boolean;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This method returns whether the [Source Map v3](https://tc39.es/ecma426/) support for stack
|
||||||
|
* traces is enabled.
|
||||||
|
* @since v23.7.0, v22.14.0
|
||||||
|
*/
|
||||||
|
function getSourceMapsSupport(): SourceMapsSupport;
|
||||||
|
/**
|
||||||
|
* `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): SourceMap | undefined;
|
||||||
|
interface SetSourceMapsSupportOptions {
|
||||||
|
/**
|
||||||
|
* If enabling the support for files in `node_modules`.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
nodeModules?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* If enabling the support for generated code from `eval` or `new Function`.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
generatedCode?: boolean | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This function enables or disables the [Source Map v3](https://tc39.es/ecma426/) support for
|
||||||
|
* stack traces.
|
||||||
|
*
|
||||||
|
* It provides same features as launching Node.js process with commandline options
|
||||||
|
* `--enable-source-maps`, with additional options to alter the support for files
|
||||||
|
* in `node_modules` or generated codes.
|
||||||
|
*
|
||||||
|
* Only source maps in JavaScript files that are loaded after source maps has been
|
||||||
|
* enabled will be parsed and loaded. Preferably, use the commandline options
|
||||||
|
* `--enable-source-maps` to avoid losing track of source maps of modules loaded
|
||||||
|
* before this API call.
|
||||||
|
* @since v23.7.0, v22.14.0
|
||||||
|
*/
|
||||||
|
function setSourceMapsSupport(enabled: boolean, options?: SetSourceMapsSupportOptions): void;
|
||||||
|
interface SourceMapConstructorOptions {
|
||||||
|
/**
|
||||||
|
* @since v21.0.0, v20.5.0
|
||||||
|
*/
|
||||||
|
lineLengths?: readonly number[] | undefined;
|
||||||
|
}
|
||||||
|
interface SourceMapPayload {
|
||||||
|
file: string;
|
||||||
|
version: number;
|
||||||
|
sources: string[];
|
||||||
|
sourcesContent: string[];
|
||||||
|
names: string[];
|
||||||
|
mappings: string;
|
||||||
|
sourceRoot: string;
|
||||||
|
}
|
||||||
|
interface SourceMapping {
|
||||||
|
generatedLine: number;
|
||||||
|
generatedColumn: number;
|
||||||
|
originalSource: string;
|
||||||
|
originalLine: number;
|
||||||
|
originalColumn: number;
|
||||||
|
}
|
||||||
|
interface SourceOrigin {
|
||||||
|
/**
|
||||||
|
* The name of the range in the source map, if one was provided
|
||||||
|
*/
|
||||||
|
name: string | undefined;
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
class SourceMap {
|
||||||
|
constructor(payload: SourceMapPayload, options?: SourceMapConstructorOptions);
|
||||||
|
/**
|
||||||
|
* Getter for the payload used to construct the `SourceMap` instance.
|
||||||
|
*/
|
||||||
|
readonly 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
|
||||||
|
*/
|
||||||
|
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 | {};
|
||||||
|
}
|
||||||
|
function runMain(main?: string): void;
|
||||||
|
function wrap(script: string): string;
|
||||||
|
}
|
||||||
|
global {
|
||||||
|
namespace NodeJS {
|
||||||
|
interface Module {
|
||||||
|
/**
|
||||||
|
* The module objects required for the first time by this one.
|
||||||
|
* @since v0.1.16
|
||||||
|
*/
|
||||||
|
children: Module[];
|
||||||
|
/**
|
||||||
|
* The `module.exports` object is created by the `Module` system. Sometimes this is
|
||||||
|
* not acceptable; many want their module to be an instance of some class. To do
|
||||||
|
* this, assign the desired export object to `module.exports`.
|
||||||
|
* @since v0.1.16
|
||||||
|
*/
|
||||||
|
exports: any;
|
||||||
|
/**
|
||||||
|
* The fully resolved filename of the module.
|
||||||
|
* @since v0.1.16
|
||||||
|
*/
|
||||||
|
filename: string;
|
||||||
|
/**
|
||||||
|
* The identifier for the module. Typically this is the fully resolved
|
||||||
|
* filename.
|
||||||
|
* @since v0.1.16
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* `true` if the module is running during the Node.js preload
|
||||||
|
* phase.
|
||||||
|
* @since v15.4.0, v14.17.0
|
||||||
|
*/
|
||||||
|
isPreloading: boolean;
|
||||||
|
/**
|
||||||
|
* Whether or not the module is done loading, or is in the process of
|
||||||
|
* loading.
|
||||||
|
* @since v0.1.16
|
||||||
|
*/
|
||||||
|
loaded: boolean;
|
||||||
|
/**
|
||||||
|
* The module that first required this one, or `null` if the current module is the
|
||||||
|
* entry point of the current process, or `undefined` if the module was loaded by
|
||||||
|
* something that is not a CommonJS module (e.g. REPL or `import`).
|
||||||
|
* @since v0.1.16
|
||||||
|
* @deprecated Please use `require.main` and `module.children` instead.
|
||||||
|
*/
|
||||||
|
parent: Module | null | undefined;
|
||||||
|
/**
|
||||||
|
* The directory name of the module. This is usually the same as the
|
||||||
|
* `path.dirname()` of the `module.id`.
|
||||||
|
* @since v11.14.0
|
||||||
|
*/
|
||||||
|
path: string;
|
||||||
|
/**
|
||||||
|
* The search paths for the module.
|
||||||
|
* @since v0.4.0
|
||||||
|
*/
|
||||||
|
paths: string[];
|
||||||
|
/**
|
||||||
|
* The `module.require()` method provides a way to load a module as if
|
||||||
|
* `require()` was called from the original module.
|
||||||
|
* @since v0.5.1
|
||||||
|
*/
|
||||||
|
require(id: string): any;
|
||||||
|
}
|
||||||
|
interface Require {
|
||||||
|
/**
|
||||||
|
* Used to import modules, `JSON`, and local files.
|
||||||
|
* @since v0.1.13
|
||||||
|
*/
|
||||||
|
(id: string): any;
|
||||||
|
/**
|
||||||
|
* Modules are cached in this object when they are required. By deleting a key
|
||||||
|
* value from this object, the next `require` will reload the module.
|
||||||
|
* This does not apply to
|
||||||
|
* [native addons](https://nodejs.org/docs/latest-v25.x/api/addons.html),
|
||||||
|
* for which reloading will result in an error.
|
||||||
|
* @since v0.3.0
|
||||||
|
*/
|
||||||
|
cache: Dict<Module>;
|
||||||
|
/**
|
||||||
|
* Instruct `require` on how to handle certain file extensions.
|
||||||
|
* @since v0.3.0
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
extensions: RequireExtensions;
|
||||||
|
/**
|
||||||
|
* The `Module` object representing the entry script loaded when the Node.js
|
||||||
|
* process launched, or `undefined` if the entry point of the program is not a
|
||||||
|
* CommonJS module.
|
||||||
|
* @since v0.1.17
|
||||||
|
*/
|
||||||
|
main: Module | undefined;
|
||||||
|
/**
|
||||||
|
* @since v0.3.0
|
||||||
|
*/
|
||||||
|
resolve: RequireResolve;
|
||||||
|
}
|
||||||
|
/** @deprecated */
|
||||||
|
interface RequireExtensions extends Dict<(module: Module, filename: string) => any> {
|
||||||
|
".js": (module: Module, filename: string) => any;
|
||||||
|
".json": (module: Module, filename: string) => any;
|
||||||
|
".node": (module: Module, filename: string) => any;
|
||||||
|
}
|
||||||
|
interface RequireResolveOptions {
|
||||||
|
/**
|
||||||
|
* Paths to resolve module location from. If present, these
|
||||||
|
* paths are used instead of the default resolution paths, with the exception
|
||||||
|
* of
|
||||||
|
* [GLOBAL\_FOLDERS](https://nodejs.org/docs/latest-v25.x/api/modules.html#loading-from-the-global-folders)
|
||||||
|
* like `$HOME/.node_modules`, which are
|
||||||
|
* always included. Each of these paths is used as a starting point for
|
||||||
|
* the module resolution algorithm, meaning that the `node_modules` hierarchy
|
||||||
|
* is checked from this location.
|
||||||
|
* @since v8.9.0
|
||||||
|
*/
|
||||||
|
paths?: string[] | undefined;
|
||||||
|
}
|
||||||
|
interface RequireResolve {
|
||||||
|
/**
|
||||||
|
* Use the internal `require()` machinery to look up the location of a module,
|
||||||
|
* but rather than loading the module, just return the resolved filename.
|
||||||
|
*
|
||||||
|
* If the module can not be found, a `MODULE_NOT_FOUND` error is thrown.
|
||||||
|
* @since v0.3.0
|
||||||
|
* @param request The module path to resolve.
|
||||||
|
*/
|
||||||
|
(request: string, options?: RequireResolveOptions): string;
|
||||||
|
/**
|
||||||
|
* Returns an array containing the paths searched during resolution of `request` or
|
||||||
|
* `null` if the `request` string references a core module, for example `http` or
|
||||||
|
* `fs`.
|
||||||
|
* @since v8.9.0
|
||||||
|
* @param request The module path whose lookup paths are being retrieved.
|
||||||
|
*/
|
||||||
|
paths(request: string): string[] | null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The directory name of the current module. This is the same as the
|
||||||
|
* `path.dirname()` of the `__filename`.
|
||||||
|
* @since v0.1.27
|
||||||
|
*/
|
||||||
|
var __dirname: string;
|
||||||
|
/**
|
||||||
|
* The file name of the current module. This is the current module file's absolute
|
||||||
|
* path with symlinks resolved.
|
||||||
|
*
|
||||||
|
* For a main program this is not necessarily the same as the file name used in the
|
||||||
|
* command line.
|
||||||
|
* @since v0.0.1
|
||||||
|
*/
|
||||||
|
var __filename: string;
|
||||||
|
/**
|
||||||
|
* The `exports` variable is available within a module's file-level scope, and is
|
||||||
|
* assigned the value of `module.exports` before the module is evaluated.
|
||||||
|
* @since v0.1.16
|
||||||
|
*/
|
||||||
|
var exports: NodeJS.Module["exports"];
|
||||||
|
/**
|
||||||
|
* A reference to the current module.
|
||||||
|
* @since v0.1.16
|
||||||
|
*/
|
||||||
|
var module: NodeJS.Module;
|
||||||
|
/**
|
||||||
|
* @since v0.1.13
|
||||||
|
*/
|
||||||
|
var require: NodeJS.Require;
|
||||||
|
// Global-scope aliases for backwards compatibility with @types/node <13.0.x
|
||||||
|
// TODO: consider removing in a future major version update
|
||||||
|
/** @deprecated Use `NodeJS.Module` instead. */
|
||||||
|
interface NodeModule extends NodeJS.Module {}
|
||||||
|
/** @deprecated Use `NodeJS.Require` instead. */
|
||||||
|
interface NodeRequire extends NodeJS.Require {}
|
||||||
|
/** @deprecated Use `NodeJS.RequireResolve` instead. */
|
||||||
|
interface RequireResolve extends NodeJS.RequireResolve {}
|
||||||
|
}
|
||||||
|
export = Module;
|
||||||
|
}
|
||||||
|
declare module "module" {
|
||||||
|
import module = require("node:module");
|
||||||
|
export = module;
|
||||||
|
}
|
||||||
933
node_modules/@types/node/net.d.ts
generated
vendored
Normal file
933
node_modules/@types/node/net.d.ts
generated
vendored
Normal file
@ -0,0 +1,933 @@
|
|||||||
|
/**
|
||||||
|
* > Stability: 2 - Stable
|
||||||
|
*
|
||||||
|
* The `node: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
|
||||||
|
* import net from 'node:net';
|
||||||
|
* ```
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/net.js)
|
||||||
|
*/
|
||||||
|
declare module "node:net" {
|
||||||
|
import { NonSharedBuffer } from "node:buffer";
|
||||||
|
import * as dns from "node:dns";
|
||||||
|
import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
|
||||||
|
import * as stream from "node:stream";
|
||||||
|
type LookupFunction = (
|
||||||
|
hostname: string,
|
||||||
|
options: dns.LookupOptions,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, address: string | dns.LookupAddress[], family?: number) => void,
|
||||||
|
) => void;
|
||||||
|
interface AddressInfo {
|
||||||
|
address: string;
|
||||||
|
family: string;
|
||||||
|
port: number;
|
||||||
|
}
|
||||||
|
interface SocketConstructorOpts {
|
||||||
|
fd?: number | undefined;
|
||||||
|
allowHalfOpen?: boolean | undefined;
|
||||||
|
onread?: OnReadOpts | undefined;
|
||||||
|
readable?: boolean | undefined;
|
||||||
|
writable?: boolean | undefined;
|
||||||
|
signal?: AbortSignal | undefined;
|
||||||
|
noDelay?: boolean | undefined;
|
||||||
|
keepAlive?: boolean | undefined;
|
||||||
|
keepAliveInitialDelay?: number | undefined;
|
||||||
|
blockList?: BlockList | undefined;
|
||||||
|
}
|
||||||
|
interface OnReadOpts {
|
||||||
|
buffer: Uint8Array | (() => Uint8Array);
|
||||||
|
/**
|
||||||
|
* This function is called for every chunk of incoming data.
|
||||||
|
* Two arguments are passed to it: the number of bytes written to `buffer` and a reference to `buffer`.
|
||||||
|
* Return `false` from this function to implicitly `pause()` the socket.
|
||||||
|
*/
|
||||||
|
callback(bytesWritten: number, buffer: Uint8Array): boolean;
|
||||||
|
}
|
||||||
|
interface TcpSocketConnectOpts {
|
||||||
|
port: number;
|
||||||
|
host?: string | undefined;
|
||||||
|
localAddress?: string | undefined;
|
||||||
|
localPort?: number | undefined;
|
||||||
|
hints?: number | undefined;
|
||||||
|
family?: number | undefined;
|
||||||
|
lookup?: LookupFunction | undefined;
|
||||||
|
/**
|
||||||
|
* @since v18.13.0
|
||||||
|
*/
|
||||||
|
autoSelectFamily?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* @since v18.13.0
|
||||||
|
*/
|
||||||
|
autoSelectFamilyAttemptTimeout?: number | undefined;
|
||||||
|
}
|
||||||
|
interface IpcSocketConnectOpts {
|
||||||
|
path: string;
|
||||||
|
}
|
||||||
|
type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
|
||||||
|
type SocketReadyState = "opening" | "open" | "readOnly" | "writeOnly" | "closed";
|
||||||
|
interface SocketEventMap extends Omit<stream.DuplexEventMap, "close"> {
|
||||||
|
"close": [hadError: boolean];
|
||||||
|
"connect": [];
|
||||||
|
"connectionAttempt": [ip: string, port: number, family: number];
|
||||||
|
"connectionAttemptFailed": [ip: string, port: number, family: number, error: Error];
|
||||||
|
"connectionAttemptTimeout": [ip: string, port: number, family: number];
|
||||||
|
"data": [data: string | NonSharedBuffer];
|
||||||
|
"lookup": [err: Error | null, address: string, family: number | null, host: string];
|
||||||
|
"ready": [];
|
||||||
|
"timeout": [];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This class is an abstraction of a TCP socket or a streaming `IPC` endpoint
|
||||||
|
* (uses named pipes on Windows, and Unix domain sockets otherwise). It is also
|
||||||
|
* an `EventEmitter`.
|
||||||
|
*
|
||||||
|
* A `net.Socket` can be created by the user and used directly to interact with
|
||||||
|
* a server. For example, it is returned by {@link createConnection},
|
||||||
|
* so the user can use it to talk to the server.
|
||||||
|
*
|
||||||
|
* It can also be created by Node.js and passed to the user when a connection
|
||||||
|
* is received. For example, it is passed to the listeners of a `'connection'` event emitted on a {@link Server}, so the user can use
|
||||||
|
* it to interact with the client.
|
||||||
|
* @since v0.3.4
|
||||||
|
*/
|
||||||
|
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.
|
||||||
|
*
|
||||||
|
* Returns `true` if the entire data was flushed successfully to the kernel
|
||||||
|
* buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is again free.
|
||||||
|
*
|
||||||
|
* The optional `callback` parameter will be executed when the data is finally
|
||||||
|
* written out, which may not be immediately.
|
||||||
|
*
|
||||||
|
* See `Writable` stream `write()` method for more
|
||||||
|
* information.
|
||||||
|
* @since v0.1.90
|
||||||
|
* @param [encoding='utf8'] Only used when data is `string`.
|
||||||
|
*/
|
||||||
|
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
||||||
|
write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
|
||||||
|
/**
|
||||||
|
* Initiate a connection on a given socket.
|
||||||
|
*
|
||||||
|
* Possible signatures:
|
||||||
|
*
|
||||||
|
* * `socket.connect(options[, connectListener])`
|
||||||
|
* * `socket.connect(path[, connectListener])` for `IPC` connections.
|
||||||
|
* * `socket.connect(port[, host][, connectListener])` for TCP connections.
|
||||||
|
* * Returns: `net.Socket` The socket itself.
|
||||||
|
*
|
||||||
|
* This function is asynchronous. When the connection is established, the `'connect'` event will be emitted. If there is a problem connecting,
|
||||||
|
* instead of a `'connect'` event, an `'error'` event will be emitted with
|
||||||
|
* the error passed to the `'error'` listener.
|
||||||
|
* The last parameter `connectListener`, if supplied, will be added as a listener
|
||||||
|
* for the `'connect'` event **once**.
|
||||||
|
*
|
||||||
|
* This function should only be used for reconnecting a socket after`'close'` has been emitted or otherwise it may lead to undefined
|
||||||
|
* behavior.
|
||||||
|
*/
|
||||||
|
connect(options: SocketConnectOpts, connectionListener?: () => void): this;
|
||||||
|
connect(port: number, host: string, connectionListener?: () => void): this;
|
||||||
|
connect(port: number, connectionListener?: () => void): this;
|
||||||
|
connect(path: string, connectionListener?: () => void): this;
|
||||||
|
/**
|
||||||
|
* Set the encoding for the socket as a `Readable Stream`. See `readable.setEncoding()` for more information.
|
||||||
|
* @since v0.1.90
|
||||||
|
* @return The socket itself.
|
||||||
|
*/
|
||||||
|
setEncoding(encoding?: BufferEncoding): this;
|
||||||
|
/**
|
||||||
|
* Pauses the reading of data. That is, `'data'` events will not be emitted.
|
||||||
|
* Useful to throttle back an upload.
|
||||||
|
* @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.
|
||||||
|
*/
|
||||||
|
resume(): this;
|
||||||
|
/**
|
||||||
|
* Sets the socket to timeout after `timeout` milliseconds of inactivity on
|
||||||
|
* the socket. By default `net.Socket` do not have a timeout.
|
||||||
|
*
|
||||||
|
* When an idle timeout is triggered the socket will receive a `'timeout'` event but the connection will not be severed. The user must manually call `socket.end()` or `socket.destroy()` to
|
||||||
|
* end the connection.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* socket.setTimeout(3000);
|
||||||
|
* socket.on('timeout', () => {
|
||||||
|
* console.log('socket timeout');
|
||||||
|
* socket.end();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If `timeout` is 0, then the existing idle timeout is disabled.
|
||||||
|
*
|
||||||
|
* The optional `callback` parameter will be added as a one-time listener for the `'timeout'` event.
|
||||||
|
* @since v0.1.90
|
||||||
|
* @return The socket itself.
|
||||||
|
*/
|
||||||
|
setTimeout(timeout: number, callback?: () => void): this;
|
||||||
|
/**
|
||||||
|
* Enable/disable the use of Nagle's algorithm.
|
||||||
|
*
|
||||||
|
* When a TCP connection is created, it will have Nagle's algorithm enabled.
|
||||||
|
*
|
||||||
|
* Nagle's algorithm delays data before it is sent via the network. It attempts
|
||||||
|
* to optimize throughput at the expense of latency.
|
||||||
|
*
|
||||||
|
* Passing `true` for `noDelay` or not passing an argument will disable Nagle's
|
||||||
|
* algorithm for the socket. Passing `false` for `noDelay` will enable Nagle's
|
||||||
|
* algorithm.
|
||||||
|
* @since v0.1.90
|
||||||
|
* @param [noDelay=true]
|
||||||
|
* @return The socket itself.
|
||||||
|
*/
|
||||||
|
setNoDelay(noDelay?: boolean): this;
|
||||||
|
/**
|
||||||
|
* Enable/disable keep-alive functionality, and optionally set the initial
|
||||||
|
* delay before the first keepalive probe is sent on an idle socket.
|
||||||
|
*
|
||||||
|
* Set `initialDelay` (in milliseconds) to set the delay between the last
|
||||||
|
* data packet received and the first keepalive probe. Setting `0` for`initialDelay` will leave the value unchanged from the default
|
||||||
|
* (or previous) setting.
|
||||||
|
*
|
||||||
|
* Enabling the keep-alive functionality will set the following socket options:
|
||||||
|
*
|
||||||
|
* * `SO_KEEPALIVE=1`
|
||||||
|
* * `TCP_KEEPIDLE=initialDelay`
|
||||||
|
* * `TCP_KEEPCNT=10`
|
||||||
|
* * `TCP_KEEPINTVL=1`
|
||||||
|
* @since v0.1.92
|
||||||
|
* @param [enable=false]
|
||||||
|
* @param [initialDelay=0]
|
||||||
|
* @return The socket itself.
|
||||||
|
*/
|
||||||
|
setKeepAlive(enable?: boolean, initialDelay?: number): this;
|
||||||
|
/**
|
||||||
|
* Returns the bound `address`, the address `family` name and `port` of the
|
||||||
|
* socket as reported by the operating system:`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`
|
||||||
|
* @since v0.1.90
|
||||||
|
*/
|
||||||
|
address(): AddressInfo | {};
|
||||||
|
/**
|
||||||
|
* Calling `unref()` on a socket will allow the program to exit if this is the only
|
||||||
|
* active socket in the event system. If the socket is already `unref`ed calling`unref()` again will have no effect.
|
||||||
|
* @since v0.9.1
|
||||||
|
* @return The socket itself.
|
||||||
|
*/
|
||||||
|
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).
|
||||||
|
* 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
|
||||||
|
* is only an approximation of the number of bytes in the buffer.
|
||||||
|
*
|
||||||
|
* `net.Socket` has the property that `socket.write()` always works. This is to
|
||||||
|
* help users get up and running quickly. The computer cannot always keep up
|
||||||
|
* with the amount of data that is written to a socket. The network connection
|
||||||
|
* simply might be too slow. Node.js will internally queue up the data written to a
|
||||||
|
* socket and send it out over the wire when it is possible.
|
||||||
|
*
|
||||||
|
* The consequence of this internal buffering is that memory may grow.
|
||||||
|
* Users who experience large or growing `bufferSize` should attempt to
|
||||||
|
* "throttle" the data flows in their program with `socket.pause()` and `socket.resume()`.
|
||||||
|
* @since v0.3.8
|
||||||
|
* @deprecated Since v14.6.0 - Use `writableLength` instead.
|
||||||
|
*/
|
||||||
|
readonly bufferSize: number;
|
||||||
|
/**
|
||||||
|
* The amount of received bytes.
|
||||||
|
* @since v0.5.3
|
||||||
|
*/
|
||||||
|
readonly bytesRead: number;
|
||||||
|
/**
|
||||||
|
* The amount of bytes sent.
|
||||||
|
* @since v0.5.3
|
||||||
|
*/
|
||||||
|
readonly bytesWritten: number;
|
||||||
|
/**
|
||||||
|
* If `true`, `socket.connect(options[, connectListener])` was
|
||||||
|
* called and has not yet finished. It will stay `true` until the socket becomes
|
||||||
|
* connected, then it is set to `false` and the `'connect'` event is emitted. Note
|
||||||
|
* that the `socket.connect(options[, connectListener])` callback is a listener for the `'connect'` event.
|
||||||
|
* @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.
|
||||||
|
*/
|
||||||
|
readonly destroyed: boolean;
|
||||||
|
/**
|
||||||
|
* The string representation of the local IP address the remote client is
|
||||||
|
* connecting on. For example, in a server listening on `'0.0.0.0'`, if a client
|
||||||
|
* connects on `'192.168.1.1'`, the value of `socket.localAddress` would be`'192.168.1.1'`.
|
||||||
|
* @since v0.9.6
|
||||||
|
*/
|
||||||
|
readonly localAddress?: string;
|
||||||
|
/**
|
||||||
|
* The numeric representation of the local port. For example, `80` or `21`.
|
||||||
|
* @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`.
|
||||||
|
* @since v0.5.0
|
||||||
|
*/
|
||||||
|
readonly readyState: SocketReadyState;
|
||||||
|
/**
|
||||||
|
* The string representation of the remote IP address. For example,`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if
|
||||||
|
* the socket is destroyed (for example, if the client disconnected).
|
||||||
|
* @since v0.5.10
|
||||||
|
*/
|
||||||
|
readonly remoteAddress: string | undefined;
|
||||||
|
/**
|
||||||
|
* The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. Value may be `undefined` if
|
||||||
|
* the socket is destroyed (for example, if the client disconnected).
|
||||||
|
* @since v0.11.14
|
||||||
|
*/
|
||||||
|
readonly remoteFamily: string | undefined;
|
||||||
|
/**
|
||||||
|
* The numeric representation of the remote port. For example, `80` or `21`. Value may be `undefined` if
|
||||||
|
* the socket is destroyed (for example, if the client disconnected).
|
||||||
|
* @since v0.5.10
|
||||||
|
*/
|
||||||
|
readonly remotePort: number | undefined;
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
/**
|
||||||
|
* Half-closes the socket. i.e., it sends a FIN packet. It is possible the
|
||||||
|
* server will still send some data.
|
||||||
|
*
|
||||||
|
* See `writable.end()` for further details.
|
||||||
|
* @since v0.1.90
|
||||||
|
* @param [encoding='utf8'] Only used when data is `string`.
|
||||||
|
* @param callback Optional callback for when the socket is finished.
|
||||||
|
* @return The socket itself.
|
||||||
|
*/
|
||||||
|
end(callback?: () => void): this;
|
||||||
|
end(buffer: Uint8Array | string, callback?: () => void): this;
|
||||||
|
end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this;
|
||||||
|
// #region InternalEventEmitter
|
||||||
|
addListener<E extends keyof SocketEventMap>(eventName: E, listener: (...args: SocketEventMap[E]) => void): this;
|
||||||
|
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
emit<E extends keyof SocketEventMap>(eventName: E, ...args: SocketEventMap[E]): boolean;
|
||||||
|
emit(eventName: string | symbol, ...args: any[]): boolean;
|
||||||
|
listenerCount<E extends keyof SocketEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener?: (...args: SocketEventMap[E]) => void,
|
||||||
|
): number;
|
||||||
|
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
||||||
|
listeners<E extends keyof SocketEventMap>(eventName: E): ((...args: SocketEventMap[E]) => void)[];
|
||||||
|
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
||||||
|
off<E extends keyof SocketEventMap>(eventName: E, listener: (...args: SocketEventMap[E]) => void): this;
|
||||||
|
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
on<E extends keyof SocketEventMap>(eventName: E, listener: (...args: SocketEventMap[E]) => void): this;
|
||||||
|
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
once<E extends keyof SocketEventMap>(eventName: E, listener: (...args: SocketEventMap[E]) => void): this;
|
||||||
|
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
prependListener<E extends keyof SocketEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: SocketEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
prependOnceListener<E extends keyof SocketEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: SocketEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
rawListeners<E extends keyof SocketEventMap>(eventName: E): ((...args: SocketEventMap[E]) => void)[];
|
||||||
|
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
||||||
|
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
||||||
|
removeAllListeners<E extends keyof SocketEventMap>(eventName?: E): this;
|
||||||
|
removeAllListeners(eventName?: string | symbol): this;
|
||||||
|
removeListener<E extends keyof SocketEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: SocketEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
// #endregion
|
||||||
|
}
|
||||||
|
interface ListenOptions extends Abortable {
|
||||||
|
backlog?: number | undefined;
|
||||||
|
exclusive?: boolean | undefined;
|
||||||
|
host?: string | undefined;
|
||||||
|
/**
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
ipv6Only?: boolean | undefined;
|
||||||
|
reusePort?: boolean | undefined;
|
||||||
|
path?: string | undefined;
|
||||||
|
port?: number | undefined;
|
||||||
|
readableAll?: boolean | undefined;
|
||||||
|
writableAll?: boolean | undefined;
|
||||||
|
}
|
||||||
|
interface ServerOpts {
|
||||||
|
/**
|
||||||
|
* Indicates whether half-opened TCP connections are allowed.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
allowHalfOpen?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Indicates whether the socket should be paused on incoming connections.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
pauseOnConnect?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received.
|
||||||
|
* @default false
|
||||||
|
* @since v16.5.0
|
||||||
|
*/
|
||||||
|
noDelay?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received,
|
||||||
|
* similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`.
|
||||||
|
* @default false
|
||||||
|
* @since v16.5.0
|
||||||
|
*/
|
||||||
|
keepAlive?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket.
|
||||||
|
* @default 0
|
||||||
|
* @since v16.5.0
|
||||||
|
*/
|
||||||
|
keepAliveInitialDelay?: number | undefined;
|
||||||
|
/**
|
||||||
|
* Optionally overrides all `net.Socket`s' `readableHighWaterMark` and `writableHighWaterMark`.
|
||||||
|
* @default See [stream.getDefaultHighWaterMark()](https://nodejs.org/docs/latest-v25.x/api/stream.html#streamgetdefaulthighwatermarkobjectmode).
|
||||||
|
* @since v18.17.0, v20.1.0
|
||||||
|
*/
|
||||||
|
highWaterMark?: number | undefined;
|
||||||
|
/**
|
||||||
|
* `blockList` can be used for disabling inbound
|
||||||
|
* access to specific IP addresses, IP ranges, or IP subnets. This does not
|
||||||
|
* work if the server is behind a reverse proxy, NAT, etc. because the address
|
||||||
|
* checked against the block list is the address of the proxy, or the one
|
||||||
|
* specified by the NAT.
|
||||||
|
* @since v22.13.0
|
||||||
|
*/
|
||||||
|
blockList?: BlockList | undefined;
|
||||||
|
}
|
||||||
|
interface DropArgument {
|
||||||
|
localAddress?: string;
|
||||||
|
localPort?: number;
|
||||||
|
localFamily?: string;
|
||||||
|
remoteAddress?: string;
|
||||||
|
remotePort?: number;
|
||||||
|
remoteFamily?: string;
|
||||||
|
}
|
||||||
|
interface ServerEventMap {
|
||||||
|
"close": [];
|
||||||
|
"connection": [socket: Socket];
|
||||||
|
"error": [err: Error];
|
||||||
|
"listening": [];
|
||||||
|
"drop": [data?: DropArgument];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This class is used to create a TCP or `IPC` server.
|
||||||
|
* @since v0.1.90
|
||||||
|
*/
|
||||||
|
class Server implements EventEmitter {
|
||||||
|
constructor(connectionListener?: (socket: Socket) => void);
|
||||||
|
constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void);
|
||||||
|
/**
|
||||||
|
* Start a server listening for connections. A `net.Server` can be a TCP or
|
||||||
|
* an `IPC` server depending on what it listens to.
|
||||||
|
*
|
||||||
|
* Possible signatures:
|
||||||
|
*
|
||||||
|
* * `server.listen(handle[, backlog][, callback])`
|
||||||
|
* * `server.listen(options[, callback])`
|
||||||
|
* * `server.listen(path[, backlog][, callback])` for `IPC` servers
|
||||||
|
* * `server.listen([port[, host[, backlog]]][, callback])` for TCP servers
|
||||||
|
*
|
||||||
|
* This function is asynchronous. When the server starts listening, the `'listening'` event will be emitted. The last parameter `callback`will be added as a listener for the `'listening'`
|
||||||
|
* event.
|
||||||
|
*
|
||||||
|
* All `listen()` methods can take a `backlog` parameter to specify the maximum
|
||||||
|
* length of the queue of pending connections. The actual length will be determined
|
||||||
|
* by the OS through sysctl settings such as `tcp_max_syn_backlog` and `somaxconn` on Linux. The default value of this parameter is 511 (not 512).
|
||||||
|
*
|
||||||
|
* All {@link Socket} are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for
|
||||||
|
* details).
|
||||||
|
*
|
||||||
|
* The `server.listen()` method can be called again if and only if there was an
|
||||||
|
* error during the first `server.listen()` call or `server.close()` has been
|
||||||
|
* called. Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown.
|
||||||
|
*
|
||||||
|
* One of the most common errors raised when listening is `EADDRINUSE`.
|
||||||
|
* This happens when another server is already listening on the requested`port`/`path`/`handle`. One way to handle this would be to retry
|
||||||
|
* after a certain amount of time:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* server.on('error', (e) => {
|
||||||
|
* if (e.code === 'EADDRINUSE') {
|
||||||
|
* console.error('Address in use, retrying...');
|
||||||
|
* setTimeout(() => {
|
||||||
|
* server.close();
|
||||||
|
* server.listen(PORT, HOST);
|
||||||
|
* }, 1000);
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this;
|
||||||
|
listen(port?: number, hostname?: string, listeningListener?: () => void): this;
|
||||||
|
listen(port?: number, backlog?: number, listeningListener?: () => void): this;
|
||||||
|
listen(port?: number, listeningListener?: () => void): this;
|
||||||
|
listen(path: string, backlog?: number, listeningListener?: () => void): this;
|
||||||
|
listen(path: string, listeningListener?: () => void): this;
|
||||||
|
listen(options: ListenOptions, listeningListener?: () => void): this;
|
||||||
|
listen(handle: any, backlog?: number, listeningListener?: () => void): this;
|
||||||
|
listen(handle: any, listeningListener?: () => void): this;
|
||||||
|
/**
|
||||||
|
* Stops the server from accepting new connections and keeps existing
|
||||||
|
* connections. This function is asynchronous, the server is finally closed
|
||||||
|
* when all connections are ended and the server emits a `'close'` event.
|
||||||
|
* The optional `callback` will be called once the `'close'` event occurs. Unlike
|
||||||
|
* that event, it will be called with an `Error` as its only argument if the server
|
||||||
|
* was not open when it was closed.
|
||||||
|
* @since v0.1.90
|
||||||
|
* @param callback Called when the server is closed.
|
||||||
|
*/
|
||||||
|
close(callback?: (err?: Error) => void): this;
|
||||||
|
/**
|
||||||
|
* Returns the bound `address`, the address `family` name, and `port` of the server
|
||||||
|
* as reported by the operating system if listening on an IP socket
|
||||||
|
* (useful to find which port was assigned when getting an OS-assigned address):`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`.
|
||||||
|
*
|
||||||
|
* For a server listening on a pipe or Unix domain socket, the name is returned
|
||||||
|
* as a string.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const server = net.createServer((socket) => {
|
||||||
|
* socket.end('goodbye\n');
|
||||||
|
* }).on('error', (err) => {
|
||||||
|
* // Handle errors here.
|
||||||
|
* throw err;
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Grab an arbitrary unused port.
|
||||||
|
* server.listen(() => {
|
||||||
|
* console.log('opened server on', server.address());
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* `server.address()` returns `null` before the `'listening'` event has been
|
||||||
|
* emitted or after calling `server.close()`.
|
||||||
|
* @since v0.1.90
|
||||||
|
*/
|
||||||
|
address(): AddressInfo | string | null;
|
||||||
|
/**
|
||||||
|
* Asynchronously get the number of concurrent connections on the server. Works
|
||||||
|
* when sockets were sent to forks.
|
||||||
|
*
|
||||||
|
* Callback should take two arguments `err` and `count`.
|
||||||
|
* @since v0.9.7
|
||||||
|
*/
|
||||||
|
getConnections(cb: (error: Error | null, count: number) => void): this;
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
ref(): this;
|
||||||
|
/**
|
||||||
|
* Calling `unref()` on a server will allow the program to exit if this is the only
|
||||||
|
* active server in the event system. If the server is already `unref`ed calling`unref()` again will have no effect.
|
||||||
|
* @since v0.9.1
|
||||||
|
*/
|
||||||
|
unref(): this;
|
||||||
|
/**
|
||||||
|
* Set this property to reject connections when the server's connection count gets
|
||||||
|
* high.
|
||||||
|
*
|
||||||
|
* It is not recommended to use this option once a socket has been sent to a child
|
||||||
|
* with `child_process.fork()`.
|
||||||
|
* @since v0.2.0
|
||||||
|
*/
|
||||||
|
maxConnections: number;
|
||||||
|
connections: number;
|
||||||
|
/**
|
||||||
|
* Indicates whether or not the server is listening for connections.
|
||||||
|
* @since v5.7.0
|
||||||
|
*/
|
||||||
|
readonly listening: boolean;
|
||||||
|
/**
|
||||||
|
* Calls {@link Server.close()} and returns a promise that fulfills when the server has closed.
|
||||||
|
* @since v20.5.0
|
||||||
|
*/
|
||||||
|
[Symbol.asyncDispose](): Promise<void>;
|
||||||
|
}
|
||||||
|
interface Server extends InternalEventEmitter<ServerEventMap> {}
|
||||||
|
type IPVersion = "ipv4" | "ipv6";
|
||||||
|
/**
|
||||||
|
* The `BlockList` object can be used with some network APIs to specify rules for
|
||||||
|
* disabling inbound or outbound access to specific IP addresses, IP ranges, or
|
||||||
|
* IP subnets.
|
||||||
|
* @since v15.0.0, v14.18.0
|
||||||
|
*/
|
||||||
|
class BlockList {
|
||||||
|
/**
|
||||||
|
* Adds a rule to block the given IP address.
|
||||||
|
* @since v15.0.0, v14.18.0
|
||||||
|
* @param address An IPv4 or IPv6 address.
|
||||||
|
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
|
||||||
|
*/
|
||||||
|
addAddress(address: string, type?: IPVersion): void;
|
||||||
|
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
|
||||||
|
* @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'`.
|
||||||
|
*/
|
||||||
|
addRange(start: string, end: string, type?: IPVersion): void;
|
||||||
|
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
|
||||||
|
* @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'`.
|
||||||
|
*/
|
||||||
|
addSubnet(net: SocketAddress, prefix: number): void;
|
||||||
|
addSubnet(net: string, prefix: number, type?: IPVersion): void;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the given IP address matches any of the rules added to the`BlockList`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const blockList = new net.BlockList();
|
||||||
|
* blockList.addAddress('123.123.123.123');
|
||||||
|
* blockList.addRange('10.0.0.1', '10.0.0.10');
|
||||||
|
* blockList.addSubnet('8592:757c:efae:4e45::', 64, 'ipv6');
|
||||||
|
*
|
||||||
|
* console.log(blockList.check('123.123.123.123')); // Prints: true
|
||||||
|
* console.log(blockList.check('10.0.0.3')); // Prints: true
|
||||||
|
* console.log(blockList.check('222.111.111.222')); // Prints: false
|
||||||
|
*
|
||||||
|
* // IPv6 notation for IPv4 addresses works:
|
||||||
|
* 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
|
||||||
|
* @param address The IP address to check
|
||||||
|
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
|
||||||
|
*/
|
||||||
|
check(address: SocketAddress): boolean;
|
||||||
|
check(address: string, type?: IPVersion): boolean;
|
||||||
|
/**
|
||||||
|
* The list of rules added to the blocklist.
|
||||||
|
* @since v15.0.0, v14.18.0
|
||||||
|
*/
|
||||||
|
rules: readonly string[];
|
||||||
|
/**
|
||||||
|
* Returns `true` if the `value` is a `net.BlockList`.
|
||||||
|
* @since v22.13.0
|
||||||
|
* @param value Any JS value
|
||||||
|
*/
|
||||||
|
static isBlockList(value: unknown): value is BlockList;
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* const blockList = new net.BlockList();
|
||||||
|
* const data = [
|
||||||
|
* 'Subnet: IPv4 192.168.1.0/24',
|
||||||
|
* 'Address: IPv4 10.0.0.5',
|
||||||
|
* 'Range: IPv4 192.168.2.1-192.168.2.10',
|
||||||
|
* 'Range: IPv4 10.0.0.1-10.0.0.10',
|
||||||
|
* ];
|
||||||
|
* blockList.fromJSON(data);
|
||||||
|
* blockList.fromJSON(JSON.stringify(data));
|
||||||
|
* ```
|
||||||
|
* @since v24.5.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
fromJSON(data: string | readonly string[]): void;
|
||||||
|
/**
|
||||||
|
* @since v24.5.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
toJSON(): readonly string[];
|
||||||
|
}
|
||||||
|
interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts {
|
||||||
|
timeout?: number | undefined;
|
||||||
|
}
|
||||||
|
interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts {
|
||||||
|
timeout?: number | undefined;
|
||||||
|
}
|
||||||
|
type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts;
|
||||||
|
/**
|
||||||
|
* Creates a new TCP or `IPC` server.
|
||||||
|
*
|
||||||
|
* If `allowHalfOpen` is set to `true`, when the other end of the socket
|
||||||
|
* signals the end of transmission, the server will only send back the end of
|
||||||
|
* transmission when `socket.end()` is explicitly called. For example, in the
|
||||||
|
* context of TCP, when a FIN packed is received, a FIN packed is sent
|
||||||
|
* back only when `socket.end()` is explicitly called. Until then the
|
||||||
|
* connection is half-closed (non-readable but still writable). See `'end'` event and [RFC 1122](https://tools.ietf.org/html/rfc1122) (section 4.2.2.13) for more information.
|
||||||
|
*
|
||||||
|
* If `pauseOnConnect` is set to `true`, then the socket associated with each
|
||||||
|
* incoming connection will be paused, and no data will be read from its handle.
|
||||||
|
* This allows connections to be passed between processes without any data being
|
||||||
|
* read by the original process. To begin reading data from a paused socket, call `socket.resume()`.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* on port 8124:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import net from 'node:net';
|
||||||
|
* const server = net.createServer((c) => {
|
||||||
|
* // 'connection' listener.
|
||||||
|
* console.log('client connected');
|
||||||
|
* c.on('end', () => {
|
||||||
|
* console.log('client disconnected');
|
||||||
|
* });
|
||||||
|
* c.write('hello\r\n');
|
||||||
|
* c.pipe(c);
|
||||||
|
* });
|
||||||
|
* server.on('error', (err) => {
|
||||||
|
* throw err;
|
||||||
|
* });
|
||||||
|
* server.listen(8124, () => {
|
||||||
|
* console.log('server bound');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Test this by using `telnet`:
|
||||||
|
*
|
||||||
|
* ```bash
|
||||||
|
* telnet localhost 8124
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To listen on the socket `/tmp/echo.sock`:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* server.listen('/tmp/echo.sock', () => {
|
||||||
|
* console.log('server bound');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Use `nc` to connect to a Unix domain socket server:
|
||||||
|
*
|
||||||
|
* ```bash
|
||||||
|
* nc -U /tmp/echo.sock
|
||||||
|
* ```
|
||||||
|
* @since v0.5.0
|
||||||
|
* @param connectionListener Automatically set as a listener for the {@link 'connection'} event.
|
||||||
|
*/
|
||||||
|
function createServer(connectionListener?: (socket: Socket) => void): Server;
|
||||||
|
function createServer(options?: ServerOpts, connectionListener?: (socket: Socket) => void): Server;
|
||||||
|
/**
|
||||||
|
* Aliases to {@link createConnection}.
|
||||||
|
*
|
||||||
|
* Possible signatures:
|
||||||
|
*
|
||||||
|
* * {@link connect}
|
||||||
|
* * {@link connect} for `IPC` connections.
|
||||||
|
* * {@link connect} for TCP connections.
|
||||||
|
*/
|
||||||
|
function connect(options: NetConnectOpts, connectionListener?: () => void): Socket;
|
||||||
|
function connect(port: number, host?: string, connectionListener?: () => void): Socket;
|
||||||
|
function connect(path: string, connectionListener?: () => void): Socket;
|
||||||
|
/**
|
||||||
|
* A factory function, which creates a new {@link Socket},
|
||||||
|
* immediately initiates connection with `socket.connect()`,
|
||||||
|
* then returns the `net.Socket` that starts the connection.
|
||||||
|
*
|
||||||
|
* When the connection is established, a `'connect'` event will be emitted
|
||||||
|
* on the returned socket. The last parameter `connectListener`, if supplied,
|
||||||
|
* will be added as a listener for the `'connect'` event **once**.
|
||||||
|
*
|
||||||
|
* Possible signatures:
|
||||||
|
*
|
||||||
|
* * {@link createConnection}
|
||||||
|
* * {@link createConnection} for `IPC` connections.
|
||||||
|
* * {@link createConnection} for TCP connections.
|
||||||
|
*
|
||||||
|
* The {@link connect} function is an alias to this function.
|
||||||
|
*/
|
||||||
|
function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket;
|
||||||
|
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)`.
|
||||||
|
* @param value The new default value.
|
||||||
|
* The initial default value is `true`, unless the command line option
|
||||||
|
* `--no-network-family-autoselection` is provided.
|
||||||
|
* @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 `500` or the value specified via the command line option `--network-family-autoselection-attempt-timeout`.
|
||||||
|
* @returns The current default value of the `autoSelectFamilyAttemptTimeout` option.
|
||||||
|
* @since v19.8.0, v18.8.0
|
||||||
|
*/
|
||||||
|
function getDefaultAutoSelectFamilyAttemptTimeout(): number;
|
||||||
|
/**
|
||||||
|
* Sets the default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
|
||||||
|
* @param value The new default value, which must be a positive number. If the number is less than `10`, the value `10` is used instead. The initial default value is `250` or the value specified via the command line
|
||||||
|
* option `--network-family-autoselection-attempt-timeout`.
|
||||||
|
* @since v19.8.0, v18.8.0
|
||||||
|
*/
|
||||||
|
function setDefaultAutoSelectFamilyAttemptTimeout(value: number): void;
|
||||||
|
/**
|
||||||
|
* Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4
|
||||||
|
* address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* net.isIP('::1'); // returns 6
|
||||||
|
* net.isIP('127.0.0.1'); // returns 4
|
||||||
|
* net.isIP('127.000.000.001'); // returns 0
|
||||||
|
* net.isIP('127.0.0.1/24'); // returns 0
|
||||||
|
* net.isIP('fhqwhgads'); // returns 0
|
||||||
|
* ```
|
||||||
|
* @since v0.3.0
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
* ```
|
||||||
|
* @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
|
||||||
|
* ```
|
||||||
|
* @since v0.3.0
|
||||||
|
*/
|
||||||
|
function isIPv6(input: string): boolean;
|
||||||
|
interface SocketAddressInitOptions {
|
||||||
|
/**
|
||||||
|
* The network address as either an IPv4 or IPv6 string.
|
||||||
|
* @default 127.0.0.1
|
||||||
|
*/
|
||||||
|
address?: string | undefined;
|
||||||
|
/**
|
||||||
|
* @default `'ipv4'`
|
||||||
|
*/
|
||||||
|
family?: IPVersion | undefined;
|
||||||
|
/**
|
||||||
|
* An IPv6 flow-label used only if `family` is `'ipv6'`.
|
||||||
|
* @default 0
|
||||||
|
*/
|
||||||
|
flowlabel?: number | undefined;
|
||||||
|
/**
|
||||||
|
* An IP port.
|
||||||
|
* @default 0
|
||||||
|
*/
|
||||||
|
port?: number | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @since v15.14.0, v14.18.0
|
||||||
|
*/
|
||||||
|
class SocketAddress {
|
||||||
|
constructor(options: SocketAddressInitOptions);
|
||||||
|
/**
|
||||||
|
* Either \`'ipv4'\` or \`'ipv6'\`.
|
||||||
|
* @since v15.14.0, v14.18.0
|
||||||
|
*/
|
||||||
|
readonly address: string;
|
||||||
|
/**
|
||||||
|
* Either \`'ipv4'\` or \`'ipv6'\`.
|
||||||
|
* @since v15.14.0, v14.18.0
|
||||||
|
*/
|
||||||
|
readonly family: IPVersion;
|
||||||
|
/**
|
||||||
|
* @since v15.14.0, v14.18.0
|
||||||
|
*/
|
||||||
|
readonly port: number;
|
||||||
|
/**
|
||||||
|
* @since v15.14.0, v14.18.0
|
||||||
|
*/
|
||||||
|
readonly flowlabel: number;
|
||||||
|
/**
|
||||||
|
* @since v22.13.0
|
||||||
|
* @param input An input string containing an IP address and optional port,
|
||||||
|
* e.g. `123.1.2.3:1234` or `[1::1]:1234`.
|
||||||
|
* @returns Returns a `SocketAddress` if parsing was successful.
|
||||||
|
* Otherwise returns `undefined`.
|
||||||
|
*/
|
||||||
|
static parse(input: string): SocketAddress | undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module "net" {
|
||||||
|
export * from "node:net";
|
||||||
|
}
|
||||||
507
node_modules/@types/node/os.d.ts
generated
vendored
Normal file
507
node_modules/@types/node/os.d.ts
generated
vendored
Normal file
@ -0,0 +1,507 @@
|
|||||||
|
/**
|
||||||
|
* The `node:os` module provides operating system-related utility methods and
|
||||||
|
* properties. It can be accessed using:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import os from 'node:os';
|
||||||
|
* ```
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/os.js)
|
||||||
|
*/
|
||||||
|
declare module "node:os" {
|
||||||
|
import { NonSharedBuffer } from "buffer";
|
||||||
|
interface CpuInfo {
|
||||||
|
model: string;
|
||||||
|
speed: number;
|
||||||
|
times: {
|
||||||
|
/** The number of milliseconds the CPU has spent in user mode. */
|
||||||
|
user: number;
|
||||||
|
/** The number of milliseconds the CPU has spent in nice mode. */
|
||||||
|
nice: number;
|
||||||
|
/** The number of milliseconds the CPU has spent in sys mode. */
|
||||||
|
sys: number;
|
||||||
|
/** The number of milliseconds the CPU has spent in idle mode. */
|
||||||
|
idle: number;
|
||||||
|
/** The number of milliseconds the CPU has spent in irq mode. */
|
||||||
|
irq: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
interface NetworkInterfaceBase {
|
||||||
|
address: string;
|
||||||
|
netmask: string;
|
||||||
|
mac: string;
|
||||||
|
internal: boolean;
|
||||||
|
cidr: string | null;
|
||||||
|
scopeid?: number;
|
||||||
|
}
|
||||||
|
interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase {
|
||||||
|
family: "IPv4";
|
||||||
|
}
|
||||||
|
interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase {
|
||||||
|
family: "IPv6";
|
||||||
|
scopeid: number;
|
||||||
|
}
|
||||||
|
interface UserInfo<T> {
|
||||||
|
username: T;
|
||||||
|
uid: number;
|
||||||
|
gid: number;
|
||||||
|
shell: T | null;
|
||||||
|
homedir: T;
|
||||||
|
}
|
||||||
|
type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6;
|
||||||
|
/**
|
||||||
|
* Returns the host name of the operating system as a string.
|
||||||
|
* @since v0.3.3
|
||||||
|
*/
|
||||||
|
function hostname(): string;
|
||||||
|
/**
|
||||||
|
* Returns an array containing the 1, 5, and 15 minute load averages.
|
||||||
|
*
|
||||||
|
* The load average is a measure of system activity calculated by the operating
|
||||||
|
* system and expressed as a fractional number.
|
||||||
|
*
|
||||||
|
* The load average is a Unix-specific concept. On Windows, the return value is
|
||||||
|
* always `[0, 0, 0]`.
|
||||||
|
* @since v0.3.3
|
||||||
|
*/
|
||||||
|
function loadavg(): number[];
|
||||||
|
/**
|
||||||
|
* Returns the system uptime in number of seconds.
|
||||||
|
* @since v0.3.3
|
||||||
|
*/
|
||||||
|
function uptime(): number;
|
||||||
|
/**
|
||||||
|
* Returns the amount of free system memory in bytes as an integer.
|
||||||
|
* @since v0.3.3
|
||||||
|
*/
|
||||||
|
function freemem(): number;
|
||||||
|
/**
|
||||||
|
* Returns the total amount of system memory in bytes as an integer.
|
||||||
|
* @since v0.3.3
|
||||||
|
*/
|
||||||
|
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:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* [
|
||||||
|
* {
|
||||||
|
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
|
||||||
|
* speed: 2926,
|
||||||
|
* times: {
|
||||||
|
* user: 252020,
|
||||||
|
* nice: 0,
|
||||||
|
* sys: 30340,
|
||||||
|
* idle: 1070356870,
|
||||||
|
* irq: 0,
|
||||||
|
* },
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
|
||||||
|
* speed: 2926,
|
||||||
|
* times: {
|
||||||
|
* user: 306960,
|
||||||
|
* nice: 0,
|
||||||
|
* sys: 26980,
|
||||||
|
* idle: 1071569080,
|
||||||
|
* irq: 0,
|
||||||
|
* },
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
|
||||||
|
* speed: 2926,
|
||||||
|
* times: {
|
||||||
|
* user: 248450,
|
||||||
|
* nice: 0,
|
||||||
|
* sys: 21750,
|
||||||
|
* idle: 1070919370,
|
||||||
|
* irq: 0,
|
||||||
|
* },
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
|
||||||
|
* speed: 2926,
|
||||||
|
* times: {
|
||||||
|
* user: 256880,
|
||||||
|
* nice: 0,
|
||||||
|
* sys: 19430,
|
||||||
|
* idle: 1070905480,
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for additional information
|
||||||
|
* about the output of running [`uname(3)`](https://linux.die.net/man/3/uname) on various operating systems.
|
||||||
|
* @since v0.3.3
|
||||||
|
*/
|
||||||
|
function type(): string;
|
||||||
|
/**
|
||||||
|
* Returns the operating system as a string.
|
||||||
|
*
|
||||||
|
* On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `GetVersionExW()` is used. See
|
||||||
|
* [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
|
||||||
|
* @since v0.3.3
|
||||||
|
*/
|
||||||
|
function release(): string;
|
||||||
|
/**
|
||||||
|
* Returns an object containing network interfaces that have been assigned a
|
||||||
|
* network address.
|
||||||
|
*
|
||||||
|
* Each key on the returned object identifies a network interface. The associated
|
||||||
|
* value is an array of objects that each describe an assigned network address.
|
||||||
|
*
|
||||||
|
* The properties available on the assigned network address object include:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* lo: [
|
||||||
|
* {
|
||||||
|
* address: '127.0.0.1',
|
||||||
|
* netmask: '255.0.0.0',
|
||||||
|
* family: 'IPv4',
|
||||||
|
* mac: '00:00:00:00:00:00',
|
||||||
|
* internal: true,
|
||||||
|
* cidr: '127.0.0.1/8'
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* address: '::1',
|
||||||
|
* netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
|
||||||
|
* family: 'IPv6',
|
||||||
|
* mac: '00:00:00:00:00:00',
|
||||||
|
* scopeid: 0,
|
||||||
|
* internal: true,
|
||||||
|
* cidr: '::1/128'
|
||||||
|
* }
|
||||||
|
* ],
|
||||||
|
* eth0: [
|
||||||
|
* {
|
||||||
|
* address: '192.168.1.108',
|
||||||
|
* netmask: '255.255.255.0',
|
||||||
|
* family: 'IPv4',
|
||||||
|
* mac: '01:02:03:0a:0b:0c',
|
||||||
|
* internal: false,
|
||||||
|
* cidr: '192.168.1.108/24'
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* address: 'fe80::a00:27ff:fe4e:66a1',
|
||||||
|
* netmask: 'ffff:ffff:ffff:ffff::',
|
||||||
|
* family: 'IPv6',
|
||||||
|
* mac: '01:02:03:0a:0b:0c',
|
||||||
|
* scopeid: 1,
|
||||||
|
* internal: false,
|
||||||
|
* cidr: 'fe80::a00:27ff:fe4e:66a1/64'
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.6.0
|
||||||
|
*/
|
||||||
|
function networkInterfaces(): NodeJS.Dict<NetworkInterfaceInfo[]>;
|
||||||
|
/**
|
||||||
|
* Returns the string path of the current user's home directory.
|
||||||
|
*
|
||||||
|
* On POSIX, it uses the `$HOME` environment variable if defined. Otherwise it
|
||||||
|
* uses the [effective UID](https://en.wikipedia.org/wiki/User_identifier#Effective_user_ID) to look up the user's home directory.
|
||||||
|
*
|
||||||
|
* On Windows, it uses the `USERPROFILE` environment variable if defined.
|
||||||
|
* Otherwise it uses the path to the profile directory of the current user.
|
||||||
|
* @since v2.3.0
|
||||||
|
*/
|
||||||
|
function homedir(): string;
|
||||||
|
interface UserInfoOptions {
|
||||||
|
encoding?: BufferEncoding | "buffer" | undefined;
|
||||||
|
}
|
||||||
|
interface UserInfoOptionsWithBufferEncoding extends UserInfoOptions {
|
||||||
|
encoding: "buffer";
|
||||||
|
}
|
||||||
|
interface UserInfoOptionsWithStringEncoding extends UserInfoOptions {
|
||||||
|
encoding?: BufferEncoding | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns information about the currently effective user. On POSIX platforms,
|
||||||
|
* this is typically a subset of the password file. The returned object includes
|
||||||
|
* the `username`, `uid`, `gid`, `shell`, and `homedir`. On Windows, the `uid` and `gid` fields are `-1`, and `shell` is `null`.
|
||||||
|
*
|
||||||
|
* The value of `homedir` returned by `os.userInfo()` is provided by the operating
|
||||||
|
* system. This differs from the result of `os.homedir()`, which queries
|
||||||
|
* environment variables for the home directory before falling back to the
|
||||||
|
* operating system response.
|
||||||
|
*
|
||||||
|
* Throws a [`SystemError`](https://nodejs.org/docs/latest-v25.x/api/errors.html#class-systemerror) if a user has no `username` or `homedir`.
|
||||||
|
* @since v6.0.0
|
||||||
|
*/
|
||||||
|
function userInfo(options?: UserInfoOptionsWithStringEncoding): UserInfo<string>;
|
||||||
|
function userInfo(options: UserInfoOptionsWithBufferEncoding): UserInfo<NonSharedBuffer>;
|
||||||
|
function userInfo(options: UserInfoOptions): UserInfo<string | NonSharedBuffer>;
|
||||||
|
type SignalConstants = {
|
||||||
|
[key in NodeJS.Signals]: number;
|
||||||
|
};
|
||||||
|
namespace constants {
|
||||||
|
const UV_UDP_REUSEADDR: number;
|
||||||
|
namespace signals {}
|
||||||
|
const signals: SignalConstants;
|
||||||
|
namespace errno {
|
||||||
|
const E2BIG: number;
|
||||||
|
const EACCES: number;
|
||||||
|
const EADDRINUSE: number;
|
||||||
|
const EADDRNOTAVAIL: number;
|
||||||
|
const EAFNOSUPPORT: number;
|
||||||
|
const EAGAIN: number;
|
||||||
|
const EALREADY: number;
|
||||||
|
const EBADF: number;
|
||||||
|
const EBADMSG: number;
|
||||||
|
const EBUSY: number;
|
||||||
|
const ECANCELED: number;
|
||||||
|
const ECHILD: number;
|
||||||
|
const ECONNABORTED: number;
|
||||||
|
const ECONNREFUSED: number;
|
||||||
|
const ECONNRESET: number;
|
||||||
|
const EDEADLK: number;
|
||||||
|
const EDESTADDRREQ: number;
|
||||||
|
const EDOM: number;
|
||||||
|
const EDQUOT: number;
|
||||||
|
const EEXIST: number;
|
||||||
|
const EFAULT: number;
|
||||||
|
const EFBIG: number;
|
||||||
|
const EHOSTUNREACH: number;
|
||||||
|
const EIDRM: number;
|
||||||
|
const EILSEQ: number;
|
||||||
|
const EINPROGRESS: number;
|
||||||
|
const EINTR: number;
|
||||||
|
const EINVAL: number;
|
||||||
|
const EIO: number;
|
||||||
|
const EISCONN: number;
|
||||||
|
const EISDIR: number;
|
||||||
|
const ELOOP: number;
|
||||||
|
const EMFILE: number;
|
||||||
|
const EMLINK: number;
|
||||||
|
const EMSGSIZE: number;
|
||||||
|
const EMULTIHOP: number;
|
||||||
|
const ENAMETOOLONG: number;
|
||||||
|
const ENETDOWN: number;
|
||||||
|
const ENETRESET: number;
|
||||||
|
const ENETUNREACH: number;
|
||||||
|
const ENFILE: number;
|
||||||
|
const ENOBUFS: number;
|
||||||
|
const ENODATA: number;
|
||||||
|
const ENODEV: number;
|
||||||
|
const ENOENT: number;
|
||||||
|
const ENOEXEC: number;
|
||||||
|
const ENOLCK: number;
|
||||||
|
const ENOLINK: number;
|
||||||
|
const ENOMEM: number;
|
||||||
|
const ENOMSG: number;
|
||||||
|
const ENOPROTOOPT: number;
|
||||||
|
const ENOSPC: number;
|
||||||
|
const ENOSR: number;
|
||||||
|
const ENOSTR: number;
|
||||||
|
const ENOSYS: number;
|
||||||
|
const ENOTCONN: number;
|
||||||
|
const ENOTDIR: number;
|
||||||
|
const ENOTEMPTY: number;
|
||||||
|
const ENOTSOCK: number;
|
||||||
|
const ENOTSUP: number;
|
||||||
|
const ENOTTY: number;
|
||||||
|
const ENXIO: number;
|
||||||
|
const EOPNOTSUPP: number;
|
||||||
|
const EOVERFLOW: number;
|
||||||
|
const EPERM: number;
|
||||||
|
const EPIPE: number;
|
||||||
|
const EPROTO: number;
|
||||||
|
const EPROTONOSUPPORT: number;
|
||||||
|
const EPROTOTYPE: number;
|
||||||
|
const ERANGE: number;
|
||||||
|
const EROFS: number;
|
||||||
|
const ESPIPE: number;
|
||||||
|
const ESRCH: number;
|
||||||
|
const ESTALE: number;
|
||||||
|
const ETIME: number;
|
||||||
|
const ETIMEDOUT: number;
|
||||||
|
const ETXTBSY: number;
|
||||||
|
const EWOULDBLOCK: number;
|
||||||
|
const EXDEV: number;
|
||||||
|
const WSAEINTR: number;
|
||||||
|
const WSAEBADF: number;
|
||||||
|
const WSAEACCES: number;
|
||||||
|
const WSAEFAULT: number;
|
||||||
|
const WSAEINVAL: number;
|
||||||
|
const WSAEMFILE: number;
|
||||||
|
const WSAEWOULDBLOCK: number;
|
||||||
|
const WSAEINPROGRESS: number;
|
||||||
|
const WSAEALREADY: number;
|
||||||
|
const WSAENOTSOCK: number;
|
||||||
|
const WSAEDESTADDRREQ: number;
|
||||||
|
const WSAEMSGSIZE: number;
|
||||||
|
const WSAEPROTOTYPE: number;
|
||||||
|
const WSAENOPROTOOPT: number;
|
||||||
|
const WSAEPROTONOSUPPORT: number;
|
||||||
|
const WSAESOCKTNOSUPPORT: number;
|
||||||
|
const WSAEOPNOTSUPP: number;
|
||||||
|
const WSAEPFNOSUPPORT: number;
|
||||||
|
const WSAEAFNOSUPPORT: number;
|
||||||
|
const WSAEADDRINUSE: number;
|
||||||
|
const WSAEADDRNOTAVAIL: number;
|
||||||
|
const WSAENETDOWN: number;
|
||||||
|
const WSAENETUNREACH: number;
|
||||||
|
const WSAENETRESET: number;
|
||||||
|
const WSAECONNABORTED: number;
|
||||||
|
const WSAECONNRESET: number;
|
||||||
|
const WSAENOBUFS: number;
|
||||||
|
const WSAEISCONN: number;
|
||||||
|
const WSAENOTCONN: number;
|
||||||
|
const WSAESHUTDOWN: number;
|
||||||
|
const WSAETOOMANYREFS: number;
|
||||||
|
const WSAETIMEDOUT: number;
|
||||||
|
const WSAECONNREFUSED: number;
|
||||||
|
const WSAELOOP: number;
|
||||||
|
const WSAENAMETOOLONG: number;
|
||||||
|
const WSAEHOSTDOWN: number;
|
||||||
|
const WSAEHOSTUNREACH: number;
|
||||||
|
const WSAENOTEMPTY: number;
|
||||||
|
const WSAEPROCLIM: number;
|
||||||
|
const WSAEUSERS: number;
|
||||||
|
const WSAEDQUOT: number;
|
||||||
|
const WSAESTALE: number;
|
||||||
|
const WSAEREMOTE: number;
|
||||||
|
const WSASYSNOTREADY: number;
|
||||||
|
const WSAVERNOTSUPPORTED: number;
|
||||||
|
const WSANOTINITIALISED: number;
|
||||||
|
const WSAEDISCON: number;
|
||||||
|
const WSAENOMORE: number;
|
||||||
|
const WSAECANCELLED: number;
|
||||||
|
const WSAEINVALIDPROCTABLE: number;
|
||||||
|
const WSAEINVALIDPROVIDER: number;
|
||||||
|
const WSAEPROVIDERFAILEDINIT: number;
|
||||||
|
const WSASYSCALLFAILURE: number;
|
||||||
|
const WSASERVICE_NOT_FOUND: number;
|
||||||
|
const WSATYPE_NOT_FOUND: number;
|
||||||
|
const WSA_E_NO_MORE: number;
|
||||||
|
const WSA_E_CANCELLED: number;
|
||||||
|
const WSAEREFUSED: number;
|
||||||
|
}
|
||||||
|
namespace dlopen {
|
||||||
|
const RTLD_LAZY: number;
|
||||||
|
const RTLD_NOW: number;
|
||||||
|
const RTLD_GLOBAL: number;
|
||||||
|
const RTLD_LOCAL: number;
|
||||||
|
const RTLD_DEEPBIND: number;
|
||||||
|
}
|
||||||
|
namespace priority {
|
||||||
|
const PRIORITY_LOW: number;
|
||||||
|
const PRIORITY_BELOW_NORMAL: number;
|
||||||
|
const PRIORITY_NORMAL: number;
|
||||||
|
const PRIORITY_ABOVE_NORMAL: number;
|
||||||
|
const PRIORITY_HIGH: number;
|
||||||
|
const PRIORITY_HIGHEST: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const devNull: string;
|
||||||
|
/**
|
||||||
|
* The operating system-specific end-of-line marker.
|
||||||
|
* * `\n` on POSIX
|
||||||
|
* * `\r\n` on Windows
|
||||||
|
*/
|
||||||
|
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'`, `'ppc64'`, `'riscv64'`, `'s390x'`, and `'x64'`.
|
||||||
|
*
|
||||||
|
* The return value is equivalent to [process.arch](https://nodejs.org/docs/latest-v25.x/api/process.html#processarch).
|
||||||
|
* @since v0.5.0
|
||||||
|
*/
|
||||||
|
function arch(): NodeJS.Architecture;
|
||||||
|
/**
|
||||||
|
* Returns a string identifying the kernel version.
|
||||||
|
*
|
||||||
|
* On POSIX systems, the operating system release 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 v13.11.0, v12.17.0
|
||||||
|
*/
|
||||||
|
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'`.
|
||||||
|
*
|
||||||
|
* The return value is equivalent to `process.platform`.
|
||||||
|
*
|
||||||
|
* The value `'android'` may also be returned if Node.js is built on the Android
|
||||||
|
* operating system. [Android support is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-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`, `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.
|
||||||
|
* @since v0.9.9
|
||||||
|
*/
|
||||||
|
function tmpdir(): string;
|
||||||
|
/**
|
||||||
|
* Returns a string identifying the endianness of the CPU for which the Node.js
|
||||||
|
* binary was compiled.
|
||||||
|
*
|
||||||
|
* Possible values are `'BE'` for big endian and `'LE'` for little endian.
|
||||||
|
* @since v0.9.4
|
||||||
|
*/
|
||||||
|
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.
|
||||||
|
* @since v10.10.0
|
||||||
|
* @param [pid=0] The process ID to retrieve scheduling priority for.
|
||||||
|
*/
|
||||||
|
function getPriority(pid?: number): number;
|
||||||
|
/**
|
||||||
|
* Attempts to set the scheduling priority for the process specified by `pid`. If `pid` is not provided or is `0`, the process ID of the current process is used.
|
||||||
|
*
|
||||||
|
* The `priority` input must be an integer between `-20` (high priority) and `19` (low priority). Due to differences between Unix priority levels and Windows
|
||||||
|
* priority classes, `priority` is mapped to one of six priority constants in `os.constants.priority`. When retrieving a process priority level, this range
|
||||||
|
* mapping may cause the return value to be slightly different on Windows. To avoid
|
||||||
|
* confusion, set `priority` to one of the priority constants.
|
||||||
|
*
|
||||||
|
* On Windows, setting priority to `PRIORITY_HIGHEST` requires elevated user
|
||||||
|
* privileges. Otherwise the set priority will be silently reduced to `PRIORITY_HIGH`.
|
||||||
|
* @since v10.10.0
|
||||||
|
* @param [pid=0] The process ID to set scheduling priority for.
|
||||||
|
* @param priority The scheduling priority to assign to the process.
|
||||||
|
*/
|
||||||
|
function setPriority(priority: number): void;
|
||||||
|
function setPriority(pid: number, priority: number): void;
|
||||||
|
}
|
||||||
|
declare module "os" {
|
||||||
|
export * from "node:os";
|
||||||
|
}
|
||||||
155
node_modules/@types/node/package.json
generated
vendored
Normal file
155
node_modules/@types/node/package.json
generated
vendored
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
{
|
||||||
|
"name": "@types/node",
|
||||||
|
"version": "25.5.0",
|
||||||
|
"description": "TypeScript definitions for node",
|
||||||
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
||||||
|
"license": "MIT",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Microsoft TypeScript",
|
||||||
|
"githubUsername": "Microsoft",
|
||||||
|
"url": "https://github.com/Microsoft"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Alberto Schiabel",
|
||||||
|
"githubUsername": "jkomyno",
|
||||||
|
"url": "https://github.com/jkomyno"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Andrew Makarov",
|
||||||
|
"githubUsername": "r3nya",
|
||||||
|
"url": "https://github.com/r3nya"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Benjamin Toueg",
|
||||||
|
"githubUsername": "btoueg",
|
||||||
|
"url": "https://github.com/btoueg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "David Junger",
|
||||||
|
"githubUsername": "touffy",
|
||||||
|
"url": "https://github.com/touffy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Mohsen Azimi",
|
||||||
|
"githubUsername": "mohsen1",
|
||||||
|
"url": "https://github.com/mohsen1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Nikita Galkin",
|
||||||
|
"githubUsername": "galkin",
|
||||||
|
"url": "https://github.com/galkin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Sebastian Silbermann",
|
||||||
|
"githubUsername": "eps1lon",
|
||||||
|
"url": "https://github.com/eps1lon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Wilco Bakker",
|
||||||
|
"githubUsername": "WilcoBakker",
|
||||||
|
"url": "https://github.com/WilcoBakker"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Marcin Kopacz",
|
||||||
|
"githubUsername": "chyzwar",
|
||||||
|
"url": "https://github.com/chyzwar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Trivikram Kamat",
|
||||||
|
"githubUsername": "trivikr",
|
||||||
|
"url": "https://github.com/trivikr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Junxiao Shi",
|
||||||
|
"githubUsername": "yoursunny",
|
||||||
|
"url": "https://github.com/yoursunny"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Ilia Baryshnikov",
|
||||||
|
"githubUsername": "qwelias",
|
||||||
|
"url": "https://github.com/qwelias"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ExE Boss",
|
||||||
|
"githubUsername": "ExE-Boss",
|
||||||
|
"url": "https://github.com/ExE-Boss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Piotr Błażejewicz",
|
||||||
|
"githubUsername": "peterblazejewicz",
|
||||||
|
"url": "https://github.com/peterblazejewicz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Anna Henningsen",
|
||||||
|
"githubUsername": "addaleax",
|
||||||
|
"url": "https://github.com/addaleax"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Victor Perin",
|
||||||
|
"githubUsername": "victorperin",
|
||||||
|
"url": "https://github.com/victorperin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "NodeJS Contributors",
|
||||||
|
"githubUsername": "NodeJS",
|
||||||
|
"url": "https://github.com/NodeJS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Linus Unnebäck",
|
||||||
|
"githubUsername": "LinusU",
|
||||||
|
"url": "https://github.com/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"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "René",
|
||||||
|
"githubUsername": "Renegade334",
|
||||||
|
"url": "https://github.com/Renegade334"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Yagiz Nizipli",
|
||||||
|
"githubUsername": "anonrig",
|
||||||
|
"url": "https://github.com/anonrig"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"main": "",
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"typesVersions": {
|
||||||
|
"<=5.6": {
|
||||||
|
"*": [
|
||||||
|
"ts5.6/*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"<=5.7": {
|
||||||
|
"*": [
|
||||||
|
"ts5.7/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||||
|
"directory": "types/node"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~7.18.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {},
|
||||||
|
"typesPublisherContentHash": "4b6968335abe1dc64bd6086fd546d6e9c50f986c37d49de8073f4ed1c900057c",
|
||||||
|
"typeScriptVersion": "5.2"
|
||||||
|
}
|
||||||
187
node_modules/@types/node/path.d.ts
generated
vendored
Normal file
187
node_modules/@types/node/path.d.ts
generated
vendored
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
/**
|
||||||
|
* The `node:path` module provides utilities for working with file and directory
|
||||||
|
* paths. It can be accessed using:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import path from 'node:path';
|
||||||
|
* ```
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/path.js)
|
||||||
|
*/
|
||||||
|
declare module "node:path" {
|
||||||
|
namespace path {
|
||||||
|
/**
|
||||||
|
* A parsed path object generated by path.parse() or consumed by path.format().
|
||||||
|
*/
|
||||||
|
interface ParsedPath {
|
||||||
|
/**
|
||||||
|
* The root of the path such as '/' or 'c:\'
|
||||||
|
*/
|
||||||
|
root: string;
|
||||||
|
/**
|
||||||
|
* The full directory path such as '/home/user/dir' or 'c:\path\dir'
|
||||||
|
*/
|
||||||
|
dir: string;
|
||||||
|
/**
|
||||||
|
* The file name including extension (if any) such as 'index.html'
|
||||||
|
*/
|
||||||
|
base: string;
|
||||||
|
/**
|
||||||
|
* The file extension (if any) such as '.html'
|
||||||
|
*/
|
||||||
|
ext: string;
|
||||||
|
/**
|
||||||
|
* The file name without extension (if any) such as 'index'
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
interface FormatInputPathObject {
|
||||||
|
/**
|
||||||
|
* The root of the path such as '/' or 'c:\'
|
||||||
|
*/
|
||||||
|
root?: string | undefined;
|
||||||
|
/**
|
||||||
|
* The full directory path such as '/home/user/dir' or 'c:\path\dir'
|
||||||
|
*/
|
||||||
|
dir?: string | undefined;
|
||||||
|
/**
|
||||||
|
* The file name including extension (if any) such as 'index.html'
|
||||||
|
*/
|
||||||
|
base?: string | undefined;
|
||||||
|
/**
|
||||||
|
* The file extension (if any) such as '.html'
|
||||||
|
*/
|
||||||
|
ext?: string | undefined;
|
||||||
|
/**
|
||||||
|
* The file name without extension (if any) such as 'index'
|
||||||
|
*/
|
||||||
|
name?: string | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Normalize a string path, reducing '..' and '.' parts.
|
||||||
|
* When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. If the path is a zero-length string, '.' is returned, representing the current working directory.
|
||||||
|
*
|
||||||
|
* @param path string path to normalize.
|
||||||
|
* @throws {TypeError} if `path` is not a string.
|
||||||
|
*/
|
||||||
|
function normalize(path: string): string;
|
||||||
|
/**
|
||||||
|
* Join all arguments together and normalize the resulting path.
|
||||||
|
*
|
||||||
|
* @param paths paths to join.
|
||||||
|
* @throws {TypeError} if any of the path segments is not a string.
|
||||||
|
*/
|
||||||
|
function join(...paths: string[]): string;
|
||||||
|
/**
|
||||||
|
* The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
|
||||||
|
*
|
||||||
|
* Starting from leftmost {from} parameter, resolves {to} to an absolute path.
|
||||||
|
*
|
||||||
|
* If {to} isn't already absolute, {from} arguments are prepended in right to left order,
|
||||||
|
* until an absolute path is found. If after using all {from} paths still no absolute path is found,
|
||||||
|
* the current working directory is used as well. The resulting path is normalized,
|
||||||
|
* and trailing slashes are removed unless the path gets resolved to the root directory.
|
||||||
|
*
|
||||||
|
* @param paths A sequence of paths or path segments.
|
||||||
|
* @throws {TypeError} if any of the arguments is not a string.
|
||||||
|
*/
|
||||||
|
function resolve(...paths: string[]): string;
|
||||||
|
/**
|
||||||
|
* The `path.matchesGlob()` method determines if `path` matches the `pattern`.
|
||||||
|
* @param path The path to glob-match against.
|
||||||
|
* @param pattern The glob to check the path against.
|
||||||
|
* @returns Whether or not the `path` matched the `pattern`.
|
||||||
|
* @throws {TypeError} if `path` or `pattern` are not strings.
|
||||||
|
* @since v22.5.0
|
||||||
|
*/
|
||||||
|
function matchesGlob(path: string, pattern: string): boolean;
|
||||||
|
/**
|
||||||
|
* Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
|
||||||
|
*
|
||||||
|
* If the given {path} is a zero-length string, `false` will be returned.
|
||||||
|
*
|
||||||
|
* @param path path to test.
|
||||||
|
* @throws {TypeError} if `path` is not a string.
|
||||||
|
*/
|
||||||
|
function isAbsolute(path: string): boolean;
|
||||||
|
/**
|
||||||
|
* Solve the relative path from {from} to {to} based on the current working directory.
|
||||||
|
* At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
|
||||||
|
*
|
||||||
|
* @throws {TypeError} if either `from` or `to` is not a string.
|
||||||
|
*/
|
||||||
|
function relative(from: string, to: string): string;
|
||||||
|
/**
|
||||||
|
* Return the directory name of a path. Similar to the Unix dirname command.
|
||||||
|
*
|
||||||
|
* @param path the path to evaluate.
|
||||||
|
* @throws {TypeError} if `path` is not a string.
|
||||||
|
*/
|
||||||
|
function dirname(path: string): string;
|
||||||
|
/**
|
||||||
|
* Return the last portion of a path. Similar to the Unix basename command.
|
||||||
|
* Often used to extract the file name from a fully qualified path.
|
||||||
|
*
|
||||||
|
* @param path the path to evaluate.
|
||||||
|
* @param suffix optionally, an extension to remove from the result.
|
||||||
|
* @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string.
|
||||||
|
*/
|
||||||
|
function basename(path: string, suffix?: string): string;
|
||||||
|
/**
|
||||||
|
* Return the extension of the path, from the last '.' to end of string in the last portion of the path.
|
||||||
|
* If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.
|
||||||
|
*
|
||||||
|
* @param path the path to evaluate.
|
||||||
|
* @throws {TypeError} if `path` is not a string.
|
||||||
|
*/
|
||||||
|
function extname(path: string): string;
|
||||||
|
/**
|
||||||
|
* The platform-specific file separator. '\\' or '/'.
|
||||||
|
*/
|
||||||
|
const sep: "\\" | "/";
|
||||||
|
/**
|
||||||
|
* The platform-specific file delimiter. ';' or ':'.
|
||||||
|
*/
|
||||||
|
const delimiter: ";" | ":";
|
||||||
|
/**
|
||||||
|
* Returns an object from a path string - the opposite of format().
|
||||||
|
*
|
||||||
|
* @param path path to evaluate.
|
||||||
|
* @throws {TypeError} if `path` is not a string.
|
||||||
|
*/
|
||||||
|
function parse(path: string): ParsedPath;
|
||||||
|
/**
|
||||||
|
* Returns a path string from an object - the opposite of parse().
|
||||||
|
*
|
||||||
|
* @param pathObject path to evaluate.
|
||||||
|
*/
|
||||||
|
function format(pathObject: FormatInputPathObject): string;
|
||||||
|
/**
|
||||||
|
* On Windows systems only, returns an equivalent namespace-prefixed path for the given path.
|
||||||
|
* If path is not a string, path will be returned without modifications.
|
||||||
|
* This method is meaningful only on Windows system.
|
||||||
|
* On POSIX systems, the method is non-operational and always returns path without modifications.
|
||||||
|
*/
|
||||||
|
function toNamespacedPath(path: string): string;
|
||||||
|
}
|
||||||
|
namespace path {
|
||||||
|
export {
|
||||||
|
/**
|
||||||
|
* The `path.posix` property provides access to POSIX specific implementations of the `path` methods.
|
||||||
|
*
|
||||||
|
* The API is accessible via `require('node:path').posix` or `require('node:path/posix')`.
|
||||||
|
*/
|
||||||
|
path as posix,
|
||||||
|
/**
|
||||||
|
* The `path.win32` property provides access to Windows-specific implementations of the `path` methods.
|
||||||
|
*
|
||||||
|
* The API is accessible via `require('node:path').win32` or `require('node:path/win32')`.
|
||||||
|
*/
|
||||||
|
path as win32,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export = path;
|
||||||
|
}
|
||||||
|
declare module "path" {
|
||||||
|
import path = require("node:path");
|
||||||
|
export = path;
|
||||||
|
}
|
||||||
8
node_modules/@types/node/path/posix.d.ts
generated
vendored
Normal file
8
node_modules/@types/node/path/posix.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
declare module "node:path/posix" {
|
||||||
|
import path = require("node:path");
|
||||||
|
export = path.posix;
|
||||||
|
}
|
||||||
|
declare module "path/posix" {
|
||||||
|
import path = require("path");
|
||||||
|
export = path.posix;
|
||||||
|
}
|
||||||
8
node_modules/@types/node/path/win32.d.ts
generated
vendored
Normal file
8
node_modules/@types/node/path/win32.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
declare module "node:path/win32" {
|
||||||
|
import path = require("node:path");
|
||||||
|
export = path.win32;
|
||||||
|
}
|
||||||
|
declare module "path/win32" {
|
||||||
|
import path = require("path");
|
||||||
|
export = path.win32;
|
||||||
|
}
|
||||||
643
node_modules/@types/node/perf_hooks.d.ts
generated
vendored
Normal file
643
node_modules/@types/node/perf_hooks.d.ts
generated
vendored
Normal file
@ -0,0 +1,643 @@
|
|||||||
|
/**
|
||||||
|
* This module provides an implementation of a subset of the W3C [Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for
|
||||||
|
* Node.js-specific performance measurements.
|
||||||
|
*
|
||||||
|
* Node.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/):
|
||||||
|
*
|
||||||
|
* * [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
|
||||||
|
* import { PerformanceObserver, performance } from 'node:perf_hooks';
|
||||||
|
*
|
||||||
|
* const obs = new PerformanceObserver((items) => {
|
||||||
|
* console.log(items.getEntries()[0].duration);
|
||||||
|
* performance.clearMarks();
|
||||||
|
* });
|
||||||
|
* obs.observe({ type: 'measure' });
|
||||||
|
* performance.measure('Start to Now');
|
||||||
|
*
|
||||||
|
* performance.mark('A');
|
||||||
|
* doSomeLongRunningProcess(() => {
|
||||||
|
* performance.measure('A to Now', 'A');
|
||||||
|
*
|
||||||
|
* performance.mark('B');
|
||||||
|
* performance.measure('A to B', 'A', 'B');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/perf_hooks.js)
|
||||||
|
*/
|
||||||
|
declare module "node:perf_hooks" {
|
||||||
|
import { InternalEventTargetEventProperties } from "node:events";
|
||||||
|
// #region web types
|
||||||
|
type EntryType =
|
||||||
|
| "dns" // Node.js only
|
||||||
|
| "function" // Node.js only
|
||||||
|
| "gc" // Node.js only
|
||||||
|
| "http2" // Node.js only
|
||||||
|
| "http" // Node.js only
|
||||||
|
| "mark" // available on the Web
|
||||||
|
| "measure" // available on the Web
|
||||||
|
| "net" // Node.js only
|
||||||
|
| "node" // Node.js only
|
||||||
|
| "resource"; // available on the Web
|
||||||
|
interface ConnectionTimingInfo {
|
||||||
|
domainLookupStartTime: number;
|
||||||
|
domainLookupEndTime: number;
|
||||||
|
connectionStartTime: number;
|
||||||
|
connectionEndTime: number;
|
||||||
|
secureConnectionStartTime: number;
|
||||||
|
ALPNNegotiatedProtocol: string;
|
||||||
|
}
|
||||||
|
interface FetchTimingInfo {
|
||||||
|
startTime: number;
|
||||||
|
redirectStartTime: number;
|
||||||
|
redirectEndTime: number;
|
||||||
|
postRedirectStartTime: number;
|
||||||
|
finalServiceWorkerStartTime: number;
|
||||||
|
finalNetworkRequestStartTime: number;
|
||||||
|
finalNetworkResponseStartTime: number;
|
||||||
|
endTime: number;
|
||||||
|
finalConnectionTimingInfo: ConnectionTimingInfo | null;
|
||||||
|
encodedBodySize: number;
|
||||||
|
decodedBodySize: number;
|
||||||
|
}
|
||||||
|
type PerformanceEntryList = PerformanceEntry[];
|
||||||
|
interface PerformanceMarkOptions {
|
||||||
|
detail?: any;
|
||||||
|
startTime?: number;
|
||||||
|
}
|
||||||
|
interface PerformanceMeasureOptions {
|
||||||
|
detail?: any;
|
||||||
|
duration?: number;
|
||||||
|
end?: string | number;
|
||||||
|
start?: string | number;
|
||||||
|
}
|
||||||
|
interface PerformanceObserverCallback {
|
||||||
|
(entries: PerformanceObserverEntryList, observer: PerformanceObserver): void;
|
||||||
|
}
|
||||||
|
interface PerformanceObserverInit {
|
||||||
|
buffered?: boolean;
|
||||||
|
entryTypes?: EntryType[];
|
||||||
|
type?: EntryType;
|
||||||
|
}
|
||||||
|
// TODO: remove in next major
|
||||||
|
/** @deprecated Use `TimerifyOptions` instead. */
|
||||||
|
interface PerformanceTimerifyOptions extends TimerifyOptions {}
|
||||||
|
interface PerformanceEventMap {
|
||||||
|
"resourcetimingbufferfull": Event;
|
||||||
|
}
|
||||||
|
interface Performance extends EventTarget, InternalEventTargetEventProperties<PerformanceEventMap> {
|
||||||
|
readonly nodeTiming: PerformanceNodeTiming;
|
||||||
|
readonly timeOrigin: number;
|
||||||
|
clearMarks(markName?: string): void;
|
||||||
|
clearMeasures(measureName?: string): void;
|
||||||
|
clearResourceTimings(resourceTimingName?: string): void;
|
||||||
|
getEntries(): PerformanceEntryList;
|
||||||
|
getEntriesByName(name: string, type?: EntryType): PerformanceEntryList;
|
||||||
|
getEntriesByType(type: EntryType): PerformanceEntryList;
|
||||||
|
mark(markName: string, markOptions?: PerformanceMarkOptions): PerformanceMark;
|
||||||
|
markResourceTiming(
|
||||||
|
timingInfo: FetchTimingInfo,
|
||||||
|
requestedUrl: string,
|
||||||
|
initiatorType: string,
|
||||||
|
global: unknown,
|
||||||
|
cacheMode: string,
|
||||||
|
bodyInfo: unknown,
|
||||||
|
responseStatus: number,
|
||||||
|
deliveryType?: string,
|
||||||
|
): PerformanceResourceTiming;
|
||||||
|
measure(measureName: string, startMark?: string, endMark?: string): PerformanceMeasure;
|
||||||
|
measure(measureName: string, options: PerformanceMeasureOptions, endMark?: string): PerformanceMeasure;
|
||||||
|
now(): number;
|
||||||
|
setResourceTimingBufferSize(maxSize: number): void;
|
||||||
|
toJSON(): any;
|
||||||
|
addEventListener<K extends keyof PerformanceEventMap>(
|
||||||
|
type: K,
|
||||||
|
listener: (ev: PerformanceEventMap[K]) => void,
|
||||||
|
options?: AddEventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
addEventListener(
|
||||||
|
type: string,
|
||||||
|
listener: EventListener | EventListenerObject,
|
||||||
|
options?: AddEventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
removeEventListener<K extends keyof PerformanceEventMap>(
|
||||||
|
type: K,
|
||||||
|
listener: (ev: PerformanceEventMap[K]) => void,
|
||||||
|
options?: EventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
removeEventListener(
|
||||||
|
type: string,
|
||||||
|
listener: EventListener | EventListenerObject,
|
||||||
|
options?: EventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
/**
|
||||||
|
* This is an alias of `perf_hooks.eventLoopUtilization()`.
|
||||||
|
*
|
||||||
|
* _This property is an extension by Node.js. It is not available in Web browsers._
|
||||||
|
* @since v14.10.0, v12.19.0
|
||||||
|
* @param utilization1 The result of a previous call to
|
||||||
|
* `eventLoopUtilization()`.
|
||||||
|
* @param utilization2 The result of a previous call to
|
||||||
|
* `eventLoopUtilization()` prior to `utilization1`.
|
||||||
|
*/
|
||||||
|
eventLoopUtilization(
|
||||||
|
utilization1?: EventLoopUtilization,
|
||||||
|
utilization2?: EventLoopUtilization,
|
||||||
|
): EventLoopUtilization;
|
||||||
|
/**
|
||||||
|
* This is an alias of `perf_hooks.timerify()`.
|
||||||
|
*
|
||||||
|
* _This property is an extension by Node.js. It is not available in Web browsers._
|
||||||
|
* @since v8.5.0
|
||||||
|
*/
|
||||||
|
timerify<T extends (...args: any[]) => any>(fn: T, options?: TimerifyOptions): T;
|
||||||
|
}
|
||||||
|
var Performance: {
|
||||||
|
prototype: Performance;
|
||||||
|
new(): Performance;
|
||||||
|
};
|
||||||
|
interface PerformanceEntry {
|
||||||
|
readonly duration: number;
|
||||||
|
readonly entryType: EntryType;
|
||||||
|
readonly name: string;
|
||||||
|
readonly startTime: number;
|
||||||
|
toJSON(): any;
|
||||||
|
}
|
||||||
|
var PerformanceEntry: {
|
||||||
|
prototype: PerformanceEntry;
|
||||||
|
new(): PerformanceEntry;
|
||||||
|
};
|
||||||
|
interface PerformanceMark extends PerformanceEntry {
|
||||||
|
readonly detail: any;
|
||||||
|
readonly entryType: "mark";
|
||||||
|
}
|
||||||
|
var PerformanceMark: {
|
||||||
|
prototype: PerformanceMark;
|
||||||
|
new(markName: string, markOptions?: PerformanceMarkOptions): PerformanceMark;
|
||||||
|
};
|
||||||
|
interface PerformanceMeasure extends PerformanceEntry {
|
||||||
|
readonly detail: any;
|
||||||
|
readonly entryType: "measure";
|
||||||
|
}
|
||||||
|
var PerformanceMeasure: {
|
||||||
|
prototype: PerformanceMeasure;
|
||||||
|
new(): PerformanceMeasure;
|
||||||
|
};
|
||||||
|
interface PerformanceObserver {
|
||||||
|
disconnect(): void;
|
||||||
|
observe(options: PerformanceObserverInit): void;
|
||||||
|
takeRecords(): PerformanceEntryList;
|
||||||
|
}
|
||||||
|
var PerformanceObserver: {
|
||||||
|
prototype: PerformanceObserver;
|
||||||
|
new(callback: PerformanceObserverCallback): PerformanceObserver;
|
||||||
|
readonly supportedEntryTypes: readonly EntryType[];
|
||||||
|
};
|
||||||
|
interface PerformanceObserverEntryList {
|
||||||
|
getEntries(): PerformanceEntryList;
|
||||||
|
getEntriesByName(name: string, type?: EntryType): PerformanceEntryList;
|
||||||
|
getEntriesByType(type: EntryType): PerformanceEntryList;
|
||||||
|
}
|
||||||
|
var PerformanceObserverEntryList: {
|
||||||
|
prototype: PerformanceObserverEntryList;
|
||||||
|
new(): PerformanceObserverEntryList;
|
||||||
|
};
|
||||||
|
interface PerformanceResourceTiming extends PerformanceEntry {
|
||||||
|
readonly connectEnd: number;
|
||||||
|
readonly connectStart: number;
|
||||||
|
readonly decodedBodySize: number;
|
||||||
|
readonly domainLookupEnd: number;
|
||||||
|
readonly domainLookupStart: number;
|
||||||
|
readonly encodedBodySize: number;
|
||||||
|
readonly entryType: "resource";
|
||||||
|
readonly fetchStart: number;
|
||||||
|
readonly initiatorType: string;
|
||||||
|
readonly nextHopProtocol: string;
|
||||||
|
readonly redirectEnd: number;
|
||||||
|
readonly redirectStart: number;
|
||||||
|
readonly requestStart: number;
|
||||||
|
readonly responseEnd: number;
|
||||||
|
readonly responseStart: number;
|
||||||
|
readonly responseStatus: number;
|
||||||
|
readonly secureConnectionStart: number;
|
||||||
|
readonly transferSize: number;
|
||||||
|
readonly workerStart: number;
|
||||||
|
toJSON(): any;
|
||||||
|
}
|
||||||
|
var PerformanceResourceTiming: {
|
||||||
|
prototype: PerformanceResourceTiming;
|
||||||
|
new(): PerformanceResourceTiming;
|
||||||
|
};
|
||||||
|
var performance: Performance;
|
||||||
|
// #endregion
|
||||||
|
/**
|
||||||
|
* _This class is an extension by Node.js. It is not available in Web browsers._
|
||||||
|
*
|
||||||
|
* Provides detailed Node.js timing data.
|
||||||
|
*
|
||||||
|
* The constructor of this class is not exposed to users directly.
|
||||||
|
* @since v19.0.0
|
||||||
|
*/
|
||||||
|
class PerformanceNodeEntry extends PerformanceEntry {
|
||||||
|
/**
|
||||||
|
* Additional detail specific to the `entryType`.
|
||||||
|
* @since v16.0.0
|
||||||
|
*/
|
||||||
|
readonly detail: any;
|
||||||
|
readonly entryType: "dns" | "function" | "gc" | "http2" | "http" | "net" | "node";
|
||||||
|
}
|
||||||
|
interface UVMetrics {
|
||||||
|
/**
|
||||||
|
* Number of event loop iterations.
|
||||||
|
*/
|
||||||
|
readonly loopCount: number;
|
||||||
|
/**
|
||||||
|
* Number of events that have been processed by the event handler.
|
||||||
|
*/
|
||||||
|
readonly events: number;
|
||||||
|
/**
|
||||||
|
* Number of events that were waiting to be processed when the event provider was called.
|
||||||
|
*/
|
||||||
|
readonly eventsWaiting: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* _This property is an extension by Node.js. It is not available in Web browsers._
|
||||||
|
*
|
||||||
|
* Provides timing details for Node.js itself. The constructor of this class
|
||||||
|
* is not exposed to users.
|
||||||
|
* @since v8.5.0
|
||||||
|
*/
|
||||||
|
interface PerformanceNodeTiming extends PerformanceEntry {
|
||||||
|
/**
|
||||||
|
* The high resolution millisecond timestamp at which the Node.js process
|
||||||
|
* completed bootstrapping. If bootstrapping has not yet finished, the property
|
||||||
|
* has the value of -1.
|
||||||
|
* @since v8.5.0
|
||||||
|
*/
|
||||||
|
readonly bootstrapComplete: number;
|
||||||
|
readonly entryType: "node";
|
||||||
|
/**
|
||||||
|
* The high resolution millisecond timestamp at which the Node.js environment was
|
||||||
|
* initialized.
|
||||||
|
* @since v8.5.0
|
||||||
|
*/
|
||||||
|
readonly environment: number;
|
||||||
|
/**
|
||||||
|
* The high resolution millisecond timestamp of the amount of time the event loop
|
||||||
|
* has been idle within the event loop's event provider (e.g. `epoll_wait`). This
|
||||||
|
* does not take CPU usage into consideration. If the event loop has not yet
|
||||||
|
* started (e.g., in the first tick of the main script), the property has the
|
||||||
|
* value of 0.
|
||||||
|
* @since v14.10.0, v12.19.0
|
||||||
|
*/
|
||||||
|
readonly idleTime: number;
|
||||||
|
/**
|
||||||
|
* The high resolution millisecond timestamp at which the Node.js event loop
|
||||||
|
* exited. If the event loop has not yet exited, the property has the value of -1\.
|
||||||
|
* It can only have a value of not -1 in a handler of the `'exit'` event.
|
||||||
|
* @since v8.5.0
|
||||||
|
*/
|
||||||
|
readonly loopExit: number;
|
||||||
|
/**
|
||||||
|
* The high resolution millisecond timestamp at which the Node.js event loop
|
||||||
|
* started. If the event loop has not yet started (e.g., in the first tick of the
|
||||||
|
* main script), the property has the value of -1.
|
||||||
|
* @since v8.5.0
|
||||||
|
*/
|
||||||
|
readonly loopStart: number;
|
||||||
|
/**
|
||||||
|
* The high resolution millisecond timestamp at which the Node.js process was initialized.
|
||||||
|
* @since v8.5.0
|
||||||
|
*/
|
||||||
|
readonly nodeStart: number;
|
||||||
|
/**
|
||||||
|
* This is a wrapper to the `uv_metrics_info` function.
|
||||||
|
* It returns the current set of event loop metrics.
|
||||||
|
*
|
||||||
|
* It is recommended to use this property inside a function whose execution was
|
||||||
|
* scheduled using `setImmediate` to avoid collecting metrics before finishing all
|
||||||
|
* operations scheduled during the current loop iteration.
|
||||||
|
* @since v22.8.0, v20.18.0
|
||||||
|
*/
|
||||||
|
readonly uvMetricsInfo: UVMetrics;
|
||||||
|
/**
|
||||||
|
* The high resolution millisecond timestamp at which the V8 platform was
|
||||||
|
* initialized.
|
||||||
|
* @since v8.5.0
|
||||||
|
*/
|
||||||
|
readonly v8Start: number;
|
||||||
|
}
|
||||||
|
namespace constants {
|
||||||
|
const NODE_PERFORMANCE_GC_MAJOR: number;
|
||||||
|
const NODE_PERFORMANCE_GC_MINOR: number;
|
||||||
|
const NODE_PERFORMANCE_GC_INCREMENTAL: number;
|
||||||
|
const NODE_PERFORMANCE_GC_WEAKCB: number;
|
||||||
|
const NODE_PERFORMANCE_GC_FLAGS_NO: number;
|
||||||
|
const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number;
|
||||||
|
const NODE_PERFORMANCE_GC_FLAGS_FORCED: number;
|
||||||
|
const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number;
|
||||||
|
const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number;
|
||||||
|
const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number;
|
||||||
|
const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number;
|
||||||
|
}
|
||||||
|
interface EventLoopMonitorOptions {
|
||||||
|
/**
|
||||||
|
* The sampling rate in milliseconds.
|
||||||
|
* Must be greater than zero.
|
||||||
|
* @default 10
|
||||||
|
*/
|
||||||
|
resolution?: number | undefined;
|
||||||
|
}
|
||||||
|
interface Histogram {
|
||||||
|
/**
|
||||||
|
* The number of samples recorded by the histogram.
|
||||||
|
* @since v17.4.0, v16.14.0
|
||||||
|
*/
|
||||||
|
readonly count: number;
|
||||||
|
/**
|
||||||
|
* The number of samples recorded by the histogram.
|
||||||
|
* v17.4.0, v16.14.0
|
||||||
|
*/
|
||||||
|
readonly countBigInt: bigint;
|
||||||
|
/**
|
||||||
|
* The number of times the event loop delay exceeded the maximum 1 hour event
|
||||||
|
* loop delay threshold.
|
||||||
|
* @since v11.10.0
|
||||||
|
*/
|
||||||
|
readonly exceeds: number;
|
||||||
|
/**
|
||||||
|
* The number of times the event loop delay exceeded the maximum 1 hour event loop delay threshold.
|
||||||
|
* @since v17.4.0, v16.14.0
|
||||||
|
*/
|
||||||
|
readonly exceedsBigInt: bigint;
|
||||||
|
/**
|
||||||
|
* The maximum recorded event loop delay.
|
||||||
|
* @since v11.10.0
|
||||||
|
*/
|
||||||
|
readonly max: number;
|
||||||
|
/**
|
||||||
|
* The maximum recorded event loop delay.
|
||||||
|
* v17.4.0, v16.14.0
|
||||||
|
*/
|
||||||
|
readonly maxBigInt: number;
|
||||||
|
/**
|
||||||
|
* The mean of the recorded event loop delays.
|
||||||
|
* @since v11.10.0
|
||||||
|
*/
|
||||||
|
readonly mean: number;
|
||||||
|
/**
|
||||||
|
* The minimum recorded event loop delay.
|
||||||
|
* @since v11.10.0
|
||||||
|
*/
|
||||||
|
readonly min: number;
|
||||||
|
/**
|
||||||
|
* The minimum recorded event loop delay.
|
||||||
|
* v17.4.0, v16.14.0
|
||||||
|
*/
|
||||||
|
readonly minBigInt: bigint;
|
||||||
|
/**
|
||||||
|
* Returns the value at the given percentile.
|
||||||
|
* @since v11.10.0
|
||||||
|
* @param percentile A percentile value in the range (0, 100].
|
||||||
|
*/
|
||||||
|
percentile(percentile: number): number;
|
||||||
|
/**
|
||||||
|
* Returns the value at the given percentile.
|
||||||
|
* @since v17.4.0, v16.14.0
|
||||||
|
* @param percentile A percentile value in the range (0, 100].
|
||||||
|
*/
|
||||||
|
percentileBigInt(percentile: number): bigint;
|
||||||
|
/**
|
||||||
|
* Returns a `Map` object detailing the accumulated percentile distribution.
|
||||||
|
* @since v11.10.0
|
||||||
|
*/
|
||||||
|
readonly percentiles: Map<number, number>;
|
||||||
|
/**
|
||||||
|
* Returns a `Map` object detailing the accumulated percentile distribution.
|
||||||
|
* @since v17.4.0, v16.14.0
|
||||||
|
*/
|
||||||
|
readonly percentilesBigInt: Map<bigint, bigint>;
|
||||||
|
/**
|
||||||
|
* Resets the collected histogram data.
|
||||||
|
* @since v11.10.0
|
||||||
|
*/
|
||||||
|
reset(): void;
|
||||||
|
/**
|
||||||
|
* The standard deviation of the recorded event loop delays.
|
||||||
|
* @since v11.10.0
|
||||||
|
*/
|
||||||
|
readonly stddev: number;
|
||||||
|
}
|
||||||
|
interface IntervalHistogram extends Histogram {
|
||||||
|
/**
|
||||||
|
* Enables the update interval timer. Returns `true` if the timer was
|
||||||
|
* started, `false` if it was already started.
|
||||||
|
* @since v11.10.0
|
||||||
|
*/
|
||||||
|
enable(): boolean;
|
||||||
|
/**
|
||||||
|
* Disables the update interval timer. Returns `true` if the timer was
|
||||||
|
* stopped, `false` if it was already stopped.
|
||||||
|
* @since v11.10.0
|
||||||
|
*/
|
||||||
|
disable(): boolean;
|
||||||
|
/**
|
||||||
|
* Disables the update interval timer when the histogram is disposed.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { monitorEventLoopDelay } = require('node:perf_hooks');
|
||||||
|
* {
|
||||||
|
* using hist = monitorEventLoopDelay({ resolution: 20 });
|
||||||
|
* hist.enable();
|
||||||
|
* // The histogram will be disabled when the block is exited.
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v24.2.0
|
||||||
|
*/
|
||||||
|
[Symbol.dispose](): void;
|
||||||
|
}
|
||||||
|
interface RecordableHistogram extends Histogram {
|
||||||
|
/**
|
||||||
|
* @since v15.9.0, v14.18.0
|
||||||
|
* @param val The amount to record in the histogram.
|
||||||
|
*/
|
||||||
|
record(val: number | bigint): void;
|
||||||
|
/**
|
||||||
|
* Calculates the amount of time (in nanoseconds) that has passed since the
|
||||||
|
* previous call to `recordDelta()` and records that amount in the histogram.
|
||||||
|
* @since v15.9.0, v14.18.0
|
||||||
|
*/
|
||||||
|
recordDelta(): void;
|
||||||
|
/**
|
||||||
|
* Adds the values from `other` to this histogram.
|
||||||
|
* @since v17.4.0, v16.14.0
|
||||||
|
*/
|
||||||
|
add(other: RecordableHistogram): void;
|
||||||
|
}
|
||||||
|
interface EventLoopUtilization {
|
||||||
|
idle: number;
|
||||||
|
active: number;
|
||||||
|
utilization: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The `eventLoopUtilization()` function returns an object that contains the
|
||||||
|
* cumulative duration of time the event loop has been both idle and active as a
|
||||||
|
* high resolution milliseconds timer. The `utilization` value is the calculated
|
||||||
|
* Event Loop Utilization (ELU).
|
||||||
|
*
|
||||||
|
* If bootstrapping has not yet finished on the main thread the properties have
|
||||||
|
* the value of `0`. The ELU is immediately available on [Worker threads](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#worker-threads) since
|
||||||
|
* bootstrap happens within the event loop.
|
||||||
|
*
|
||||||
|
* Both `utilization1` and `utilization2` are optional parameters.
|
||||||
|
*
|
||||||
|
* If `utilization1` is passed, then the delta between the current call's `active`
|
||||||
|
* and `idle` times, as well as the corresponding `utilization` value are
|
||||||
|
* calculated and returned (similar to `process.hrtime()`).
|
||||||
|
*
|
||||||
|
* If `utilization1` and `utilization2` are both passed, then the delta is
|
||||||
|
* calculated between the two arguments. This is a convenience option because,
|
||||||
|
* unlike `process.hrtime()`, calculating the ELU is more complex than a
|
||||||
|
* single subtraction.
|
||||||
|
*
|
||||||
|
* ELU is similar to CPU utilization, except that it only measures event loop
|
||||||
|
* statistics and not CPU usage. It represents the percentage of time the event
|
||||||
|
* loop has spent outside the event loop's event provider (e.g. `epoll_wait`).
|
||||||
|
* No other CPU idle time is taken into consideration. The following is an example
|
||||||
|
* of how a mostly idle process will have a high ELU.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { eventLoopUtilization } from 'node:perf_hooks';
|
||||||
|
* import { spawnSync } from 'node:child_process';
|
||||||
|
*
|
||||||
|
* setImmediate(() => {
|
||||||
|
* const elu = eventLoopUtilization();
|
||||||
|
* spawnSync('sleep', ['5']);
|
||||||
|
* console.log(eventLoopUtilization(elu).utilization);
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Although the CPU is mostly idle while running this script, the value of
|
||||||
|
* `utilization` is `1`. This is because the call to
|
||||||
|
* `child_process.spawnSync()` blocks the event loop from proceeding.
|
||||||
|
*
|
||||||
|
* Passing in a user-defined object instead of the result of a previous call to
|
||||||
|
* `eventLoopUtilization()` will lead to undefined behavior. The return values
|
||||||
|
* are not guaranteed to reflect any correct state of the event loop.
|
||||||
|
* @since v25.2.0
|
||||||
|
* @param utilization1 The result of a previous call to
|
||||||
|
* `eventLoopUtilization()`.
|
||||||
|
* @param utilization2 The result of a previous call to
|
||||||
|
* `eventLoopUtilization()` prior to `utilization1`.
|
||||||
|
*/
|
||||||
|
function eventLoopUtilization(
|
||||||
|
utilization1?: EventLoopUtilization,
|
||||||
|
utilization2?: EventLoopUtilization,
|
||||||
|
): EventLoopUtilization;
|
||||||
|
/**
|
||||||
|
* _This property is an extension by Node.js. It is not available in Web browsers._
|
||||||
|
*
|
||||||
|
* Creates an `IntervalHistogram` object that samples and reports the event loop
|
||||||
|
* delay over time. The delays will be reported in nanoseconds.
|
||||||
|
*
|
||||||
|
* Using a timer to detect approximate event loop delay works because the
|
||||||
|
* execution of timers is tied specifically to the lifecycle of the libuv
|
||||||
|
* event loop. That is, a delay in the loop will cause a delay in the execution
|
||||||
|
* of the timer, and those delays are specifically what this API is intended to
|
||||||
|
* detect.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { monitorEventLoopDelay } from 'node:perf_hooks';
|
||||||
|
* const h = monitorEventLoopDelay({ resolution: 20 });
|
||||||
|
* h.enable();
|
||||||
|
* // Do something.
|
||||||
|
* h.disable();
|
||||||
|
* console.log(h.min);
|
||||||
|
* console.log(h.max);
|
||||||
|
* console.log(h.mean);
|
||||||
|
* console.log(h.stddev);
|
||||||
|
* console.log(h.percentiles);
|
||||||
|
* console.log(h.percentile(50));
|
||||||
|
* console.log(h.percentile(99));
|
||||||
|
* ```
|
||||||
|
* @since v11.10.0
|
||||||
|
*/
|
||||||
|
function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram;
|
||||||
|
interface TimerifyOptions {
|
||||||
|
/**
|
||||||
|
* A histogram object created using
|
||||||
|
* `perf_hooks.createHistogram()` that will record runtime durations in
|
||||||
|
* nanoseconds.
|
||||||
|
*/
|
||||||
|
histogram?: RecordableHistogram | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* _This property is an extension by Node.js. It is not available in Web browsers._
|
||||||
|
*
|
||||||
|
* Wraps a function within a new function that measures the running time of the
|
||||||
|
* wrapped function. A `PerformanceObserver` must be subscribed to the `'function'`
|
||||||
|
* event type in order for the timing details to be accessed.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { timerify, performance, PerformanceObserver } from 'node:perf_hooks';
|
||||||
|
*
|
||||||
|
* function someFunction() {
|
||||||
|
* console.log('hello world');
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* const wrapped = timerify(someFunction);
|
||||||
|
*
|
||||||
|
* const obs = new PerformanceObserver((list) => {
|
||||||
|
* console.log(list.getEntries()[0].duration);
|
||||||
|
*
|
||||||
|
* performance.clearMarks();
|
||||||
|
* performance.clearMeasures();
|
||||||
|
* obs.disconnect();
|
||||||
|
* });
|
||||||
|
* obs.observe({ entryTypes: ['function'] });
|
||||||
|
*
|
||||||
|
* // A performance timeline entry will be created
|
||||||
|
* wrapped();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the wrapped function returns a promise, a finally handler will be attached
|
||||||
|
* to the promise and the duration will be reported once the finally handler is
|
||||||
|
* invoked.
|
||||||
|
* @since v25.2.0
|
||||||
|
*/
|
||||||
|
function timerify<T extends (...args: any[]) => any>(fn: T, options?: TimerifyOptions): T;
|
||||||
|
interface CreateHistogramOptions {
|
||||||
|
/**
|
||||||
|
* The minimum recordable value. Must be an integer value greater than 0.
|
||||||
|
* @default 1
|
||||||
|
*/
|
||||||
|
lowest?: number | bigint | undefined;
|
||||||
|
/**
|
||||||
|
* The maximum recordable value. Must be an integer value greater than min.
|
||||||
|
* @default Number.MAX_SAFE_INTEGER
|
||||||
|
*/
|
||||||
|
highest?: number | bigint | undefined;
|
||||||
|
/**
|
||||||
|
* The number of accuracy digits. Must be a number between 1 and 5.
|
||||||
|
* @default 3
|
||||||
|
*/
|
||||||
|
figures?: number | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns a `RecordableHistogram`.
|
||||||
|
* @since v15.9.0, v14.18.0
|
||||||
|
*/
|
||||||
|
function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
|
||||||
|
// TODO: remove these in a future major
|
||||||
|
/** @deprecated Use the canonical `PerformanceMarkOptions` instead. */
|
||||||
|
interface MarkOptions extends PerformanceMarkOptions {}
|
||||||
|
/** @deprecated Use the canonical `PerformanceMeasureOptions` instead. */
|
||||||
|
interface MeasureOptions extends PerformanceMeasureOptions {}
|
||||||
|
}
|
||||||
|
declare module "perf_hooks" {
|
||||||
|
export * from "node:perf_hooks";
|
||||||
|
}
|
||||||
2175
node_modules/@types/node/process.d.ts
generated
vendored
Normal file
2175
node_modules/@types/node/process.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
117
node_modules/@types/node/punycode.d.ts
generated
vendored
Normal file
117
node_modules/@types/node/punycode.d.ts
generated
vendored
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
/**
|
||||||
|
* **The version of the punycode module bundled in Node.js is being deprecated. **In a future major version of Node.js this module will be removed. Users
|
||||||
|
* currently depending on the `punycode` module should switch to using the
|
||||||
|
* userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL
|
||||||
|
* encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`.
|
||||||
|
*
|
||||||
|
* The `punycode` module is a bundled version of the [Punycode.js](https://github.com/bestiejs/punycode.js) module. It
|
||||||
|
* can be accessed using:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import punycode from 'node:punycode';
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is
|
||||||
|
* primarily intended for use in Internationalized Domain Names. Because host
|
||||||
|
* names in URLs are limited to ASCII characters only, Domain Names that contain
|
||||||
|
* non-ASCII characters must be converted into ASCII using the Punycode scheme.
|
||||||
|
* For instance, the Japanese character that translates into the English word, `'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent
|
||||||
|
* to `'example.com'`) is represented by Punycode as the ASCII string `'xn--fsq.com'`.
|
||||||
|
*
|
||||||
|
* The `punycode` module provides a simple implementation of the Punycode standard.
|
||||||
|
*
|
||||||
|
* The `punycode` module is a third-party dependency used by Node.js and
|
||||||
|
* made available to developers as a convenience. Fixes or other modifications to
|
||||||
|
* the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
|
||||||
|
* @deprecated
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/punycode.js)
|
||||||
|
*/
|
||||||
|
declare module "node: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.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* punycode.decode('maana-pta'); // 'mañana'
|
||||||
|
* punycode.decode('--dqo34k'); // '☃-⌘'
|
||||||
|
* ```
|
||||||
|
* @since v0.5.1
|
||||||
|
*/
|
||||||
|
function decode(string: string): string;
|
||||||
|
/**
|
||||||
|
* The `punycode.encode()` method converts a string of Unicode codepoints to a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only characters.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* punycode.encode('mañana'); // 'maana-pta'
|
||||||
|
* punycode.encode('☃-⌘'); // '--dqo34k'
|
||||||
|
* ```
|
||||||
|
* @since v0.5.1
|
||||||
|
*/
|
||||||
|
function encode(string: string): string;
|
||||||
|
/**
|
||||||
|
* The `punycode.toUnicode()` method converts a string representing a domain name
|
||||||
|
* containing [Punycode](https://tools.ietf.org/html/rfc3492) encoded characters into Unicode. Only the [Punycode](https://tools.ietf.org/html/rfc3492) encoded parts of the domain name are be
|
||||||
|
* converted.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // decode domain names
|
||||||
|
* punycode.toUnicode('xn--maana-pta.com'); // 'mañana.com'
|
||||||
|
* punycode.toUnicode('xn----dqo34k.com'); // '☃-⌘.com'
|
||||||
|
* punycode.toUnicode('example.com'); // 'example.com'
|
||||||
|
* ```
|
||||||
|
* @since v0.6.1
|
||||||
|
*/
|
||||||
|
function toUnicode(domain: string): string;
|
||||||
|
/**
|
||||||
|
* The `punycode.toASCII()` method converts a Unicode string representing an
|
||||||
|
* Internationalized Domain Name to [Punycode](https://tools.ietf.org/html/rfc3492). Only the non-ASCII parts of the
|
||||||
|
* domain name will be converted. Calling `punycode.toASCII()` on a string that
|
||||||
|
* already only contains ASCII characters will have no effect.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // encode domain names
|
||||||
|
* punycode.toASCII('mañana.com'); // 'xn--maana-pta.com'
|
||||||
|
* punycode.toASCII('☃-⌘.com'); // 'xn----dqo34k.com'
|
||||||
|
* punycode.toASCII('example.com'); // 'example.com'
|
||||||
|
* ```
|
||||||
|
* @since v0.6.1
|
||||||
|
*/
|
||||||
|
function toASCII(domain: string): string;
|
||||||
|
/**
|
||||||
|
* @deprecated since v7.0.0
|
||||||
|
* The version of the punycode module bundled in Node.js is being deprecated.
|
||||||
|
* In a future major version of Node.js this module will be removed.
|
||||||
|
* Users currently depending on the punycode module should switch to using
|
||||||
|
* the userland-provided Punycode.js module instead.
|
||||||
|
*/
|
||||||
|
const ucs2: ucs2;
|
||||||
|
interface ucs2 {
|
||||||
|
/**
|
||||||
|
* @deprecated since v7.0.0
|
||||||
|
* The version of the punycode module bundled in Node.js is being deprecated.
|
||||||
|
* In a future major version of Node.js this module will be removed.
|
||||||
|
* Users currently depending on the punycode module should switch to using
|
||||||
|
* the userland-provided Punycode.js module instead.
|
||||||
|
*/
|
||||||
|
decode(string: string): number[];
|
||||||
|
/**
|
||||||
|
* @deprecated since v7.0.0
|
||||||
|
* The version of the punycode module bundled in Node.js is being deprecated.
|
||||||
|
* In a future major version of Node.js this module will be removed.
|
||||||
|
* Users currently depending on the punycode module should switch to using
|
||||||
|
* the userland-provided Punycode.js module instead.
|
||||||
|
*/
|
||||||
|
encode(codePoints: readonly number[]): string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @deprecated since v7.0.0
|
||||||
|
* The version of the punycode module bundled in Node.js is being deprecated.
|
||||||
|
* In a future major version of Node.js this module will be removed.
|
||||||
|
* Users currently depending on the punycode module should switch to using
|
||||||
|
* the userland-provided Punycode.js module instead.
|
||||||
|
*/
|
||||||
|
const version: string;
|
||||||
|
}
|
||||||
|
declare module "punycode" {
|
||||||
|
export * from "node:punycode";
|
||||||
|
}
|
||||||
152
node_modules/@types/node/querystring.d.ts
generated
vendored
Normal file
152
node_modules/@types/node/querystring.d.ts
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
/**
|
||||||
|
* The `node:querystring` module provides utilities for parsing and formatting URL
|
||||||
|
* query strings. It can be accessed using:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import querystring from 'node: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/v25.x/lib/querystring.js)
|
||||||
|
*/
|
||||||
|
declare module "node:querystring" {
|
||||||
|
interface StringifyOptions {
|
||||||
|
/**
|
||||||
|
* The function to use when converting URL-unsafe characters to percent-encoding in the query string.
|
||||||
|
* @default `querystring.escape()`
|
||||||
|
*/
|
||||||
|
encodeURIComponent?: ((str: string) => string) | undefined;
|
||||||
|
}
|
||||||
|
interface ParseOptions {
|
||||||
|
/**
|
||||||
|
* Specifies the maximum number of keys to parse. Specify `0` to remove key counting limitations.
|
||||||
|
* @default 1000
|
||||||
|
*/
|
||||||
|
maxKeys?: number | undefined;
|
||||||
|
/**
|
||||||
|
* The function to use when decoding percent-encoded characters in the query string.
|
||||||
|
* @default `querystring.unescape()`
|
||||||
|
*/
|
||||||
|
decodeURIComponent?: ((str: string) => string) | undefined;
|
||||||
|
}
|
||||||
|
interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> {}
|
||||||
|
interface ParsedUrlQueryInput extends
|
||||||
|
NodeJS.Dict<
|
||||||
|
| string
|
||||||
|
| number
|
||||||
|
| boolean
|
||||||
|
| bigint
|
||||||
|
| ReadonlyArray<string | number | boolean | bigint>
|
||||||
|
| null
|
||||||
|
>
|
||||||
|
{}
|
||||||
|
/**
|
||||||
|
* The `querystring.stringify()` method produces a URL query string from a
|
||||||
|
* given `obj` by iterating through the object's "own properties".
|
||||||
|
*
|
||||||
|
* It serializes the following types of values passed in `obj`: [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
|
||||||
|
* [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
|
||||||
|
* [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
|
||||||
|
* [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
|
||||||
|
* [string\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
|
||||||
|
* [number\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
|
||||||
|
* [bigint\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
|
||||||
|
* [boolean\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) The numeric values must be finite. Any other input values will be coerced to
|
||||||
|
* empty strings.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });
|
||||||
|
* // Returns 'foo=bar&baz=qux&baz=quux&corge='
|
||||||
|
*
|
||||||
|
* querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':');
|
||||||
|
* // Returns 'foo:bar;baz:qux'
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* By default, characters requiring percent-encoding within the query string will
|
||||||
|
* be encoded as UTF-8\. If an alternative encoding is required, then an alternative `encodeURIComponent` option will need to be specified:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // Assuming gbkEncodeURIComponent function already exists,
|
||||||
|
*
|
||||||
|
* querystring.stringify({ w: '中文', foo: 'bar' }, null, null,
|
||||||
|
* { encodeURIComponent: gbkEncodeURIComponent });
|
||||||
|
* ```
|
||||||
|
* @since v0.1.25
|
||||||
|
* @param obj The object to serialize into a URL query string
|
||||||
|
* @param [sep='&'] The substring used to delimit key and value pairs in the query string.
|
||||||
|
* @param [eq='='] . The substring used to delimit keys and values in the query string.
|
||||||
|
*/
|
||||||
|
function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string;
|
||||||
|
/**
|
||||||
|
* The `querystring.parse()` method parses a URL query string (`str`) into a
|
||||||
|
* collection of key and value pairs.
|
||||||
|
*
|
||||||
|
* For example, the query string `'foo=bar&abc=xyz&abc=123'` is parsed into:
|
||||||
|
*
|
||||||
|
* ```json
|
||||||
|
* {
|
||||||
|
* "foo": "bar",
|
||||||
|
* "abc": ["xyz", "123"]
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The object returned by the `querystring.parse()` method _does not_ prototypically inherit from the JavaScript `Object`. This means that typical `Object` methods such as `obj.toString()`,
|
||||||
|
* `obj.hasOwnProperty()`, and others
|
||||||
|
* are not defined and _will not work_.
|
||||||
|
*
|
||||||
|
* By default, percent-encoded characters within the query string will be assumed
|
||||||
|
* to use UTF-8 encoding. If an alternative character encoding is used, then an
|
||||||
|
* alternative `decodeURIComponent` option will need to be specified:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // Assuming gbkDecodeURIComponent function already exists...
|
||||||
|
*
|
||||||
|
* querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null,
|
||||||
|
* { decodeURIComponent: gbkDecodeURIComponent });
|
||||||
|
* ```
|
||||||
|
* @since v0.1.25
|
||||||
|
* @param str The URL query string to parse
|
||||||
|
* @param [sep='&'] The substring used to delimit key and value pairs in the query string.
|
||||||
|
* @param [eq='='] The substring used to delimit keys and values in the query string.
|
||||||
|
*/
|
||||||
|
function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery;
|
||||||
|
/**
|
||||||
|
* The querystring.encode() function is an alias for querystring.stringify().
|
||||||
|
*/
|
||||||
|
const encode: typeof stringify;
|
||||||
|
/**
|
||||||
|
* The querystring.decode() function is an alias for querystring.parse().
|
||||||
|
*/
|
||||||
|
const decode: typeof parse;
|
||||||
|
/**
|
||||||
|
* The `querystring.escape()` method performs URL percent-encoding on the given `str` in a manner that is optimized for the specific requirements of URL
|
||||||
|
* query strings.
|
||||||
|
*
|
||||||
|
* The `querystring.escape()` method is used by `querystring.stringify()` and is
|
||||||
|
* generally not expected to be used directly. It is exported primarily to allow
|
||||||
|
* application code to provide a replacement percent-encoding implementation if
|
||||||
|
* necessary by assigning `querystring.escape` to an alternative function.
|
||||||
|
* @since v0.1.25
|
||||||
|
*/
|
||||||
|
function escape(str: string): string;
|
||||||
|
/**
|
||||||
|
* The `querystring.unescape()` method performs decoding of URL percent-encoded
|
||||||
|
* characters on the given `str`.
|
||||||
|
*
|
||||||
|
* The `querystring.unescape()` method is used by `querystring.parse()` and is
|
||||||
|
* generally not expected to be used directly. It is exported primarily to allow
|
||||||
|
* application code to provide a replacement decoding implementation if
|
||||||
|
* necessary by assigning `querystring.unescape` to an alternative function.
|
||||||
|
*
|
||||||
|
* By default, the `querystring.unescape()` method will attempt to use the
|
||||||
|
* JavaScript built-in `decodeURIComponent()` method to decode. If that fails,
|
||||||
|
* a safer equivalent that does not throw on malformed URLs will be used.
|
||||||
|
* @since v0.1.25
|
||||||
|
*/
|
||||||
|
function unescape(str: string): string;
|
||||||
|
}
|
||||||
|
declare module "querystring" {
|
||||||
|
export * from "node:querystring";
|
||||||
|
}
|
||||||
910
node_modules/@types/node/quic.d.ts
generated
vendored
Normal file
910
node_modules/@types/node/quic.d.ts
generated
vendored
Normal file
@ -0,0 +1,910 @@
|
|||||||
|
/**
|
||||||
|
* The 'node:quic' module provides an implementation of the QUIC protocol.
|
||||||
|
* To access it, start Node.js with the `--experimental-quic` option and:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import quic from 'node:quic';
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The module is only available under the `node:` scheme.
|
||||||
|
* @since v23.8.0
|
||||||
|
* @experimental
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/quic.js)
|
||||||
|
*/
|
||||||
|
declare module "node:quic" {
|
||||||
|
import { KeyObject, webcrypto } from "node:crypto";
|
||||||
|
import { SocketAddress } from "node:net";
|
||||||
|
import { ReadableStream } from "node:stream/web";
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
type OnSessionCallback = (this: QuicEndpoint, session: QuicSession) => void;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
type OnStreamCallback = (this: QuicSession, stream: QuicStream) => void;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
type OnDatagramCallback = (this: QuicSession, datagram: Uint8Array, early: boolean) => void;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
type OnDatagramStatusCallback = (this: QuicSession, id: bigint, status: "lost" | "acknowledged") => void;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
type OnPathValidationCallback = (
|
||||||
|
this: QuicSession,
|
||||||
|
result: "success" | "failure" | "aborted",
|
||||||
|
newLocalAddress: SocketAddress,
|
||||||
|
newRemoteAddress: SocketAddress,
|
||||||
|
oldLocalAddress: SocketAddress,
|
||||||
|
oldRemoteAddress: SocketAddress,
|
||||||
|
preferredAddress: boolean,
|
||||||
|
) => void;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
type OnSessionTicketCallback = (this: QuicSession, ticket: object) => void;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
type OnVersionNegotiationCallback = (
|
||||||
|
this: QuicSession,
|
||||||
|
version: number,
|
||||||
|
requestedVersions: number[],
|
||||||
|
supportedVersions: number[],
|
||||||
|
) => void;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
type OnHandshakeCallback = (
|
||||||
|
this: QuicSession,
|
||||||
|
sni: string,
|
||||||
|
alpn: string,
|
||||||
|
cipher: string,
|
||||||
|
cipherVersion: string,
|
||||||
|
validationErrorReason: string,
|
||||||
|
validationErrorCode: number,
|
||||||
|
earlyDataAccepted: boolean,
|
||||||
|
) => void;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
type OnBlockedCallback = (this: QuicStream) => void;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
type OnStreamErrorCallback = (this: QuicStream, error: any) => void;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
interface TransportParams {
|
||||||
|
/**
|
||||||
|
* The preferred IPv4 address to advertise.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
preferredAddressIpv4?: SocketAddress | undefined;
|
||||||
|
/**
|
||||||
|
* The preferred IPv6 address to advertise.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
preferredAddressIpv6?: SocketAddress | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
initialMaxStreamDataBidiLocal?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
initialMaxStreamDataBidiRemote?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
initialMaxStreamDataUni?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
initialMaxData?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
initialMaxStreamsBidi?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
initialMaxStreamsUni?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
maxIdleTimeout?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
activeConnectionIDLimit?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
ackDelayExponent?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
maxAckDelay?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
maxDatagramFrameSize?: bigint | number | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
interface SessionOptions {
|
||||||
|
/**
|
||||||
|
* An endpoint to use.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
endpoint?: EndpointOptions | QuicEndpoint | undefined;
|
||||||
|
/**
|
||||||
|
* The ALPN protocol identifier.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
alpn?: string | undefined;
|
||||||
|
/**
|
||||||
|
* The CA certificates to use for sessions.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
ca?: ArrayBuffer | NodeJS.ArrayBufferView | ReadonlyArray<ArrayBuffer | NodeJS.ArrayBufferView> | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the congestion control algorithm that will be used.
|
||||||
|
* Must be set to one of either `'reno'`, `'cubic'`, or `'bbr'`.
|
||||||
|
*
|
||||||
|
* This is an advanced option that users typically won't have need to specify.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
cc?: `${constants.cc}` | undefined;
|
||||||
|
/**
|
||||||
|
* The TLS certificates to use for sessions.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
certs?: ArrayBuffer | NodeJS.ArrayBufferView | ReadonlyArray<ArrayBuffer | NodeJS.ArrayBufferView> | undefined;
|
||||||
|
/**
|
||||||
|
* The list of supported TLS 1.3 cipher algorithms.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
ciphers?: string | undefined;
|
||||||
|
/**
|
||||||
|
* The CRL to use for sessions.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
crl?: ArrayBuffer | NodeJS.ArrayBufferView | ReadonlyArray<ArrayBuffer | NodeJS.ArrayBufferView> | undefined;
|
||||||
|
/**
|
||||||
|
* The list of support TLS 1.3 cipher groups.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
groups?: string | undefined;
|
||||||
|
/**
|
||||||
|
* True to enable TLS keylogging output.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
keylog?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* The TLS crypto keys to use for sessions.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
keys?: KeyObject | webcrypto.CryptoKey | ReadonlyArray<KeyObject | webcrypto.CryptoKey> | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the maximum UDP packet payload size.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
maxPayloadSize?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the maximum stream flow-control window size.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
maxStreamWindow?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the maximum session flow-control window size.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
maxWindow?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* The minimum QUIC version number to allow. This is an advanced option that users
|
||||||
|
* typically won't have need to specify.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
minVersion?: number | undefined;
|
||||||
|
/**
|
||||||
|
* When the remote peer advertises a preferred address, this option specifies whether
|
||||||
|
* to use it or ignore it.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
preferredAddressPolicy?: "use" | "ignore" | "default" | undefined;
|
||||||
|
/**
|
||||||
|
* True if qlog output should be enabled.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
qlog?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* A session ticket to use for 0RTT session resumption.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
sessionTicket?: NodeJS.ArrayBufferView | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the maximum number of milliseconds a TLS handshake is permitted to take
|
||||||
|
* to complete before timing out.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
handshakeTimeout?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* The peer server name to target.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
sni?: string | undefined;
|
||||||
|
/**
|
||||||
|
* True to enable TLS tracing output.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
tlsTrace?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* The QUIC transport parameters to use for the session.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
transportParams?: TransportParams | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the maximum number of unacknowledged packets a session should allow.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
unacknowledgedPacketThreshold?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* True to require verification of TLS client certificate.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
verifyClient?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* True to require private key verification.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
verifyPrivateKey?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* The QUIC version number to use. This is an advanced option that users typically
|
||||||
|
* won't have need to specify.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
version?: number | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Initiate a new client-side session.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { connect } from 'node:quic';
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const enc = new TextEncoder();
|
||||||
|
* const alpn = 'foo';
|
||||||
|
* const client = await connect('123.123.123.123:8888', { alpn });
|
||||||
|
* await client.createUnidirectionalStream({
|
||||||
|
* body: enc.encode('hello world'),
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* By default, every call to `connect(...)` will create a new local
|
||||||
|
* `QuicEndpoint` instance bound to a new random local IP port. To
|
||||||
|
* specify the exact local address to use, or to multiplex multiple
|
||||||
|
* QUIC sessions over a single local port, pass the `endpoint` option
|
||||||
|
* with either a `QuicEndpoint` or `EndpointOptions` as the argument.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { QuicEndpoint, connect } from 'node:quic';
|
||||||
|
*
|
||||||
|
* const endpoint = new QuicEndpoint({
|
||||||
|
* address: '127.0.0.1:1234',
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* const client = await connect('123.123.123.123:8888', { endpoint });
|
||||||
|
* ```
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
function connect(address: string | SocketAddress, options?: SessionOptions): Promise<QuicSession>;
|
||||||
|
/**
|
||||||
|
* Configures the endpoint to listen as a server. When a new session is initiated by
|
||||||
|
* a remote peer, the given `onsession` callback will be invoked with the created
|
||||||
|
* session.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { listen } from 'node:quic';
|
||||||
|
*
|
||||||
|
* const endpoint = await listen((session) => {
|
||||||
|
* // ... handle the session
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Closing the endpoint allows any sessions open when close is called
|
||||||
|
* // to complete naturally while preventing new sessions from being
|
||||||
|
* // initiated. Once all existing sessions have finished, the endpoint
|
||||||
|
* // will be destroyed. The call returns a promise that is resolved once
|
||||||
|
* // the endpoint is destroyed.
|
||||||
|
* await endpoint.close();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* By default, every call to `listen(...)` will create a new local
|
||||||
|
* `QuicEndpoint` instance bound to a new random local IP port. To
|
||||||
|
* specify the exact local address to use, or to multiplex multiple
|
||||||
|
* QUIC sessions over a single local port, pass the `endpoint` option
|
||||||
|
* with either a `QuicEndpoint` or `EndpointOptions` as the argument.
|
||||||
|
*
|
||||||
|
* At most, any single `QuicEndpoint` can only be configured to listen as
|
||||||
|
* a server once.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
function listen(onsession: OnSessionCallback, options?: SessionOptions): Promise<QuicEndpoint>;
|
||||||
|
/**
|
||||||
|
* The endpoint configuration options passed when constructing a new `QuicEndpoint` instance.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
interface EndpointOptions {
|
||||||
|
/**
|
||||||
|
* If not specified the endpoint will bind to IPv4 `localhost` on a random port.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
address?: SocketAddress | string | undefined;
|
||||||
|
/**
|
||||||
|
* The endpoint maintains an internal cache of validated socket addresses as a
|
||||||
|
* performance optimization. This option sets the maximum number of addresses
|
||||||
|
* that are cache. This is an advanced option that users typically won't have
|
||||||
|
* need to specify.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
addressLRUSize?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* When `true`, indicates that the endpoint should bind only to IPv6 addresses.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
ipv6Only?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the maximum number of concurrent sessions allowed per remote peer address.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
maxConnectionsPerHost?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the maximum total number of concurrent sessions.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
maxConnectionsTotal?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the maximum number of QUIC retry attempts allowed per remote peer address.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
maxRetries?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the maximum number of stateless resets that are allowed per remote peer address.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
maxStatelessResetsPerHost?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the length of time a QUIC retry token is considered valid.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
retryTokenExpiration?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the 16-byte secret used to generate QUIC retry tokens.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
resetTokenSecret?: NodeJS.ArrayBufferView | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the length of time a QUIC token is considered valid.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
tokenExpiration?: bigint | number | undefined;
|
||||||
|
/**
|
||||||
|
* Specifies the 16-byte secret used to generate QUIC tokens.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
tokenSecret?: NodeJS.ArrayBufferView | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
udpReceiveBufferSize?: number | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
udpSendBufferSize?: number | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
udpTTL?: number | undefined;
|
||||||
|
/**
|
||||||
|
* When `true`, requires that the endpoint validate peer addresses using retry packets
|
||||||
|
* while establishing a new connection.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
validateAddress?: boolean | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A `QuicEndpoint` encapsulates the local UDP-port binding for QUIC. It can be
|
||||||
|
* used as both a client and a server.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
class QuicEndpoint implements AsyncDisposable {
|
||||||
|
constructor(options?: EndpointOptions);
|
||||||
|
/**
|
||||||
|
* The local UDP socket address to which the endpoint is bound, if any.
|
||||||
|
*
|
||||||
|
* If the endpoint is not currently bound then the value will be `undefined`. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly address: SocketAddress | undefined;
|
||||||
|
/**
|
||||||
|
* When `endpoint.busy` is set to true, the endpoint will temporarily reject
|
||||||
|
* new sessions from being created. Read/write.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // Mark the endpoint busy. New sessions will be prevented.
|
||||||
|
* endpoint.busy = true;
|
||||||
|
*
|
||||||
|
* // Mark the endpoint free. New session will be allowed.
|
||||||
|
* endpoint.busy = false;
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The `busy` property is useful when the endpoint is under heavy load and needs to
|
||||||
|
* temporarily reject new sessions while it catches up.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
busy: boolean;
|
||||||
|
/**
|
||||||
|
* Gracefully close the endpoint. The endpoint will close and destroy itself when
|
||||||
|
* all currently open sessions close. Once called, new sessions will be rejected.
|
||||||
|
*
|
||||||
|
* Returns a promise that is fulfilled when the endpoint is destroyed.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
close(): Promise<void>;
|
||||||
|
/**
|
||||||
|
* A promise that is fulfilled when the endpoint is destroyed. This will be the same promise that is
|
||||||
|
* returned by the `endpoint.close()` function. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly closed: Promise<void>;
|
||||||
|
/**
|
||||||
|
* True if `endpoint.close()` has been called and closing the endpoint has not yet completed.
|
||||||
|
* Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly closing: boolean;
|
||||||
|
/**
|
||||||
|
* Forcefully closes the endpoint by forcing all open sessions to be immediately
|
||||||
|
* closed.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
destroy(error?: any): void;
|
||||||
|
/**
|
||||||
|
* True if `endpoint.destroy()` has been called. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly destroyed: boolean;
|
||||||
|
/**
|
||||||
|
* The statistics collected for an active session. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly stats: QuicEndpoint.Stats;
|
||||||
|
/**
|
||||||
|
* Calls `endpoint.close()` and returns a promise that fulfills when the
|
||||||
|
* endpoint has closed.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
[Symbol.asyncDispose](): Promise<void>;
|
||||||
|
}
|
||||||
|
namespace QuicEndpoint {
|
||||||
|
/**
|
||||||
|
* A view of the collected statistics for an endpoint.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
class Stats {
|
||||||
|
private constructor();
|
||||||
|
/**
|
||||||
|
* A timestamp indicating the moment the endpoint was created. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly createdAt: bigint;
|
||||||
|
/**
|
||||||
|
* A timestamp indicating the moment the endpoint was destroyed. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly destroyedAt: bigint;
|
||||||
|
/**
|
||||||
|
* The total number of bytes received by this endpoint. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly bytesReceived: bigint;
|
||||||
|
/**
|
||||||
|
* The total number of bytes sent by this endpoint. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly bytesSent: bigint;
|
||||||
|
/**
|
||||||
|
* The total number of QUIC packets successfully received by this endpoint. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly packetsReceived: bigint;
|
||||||
|
/**
|
||||||
|
* The total number of QUIC packets successfully sent by this endpoint. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly packetsSent: bigint;
|
||||||
|
/**
|
||||||
|
* The total number of peer-initiated sessions received by this endpoint. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly serverSessions: bigint;
|
||||||
|
/**
|
||||||
|
* The total number of sessions initiated by this endpoint. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly clientSessions: bigint;
|
||||||
|
/**
|
||||||
|
* The total number of times an initial packet was rejected due to the
|
||||||
|
* endpoint being marked busy. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly serverBusyCount: bigint;
|
||||||
|
/**
|
||||||
|
* The total number of QUIC retry attempts on this endpoint. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly retryCount: bigint;
|
||||||
|
/**
|
||||||
|
* The total number sessions rejected due to QUIC version mismatch. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly versionNegotiationCount: bigint;
|
||||||
|
/**
|
||||||
|
* The total number of stateless resets handled by this endpoint. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly statelessResetCount: bigint;
|
||||||
|
/**
|
||||||
|
* The total number of sessions that were closed before handshake completed. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly immediateCloseCount: bigint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
interface CreateStreamOptions {
|
||||||
|
body?: ArrayBuffer | NodeJS.ArrayBufferView | Blob | undefined;
|
||||||
|
sendOrder?: number | undefined;
|
||||||
|
}
|
||||||
|
interface SessionPath {
|
||||||
|
local: SocketAddress;
|
||||||
|
remote: SocketAddress;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A `QuicSession` represents the local side of a QUIC connection.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
class QuicSession implements AsyncDisposable {
|
||||||
|
private constructor();
|
||||||
|
/**
|
||||||
|
* Initiate a graceful close of the session. Existing streams will be allowed
|
||||||
|
* to complete but no new streams will be opened. Once all streams have closed,
|
||||||
|
* the session will be destroyed. The returned promise will be fulfilled once
|
||||||
|
* the session has been destroyed.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
close(): Promise<void>;
|
||||||
|
/**
|
||||||
|
* A promise that is fulfilled once the session is destroyed.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly closed: Promise<void>;
|
||||||
|
/**
|
||||||
|
* Immediately destroy the session. All streams will be destroys and the
|
||||||
|
* session will be closed.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
destroy(error?: any): void;
|
||||||
|
/**
|
||||||
|
* True if `session.destroy()` has been called. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly destroyed: boolean;
|
||||||
|
/**
|
||||||
|
* The endpoint that created this session. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly endpoint: QuicEndpoint;
|
||||||
|
/**
|
||||||
|
* The callback to invoke when a new stream is initiated by a remote peer. Read/write.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
onstream: OnStreamCallback | undefined;
|
||||||
|
/**
|
||||||
|
* The callback to invoke when a new datagram is received from a remote peer. Read/write.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
ondatagram: OnDatagramCallback | undefined;
|
||||||
|
/**
|
||||||
|
* The callback to invoke when the status of a datagram is updated. Read/write.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
ondatagramstatus: OnDatagramStatusCallback | undefined;
|
||||||
|
/**
|
||||||
|
* The callback to invoke when the path validation is updated. Read/write.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
onpathvalidation: OnPathValidationCallback | undefined;
|
||||||
|
/**
|
||||||
|
* The callback to invoke when a new session ticket is received. Read/write.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
onsessionticket: OnSessionTicketCallback | undefined;
|
||||||
|
/**
|
||||||
|
* The callback to invoke when a version negotiation is initiated. Read/write.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
onversionnegotiation: OnVersionNegotiationCallback | undefined;
|
||||||
|
/**
|
||||||
|
* The callback to invoke when the TLS handshake is completed. Read/write.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
onhandshake: OnHandshakeCallback | undefined;
|
||||||
|
/**
|
||||||
|
* Open a new bidirectional stream. If the `body` option is not specified,
|
||||||
|
* the outgoing stream will be half-closed.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
createBidirectionalStream(options?: CreateStreamOptions): Promise<QuicStream>;
|
||||||
|
/**
|
||||||
|
* Open a new unidirectional stream. If the `body` option is not specified,
|
||||||
|
* the outgoing stream will be closed.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
createUnidirectionalStream(options?: CreateStreamOptions): Promise<QuicStream>;
|
||||||
|
/**
|
||||||
|
* The local and remote socket addresses associated with the session. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
path: SessionPath | undefined;
|
||||||
|
/**
|
||||||
|
* Sends an unreliable datagram to the remote peer, returning the datagram ID.
|
||||||
|
* If the datagram payload is specified as an `ArrayBufferView`, then ownership of
|
||||||
|
* that view will be transfered to the underlying stream.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
sendDatagram(datagram: string | NodeJS.ArrayBufferView): bigint;
|
||||||
|
/**
|
||||||
|
* Return the current statistics for the session. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly stats: QuicSession.Stats;
|
||||||
|
/**
|
||||||
|
* Initiate a key update for the session.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
updateKey(): void;
|
||||||
|
/**
|
||||||
|
* Calls `session.close()` and returns a promise that fulfills when the
|
||||||
|
* session has closed.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
[Symbol.asyncDispose](): Promise<void>;
|
||||||
|
}
|
||||||
|
namespace QuicSession {
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
class Stats {
|
||||||
|
private constructor();
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly createdAt: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly closingAt: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly handshakeCompletedAt: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly handshakeConfirmedAt: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly bytesReceived: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly bytesSent: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly bidiInStreamCount: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly bidiOutStreamCount: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly uniInStreamCount: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly uniOutStreamCount: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly maxBytesInFlights: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly bytesInFlight: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly blockCount: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly cwnd: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly latestRtt: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly minRtt: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly rttVar: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly smoothedRtt: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly ssthresh: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly datagramsReceived: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly datagramsSent: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly datagramsAcknowledged: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly datagramsLost: bigint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
class QuicStream {
|
||||||
|
private constructor();
|
||||||
|
/**
|
||||||
|
* A promise that is fulfilled when the stream is fully closed.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly closed: Promise<void>;
|
||||||
|
/**
|
||||||
|
* Immediately and abruptly destroys the stream.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
destroy(error?: any): void;
|
||||||
|
/**
|
||||||
|
* True if `stream.destroy()` has been called.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly destroyed: boolean;
|
||||||
|
/**
|
||||||
|
* The directionality of the stream. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly direction: "bidi" | "uni";
|
||||||
|
/**
|
||||||
|
* The stream ID. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly id: bigint;
|
||||||
|
/**
|
||||||
|
* The callback to invoke when the stream is blocked. Read/write.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
onblocked: OnBlockedCallback | undefined;
|
||||||
|
/**
|
||||||
|
* The callback to invoke when the stream is reset. Read/write.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
onreset: OnStreamErrorCallback | undefined;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly readable: ReadableStream<Uint8Array>;
|
||||||
|
/**
|
||||||
|
* The session that created this stream. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly session: QuicSession;
|
||||||
|
/**
|
||||||
|
* The current statistics for the stream. Read only.
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly stats: QuicStream.Stats;
|
||||||
|
}
|
||||||
|
namespace QuicStream {
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
class Stats {
|
||||||
|
private constructor();
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly ackedAt: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly bytesReceived: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly bytesSent: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly createdAt: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly destroyedAt: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly finalSize: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly isConnected: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly maxOffset: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly maxOffsetAcknowledged: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly maxOffsetReceived: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly openedAt: bigint;
|
||||||
|
/**
|
||||||
|
* @since v23.8.0
|
||||||
|
*/
|
||||||
|
readonly receivedAt: bigint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
namespace constants {
|
||||||
|
enum cc {
|
||||||
|
RENO = "reno",
|
||||||
|
CUBIC = "cubic",
|
||||||
|
BBR = "bbr",
|
||||||
|
}
|
||||||
|
const DEFAULT_CIPHERS: string;
|
||||||
|
const DEFAULT_GROUPS: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
542
node_modules/@types/node/readline.d.ts
generated
vendored
Normal file
542
node_modules/@types/node/readline.d.ts
generated
vendored
Normal file
@ -0,0 +1,542 @@
|
|||||||
|
/**
|
||||||
|
* The `node:readline` module provides an interface for reading data from a [Readable](https://nodejs.org/docs/latest-v25.x/api/stream.html#readable-streams) stream
|
||||||
|
* (such as [`process.stdin`](https://nodejs.org/docs/latest-v25.x/api/process.html#processstdin)) one line at a time.
|
||||||
|
*
|
||||||
|
* To use the promise-based APIs:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import * as readline from 'node:readline/promises';
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To use the callback and sync APIs:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import * as readline from 'node:readline';
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The following simple example illustrates the basic use of the `node:readline` module.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import * as readline from 'node:readline/promises';
|
||||||
|
* import { stdin as input, stdout as output } from 'node:process';
|
||||||
|
*
|
||||||
|
* 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();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Once this code is invoked, the Node.js application will not terminate until the `readline.Interface` is closed because the interface waits for data to be
|
||||||
|
* received on the `input` stream.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/readline.js)
|
||||||
|
*/
|
||||||
|
declare module "node:readline" {
|
||||||
|
import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
|
||||||
|
interface Key {
|
||||||
|
sequence?: string | undefined;
|
||||||
|
name?: string | undefined;
|
||||||
|
ctrl?: boolean | undefined;
|
||||||
|
meta?: boolean | undefined;
|
||||||
|
shift?: boolean | undefined;
|
||||||
|
}
|
||||||
|
interface InterfaceEventMap {
|
||||||
|
"close": [];
|
||||||
|
"error": [error: Error];
|
||||||
|
"history": [history: string[]];
|
||||||
|
"line": [input: string];
|
||||||
|
"pause": [];
|
||||||
|
"resume": [];
|
||||||
|
"SIGCONT": [];
|
||||||
|
"SIGINT": [];
|
||||||
|
"SIGTSTP": [];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Instances of the `readline.Interface` class are constructed using the `readline.createInterface()` method. Every instance is associated with a
|
||||||
|
* single `input` [Readable](https://nodejs.org/docs/latest-v25.x/api/stream.html#readable-streams) stream and a single `output` [Writable](https://nodejs.org/docs/latest-v25.x/api/stream.html#writable-streams) stream.
|
||||||
|
* The `output` stream is used to print prompts for user input that arrives on,
|
||||||
|
* and is read from, the `input` stream.
|
||||||
|
* @since v0.1.104
|
||||||
|
*/
|
||||||
|
class Interface implements EventEmitter, Disposable {
|
||||||
|
/**
|
||||||
|
* NOTE: According to the documentation:
|
||||||
|
*
|
||||||
|
* > Instances of the `readline.Interface` class are constructed using the
|
||||||
|
* > `readline.createInterface()` method.
|
||||||
|
*
|
||||||
|
* @see https://nodejs.org/dist/latest-v25.x/docs/api/readline.html#class-interfaceconstructor
|
||||||
|
*/
|
||||||
|
protected constructor(
|
||||||
|
input: NodeJS.ReadableStream,
|
||||||
|
output?: NodeJS.WritableStream,
|
||||||
|
completer?: Completer | AsyncCompleter,
|
||||||
|
terminal?: boolean,
|
||||||
|
);
|
||||||
|
/**
|
||||||
|
* NOTE: According to the documentation:
|
||||||
|
*
|
||||||
|
* > Instances of the `readline.Interface` class are constructed using the
|
||||||
|
* > `readline.createInterface()` method.
|
||||||
|
*
|
||||||
|
* @see https://nodejs.org/dist/latest-v25.x/docs/api/readline.html#class-interfaceconstructor
|
||||||
|
*/
|
||||||
|
protected constructor(options: ReadLineOptions);
|
||||||
|
readonly terminal: boolean;
|
||||||
|
/**
|
||||||
|
* The current input data being processed by node.
|
||||||
|
*
|
||||||
|
* This can be used when collecting input from a TTY stream to retrieve the
|
||||||
|
* current value that has been processed thus far, prior to the `line` event
|
||||||
|
* being emitted. Once the `line` event has been emitted, this property will
|
||||||
|
* be an empty string.
|
||||||
|
*
|
||||||
|
* Be aware that modifying the value during the instance runtime may have
|
||||||
|
* unintended consequences if `rl.cursor` is not also controlled.
|
||||||
|
*
|
||||||
|
* **If not using a TTY stream for input, use the `'line'` event.**
|
||||||
|
*
|
||||||
|
* One possible use case would be as follows:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const values = ['lorem ipsum', 'dolor sit amet'];
|
||||||
|
* const rl = readline.createInterface(process.stdin);
|
||||||
|
* const showResults = debounce(() => {
|
||||||
|
* console.log(
|
||||||
|
* '\n',
|
||||||
|
* values.filter((val) => val.startsWith(rl.line)).join(' '),
|
||||||
|
* );
|
||||||
|
* }, 300);
|
||||||
|
* process.stdin.on('keypress', (c, k) => {
|
||||||
|
* showResults();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v0.1.98
|
||||||
|
*/
|
||||||
|
readonly line: string;
|
||||||
|
/**
|
||||||
|
* The cursor position relative to `rl.line`.
|
||||||
|
*
|
||||||
|
* This will track where the current cursor lands in the input string, when
|
||||||
|
* reading input from a TTY stream. The position of cursor determines the
|
||||||
|
* portion of the input string that will be modified as input is processed,
|
||||||
|
* as well as the column where the terminal caret will be rendered.
|
||||||
|
* @since v0.1.98
|
||||||
|
*/
|
||||||
|
readonly cursor: number;
|
||||||
|
/**
|
||||||
|
* The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`.
|
||||||
|
* @since v15.3.0, v14.17.0
|
||||||
|
* @return the current prompt string
|
||||||
|
*/
|
||||||
|
getPrompt(): string;
|
||||||
|
/**
|
||||||
|
* The `rl.setPrompt()` method sets the prompt that will be written to `output` whenever `rl.prompt()` is called.
|
||||||
|
* @since v0.1.98
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
* 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.
|
||||||
|
* @since v0.1.98
|
||||||
|
* @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`.
|
||||||
|
*/
|
||||||
|
prompt(preserveCursor?: boolean): void;
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* rl.question('What is your favorite food? ', (answer) => {
|
||||||
|
* console.log(`Oh, so your favorite food is ${answer}`);
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Using an `AbortController` to cancel a question.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const ac = new AbortController();
|
||||||
|
* const signal = ac.signal;
|
||||||
|
*
|
||||||
|
* rl.question('What is your favorite food? ', { signal }, (answer) => {
|
||||||
|
* console.log(`Oh, so your favorite food is ${answer}`);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* signal.addEventListener('abort', () => {
|
||||||
|
* console.log('The food question timed out');
|
||||||
|
* }, { once: true });
|
||||||
|
*
|
||||||
|
* setTimeout(() => ac.abort(), 10000);
|
||||||
|
* ```
|
||||||
|
* @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`.
|
||||||
|
*/
|
||||||
|
question(query: string, callback: (answer: string) => void): void;
|
||||||
|
question(query: string, options: Abortable, callback: (answer: string) => void): void;
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
* @since v0.3.4
|
||||||
|
*/
|
||||||
|
pause(): this;
|
||||||
|
/**
|
||||||
|
* The `rl.resume()` method resumes the `input` stream if it has been paused.
|
||||||
|
* @since v0.3.4
|
||||||
|
*/
|
||||||
|
resume(): this;
|
||||||
|
/**
|
||||||
|
* The `rl.close()` method closes the `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.
|
||||||
|
* @since v0.1.98
|
||||||
|
*/
|
||||||
|
close(): void;
|
||||||
|
/**
|
||||||
|
* Alias for `rl.close()`.
|
||||||
|
* @since v22.15.0
|
||||||
|
*/
|
||||||
|
[Symbol.dispose](): void;
|
||||||
|
/**
|
||||||
|
* The `rl.write()` method will write either `data` or a key sequence identified
|
||||||
|
* by `key` to the `output`. The `key` argument is supported only if `output` is
|
||||||
|
* a `TTY` text terminal. See `TTY keybindings` for a list of key
|
||||||
|
* combinations.
|
||||||
|
*
|
||||||
|
* If `key` is specified, `data` is ignored.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* rl.write('Delete this!');
|
||||||
|
* // Simulate Ctrl+U to delete the line written previously
|
||||||
|
* rl.write(null, { ctrl: true, name: 'u' });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The `rl.write()` method will write the data to the `readline` `Interface`'s `input` _as if it were provided by the user_.
|
||||||
|
* @since v0.1.98
|
||||||
|
*/
|
||||||
|
write(data: string | Buffer, key?: Key): void;
|
||||||
|
write(data: undefined | null | string | Buffer, key: Key): void;
|
||||||
|
/**
|
||||||
|
* Returns the real position of the cursor in relation to the input
|
||||||
|
* prompt + string. Long input (wrapping) strings, as well as multiple
|
||||||
|
* line prompts are included in the calculations.
|
||||||
|
* @since v13.5.0, v12.16.0
|
||||||
|
*/
|
||||||
|
getCursorPos(): CursorPos;
|
||||||
|
[Symbol.asyncIterator](): NodeJS.AsyncIterator<string>;
|
||||||
|
}
|
||||||
|
interface Interface extends InternalEventEmitter<InterfaceEventMap> {}
|
||||||
|
type ReadLine = Interface; // type forwarded for backwards compatibility
|
||||||
|
type Completer = (line: string) => CompleterResult;
|
||||||
|
type AsyncCompleter = (
|
||||||
|
line: string,
|
||||||
|
callback: (err?: null | Error, result?: CompleterResult) => void,
|
||||||
|
) => void;
|
||||||
|
type CompleterResult = [string[], string];
|
||||||
|
interface ReadLineOptions {
|
||||||
|
/**
|
||||||
|
* The [`Readable`](https://nodejs.org/docs/latest-v25.x/api/stream.html#readable-streams) stream to listen to
|
||||||
|
*/
|
||||||
|
input: NodeJS.ReadableStream;
|
||||||
|
/**
|
||||||
|
* The [`Writable`](https://nodejs.org/docs/latest-v25.x/api/stream.html#writable-streams) stream to write readline data to.
|
||||||
|
*/
|
||||||
|
output?: NodeJS.WritableStream | undefined;
|
||||||
|
/**
|
||||||
|
* An optional function used for Tab autocompletion.
|
||||||
|
*/
|
||||||
|
completer?: Completer | AsyncCompleter | undefined;
|
||||||
|
/**
|
||||||
|
* `true` if the `input` and `output` streams should be treated like a TTY,
|
||||||
|
* and have ANSI/VT100 escape codes written to it.
|
||||||
|
* Default: checking `isTTY` on the `output` stream upon instantiation.
|
||||||
|
*/
|
||||||
|
terminal?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Initial list of history lines.
|
||||||
|
* This option makes sense only if `terminal` is set to `true` by the user or by an internal `output` check,
|
||||||
|
* otherwise the history caching mechanism is not initialized at all.
|
||||||
|
* @default []
|
||||||
|
*/
|
||||||
|
history?: string[] | undefined;
|
||||||
|
/**
|
||||||
|
* Maximum number of history lines retained.
|
||||||
|
* To disable the history set this value to `0`.
|
||||||
|
* This option makes sense only if `terminal` is set to `true` by the user or by an internal `output` check,
|
||||||
|
* otherwise the history caching mechanism is not initialized at all.
|
||||||
|
* @default 30
|
||||||
|
*/
|
||||||
|
historySize?: number | undefined;
|
||||||
|
/**
|
||||||
|
* If `true`, when a new input line added to the history list duplicates an older one,
|
||||||
|
* this removes the older line from the list.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
removeHistoryDuplicates?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* The prompt string to use.
|
||||||
|
* @default "> "
|
||||||
|
*/
|
||||||
|
prompt?: string | undefined;
|
||||||
|
/**
|
||||||
|
* If the delay between `\r` and `\n` exceeds `crlfDelay` milliseconds,
|
||||||
|
* both `\r` and `\n` will be treated as separate end-of-line input.
|
||||||
|
* `crlfDelay` will be coerced to a number no less than `100`.
|
||||||
|
* It can be set to `Infinity`, in which case
|
||||||
|
* `\r` followed by `\n` will always be considered a single newline
|
||||||
|
* (which may be reasonable for [reading files](https://nodejs.org/docs/latest-v25.x/api/readline.html#example-read-file-stream-line-by-line) with `\r\n` line delimiter).
|
||||||
|
* @default 100
|
||||||
|
*/
|
||||||
|
crlfDelay?: number | undefined;
|
||||||
|
/**
|
||||||
|
* The duration `readline` will wait for a character
|
||||||
|
* (when reading an ambiguous key sequence in milliseconds
|
||||||
|
* one that can both form a complete key sequence using the input read so far
|
||||||
|
* and can take additional input to complete a longer key sequence).
|
||||||
|
* @default 500
|
||||||
|
*/
|
||||||
|
escapeCodeTimeout?: number | undefined;
|
||||||
|
/**
|
||||||
|
* The number of spaces a tab is equal to (minimum 1).
|
||||||
|
* @default 8
|
||||||
|
*/
|
||||||
|
tabSize?: number | undefined;
|
||||||
|
/**
|
||||||
|
* Allows closing the interface using an AbortSignal.
|
||||||
|
* Aborting the signal will internally call `close` on the interface.
|
||||||
|
*/
|
||||||
|
signal?: AbortSignal | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The `readline.createInterface()` method creates a new `readline.Interface` instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import readline from 'node:readline';
|
||||||
|
* const rl = readline.createInterface({
|
||||||
|
* input: process.stdin,
|
||||||
|
* output: process.stdout,
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Once the `readline.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).
|
||||||
|
*
|
||||||
|
* 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()`.
|
||||||
|
* @since v0.1.98
|
||||||
|
*/
|
||||||
|
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.
|
||||||
|
*
|
||||||
|
* Optionally, `interface` specifies a `readline.Interface` instance for which
|
||||||
|
* autocompletion is disabled when copy-pasted input is detected.
|
||||||
|
*
|
||||||
|
* If the `stream` is a `TTY`, then it must be in raw mode.
|
||||||
|
*
|
||||||
|
* This is automatically called by any readline instance on its `input` if the `input` is a terminal. Closing the `readline` instance does not stop
|
||||||
|
* the `input` from emitting `'keypress'` events.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* readline.emitKeypressEvents(process.stdin);
|
||||||
|
* if (process.stdin.isTTY)
|
||||||
|
* process.stdin.setRawMode(true);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ## Example: Tiny CLI
|
||||||
|
*
|
||||||
|
* The following example illustrates the use of `readline.Interface` class to
|
||||||
|
* implement a small command-line interface:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import readline from 'node:readline';
|
||||||
|
* const rl = readline.createInterface({
|
||||||
|
* input: process.stdin,
|
||||||
|
* output: process.stdout,
|
||||||
|
* prompt: 'OHAI> ',
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* rl.prompt();
|
||||||
|
*
|
||||||
|
* rl.on('line', (line) => {
|
||||||
|
* switch (line.trim()) {
|
||||||
|
* case 'hello':
|
||||||
|
* console.log('world!');
|
||||||
|
* break;
|
||||||
|
* default:
|
||||||
|
* console.log(`Say what? I might have heard '${line.trim()}'`);
|
||||||
|
* break;
|
||||||
|
* }
|
||||||
|
* rl.prompt();
|
||||||
|
* }).on('close', () => {
|
||||||
|
* console.log('Have a great day!');
|
||||||
|
* process.exit(0);
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ## Example: Read file stream line-by-Line
|
||||||
|
*
|
||||||
|
* A common use case for `readline` is to consume an input file one line at a
|
||||||
|
* time. The easiest way to do so is leveraging the `fs.ReadStream` API as
|
||||||
|
* well as a `for await...of` loop:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import fs from 'node:fs';
|
||||||
|
* import readline from 'node:readline';
|
||||||
|
*
|
||||||
|
* async function processLineByLine() {
|
||||||
|
* const fileStream = fs.createReadStream('input.txt');
|
||||||
|
*
|
||||||
|
* const rl = readline.createInterface({
|
||||||
|
* input: fileStream,
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* for await (const line of rl) {
|
||||||
|
* // Each line in input.txt will be successively available here as `line`.
|
||||||
|
* console.log(`Line from file: ${line}`);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* processLineByLine();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Alternatively, one could use the `'line'` event:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import fs from 'node:fs';
|
||||||
|
* import readline from 'node:readline';
|
||||||
|
*
|
||||||
|
* const rl = readline.createInterface({
|
||||||
|
* input: fs.createReadStream('sample.txt'),
|
||||||
|
* crlfDelay: Infinity,
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* rl.on('line', (line) => {
|
||||||
|
* console.log(`Line from file: ${line}`);
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* import { once } from 'node:events';
|
||||||
|
* import { createReadStream } from 'node:fs';
|
||||||
|
* import { createInterface } from 'node:readline';
|
||||||
|
*
|
||||||
|
* (async function processLineByLine() {
|
||||||
|
* try {
|
||||||
|
* const rl = createInterface({
|
||||||
|
* input: createReadStream('big-file.txt'),
|
||||||
|
* crlfDelay: Infinity,
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* rl.on('line', (line) => {
|
||||||
|
* // Process the line.
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* await once(rl, 'close');
|
||||||
|
*
|
||||||
|
* console.log('File processed.');
|
||||||
|
* } catch (err) {
|
||||||
|
* console.error(err);
|
||||||
|
* }
|
||||||
|
* })();
|
||||||
|
* ```
|
||||||
|
* @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](https://nodejs.org/docs/latest-v25.x/api/tty.html) stream
|
||||||
|
* in a specified direction identified by `dir`.
|
||||||
|
* @since v0.7.7
|
||||||
|
* @param callback Invoked once the operation completes.
|
||||||
|
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
||||||
|
*/
|
||||||
|
function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
|
||||||
|
/**
|
||||||
|
* The `readline.clearScreenDown()` method clears the given [TTY](https://nodejs.org/docs/latest-v25.x/api/tty.html) stream from
|
||||||
|
* the current position of the cursor down.
|
||||||
|
* @since v0.7.7
|
||||||
|
* @param callback Invoked once the operation completes.
|
||||||
|
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
||||||
|
*/
|
||||||
|
function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
|
||||||
|
/**
|
||||||
|
* The `readline.cursorTo()` method moves cursor to the specified position in a
|
||||||
|
* given [TTY](https://nodejs.org/docs/latest-v25.x/api/tty.html) `stream`.
|
||||||
|
* @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](https://nodejs.org/docs/latest-v25.x/api/tty.html) `stream`.
|
||||||
|
* @since v0.7.7
|
||||||
|
* @param callback Invoked once the operation completes.
|
||||||
|
* @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
||||||
|
*/
|
||||||
|
function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
|
||||||
|
}
|
||||||
|
declare module "node:readline" {
|
||||||
|
export * as promises from "node:readline/promises";
|
||||||
|
}
|
||||||
|
declare module "readline" {
|
||||||
|
export * from "node:readline";
|
||||||
|
}
|
||||||
161
node_modules/@types/node/readline/promises.d.ts
generated
vendored
Normal file
161
node_modules/@types/node/readline/promises.d.ts
generated
vendored
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
/**
|
||||||
|
* @since v17.0.0
|
||||||
|
*/
|
||||||
|
declare module "node:readline/promises" {
|
||||||
|
import { Abortable } from "node:events";
|
||||||
|
import {
|
||||||
|
CompleterResult,
|
||||||
|
Direction,
|
||||||
|
Interface as _Interface,
|
||||||
|
ReadLineOptions as _ReadLineOptions,
|
||||||
|
} from "node:readline";
|
||||||
|
/**
|
||||||
|
* 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 | undefined;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
type Completer = (line: string) => CompleterResult | Promise<CompleterResult>;
|
||||||
|
interface ReadLineOptions extends Omit<_ReadLineOptions, "completer"> {
|
||||||
|
/**
|
||||||
|
* An optional function used for Tab autocompletion.
|
||||||
|
*/
|
||||||
|
completer?: Completer | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface` instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import readlinePromises from '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,
|
||||||
|
terminal?: boolean,
|
||||||
|
): Interface;
|
||||||
|
function createInterface(options: ReadLineOptions): Interface;
|
||||||
|
}
|
||||||
|
declare module "readline/promises" {
|
||||||
|
export * from "node:readline/promises";
|
||||||
|
}
|
||||||
415
node_modules/@types/node/repl.d.ts
generated
vendored
Normal file
415
node_modules/@types/node/repl.d.ts
generated
vendored
Normal file
@ -0,0 +1,415 @@
|
|||||||
|
/**
|
||||||
|
* The `node:repl` module provides a Read-Eval-Print-Loop (REPL) implementation
|
||||||
|
* that is available both as a standalone program or includible in other
|
||||||
|
* applications. It can be accessed using:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import repl from 'node:repl';
|
||||||
|
* ```
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/repl.js)
|
||||||
|
*/
|
||||||
|
declare module "node:repl" {
|
||||||
|
import { AsyncCompleter, Completer, Interface, InterfaceEventMap } from "node:readline";
|
||||||
|
import { InspectOptions } from "node:util";
|
||||||
|
import { Context } from "node:vm";
|
||||||
|
interface ReplOptions {
|
||||||
|
/**
|
||||||
|
* The input prompt to display.
|
||||||
|
* @default "> "
|
||||||
|
*/
|
||||||
|
prompt?: string | undefined;
|
||||||
|
/**
|
||||||
|
* The `Readable` stream from which REPL input will be read.
|
||||||
|
* @default process.stdin
|
||||||
|
*/
|
||||||
|
input?: NodeJS.ReadableStream | undefined;
|
||||||
|
/**
|
||||||
|
* The `Writable` stream to which REPL output will be written.
|
||||||
|
* @default process.stdout
|
||||||
|
*/
|
||||||
|
output?: NodeJS.WritableStream | undefined;
|
||||||
|
/**
|
||||||
|
* If `true`, specifies that the output should be treated as a TTY terminal, and have
|
||||||
|
* ANSI/VT100 escape codes written to it.
|
||||||
|
* Default: checking the value of the `isTTY` property on the output stream upon
|
||||||
|
* instantiation.
|
||||||
|
*/
|
||||||
|
terminal?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* The function to be used when evaluating each given line of input.
|
||||||
|
* **Default:** an async wrapper for the JavaScript `eval()` function. An `eval` function can
|
||||||
|
* error with `repl.Recoverable` to indicate the input was incomplete and prompt for
|
||||||
|
* additional lines. See the [custom evaluation functions](https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#custom-evaluation-functions)
|
||||||
|
* section for more details.
|
||||||
|
*/
|
||||||
|
eval?: REPLEval | undefined;
|
||||||
|
/**
|
||||||
|
* Defines if the repl prints output previews or not.
|
||||||
|
* @default `true` Always `false` in case `terminal` is falsy.
|
||||||
|
*/
|
||||||
|
preview?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* If `true`, specifies that the default `writer` function should include ANSI color
|
||||||
|
* styling to REPL output. If a custom `writer` function is provided then this has no
|
||||||
|
* effect.
|
||||||
|
* @default the REPL instance's `terminal` value
|
||||||
|
*/
|
||||||
|
useColors?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* If `true`, specifies that the default evaluation function will use the JavaScript
|
||||||
|
* `global` as the context as opposed to creating a new separate context for the REPL
|
||||||
|
* instance. The node CLI REPL sets this value to `true`.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
useGlobal?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* If `true`, specifies that the default writer will not output the return value of a
|
||||||
|
* command if it evaluates to `undefined`.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
ignoreUndefined?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* The function to invoke to format the output of each command before writing to `output`.
|
||||||
|
* @default a wrapper for `util.inspect`
|
||||||
|
*
|
||||||
|
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_customizing_repl_output
|
||||||
|
*/
|
||||||
|
writer?: REPLWriter | undefined;
|
||||||
|
/**
|
||||||
|
* An optional function used for custom Tab auto completion.
|
||||||
|
*
|
||||||
|
* @see https://nodejs.org/dist/latest-v25.x/docs/api/readline.html#readline_use_of_the_completer_function
|
||||||
|
*/
|
||||||
|
completer?: Completer | AsyncCompleter | undefined;
|
||||||
|
/**
|
||||||
|
* A flag that specifies whether the default evaluator executes all JavaScript commands in
|
||||||
|
* strict mode or default (sloppy) mode.
|
||||||
|
* Accepted values are:
|
||||||
|
* - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode.
|
||||||
|
* - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to
|
||||||
|
* prefacing every repl statement with `'use strict'`.
|
||||||
|
*/
|
||||||
|
replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT | undefined;
|
||||||
|
/**
|
||||||
|
* Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is
|
||||||
|
* pressed. This cannot be used together with a custom `eval` function.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
breakEvalOnSigint?: boolean | undefined;
|
||||||
|
}
|
||||||
|
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,
|
||||||
|
* and it can be overridden by custom print functions.
|
||||||
|
*/
|
||||||
|
const writer: REPLWriter & {
|
||||||
|
options: InspectOptions;
|
||||||
|
};
|
||||||
|
type REPLCommandAction = (this: REPLServer, text: string) => void;
|
||||||
|
interface REPLCommand {
|
||||||
|
/**
|
||||||
|
* Help text to be displayed when `.help` is entered.
|
||||||
|
*/
|
||||||
|
help?: string | undefined;
|
||||||
|
/**
|
||||||
|
* The function to execute, optionally accepting a single string argument.
|
||||||
|
*/
|
||||||
|
action: REPLCommandAction;
|
||||||
|
}
|
||||||
|
interface REPLServerSetupHistoryOptions {
|
||||||
|
filePath?: string | undefined;
|
||||||
|
size?: number | undefined;
|
||||||
|
removeHistoryDuplicates?: boolean | undefined;
|
||||||
|
onHistoryFileLoaded?: ((err: Error | null, repl: REPLServer) => void) | undefined;
|
||||||
|
}
|
||||||
|
interface REPLServerEventMap extends InterfaceEventMap {
|
||||||
|
"exit": [];
|
||||||
|
"reset": [context: Context];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Instances of `repl.REPLServer` are created using the {@link start} method
|
||||||
|
* or directly using the JavaScript `new` keyword.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import repl from 'node:repl';
|
||||||
|
*
|
||||||
|
* const options = { useColors: true };
|
||||||
|
*
|
||||||
|
* const firstInstance = repl.start(options);
|
||||||
|
* const secondInstance = new repl.REPLServer(options);
|
||||||
|
* ```
|
||||||
|
* @since v0.1.91
|
||||||
|
*/
|
||||||
|
class REPLServer extends Interface {
|
||||||
|
/**
|
||||||
|
* NOTE: According to the documentation:
|
||||||
|
*
|
||||||
|
* > Instances of `repl.REPLServer` are created using the `repl.start()` method and
|
||||||
|
* > _should not_ be created directly using the JavaScript `new` keyword.
|
||||||
|
*
|
||||||
|
* `REPLServer` cannot be subclassed due to implementation specifics in NodeJS.
|
||||||
|
*
|
||||||
|
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_class_replserver
|
||||||
|
*/
|
||||||
|
private constructor();
|
||||||
|
/**
|
||||||
|
* The `vm.Context` provided to the `eval` function to be used for JavaScript
|
||||||
|
* evaluation.
|
||||||
|
*/
|
||||||
|
readonly context: Context;
|
||||||
|
/**
|
||||||
|
* @deprecated since v14.3.0 - Use `input` instead.
|
||||||
|
*/
|
||||||
|
readonly inputStream: NodeJS.ReadableStream;
|
||||||
|
/**
|
||||||
|
* @deprecated since v14.3.0 - Use `output` instead.
|
||||||
|
*/
|
||||||
|
readonly outputStream: NodeJS.WritableStream;
|
||||||
|
/**
|
||||||
|
* The `Readable` stream from which REPL input will be read.
|
||||||
|
*/
|
||||||
|
readonly input: NodeJS.ReadableStream;
|
||||||
|
/**
|
||||||
|
* The `Writable` stream to which REPL output will be written.
|
||||||
|
*/
|
||||||
|
readonly output: NodeJS.WritableStream;
|
||||||
|
/**
|
||||||
|
* The commands registered via `replServer.defineCommand()`.
|
||||||
|
*/
|
||||||
|
readonly commands: NodeJS.ReadOnlyDict<REPLCommand>;
|
||||||
|
/**
|
||||||
|
* A value indicating whether the REPL is currently in "editor mode".
|
||||||
|
*
|
||||||
|
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_commands_and_special_keys
|
||||||
|
*/
|
||||||
|
readonly editorMode: boolean;
|
||||||
|
/**
|
||||||
|
* A value indicating whether the `_` variable has been assigned.
|
||||||
|
*
|
||||||
|
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
|
||||||
|
*/
|
||||||
|
readonly underscoreAssigned: boolean;
|
||||||
|
/**
|
||||||
|
* The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL).
|
||||||
|
*
|
||||||
|
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
|
||||||
|
*/
|
||||||
|
readonly last: any;
|
||||||
|
/**
|
||||||
|
* A value indicating whether the `_error` variable has been assigned.
|
||||||
|
*
|
||||||
|
* @since v9.8.0
|
||||||
|
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
|
||||||
|
*/
|
||||||
|
readonly underscoreErrAssigned: boolean;
|
||||||
|
/**
|
||||||
|
* The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL).
|
||||||
|
*
|
||||||
|
* @since v9.8.0
|
||||||
|
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
|
||||||
|
*/
|
||||||
|
readonly lastError: any;
|
||||||
|
/**
|
||||||
|
* Specified in the REPL options, this is the function to be used when evaluating each
|
||||||
|
* given line of input. If not specified in the REPL options, this is an async wrapper
|
||||||
|
* for the JavaScript `eval()` function.
|
||||||
|
*/
|
||||||
|
readonly eval: REPLEval;
|
||||||
|
/**
|
||||||
|
* Specified in the REPL options, this is a value indicating whether the default
|
||||||
|
* `writer` function should include ANSI color styling to REPL output.
|
||||||
|
*/
|
||||||
|
readonly useColors: boolean;
|
||||||
|
/**
|
||||||
|
* Specified in the REPL options, this is a value indicating whether the default `eval`
|
||||||
|
* function will use the JavaScript `global` as the context as opposed to creating a new
|
||||||
|
* separate context for the REPL instance.
|
||||||
|
*/
|
||||||
|
readonly useGlobal: boolean;
|
||||||
|
/**
|
||||||
|
* Specified in the REPL options, this is a value indicating whether the default `writer`
|
||||||
|
* function should output the result of a command if it evaluates to `undefined`.
|
||||||
|
*/
|
||||||
|
readonly ignoreUndefined: boolean;
|
||||||
|
/**
|
||||||
|
* Specified in the REPL options, this is the function to invoke to format the output of
|
||||||
|
* each command before writing to `outputStream`. If not specified in the REPL options,
|
||||||
|
* this will be a wrapper for `util.inspect`.
|
||||||
|
*/
|
||||||
|
readonly writer: REPLWriter;
|
||||||
|
/**
|
||||||
|
* Specified in the REPL options, this is the function to use for custom Tab auto-completion.
|
||||||
|
*/
|
||||||
|
readonly completer: Completer | AsyncCompleter;
|
||||||
|
/**
|
||||||
|
* Specified in the REPL options, this is a flag that specifies whether the default `eval`
|
||||||
|
* function should execute all JavaScript commands in strict mode or default (sloppy) mode.
|
||||||
|
* Possible values are:
|
||||||
|
* - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode.
|
||||||
|
* - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to
|
||||||
|
* prefacing every repl statement with `'use strict'`.
|
||||||
|
*/
|
||||||
|
readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT;
|
||||||
|
/**
|
||||||
|
* The `replServer.defineCommand()` method is used to add new `.`\-prefixed commands
|
||||||
|
* to the REPL instance. Such commands are invoked by typing a `.` followed by the `keyword`. The `cmd` is either a `Function` or an `Object` with the following
|
||||||
|
* properties:
|
||||||
|
*
|
||||||
|
* The following example shows two new commands added to the REPL instance:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import repl from 'node:repl';
|
||||||
|
*
|
||||||
|
* const replServer = repl.start({ prompt: '> ' });
|
||||||
|
* replServer.defineCommand('sayhello', {
|
||||||
|
* help: 'Say hello',
|
||||||
|
* action(name) {
|
||||||
|
* this.clearBufferedCommand();
|
||||||
|
* console.log(`Hello, ${name}!`);
|
||||||
|
* this.displayPrompt();
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
* replServer.defineCommand('saybye', function saybye() {
|
||||||
|
* console.log('Goodbye!');
|
||||||
|
* this.close();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The new commands can then be used from within the REPL instance:
|
||||||
|
*
|
||||||
|
* ```console
|
||||||
|
* > .sayhello Node.js User
|
||||||
|
* Hello, Node.js User!
|
||||||
|
* > .saybye
|
||||||
|
* Goodbye!
|
||||||
|
* ```
|
||||||
|
* @since v0.3.0
|
||||||
|
* @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;
|
||||||
|
/**
|
||||||
|
* The `replServer.displayPrompt()` method readies the REPL instance for input
|
||||||
|
* from the user, printing the configured `prompt` to a new line in the `output` and resuming the `input` to accept new input.
|
||||||
|
*
|
||||||
|
* When multi-line input is being entered, a pipe `'|'` is printed rather than the
|
||||||
|
* 'prompt'.
|
||||||
|
*
|
||||||
|
* When `preserveCursor` is `true`, the cursor placement will not be reset to `0`.
|
||||||
|
*
|
||||||
|
* The `replServer.displayPrompt` method is primarily intended to be called from
|
||||||
|
* within the action function for commands registered using the `replServer.defineCommand()` method.
|
||||||
|
* @since v0.1.91
|
||||||
|
*/
|
||||||
|
displayPrompt(preserveCursor?: boolean): void;
|
||||||
|
/**
|
||||||
|
* The `replServer.clearBufferedCommand()` method clears any command that has been
|
||||||
|
* buffered but not yet executed. This method is primarily intended to be
|
||||||
|
* called from within the action function for commands registered using the `replServer.defineCommand()` method.
|
||||||
|
* @since v9.0.0
|
||||||
|
*/
|
||||||
|
clearBufferedCommand(): void;
|
||||||
|
/**
|
||||||
|
* Initializes a history log file for the REPL instance. When executing the
|
||||||
|
* Node.js binary and using the command-line REPL, a history file is initialized
|
||||||
|
* by default. However, this is not the case when creating a REPL
|
||||||
|
* programmatically. Use this method to initialize a history log file when working
|
||||||
|
* with REPL instances programmatically.
|
||||||
|
* @since v11.10.0
|
||||||
|
* @param historyPath the path to the history file
|
||||||
|
* @param callback called when history writes are ready or upon error
|
||||||
|
*/
|
||||||
|
setupHistory(historyPath: string, callback: (err: Error | null, repl: this) => void): void;
|
||||||
|
setupHistory(
|
||||||
|
historyConfig?: REPLServerSetupHistoryOptions,
|
||||||
|
callback?: (err: Error | null, repl: this) => void,
|
||||||
|
): void;
|
||||||
|
// #region InternalEventEmitter
|
||||||
|
addListener<E extends keyof REPLServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: REPLServerEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
emit<E extends keyof REPLServerEventMap>(eventName: E, ...args: REPLServerEventMap[E]): boolean;
|
||||||
|
emit(eventName: string | symbol, ...args: any[]): boolean;
|
||||||
|
listenerCount<E extends keyof REPLServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener?: (...args: REPLServerEventMap[E]) => void,
|
||||||
|
): number;
|
||||||
|
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
||||||
|
listeners<E extends keyof REPLServerEventMap>(eventName: E): ((...args: REPLServerEventMap[E]) => void)[];
|
||||||
|
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
||||||
|
off<E extends keyof REPLServerEventMap>(eventName: E, listener: (...args: REPLServerEventMap[E]) => void): this;
|
||||||
|
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
on<E extends keyof REPLServerEventMap>(eventName: E, listener: (...args: REPLServerEventMap[E]) => void): this;
|
||||||
|
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
once<E extends keyof REPLServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: REPLServerEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
prependListener<E extends keyof REPLServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: REPLServerEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
prependOnceListener<E extends keyof REPLServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: REPLServerEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
rawListeners<E extends keyof REPLServerEventMap>(eventName: E): ((...args: REPLServerEventMap[E]) => void)[];
|
||||||
|
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
||||||
|
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
||||||
|
removeAllListeners<E extends keyof REPLServerEventMap>(eventName?: E): this;
|
||||||
|
removeAllListeners(eventName?: string | symbol): this;
|
||||||
|
removeListener<E extends keyof REPLServerEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: REPLServerEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
// #endregion
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A flag passed in the REPL options. Evaluates expressions in sloppy mode.
|
||||||
|
*/
|
||||||
|
const REPL_MODE_SLOPPY: unique symbol;
|
||||||
|
/**
|
||||||
|
* A flag passed in the REPL options. Evaluates expressions in strict mode.
|
||||||
|
* This is equivalent to prefacing every repl statement with `'use strict'`.
|
||||||
|
*/
|
||||||
|
const REPL_MODE_STRICT: unique symbol;
|
||||||
|
/**
|
||||||
|
* The `repl.start()` method creates and starts a {@link REPLServer} instance.
|
||||||
|
*
|
||||||
|
* If `options` is a string, then it specifies the input prompt:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import repl from 'node:repl';
|
||||||
|
*
|
||||||
|
* // a Unix style prompt
|
||||||
|
* repl.start('$ ');
|
||||||
|
* ```
|
||||||
|
* @since v0.1.91
|
||||||
|
*/
|
||||||
|
function start(options?: string | ReplOptions): REPLServer;
|
||||||
|
/**
|
||||||
|
* Indicates a recoverable error that a `REPLServer` can use to support multi-line input.
|
||||||
|
*
|
||||||
|
* @see https://nodejs.org/dist/latest-v25.x/docs/api/repl.html#repl_recoverable_errors
|
||||||
|
*/
|
||||||
|
class Recoverable extends SyntaxError {
|
||||||
|
err: Error;
|
||||||
|
constructor(err: Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module "repl" {
|
||||||
|
export * from "node:repl";
|
||||||
|
}
|
||||||
162
node_modules/@types/node/sea.d.ts
generated
vendored
Normal file
162
node_modules/@types/node/sea.d.ts
generated
vendored
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
/**
|
||||||
|
* This feature allows the distribution of a Node.js application conveniently to a
|
||||||
|
* system that does not have Node.js installed.
|
||||||
|
*
|
||||||
|
* Node.js supports the creation of [single executable applications](https://github.com/nodejs/single-executable) by allowing
|
||||||
|
* the injection of a blob prepared by Node.js, which can contain a bundled script,
|
||||||
|
* into the `node` binary. During start up, the program checks if anything has been
|
||||||
|
* injected. If the blob is found, it executes the script in the blob. Otherwise
|
||||||
|
* Node.js operates as it normally does.
|
||||||
|
*
|
||||||
|
* The single executable application feature currently only supports running a
|
||||||
|
* single embedded script using the `CommonJS` module system.
|
||||||
|
*
|
||||||
|
* Users can create a single executable application from their bundled script
|
||||||
|
* with the `node` binary itself and any tool which can inject resources into the
|
||||||
|
* binary.
|
||||||
|
*
|
||||||
|
* Here are the steps for creating a single executable application using one such
|
||||||
|
* tool, [postject](https://github.com/nodejs/postject):
|
||||||
|
*
|
||||||
|
* 1. Create a JavaScript file:
|
||||||
|
* ```bash
|
||||||
|
* echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js
|
||||||
|
* ```
|
||||||
|
* 2. Create a configuration file building a blob that can be injected into the
|
||||||
|
* single executable application (see `Generating single executable preparation blobs` for details):
|
||||||
|
* ```bash
|
||||||
|
* echo '{ "main": "hello.js", "output": "sea-prep.blob" }' > sea-config.json
|
||||||
|
* ```
|
||||||
|
* 3. Generate the blob to be injected:
|
||||||
|
* ```bash
|
||||||
|
* node --experimental-sea-config sea-config.json
|
||||||
|
* ```
|
||||||
|
* 4. Create a copy of the `node` executable and name it according to your needs:
|
||||||
|
* * On systems other than Windows:
|
||||||
|
* ```bash
|
||||||
|
* cp $(command -v node) hello
|
||||||
|
* ```
|
||||||
|
* * On Windows:
|
||||||
|
* ```text
|
||||||
|
* node -e "require('fs').copyFileSync(process.execPath, 'hello.exe')"
|
||||||
|
* ```
|
||||||
|
* The `.exe` extension is necessary.
|
||||||
|
* 5. Remove the signature of the binary (macOS and Windows only):
|
||||||
|
* * On macOS:
|
||||||
|
* ```bash
|
||||||
|
* codesign --remove-signature hello
|
||||||
|
* ```
|
||||||
|
* * On Windows (optional):
|
||||||
|
* [signtool](https://learn.microsoft.com/en-us/windows/win32/seccrypto/signtool) can be used from the installed [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/).
|
||||||
|
* If this step is
|
||||||
|
* skipped, ignore any signature-related warning from postject.
|
||||||
|
* ```powershell
|
||||||
|
* signtool remove /s hello.exe
|
||||||
|
* ```
|
||||||
|
* 6. Inject the blob into the copied binary by running `postject` with
|
||||||
|
* the following options:
|
||||||
|
* * `hello` / `hello.exe` \- The name of the copy of the `node` executable
|
||||||
|
* created in step 4.
|
||||||
|
* * `NODE_SEA_BLOB` \- The name of the resource / note / section in the binary
|
||||||
|
* where the contents of the blob will be stored.
|
||||||
|
* * `sea-prep.blob` \- The name of the blob created in step 1.
|
||||||
|
* * `--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2` \- The [fuse](https://www.electronjs.org/docs/latest/tutorial/fuses) used by the Node.js project to detect if a file has been
|
||||||
|
* injected.
|
||||||
|
* * `--macho-segment-name NODE_SEA` (only needed on macOS) - The name of the
|
||||||
|
* segment in the binary where the contents of the blob will be
|
||||||
|
* stored.
|
||||||
|
* To summarize, here is the required command for each platform:
|
||||||
|
* * On Linux:
|
||||||
|
* ```bash
|
||||||
|
* npx postject hello NODE_SEA_BLOB sea-prep.blob \
|
||||||
|
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
|
||||||
|
* ```
|
||||||
|
* * On Windows - PowerShell:
|
||||||
|
* ```powershell
|
||||||
|
* npx postject hello.exe NODE_SEA_BLOB sea-prep.blob `
|
||||||
|
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
|
||||||
|
* ```
|
||||||
|
* * On Windows - Command Prompt:
|
||||||
|
* ```text
|
||||||
|
* npx postject hello.exe NODE_SEA_BLOB sea-prep.blob ^
|
||||||
|
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
|
||||||
|
* ```
|
||||||
|
* * On macOS:
|
||||||
|
* ```bash
|
||||||
|
* npx postject hello NODE_SEA_BLOB sea-prep.blob \
|
||||||
|
* --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
|
||||||
|
* --macho-segment-name NODE_SEA
|
||||||
|
* ```
|
||||||
|
* 7. Sign the binary (macOS and Windows only):
|
||||||
|
* * On macOS:
|
||||||
|
* ```bash
|
||||||
|
* codesign --sign - hello
|
||||||
|
* ```
|
||||||
|
* * On Windows (optional):
|
||||||
|
* A certificate needs to be present for this to work. However, the unsigned
|
||||||
|
* binary would still be runnable.
|
||||||
|
* ```powershell
|
||||||
|
* signtool sign /fd SHA256 hello.exe
|
||||||
|
* ```
|
||||||
|
* 8. Run the binary:
|
||||||
|
* * On systems other than Windows
|
||||||
|
* ```console
|
||||||
|
* $ ./hello world
|
||||||
|
* Hello, world!
|
||||||
|
* ```
|
||||||
|
* * On Windows
|
||||||
|
* ```console
|
||||||
|
* $ .\hello.exe world
|
||||||
|
* Hello, world!
|
||||||
|
* ```
|
||||||
|
* @since v19.7.0, v18.16.0
|
||||||
|
* @experimental
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/src/node_sea.cc)
|
||||||
|
*/
|
||||||
|
declare module "node:sea" {
|
||||||
|
type AssetKey = string;
|
||||||
|
/**
|
||||||
|
* @since v20.12.0
|
||||||
|
* @return Whether this script is running inside a single-executable application.
|
||||||
|
*/
|
||||||
|
function isSea(): boolean;
|
||||||
|
/**
|
||||||
|
* This method can be used to retrieve the assets configured to be bundled into the
|
||||||
|
* single-executable application at build time.
|
||||||
|
* An error is thrown when no matching asset can be found.
|
||||||
|
* @since v20.12.0
|
||||||
|
*/
|
||||||
|
function getAsset(key: AssetKey): ArrayBuffer;
|
||||||
|
function getAsset(key: AssetKey, encoding: string): string;
|
||||||
|
/**
|
||||||
|
* Similar to `sea.getAsset()`, but returns the result in a [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob).
|
||||||
|
* An error is thrown when no matching asset can be found.
|
||||||
|
* @since v20.12.0
|
||||||
|
*/
|
||||||
|
function getAssetAsBlob(key: AssetKey, options?: {
|
||||||
|
type: string;
|
||||||
|
}): Blob;
|
||||||
|
/**
|
||||||
|
* This method can be used to retrieve the assets configured to be bundled into the
|
||||||
|
* single-executable application at build time.
|
||||||
|
* An error is thrown when no matching asset can be found.
|
||||||
|
*
|
||||||
|
* Unlike `sea.getRawAsset()` or `sea.getAssetAsBlob()`, this method does not
|
||||||
|
* return a copy. Instead, it returns the raw asset bundled inside the executable.
|
||||||
|
*
|
||||||
|
* For now, users should avoid writing to the returned array buffer. If the
|
||||||
|
* injected section is not marked as writable or not aligned properly,
|
||||||
|
* writes to the returned array buffer is likely to result in a crash.
|
||||||
|
* @since v20.12.0
|
||||||
|
*/
|
||||||
|
function getRawAsset(key: AssetKey): ArrayBuffer;
|
||||||
|
/**
|
||||||
|
* This method can be used to retrieve an array of all the keys of assets
|
||||||
|
* embedded into the single-executable application.
|
||||||
|
* An error is thrown when not running inside a single-executable application.
|
||||||
|
* @since v24.8.0
|
||||||
|
* @returns An array containing all the keys of the assets
|
||||||
|
* embedded in the executable. If no assets are embedded, returns an empty array.
|
||||||
|
*/
|
||||||
|
function getAssetKeys(): string[];
|
||||||
|
}
|
||||||
1065
node_modules/@types/node/sqlite.d.ts
generated
vendored
Normal file
1065
node_modules/@types/node/sqlite.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1770
node_modules/@types/node/stream.d.ts
generated
vendored
Normal file
1770
node_modules/@types/node/stream.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
38
node_modules/@types/node/stream/consumers.d.ts
generated
vendored
Normal file
38
node_modules/@types/node/stream/consumers.d.ts
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* The utility consumer functions provide common options for consuming
|
||||||
|
* streams.
|
||||||
|
* @since v16.7.0
|
||||||
|
*/
|
||||||
|
declare module "node:stream/consumers" {
|
||||||
|
import { Blob, NonSharedBuffer } from "node:buffer";
|
||||||
|
import { ReadableStream } from "node:stream/web";
|
||||||
|
/**
|
||||||
|
* @since v16.7.0
|
||||||
|
* @returns Fulfills with an `ArrayBuffer` containing the full contents of the stream.
|
||||||
|
*/
|
||||||
|
function arrayBuffer(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<ArrayBuffer>;
|
||||||
|
/**
|
||||||
|
* @since v16.7.0
|
||||||
|
* @returns Fulfills with a `Blob` containing the full contents of the stream.
|
||||||
|
*/
|
||||||
|
function blob(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<Blob>;
|
||||||
|
/**
|
||||||
|
* @since v16.7.0
|
||||||
|
* @returns Fulfills with a `Buffer` containing the full contents of the stream.
|
||||||
|
*/
|
||||||
|
function buffer(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<NonSharedBuffer>;
|
||||||
|
/**
|
||||||
|
* @since v16.7.0
|
||||||
|
* @returns Fulfills with the contents of the stream parsed as a
|
||||||
|
* UTF-8 encoded string that is then passed through `JSON.parse()`.
|
||||||
|
*/
|
||||||
|
function json(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<unknown>;
|
||||||
|
/**
|
||||||
|
* @since v16.7.0
|
||||||
|
* @returns Fulfills with the contents of the stream parsed as a UTF-8 encoded string.
|
||||||
|
*/
|
||||||
|
function text(stream: ReadableStream | NodeJS.ReadableStream | AsyncIterable<any>): Promise<string>;
|
||||||
|
}
|
||||||
|
declare module "stream/consumers" {
|
||||||
|
export * from "node:stream/consumers";
|
||||||
|
}
|
||||||
211
node_modules/@types/node/stream/promises.d.ts
generated
vendored
Normal file
211
node_modules/@types/node/stream/promises.d.ts
generated
vendored
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
declare module "node:stream/promises" {
|
||||||
|
import { Abortable } from "node:events";
|
||||||
|
import {
|
||||||
|
FinishedOptions as _FinishedOptions,
|
||||||
|
PipelineDestination,
|
||||||
|
PipelineSource,
|
||||||
|
PipelineTransform,
|
||||||
|
} from "node:stream";
|
||||||
|
import { ReadableStream, WritableStream } from "node:stream/web";
|
||||||
|
interface FinishedOptions extends _FinishedOptions {
|
||||||
|
/**
|
||||||
|
* If true, removes the listeners registered by this function before the promise is fulfilled.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
cleanup?: boolean | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* import { finished } from 'node:stream/promises';
|
||||||
|
* import { createReadStream } from 'node:fs';
|
||||||
|
*
|
||||||
|
* const rs = createReadStream('archive.tar');
|
||||||
|
*
|
||||||
|
* async function run() {
|
||||||
|
* await finished(rs);
|
||||||
|
* console.log('Stream is done reading.');
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* run().catch(console.error);
|
||||||
|
* rs.resume(); // Drain the stream.
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The `finished` API also provides a [callback version](https://nodejs.org/docs/latest-v25.x/api/stream.html#streamfinishedstream-options-callback).
|
||||||
|
*
|
||||||
|
* `stream.finished()` leaves dangling event listeners (in particular
|
||||||
|
* `'error'`, `'end'`, `'finish'` and `'close'`) after the returned promise is
|
||||||
|
* resolved or rejected. The reason for this is so that unexpected `'error'`
|
||||||
|
* events (due to incorrect stream implementations) do not cause unexpected
|
||||||
|
* crashes. If this is unwanted behavior then `options.cleanup` should be set to
|
||||||
|
* `true`:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* await finished(rs, { cleanup: true });
|
||||||
|
* ```
|
||||||
|
* @since v15.0.0
|
||||||
|
* @returns Fulfills when the stream is no longer readable or writable.
|
||||||
|
*/
|
||||||
|
function finished(
|
||||||
|
stream: NodeJS.ReadableStream | NodeJS.WritableStream | ReadableStream | WritableStream,
|
||||||
|
options?: FinishedOptions,
|
||||||
|
): Promise<void>;
|
||||||
|
interface PipelineOptions extends Abortable {
|
||||||
|
end?: boolean | undefined;
|
||||||
|
}
|
||||||
|
type PipelineResult<S extends PipelineDestination<any, any>> = S extends (...args: any[]) => PromiseLike<infer R>
|
||||||
|
? Promise<R>
|
||||||
|
: Promise<void>;
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* import { pipeline } from 'node:stream/promises';
|
||||||
|
* import { createReadStream, createWriteStream } from 'node:fs';
|
||||||
|
* import { createGzip } from 'node:zlib';
|
||||||
|
*
|
||||||
|
* await pipeline(
|
||||||
|
* createReadStream('archive.tar'),
|
||||||
|
* createGzip(),
|
||||||
|
* createWriteStream('archive.tar.gz'),
|
||||||
|
* );
|
||||||
|
* console.log('Pipeline succeeded.');
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To use an `AbortSignal`, pass it inside an options object, as the last argument.
|
||||||
|
* When the signal is aborted, `destroy` will be called on the underlying pipeline,
|
||||||
|
* with an `AbortError`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { pipeline } from 'node:stream/promises';
|
||||||
|
* import { createReadStream, createWriteStream } from 'node:fs';
|
||||||
|
* import { createGzip } from 'node:zlib';
|
||||||
|
*
|
||||||
|
* const ac = new AbortController();
|
||||||
|
* const { signal } = ac;
|
||||||
|
* setImmediate(() => ac.abort());
|
||||||
|
* try {
|
||||||
|
* await pipeline(
|
||||||
|
* createReadStream('archive.tar'),
|
||||||
|
* createGzip(),
|
||||||
|
* createWriteStream('archive.tar.gz'),
|
||||||
|
* { signal },
|
||||||
|
* );
|
||||||
|
* } catch (err) {
|
||||||
|
* console.error(err); // AbortError
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The `pipeline` API also supports async generators:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { pipeline } from 'node:stream/promises';
|
||||||
|
* import { createReadStream, createWriteStream } from 'node:fs';
|
||||||
|
*
|
||||||
|
* await pipeline(
|
||||||
|
* createReadStream('lowercase.txt'),
|
||||||
|
* async function* (source, { signal }) {
|
||||||
|
* source.setEncoding('utf8'); // Work with strings rather than `Buffer`s.
|
||||||
|
* for await (const chunk of source) {
|
||||||
|
* yield await processChunk(chunk, { signal });
|
||||||
|
* }
|
||||||
|
* },
|
||||||
|
* createWriteStream('uppercase.txt'),
|
||||||
|
* );
|
||||||
|
* console.log('Pipeline succeeded.');
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Remember to handle the `signal` argument passed into the async generator.
|
||||||
|
* Especially in the case where the async generator is the source for the
|
||||||
|
* pipeline (i.e. first argument) or the pipeline will never complete.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { pipeline } from 'node:stream/promises';
|
||||||
|
* import fs from 'node:fs';
|
||||||
|
* await pipeline(
|
||||||
|
* async function* ({ signal }) {
|
||||||
|
* await someLongRunningfn({ signal });
|
||||||
|
* yield 'asd';
|
||||||
|
* },
|
||||||
|
* fs.createWriteStream('uppercase.txt'),
|
||||||
|
* );
|
||||||
|
* console.log('Pipeline succeeded.');
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The `pipeline` API provides [callback version](https://nodejs.org/docs/latest-v25.x/api/stream.html#streampipelinesource-transforms-destination-callback):
|
||||||
|
* @since v15.0.0
|
||||||
|
* @returns Fulfills when the pipeline is complete.
|
||||||
|
*/
|
||||||
|
function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(
|
||||||
|
source: A,
|
||||||
|
destination: B,
|
||||||
|
options?: PipelineOptions,
|
||||||
|
): PipelineResult<B>;
|
||||||
|
function pipeline<
|
||||||
|
A extends PipelineSource<any>,
|
||||||
|
T1 extends PipelineTransform<A, any>,
|
||||||
|
B extends PipelineDestination<T1, any>,
|
||||||
|
>(
|
||||||
|
source: A,
|
||||||
|
transform1: T1,
|
||||||
|
destination: B,
|
||||||
|
options?: PipelineOptions,
|
||||||
|
): PipelineResult<B>;
|
||||||
|
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,
|
||||||
|
): PipelineResult<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,
|
||||||
|
): PipelineResult<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,
|
||||||
|
): PipelineResult<B>;
|
||||||
|
function pipeline(
|
||||||
|
streams: readonly [PipelineSource<any>, ...PipelineTransform<any, any>[], PipelineDestination<any, any>],
|
||||||
|
options?: PipelineOptions,
|
||||||
|
): Promise<void>;
|
||||||
|
function pipeline(
|
||||||
|
...streams: [PipelineSource<any>, ...PipelineTransform<any, any>[], PipelineDestination<any, any>]
|
||||||
|
): Promise<void>;
|
||||||
|
function pipeline(
|
||||||
|
...streams: [
|
||||||
|
PipelineSource<any>,
|
||||||
|
...PipelineTransform<any, any>[],
|
||||||
|
PipelineDestination<any, any>,
|
||||||
|
options: PipelineOptions,
|
||||||
|
]
|
||||||
|
): Promise<void>;
|
||||||
|
}
|
||||||
|
declare module "stream/promises" {
|
||||||
|
export * from "node:stream/promises";
|
||||||
|
}
|
||||||
296
node_modules/@types/node/stream/web.d.ts
generated
vendored
Normal file
296
node_modules/@types/node/stream/web.d.ts
generated
vendored
Normal file
@ -0,0 +1,296 @@
|
|||||||
|
declare module "node:stream/web" {
|
||||||
|
import { TextDecoderCommon, TextDecoderOptions, TextEncoderCommon } from "node:util";
|
||||||
|
type CompressionFormat = "brotli" | "deflate" | "deflate-raw" | "gzip";
|
||||||
|
type ReadableStreamController<T> = ReadableStreamDefaultController<T> | ReadableByteStreamController;
|
||||||
|
type ReadableStreamReader<T> = ReadableStreamDefaultReader<T> | ReadableStreamBYOBReader;
|
||||||
|
type ReadableStreamReaderMode = "byob";
|
||||||
|
type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
|
||||||
|
type ReadableStreamType = "bytes";
|
||||||
|
interface GenericTransformStream {
|
||||||
|
readonly readable: ReadableStream;
|
||||||
|
readonly writable: WritableStream;
|
||||||
|
}
|
||||||
|
interface QueuingStrategy<T = any> {
|
||||||
|
highWaterMark?: number;
|
||||||
|
size?: QueuingStrategySize<T>;
|
||||||
|
}
|
||||||
|
interface QueuingStrategyInit {
|
||||||
|
highWaterMark: number;
|
||||||
|
}
|
||||||
|
interface QueuingStrategySize<T = any> {
|
||||||
|
(chunk: T): number;
|
||||||
|
}
|
||||||
|
interface ReadableStreamBYOBReaderReadOptions {
|
||||||
|
min?: number;
|
||||||
|
}
|
||||||
|
interface ReadableStreamGenericReader {
|
||||||
|
readonly closed: Promise<void>;
|
||||||
|
cancel(reason?: any): Promise<void>;
|
||||||
|
}
|
||||||
|
interface ReadableStreamGetReaderOptions {
|
||||||
|
mode?: ReadableStreamReaderMode;
|
||||||
|
}
|
||||||
|
interface ReadableStreamIteratorOptions {
|
||||||
|
preventCancel?: boolean;
|
||||||
|
}
|
||||||
|
interface ReadableStreamReadDoneResult<T> {
|
||||||
|
done: true;
|
||||||
|
value: T | undefined;
|
||||||
|
}
|
||||||
|
interface ReadableStreamReadValueResult<T> {
|
||||||
|
done: false;
|
||||||
|
value: T;
|
||||||
|
}
|
||||||
|
interface ReadableWritablePair<R = any, W = any> {
|
||||||
|
readable: ReadableStream<R>;
|
||||||
|
writable: WritableStream<W>;
|
||||||
|
}
|
||||||
|
interface StreamPipeOptions {
|
||||||
|
preventAbort?: boolean;
|
||||||
|
preventCancel?: boolean;
|
||||||
|
preventClose?: boolean;
|
||||||
|
signal?: AbortSignal;
|
||||||
|
}
|
||||||
|
interface Transformer<I = any, O = any> {
|
||||||
|
flush?: TransformerFlushCallback<O>;
|
||||||
|
readableType?: undefined;
|
||||||
|
start?: TransformerStartCallback<O>;
|
||||||
|
transform?: TransformerTransformCallback<I, O>;
|
||||||
|
writableType?: undefined;
|
||||||
|
}
|
||||||
|
interface 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?: UnderlyingSourceCancelCallback;
|
||||||
|
pull?: (controller: ReadableByteStreamController) => void | PromiseLike<void>;
|
||||||
|
start?: (controller: ReadableByteStreamController) => any;
|
||||||
|
type: "bytes";
|
||||||
|
}
|
||||||
|
interface UnderlyingDefaultSource<R = any> {
|
||||||
|
cancel?: UnderlyingSourceCancelCallback;
|
||||||
|
pull?: (controller: ReadableStreamDefaultController<R>) => void | PromiseLike<void>;
|
||||||
|
start?: (controller: ReadableStreamDefaultController<R>) => any;
|
||||||
|
type?: undefined;
|
||||||
|
}
|
||||||
|
interface UnderlyingSink<W = any> {
|
||||||
|
abort?: UnderlyingSinkAbortCallback;
|
||||||
|
close?: UnderlyingSinkCloseCallback;
|
||||||
|
start?: UnderlyingSinkStartCallback;
|
||||||
|
type?: undefined;
|
||||||
|
write?: UnderlyingSinkWriteCallback<W>;
|
||||||
|
}
|
||||||
|
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 UnderlyingSource<R = any> {
|
||||||
|
autoAllocateChunkSize?: number;
|
||||||
|
cancel?: UnderlyingSourceCancelCallback;
|
||||||
|
pull?: UnderlyingSourcePullCallback<R>;
|
||||||
|
start?: UnderlyingSourceStartCallback<R>;
|
||||||
|
type?: ReadableStreamType;
|
||||||
|
}
|
||||||
|
interface UnderlyingSourceCancelCallback {
|
||||||
|
(reason?: any): void | PromiseLike<void>;
|
||||||
|
}
|
||||||
|
interface UnderlyingSourcePullCallback<R> {
|
||||||
|
(controller: ReadableStreamController<R>): void | PromiseLike<void>;
|
||||||
|
}
|
||||||
|
interface UnderlyingSourceStartCallback<R> {
|
||||||
|
(controller: ReadableStreamController<R>): any;
|
||||||
|
}
|
||||||
|
interface ByteLengthQueuingStrategy extends QueuingStrategy<NodeJS.ArrayBufferView> {
|
||||||
|
readonly highWaterMark: number;
|
||||||
|
readonly size: QueuingStrategySize<NodeJS.ArrayBufferView>;
|
||||||
|
}
|
||||||
|
var ByteLengthQueuingStrategy: {
|
||||||
|
prototype: ByteLengthQueuingStrategy;
|
||||||
|
new(init: QueuingStrategyInit): ByteLengthQueuingStrategy;
|
||||||
|
};
|
||||||
|
interface CompressionStream extends GenericTransformStream {
|
||||||
|
readonly readable: ReadableStream<NodeJS.NonSharedUint8Array>;
|
||||||
|
readonly writable: WritableStream<NodeJS.BufferSource>;
|
||||||
|
}
|
||||||
|
var CompressionStream: {
|
||||||
|
prototype: CompressionStream;
|
||||||
|
new(format: CompressionFormat): CompressionStream;
|
||||||
|
};
|
||||||
|
interface CountQueuingStrategy extends QueuingStrategy {
|
||||||
|
readonly highWaterMark: number;
|
||||||
|
readonly size: QueuingStrategySize;
|
||||||
|
}
|
||||||
|
var CountQueuingStrategy: {
|
||||||
|
prototype: CountQueuingStrategy;
|
||||||
|
new(init: QueuingStrategyInit): CountQueuingStrategy;
|
||||||
|
};
|
||||||
|
interface DecompressionStream extends GenericTransformStream {
|
||||||
|
readonly readable: ReadableStream<NodeJS.NonSharedUint8Array>;
|
||||||
|
readonly writable: WritableStream<NodeJS.BufferSource>;
|
||||||
|
}
|
||||||
|
var DecompressionStream: {
|
||||||
|
prototype: DecompressionStream;
|
||||||
|
new(format: CompressionFormat): DecompressionStream;
|
||||||
|
};
|
||||||
|
interface ReadableByteStreamController {
|
||||||
|
readonly byobRequest: ReadableStreamBYOBRequest | null;
|
||||||
|
readonly desiredSize: number | null;
|
||||||
|
close(): void;
|
||||||
|
enqueue(chunk: NodeJS.NonSharedArrayBufferView): void;
|
||||||
|
error(e?: any): void;
|
||||||
|
}
|
||||||
|
var ReadableByteStreamController: {
|
||||||
|
prototype: ReadableByteStreamController;
|
||||||
|
new(): ReadableByteStreamController;
|
||||||
|
};
|
||||||
|
interface ReadableStream<R = any> {
|
||||||
|
readonly locked: boolean;
|
||||||
|
cancel(reason?: any): Promise<void>;
|
||||||
|
getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
|
||||||
|
getReader(): ReadableStreamDefaultReader<R>;
|
||||||
|
getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader<R>;
|
||||||
|
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
|
||||||
|
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
|
||||||
|
tee(): [ReadableStream<R>, ReadableStream<R>];
|
||||||
|
[Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
|
||||||
|
values(options?: ReadableStreamIteratorOptions): ReadableStreamAsyncIterator<R>;
|
||||||
|
}
|
||||||
|
var ReadableStream: {
|
||||||
|
prototype: ReadableStream;
|
||||||
|
new(
|
||||||
|
underlyingSource: UnderlyingByteSource,
|
||||||
|
strategy?: { highWaterMark?: number },
|
||||||
|
): ReadableStream<NodeJS.NonSharedUint8Array>;
|
||||||
|
new<R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
|
||||||
|
new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
|
||||||
|
from<R = any>(iterable: Iterable<R> | AsyncIterable<R>): ReadableStream<R>;
|
||||||
|
};
|
||||||
|
interface ReadableStreamAsyncIterator<T> extends NodeJS.AsyncIterator<T, NodeJS.BuiltinIteratorReturn, unknown> {
|
||||||
|
[Symbol.asyncIterator](): ReadableStreamAsyncIterator<T>;
|
||||||
|
}
|
||||||
|
interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
|
||||||
|
read<T extends NodeJS.NonSharedArrayBufferView>(
|
||||||
|
view: T,
|
||||||
|
options?: ReadableStreamBYOBReaderReadOptions,
|
||||||
|
): Promise<ReadableStreamReadResult<T>>;
|
||||||
|
releaseLock(): void;
|
||||||
|
}
|
||||||
|
var ReadableStreamBYOBReader: {
|
||||||
|
prototype: ReadableStreamBYOBReader;
|
||||||
|
new(stream: ReadableStream<NodeJS.NonSharedUint8Array>): ReadableStreamBYOBReader;
|
||||||
|
};
|
||||||
|
interface ReadableStreamBYOBRequest {
|
||||||
|
readonly view: NodeJS.NonSharedArrayBufferView | null;
|
||||||
|
respond(bytesWritten: number): void;
|
||||||
|
respondWithNewView(view: NodeJS.NonSharedArrayBufferView): void;
|
||||||
|
}
|
||||||
|
var ReadableStreamBYOBRequest: {
|
||||||
|
prototype: ReadableStreamBYOBRequest;
|
||||||
|
new(): ReadableStreamBYOBRequest;
|
||||||
|
};
|
||||||
|
interface ReadableStreamDefaultController<R = any> {
|
||||||
|
readonly desiredSize: number | null;
|
||||||
|
close(): void;
|
||||||
|
enqueue(chunk?: R): void;
|
||||||
|
error(e?: any): void;
|
||||||
|
}
|
||||||
|
var ReadableStreamDefaultController: {
|
||||||
|
prototype: ReadableStreamDefaultController;
|
||||||
|
new(): ReadableStreamDefaultController;
|
||||||
|
};
|
||||||
|
interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader {
|
||||||
|
read(): Promise<ReadableStreamReadResult<R>>;
|
||||||
|
releaseLock(): void;
|
||||||
|
}
|
||||||
|
var ReadableStreamDefaultReader: {
|
||||||
|
prototype: ReadableStreamDefaultReader;
|
||||||
|
new<R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
|
||||||
|
};
|
||||||
|
interface TextDecoderStream extends GenericTransformStream, TextDecoderCommon {
|
||||||
|
readonly readable: ReadableStream<string>;
|
||||||
|
readonly writable: WritableStream<NodeJS.BufferSource>;
|
||||||
|
}
|
||||||
|
var TextDecoderStream: {
|
||||||
|
prototype: TextDecoderStream;
|
||||||
|
new(label?: string, options?: TextDecoderOptions): TextDecoderStream;
|
||||||
|
};
|
||||||
|
interface TextEncoderStream extends GenericTransformStream, TextEncoderCommon {
|
||||||
|
readonly readable: ReadableStream<NodeJS.NonSharedUint8Array>;
|
||||||
|
readonly writable: WritableStream<string>;
|
||||||
|
}
|
||||||
|
var TextEncoderStream: {
|
||||||
|
prototype: TextEncoderStream;
|
||||||
|
new(): TextEncoderStream;
|
||||||
|
};
|
||||||
|
interface TransformStream<I = any, O = any> {
|
||||||
|
readonly readable: ReadableStream<O>;
|
||||||
|
readonly writable: WritableStream<I>;
|
||||||
|
}
|
||||||
|
var TransformStream: {
|
||||||
|
prototype: TransformStream;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
var TransformStreamDefaultController: {
|
||||||
|
prototype: TransformStreamDefaultController;
|
||||||
|
new(): TransformStreamDefaultController;
|
||||||
|
};
|
||||||
|
interface WritableStream<W = any> {
|
||||||
|
readonly locked: boolean;
|
||||||
|
abort(reason?: any): Promise<void>;
|
||||||
|
close(): Promise<void>;
|
||||||
|
getWriter(): WritableStreamDefaultWriter<W>;
|
||||||
|
}
|
||||||
|
var WritableStream: {
|
||||||
|
prototype: WritableStream;
|
||||||
|
new<W = any>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
|
||||||
|
};
|
||||||
|
interface WritableStreamDefaultController {
|
||||||
|
readonly signal: AbortSignal;
|
||||||
|
error(e?: any): void;
|
||||||
|
}
|
||||||
|
var WritableStreamDefaultController: {
|
||||||
|
prototype: WritableStreamDefaultController;
|
||||||
|
new(): WritableStreamDefaultController;
|
||||||
|
};
|
||||||
|
interface WritableStreamDefaultWriter<W = any> {
|
||||||
|
readonly closed: Promise<void>;
|
||||||
|
readonly desiredSize: number | null;
|
||||||
|
readonly ready: Promise<void>;
|
||||||
|
abort(reason?: any): Promise<void>;
|
||||||
|
close(): Promise<void>;
|
||||||
|
releaseLock(): void;
|
||||||
|
write(chunk?: W): Promise<void>;
|
||||||
|
}
|
||||||
|
var WritableStreamDefaultWriter: {
|
||||||
|
prototype: WritableStreamDefaultWriter;
|
||||||
|
new<W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
declare module "stream/web" {
|
||||||
|
export * from "node:stream/web";
|
||||||
|
}
|
||||||
67
node_modules/@types/node/string_decoder.d.ts
generated
vendored
Normal file
67
node_modules/@types/node/string_decoder.d.ts
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/**
|
||||||
|
* The `node:string_decoder` module provides an API for decoding `Buffer` objects
|
||||||
|
* into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16
|
||||||
|
* characters. It can be accessed using:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { StringDecoder } from 'node:string_decoder';
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The following example shows the basic use of the `StringDecoder` class.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { StringDecoder } from 'node:string_decoder';
|
||||||
|
* const decoder = new StringDecoder('utf8');
|
||||||
|
*
|
||||||
|
* const cent = Buffer.from([0xC2, 0xA2]);
|
||||||
|
* console.log(decoder.write(cent)); // Prints: ¢
|
||||||
|
*
|
||||||
|
* const euro = Buffer.from([0xE2, 0x82, 0xAC]);
|
||||||
|
* console.log(decoder.write(euro)); // Prints: €
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* When a `Buffer` instance is written to the `StringDecoder` instance, an
|
||||||
|
* internal buffer is used to ensure that the decoded string does not contain
|
||||||
|
* any incomplete multibyte characters. These are held in the buffer until the
|
||||||
|
* next call to `stringDecoder.write()` or until `stringDecoder.end()` is called.
|
||||||
|
*
|
||||||
|
* In the following example, the three UTF-8 encoded bytes of the European Euro
|
||||||
|
* symbol (`€`) are written over three separate operations:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { StringDecoder } from 'node: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: €
|
||||||
|
* ```
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/string_decoder.js)
|
||||||
|
*/
|
||||||
|
declare module "node:string_decoder" {
|
||||||
|
class StringDecoder {
|
||||||
|
constructor(encoding?: BufferEncoding);
|
||||||
|
/**
|
||||||
|
* Returns a decoded string, ensuring that any incomplete multibyte characters at
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
write(buffer: string | NodeJS.ArrayBufferView): string;
|
||||||
|
/**
|
||||||
|
* Returns any remaining input stored in the internal buffer as a string. Bytes
|
||||||
|
* representing incomplete UTF-8 and UTF-16 characters will be replaced with
|
||||||
|
* substitution characters appropriate for the character encoding.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
end(buffer?: string | NodeJS.ArrayBufferView): string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module "string_decoder" {
|
||||||
|
export * from "node:string_decoder";
|
||||||
|
}
|
||||||
2275
node_modules/@types/node/test.d.ts
generated
vendored
Normal file
2275
node_modules/@types/node/test.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
96
node_modules/@types/node/test/reporters.d.ts
generated
vendored
Normal file
96
node_modules/@types/node/test/reporters.d.ts
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/**
|
||||||
|
* The `node:test` module supports passing `--test-reporter`
|
||||||
|
* flags for the test runner to use a specific reporter.
|
||||||
|
*
|
||||||
|
* The following built-reporters are supported:
|
||||||
|
*
|
||||||
|
* * `spec`
|
||||||
|
* The `spec` reporter outputs the test results in a human-readable format. This
|
||||||
|
* is the default reporter.
|
||||||
|
*
|
||||||
|
* * `tap`
|
||||||
|
* The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
|
||||||
|
*
|
||||||
|
* * `dot`
|
||||||
|
* The `dot` reporter outputs the test results in a compact format,
|
||||||
|
* where each passing test is represented by a `.`,
|
||||||
|
* and each failing test is represented by a `X`.
|
||||||
|
*
|
||||||
|
* * `junit`
|
||||||
|
* The junit reporter outputs test results in a jUnit XML format
|
||||||
|
*
|
||||||
|
* * `lcov`
|
||||||
|
* The `lcov` reporter outputs test coverage when used with the
|
||||||
|
* `--experimental-test-coverage` flag.
|
||||||
|
*
|
||||||
|
* The exact output of these reporters is subject to change between versions of
|
||||||
|
* Node.js, and should not be relied on programmatically. If programmatic access
|
||||||
|
* to the test runner's output is required, use the events emitted by the
|
||||||
|
* `TestsStream`.
|
||||||
|
*
|
||||||
|
* The reporters are available via the `node:test/reporters` module:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { tap, spec, dot, junit, lcov } from 'node:test/reporters';
|
||||||
|
* ```
|
||||||
|
* @since v19.9.0, v18.17.0
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/test/reporters.js)
|
||||||
|
*/
|
||||||
|
declare module "node:test/reporters" {
|
||||||
|
import { Transform, TransformOptions } from "node:stream";
|
||||||
|
import { EventData } from "node:test";
|
||||||
|
type TestEvent =
|
||||||
|
| { type: "test:coverage"; data: EventData.TestCoverage }
|
||||||
|
| { type: "test:complete"; data: EventData.TestComplete }
|
||||||
|
| { type: "test:dequeue"; data: EventData.TestDequeue }
|
||||||
|
| { type: "test:diagnostic"; data: EventData.TestDiagnostic }
|
||||||
|
| { type: "test:enqueue"; data: EventData.TestEnqueue }
|
||||||
|
| { type: "test:fail"; data: EventData.TestFail }
|
||||||
|
| { type: "test:pass"; data: EventData.TestPass }
|
||||||
|
| { type: "test:plan"; data: EventData.TestPlan }
|
||||||
|
| { type: "test:start"; data: EventData.TestStart }
|
||||||
|
| { type: "test:stderr"; data: EventData.TestStderr }
|
||||||
|
| { type: "test:stdout"; data: EventData.TestStdout }
|
||||||
|
| { type: "test:summary"; data: EventData.TestSummary }
|
||||||
|
| { type: "test:watch:drained"; data: undefined }
|
||||||
|
| { type: "test:watch:restarted"; data: undefined };
|
||||||
|
interface ReporterConstructorWrapper<T extends new(...args: any[]) => Transform> {
|
||||||
|
new(...args: ConstructorParameters<T>): InstanceType<T>;
|
||||||
|
(...args: ConstructorParameters<T>): InstanceType<T>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The `dot` reporter outputs the test results in a compact format,
|
||||||
|
* where each passing test is represented by a `.`,
|
||||||
|
* and each failing test is represented by a `X`.
|
||||||
|
* @since v20.0.0
|
||||||
|
*/
|
||||||
|
function dot(source: AsyncIterable<TestEvent>): NodeJS.AsyncIterator<string>;
|
||||||
|
/**
|
||||||
|
* The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format.
|
||||||
|
* @since v20.0.0
|
||||||
|
*/
|
||||||
|
function tap(source: AsyncIterable<TestEvent>): NodeJS.AsyncIterator<string>;
|
||||||
|
class SpecReporter extends Transform {
|
||||||
|
constructor();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The `spec` reporter outputs the test results in a human-readable format.
|
||||||
|
* @since v20.0.0
|
||||||
|
*/
|
||||||
|
const spec: ReporterConstructorWrapper<typeof SpecReporter>;
|
||||||
|
/**
|
||||||
|
* The `junit` reporter outputs test results in a jUnit XML format.
|
||||||
|
* @since v21.0.0
|
||||||
|
*/
|
||||||
|
function junit(source: AsyncIterable<TestEvent>): NodeJS.AsyncIterator<string>;
|
||||||
|
class LcovReporter extends Transform {
|
||||||
|
constructor(options?: Omit<TransformOptions, "writableObjectMode">);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The `lcov` reporter outputs test coverage when used with the
|
||||||
|
* [`--experimental-test-coverage`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--experimental-test-coverage) flag.
|
||||||
|
* @since v22.0.0
|
||||||
|
*/
|
||||||
|
const lcov: ReporterConstructorWrapper<typeof LcovReporter>;
|
||||||
|
export { dot, junit, lcov, spec, tap, TestEvent };
|
||||||
|
}
|
||||||
159
node_modules/@types/node/timers.d.ts
generated
vendored
Normal file
159
node_modules/@types/node/timers.d.ts
generated
vendored
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
/**
|
||||||
|
* 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 import `node: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/v25.x/lib/timers.js)
|
||||||
|
*/
|
||||||
|
declare module "node:timers" {
|
||||||
|
import { Abortable } from "node:events";
|
||||||
|
import * as promises from "node:timers/promises";
|
||||||
|
export interface TimerOptions extends Abortable {
|
||||||
|
/**
|
||||||
|
* Set to `false` to indicate that the scheduled `Timeout`
|
||||||
|
* should not require the Node.js event loop to remain active.
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
|
ref?: boolean | undefined;
|
||||||
|
}
|
||||||
|
global {
|
||||||
|
namespace NodeJS {
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
interface Immediate extends RefCounted, Disposable {
|
||||||
|
/**
|
||||||
|
* If true, the `Immediate` object will keep the Node.js event loop active.
|
||||||
|
* @since v11.0.0
|
||||||
|
*/
|
||||||
|
hasRef(): boolean;
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* @returns 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
|
||||||
|
* @returns a reference to `immediate`
|
||||||
|
*/
|
||||||
|
unref(): this;
|
||||||
|
/**
|
||||||
|
* Cancels the immediate. This is similar to calling `clearImmediate()`.
|
||||||
|
* @since v20.5.0, v18.18.0
|
||||||
|
*/
|
||||||
|
[Symbol.dispose](): void;
|
||||||
|
_onImmediate(...args: any[]): void;
|
||||||
|
}
|
||||||
|
// Legacy interface used in Node.js v9 and prior
|
||||||
|
// TODO: remove in a future major version bump
|
||||||
|
/** @deprecated Use `NodeJS.Timeout` instead. */
|
||||||
|
interface Timer extends RefCounted {
|
||||||
|
hasRef(): boolean;
|
||||||
|
refresh(): this;
|
||||||
|
[Symbol.toPrimitive](): number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
interface Timeout extends RefCounted, Disposable, Timer {
|
||||||
|
/**
|
||||||
|
* Cancels the timeout.
|
||||||
|
* @since v0.9.1
|
||||||
|
* @legacy Use `clearTimeout()` instead.
|
||||||
|
* @returns a reference to `timeout`
|
||||||
|
*/
|
||||||
|
close(): this;
|
||||||
|
/**
|
||||||
|
* If true, the `Timeout` object will keep the Node.js event loop active.
|
||||||
|
* @since v11.0.0
|
||||||
|
*/
|
||||||
|
hasRef(): boolean;
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* @returns a reference to `timeout`
|
||||||
|
*/
|
||||||
|
ref(): this;
|
||||||
|
/**
|
||||||
|
* Sets the timer's start time to the current time, and reschedules the timer to
|
||||||
|
* call its callback at the previously specified duration adjusted to the current
|
||||||
|
* time. This is useful for refreshing a timer without allocating a new
|
||||||
|
* JavaScript object.
|
||||||
|
*
|
||||||
|
* Using this on a timer that has already called its callback will reactivate the
|
||||||
|
* timer.
|
||||||
|
* @since v10.2.0
|
||||||
|
* @returns a reference to `timeout`
|
||||||
|
*/
|
||||||
|
refresh(): 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
|
||||||
|
* @returns a reference to `timeout`
|
||||||
|
*/
|
||||||
|
unref(): this;
|
||||||
|
/**
|
||||||
|
* Coerce a `Timeout` to a primitive. The primitive can be used to
|
||||||
|
* clear the `Timeout`. The primitive can only be used in the
|
||||||
|
* same thread where the timeout was created. Therefore, to use it
|
||||||
|
* across `worker_threads` it must first be passed to the correct
|
||||||
|
* thread. This allows enhanced compatibility with browser
|
||||||
|
* `setTimeout()` and `setInterval()` implementations.
|
||||||
|
* @since v14.9.0, v12.19.0
|
||||||
|
*/
|
||||||
|
[Symbol.toPrimitive](): number;
|
||||||
|
/**
|
||||||
|
* Cancels the timeout.
|
||||||
|
* @since v20.5.0, v18.18.0
|
||||||
|
*/
|
||||||
|
[Symbol.dispose](): void;
|
||||||
|
_onTimeout(...args: any[]): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
import clearImmediate = globalThis.clearImmediate;
|
||||||
|
import clearInterval = globalThis.clearInterval;
|
||||||
|
import clearTimeout = globalThis.clearTimeout;
|
||||||
|
import setImmediate = globalThis.setImmediate;
|
||||||
|
import setInterval = globalThis.setInterval;
|
||||||
|
import setTimeout = globalThis.setTimeout;
|
||||||
|
export { clearImmediate, clearInterval, clearTimeout, promises, setImmediate, setInterval, setTimeout };
|
||||||
|
}
|
||||||
|
declare module "timers" {
|
||||||
|
export * from "node:timers";
|
||||||
|
}
|
||||||
108
node_modules/@types/node/timers/promises.d.ts
generated
vendored
Normal file
108
node_modules/@types/node/timers/promises.d.ts
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
/**
|
||||||
|
* The `timers/promises` API provides an alternative set of timer functions
|
||||||
|
* that return `Promise` objects. The API is accessible via
|
||||||
|
* `require('node:timers/promises')`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import {
|
||||||
|
* setTimeout,
|
||||||
|
* setImmediate,
|
||||||
|
* setInterval,
|
||||||
|
* } from 'node:timers/promises';
|
||||||
|
* ```
|
||||||
|
* @since v15.0.0
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/timers/promises.js)
|
||||||
|
*/
|
||||||
|
declare module "node:timers/promises" {
|
||||||
|
import { TimerOptions } from "node:timers";
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* import {
|
||||||
|
* setTimeout,
|
||||||
|
* } from 'node:timers/promises';
|
||||||
|
*
|
||||||
|
* const res = await setTimeout(100, 'result');
|
||||||
|
*
|
||||||
|
* console.log(res); // Prints 'result'
|
||||||
|
* ```
|
||||||
|
* @since v15.0.0
|
||||||
|
* @param delay The number of milliseconds to wait before fulfilling the
|
||||||
|
* promise. **Default:** `1`.
|
||||||
|
* @param value A value with which the promise is fulfilled.
|
||||||
|
*/
|
||||||
|
function setTimeout<T = void>(delay?: number, value?: T, options?: TimerOptions): Promise<T>;
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* import {
|
||||||
|
* setImmediate,
|
||||||
|
* } from 'node:timers/promises';
|
||||||
|
*
|
||||||
|
* const res = await setImmediate('result');
|
||||||
|
*
|
||||||
|
* console.log(res); // Prints 'result'
|
||||||
|
* ```
|
||||||
|
* @since v15.0.0
|
||||||
|
* @param value A value with which the promise is fulfilled.
|
||||||
|
*/
|
||||||
|
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 {
|
||||||
|
* setInterval,
|
||||||
|
* } from 'node:timers/promises';
|
||||||
|
*
|
||||||
|
* const interval = 100;
|
||||||
|
* for await (const startTime of setInterval(interval, Date.now())) {
|
||||||
|
* const now = Date.now();
|
||||||
|
* console.log(now);
|
||||||
|
* if ((now - startTime) > 1000)
|
||||||
|
* break;
|
||||||
|
* }
|
||||||
|
* console.log(Date.now());
|
||||||
|
* ```
|
||||||
|
* @since v15.9.0
|
||||||
|
* @param delay The number of milliseconds to wait between iterations.
|
||||||
|
* **Default:** `1`.
|
||||||
|
* @param value A value with which the iterator returns.
|
||||||
|
*/
|
||||||
|
function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): NodeJS.AsyncIterator<T>;
|
||||||
|
interface Scheduler {
|
||||||
|
/**
|
||||||
|
* An experimental API defined by the [Scheduling APIs](https://github.com/WICG/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.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { scheduler } from 'node:timers/promises';
|
||||||
|
*
|
||||||
|
* await scheduler.wait(1000); // Wait one second before continuing
|
||||||
|
* ```
|
||||||
|
* @since v17.3.0, v16.14.0
|
||||||
|
* @experimental
|
||||||
|
* @param delay The number of milliseconds to wait before resolving the
|
||||||
|
* promise.
|
||||||
|
*/
|
||||||
|
wait(delay: number, options?: { signal?: AbortSignal }): Promise<void>;
|
||||||
|
/**
|
||||||
|
* An experimental API defined by the [Scheduling APIs](https://github.com/WICG/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 v17.3.0, v16.14.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
yield(): Promise<void>;
|
||||||
|
}
|
||||||
|
const scheduler: Scheduler;
|
||||||
|
}
|
||||||
|
declare module "timers/promises" {
|
||||||
|
export * from "node:timers/promises";
|
||||||
|
}
|
||||||
1203
node_modules/@types/node/tls.d.ts
generated
vendored
Normal file
1203
node_modules/@types/node/tls.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
197
node_modules/@types/node/trace_events.d.ts
generated
vendored
Normal file
197
node_modules/@types/node/trace_events.d.ts
generated
vendored
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
/**
|
||||||
|
* The `node:trace_events` module provides a mechanism to centralize tracing information
|
||||||
|
* generated by V8, Node.js core, and userspace code.
|
||||||
|
*
|
||||||
|
* Tracing can be enabled with the `--trace-event-categories` command-line flag
|
||||||
|
* or by using the `trace_events` module. The `--trace-event-categories` flag
|
||||||
|
* accepts a list of comma-separated category names.
|
||||||
|
*
|
||||||
|
* The available categories are:
|
||||||
|
*
|
||||||
|
* * `node`: An empty placeholder.
|
||||||
|
* * `node.async_hooks`: Enables capture of detailed [`async_hooks`](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html) trace data.
|
||||||
|
* The [`async_hooks`](https://nodejs.org/docs/latest-v25.x/api/async_hooks.html) events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property.
|
||||||
|
* * `node.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](https://nodejs.org/docs/latest-v25.x/api/perf_hooks.html) measurements.
|
||||||
|
* * `node.perf.usertiming`: Enables capture of only Performance API User Timing
|
||||||
|
* measures and marks.
|
||||||
|
* * `node.perf.timerify`: Enables capture of only Performance API timerify
|
||||||
|
* 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.
|
||||||
|
* * `v8`: The [V8](https://nodejs.org/docs/latest-v25.x/api/v8.html) events are GC, compiling, and execution related.
|
||||||
|
* * `node.http`: Enables capture of trace data for http request / response.
|
||||||
|
*
|
||||||
|
* By default the `node`, `node.async_hooks`, and `v8` categories are enabled.
|
||||||
|
*
|
||||||
|
* ```bash
|
||||||
|
* node --trace-event-categories v8,node,node.async_hooks server.js
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Prior versions of Node.js required the use of the `--trace-events-enabled` flag to enable trace events. This requirement has been removed. However, the `--trace-events-enabled` flag _may_ still be
|
||||||
|
* used and will enable the `node`, `node.async_hooks`, and `v8` trace event categories by default.
|
||||||
|
*
|
||||||
|
* ```bash
|
||||||
|
* node --trace-events-enabled
|
||||||
|
*
|
||||||
|
* # is equivalent to
|
||||||
|
*
|
||||||
|
* node --trace-event-categories v8,node,node.async_hooks
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Alternatively, trace events may be enabled using the `node:trace_events` module:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import trace_events from 'node:trace_events';
|
||||||
|
* const tracing = trace_events.createTracing({ categories: ['node.perf'] });
|
||||||
|
* tracing.enable(); // Enable trace event capture for the 'node.perf' category
|
||||||
|
*
|
||||||
|
* // do work
|
||||||
|
*
|
||||||
|
* tracing.disable(); // Disable trace event capture for the 'node.perf' category
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Running Node.js with tracing enabled will produce log files that can be opened
|
||||||
|
* in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome.
|
||||||
|
*
|
||||||
|
* The logging file is by default called `node_trace.${rotation}.log`, where `${rotation}` is an incrementing log-rotation id. The filepath pattern can
|
||||||
|
* be specified with `--trace-event-file-pattern` that accepts a template
|
||||||
|
* string that supports `${rotation}` and `${pid}`:
|
||||||
|
*
|
||||||
|
* ```bash
|
||||||
|
* 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,
|
||||||
|
* unlike `process.hrtime()` which returns nanoseconds.
|
||||||
|
*
|
||||||
|
* The features from this module are not available in [`Worker`](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#class-worker) threads.
|
||||||
|
* @experimental
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/trace_events.js)
|
||||||
|
*/
|
||||||
|
declare module "node:trace_events" {
|
||||||
|
/**
|
||||||
|
* The `Tracing` object is used to enable or disable tracing for sets of
|
||||||
|
* categories. Instances are created using the
|
||||||
|
* `trace_events.createTracing()` method.
|
||||||
|
*
|
||||||
|
* When created, the `Tracing` object is disabled. Calling the
|
||||||
|
* `tracing.enable()` method adds the categories to the set of enabled trace
|
||||||
|
* event categories. Calling `tracing.disable()` will remove the categories
|
||||||
|
* from the set of enabled trace event categories.
|
||||||
|
*/
|
||||||
|
interface Tracing {
|
||||||
|
/**
|
||||||
|
* A comma-separated list of the trace event categories covered by this
|
||||||
|
* `Tracing` object.
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
readonly categories: string;
|
||||||
|
/**
|
||||||
|
* Disables this `Tracing` object.
|
||||||
|
*
|
||||||
|
* Only trace event categories _not_ covered by other enabled `Tracing`
|
||||||
|
* objects and _not_ specified by the `--trace-event-categories` flag
|
||||||
|
* will be disabled.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import trace_events from 'node:trace_events';
|
||||||
|
* const t1 = trace_events.createTracing({ categories: ['node', 'v8'] });
|
||||||
|
* const t2 = trace_events.createTracing({ categories: ['node.perf', 'node'] });
|
||||||
|
* t1.enable();
|
||||||
|
* t2.enable();
|
||||||
|
*
|
||||||
|
* // Prints 'node,node.perf,v8'
|
||||||
|
* console.log(trace_events.getEnabledCategories());
|
||||||
|
*
|
||||||
|
* t2.disable(); // Will only disable emission of the 'node.perf' category
|
||||||
|
*
|
||||||
|
* // Prints 'node,v8'
|
||||||
|
* console.log(trace_events.getEnabledCategories());
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
disable(): void;
|
||||||
|
/**
|
||||||
|
* Enables this `Tracing` object for the set of categories covered by
|
||||||
|
* the `Tracing` object.
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
enable(): void;
|
||||||
|
/**
|
||||||
|
* `true` only if the `Tracing` object has been enabled.
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
readonly enabled: boolean;
|
||||||
|
}
|
||||||
|
interface CreateTracingOptions {
|
||||||
|
/**
|
||||||
|
* An array of trace category names. Values included in the array are
|
||||||
|
* coerced to a string when possible. An error will be thrown if the
|
||||||
|
* value cannot be coerced.
|
||||||
|
*/
|
||||||
|
categories: string[];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Creates and returns a `Tracing` object for the given set of `categories`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import trace_events from 'node:trace_events';
|
||||||
|
* const categories = ['node.perf', 'node.async_hooks'];
|
||||||
|
* const tracing = trace_events.createTracing({ categories });
|
||||||
|
* tracing.enable();
|
||||||
|
* // do stuff
|
||||||
|
* tracing.disable();
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function createTracing(options: CreateTracingOptions): Tracing;
|
||||||
|
/**
|
||||||
|
* Returns a comma-separated list of all currently-enabled trace event
|
||||||
|
* categories. The current set of enabled trace event categories is determined
|
||||||
|
* by the _union_ of all currently-enabled `Tracing` objects and any categories
|
||||||
|
* enabled using the `--trace-event-categories` flag.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* import trace_events from 'node: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'] });
|
||||||
|
*
|
||||||
|
* t1.enable();
|
||||||
|
* t2.enable();
|
||||||
|
*
|
||||||
|
* console.log(trace_events.getEnabledCategories());
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function getEnabledCategories(): string | undefined;
|
||||||
|
}
|
||||||
|
declare module "trace_events" {
|
||||||
|
export * from "node:trace_events";
|
||||||
|
}
|
||||||
462
node_modules/@types/node/ts5.6/buffer.buffer.d.ts
generated
vendored
Normal file
462
node_modules/@types/node/ts5.6/buffer.buffer.d.ts
generated
vendored
Normal file
@ -0,0 +1,462 @@
|
|||||||
|
declare module "node:buffer" {
|
||||||
|
global {
|
||||||
|
interface BufferConstructor {
|
||||||
|
// see ../buffer.d.ts for implementation shared with all TypeScript versions
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocates a new buffer containing the given {str}.
|
||||||
|
*
|
||||||
|
* @param str String to store in buffer.
|
||||||
|
* @param encoding encoding to use, optional. Default is 'utf8'
|
||||||
|
* @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
|
||||||
|
*/
|
||||||
|
new(str: string, encoding?: BufferEncoding): Buffer;
|
||||||
|
/**
|
||||||
|
* Allocates a new buffer of {size} octets.
|
||||||
|
*
|
||||||
|
* @param size count of octets to allocate.
|
||||||
|
* @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
|
||||||
|
*/
|
||||||
|
new(size: number): Buffer;
|
||||||
|
/**
|
||||||
|
* Allocates a new buffer containing the given {array} of octets.
|
||||||
|
*
|
||||||
|
* @param array The octets to store.
|
||||||
|
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
||||||
|
*/
|
||||||
|
new(array: ArrayLike<number>): Buffer;
|
||||||
|
/**
|
||||||
|
* Produces a Buffer backed by the same allocated memory as
|
||||||
|
* the given {ArrayBuffer}/{SharedArrayBuffer}.
|
||||||
|
*
|
||||||
|
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
||||||
|
* @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
|
||||||
|
*/
|
||||||
|
new(arrayBuffer: ArrayBufferLike): Buffer;
|
||||||
|
/**
|
||||||
|
* Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`.
|
||||||
|
* Array entries outside that range will be truncated to fit into it.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.
|
||||||
|
* const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If `array` is an `Array`-like object (that is, one with a `length` property of
|
||||||
|
* type `number`), it is treated as if it is an array, unless it is a `Buffer` or
|
||||||
|
* a `Uint8Array`. This means all other `TypedArray` variants get treated as an
|
||||||
|
* `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use
|
||||||
|
* `Buffer.copyBytesFrom()`.
|
||||||
|
*
|
||||||
|
* A `TypeError` will be thrown if `array` is not an `Array` or another type
|
||||||
|
* appropriate for `Buffer.from()` variants.
|
||||||
|
*
|
||||||
|
* `Buffer.from(array)` and `Buffer.from(string)` may also use the internal
|
||||||
|
* `Buffer` pool like `Buffer.allocUnsafe()` does.
|
||||||
|
* @since v5.10.0
|
||||||
|
*/
|
||||||
|
from(array: WithImplicitCoercion<ArrayLike<number>>): Buffer;
|
||||||
|
/**
|
||||||
|
* This creates a view of the `ArrayBuffer` without copying the underlying
|
||||||
|
* memory. For example, when passed a reference to the `.buffer` property of a
|
||||||
|
* `TypedArray` instance, the newly created `Buffer` will share the same
|
||||||
|
* allocated memory as the `TypedArray`'s underlying `ArrayBuffer`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const arr = new Uint16Array(2);
|
||||||
|
*
|
||||||
|
* arr[0] = 5000;
|
||||||
|
* arr[1] = 4000;
|
||||||
|
*
|
||||||
|
* // Shares memory with `arr`.
|
||||||
|
* const buf = Buffer.from(arr.buffer);
|
||||||
|
*
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints: <Buffer 88 13 a0 0f>
|
||||||
|
*
|
||||||
|
* // Changing the original Uint16Array changes the Buffer also.
|
||||||
|
* arr[1] = 6000;
|
||||||
|
*
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints: <Buffer 88 13 70 17>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The optional `byteOffset` and `length` arguments specify a memory range within
|
||||||
|
* the `arrayBuffer` that will be shared by the `Buffer`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const ab = new ArrayBuffer(10);
|
||||||
|
* const buf = Buffer.from(ab, 0, 2);
|
||||||
|
*
|
||||||
|
* console.log(buf.length);
|
||||||
|
* // Prints: 2
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer` or a
|
||||||
|
* `SharedArrayBuffer` or another type appropriate for `Buffer.from()`
|
||||||
|
* variants.
|
||||||
|
*
|
||||||
|
* It is important to remember that a backing `ArrayBuffer` can cover a range
|
||||||
|
* of memory that extends beyond the bounds of a `TypedArray` view. A new
|
||||||
|
* `Buffer` created using the `buffer` property of a `TypedArray` may extend
|
||||||
|
* beyond the range of the `TypedArray`:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const arrA = Uint8Array.from([0x63, 0x64, 0x65, 0x66]); // 4 elements
|
||||||
|
* const arrB = new Uint8Array(arrA.buffer, 1, 2); // 2 elements
|
||||||
|
* console.log(arrA.buffer === arrB.buffer); // true
|
||||||
|
*
|
||||||
|
* const buf = Buffer.from(arrB.buffer);
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints: <Buffer 63 64 65 66>
|
||||||
|
* ```
|
||||||
|
* @since v5.10.0
|
||||||
|
* @param arrayBuffer An `ArrayBuffer`, `SharedArrayBuffer`, for example the
|
||||||
|
* `.buffer` property of a `TypedArray`.
|
||||||
|
* @param byteOffset Index of first byte to expose. **Default:** `0`.
|
||||||
|
* @param length Number of bytes to expose. **Default:**
|
||||||
|
* `arrayBuffer.byteLength - byteOffset`.
|
||||||
|
*/
|
||||||
|
from(
|
||||||
|
arrayBuffer: WithImplicitCoercion<ArrayBufferLike>,
|
||||||
|
byteOffset?: number,
|
||||||
|
length?: number,
|
||||||
|
): Buffer;
|
||||||
|
/**
|
||||||
|
* Creates a new `Buffer` containing `string`. The `encoding` parameter identifies
|
||||||
|
* the character encoding to be used when converting `string` into bytes.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const buf1 = Buffer.from('this is a tést');
|
||||||
|
* const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');
|
||||||
|
*
|
||||||
|
* console.log(buf1.toString());
|
||||||
|
* // Prints: this is a tést
|
||||||
|
* console.log(buf2.toString());
|
||||||
|
* // Prints: this is a tést
|
||||||
|
* console.log(buf1.toString('latin1'));
|
||||||
|
* // Prints: this is a tést
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* A `TypeError` will be thrown if `string` is not a string or another type
|
||||||
|
* appropriate for `Buffer.from()` variants.
|
||||||
|
*
|
||||||
|
* `Buffer.from(string)` may also use the internal `Buffer` pool like
|
||||||
|
* `Buffer.allocUnsafe()` does.
|
||||||
|
* @since v5.10.0
|
||||||
|
* @param string A string to encode.
|
||||||
|
* @param encoding The encoding of `string`. **Default:** `'utf8'`.
|
||||||
|
*/
|
||||||
|
from(string: WithImplicitCoercion<string>, encoding?: BufferEncoding): Buffer;
|
||||||
|
from(arrayOrString: WithImplicitCoercion<ArrayLike<number> | string>): Buffer;
|
||||||
|
/**
|
||||||
|
* Creates a new Buffer using the passed {data}
|
||||||
|
* @param values to create a new Buffer
|
||||||
|
*/
|
||||||
|
of(...items: number[]): Buffer;
|
||||||
|
/**
|
||||||
|
* Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together.
|
||||||
|
*
|
||||||
|
* If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned.
|
||||||
|
*
|
||||||
|
* If `totalLength` is not provided, it is calculated from the `Buffer` instances
|
||||||
|
* in `list` by adding their lengths.
|
||||||
|
*
|
||||||
|
* If `totalLength` is provided, it is coerced to an unsigned integer. If the
|
||||||
|
* combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is
|
||||||
|
* truncated to `totalLength`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* // Create a single `Buffer` from a list of three `Buffer` instances.
|
||||||
|
*
|
||||||
|
* const buf1 = Buffer.alloc(10);
|
||||||
|
* const buf2 = Buffer.alloc(14);
|
||||||
|
* const buf3 = Buffer.alloc(18);
|
||||||
|
* const totalLength = buf1.length + buf2.length + buf3.length;
|
||||||
|
*
|
||||||
|
* console.log(totalLength);
|
||||||
|
* // Prints: 42
|
||||||
|
*
|
||||||
|
* const bufA = Buffer.concat([buf1, buf2, buf3], totalLength);
|
||||||
|
*
|
||||||
|
* console.log(bufA);
|
||||||
|
* // Prints: <Buffer 00 00 00 00 ...>
|
||||||
|
* console.log(bufA.length);
|
||||||
|
* // Prints: 42
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
|
||||||
|
* @since v0.7.11
|
||||||
|
* @param list List of `Buffer` or {@link Uint8Array} instances to concatenate.
|
||||||
|
* @param totalLength Total length of the `Buffer` instances in `list` when concatenated.
|
||||||
|
*/
|
||||||
|
concat(list: readonly Uint8Array[], totalLength?: number): Buffer;
|
||||||
|
/**
|
||||||
|
* Copies the underlying memory of `view` into a new `Buffer`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const u16 = new Uint16Array([0, 0xffff]);
|
||||||
|
* const buf = Buffer.copyBytesFrom(u16, 1, 1);
|
||||||
|
* u16[1] = 0;
|
||||||
|
* console.log(buf.length); // 2
|
||||||
|
* console.log(buf[0]); // 255
|
||||||
|
* console.log(buf[1]); // 255
|
||||||
|
* ```
|
||||||
|
* @since v19.8.0
|
||||||
|
* @param view The {TypedArray} to copy.
|
||||||
|
* @param [offset=0] The starting offset within `view`.
|
||||||
|
* @param [length=view.length - offset] The number of elements from `view` to copy.
|
||||||
|
*/
|
||||||
|
copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer;
|
||||||
|
/**
|
||||||
|
* Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const buf = Buffer.alloc(5);
|
||||||
|
*
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints: <Buffer 00 00 00 00 00>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
|
||||||
|
*
|
||||||
|
* If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const buf = Buffer.alloc(5, 'a');
|
||||||
|
*
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints: <Buffer 61 61 61 61 61>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If both `fill` and `encoding` are specified, the allocated `Buffer` will be
|
||||||
|
* initialized by calling `buf.fill(fill, encoding)`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
|
||||||
|
*
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints: <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance
|
||||||
|
* contents will never contain sensitive data from previous allocations, including
|
||||||
|
* data that might not have been allocated for `Buffer`s.
|
||||||
|
*
|
||||||
|
* A `TypeError` will be thrown if `size` is not a number.
|
||||||
|
* @since v5.10.0
|
||||||
|
* @param size The desired length of the new `Buffer`.
|
||||||
|
* @param [fill=0] A value to pre-fill the new `Buffer` with.
|
||||||
|
* @param [encoding='utf8'] If `fill` is a string, this is its encoding.
|
||||||
|
*/
|
||||||
|
alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer;
|
||||||
|
/**
|
||||||
|
* Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
|
||||||
|
*
|
||||||
|
* The underlying memory for `Buffer` instances created in this way is _not_
|
||||||
|
* _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const buf = Buffer.allocUnsafe(10);
|
||||||
|
*
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints (contents may vary): <Buffer a0 8b 28 3f 01 00 00 00 50 32>
|
||||||
|
*
|
||||||
|
* buf.fill(0);
|
||||||
|
*
|
||||||
|
* console.log(buf);
|
||||||
|
* // Prints: <Buffer 00 00 00 00 00 00 00 00 00 00>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* A `TypeError` will be thrown if `size` is not a number.
|
||||||
|
*
|
||||||
|
* The `Buffer` module pre-allocates an internal `Buffer` instance of
|
||||||
|
* size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`,
|
||||||
|
* and `Buffer.concat()` only when `size` is less than `Buffer.poolSize >>> 1` (floor of `Buffer.poolSize` divided by two).
|
||||||
|
*
|
||||||
|
* Use of this pre-allocated internal memory pool is a key difference between
|
||||||
|
* calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
|
||||||
|
* Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less
|
||||||
|
* than or equal to half `Buffer.poolSize`. The
|
||||||
|
* difference is subtle but can be important when an application requires the
|
||||||
|
* additional performance that `Buffer.allocUnsafe()` provides.
|
||||||
|
* @since v5.10.0
|
||||||
|
* @param size The desired length of the new `Buffer`.
|
||||||
|
*/
|
||||||
|
allocUnsafe(size: number): Buffer;
|
||||||
|
/**
|
||||||
|
* Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. A zero-length `Buffer` is created if
|
||||||
|
* `size` is 0.
|
||||||
|
*
|
||||||
|
* The underlying memory for `Buffer` instances created in this way is _not_
|
||||||
|
* _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize
|
||||||
|
* such `Buffer` instances with zeroes.
|
||||||
|
*
|
||||||
|
* When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
|
||||||
|
* allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This
|
||||||
|
* allows applications to avoid the garbage collection overhead of creating many
|
||||||
|
* individually allocated `Buffer` instances. This approach improves both
|
||||||
|
* performance and memory usage by eliminating the need to track and clean up as
|
||||||
|
* many individual `ArrayBuffer` objects.
|
||||||
|
*
|
||||||
|
* However, in the case where a developer may need to retain a small chunk of
|
||||||
|
* memory from a pool for an indeterminate amount of time, it may be appropriate
|
||||||
|
* to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and
|
||||||
|
* then copying out the relevant bits.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* // Need to keep around a few small chunks of memory.
|
||||||
|
* const store = [];
|
||||||
|
*
|
||||||
|
* socket.on('readable', () => {
|
||||||
|
* let data;
|
||||||
|
* while (null !== (data = readable.read())) {
|
||||||
|
* // Allocate for retained data.
|
||||||
|
* const sb = Buffer.allocUnsafeSlow(10);
|
||||||
|
*
|
||||||
|
* // Copy the data into the new allocation.
|
||||||
|
* data.copy(sb, 0, 0, 10);
|
||||||
|
*
|
||||||
|
* store.push(sb);
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* A `TypeError` will be thrown if `size` is not a number.
|
||||||
|
* @since v5.12.0
|
||||||
|
* @param size The desired length of the new `Buffer`.
|
||||||
|
*/
|
||||||
|
allocUnsafeSlow(size: number): Buffer;
|
||||||
|
}
|
||||||
|
interface Buffer extends Uint8Array {
|
||||||
|
// see ../buffer.d.ts for implementation shared with all TypeScript versions
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new `Buffer` that references the same memory as the original, but
|
||||||
|
* offset and cropped by the `start` and `end` indices.
|
||||||
|
*
|
||||||
|
* This method is not compatible with the `Uint8Array.prototype.slice()`,
|
||||||
|
* which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const buf = Buffer.from('buffer');
|
||||||
|
*
|
||||||
|
* const copiedBuf = Uint8Array.prototype.slice.call(buf);
|
||||||
|
* copiedBuf[0]++;
|
||||||
|
* console.log(copiedBuf.toString());
|
||||||
|
* // Prints: cuffer
|
||||||
|
*
|
||||||
|
* console.log(buf.toString());
|
||||||
|
* // Prints: buffer
|
||||||
|
*
|
||||||
|
* // With buf.slice(), the original buffer is modified.
|
||||||
|
* const notReallyCopiedBuf = buf.slice();
|
||||||
|
* notReallyCopiedBuf[0]++;
|
||||||
|
* console.log(notReallyCopiedBuf.toString());
|
||||||
|
* // Prints: cuffer
|
||||||
|
* console.log(buf.toString());
|
||||||
|
* // Also prints: cuffer (!)
|
||||||
|
* ```
|
||||||
|
* @since v0.3.0
|
||||||
|
* @deprecated Use `subarray` instead.
|
||||||
|
* @param [start=0] Where the new `Buffer` will start.
|
||||||
|
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
||||||
|
*/
|
||||||
|
slice(start?: number, end?: number): Buffer;
|
||||||
|
/**
|
||||||
|
* Returns a new `Buffer` that references the same memory as the original, but
|
||||||
|
* offset and cropped by the `start` and `end` indices.
|
||||||
|
*
|
||||||
|
* Specifying `end` greater than `buf.length` will return the same result as
|
||||||
|
* that of `end` equal to `buf.length`.
|
||||||
|
*
|
||||||
|
* This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray).
|
||||||
|
*
|
||||||
|
* Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte
|
||||||
|
* // from the original `Buffer`.
|
||||||
|
*
|
||||||
|
* const buf1 = Buffer.allocUnsafe(26);
|
||||||
|
*
|
||||||
|
* for (let i = 0; i < 26; i++) {
|
||||||
|
* // 97 is the decimal ASCII value for 'a'.
|
||||||
|
* buf1[i] = i + 97;
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* const buf2 = buf1.subarray(0, 3);
|
||||||
|
*
|
||||||
|
* console.log(buf2.toString('ascii', 0, buf2.length));
|
||||||
|
* // Prints: abc
|
||||||
|
*
|
||||||
|
* buf1[0] = 33;
|
||||||
|
*
|
||||||
|
* console.log(buf2.toString('ascii', 0, buf2.length));
|
||||||
|
* // Prints: !bc
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Specifying negative indexes causes the slice to be generated relative to the
|
||||||
|
* end of `buf` rather than the beginning.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { Buffer } from 'node:buffer';
|
||||||
|
*
|
||||||
|
* const buf = Buffer.from('buffer');
|
||||||
|
*
|
||||||
|
* console.log(buf.subarray(-6, -1).toString());
|
||||||
|
* // Prints: buffe
|
||||||
|
* // (Equivalent to buf.subarray(0, 5).)
|
||||||
|
*
|
||||||
|
* console.log(buf.subarray(-6, -2).toString());
|
||||||
|
* // Prints: buff
|
||||||
|
* // (Equivalent to buf.subarray(0, 4).)
|
||||||
|
*
|
||||||
|
* console.log(buf.subarray(-5, -2).toString());
|
||||||
|
* // Prints: uff
|
||||||
|
* // (Equivalent to buf.subarray(1, 4).)
|
||||||
|
* ```
|
||||||
|
* @since v3.0.0
|
||||||
|
* @param [start=0] Where the new `Buffer` will start.
|
||||||
|
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
|
||||||
|
*/
|
||||||
|
subarray(start?: number, end?: number): Buffer;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type NonSharedBuffer = Buffer;
|
||||||
|
/**
|
||||||
|
* @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
|
||||||
|
* TypeScript versions earlier than 5.7.
|
||||||
|
*/
|
||||||
|
type AllowSharedBuffer = Buffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
71
node_modules/@types/node/ts5.6/compatibility/float16array.d.ts
generated
vendored
Normal file
71
node_modules/@types/node/ts5.6/compatibility/float16array.d.ts
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
// Interface declaration for Float16Array, required in @types/node v24+.
|
||||||
|
// These definitions are specific to TS <=5.6.
|
||||||
|
|
||||||
|
// This needs all of the "common" properties/methods of the TypedArrays,
|
||||||
|
// otherwise the type unions `TypedArray` and `ArrayBufferView` will be
|
||||||
|
// empty objects.
|
||||||
|
interface Float16Array extends Pick<Float32Array, typeof Symbol.iterator | "entries" | "keys" | "values"> {
|
||||||
|
readonly BYTES_PER_ELEMENT: number;
|
||||||
|
readonly buffer: ArrayBufferLike;
|
||||||
|
readonly byteLength: number;
|
||||||
|
readonly byteOffset: number;
|
||||||
|
readonly length: number;
|
||||||
|
readonly [Symbol.toStringTag]: "Float16Array";
|
||||||
|
at(index: number): number | undefined;
|
||||||
|
copyWithin(target: number, start: number, end?: number): this;
|
||||||
|
every(predicate: (value: number, index: number, array: Float16Array) => unknown, thisArg?: any): boolean;
|
||||||
|
fill(value: number, start?: number, end?: number): this;
|
||||||
|
filter(predicate: (value: number, index: number, array: Float16Array) => any, thisArg?: any): Float16Array;
|
||||||
|
find(predicate: (value: number, index: number, obj: Float16Array) => boolean, thisArg?: any): number | undefined;
|
||||||
|
findIndex(predicate: (value: number, index: number, obj: Float16Array) => boolean, thisArg?: any): number;
|
||||||
|
findLast<S extends number>(
|
||||||
|
predicate: (value: number, index: number, array: Float16Array) => value is S,
|
||||||
|
thisArg?: any,
|
||||||
|
): S | undefined;
|
||||||
|
findLast(
|
||||||
|
predicate: (value: number, index: number, array: Float16Array) => unknown,
|
||||||
|
thisArg?: any,
|
||||||
|
): number | undefined;
|
||||||
|
findLastIndex(predicate: (value: number, index: number, array: Float16Array) => unknown, thisArg?: any): number;
|
||||||
|
forEach(callbackfn: (value: number, index: number, array: Float16Array) => void, thisArg?: any): void;
|
||||||
|
includes(searchElement: number, fromIndex?: number): boolean;
|
||||||
|
indexOf(searchElement: number, fromIndex?: number): number;
|
||||||
|
join(separator?: string): string;
|
||||||
|
lastIndexOf(searchElement: number, fromIndex?: number): number;
|
||||||
|
map(callbackfn: (value: number, index: number, array: Float16Array) => number, thisArg?: any): Float16Array;
|
||||||
|
reduce(
|
||||||
|
callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float16Array) => number,
|
||||||
|
): number;
|
||||||
|
reduce(
|
||||||
|
callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float16Array) => number,
|
||||||
|
initialValue: number,
|
||||||
|
): number;
|
||||||
|
reduce<U>(
|
||||||
|
callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float16Array) => U,
|
||||||
|
initialValue: U,
|
||||||
|
): U;
|
||||||
|
reduceRight(
|
||||||
|
callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float16Array) => number,
|
||||||
|
): number;
|
||||||
|
reduceRight(
|
||||||
|
callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float16Array) => number,
|
||||||
|
initialValue: number,
|
||||||
|
): number;
|
||||||
|
reduceRight<U>(
|
||||||
|
callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float16Array) => U,
|
||||||
|
initialValue: U,
|
||||||
|
): U;
|
||||||
|
reverse(): Float16Array;
|
||||||
|
set(array: ArrayLike<number>, offset?: number): void;
|
||||||
|
slice(start?: number, end?: number): Float16Array;
|
||||||
|
some(predicate: (value: number, index: number, array: Float16Array) => unknown, thisArg?: any): boolean;
|
||||||
|
sort(compareFn?: (a: number, b: number) => number): this;
|
||||||
|
subarray(begin?: number, end?: number): Float16Array;
|
||||||
|
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
|
||||||
|
toReversed(): Float16Array;
|
||||||
|
toSorted(compareFn?: (a: number, b: number) => number): Float16Array;
|
||||||
|
toString(): string;
|
||||||
|
valueOf(): Float16Array;
|
||||||
|
with(index: number, value: number): Float16Array;
|
||||||
|
[index: number]: number;
|
||||||
|
}
|
||||||
36
node_modules/@types/node/ts5.6/globals.typedarray.d.ts
generated
vendored
Normal file
36
node_modules/@types/node/ts5.6/globals.typedarray.d.ts
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
export {}; // Make this a module
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
namespace NodeJS {
|
||||||
|
type TypedArray =
|
||||||
|
| Uint8Array
|
||||||
|
| Uint8ClampedArray
|
||||||
|
| Uint16Array
|
||||||
|
| Uint32Array
|
||||||
|
| Int8Array
|
||||||
|
| Int16Array
|
||||||
|
| Int32Array
|
||||||
|
| BigUint64Array
|
||||||
|
| BigInt64Array
|
||||||
|
| Float16Array
|
||||||
|
| Float32Array
|
||||||
|
| Float64Array;
|
||||||
|
type ArrayBufferView = TypedArray | DataView;
|
||||||
|
|
||||||
|
type NonSharedUint8Array = Uint8Array;
|
||||||
|
type NonSharedUint8ClampedArray = Uint8ClampedArray;
|
||||||
|
type NonSharedUint16Array = Uint16Array;
|
||||||
|
type NonSharedUint32Array = Uint32Array;
|
||||||
|
type NonSharedInt8Array = Int8Array;
|
||||||
|
type NonSharedInt16Array = Int16Array;
|
||||||
|
type NonSharedInt32Array = Int32Array;
|
||||||
|
type NonSharedBigUint64Array = BigUint64Array;
|
||||||
|
type NonSharedBigInt64Array = BigInt64Array;
|
||||||
|
type NonSharedFloat16Array = Float16Array;
|
||||||
|
type NonSharedFloat32Array = Float32Array;
|
||||||
|
type NonSharedFloat64Array = Float64Array;
|
||||||
|
type NonSharedDataView = DataView;
|
||||||
|
type NonSharedTypedArray = TypedArray;
|
||||||
|
type NonSharedArrayBufferView = ArrayBufferView;
|
||||||
|
}
|
||||||
|
}
|
||||||
117
node_modules/@types/node/ts5.6/index.d.ts
generated
vendored
Normal file
117
node_modules/@types/node/ts5.6/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
/**
|
||||||
|
* License for programmatically and manually incorporated
|
||||||
|
* documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc
|
||||||
|
*
|
||||||
|
* Copyright Node.js contributors. All rights reserved.
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to
|
||||||
|
* deal in the Software without restriction, including without limitation the
|
||||||
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
* sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
* IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// NOTE: These definitions support Node.js and TypeScript 5.2 through 5.6.
|
||||||
|
|
||||||
|
// Reference required TypeScript libraries:
|
||||||
|
/// <reference lib="es2020" />
|
||||||
|
/// <reference lib="esnext.disposable" />
|
||||||
|
|
||||||
|
// TypeScript library polyfills required for TypeScript <=5.6:
|
||||||
|
/// <reference path="./compatibility/float16array.d.ts" />
|
||||||
|
|
||||||
|
// Iterator definitions required for compatibility with TypeScript <5.6:
|
||||||
|
/// <reference path="../compatibility/iterators.d.ts" />
|
||||||
|
|
||||||
|
// Definitions for Node.js modules specific to TypeScript <=5.6:
|
||||||
|
/// <reference path="./globals.typedarray.d.ts" />
|
||||||
|
/// <reference path="./buffer.buffer.d.ts" />
|
||||||
|
|
||||||
|
// Definitions for Node.js modules that are not specific to any version of TypeScript:
|
||||||
|
/// <reference path="../globals.d.ts" />
|
||||||
|
/// <reference path="../web-globals/abortcontroller.d.ts" />
|
||||||
|
/// <reference path="../web-globals/blob.d.ts" />
|
||||||
|
/// <reference path="../web-globals/console.d.ts" />
|
||||||
|
/// <reference path="../web-globals/crypto.d.ts" />
|
||||||
|
/// <reference path="../web-globals/domexception.d.ts" />
|
||||||
|
/// <reference path="../web-globals/encoding.d.ts" />
|
||||||
|
/// <reference path="../web-globals/events.d.ts" />
|
||||||
|
/// <reference path="../web-globals/fetch.d.ts" />
|
||||||
|
/// <reference path="../web-globals/importmeta.d.ts" />
|
||||||
|
/// <reference path="../web-globals/messaging.d.ts" />
|
||||||
|
/// <reference path="../web-globals/navigator.d.ts" />
|
||||||
|
/// <reference path="../web-globals/performance.d.ts" />
|
||||||
|
/// <reference path="../web-globals/storage.d.ts" />
|
||||||
|
/// <reference path="../web-globals/streams.d.ts" />
|
||||||
|
/// <reference path="../web-globals/timers.d.ts" />
|
||||||
|
/// <reference path="../web-globals/url.d.ts" />
|
||||||
|
/// <reference path="../assert.d.ts" />
|
||||||
|
/// <reference path="../assert/strict.d.ts" />
|
||||||
|
/// <reference path="../async_hooks.d.ts" />
|
||||||
|
/// <reference path="../buffer.d.ts" />
|
||||||
|
/// <reference path="../child_process.d.ts" />
|
||||||
|
/// <reference path="../cluster.d.ts" />
|
||||||
|
/// <reference path="../console.d.ts" />
|
||||||
|
/// <reference path="../constants.d.ts" />
|
||||||
|
/// <reference path="../crypto.d.ts" />
|
||||||
|
/// <reference path="../dgram.d.ts" />
|
||||||
|
/// <reference path="../diagnostics_channel.d.ts" />
|
||||||
|
/// <reference path="../dns.d.ts" />
|
||||||
|
/// <reference path="../dns/promises.d.ts" />
|
||||||
|
/// <reference path="../domain.d.ts" />
|
||||||
|
/// <reference path="../events.d.ts" />
|
||||||
|
/// <reference path="../fs.d.ts" />
|
||||||
|
/// <reference path="../fs/promises.d.ts" />
|
||||||
|
/// <reference path="../http.d.ts" />
|
||||||
|
/// <reference path="../http2.d.ts" />
|
||||||
|
/// <reference path="../https.d.ts" />
|
||||||
|
/// <reference path="../inspector.d.ts" />
|
||||||
|
/// <reference path="../inspector.generated.d.ts" />
|
||||||
|
/// <reference path="../inspector/promises.d.ts" />
|
||||||
|
/// <reference path="../module.d.ts" />
|
||||||
|
/// <reference path="../net.d.ts" />
|
||||||
|
/// <reference path="../os.d.ts" />
|
||||||
|
/// <reference path="../path.d.ts" />
|
||||||
|
/// <reference path="../path/posix.d.ts" />
|
||||||
|
/// <reference path="../path/win32.d.ts" />
|
||||||
|
/// <reference path="../perf_hooks.d.ts" />
|
||||||
|
/// <reference path="../process.d.ts" />
|
||||||
|
/// <reference path="../punycode.d.ts" />
|
||||||
|
/// <reference path="../querystring.d.ts" />
|
||||||
|
/// <reference path="../quic.d.ts" />
|
||||||
|
/// <reference path="../readline.d.ts" />
|
||||||
|
/// <reference path="../readline/promises.d.ts" />
|
||||||
|
/// <reference path="../repl.d.ts" />
|
||||||
|
/// <reference path="../sea.d.ts" />
|
||||||
|
/// <reference path="../sqlite.d.ts" />
|
||||||
|
/// <reference path="../stream.d.ts" />
|
||||||
|
/// <reference path="../stream/consumers.d.ts" />
|
||||||
|
/// <reference path="../stream/promises.d.ts" />
|
||||||
|
/// <reference path="../stream/web.d.ts" />
|
||||||
|
/// <reference path="../string_decoder.d.ts" />
|
||||||
|
/// <reference path="../test.d.ts" />
|
||||||
|
/// <reference path="../test/reporters.d.ts" />
|
||||||
|
/// <reference path="../timers.d.ts" />
|
||||||
|
/// <reference path="../timers/promises.d.ts" />
|
||||||
|
/// <reference path="../tls.d.ts" />
|
||||||
|
/// <reference path="../trace_events.d.ts" />
|
||||||
|
/// <reference path="../tty.d.ts" />
|
||||||
|
/// <reference path="../url.d.ts" />
|
||||||
|
/// <reference path="../util.d.ts" />
|
||||||
|
/// <reference path="../util/types.d.ts" />
|
||||||
|
/// <reference path="../v8.d.ts" />
|
||||||
|
/// <reference path="../vm.d.ts" />
|
||||||
|
/// <reference path="../wasi.d.ts" />
|
||||||
|
/// <reference path="../worker_threads.d.ts" />
|
||||||
|
/// <reference path="../zlib.d.ts" />
|
||||||
72
node_modules/@types/node/ts5.7/compatibility/float16array.d.ts
generated
vendored
Normal file
72
node_modules/@types/node/ts5.7/compatibility/float16array.d.ts
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
// Interface declaration for Float16Array, required in @types/node v24+.
|
||||||
|
// These definitions are specific to TS 5.7.
|
||||||
|
|
||||||
|
// This needs all of the "common" properties/methods of the TypedArrays,
|
||||||
|
// otherwise the type unions `TypedArray` and `ArrayBufferView` will be
|
||||||
|
// empty objects.
|
||||||
|
interface Float16Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
|
||||||
|
readonly BYTES_PER_ELEMENT: number;
|
||||||
|
readonly buffer: TArrayBuffer;
|
||||||
|
readonly byteLength: number;
|
||||||
|
readonly byteOffset: number;
|
||||||
|
readonly length: number;
|
||||||
|
readonly [Symbol.toStringTag]: "Float16Array";
|
||||||
|
at(index: number): number | undefined;
|
||||||
|
copyWithin(target: number, start: number, end?: number): this;
|
||||||
|
entries(): ArrayIterator<[number, number]>;
|
||||||
|
every(predicate: (value: number, index: number, array: this) => unknown, thisArg?: any): boolean;
|
||||||
|
fill(value: number, start?: number, end?: number): this;
|
||||||
|
filter(predicate: (value: number, index: number, array: this) => any, thisArg?: any): Float16Array<ArrayBuffer>;
|
||||||
|
find(predicate: (value: number, index: number, obj: this) => boolean, thisArg?: any): number | undefined;
|
||||||
|
findIndex(predicate: (value: number, index: number, obj: this) => boolean, thisArg?: any): number;
|
||||||
|
findLast<S extends number>(
|
||||||
|
predicate: (value: number, index: number, array: this) => value is S,
|
||||||
|
thisArg?: any,
|
||||||
|
): S | undefined;
|
||||||
|
findLast(predicate: (value: number, index: number, array: this) => unknown, thisArg?: any): number | undefined;
|
||||||
|
findLastIndex(predicate: (value: number, index: number, array: this) => unknown, thisArg?: any): number;
|
||||||
|
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
|
||||||
|
includes(searchElement: number, fromIndex?: number): boolean;
|
||||||
|
indexOf(searchElement: number, fromIndex?: number): number;
|
||||||
|
join(separator?: string): string;
|
||||||
|
keys(): ArrayIterator<number>;
|
||||||
|
lastIndexOf(searchElement: number, fromIndex?: number): number;
|
||||||
|
map(callbackfn: (value: number, index: number, array: this) => number, thisArg?: any): Float16Array<ArrayBuffer>;
|
||||||
|
reduce(
|
||||||
|
callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number,
|
||||||
|
): number;
|
||||||
|
reduce(
|
||||||
|
callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number,
|
||||||
|
initialValue: number,
|
||||||
|
): number;
|
||||||
|
reduce<U>(
|
||||||
|
callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: this) => U,
|
||||||
|
initialValue: U,
|
||||||
|
): U;
|
||||||
|
reduceRight(
|
||||||
|
callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number,
|
||||||
|
): number;
|
||||||
|
reduceRight(
|
||||||
|
callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number,
|
||||||
|
initialValue: number,
|
||||||
|
): number;
|
||||||
|
reduceRight<U>(
|
||||||
|
callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: this) => U,
|
||||||
|
initialValue: U,
|
||||||
|
): U;
|
||||||
|
reverse(): this;
|
||||||
|
set(array: ArrayLike<number>, offset?: number): void;
|
||||||
|
slice(start?: number, end?: number): Float16Array<ArrayBuffer>;
|
||||||
|
some(predicate: (value: number, index: number, array: this) => unknown, thisArg?: any): boolean;
|
||||||
|
sort(compareFn?: (a: number, b: number) => number): this;
|
||||||
|
subarray(begin?: number, end?: number): Float16Array<TArrayBuffer>;
|
||||||
|
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
|
||||||
|
toReversed(): Float16Array<ArrayBuffer>;
|
||||||
|
toSorted(compareFn?: (a: number, b: number) => number): Float16Array<ArrayBuffer>;
|
||||||
|
toString(): string;
|
||||||
|
valueOf(): this;
|
||||||
|
values(): ArrayIterator<number>;
|
||||||
|
with(index: number, value: number): Float16Array<ArrayBuffer>;
|
||||||
|
[Symbol.iterator](): ArrayIterator<number>;
|
||||||
|
[index: number]: number;
|
||||||
|
}
|
||||||
117
node_modules/@types/node/ts5.7/index.d.ts
generated
vendored
Normal file
117
node_modules/@types/node/ts5.7/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
/**
|
||||||
|
* License for programmatically and manually incorporated
|
||||||
|
* documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc
|
||||||
|
*
|
||||||
|
* Copyright Node.js contributors. All rights reserved.
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to
|
||||||
|
* deal in the Software without restriction, including without limitation the
|
||||||
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
* sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
* IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// NOTE: These definitions support Node.js and TypeScript 5.7.
|
||||||
|
|
||||||
|
// Reference required TypeScript libraries:
|
||||||
|
/// <reference lib="es2020" />
|
||||||
|
/// <reference lib="esnext.disposable" />
|
||||||
|
|
||||||
|
// TypeScript library polyfills required for TypeScript 5.7:
|
||||||
|
/// <reference path="./compatibility/float16array.d.ts" />
|
||||||
|
|
||||||
|
// Iterator definitions required for compatibility with TypeScript <5.6:
|
||||||
|
/// <reference path="../compatibility/iterators.d.ts" />
|
||||||
|
|
||||||
|
// Definitions for Node.js modules specific to TypeScript 5.7+:
|
||||||
|
/// <reference path="../globals.typedarray.d.ts" />
|
||||||
|
/// <reference path="../buffer.buffer.d.ts" />
|
||||||
|
|
||||||
|
// Definitions for Node.js modules that are not specific to any version of TypeScript:
|
||||||
|
/// <reference path="../globals.d.ts" />
|
||||||
|
/// <reference path="../web-globals/abortcontroller.d.ts" />
|
||||||
|
/// <reference path="../web-globals/blob.d.ts" />
|
||||||
|
/// <reference path="../web-globals/console.d.ts" />
|
||||||
|
/// <reference path="../web-globals/crypto.d.ts" />
|
||||||
|
/// <reference path="../web-globals/domexception.d.ts" />
|
||||||
|
/// <reference path="../web-globals/encoding.d.ts" />
|
||||||
|
/// <reference path="../web-globals/events.d.ts" />
|
||||||
|
/// <reference path="../web-globals/fetch.d.ts" />
|
||||||
|
/// <reference path="../web-globals/importmeta.d.ts" />
|
||||||
|
/// <reference path="../web-globals/messaging.d.ts" />
|
||||||
|
/// <reference path="../web-globals/navigator.d.ts" />
|
||||||
|
/// <reference path="../web-globals/performance.d.ts" />
|
||||||
|
/// <reference path="../web-globals/storage.d.ts" />
|
||||||
|
/// <reference path="../web-globals/streams.d.ts" />
|
||||||
|
/// <reference path="../web-globals/timers.d.ts" />
|
||||||
|
/// <reference path="../web-globals/url.d.ts" />
|
||||||
|
/// <reference path="../assert.d.ts" />
|
||||||
|
/// <reference path="../assert/strict.d.ts" />
|
||||||
|
/// <reference path="../async_hooks.d.ts" />
|
||||||
|
/// <reference path="../buffer.d.ts" />
|
||||||
|
/// <reference path="../child_process.d.ts" />
|
||||||
|
/// <reference path="../cluster.d.ts" />
|
||||||
|
/// <reference path="../console.d.ts" />
|
||||||
|
/// <reference path="../constants.d.ts" />
|
||||||
|
/// <reference path="../crypto.d.ts" />
|
||||||
|
/// <reference path="../dgram.d.ts" />
|
||||||
|
/// <reference path="../diagnostics_channel.d.ts" />
|
||||||
|
/// <reference path="../dns.d.ts" />
|
||||||
|
/// <reference path="../dns/promises.d.ts" />
|
||||||
|
/// <reference path="../domain.d.ts" />
|
||||||
|
/// <reference path="../events.d.ts" />
|
||||||
|
/// <reference path="../fs.d.ts" />
|
||||||
|
/// <reference path="../fs/promises.d.ts" />
|
||||||
|
/// <reference path="../http.d.ts" />
|
||||||
|
/// <reference path="../http2.d.ts" />
|
||||||
|
/// <reference path="../https.d.ts" />
|
||||||
|
/// <reference path="../inspector.d.ts" />
|
||||||
|
/// <reference path="../inspector.generated.d.ts" />
|
||||||
|
/// <reference path="../inspector/promises.d.ts" />
|
||||||
|
/// <reference path="../module.d.ts" />
|
||||||
|
/// <reference path="../net.d.ts" />
|
||||||
|
/// <reference path="../os.d.ts" />
|
||||||
|
/// <reference path="../path.d.ts" />
|
||||||
|
/// <reference path="../path/posix.d.ts" />
|
||||||
|
/// <reference path="../path/win32.d.ts" />
|
||||||
|
/// <reference path="../perf_hooks.d.ts" />
|
||||||
|
/// <reference path="../process.d.ts" />
|
||||||
|
/// <reference path="../punycode.d.ts" />
|
||||||
|
/// <reference path="../querystring.d.ts" />
|
||||||
|
/// <reference path="../quic.d.ts" />
|
||||||
|
/// <reference path="../readline.d.ts" />
|
||||||
|
/// <reference path="../readline/promises.d.ts" />
|
||||||
|
/// <reference path="../repl.d.ts" />
|
||||||
|
/// <reference path="../sea.d.ts" />
|
||||||
|
/// <reference path="../sqlite.d.ts" />
|
||||||
|
/// <reference path="../stream.d.ts" />
|
||||||
|
/// <reference path="../stream/consumers.d.ts" />
|
||||||
|
/// <reference path="../stream/promises.d.ts" />
|
||||||
|
/// <reference path="../stream/web.d.ts" />
|
||||||
|
/// <reference path="../string_decoder.d.ts" />
|
||||||
|
/// <reference path="../test.d.ts" />
|
||||||
|
/// <reference path="../test/reporters.d.ts" />
|
||||||
|
/// <reference path="../timers.d.ts" />
|
||||||
|
/// <reference path="../timers/promises.d.ts" />
|
||||||
|
/// <reference path="../tls.d.ts" />
|
||||||
|
/// <reference path="../trace_events.d.ts" />
|
||||||
|
/// <reference path="../tty.d.ts" />
|
||||||
|
/// <reference path="../url.d.ts" />
|
||||||
|
/// <reference path="../util.d.ts" />
|
||||||
|
/// <reference path="../util/types.d.ts" />
|
||||||
|
/// <reference path="../v8.d.ts" />
|
||||||
|
/// <reference path="../vm.d.ts" />
|
||||||
|
/// <reference path="../wasi.d.ts" />
|
||||||
|
/// <reference path="../worker_threads.d.ts" />
|
||||||
|
/// <reference path="../zlib.d.ts" />
|
||||||
250
node_modules/@types/node/tty.d.ts
generated
vendored
Normal file
250
node_modules/@types/node/tty.d.ts
generated
vendored
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
/**
|
||||||
|
* The `node:tty` module provides the `tty.ReadStream` and `tty.WriteStream` classes. In most cases, it will not be necessary or possible to use this module
|
||||||
|
* directly. However, it can be accessed using:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import tty from 'node:tty';
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* When Node.js detects that it is being run with a text terminal ("TTY")
|
||||||
|
* attached, `process.stdin` will, by default, be initialized as an instance of `tty.ReadStream` and both `process.stdout` and `process.stderr` will, by
|
||||||
|
* default, be instances of `tty.WriteStream`. The preferred method of determining
|
||||||
|
* whether Node.js is being run within a TTY context is to check that the value of
|
||||||
|
* the `process.stdout.isTTY` property is `true`:
|
||||||
|
*
|
||||||
|
* ```console
|
||||||
|
* $ node -p -e "Boolean(process.stdout.isTTY)"
|
||||||
|
* true
|
||||||
|
* $ node -p -e "Boolean(process.stdout.isTTY)" | cat
|
||||||
|
* false
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* In most cases, there should be little to no reason for an application to
|
||||||
|
* manually create instances of the `tty.ReadStream` and `tty.WriteStream` classes.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/tty.js)
|
||||||
|
*/
|
||||||
|
declare module "node:tty" {
|
||||||
|
import * as net from "node:net";
|
||||||
|
/**
|
||||||
|
* The `tty.isatty()` method returns `true` if the given `fd` is associated with
|
||||||
|
* a TTY and `false` if it is not, including whenever `fd` is not a non-negative
|
||||||
|
* integer.
|
||||||
|
* @since v0.5.8
|
||||||
|
* @param fd A numeric file descriptor
|
||||||
|
*/
|
||||||
|
function isatty(fd: number): boolean;
|
||||||
|
/**
|
||||||
|
* Represents the readable side of a TTY. In normal circumstances `process.stdin` will be the only `tty.ReadStream` instance in a Node.js
|
||||||
|
* process and there should be no reason to create additional instances.
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
class ReadStream extends net.Socket {
|
||||||
|
constructor(fd: number, options?: net.SocketConstructorOpts);
|
||||||
|
/**
|
||||||
|
* A `boolean` that is `true` if the TTY is currently configured to operate as a
|
||||||
|
* raw device.
|
||||||
|
*
|
||||||
|
* This flag is always `false` when a process starts, even if the terminal is
|
||||||
|
* operating in raw mode. Its value will change with subsequent calls to `setRawMode`.
|
||||||
|
* @since v0.7.7
|
||||||
|
*/
|
||||||
|
isRaw: boolean;
|
||||||
|
/**
|
||||||
|
* Allows configuration of `tty.ReadStream` so that it operates as a raw device.
|
||||||
|
*
|
||||||
|
* When in raw mode, input is always available character-by-character, not
|
||||||
|
* including modifiers. Additionally, all special processing of characters by the
|
||||||
|
* terminal is disabled, including echoing input
|
||||||
|
* characters. Ctrl+C will no longer cause a `SIGINT` when
|
||||||
|
* in this mode.
|
||||||
|
* @since v0.7.7
|
||||||
|
* @param mode If `true`, configures the `tty.ReadStream` to operate as a raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw`
|
||||||
|
* property will be set to the resulting mode.
|
||||||
|
* @return The read stream instance.
|
||||||
|
*/
|
||||||
|
setRawMode(mode: boolean): this;
|
||||||
|
/**
|
||||||
|
* A `boolean` that is always `true` for `tty.ReadStream` instances.
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
isTTY: boolean;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* -1 - to the left from cursor
|
||||||
|
* 0 - the entire line
|
||||||
|
* 1 - to the right from cursor
|
||||||
|
*/
|
||||||
|
type Direction = -1 | 0 | 1;
|
||||||
|
interface WriteStreamEventMap extends net.SocketEventMap {
|
||||||
|
"resize": [];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Represents the writable side of a TTY. In normal circumstances, `process.stdout` and `process.stderr` will be the only`tty.WriteStream` instances created for a Node.js process and there
|
||||||
|
* should be no reason to create additional instances.
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
class WriteStream extends net.Socket {
|
||||||
|
constructor(fd: number);
|
||||||
|
/**
|
||||||
|
* `writeStream.clearLine()` clears the current line of this `WriteStream` in a
|
||||||
|
* direction identified by `dir`.
|
||||||
|
* @since v0.7.7
|
||||||
|
* @param callback Invoked once the operation completes.
|
||||||
|
* @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
||||||
|
*/
|
||||||
|
clearLine(dir: Direction, callback?: () => void): boolean;
|
||||||
|
/**
|
||||||
|
* `writeStream.clearScreenDown()` clears this `WriteStream` from the current
|
||||||
|
* cursor down.
|
||||||
|
* @since v0.7.7
|
||||||
|
* @param callback Invoked once the operation completes.
|
||||||
|
* @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
||||||
|
*/
|
||||||
|
clearScreenDown(callback?: () => void): boolean;
|
||||||
|
/**
|
||||||
|
* `writeStream.cursorTo()` moves this `WriteStream`'s cursor to the specified
|
||||||
|
* position.
|
||||||
|
* @since v0.7.7
|
||||||
|
* @param callback Invoked once the operation completes.
|
||||||
|
* @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
||||||
|
*/
|
||||||
|
cursorTo(x: number, y?: number, callback?: () => void): boolean;
|
||||||
|
cursorTo(x: number, callback: () => void): boolean;
|
||||||
|
/**
|
||||||
|
* `writeStream.moveCursor()` moves this `WriteStream`'s cursor _relative_ to its
|
||||||
|
* current position.
|
||||||
|
* @since v0.7.7
|
||||||
|
* @param callback Invoked once the operation completes.
|
||||||
|
* @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
|
||||||
|
*/
|
||||||
|
moveCursor(dx: number, dy: number, callback?: () => void): boolean;
|
||||||
|
/**
|
||||||
|
* Returns:
|
||||||
|
*
|
||||||
|
* * `1` for 2,
|
||||||
|
* * `4` for 16,
|
||||||
|
* * `8` for 256,
|
||||||
|
* * `24` for 16,777,216 colors supported.
|
||||||
|
*
|
||||||
|
* Use this to determine what colors the terminal supports. Due to the nature of
|
||||||
|
* colors in terminals it is possible to either have false positives or false
|
||||||
|
* negatives. It depends on process information and the environment variables that
|
||||||
|
* may lie about what terminal is used.
|
||||||
|
* It is possible to pass in an `env` object to simulate the usage of a specific
|
||||||
|
* terminal. This can be useful to check how specific environment settings behave.
|
||||||
|
*
|
||||||
|
* To enforce a specific color support, use one of the below environment settings.
|
||||||
|
*
|
||||||
|
* * 2 colors: `FORCE_COLOR = 0` (Disables colors)
|
||||||
|
* * 16 colors: `FORCE_COLOR = 1`
|
||||||
|
* * 256 colors: `FORCE_COLOR = 2`
|
||||||
|
* * 16,777,216 colors: `FORCE_COLOR = 3`
|
||||||
|
*
|
||||||
|
* Disabling color support is also possible by using the `NO_COLOR` and `NODE_DISABLE_COLORS` environment variables.
|
||||||
|
* @since v9.9.0
|
||||||
|
* @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal.
|
||||||
|
*/
|
||||||
|
getColorDepth(env?: object): number;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the `writeStream` supports at least as many colors as provided
|
||||||
|
* in `count`. Minimum support is 2 (black and white).
|
||||||
|
*
|
||||||
|
* This has the same false positives and negatives as described in `writeStream.getColorDepth()`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* process.stdout.hasColors();
|
||||||
|
* // Returns true or false depending on if `stdout` supports at least 16 colors.
|
||||||
|
* process.stdout.hasColors(256);
|
||||||
|
* // Returns true or false depending on if `stdout` supports at least 256 colors.
|
||||||
|
* process.stdout.hasColors({ TMUX: '1' });
|
||||||
|
* // Returns true.
|
||||||
|
* process.stdout.hasColors(2 ** 24, { TMUX: '1' });
|
||||||
|
* // Returns false (the environment setting pretends to support 2 ** 8 colors).
|
||||||
|
* ```
|
||||||
|
* @since v11.13.0, v10.16.0
|
||||||
|
* @param [count=16] The number of colors that are requested (minimum 2).
|
||||||
|
* @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal.
|
||||||
|
*/
|
||||||
|
hasColors(count?: number): boolean;
|
||||||
|
hasColors(env?: object): boolean;
|
||||||
|
hasColors(count: number, env?: object): boolean;
|
||||||
|
/**
|
||||||
|
* `writeStream.getWindowSize()` returns the size of the TTY
|
||||||
|
* corresponding to this `WriteStream`. The array is of the type `[numColumns, numRows]` where `numColumns` and `numRows` represent the number
|
||||||
|
* of columns and rows in the corresponding TTY.
|
||||||
|
* @since v0.7.7
|
||||||
|
*/
|
||||||
|
getWindowSize(): [number, number];
|
||||||
|
/**
|
||||||
|
* A `number` specifying the number of columns the TTY currently has. This property
|
||||||
|
* is updated whenever the `'resize'` event is emitted.
|
||||||
|
* @since v0.7.7
|
||||||
|
*/
|
||||||
|
columns: number;
|
||||||
|
/**
|
||||||
|
* A `number` specifying the number of rows the TTY currently has. This property
|
||||||
|
* is updated whenever the `'resize'` event is emitted.
|
||||||
|
* @since v0.7.7
|
||||||
|
*/
|
||||||
|
rows: number;
|
||||||
|
/**
|
||||||
|
* A `boolean` that is always `true`.
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
isTTY: boolean;
|
||||||
|
// #region InternalEventEmitter
|
||||||
|
addListener<E extends keyof WriteStreamEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: WriteStreamEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
emit<E extends keyof WriteStreamEventMap>(eventName: E, ...args: WriteStreamEventMap[E]): boolean;
|
||||||
|
emit(eventName: string | symbol, ...args: any[]): boolean;
|
||||||
|
listenerCount<E extends keyof WriteStreamEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener?: (...args: WriteStreamEventMap[E]) => void,
|
||||||
|
): number;
|
||||||
|
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
||||||
|
listeners<E extends keyof WriteStreamEventMap>(eventName: E): ((...args: WriteStreamEventMap[E]) => void)[];
|
||||||
|
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
||||||
|
off<E extends keyof WriteStreamEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: WriteStreamEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
on<E extends keyof WriteStreamEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: WriteStreamEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
once<E extends keyof WriteStreamEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: WriteStreamEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
prependListener<E extends keyof WriteStreamEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: WriteStreamEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
prependOnceListener<E extends keyof WriteStreamEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: WriteStreamEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
rawListeners<E extends keyof WriteStreamEventMap>(eventName: E): ((...args: WriteStreamEventMap[E]) => void)[];
|
||||||
|
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
||||||
|
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
||||||
|
removeAllListeners<E extends keyof WriteStreamEventMap>(eventName?: E): this;
|
||||||
|
removeAllListeners(eventName?: string | symbol): this;
|
||||||
|
removeListener<E extends keyof WriteStreamEventMap>(
|
||||||
|
eventName: E,
|
||||||
|
listener: (...args: WriteStreamEventMap[E]) => void,
|
||||||
|
): this;
|
||||||
|
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
// #endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module "tty" {
|
||||||
|
export * from "node:tty";
|
||||||
|
}
|
||||||
541
node_modules/@types/node/url.d.ts
generated
vendored
Normal file
541
node_modules/@types/node/url.d.ts
generated
vendored
Normal file
@ -0,0 +1,541 @@
|
|||||||
|
/**
|
||||||
|
* The `node:url` module provides utilities for URL resolution and parsing. It can
|
||||||
|
* be accessed using:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import url from 'node:url';
|
||||||
|
* ```
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/url.js)
|
||||||
|
*/
|
||||||
|
declare module "node:url" {
|
||||||
|
import { Blob, NonSharedBuffer } from "node:buffer";
|
||||||
|
import { ClientRequestArgs } from "node:http";
|
||||||
|
import { ParsedUrlQuery, ParsedUrlQueryInput } from "node:querystring";
|
||||||
|
// Input to `url.format`
|
||||||
|
interface UrlObject {
|
||||||
|
auth?: string | null | undefined;
|
||||||
|
hash?: string | null | undefined;
|
||||||
|
host?: string | null | undefined;
|
||||||
|
hostname?: string | null | undefined;
|
||||||
|
href?: string | null | undefined;
|
||||||
|
pathname?: string | null | undefined;
|
||||||
|
protocol?: string | null | undefined;
|
||||||
|
search?: string | null | undefined;
|
||||||
|
slashes?: boolean | null | undefined;
|
||||||
|
port?: string | number | null | undefined;
|
||||||
|
query?: string | null | ParsedUrlQueryInput | undefined;
|
||||||
|
}
|
||||||
|
// Output of `url.parse`
|
||||||
|
interface Url {
|
||||||
|
auth: string | null;
|
||||||
|
hash: string | null;
|
||||||
|
host: string | null;
|
||||||
|
hostname: string | null;
|
||||||
|
href: string;
|
||||||
|
path: string | null;
|
||||||
|
pathname: string | null;
|
||||||
|
protocol: string | null;
|
||||||
|
search: string | null;
|
||||||
|
slashes: boolean | null;
|
||||||
|
port: string | null;
|
||||||
|
query: string | null | ParsedUrlQuery;
|
||||||
|
}
|
||||||
|
interface UrlWithParsedQuery extends Url {
|
||||||
|
query: ParsedUrlQuery;
|
||||||
|
}
|
||||||
|
interface UrlWithStringQuery extends Url {
|
||||||
|
query: string | null;
|
||||||
|
}
|
||||||
|
interface FileUrlToPathOptions {
|
||||||
|
/**
|
||||||
|
* `true` if the `path` should be return as a windows filepath, `false` for posix, and `undefined` for the system default.
|
||||||
|
* @default undefined
|
||||||
|
* @since v22.1.0
|
||||||
|
*/
|
||||||
|
windows?: boolean | undefined;
|
||||||
|
}
|
||||||
|
interface PathToFileUrlOptions {
|
||||||
|
/**
|
||||||
|
* `true` if the `path` should be return as a windows filepath, `false` for posix, and `undefined` for the system default.
|
||||||
|
* @default undefined
|
||||||
|
* @since v22.1.0
|
||||||
|
*/
|
||||||
|
windows?: boolean | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The `url.parse()` method takes a URL string, parses it, and returns a URL
|
||||||
|
* object.
|
||||||
|
*
|
||||||
|
* A `TypeError` is thrown if `urlString` is not a string.
|
||||||
|
*
|
||||||
|
* A `URIError` is thrown if the `auth` property is present but cannot be decoded.
|
||||||
|
*
|
||||||
|
* `url.parse()` uses a lenient, non-standard algorithm for parsing URL
|
||||||
|
* strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487)
|
||||||
|
* and incorrect handling of usernames and passwords. Do not use with untrusted
|
||||||
|
* input. CVEs are not issued for `url.parse()` vulnerabilities. Use the
|
||||||
|
* [WHATWG URL](https://nodejs.org/docs/latest-v25.x/api/url.html#the-whatwg-url-api) API instead, for example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* function getURL(req) {
|
||||||
|
* const proto = req.headers['x-forwarded-proto'] || 'https';
|
||||||
|
* const host = req.headers['x-forwarded-host'] || req.headers.host || 'example.com';
|
||||||
|
* return new URL(req.url || '/', `${proto}://${host}`);
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The example above assumes well-formed headers are forwarded from a reverse
|
||||||
|
* proxy to your Node.js server. If you are not using a reverse proxy, you should
|
||||||
|
* use the example below:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* function getURL(req) {
|
||||||
|
* return new URL(req.url || '/', 'https://example.com');
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.1.25
|
||||||
|
* @deprecated Use the WHATWG URL API instead.
|
||||||
|
* @param urlString The URL string to parse.
|
||||||
|
* @param parseQueryString If `true`, the `query` property will always
|
||||||
|
* be set to an object returned by the [`querystring`](https://nodejs.org/docs/latest-v25.x/api/querystring.html) module's `parse()`
|
||||||
|
* method. If `false`, the `query` property on the returned URL object will be an
|
||||||
|
* unparsed, undecoded string. **Default:** `false`.
|
||||||
|
* @param slashesDenoteHost If `true`, the first token after the literal
|
||||||
|
* string `//` and preceding the next `/` will be interpreted as the `host`.
|
||||||
|
* For instance, given `//foo/bar`, the result would be
|
||||||
|
* `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`.
|
||||||
|
* **Default:** `false`.
|
||||||
|
*/
|
||||||
|
function parse(
|
||||||
|
urlString: string,
|
||||||
|
parseQueryString?: false,
|
||||||
|
slashesDenoteHost?: boolean,
|
||||||
|
): UrlWithStringQuery;
|
||||||
|
function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;
|
||||||
|
function parse(urlString: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;
|
||||||
|
/**
|
||||||
|
* The `url.format()` method returns a formatted URL string derived from `urlObject`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import url from 'node:url';
|
||||||
|
* url.format({
|
||||||
|
* protocol: 'https',
|
||||||
|
* hostname: 'example.com',
|
||||||
|
* pathname: '/some/path',
|
||||||
|
* query: {
|
||||||
|
* page: 1,
|
||||||
|
* format: 'json',
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // => 'https://example.com/some/path?page=1&format=json'
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If `urlObject` is not an object or a string, `url.format()` will throw a `TypeError`.
|
||||||
|
*
|
||||||
|
* The formatting process operates as follows:
|
||||||
|
*
|
||||||
|
* * A new empty string `result` is created.
|
||||||
|
* * If `urlObject.protocol` is a string, it is appended as-is to `result`.
|
||||||
|
* * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown.
|
||||||
|
* * For all string values of `urlObject.protocol` that _do not end_ with an ASCII
|
||||||
|
* colon (`:`) character, the literal string `:` will be appended to `result`.
|
||||||
|
* * If either of the following conditions is true, then the literal string `//` will be appended to `result`:
|
||||||
|
* * `urlObject.slashes` property is true;
|
||||||
|
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or `file`;
|
||||||
|
* * If the value of the `urlObject.auth` property is truthy, and either `urlObject.host` or `urlObject.hostname` are not `undefined`, the value of `urlObject.auth` will be coerced into a string
|
||||||
|
* and appended to `result` followed by the literal string `@`.
|
||||||
|
* * If the `urlObject.host` property is `undefined` then:
|
||||||
|
* * If the `urlObject.hostname` is a string, it is appended to `result`.
|
||||||
|
* * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string,
|
||||||
|
* an `Error` is thrown.
|
||||||
|
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname` is not `undefined`:
|
||||||
|
* * The literal string `:` is appended to `result`, and
|
||||||
|
* * The value of `urlObject.port` is coerced to a string and appended to `result`.
|
||||||
|
* * Otherwise, if the `urlObject.host` property value is truthy, the value of `urlObject.host` is coerced to a string and appended to `result`.
|
||||||
|
* * If the `urlObject.pathname` property is a string that is not an empty string:
|
||||||
|
* * If the `urlObject.pathname` _does not start_ with an ASCII forward slash
|
||||||
|
* (`/`), then the literal string `'/'` is appended to `result`.
|
||||||
|
* * The value of `urlObject.pathname` is appended to `result`.
|
||||||
|
* * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown.
|
||||||
|
* * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result` followed by the output of calling the
|
||||||
|
* `querystring` module's `stringify()` method passing the value of `urlObject.query`.
|
||||||
|
* * Otherwise, if `urlObject.search` is a string:
|
||||||
|
* * If the value of `urlObject.search` _does not start_ with the ASCII question
|
||||||
|
* mark (`?`) character, the literal string `?` is appended to `result`.
|
||||||
|
* * The value of `urlObject.search` is appended to `result`.
|
||||||
|
* * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown.
|
||||||
|
* * If the `urlObject.hash` property is a string:
|
||||||
|
* * If the value of `urlObject.hash` _does not start_ with the ASCII hash (`#`)
|
||||||
|
* character, the literal string `#` is appended to `result`.
|
||||||
|
* * The value of `urlObject.hash` is appended to `result`.
|
||||||
|
* * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a
|
||||||
|
* string, an `Error` is thrown.
|
||||||
|
* * `result` is returned.
|
||||||
|
* @since v0.1.25
|
||||||
|
* @legacy Use the WHATWG URL API instead.
|
||||||
|
* @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`.
|
||||||
|
*/
|
||||||
|
function format(urlObject: URL, options?: URLFormatOptions): string;
|
||||||
|
/**
|
||||||
|
* The `url.format()` method returns a formatted URL string derived from `urlObject`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import url from 'node:url';
|
||||||
|
* url.format({
|
||||||
|
* protocol: 'https',
|
||||||
|
* hostname: 'example.com',
|
||||||
|
* pathname: '/some/path',
|
||||||
|
* query: {
|
||||||
|
* page: 1,
|
||||||
|
* format: 'json',
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // => 'https://example.com/some/path?page=1&format=json'
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If `urlObject` is not an object or a string, `url.format()` will throw a `TypeError`.
|
||||||
|
*
|
||||||
|
* The formatting process operates as follows:
|
||||||
|
*
|
||||||
|
* * A new empty string `result` is created.
|
||||||
|
* * If `urlObject.protocol` is a string, it is appended as-is to `result`.
|
||||||
|
* * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown.
|
||||||
|
* * For all string values of `urlObject.protocol` that _do not end_ with an ASCII
|
||||||
|
* colon (`:`) character, the literal string `:` will be appended to `result`.
|
||||||
|
* * If either of the following conditions is true, then the literal string `//` will be appended to `result`:
|
||||||
|
* * `urlObject.slashes` property is true;
|
||||||
|
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or `file`;
|
||||||
|
* * If the value of the `urlObject.auth` property is truthy, and either `urlObject.host` or `urlObject.hostname` are not `undefined`, the value of `urlObject.auth` will be coerced into a string
|
||||||
|
* and appended to `result` followed by the literal string `@`.
|
||||||
|
* * If the `urlObject.host` property is `undefined` then:
|
||||||
|
* * If the `urlObject.hostname` is a string, it is appended to `result`.
|
||||||
|
* * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string,
|
||||||
|
* an `Error` is thrown.
|
||||||
|
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname` is not `undefined`:
|
||||||
|
* * The literal string `:` is appended to `result`, and
|
||||||
|
* * The value of `urlObject.port` is coerced to a string and appended to `result`.
|
||||||
|
* * Otherwise, if the `urlObject.host` property value is truthy, the value of `urlObject.host` is coerced to a string and appended to `result`.
|
||||||
|
* * If the `urlObject.pathname` property is a string that is not an empty string:
|
||||||
|
* * If the `urlObject.pathname` _does not start_ with an ASCII forward slash
|
||||||
|
* (`/`), then the literal string `'/'` is appended to `result`.
|
||||||
|
* * The value of `urlObject.pathname` is appended to `result`.
|
||||||
|
* * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown.
|
||||||
|
* * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result` followed by the output of calling the
|
||||||
|
* `querystring` module's `stringify()` method passing the value of `urlObject.query`.
|
||||||
|
* * Otherwise, if `urlObject.search` is a string:
|
||||||
|
* * If the value of `urlObject.search` _does not start_ with the ASCII question
|
||||||
|
* mark (`?`) character, the literal string `?` is appended to `result`.
|
||||||
|
* * The value of `urlObject.search` is appended to `result`.
|
||||||
|
* * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown.
|
||||||
|
* * If the `urlObject.hash` property is a string:
|
||||||
|
* * If the value of `urlObject.hash` _does not start_ with the ASCII hash (`#`)
|
||||||
|
* character, the literal string `#` is appended to `result`.
|
||||||
|
* * The value of `urlObject.hash` is appended to `result`.
|
||||||
|
* * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a
|
||||||
|
* string, an `Error` is thrown.
|
||||||
|
* * `result` is returned.
|
||||||
|
* @since v0.1.25
|
||||||
|
* @legacy Use the WHATWG URL API instead.
|
||||||
|
* @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`.
|
||||||
|
*/
|
||||||
|
function format(urlObject: UrlObject | string): string;
|
||||||
|
/**
|
||||||
|
* The `url.resolve()` method resolves a target URL relative to a base URL in a
|
||||||
|
* manner similar to that of a web browser resolving an anchor tag.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import url from 'node:url';
|
||||||
|
* url.resolve('/one/two/three', 'four'); // '/one/two/four'
|
||||||
|
* url.resolve('http://example.com/', '/one'); // 'http://example.com/one'
|
||||||
|
* url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To achieve the same result using the WHATWG URL API:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* function resolve(from, to) {
|
||||||
|
* const resolvedUrl = new URL(to, new URL(from, 'resolve://'));
|
||||||
|
* if (resolvedUrl.protocol === 'resolve:') {
|
||||||
|
* // `from` is a relative URL.
|
||||||
|
* const { pathname, search, hash } = resolvedUrl;
|
||||||
|
* return pathname + search + hash;
|
||||||
|
* }
|
||||||
|
* return resolvedUrl.toString();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* resolve('/one/two/three', 'four'); // '/one/two/four'
|
||||||
|
* resolve('http://example.com/', '/one'); // 'http://example.com/one'
|
||||||
|
* resolve('http://example.com/one', '/two'); // 'http://example.com/two'
|
||||||
|
* ```
|
||||||
|
* @since v0.1.25
|
||||||
|
* @legacy Use the WHATWG URL API instead.
|
||||||
|
* @param from The base URL to use if `to` is a relative URL.
|
||||||
|
* @param to The target URL to resolve.
|
||||||
|
*/
|
||||||
|
function resolve(from: string, to: string): string;
|
||||||
|
/**
|
||||||
|
* Returns the [Punycode](https://tools.ietf.org/html/rfc5891#section-4.4) ASCII serialization of the `domain`. If `domain` is an
|
||||||
|
* invalid domain, the empty string is returned.
|
||||||
|
*
|
||||||
|
* It performs the inverse operation to {@link domainToUnicode}.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import url from 'node:url';
|
||||||
|
*
|
||||||
|
* console.log(url.domainToASCII('español.com'));
|
||||||
|
* // Prints xn--espaol-zwa.com
|
||||||
|
* console.log(url.domainToASCII('中文.com'));
|
||||||
|
* // Prints xn--fiq228c.com
|
||||||
|
* console.log(url.domainToASCII('xn--iñvalid.com'));
|
||||||
|
* // Prints an empty string
|
||||||
|
* ```
|
||||||
|
* @since v7.4.0, v6.13.0
|
||||||
|
*/
|
||||||
|
function domainToASCII(domain: string): string;
|
||||||
|
/**
|
||||||
|
* Returns the Unicode serialization of the `domain`. If `domain` is an invalid
|
||||||
|
* domain, the empty string is returned.
|
||||||
|
*
|
||||||
|
* It performs the inverse operation to {@link domainToASCII}.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import url from 'node:url';
|
||||||
|
*
|
||||||
|
* console.log(url.domainToUnicode('xn--espaol-zwa.com'));
|
||||||
|
* // Prints español.com
|
||||||
|
* console.log(url.domainToUnicode('xn--fiq228c.com'));
|
||||||
|
* // Prints 中文.com
|
||||||
|
* console.log(url.domainToUnicode('xn--iñvalid.com'));
|
||||||
|
* // Prints an empty string
|
||||||
|
* ```
|
||||||
|
* @since v7.4.0, v6.13.0
|
||||||
|
*/
|
||||||
|
function domainToUnicode(domain: string): string;
|
||||||
|
/**
|
||||||
|
* This function ensures the correct decodings of percent-encoded characters as
|
||||||
|
* well as ensuring a cross-platform valid absolute path string.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { fileURLToPath } from 'node:url';
|
||||||
|
*
|
||||||
|
* const __filename = fileURLToPath(import.meta.url);
|
||||||
|
*
|
||||||
|
* new URL('file:///C:/path/').pathname; // Incorrect: /C:/path/
|
||||||
|
* fileURLToPath('file:///C:/path/'); // Correct: C:\path\ (Windows)
|
||||||
|
*
|
||||||
|
* new URL('file://nas/foo.txt').pathname; // Incorrect: /foo.txt
|
||||||
|
* fileURLToPath('file://nas/foo.txt'); // Correct: \\nas\foo.txt (Windows)
|
||||||
|
*
|
||||||
|
* new URL('file:///你好.txt').pathname; // Incorrect: /%E4%BD%A0%E5%A5%BD.txt
|
||||||
|
* fileURLToPath('file:///你好.txt'); // Correct: /你好.txt (POSIX)
|
||||||
|
*
|
||||||
|
* new URL('file:///hello world').pathname; // Incorrect: /hello%20world
|
||||||
|
* fileURLToPath('file:///hello world'); // Correct: /hello world (POSIX)
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* **Security Considerations:**
|
||||||
|
*
|
||||||
|
* This function decodes percent-encoded characters, including encoded dot-segments
|
||||||
|
* (`%2e` as `.` and `%2e%2e` as `..`), and then normalizes the resulting path.
|
||||||
|
* This means that encoded directory traversal sequences (such as `%2e%2e`) are
|
||||||
|
* decoded and processed as actual path traversal, even though encoded slashes
|
||||||
|
* (`%2F`, `%5C`) are correctly rejected.
|
||||||
|
*
|
||||||
|
* **Applications must not rely on `fileURLToPath()` alone to prevent directory
|
||||||
|
* traversal attacks.** Always perform explicit path validation and security checks
|
||||||
|
* on the returned path value to ensure it remains within expected boundaries
|
||||||
|
* before using it for file system operations.
|
||||||
|
* @since v10.12.0
|
||||||
|
* @param url The file URL string or URL object to convert to a path.
|
||||||
|
* @return The fully-resolved platform-specific Node.js file path.
|
||||||
|
*/
|
||||||
|
function fileURLToPath(url: string | URL, options?: FileUrlToPathOptions): string;
|
||||||
|
/**
|
||||||
|
* Like `url.fileURLToPath(...)` except that instead of returning a string
|
||||||
|
* representation of the path, a `Buffer` is returned. This conversion is
|
||||||
|
* helpful when the input URL contains percent-encoded segments that are
|
||||||
|
* not valid UTF-8 / Unicode sequences.
|
||||||
|
*
|
||||||
|
* **Security Considerations:**
|
||||||
|
*
|
||||||
|
* This function has the same security considerations as `url.fileURLToPath()`.
|
||||||
|
* It decodes percent-encoded characters, including encoded dot-segments
|
||||||
|
* (`%2e` as `.` and `%2e%2e` as `..`), and normalizes the path. **Applications
|
||||||
|
* must not rely on this function alone to prevent directory traversal attacks.**
|
||||||
|
* Always perform explicit path validation on the returned buffer value before
|
||||||
|
* using it for file system operations.
|
||||||
|
* @since v24.3.0
|
||||||
|
* @param url The file URL string or URL object to convert to a path.
|
||||||
|
* @returns The fully-resolved platform-specific Node.js file path
|
||||||
|
* as a `Buffer`.
|
||||||
|
*/
|
||||||
|
function fileURLToPathBuffer(url: string | URL, options?: FileUrlToPathOptions): NonSharedBuffer;
|
||||||
|
/**
|
||||||
|
* This function ensures that `path` is resolved absolutely, and that the URL
|
||||||
|
* control characters are correctly encoded when converting into a File URL.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { pathToFileURL } from 'node:url';
|
||||||
|
*
|
||||||
|
* new URL('/foo#1', 'file:'); // Incorrect: file:///foo#1
|
||||||
|
* pathToFileURL('/foo#1'); // Correct: file:///foo%231 (POSIX)
|
||||||
|
*
|
||||||
|
* new URL('/some/path%.c', 'file:'); // Incorrect: file:///some/path%.c
|
||||||
|
* pathToFileURL('/some/path%.c'); // Correct: file:///some/path%25.c (POSIX)
|
||||||
|
* ```
|
||||||
|
* @since v10.12.0
|
||||||
|
* @param path The path to convert to a File URL.
|
||||||
|
* @return The file URL object.
|
||||||
|
*/
|
||||||
|
function pathToFileURL(path: string, options?: PathToFileUrlOptions): URL;
|
||||||
|
/**
|
||||||
|
* This utility function converts a URL object into an ordinary options object as
|
||||||
|
* expected by the `http.request()` and `https.request()` APIs.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { urlToHttpOptions } from 'node:url';
|
||||||
|
* const myURL = new URL('https://a:b@測試?abc#foo');
|
||||||
|
*
|
||||||
|
* console.log(urlToHttpOptions(myURL));
|
||||||
|
* /*
|
||||||
|
* {
|
||||||
|
* protocol: 'https:',
|
||||||
|
* hostname: 'xn--g6w251d',
|
||||||
|
* hash: '#foo',
|
||||||
|
* search: '?abc',
|
||||||
|
* pathname: '/',
|
||||||
|
* path: '/?abc',
|
||||||
|
* href: 'https://a:b@xn--g6w251d/?abc#foo',
|
||||||
|
* auth: 'a:b'
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* @since v15.7.0, v14.18.0
|
||||||
|
* @param url The `WHATWG URL` object to convert to an options object.
|
||||||
|
* @return Options object
|
||||||
|
*/
|
||||||
|
function urlToHttpOptions(url: URL): ClientRequestArgs;
|
||||||
|
interface URLFormatOptions {
|
||||||
|
/**
|
||||||
|
* `true` if the serialized URL string should include the username and password, `false` otherwise.
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
|
auth?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* `true` if the serialized URL string should include the fragment, `false` otherwise.
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
|
fragment?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* `true` if the serialized URL string should include the search query, `false` otherwise.
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
|
search?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* `true` if Unicode characters appearing in the host component of the URL string should be encoded directly as opposed to
|
||||||
|
* being Punycode encoded.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
unicode?: boolean | undefined;
|
||||||
|
}
|
||||||
|
// #region web types
|
||||||
|
type URLPatternInput = string | URLPatternInit;
|
||||||
|
interface URLPatternComponentResult {
|
||||||
|
input: string;
|
||||||
|
groups: Record<string, string | undefined>;
|
||||||
|
}
|
||||||
|
interface URLPatternInit {
|
||||||
|
protocol?: string;
|
||||||
|
username?: string;
|
||||||
|
password?: string;
|
||||||
|
hostname?: string;
|
||||||
|
port?: string;
|
||||||
|
pathname?: string;
|
||||||
|
search?: string;
|
||||||
|
hash?: string;
|
||||||
|
baseURL?: string;
|
||||||
|
}
|
||||||
|
interface URLPatternOptions {
|
||||||
|
ignoreCase?: boolean;
|
||||||
|
}
|
||||||
|
interface URLPatternResult {
|
||||||
|
inputs: URLPatternInput[];
|
||||||
|
protocol: URLPatternComponentResult;
|
||||||
|
username: URLPatternComponentResult;
|
||||||
|
password: URLPatternComponentResult;
|
||||||
|
hostname: URLPatternComponentResult;
|
||||||
|
port: URLPatternComponentResult;
|
||||||
|
pathname: URLPatternComponentResult;
|
||||||
|
search: URLPatternComponentResult;
|
||||||
|
hash: URLPatternComponentResult;
|
||||||
|
}
|
||||||
|
interface URL {
|
||||||
|
hash: string;
|
||||||
|
host: string;
|
||||||
|
hostname: string;
|
||||||
|
href: string;
|
||||||
|
readonly origin: string;
|
||||||
|
password: string;
|
||||||
|
pathname: string;
|
||||||
|
port: string;
|
||||||
|
protocol: string;
|
||||||
|
search: string;
|
||||||
|
readonly searchParams: URLSearchParams;
|
||||||
|
username: string;
|
||||||
|
toJSON(): string;
|
||||||
|
}
|
||||||
|
var URL: {
|
||||||
|
prototype: URL;
|
||||||
|
new(url: string | URL, base?: string | URL): URL;
|
||||||
|
canParse(input: string | URL, base?: string | URL): boolean;
|
||||||
|
createObjectURL(blob: Blob): string;
|
||||||
|
parse(input: string | URL, base?: string | URL): URL | null;
|
||||||
|
revokeObjectURL(id: string): void;
|
||||||
|
};
|
||||||
|
interface URLPattern {
|
||||||
|
readonly hasRegExpGroups: boolean;
|
||||||
|
readonly hash: string;
|
||||||
|
readonly hostname: string;
|
||||||
|
readonly password: string;
|
||||||
|
readonly pathname: string;
|
||||||
|
readonly port: string;
|
||||||
|
readonly protocol: string;
|
||||||
|
readonly search: string;
|
||||||
|
readonly username: string;
|
||||||
|
exec(input?: URLPatternInput, baseURL?: string | URL): URLPatternResult | null;
|
||||||
|
test(input?: URLPatternInput, baseURL?: string | URL): boolean;
|
||||||
|
}
|
||||||
|
var URLPattern: {
|
||||||
|
prototype: URLPattern;
|
||||||
|
new(input: URLPatternInput, baseURL: string | URL, options?: URLPatternOptions): URLPattern;
|
||||||
|
new(input?: URLPatternInput, options?: URLPatternOptions): URLPattern;
|
||||||
|
};
|
||||||
|
interface URLSearchParams {
|
||||||
|
readonly size: number;
|
||||||
|
append(name: string, value: string): void;
|
||||||
|
delete(name: string, value?: string): void;
|
||||||
|
get(name: string): string | null;
|
||||||
|
getAll(name: string): string[];
|
||||||
|
has(name: string, value?: string): boolean;
|
||||||
|
set(name: string, value: string): void;
|
||||||
|
sort(): void;
|
||||||
|
forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void;
|
||||||
|
[Symbol.iterator](): URLSearchParamsIterator<[string, string]>;
|
||||||
|
entries(): URLSearchParamsIterator<[string, string]>;
|
||||||
|
keys(): URLSearchParamsIterator<string>;
|
||||||
|
values(): URLSearchParamsIterator<string>;
|
||||||
|
}
|
||||||
|
var URLSearchParams: {
|
||||||
|
prototype: URLSearchParams;
|
||||||
|
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
|
||||||
|
};
|
||||||
|
interface URLSearchParamsIterator<T> extends NodeJS.Iterator<T, NodeJS.BuiltinIteratorReturn, unknown> {
|
||||||
|
[Symbol.iterator](): URLSearchParamsIterator<T>;
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
}
|
||||||
|
declare module "url" {
|
||||||
|
export * from "node:url";
|
||||||
|
}
|
||||||
1687
node_modules/@types/node/util.d.ts
generated
vendored
Normal file
1687
node_modules/@types/node/util.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
558
node_modules/@types/node/util/types.d.ts
generated
vendored
Normal file
558
node_modules/@types/node/util/types.d.ts
generated
vendored
Normal file
@ -0,0 +1,558 @@
|
|||||||
|
declare module "node:util/types" {
|
||||||
|
import { KeyObject, webcrypto } from "node:crypto";
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or
|
||||||
|
* [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
|
||||||
|
*
|
||||||
|
* See also `util.types.isArrayBuffer()` and `util.types.isSharedArrayBuffer()`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isAnyArrayBuffer(new ArrayBuffer()); // Returns true
|
||||||
|
* util.types.isAnyArrayBuffer(new SharedArrayBuffer()); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isAnyArrayBuffer(object: unknown): object is ArrayBufferLike;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is an `arguments` object.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* function foo() {
|
||||||
|
* util.types.isArgumentsObject(arguments); // Returns true
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isArgumentsObject(object: unknown): object is IArguments;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instance.
|
||||||
|
* This does _not_ include [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances. Usually, it is
|
||||||
|
* desirable to test for both; See `util.types.isAnyArrayBuffer()` for that.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isArrayBuffer(new ArrayBuffer()); // Returns true
|
||||||
|
* util.types.isArrayBuffer(new SharedArrayBuffer()); // Returns false
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isArrayBuffer(object: unknown): object is ArrayBuffer;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is an instance of one of the [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) views, such as typed
|
||||||
|
* array objects or [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView). Equivalent to
|
||||||
|
* [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isArrayBufferView(new Int8Array()); // true
|
||||||
|
* util.types.isArrayBufferView(Buffer.from('hello world')); // true
|
||||||
|
* util.types.isArrayBufferView(new DataView(new ArrayBuffer(16))); // true
|
||||||
|
* util.types.isArrayBufferView(new ArrayBuffer()); // false
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isArrayBufferView(object: unknown): object is NodeJS.ArrayBufferView;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is an [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).
|
||||||
|
* This only reports back what the JavaScript engine is seeing;
|
||||||
|
* in particular, the return value may not match the original source code if
|
||||||
|
* a transpilation tool was used.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isAsyncFunction(function foo() {}); // Returns false
|
||||||
|
* util.types.isAsyncFunction(async function foo() {}); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isAsyncFunction(object: unknown): boolean;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a `BigInt64Array` instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isBigInt64Array(new BigInt64Array()); // Returns true
|
||||||
|
* util.types.isBigInt64Array(new BigUint64Array()); // Returns false
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isBigInt64Array(value: unknown): value is BigInt64Array;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a BigInt object, e.g. created
|
||||||
|
* by `Object(BigInt(123))`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isBigIntObject(Object(BigInt(123))); // Returns true
|
||||||
|
* util.types.isBigIntObject(BigInt(123)); // Returns false
|
||||||
|
* util.types.isBigIntObject(123); // Returns false
|
||||||
|
* ```
|
||||||
|
* @since v10.4.0
|
||||||
|
*/
|
||||||
|
function isBigIntObject(object: unknown): object is BigInt;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a `BigUint64Array` instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isBigUint64Array(new BigInt64Array()); // Returns false
|
||||||
|
* util.types.isBigUint64Array(new BigUint64Array()); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isBigUint64Array(value: unknown): value is BigUint64Array;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a boolean object, e.g. created
|
||||||
|
* by `new Boolean()`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isBooleanObject(false); // Returns false
|
||||||
|
* util.types.isBooleanObject(true); // Returns false
|
||||||
|
* util.types.isBooleanObject(new Boolean(false)); // Returns true
|
||||||
|
* util.types.isBooleanObject(new Boolean(true)); // Returns true
|
||||||
|
* util.types.isBooleanObject(Boolean(false)); // Returns false
|
||||||
|
* util.types.isBooleanObject(Boolean(true)); // Returns false
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isBooleanObject(object: unknown): object is Boolean;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is any boxed primitive object, e.g. created
|
||||||
|
* by `new Boolean()`, `new String()` or `Object(Symbol())`.
|
||||||
|
*
|
||||||
|
* For example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isBoxedPrimitive(false); // Returns false
|
||||||
|
* util.types.isBoxedPrimitive(new Boolean(false)); // Returns true
|
||||||
|
* util.types.isBoxedPrimitive(Symbol('foo')); // Returns false
|
||||||
|
* util.types.isBoxedPrimitive(Object(Symbol('foo'))); // Returns true
|
||||||
|
* util.types.isBoxedPrimitive(Object(BigInt(5))); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.11.0
|
||||||
|
*/
|
||||||
|
function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const ab = new ArrayBuffer(20);
|
||||||
|
* util.types.isDataView(new DataView(ab)); // Returns true
|
||||||
|
* util.types.isDataView(new Float64Array()); // Returns false
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isDataView(object: unknown): object is DataView;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isDate(new Date()); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isDate(object: unknown): object is Date;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a native `External` value.
|
||||||
|
*
|
||||||
|
* A native `External` value is a special type of object that contains a
|
||||||
|
* raw C++ pointer (`void*`) for access from native code, and has no other
|
||||||
|
* properties. Such objects are created either by Node.js internals or native
|
||||||
|
* addons. In JavaScript, they are
|
||||||
|
* [frozen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) objects with a
|
||||||
|
* `null` prototype.
|
||||||
|
*
|
||||||
|
* ```c
|
||||||
|
* #include <js_native_api.h>
|
||||||
|
* #include <stdlib.h>
|
||||||
|
* napi_value result;
|
||||||
|
* static napi_value MyNapi(napi_env env, napi_callback_info info) {
|
||||||
|
* int* raw = (int*) malloc(1024);
|
||||||
|
* napi_status status = napi_create_external(env, (void*) raw, NULL, NULL, &result);
|
||||||
|
* if (status != napi_ok) {
|
||||||
|
* napi_throw_error(env, NULL, "napi_create_external failed");
|
||||||
|
* return NULL;
|
||||||
|
* }
|
||||||
|
* return result;
|
||||||
|
* }
|
||||||
|
* ...
|
||||||
|
* DECLARE_NAPI_PROPERTY("myNapi", MyNapi)
|
||||||
|
* ...
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import native from 'napi_addon.node';
|
||||||
|
* import { types } from 'node:util';
|
||||||
|
*
|
||||||
|
* const data = native.myNapi();
|
||||||
|
* types.isExternal(data); // returns true
|
||||||
|
* types.isExternal(0); // returns false
|
||||||
|
* types.isExternal(new String('foo')); // returns false
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* For further information on `napi_create_external`, refer to
|
||||||
|
* [`napi_create_external()`](https://nodejs.org/docs/latest-v25.x/api/n-api.html#napi_create_external).
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isExternal(object: unknown): boolean;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`Float16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float16Array) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isFloat16Array(new ArrayBuffer()); // Returns false
|
||||||
|
* util.types.isFloat16Array(new Float16Array()); // Returns true
|
||||||
|
* util.types.isFloat16Array(new Float32Array()); // Returns false
|
||||||
|
* ```
|
||||||
|
* @since v24.0.0
|
||||||
|
*/
|
||||||
|
function isFloat16Array(object: unknown): object is Float16Array;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isFloat32Array(new ArrayBuffer()); // Returns false
|
||||||
|
* util.types.isFloat32Array(new Float32Array()); // Returns true
|
||||||
|
* util.types.isFloat32Array(new Float64Array()); // Returns false
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isFloat32Array(object: unknown): object is Float32Array;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`Float64Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isFloat64Array(new ArrayBuffer()); // Returns false
|
||||||
|
* util.types.isFloat64Array(new Uint8Array()); // Returns false
|
||||||
|
* util.types.isFloat64Array(new Float64Array()); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isFloat64Array(object: unknown): object is Float64Array;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a generator function.
|
||||||
|
* This only reports back what the JavaScript engine is seeing;
|
||||||
|
* in particular, the return value may not match the original source code if
|
||||||
|
* a transpilation tool was used.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isGeneratorFunction(function foo() {}); // Returns false
|
||||||
|
* util.types.isGeneratorFunction(function* foo() {}); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isGeneratorFunction(object: unknown): object is GeneratorFunction;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a generator object as returned from a
|
||||||
|
* built-in generator function.
|
||||||
|
* This only reports back what the JavaScript engine is seeing;
|
||||||
|
* in particular, the return value may not match the original source code if
|
||||||
|
* a transpilation tool was used.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* function* foo() {}
|
||||||
|
* const generator = foo();
|
||||||
|
* util.types.isGeneratorObject(generator); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isGeneratorObject(object: unknown): object is Generator;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`Int8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isInt8Array(new ArrayBuffer()); // Returns false
|
||||||
|
* util.types.isInt8Array(new Int8Array()); // Returns true
|
||||||
|
* util.types.isInt8Array(new Float64Array()); // Returns false
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isInt8Array(object: unknown): object is Int8Array;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`Int16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isInt16Array(new ArrayBuffer()); // Returns false
|
||||||
|
* util.types.isInt16Array(new Int16Array()); // Returns true
|
||||||
|
* util.types.isInt16Array(new Float64Array()); // Returns false
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isInt16Array(object: unknown): object is Int16Array;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`Int32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isInt32Array(new ArrayBuffer()); // Returns false
|
||||||
|
* util.types.isInt32Array(new Int32Array()); // Returns true
|
||||||
|
* util.types.isInt32Array(new Float64Array()); // Returns false
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isInt32Array(object: unknown): object is Int32Array;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isMap(new Map()); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isMap<T>(
|
||||||
|
object: T | {},
|
||||||
|
): object is T extends ReadonlyMap<any, any> ? (unknown extends T ? never : ReadonlyMap<any, any>)
|
||||||
|
: Map<unknown, unknown>;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is an iterator returned for a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const map = new Map();
|
||||||
|
* util.types.isMapIterator(map.keys()); // Returns true
|
||||||
|
* util.types.isMapIterator(map.values()); // Returns true
|
||||||
|
* util.types.isMapIterator(map.entries()); // Returns true
|
||||||
|
* util.types.isMapIterator(map[Symbol.iterator]()); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isMapIterator(object: unknown): boolean;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is an instance of a [Module Namespace Object](https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects).
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import * as ns from './a.js';
|
||||||
|
*
|
||||||
|
* util.types.isModuleNamespaceObject(ns); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isModuleNamespaceObject(value: unknown): boolean;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value was returned by the constructor of a
|
||||||
|
* [built-in `Error` type](https://tc39.es/ecma262/#sec-error-objects).
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* console.log(util.types.isNativeError(new Error())); // true
|
||||||
|
* console.log(util.types.isNativeError(new TypeError())); // true
|
||||||
|
* console.log(util.types.isNativeError(new RangeError())); // true
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Subclasses of the native error types are also native errors:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* class MyError extends Error {}
|
||||||
|
* console.log(util.types.isNativeError(new MyError())); // true
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* A value being `instanceof` a native error class is not equivalent to `isNativeError()`
|
||||||
|
* returning `true` for that value. `isNativeError()` returns `true` for errors
|
||||||
|
* which come from a different [realm](https://tc39.es/ecma262/#realm) while `instanceof Error` returns `false`
|
||||||
|
* for these errors:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { createContext, runInContext } from 'node:vm';
|
||||||
|
* import { types } from 'node:util';
|
||||||
|
*
|
||||||
|
* const context = createContext({});
|
||||||
|
* const myError = runInContext('new Error()', context);
|
||||||
|
* console.log(types.isNativeError(myError)); // true
|
||||||
|
* console.log(myError instanceof Error); // false
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Conversely, `isNativeError()` returns `false` for all objects which were not
|
||||||
|
* returned by the constructor of a native error. That includes values
|
||||||
|
* which are `instanceof` native errors:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const myError = { __proto__: Error.prototype };
|
||||||
|
* console.log(util.types.isNativeError(myError)); // false
|
||||||
|
* console.log(myError instanceof Error); // true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
* @deprecated The `util.types.isNativeError` API is deprecated. Please use `Error.isError` instead.
|
||||||
|
*/
|
||||||
|
function isNativeError(object: unknown): object is Error;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a number object, e.g. created
|
||||||
|
* by `new Number()`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isNumberObject(0); // Returns false
|
||||||
|
* util.types.isNumberObject(new Number(0)); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isNumberObject(object: unknown): object is Number;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isPromise(Promise.resolve(42)); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isPromise(object: unknown): object is Promise<unknown>;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a [`Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const target = {};
|
||||||
|
* const proxy = new Proxy(target, {});
|
||||||
|
* util.types.isProxy(target); // Returns false
|
||||||
|
* util.types.isProxy(proxy); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isProxy(object: unknown): boolean;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a regular expression object.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isRegExp(/abc/); // Returns true
|
||||||
|
* util.types.isRegExp(new RegExp('abc')); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isRegExp(object: unknown): object is RegExp;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isSet(new Set()); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isSet<T>(
|
||||||
|
object: T | {},
|
||||||
|
): object is T extends ReadonlySet<any> ? (unknown extends T ? never : ReadonlySet<any>) : Set<unknown>;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is an iterator returned for a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const set = new Set();
|
||||||
|
* util.types.isSetIterator(set.keys()); // Returns true
|
||||||
|
* util.types.isSetIterator(set.values()); // Returns true
|
||||||
|
* util.types.isSetIterator(set.entries()); // Returns true
|
||||||
|
* util.types.isSetIterator(set[Symbol.iterator]()); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isSetIterator(object: unknown): boolean;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
|
||||||
|
* This does _not_ include [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instances. Usually, it is
|
||||||
|
* desirable to test for both; See `util.types.isAnyArrayBuffer()` for that.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isSharedArrayBuffer(new ArrayBuffer()); // Returns false
|
||||||
|
* util.types.isSharedArrayBuffer(new SharedArrayBuffer()); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isSharedArrayBuffer(object: unknown): object is SharedArrayBuffer;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a string object, e.g. created
|
||||||
|
* by `new String()`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isStringObject('foo'); // Returns false
|
||||||
|
* util.types.isStringObject(new String('foo')); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isStringObject(object: unknown): object is String;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a symbol object, created
|
||||||
|
* by calling `Object()` on a `Symbol` primitive.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const symbol = Symbol('foo');
|
||||||
|
* util.types.isSymbolObject(symbol); // Returns false
|
||||||
|
* util.types.isSymbolObject(Object(symbol)); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isSymbolObject(object: unknown): object is Symbol;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isTypedArray(new ArrayBuffer()); // Returns false
|
||||||
|
* util.types.isTypedArray(new Uint8Array()); // Returns true
|
||||||
|
* util.types.isTypedArray(new Float64Array()); // Returns true
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isTypedArray(object: unknown): object is NodeJS.TypedArray;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isUint8Array(new ArrayBuffer()); // Returns false
|
||||||
|
* util.types.isUint8Array(new Uint8Array()); // Returns true
|
||||||
|
* util.types.isUint8Array(new Float64Array()); // Returns false
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isUint8Array(object: unknown): object is Uint8Array;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`Uint8ClampedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isUint8ClampedArray(new ArrayBuffer()); // Returns false
|
||||||
|
* util.types.isUint8ClampedArray(new Uint8ClampedArray()); // Returns true
|
||||||
|
* util.types.isUint8ClampedArray(new Float64Array()); // Returns false
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isUint8ClampedArray(object: unknown): object is Uint8ClampedArray;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`Uint16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isUint16Array(new ArrayBuffer()); // Returns false
|
||||||
|
* util.types.isUint16Array(new Uint16Array()); // Returns true
|
||||||
|
* util.types.isUint16Array(new Float64Array()); // Returns false
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isUint16Array(object: unknown): object is Uint16Array;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`Uint32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isUint32Array(new ArrayBuffer()); // Returns false
|
||||||
|
* util.types.isUint32Array(new Uint32Array()); // Returns true
|
||||||
|
* util.types.isUint32Array(new Float64Array()); // Returns false
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isUint32Array(object: unknown): object is Uint32Array;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isWeakMap(new WeakMap()); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isWeakMap(object: unknown): object is WeakMap<object, unknown>;
|
||||||
|
/**
|
||||||
|
* Returns `true` if the value is a built-in [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) instance.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* util.types.isWeakSet(new WeakSet()); // Returns true
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function isWeakSet(object: unknown): object is WeakSet<object>;
|
||||||
|
/**
|
||||||
|
* Returns `true` if `value` is a `KeyObject`, `false` otherwise.
|
||||||
|
* @since v16.2.0
|
||||||
|
*/
|
||||||
|
function isKeyObject(object: unknown): object is KeyObject;
|
||||||
|
/**
|
||||||
|
* Returns `true` if `value` is a `CryptoKey`, `false` otherwise.
|
||||||
|
* @since v16.2.0
|
||||||
|
*/
|
||||||
|
function isCryptoKey(object: unknown): object is webcrypto.CryptoKey;
|
||||||
|
}
|
||||||
|
declare module "util/types" {
|
||||||
|
export * from "node:util/types";
|
||||||
|
}
|
||||||
988
node_modules/@types/node/v8.d.ts
generated
vendored
Normal file
988
node_modules/@types/node/v8.d.ts
generated
vendored
Normal file
@ -0,0 +1,988 @@
|
|||||||
|
/**
|
||||||
|
* The `node:v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import v8 from 'node:v8';
|
||||||
|
* ```
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/v8.js)
|
||||||
|
*/
|
||||||
|
declare module "node:v8" {
|
||||||
|
import { NonSharedBuffer } from "node:buffer";
|
||||||
|
import { Readable } from "node:stream";
|
||||||
|
interface HeapSpaceInfo {
|
||||||
|
space_name: string;
|
||||||
|
space_size: number;
|
||||||
|
space_used_size: number;
|
||||||
|
space_available_size: number;
|
||||||
|
physical_space_size: number;
|
||||||
|
}
|
||||||
|
// ** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */
|
||||||
|
type DoesZapCodeSpaceFlag = 0 | 1;
|
||||||
|
interface HeapInfo {
|
||||||
|
total_heap_size: number;
|
||||||
|
total_heap_size_executable: number;
|
||||||
|
total_physical_size: number;
|
||||||
|
total_available_size: number;
|
||||||
|
used_heap_size: number;
|
||||||
|
heap_size_limit: number;
|
||||||
|
malloced_memory: number;
|
||||||
|
peak_malloced_memory: number;
|
||||||
|
does_zap_garbage: DoesZapCodeSpaceFlag;
|
||||||
|
number_of_native_contexts: number;
|
||||||
|
number_of_detached_contexts: number;
|
||||||
|
total_global_handles_size: number;
|
||||||
|
used_global_handles_size: number;
|
||||||
|
external_memory: number;
|
||||||
|
total_allocated_bytes: number;
|
||||||
|
}
|
||||||
|
interface HeapCodeStatistics {
|
||||||
|
code_and_metadata_size: number;
|
||||||
|
bytecode_and_metadata_size: number;
|
||||||
|
external_script_source_size: number;
|
||||||
|
}
|
||||||
|
interface HeapSnapshotOptions {
|
||||||
|
/**
|
||||||
|
* If true, expose internals in the heap snapshot.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
exposeInternals?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* If true, expose numeric values in artificial fields.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
exposeNumericValues?: boolean | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns an integer representing a version tag derived from the V8 version,
|
||||||
|
* command-line flags, and detected CPU features. This is useful for determining
|
||||||
|
* whether a `vm.Script` `cachedData` buffer is compatible with this instance
|
||||||
|
* of V8.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* console.log(v8.cachedDataVersionTag()); // 3947234607
|
||||||
|
* // The value returned by v8.cachedDataVersionTag() is derived from the V8
|
||||||
|
* // version, command-line flags, and detected CPU features. Test that the value
|
||||||
|
* // does indeed update when flags are toggled.
|
||||||
|
* v8.setFlagsFromString('--allow_natives_syntax');
|
||||||
|
* console.log(v8.cachedDataVersionTag()); // 183726201
|
||||||
|
* ```
|
||||||
|
* @since v8.0.0
|
||||||
|
*/
|
||||||
|
function cachedDataVersionTag(): number;
|
||||||
|
/**
|
||||||
|
* Returns an object with the following properties:
|
||||||
|
*
|
||||||
|
* `does_zap_garbage` is a 0/1 boolean, which signifies whether the `--zap_code_space` option is enabled or not. This makes V8 overwrite heap
|
||||||
|
* garbage with a bit pattern. The RSS footprint (resident set size) gets bigger
|
||||||
|
* because it continuously touches all heap pages and that makes them less likely
|
||||||
|
* to get swapped out by the operating system.
|
||||||
|
*
|
||||||
|
* `number_of_native_contexts` The value of native\_context is the number of the
|
||||||
|
* top-level contexts currently active. Increase of this number over time indicates
|
||||||
|
* a memory leak.
|
||||||
|
*
|
||||||
|
* `number_of_detached_contexts` The value of detached\_context is the number
|
||||||
|
* of contexts that were detached and not yet garbage collected. This number
|
||||||
|
* being non-zero indicates a potential memory leak.
|
||||||
|
*
|
||||||
|
* `total_global_handles_size` The value of total\_global\_handles\_size is the
|
||||||
|
* total memory size of V8 global handles.
|
||||||
|
*
|
||||||
|
* `used_global_handles_size` The value of used\_global\_handles\_size is the
|
||||||
|
* used memory size of V8 global handles.
|
||||||
|
*
|
||||||
|
* `external_memory` The value of external\_memory is the memory size of array
|
||||||
|
* buffers and external strings.
|
||||||
|
*
|
||||||
|
* `total_allocated_bytes` The value of total allocated bytes since the Isolate
|
||||||
|
* creation.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* total_heap_size: 7326976,
|
||||||
|
* total_heap_size_executable: 4194304,
|
||||||
|
* total_physical_size: 7326976,
|
||||||
|
* total_available_size: 1152656,
|
||||||
|
* used_heap_size: 3476208,
|
||||||
|
* heap_size_limit: 1535115264,
|
||||||
|
* malloced_memory: 16384,
|
||||||
|
* peak_malloced_memory: 1127496,
|
||||||
|
* does_zap_garbage: 0,
|
||||||
|
* number_of_native_contexts: 1,
|
||||||
|
* number_of_detached_contexts: 0,
|
||||||
|
* total_global_handles_size: 8192,
|
||||||
|
* used_global_handles_size: 3296,
|
||||||
|
* external_memory: 318824,
|
||||||
|
* total_allocated_bytes: 45224088
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v1.0.0
|
||||||
|
*/
|
||||||
|
function getHeapStatistics(): HeapInfo;
|
||||||
|
/**
|
||||||
|
* It returns an object with a structure similar to the
|
||||||
|
* [`cppgc::HeapStatistics`](https://v8docs.nodesource.com/node-22.4/d7/d51/heap-statistics_8h_source.html)
|
||||||
|
* object. See the [V8 documentation](https://v8docs.nodesource.com/node-22.4/df/d2f/structcppgc_1_1_heap_statistics.html)
|
||||||
|
* for more information about the properties of the object.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // Detailed
|
||||||
|
* ({
|
||||||
|
* committed_size_bytes: 131072,
|
||||||
|
* resident_size_bytes: 131072,
|
||||||
|
* used_size_bytes: 152,
|
||||||
|
* space_statistics: [
|
||||||
|
* {
|
||||||
|
* name: 'NormalPageSpace0',
|
||||||
|
* committed_size_bytes: 0,
|
||||||
|
* resident_size_bytes: 0,
|
||||||
|
* used_size_bytes: 0,
|
||||||
|
* page_stats: [{}],
|
||||||
|
* free_list_stats: {},
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* name: 'NormalPageSpace1',
|
||||||
|
* committed_size_bytes: 131072,
|
||||||
|
* resident_size_bytes: 131072,
|
||||||
|
* used_size_bytes: 152,
|
||||||
|
* page_stats: [{}],
|
||||||
|
* free_list_stats: {},
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* name: 'NormalPageSpace2',
|
||||||
|
* committed_size_bytes: 0,
|
||||||
|
* resident_size_bytes: 0,
|
||||||
|
* used_size_bytes: 0,
|
||||||
|
* page_stats: [{}],
|
||||||
|
* free_list_stats: {},
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* name: 'NormalPageSpace3',
|
||||||
|
* committed_size_bytes: 0,
|
||||||
|
* resident_size_bytes: 0,
|
||||||
|
* used_size_bytes: 0,
|
||||||
|
* page_stats: [{}],
|
||||||
|
* free_list_stats: {},
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* name: 'LargePageSpace',
|
||||||
|
* committed_size_bytes: 0,
|
||||||
|
* resident_size_bytes: 0,
|
||||||
|
* used_size_bytes: 0,
|
||||||
|
* page_stats: [{}],
|
||||||
|
* free_list_stats: {},
|
||||||
|
* },
|
||||||
|
* ],
|
||||||
|
* type_names: [],
|
||||||
|
* detail_level: 'detailed',
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // Brief
|
||||||
|
* ({
|
||||||
|
* committed_size_bytes: 131072,
|
||||||
|
* resident_size_bytes: 131072,
|
||||||
|
* used_size_bytes: 128864,
|
||||||
|
* space_statistics: [],
|
||||||
|
* type_names: [],
|
||||||
|
* detail_level: 'brief',
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v22.15.0
|
||||||
|
* @param detailLevel **Default:** `'detailed'`. Specifies the level of detail in the returned statistics.
|
||||||
|
* Accepted values are:
|
||||||
|
* * `'brief'`: Brief statistics contain only the top-level
|
||||||
|
* allocated and used
|
||||||
|
* memory statistics for the entire heap.
|
||||||
|
* * `'detailed'`: Detailed statistics also contain a break
|
||||||
|
* down per space and page, as well as freelist statistics
|
||||||
|
* and object type histograms.
|
||||||
|
*/
|
||||||
|
function getCppHeapStatistics(detailLevel?: "brief" | "detailed"): object;
|
||||||
|
/**
|
||||||
|
* Returns statistics about the V8 heap spaces, i.e. the segments which make up
|
||||||
|
* the V8 heap. Neither the ordering of heap spaces, nor the availability of a
|
||||||
|
* heap space can be guaranteed as the statistics are provided via the
|
||||||
|
* V8 [`GetHeapSpaceStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4) function and may change from one V8 version to the
|
||||||
|
* next.
|
||||||
|
*
|
||||||
|
* The value returned is an array of objects containing the following properties:
|
||||||
|
*
|
||||||
|
* ```json
|
||||||
|
* [
|
||||||
|
* {
|
||||||
|
* "space_name": "new_space",
|
||||||
|
* "space_size": 2063872,
|
||||||
|
* "space_used_size": 951112,
|
||||||
|
* "space_available_size": 80824,
|
||||||
|
* "physical_space_size": 2063872
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* "space_name": "old_space",
|
||||||
|
* "space_size": 3090560,
|
||||||
|
* "space_used_size": 2493792,
|
||||||
|
* "space_available_size": 0,
|
||||||
|
* "physical_space_size": 3090560
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* "space_name": "code_space",
|
||||||
|
* "space_size": 1260160,
|
||||||
|
* "space_used_size": 644256,
|
||||||
|
* "space_available_size": 960,
|
||||||
|
* "physical_space_size": 1260160
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* "space_name": "map_space",
|
||||||
|
* "space_size": 1094160,
|
||||||
|
* "space_used_size": 201608,
|
||||||
|
* "space_available_size": 0,
|
||||||
|
* "physical_space_size": 1094160
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* "space_name": "large_object_space",
|
||||||
|
* "space_size": 0,
|
||||||
|
* "space_used_size": 0,
|
||||||
|
* "space_available_size": 1490980608,
|
||||||
|
* "physical_space_size": 0
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* ```
|
||||||
|
* @since v6.0.0
|
||||||
|
*/
|
||||||
|
function getHeapSpaceStatistics(): HeapSpaceInfo[];
|
||||||
|
/**
|
||||||
|
* The `v8.setFlagsFromString()` method can be used to programmatically set
|
||||||
|
* V8 command-line flags. This method should be used with care. Changing settings
|
||||||
|
* after the VM has started may result in unpredictable behavior, including
|
||||||
|
* crashes and data loss; or it may simply do nothing.
|
||||||
|
*
|
||||||
|
* The V8 options available for a version of Node.js may be determined by running `node --v8-options`.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // Print GC events to stdout for one minute.
|
||||||
|
* import v8 from 'node:v8';
|
||||||
|
* v8.setFlagsFromString('--trace_gc');
|
||||||
|
* setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3);
|
||||||
|
* ```
|
||||||
|
* @since v1.0.0
|
||||||
|
*/
|
||||||
|
function setFlagsFromString(flags: string): void;
|
||||||
|
/**
|
||||||
|
* This is similar to the [`queryObjects()` console API](https://developer.chrome.com/docs/devtools/console/utilities#queryObjects-function)
|
||||||
|
* provided by the Chromium DevTools console. It can be used to search for objects that have the matching constructor on its prototype chain
|
||||||
|
* in the heap after a full garbage collection, which can be useful for memory leak regression tests. To avoid surprising results, users should
|
||||||
|
* avoid using this API on constructors whose implementation they don't control, or on constructors that can be invoked by other parties in the
|
||||||
|
* application.
|
||||||
|
*
|
||||||
|
* To avoid accidental leaks, this API does not return raw references to the objects found. By default, it returns the count of the objects
|
||||||
|
* found. If `options.format` is `'summary'`, it returns an array containing brief string representations for each object. The visibility provided
|
||||||
|
* in this API is similar to what the heap snapshot provides, while users can save the cost of serialization and parsing and directly filter the
|
||||||
|
* target objects during the search.
|
||||||
|
*
|
||||||
|
* Only objects created in the current execution context are included in the results.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { queryObjects } from 'node:v8';
|
||||||
|
* class A { foo = 'bar'; }
|
||||||
|
* console.log(queryObjects(A)); // 0
|
||||||
|
* const a = new A();
|
||||||
|
* console.log(queryObjects(A)); // 1
|
||||||
|
* // [ "A { foo: 'bar' }" ]
|
||||||
|
* console.log(queryObjects(A, { format: 'summary' }));
|
||||||
|
*
|
||||||
|
* class B extends A { bar = 'qux'; }
|
||||||
|
* const b = new B();
|
||||||
|
* console.log(queryObjects(B)); // 1
|
||||||
|
* // [ "B { foo: 'bar', bar: 'qux' }" ]
|
||||||
|
* console.log(queryObjects(B, { format: 'summary' }));
|
||||||
|
*
|
||||||
|
* // Note that, when there are child classes inheriting from a constructor,
|
||||||
|
* // the constructor also shows up in the prototype chain of the child
|
||||||
|
* // classes's prototoype, so the child classes's prototoype would also be
|
||||||
|
* // included in the result.
|
||||||
|
* console.log(queryObjects(A)); // 3
|
||||||
|
* // [ "B { foo: 'bar', bar: 'qux' }", 'A {}', "A { foo: 'bar' }" ]
|
||||||
|
* console.log(queryObjects(A, { format: 'summary' }));
|
||||||
|
* ```
|
||||||
|
* @param ctor The constructor that can be used to search on the prototype chain in order to filter target objects in the heap.
|
||||||
|
* @since v20.13.0
|
||||||
|
*/
|
||||||
|
function queryObjects(ctor: Function): number | string[];
|
||||||
|
function queryObjects(ctor: Function, options: { format: "count" }): number;
|
||||||
|
function queryObjects(ctor: Function, options: { format: "summary" }): string[];
|
||||||
|
/**
|
||||||
|
* Generates a snapshot of the current V8 heap and returns a Readable
|
||||||
|
* Stream that may be used to read the JSON serialized representation.
|
||||||
|
* This JSON stream format is intended to be used with tools such as
|
||||||
|
* Chrome DevTools. The JSON schema is undocumented and specific to the
|
||||||
|
* V8 engine. Therefore, the schema may change from one version of V8 to the next.
|
||||||
|
*
|
||||||
|
* Creating a heap snapshot requires memory about twice the size of the heap at
|
||||||
|
* the time the snapshot is created. This results in the risk of OOM killers
|
||||||
|
* terminating the process.
|
||||||
|
*
|
||||||
|
* Generating a snapshot is a synchronous operation which blocks the event loop
|
||||||
|
* for a duration depending on the heap size.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // Print heap snapshot to the console
|
||||||
|
* import v8 from 'node:v8';
|
||||||
|
* const stream = v8.getHeapSnapshot();
|
||||||
|
* stream.pipe(process.stdout);
|
||||||
|
* ```
|
||||||
|
* @since v11.13.0
|
||||||
|
* @return A Readable containing the V8 heap snapshot.
|
||||||
|
*/
|
||||||
|
function getHeapSnapshot(options?: HeapSnapshotOptions): Readable;
|
||||||
|
/**
|
||||||
|
* Generates a snapshot of the current V8 heap and writes it to a JSON
|
||||||
|
* file. This file is intended to be used with tools such as Chrome
|
||||||
|
* DevTools. The JSON schema is undocumented and specific to the V8
|
||||||
|
* engine, and may change from one version of V8 to the next.
|
||||||
|
*
|
||||||
|
* A heap snapshot is specific to a single V8 isolate. When using `worker threads`, a heap snapshot generated from the main thread will
|
||||||
|
* not contain any information about the workers, and vice versa.
|
||||||
|
*
|
||||||
|
* Creating a heap snapshot requires memory about twice the size of the heap at
|
||||||
|
* the time the snapshot is created. This results in the risk of OOM killers
|
||||||
|
* terminating the process.
|
||||||
|
*
|
||||||
|
* Generating a snapshot is a synchronous operation which blocks the event loop
|
||||||
|
* for a duration depending on the heap size.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { writeHeapSnapshot } from 'node:v8';
|
||||||
|
* import {
|
||||||
|
* Worker,
|
||||||
|
* isMainThread,
|
||||||
|
* parentPort,
|
||||||
|
* } from 'node:worker_threads';
|
||||||
|
*
|
||||||
|
* if (isMainThread) {
|
||||||
|
* const worker = new Worker(__filename);
|
||||||
|
*
|
||||||
|
* worker.once('message', (filename) => {
|
||||||
|
* console.log(`worker heapdump: ${filename}`);
|
||||||
|
* // Now get a heapdump for the main thread.
|
||||||
|
* console.log(`main thread heapdump: ${writeHeapSnapshot()}`);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Tell the worker to create a heapdump.
|
||||||
|
* worker.postMessage('heapdump');
|
||||||
|
* } else {
|
||||||
|
* parentPort.once('message', (message) => {
|
||||||
|
* if (message === 'heapdump') {
|
||||||
|
* // Generate a heapdump for the worker
|
||||||
|
* // and return the filename to the parent.
|
||||||
|
* parentPort.postMessage(writeHeapSnapshot());
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v11.13.0
|
||||||
|
* @param filename The file path where the V8 heap snapshot is to be saved. If not specified, a file name with the pattern `'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread_id}.heapsnapshot'` will be
|
||||||
|
* generated, where `{pid}` will be the PID of the Node.js process, `{thread_id}` will be `0` when `writeHeapSnapshot()` is called from the main Node.js thread or the id of a
|
||||||
|
* worker thread.
|
||||||
|
* @return The filename where the snapshot was saved.
|
||||||
|
*/
|
||||||
|
function writeHeapSnapshot(filename?: string, options?: HeapSnapshotOptions): string;
|
||||||
|
/**
|
||||||
|
* Get statistics about code and its metadata in the heap, see
|
||||||
|
* V8 [`GetHeapCodeAndMetadataStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#a6079122af17612ef54ef3348ce170866) API. Returns an object with the
|
||||||
|
* following properties:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* code_and_metadata_size: 212208,
|
||||||
|
* bytecode_and_metadata_size: 161368,
|
||||||
|
* external_script_source_size: 1410794,
|
||||||
|
* cpu_profiler_metadata_size: 0,
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v12.8.0
|
||||||
|
*/
|
||||||
|
function getHeapCodeStatistics(): HeapCodeStatistics;
|
||||||
|
/**
|
||||||
|
* @since v25.0.0
|
||||||
|
*/
|
||||||
|
interface SyncCPUProfileHandle {
|
||||||
|
/**
|
||||||
|
* Stopping collecting the profile and return the profile data.
|
||||||
|
* @since v25.0.0
|
||||||
|
*/
|
||||||
|
stop(): string;
|
||||||
|
/**
|
||||||
|
* Stopping collecting the profile and the profile will be discarded.
|
||||||
|
* @since v25.0.0
|
||||||
|
*/
|
||||||
|
[Symbol.dispose](): void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @since v24.8.0
|
||||||
|
*/
|
||||||
|
interface CPUProfileHandle {
|
||||||
|
/**
|
||||||
|
* Stopping collecting the profile, then return a Promise that fulfills with an error or the
|
||||||
|
* profile data.
|
||||||
|
* @since v24.8.0
|
||||||
|
*/
|
||||||
|
stop(): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Stopping collecting the profile and the profile will be discarded.
|
||||||
|
* @since v24.8.0
|
||||||
|
*/
|
||||||
|
[Symbol.asyncDispose](): Promise<void>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @since v24.9.0
|
||||||
|
*/
|
||||||
|
interface HeapProfileHandle {
|
||||||
|
/**
|
||||||
|
* Stopping collecting the profile, then return a Promise that fulfills with an error or the
|
||||||
|
* profile data.
|
||||||
|
* @since v24.9.0
|
||||||
|
*/
|
||||||
|
stop(): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Stopping collecting the profile and the profile will be discarded.
|
||||||
|
* @since v24.9.0
|
||||||
|
*/
|
||||||
|
[Symbol.asyncDispose](): Promise<void>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Starting a CPU profile then return a `SyncCPUProfileHandle` object.
|
||||||
|
* This API supports `using` syntax.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const handle = v8.startCpuProfile();
|
||||||
|
* const profile = handle.stop();
|
||||||
|
* console.log(profile);
|
||||||
|
* ```
|
||||||
|
* @since v25.0.0
|
||||||
|
*/
|
||||||
|
function startCpuProfile(): SyncCPUProfileHandle;
|
||||||
|
/**
|
||||||
|
* V8 only supports `Latin-1/ISO-8859-1` and `UTF16` as the underlying representation of a string.
|
||||||
|
* If the `content` uses `Latin-1/ISO-8859-1` as the underlying representation, this function will return true;
|
||||||
|
* otherwise, it returns false.
|
||||||
|
*
|
||||||
|
* If this method returns false, that does not mean that the string contains some characters not in `Latin-1/ISO-8859-1`.
|
||||||
|
* Sometimes a `Latin-1` string may also be represented as `UTF16`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { isStringOneByteRepresentation } = require('node:v8');
|
||||||
|
*
|
||||||
|
* const Encoding = {
|
||||||
|
* latin1: 1,
|
||||||
|
* utf16le: 2,
|
||||||
|
* };
|
||||||
|
* const buffer = Buffer.alloc(100);
|
||||||
|
* function writeString(input) {
|
||||||
|
* if (isStringOneByteRepresentation(input)) {
|
||||||
|
* buffer.writeUint8(Encoding.latin1);
|
||||||
|
* buffer.writeUint32LE(input.length, 1);
|
||||||
|
* buffer.write(input, 5, 'latin1');
|
||||||
|
* } else {
|
||||||
|
* buffer.writeUint8(Encoding.utf16le);
|
||||||
|
* buffer.writeUint32LE(input.length * 2, 1);
|
||||||
|
* buffer.write(input, 5, 'utf16le');
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* writeString('hello');
|
||||||
|
* writeString('你好');
|
||||||
|
* ```
|
||||||
|
* @since v23.10.0, v22.15.0
|
||||||
|
*/
|
||||||
|
function isStringOneByteRepresentation(content: string): boolean;
|
||||||
|
/**
|
||||||
|
* @since v8.0.0
|
||||||
|
*/
|
||||||
|
class Serializer {
|
||||||
|
/**
|
||||||
|
* Writes out a header, which includes the serialization format version.
|
||||||
|
*/
|
||||||
|
writeHeader(): void;
|
||||||
|
/**
|
||||||
|
* Serializes a JavaScript value and adds the serialized representation to the
|
||||||
|
* internal buffer.
|
||||||
|
*
|
||||||
|
* This throws an error if `value` cannot be serialized.
|
||||||
|
*/
|
||||||
|
writeValue(val: any): boolean;
|
||||||
|
/**
|
||||||
|
* Returns the stored internal buffer. This serializer should not be used once
|
||||||
|
* the buffer is released. Calling this method results in undefined behavior
|
||||||
|
* if a previous write has failed.
|
||||||
|
*/
|
||||||
|
releaseBuffer(): NonSharedBuffer;
|
||||||
|
/**
|
||||||
|
* Marks an `ArrayBuffer` as having its contents transferred out of band.
|
||||||
|
* Pass the corresponding `ArrayBuffer` in the deserializing context to `deserializer.transferArrayBuffer()`.
|
||||||
|
* @param id A 32-bit unsigned integer.
|
||||||
|
* @param arrayBuffer An `ArrayBuffer` instance.
|
||||||
|
*/
|
||||||
|
transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void;
|
||||||
|
/**
|
||||||
|
* Write a raw 32-bit unsigned integer.
|
||||||
|
* For use inside of a custom `serializer._writeHostObject()`.
|
||||||
|
*/
|
||||||
|
writeUint32(value: number): void;
|
||||||
|
/**
|
||||||
|
* Write a raw 64-bit unsigned integer, split into high and low 32-bit parts.
|
||||||
|
* For use inside of a custom `serializer._writeHostObject()`.
|
||||||
|
*/
|
||||||
|
writeUint64(hi: number, lo: number): void;
|
||||||
|
/**
|
||||||
|
* Write a JS `number` value.
|
||||||
|
* For use inside of a custom `serializer._writeHostObject()`.
|
||||||
|
*/
|
||||||
|
writeDouble(value: number): void;
|
||||||
|
/**
|
||||||
|
* Write raw bytes into the serializer's internal buffer. The deserializer
|
||||||
|
* will require a way to compute the length of the buffer.
|
||||||
|
* For use inside of a custom `serializer._writeHostObject()`.
|
||||||
|
*/
|
||||||
|
writeRawBytes(buffer: NodeJS.ArrayBufferView): void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A subclass of `Serializer` that serializes `TypedArray`(in particular `Buffer`) and `DataView` objects as host objects, and only
|
||||||
|
* stores the part of their underlying `ArrayBuffer`s that they are referring to.
|
||||||
|
* @since v8.0.0
|
||||||
|
*/
|
||||||
|
class DefaultSerializer extends Serializer {}
|
||||||
|
/**
|
||||||
|
* @since v8.0.0
|
||||||
|
*/
|
||||||
|
class Deserializer {
|
||||||
|
constructor(data: NodeJS.TypedArray);
|
||||||
|
/**
|
||||||
|
* Reads and validates a header (including the format version).
|
||||||
|
* May, for example, reject an invalid or unsupported wire format. In that case,
|
||||||
|
* an `Error` is thrown.
|
||||||
|
*/
|
||||||
|
readHeader(): boolean;
|
||||||
|
/**
|
||||||
|
* Deserializes a JavaScript value from the buffer and returns it.
|
||||||
|
*/
|
||||||
|
readValue(): any;
|
||||||
|
/**
|
||||||
|
* Marks an `ArrayBuffer` as having its contents transferred out of band.
|
||||||
|
* Pass the corresponding `ArrayBuffer` in the serializing context to `serializer.transferArrayBuffer()` (or return the `id` from `serializer._getSharedArrayBufferId()` in the case of
|
||||||
|
* `SharedArrayBuffer`s).
|
||||||
|
* @param id A 32-bit unsigned integer.
|
||||||
|
* @param arrayBuffer An `ArrayBuffer` instance.
|
||||||
|
*/
|
||||||
|
transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void;
|
||||||
|
/**
|
||||||
|
* Reads the underlying wire format version. Likely mostly to be useful to
|
||||||
|
* legacy code reading old wire format versions. May not be called before `.readHeader()`.
|
||||||
|
*/
|
||||||
|
getWireFormatVersion(): number;
|
||||||
|
/**
|
||||||
|
* Read a raw 32-bit unsigned integer and return it.
|
||||||
|
* For use inside of a custom `deserializer._readHostObject()`.
|
||||||
|
*/
|
||||||
|
readUint32(): number;
|
||||||
|
/**
|
||||||
|
* Read a raw 64-bit unsigned integer and return it as an array `[hi, lo]` with two 32-bit unsigned integer entries.
|
||||||
|
* For use inside of a custom `deserializer._readHostObject()`.
|
||||||
|
*/
|
||||||
|
readUint64(): [number, number];
|
||||||
|
/**
|
||||||
|
* Read a JS `number` value.
|
||||||
|
* For use inside of a custom `deserializer._readHostObject()`.
|
||||||
|
*/
|
||||||
|
readDouble(): number;
|
||||||
|
/**
|
||||||
|
* Read raw bytes from the deserializer's internal buffer. The `length` parameter
|
||||||
|
* must correspond to the length of the buffer that was passed to `serializer.writeRawBytes()`.
|
||||||
|
* For use inside of a custom `deserializer._readHostObject()`.
|
||||||
|
*/
|
||||||
|
readRawBytes(length: number): Buffer;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A subclass of `Deserializer` corresponding to the format written by `DefaultSerializer`.
|
||||||
|
* @since v8.0.0
|
||||||
|
*/
|
||||||
|
class DefaultDeserializer extends Deserializer {}
|
||||||
|
/**
|
||||||
|
* Uses a `DefaultSerializer` to serialize `value` into a buffer.
|
||||||
|
*
|
||||||
|
* `ERR_BUFFER_TOO_LARGE` will be thrown when trying to
|
||||||
|
* serialize a huge object which requires buffer
|
||||||
|
* larger than `buffer.constants.MAX_LENGTH`.
|
||||||
|
* @since v8.0.0
|
||||||
|
*/
|
||||||
|
function serialize(value: any): NonSharedBuffer;
|
||||||
|
/**
|
||||||
|
* Uses a `DefaultDeserializer` with default options to read a JS value
|
||||||
|
* from a buffer.
|
||||||
|
* @since v8.0.0
|
||||||
|
* @param buffer A buffer returned by {@link serialize}.
|
||||||
|
*/
|
||||||
|
function deserialize(buffer: NodeJS.ArrayBufferView): any;
|
||||||
|
/**
|
||||||
|
* The `v8.takeCoverage()` method allows the user to write the coverage started by `NODE_V8_COVERAGE` to disk on demand. This method can be invoked multiple
|
||||||
|
* times during the lifetime of the process. Each time the execution counter will
|
||||||
|
* be reset and a new coverage report will be written to the directory specified
|
||||||
|
* by `NODE_V8_COVERAGE`.
|
||||||
|
*
|
||||||
|
* When the process is about to exit, one last coverage will still be written to
|
||||||
|
* disk unless {@link stopCoverage} is invoked before the process exits.
|
||||||
|
* @since v15.1.0, v14.18.0, v12.22.0
|
||||||
|
*/
|
||||||
|
function takeCoverage(): void;
|
||||||
|
/**
|
||||||
|
* The `v8.stopCoverage()` method allows the user to stop the coverage collection
|
||||||
|
* started by `NODE_V8_COVERAGE`, so that V8 can release the execution count
|
||||||
|
* records and optimize code. This can be used in conjunction with {@link takeCoverage} if the user wants to collect the coverage on demand.
|
||||||
|
* @since v15.1.0, v14.18.0, v12.22.0
|
||||||
|
*/
|
||||||
|
function stopCoverage(): void;
|
||||||
|
/**
|
||||||
|
* The API is a no-op if `--heapsnapshot-near-heap-limit` is already set from the command line or the API is called more than once.
|
||||||
|
* `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--heapsnapshot-near-heap-limitmax_count) for more information.
|
||||||
|
* @since v18.10.0, v16.18.0
|
||||||
|
*/
|
||||||
|
function setHeapSnapshotNearHeapLimit(limit: number): void;
|
||||||
|
/**
|
||||||
|
* This API collects GC data in current thread.
|
||||||
|
* @since v19.6.0, v18.15.0
|
||||||
|
*/
|
||||||
|
class GCProfiler {
|
||||||
|
/**
|
||||||
|
* Start collecting GC data.
|
||||||
|
* @since v19.6.0, v18.15.0
|
||||||
|
*/
|
||||||
|
start(): void;
|
||||||
|
/**
|
||||||
|
* Stop collecting GC data and return an object. The content of object
|
||||||
|
* is as follows.
|
||||||
|
*
|
||||||
|
* ```json
|
||||||
|
* {
|
||||||
|
* "version": 1,
|
||||||
|
* "startTime": 1674059033862,
|
||||||
|
* "statistics": [
|
||||||
|
* {
|
||||||
|
* "gcType": "Scavenge",
|
||||||
|
* "beforeGC": {
|
||||||
|
* "heapStatistics": {
|
||||||
|
* "totalHeapSize": 5005312,
|
||||||
|
* "totalHeapSizeExecutable": 524288,
|
||||||
|
* "totalPhysicalSize": 5226496,
|
||||||
|
* "totalAvailableSize": 4341325216,
|
||||||
|
* "totalGlobalHandlesSize": 8192,
|
||||||
|
* "usedGlobalHandlesSize": 2112,
|
||||||
|
* "usedHeapSize": 4883840,
|
||||||
|
* "heapSizeLimit": 4345298944,
|
||||||
|
* "mallocedMemory": 254128,
|
||||||
|
* "externalMemory": 225138,
|
||||||
|
* "peakMallocedMemory": 181760
|
||||||
|
* },
|
||||||
|
* "heapSpaceStatistics": [
|
||||||
|
* {
|
||||||
|
* "spaceName": "read_only_space",
|
||||||
|
* "spaceSize": 0,
|
||||||
|
* "spaceUsedSize": 0,
|
||||||
|
* "spaceAvailableSize": 0,
|
||||||
|
* "physicalSpaceSize": 0
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* },
|
||||||
|
* "cost": 1574.14,
|
||||||
|
* "afterGC": {
|
||||||
|
* "heapStatistics": {
|
||||||
|
* "totalHeapSize": 6053888,
|
||||||
|
* "totalHeapSizeExecutable": 524288,
|
||||||
|
* "totalPhysicalSize": 5500928,
|
||||||
|
* "totalAvailableSize": 4341101384,
|
||||||
|
* "totalGlobalHandlesSize": 8192,
|
||||||
|
* "usedGlobalHandlesSize": 2112,
|
||||||
|
* "usedHeapSize": 4059096,
|
||||||
|
* "heapSizeLimit": 4345298944,
|
||||||
|
* "mallocedMemory": 254128,
|
||||||
|
* "externalMemory": 225138,
|
||||||
|
* "peakMallocedMemory": 181760
|
||||||
|
* },
|
||||||
|
* "heapSpaceStatistics": [
|
||||||
|
* {
|
||||||
|
* "spaceName": "read_only_space",
|
||||||
|
* "spaceSize": 0,
|
||||||
|
* "spaceUsedSize": 0,
|
||||||
|
* "spaceAvailableSize": 0,
|
||||||
|
* "physicalSpaceSize": 0
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ],
|
||||||
|
* "endTime": 1674059036865
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Here's an example.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { GCProfiler } from 'node:v8';
|
||||||
|
* const profiler = new GCProfiler();
|
||||||
|
* profiler.start();
|
||||||
|
* setTimeout(() => {
|
||||||
|
* console.log(profiler.stop());
|
||||||
|
* }, 1000);
|
||||||
|
* ```
|
||||||
|
* @since v19.6.0, v18.15.0
|
||||||
|
*/
|
||||||
|
stop(): GCProfilerResult;
|
||||||
|
/**
|
||||||
|
* Stop collecting GC data, and discard the profile.
|
||||||
|
* @since v25.5.0
|
||||||
|
*/
|
||||||
|
[Symbol.dispose](): void;
|
||||||
|
}
|
||||||
|
interface GCProfilerResult {
|
||||||
|
version: number;
|
||||||
|
startTime: number;
|
||||||
|
endTime: number;
|
||||||
|
statistics: Array<{
|
||||||
|
gcType: string;
|
||||||
|
cost: number;
|
||||||
|
beforeGC: {
|
||||||
|
heapStatistics: HeapStatistics;
|
||||||
|
heapSpaceStatistics: HeapSpaceStatistics[];
|
||||||
|
};
|
||||||
|
afterGC: {
|
||||||
|
heapStatistics: HeapStatistics;
|
||||||
|
heapSpaceStatistics: HeapSpaceStatistics[];
|
||||||
|
};
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
interface HeapStatistics {
|
||||||
|
totalHeapSize: number;
|
||||||
|
totalHeapSizeExecutable: number;
|
||||||
|
totalPhysicalSize: number;
|
||||||
|
totalAvailableSize: number;
|
||||||
|
totalGlobalHandlesSize: number;
|
||||||
|
usedGlobalHandlesSize: number;
|
||||||
|
usedHeapSize: number;
|
||||||
|
heapSizeLimit: number;
|
||||||
|
mallocedMemory: number;
|
||||||
|
externalMemory: number;
|
||||||
|
peakMallocedMemory: number;
|
||||||
|
}
|
||||||
|
interface HeapSpaceStatistics {
|
||||||
|
spaceName: string;
|
||||||
|
spaceSize: number;
|
||||||
|
spaceUsedSize: number;
|
||||||
|
spaceAvailableSize: number;
|
||||||
|
physicalSpaceSize: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Called when a promise is constructed. This does not mean that corresponding before/after events will occur, only that the possibility exists. This will
|
||||||
|
* happen if a promise is created without ever getting a continuation.
|
||||||
|
* @since v17.1.0, v16.14.0
|
||||||
|
* @param promise The promise being created.
|
||||||
|
* @param parent The promise continued from, if applicable.
|
||||||
|
*/
|
||||||
|
interface Init {
|
||||||
|
(promise: Promise<unknown>, parent: Promise<unknown>): void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Called before a promise continuation executes. This can be in the form of `then()`, `catch()`, or `finally()` handlers or an await resuming.
|
||||||
|
*
|
||||||
|
* The before callback will be called 0 to N times. The before callback will typically be called 0 times if no continuation was ever made for the promise.
|
||||||
|
* The before callback may be called many times in the case where many continuations have been made from the same promise.
|
||||||
|
* @since v17.1.0, v16.14.0
|
||||||
|
*/
|
||||||
|
interface Before {
|
||||||
|
(promise: Promise<unknown>): void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Called immediately after a promise continuation executes. This may be after a `then()`, `catch()`, or `finally()` handler or before an await after another await.
|
||||||
|
* @since v17.1.0, v16.14.0
|
||||||
|
*/
|
||||||
|
interface After {
|
||||||
|
(promise: Promise<unknown>): void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Called when the promise receives a resolution or rejection value. This may occur synchronously in the case of {@link Promise.resolve()} or
|
||||||
|
* {@link Promise.reject()}.
|
||||||
|
* @since v17.1.0, v16.14.0
|
||||||
|
*/
|
||||||
|
interface Settled {
|
||||||
|
(promise: Promise<unknown>): void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Key events in the lifetime of a promise have been categorized into four areas: creation of a promise, before/after a continuation handler is called or
|
||||||
|
* around an await, and when the promise resolves or rejects.
|
||||||
|
*
|
||||||
|
* Because promises are asynchronous resources whose lifecycle is tracked via the promise hooks mechanism, the `init()`, `before()`, `after()`, and
|
||||||
|
* `settled()` callbacks must not be async functions as they create more promises which would produce an infinite loop.
|
||||||
|
* @since v17.1.0, v16.14.0
|
||||||
|
*/
|
||||||
|
interface HookCallbacks {
|
||||||
|
init?: Init;
|
||||||
|
before?: Before;
|
||||||
|
after?: After;
|
||||||
|
settled?: Settled;
|
||||||
|
}
|
||||||
|
interface PromiseHooks {
|
||||||
|
/**
|
||||||
|
* The `init` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
|
||||||
|
* @since v17.1.0, v16.14.0
|
||||||
|
* @param init The {@link Init | `init` callback} to call when a promise is created.
|
||||||
|
* @return Call to stop the hook.
|
||||||
|
*/
|
||||||
|
onInit: (init: Init) => Function;
|
||||||
|
/**
|
||||||
|
* The `settled` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
|
||||||
|
* @since v17.1.0, v16.14.0
|
||||||
|
* @param settled The {@link Settled | `settled` callback} to call when a promise is created.
|
||||||
|
* @return Call to stop the hook.
|
||||||
|
*/
|
||||||
|
onSettled: (settled: Settled) => Function;
|
||||||
|
/**
|
||||||
|
* The `before` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
|
||||||
|
* @since v17.1.0, v16.14.0
|
||||||
|
* @param before The {@link Before | `before` callback} to call before a promise continuation executes.
|
||||||
|
* @return Call to stop the hook.
|
||||||
|
*/
|
||||||
|
onBefore: (before: Before) => Function;
|
||||||
|
/**
|
||||||
|
* The `after` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.
|
||||||
|
* @since v17.1.0, v16.14.0
|
||||||
|
* @param after The {@link After | `after` callback} to call after a promise continuation executes.
|
||||||
|
* @return Call to stop the hook.
|
||||||
|
*/
|
||||||
|
onAfter: (after: After) => Function;
|
||||||
|
/**
|
||||||
|
* Registers functions to be called for different lifetime events of each promise.
|
||||||
|
* The callbacks `init()`/`before()`/`after()`/`settled()` are called for the respective events during a promise's lifetime.
|
||||||
|
* All callbacks are optional. For example, if only promise creation needs to be tracked, then only the init callback needs to be passed.
|
||||||
|
* The hook callbacks must be plain functions. Providing async functions will throw as it would produce an infinite microtask loop.
|
||||||
|
* @since v17.1.0, v16.14.0
|
||||||
|
* @param callbacks The {@link HookCallbacks | Hook Callbacks} to register
|
||||||
|
* @return Used for disabling hooks
|
||||||
|
*/
|
||||||
|
createHook: (callbacks: HookCallbacks) => Function;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The `promiseHooks` interface can be used to track promise lifecycle events.
|
||||||
|
* @since v17.1.0, v16.14.0
|
||||||
|
*/
|
||||||
|
const promiseHooks: PromiseHooks;
|
||||||
|
type StartupSnapshotCallbackFn = (args: any) => any;
|
||||||
|
/**
|
||||||
|
* The `v8.startupSnapshot` interface can be used to add serialization and deserialization hooks for custom startup snapshots.
|
||||||
|
*
|
||||||
|
* ```bash
|
||||||
|
* $ node --snapshot-blob snapshot.blob --build-snapshot entry.js
|
||||||
|
* # This launches a process with the snapshot
|
||||||
|
* $ node --snapshot-blob snapshot.blob
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* In the example above, `entry.js` can use methods from the `v8.startupSnapshot` interface to specify how to save information for custom objects
|
||||||
|
* in the snapshot during serialization and how the information can be used to synchronize these objects during deserialization of the snapshot.
|
||||||
|
* For example, if the `entry.js` contains the following script:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* 'use strict';
|
||||||
|
*
|
||||||
|
* import fs from 'node:fs';
|
||||||
|
* import zlib from 'node:zlib';
|
||||||
|
* import path from 'node:path';
|
||||||
|
* import assert from 'node:assert';
|
||||||
|
*
|
||||||
|
* import v8 from 'node:v8';
|
||||||
|
*
|
||||||
|
* class BookShelf {
|
||||||
|
* storage = new Map();
|
||||||
|
*
|
||||||
|
* // Reading a series of files from directory and store them into storage.
|
||||||
|
* constructor(directory, books) {
|
||||||
|
* for (const book of books) {
|
||||||
|
* this.storage.set(book, fs.readFileSync(path.join(directory, book)));
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* static compressAll(shelf) {
|
||||||
|
* for (const [ book, content ] of shelf.storage) {
|
||||||
|
* shelf.storage.set(book, zlib.gzipSync(content));
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* static decompressAll(shelf) {
|
||||||
|
* for (const [ book, content ] of shelf.storage) {
|
||||||
|
* shelf.storage.set(book, zlib.gunzipSync(content));
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // __dirname here is where the snapshot script is placed
|
||||||
|
* // during snapshot building time.
|
||||||
|
* const shelf = new BookShelf(__dirname, [
|
||||||
|
* 'book1.en_US.txt',
|
||||||
|
* 'book1.es_ES.txt',
|
||||||
|
* 'book2.zh_CN.txt',
|
||||||
|
* ]);
|
||||||
|
*
|
||||||
|
* assert(v8.startupSnapshot.isBuildingSnapshot());
|
||||||
|
* // On snapshot serialization, compress the books to reduce size.
|
||||||
|
* v8.startupSnapshot.addSerializeCallback(BookShelf.compressAll, shelf);
|
||||||
|
* // On snapshot deserialization, decompress the books.
|
||||||
|
* v8.startupSnapshot.addDeserializeCallback(BookShelf.decompressAll, shelf);
|
||||||
|
* v8.startupSnapshot.setDeserializeMainFunction((shelf) => {
|
||||||
|
* // process.env and process.argv are refreshed during snapshot
|
||||||
|
* // deserialization.
|
||||||
|
* const lang = process.env.BOOK_LANG || 'en_US';
|
||||||
|
* const book = process.argv[1];
|
||||||
|
* const name = `${book}.${lang}.txt`;
|
||||||
|
* console.log(shelf.storage.get(name));
|
||||||
|
* }, shelf);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The resulted binary will get print the data deserialized from the snapshot during start up, using the refreshed `process.env` and `process.argv` of the launched process:
|
||||||
|
*
|
||||||
|
* ```bash
|
||||||
|
* $ BOOK_LANG=es_ES node --snapshot-blob snapshot.blob book1
|
||||||
|
* # Prints content of book1.es_ES.txt deserialized from the snapshot.
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Currently the application deserialized from a user-land snapshot cannot be snapshotted again, so these APIs are only available to applications that are not deserialized from a user-land snapshot.
|
||||||
|
*
|
||||||
|
* @since v18.6.0, v16.17.0
|
||||||
|
*/
|
||||||
|
namespace startupSnapshot {
|
||||||
|
/**
|
||||||
|
* Add a callback that will be called when the Node.js instance is about to get serialized into a snapshot and exit.
|
||||||
|
* This can be used to release resources that should not or cannot be serialized or to convert user data into a form more suitable for serialization.
|
||||||
|
* @since v18.6.0, v16.17.0
|
||||||
|
*/
|
||||||
|
function addSerializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void;
|
||||||
|
/**
|
||||||
|
* Add a callback that will be called when the Node.js instance is deserialized from a snapshot.
|
||||||
|
* The `callback` and the `data` (if provided) will be serialized into the snapshot, they can be used to re-initialize the state of the application or
|
||||||
|
* to re-acquire resources that the application needs when the application is restarted from the snapshot.
|
||||||
|
* @since v18.6.0, v16.17.0
|
||||||
|
*/
|
||||||
|
function addDeserializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void;
|
||||||
|
/**
|
||||||
|
* This sets the entry point of the Node.js application when it is deserialized from a snapshot. This can be called only once in the snapshot building script.
|
||||||
|
* If called, the deserialized application no longer needs an additional entry point script to start up and will simply invoke the callback along with the deserialized
|
||||||
|
* data (if provided), otherwise an entry point script still needs to be provided to the deserialized application.
|
||||||
|
* @since v18.6.0, v16.17.0
|
||||||
|
*/
|
||||||
|
function setDeserializeMainFunction(callback: StartupSnapshotCallbackFn, data?: any): void;
|
||||||
|
/**
|
||||||
|
* Returns true if the Node.js instance is run to build a snapshot.
|
||||||
|
* @since v18.6.0, v16.17.0
|
||||||
|
*/
|
||||||
|
function isBuildingSnapshot(): boolean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module "v8" {
|
||||||
|
export * from "node:v8";
|
||||||
|
}
|
||||||
1208
node_modules/@types/node/vm.d.ts
generated
vendored
Normal file
1208
node_modules/@types/node/vm.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
202
node_modules/@types/node/wasi.d.ts
generated
vendored
Normal file
202
node_modules/@types/node/wasi.d.ts
generated
vendored
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
/**
|
||||||
|
* **The `node:wasi` module does not currently provide the**
|
||||||
|
* **comprehensive file system security properties provided by some WASI runtimes.**
|
||||||
|
* **Full support for secure file system sandboxing may or may not be implemented in**
|
||||||
|
* **future. In the mean time, do not rely on it to run untrusted code.**
|
||||||
|
*
|
||||||
|
* The WASI API provides an implementation of the [WebAssembly System Interface](https://wasi.dev/) specification. WASI gives WebAssembly applications access to the underlying
|
||||||
|
* operating system via a collection of POSIX-like functions.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { readFile } from 'node:fs/promises';
|
||||||
|
* import { WASI } from 'node:wasi';
|
||||||
|
* import { argv, env } from 'node:process';
|
||||||
|
*
|
||||||
|
* const wasi = new WASI({
|
||||||
|
* version: 'preview1',
|
||||||
|
* args: argv,
|
||||||
|
* env,
|
||||||
|
* preopens: {
|
||||||
|
* '/local': '/some/real/path/that/wasm/can/access',
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* const wasm = await WebAssembly.compile(
|
||||||
|
* await readFile(new URL('./demo.wasm', import.meta.url)),
|
||||||
|
* );
|
||||||
|
* const instance = await WebAssembly.instantiate(wasm, wasi.getImportObject());
|
||||||
|
*
|
||||||
|
* wasi.start(instance);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To run the above example, create a new WebAssembly text format file named `demo.wat`:
|
||||||
|
*
|
||||||
|
* ```text
|
||||||
|
* (module
|
||||||
|
* ;; Import the required fd_write WASI function which will write the given io vectors to stdout
|
||||||
|
* ;; The function signature for fd_write is:
|
||||||
|
* ;; (File Descriptor, *iovs, iovs_len, nwritten) -> Returns number of bytes written
|
||||||
|
* (import "wasi_snapshot_preview1" "fd_write" (func $fd_write (param i32 i32 i32 i32) (result i32)))
|
||||||
|
*
|
||||||
|
* (memory 1)
|
||||||
|
* (export "memory" (memory 0))
|
||||||
|
*
|
||||||
|
* ;; Write 'hello world\n' to memory at an offset of 8 bytes
|
||||||
|
* ;; Note the trailing newline which is required for the text to appear
|
||||||
|
* (data (i32.const 8) "hello world\n")
|
||||||
|
*
|
||||||
|
* (func $main (export "_start")
|
||||||
|
* ;; Creating a new io vector within linear memory
|
||||||
|
* (i32.store (i32.const 0) (i32.const 8)) ;; iov.iov_base - This is a pointer to the start of the 'hello world\n' string
|
||||||
|
* (i32.store (i32.const 4) (i32.const 12)) ;; iov.iov_len - The length of the 'hello world\n' string
|
||||||
|
*
|
||||||
|
* (call $fd_write
|
||||||
|
* (i32.const 1) ;; file_descriptor - 1 for stdout
|
||||||
|
* (i32.const 0) ;; *iovs - The pointer to the iov array, which is stored at memory location 0
|
||||||
|
* (i32.const 1) ;; iovs_len - We're printing 1 string stored in an iov - so one.
|
||||||
|
* (i32.const 20) ;; nwritten - A place in memory to store the number of bytes written
|
||||||
|
* )
|
||||||
|
* drop ;; Discard the number of bytes written from the top of the stack
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Use [wabt](https://github.com/WebAssembly/wabt) to compile `.wat` to `.wasm`
|
||||||
|
*
|
||||||
|
* ```bash
|
||||||
|
* wat2wasm demo.wat
|
||||||
|
* ```
|
||||||
|
* @experimental
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/wasi.js)
|
||||||
|
*/
|
||||||
|
declare module "node:wasi" {
|
||||||
|
interface WASIOptions {
|
||||||
|
/**
|
||||||
|
* An array of strings that the WebAssembly application will
|
||||||
|
* see as command line arguments. The first argument is the virtual path to the
|
||||||
|
* WASI command itself.
|
||||||
|
* @default []
|
||||||
|
*/
|
||||||
|
args?: readonly string[] | undefined;
|
||||||
|
/**
|
||||||
|
* An object similar to `process.env` that the WebAssembly
|
||||||
|
* application will see as its environment.
|
||||||
|
* @default {}
|
||||||
|
*/
|
||||||
|
env?: object | undefined;
|
||||||
|
/**
|
||||||
|
* This object represents the WebAssembly application's
|
||||||
|
* sandbox directory structure. The string keys of `preopens` are treated as
|
||||||
|
* directories within the sandbox. The corresponding values in `preopens` are
|
||||||
|
* the real paths to those directories on the host machine.
|
||||||
|
*/
|
||||||
|
preopens?: NodeJS.Dict<string> | undefined;
|
||||||
|
/**
|
||||||
|
* By default, when WASI applications call `__wasi_proc_exit()`
|
||||||
|
* `wasi.start()` will return with the exit code specified rather than terminatng the process.
|
||||||
|
* Setting this option to `false` will cause the Node.js process to exit with
|
||||||
|
* the specified exit code instead.
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
|
returnOnExit?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* The file descriptor used as standard input in the WebAssembly application.
|
||||||
|
* @default 0
|
||||||
|
*/
|
||||||
|
stdin?: number | undefined;
|
||||||
|
/**
|
||||||
|
* The file descriptor used as standard output in the WebAssembly application.
|
||||||
|
* @default 1
|
||||||
|
*/
|
||||||
|
stdout?: number | undefined;
|
||||||
|
/**
|
||||||
|
* The file descriptor used as standard error in the WebAssembly application.
|
||||||
|
* @default 2
|
||||||
|
*/
|
||||||
|
stderr?: number | undefined;
|
||||||
|
/**
|
||||||
|
* The version of WASI requested.
|
||||||
|
* Currently the only supported versions are `'unstable'` and `'preview1'`. This option is mandatory.
|
||||||
|
* @since v19.8.0
|
||||||
|
*/
|
||||||
|
version: "unstable" | "preview1";
|
||||||
|
}
|
||||||
|
interface FinalizeBindingsOptions {
|
||||||
|
/**
|
||||||
|
* @default instance.exports.memory
|
||||||
|
*/
|
||||||
|
memory?: object | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The `WASI` class provides the WASI system call API and additional convenience
|
||||||
|
* methods for working with WASI-based applications. Each `WASI` instance
|
||||||
|
* represents a distinct environment.
|
||||||
|
* @since v13.3.0, v12.16.0
|
||||||
|
*/
|
||||||
|
class WASI {
|
||||||
|
constructor(options?: WASIOptions);
|
||||||
|
/**
|
||||||
|
* Return an import object that can be passed to `WebAssembly.instantiate()` if no other WASM imports are needed beyond those provided by WASI.
|
||||||
|
*
|
||||||
|
* If version `unstable` was passed into the constructor it will return:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* { wasi_unstable: wasi.wasiImport }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If version `preview1` was passed into the constructor or no version was specified it will return:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* { wasi_snapshot_preview1: wasi.wasiImport }
|
||||||
|
* ```
|
||||||
|
* @since v19.8.0
|
||||||
|
*/
|
||||||
|
getImportObject(): object;
|
||||||
|
/**
|
||||||
|
* Attempt to begin execution of `instance` as a WASI command by invoking its `_start()` export. If `instance` does not contain a `_start()` export, or if `instance` contains an `_initialize()`
|
||||||
|
* export, then an exception is thrown.
|
||||||
|
*
|
||||||
|
* `start()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named `memory`. If
|
||||||
|
* `instance` does not have a `memory` export an exception is thrown.
|
||||||
|
*
|
||||||
|
* If `start()` is called more than once, an exception is thrown.
|
||||||
|
* @since v13.3.0, v12.16.0
|
||||||
|
*/
|
||||||
|
start(instance: object): number; // TODO: avoid DOM dependency until WASM moved to own lib.
|
||||||
|
/**
|
||||||
|
* Attempt to initialize `instance` as a WASI reactor by invoking its `_initialize()` export, if it is present. If `instance` contains a `_start()` export, then an exception is thrown.
|
||||||
|
*
|
||||||
|
* `initialize()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named `memory`.
|
||||||
|
* If `instance` does not have a `memory` export an exception is thrown.
|
||||||
|
*
|
||||||
|
* If `initialize()` is called more than once, an exception is thrown.
|
||||||
|
* @since v14.6.0, v12.19.0
|
||||||
|
*/
|
||||||
|
initialize(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
|
||||||
|
/**
|
||||||
|
* Set up WASI host bindings to `instance` without calling `initialize()`
|
||||||
|
* or `start()`. This method is useful when the WASI module is instantiated in
|
||||||
|
* child threads for sharing the memory across threads.
|
||||||
|
*
|
||||||
|
* `finalizeBindings()` requires that either `instance` exports a
|
||||||
|
* [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named `memory` or user specify a
|
||||||
|
* [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) object in `options.memory`. If the `memory` is invalid
|
||||||
|
* an exception is thrown.
|
||||||
|
*
|
||||||
|
* `start()` and `initialize()` will call `finalizeBindings()` internally.
|
||||||
|
* If `finalizeBindings()` is called more than once, an exception is thrown.
|
||||||
|
* @since v24.4.0
|
||||||
|
*/
|
||||||
|
finalizeBindings(instance: object, options?: FinalizeBindingsOptions): void;
|
||||||
|
/**
|
||||||
|
* `wasiImport` is an object that implements the WASI system call API. This object
|
||||||
|
* should be passed as the `wasi_snapshot_preview1` import during the instantiation
|
||||||
|
* of a [`WebAssembly.Instance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance).
|
||||||
|
* @since v13.3.0, v12.16.0
|
||||||
|
*/
|
||||||
|
readonly wasiImport: NodeJS.Dict<any>; // TODO: Narrow to DOM types
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module "wasi" {
|
||||||
|
export * from "node:wasi";
|
||||||
|
}
|
||||||
59
node_modules/@types/node/web-globals/abortcontroller.d.ts
generated
vendored
Normal file
59
node_modules/@types/node/web-globals/abortcontroller.d.ts
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
import { InternalEventTargetEventProperties } from "node:events";
|
||||||
|
|
||||||
|
type _AbortController = typeof globalThis extends { onmessage: any } ? {} : AbortController;
|
||||||
|
interface AbortController {
|
||||||
|
readonly signal: AbortSignal;
|
||||||
|
abort(reason?: any): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AbortSignalEventMap {
|
||||||
|
"abort": Event;
|
||||||
|
}
|
||||||
|
|
||||||
|
type _AbortSignal = typeof globalThis extends { onmessage: any } ? {} : AbortSignal;
|
||||||
|
interface AbortSignal extends EventTarget, InternalEventTargetEventProperties<AbortSignalEventMap> {
|
||||||
|
readonly aborted: boolean;
|
||||||
|
readonly reason: any;
|
||||||
|
throwIfAborted(): void;
|
||||||
|
addEventListener<K extends keyof AbortSignalEventMap>(
|
||||||
|
type: K,
|
||||||
|
listener: (ev: AbortSignalEventMap[K]) => void,
|
||||||
|
options?: AddEventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
addEventListener(
|
||||||
|
type: string,
|
||||||
|
listener: EventListener | EventListenerObject,
|
||||||
|
options?: AddEventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
removeEventListener<K extends keyof AbortSignalEventMap>(
|
||||||
|
type: K,
|
||||||
|
listener: (ev: AbortSignalEventMap[K]) => void,
|
||||||
|
options?: EventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
removeEventListener(
|
||||||
|
type: string,
|
||||||
|
listener: EventListener | EventListenerObject,
|
||||||
|
options?: EventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface AbortController extends _AbortController {}
|
||||||
|
var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
|
||||||
|
: {
|
||||||
|
prototype: AbortController;
|
||||||
|
new(): AbortController;
|
||||||
|
};
|
||||||
|
|
||||||
|
interface AbortSignal extends _AbortSignal {}
|
||||||
|
var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
|
||||||
|
: {
|
||||||
|
prototype: AbortSignal;
|
||||||
|
new(): AbortSignal;
|
||||||
|
abort(reason?: any): AbortSignal;
|
||||||
|
any(signals: AbortSignal[]): AbortSignal;
|
||||||
|
timeout(milliseconds: number): AbortSignal;
|
||||||
|
};
|
||||||
|
}
|
||||||
23
node_modules/@types/node/web-globals/blob.d.ts
generated
vendored
Normal file
23
node_modules/@types/node/web-globals/blob.d.ts
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
import * as buffer from "node:buffer";
|
||||||
|
|
||||||
|
type _Blob = typeof globalThis extends { onmessage: any } ? {} : buffer.Blob;
|
||||||
|
type _BlobPropertyBag = typeof globalThis extends { onmessage: any } ? {} : buffer.BlobPropertyBag;
|
||||||
|
type _File = typeof globalThis extends { onmessage: any } ? {} : buffer.File;
|
||||||
|
type _FilePropertyBag = typeof globalThis extends { onmessage: any } ? {} : buffer.FilePropertyBag;
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Blob extends _Blob {}
|
||||||
|
var Blob: typeof globalThis extends { onmessage: any; Blob: infer T } ? T : typeof buffer.Blob;
|
||||||
|
|
||||||
|
interface BlobPropertyBag extends _BlobPropertyBag {}
|
||||||
|
|
||||||
|
interface File extends _File {}
|
||||||
|
var File: typeof globalThis extends { onmessage: any; File: infer T } ? T : typeof buffer.File;
|
||||||
|
|
||||||
|
interface FilePropertyBag extends _FilePropertyBag {}
|
||||||
|
|
||||||
|
function atob(data: string): string;
|
||||||
|
function btoa(data: string): string;
|
||||||
|
}
|
||||||
9
node_modules/@types/node/web-globals/console.d.ts
generated
vendored
Normal file
9
node_modules/@types/node/web-globals/console.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
import * as console from "node:console";
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Console extends console.Console {}
|
||||||
|
|
||||||
|
var console: Console;
|
||||||
|
}
|
||||||
39
node_modules/@types/node/web-globals/crypto.d.ts
generated
vendored
Normal file
39
node_modules/@types/node/web-globals/crypto.d.ts
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
import { webcrypto } from "crypto";
|
||||||
|
|
||||||
|
type _Crypto = typeof globalThis extends { onmessage: any } ? {} : webcrypto.Crypto;
|
||||||
|
type _CryptoKey = typeof globalThis extends { onmessage: any } ? {} : webcrypto.CryptoKey;
|
||||||
|
type _SubtleCrypto = typeof globalThis extends { onmessage: any } ? {} : webcrypto.SubtleCrypto;
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Crypto extends _Crypto {}
|
||||||
|
var Crypto: typeof globalThis extends { onmessage: any; Crypto: infer T } ? T : {
|
||||||
|
prototype: webcrypto.Crypto;
|
||||||
|
new(): webcrypto.Crypto;
|
||||||
|
};
|
||||||
|
|
||||||
|
interface CryptoKey extends _CryptoKey {}
|
||||||
|
var CryptoKey: typeof globalThis extends { onmessage: any; CryptoKey: infer T } ? T : {
|
||||||
|
prototype: webcrypto.CryptoKey;
|
||||||
|
new(): webcrypto.CryptoKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
interface SubtleCrypto extends _SubtleCrypto {}
|
||||||
|
var SubtleCrypto: typeof globalThis extends { onmessage: any; SubtleCrypto: infer T } ? T : {
|
||||||
|
prototype: webcrypto.SubtleCrypto;
|
||||||
|
new(): webcrypto.SubtleCrypto;
|
||||||
|
supports(
|
||||||
|
operation: string,
|
||||||
|
algorithm: webcrypto.AlgorithmIdentifier,
|
||||||
|
length?: number,
|
||||||
|
): boolean;
|
||||||
|
supports(
|
||||||
|
operation: string,
|
||||||
|
algorithm: webcrypto.AlgorithmIdentifier,
|
||||||
|
additionalAlgorithm: webcrypto.AlgorithmIdentifier,
|
||||||
|
): boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
var crypto: typeof globalThis extends { onmessage: any; crypto: infer T } ? T : webcrypto.Crypto;
|
||||||
|
}
|
||||||
68
node_modules/@types/node/web-globals/domexception.d.ts
generated
vendored
Normal file
68
node_modules/@types/node/web-globals/domexception.d.ts
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
type _DOMException = typeof globalThis extends { onmessage: any } ? {} : DOMException;
|
||||||
|
interface DOMException extends Error {
|
||||||
|
readonly code: number;
|
||||||
|
readonly message: string;
|
||||||
|
readonly name: string;
|
||||||
|
readonly INDEX_SIZE_ERR: 1;
|
||||||
|
readonly DOMSTRING_SIZE_ERR: 2;
|
||||||
|
readonly HIERARCHY_REQUEST_ERR: 3;
|
||||||
|
readonly WRONG_DOCUMENT_ERR: 4;
|
||||||
|
readonly INVALID_CHARACTER_ERR: 5;
|
||||||
|
readonly NO_DATA_ALLOWED_ERR: 6;
|
||||||
|
readonly NO_MODIFICATION_ALLOWED_ERR: 7;
|
||||||
|
readonly NOT_FOUND_ERR: 8;
|
||||||
|
readonly NOT_SUPPORTED_ERR: 9;
|
||||||
|
readonly INUSE_ATTRIBUTE_ERR: 10;
|
||||||
|
readonly INVALID_STATE_ERR: 11;
|
||||||
|
readonly SYNTAX_ERR: 12;
|
||||||
|
readonly INVALID_MODIFICATION_ERR: 13;
|
||||||
|
readonly NAMESPACE_ERR: 14;
|
||||||
|
readonly INVALID_ACCESS_ERR: 15;
|
||||||
|
readonly VALIDATION_ERR: 16;
|
||||||
|
readonly TYPE_MISMATCH_ERR: 17;
|
||||||
|
readonly SECURITY_ERR: 18;
|
||||||
|
readonly NETWORK_ERR: 19;
|
||||||
|
readonly ABORT_ERR: 20;
|
||||||
|
readonly URL_MISMATCH_ERR: 21;
|
||||||
|
readonly QUOTA_EXCEEDED_ERR: 22;
|
||||||
|
readonly TIMEOUT_ERR: 23;
|
||||||
|
readonly INVALID_NODE_TYPE_ERR: 24;
|
||||||
|
readonly DATA_CLONE_ERR: 25;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface DOMException extends _DOMException {}
|
||||||
|
var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
|
||||||
|
: {
|
||||||
|
prototype: DOMException;
|
||||||
|
new(message?: string, name?: string): DOMException;
|
||||||
|
new(message?: string, options?: { name?: string; cause?: unknown }): DOMException;
|
||||||
|
readonly INDEX_SIZE_ERR: 1;
|
||||||
|
readonly DOMSTRING_SIZE_ERR: 2;
|
||||||
|
readonly HIERARCHY_REQUEST_ERR: 3;
|
||||||
|
readonly WRONG_DOCUMENT_ERR: 4;
|
||||||
|
readonly INVALID_CHARACTER_ERR: 5;
|
||||||
|
readonly NO_DATA_ALLOWED_ERR: 6;
|
||||||
|
readonly NO_MODIFICATION_ALLOWED_ERR: 7;
|
||||||
|
readonly NOT_FOUND_ERR: 8;
|
||||||
|
readonly NOT_SUPPORTED_ERR: 9;
|
||||||
|
readonly INUSE_ATTRIBUTE_ERR: 10;
|
||||||
|
readonly INVALID_STATE_ERR: 11;
|
||||||
|
readonly SYNTAX_ERR: 12;
|
||||||
|
readonly INVALID_MODIFICATION_ERR: 13;
|
||||||
|
readonly NAMESPACE_ERR: 14;
|
||||||
|
readonly INVALID_ACCESS_ERR: 15;
|
||||||
|
readonly VALIDATION_ERR: 16;
|
||||||
|
readonly TYPE_MISMATCH_ERR: 17;
|
||||||
|
readonly SECURITY_ERR: 18;
|
||||||
|
readonly NETWORK_ERR: 19;
|
||||||
|
readonly ABORT_ERR: 20;
|
||||||
|
readonly URL_MISMATCH_ERR: 21;
|
||||||
|
readonly QUOTA_EXCEEDED_ERR: 22;
|
||||||
|
readonly TIMEOUT_ERR: 23;
|
||||||
|
readonly INVALID_NODE_TYPE_ERR: 24;
|
||||||
|
readonly DATA_CLONE_ERR: 25;
|
||||||
|
};
|
||||||
|
}
|
||||||
11
node_modules/@types/node/web-globals/encoding.d.ts
generated
vendored
Normal file
11
node_modules/@types/node/web-globals/encoding.d.ts
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
import * as util from "node:util";
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface TextDecoder extends util.TextDecoder {}
|
||||||
|
var TextDecoder: typeof globalThis extends { onmessage: any; TextDecoder: infer T } ? T : typeof util.TextDecoder;
|
||||||
|
|
||||||
|
interface TextEncoder extends util.TextEncoder {}
|
||||||
|
var TextEncoder: typeof globalThis extends { onmessage: any; TextEncoder: infer T } ? T : typeof util.TextEncoder;
|
||||||
|
}
|
||||||
106
node_modules/@types/node/web-globals/events.d.ts
generated
vendored
Normal file
106
node_modules/@types/node/web-globals/events.d.ts
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
type _AddEventListenerOptions = typeof globalThis extends { onmessage: any } ? {} : AddEventListenerOptions;
|
||||||
|
interface AddEventListenerOptions extends EventListenerOptions {
|
||||||
|
once?: boolean;
|
||||||
|
passive?: boolean;
|
||||||
|
signal?: AbortSignal;
|
||||||
|
}
|
||||||
|
|
||||||
|
type _CustomEvent<T = any> = typeof globalThis extends { onmessage: any } ? {} : CustomEvent<T>;
|
||||||
|
interface CustomEvent<T = any> extends Event {
|
||||||
|
readonly detail: T;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CustomEventInit<T = any> extends EventInit {
|
||||||
|
detail?: T;
|
||||||
|
}
|
||||||
|
|
||||||
|
type _Event = typeof globalThis extends { onmessage: any } ? {} : Event;
|
||||||
|
interface Event {
|
||||||
|
readonly bubbles: boolean;
|
||||||
|
cancelBubble: boolean;
|
||||||
|
readonly cancelable: boolean;
|
||||||
|
readonly composed: boolean;
|
||||||
|
readonly currentTarget: EventTarget | null;
|
||||||
|
readonly defaultPrevented: boolean;
|
||||||
|
readonly eventPhase: 0 | 2;
|
||||||
|
readonly isTrusted: boolean;
|
||||||
|
returnValue: boolean;
|
||||||
|
readonly srcElement: EventTarget | null;
|
||||||
|
readonly target: EventTarget | null;
|
||||||
|
readonly timeStamp: number;
|
||||||
|
readonly type: string;
|
||||||
|
composedPath(): [EventTarget?];
|
||||||
|
initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
|
||||||
|
preventDefault(): void;
|
||||||
|
stopImmediatePropagation(): void;
|
||||||
|
stopPropagation(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EventInit {
|
||||||
|
bubbles?: boolean;
|
||||||
|
cancelable?: boolean;
|
||||||
|
composed?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
type _EventListener = typeof globalThis extends { onmessage: any } ? {} : EventListener;
|
||||||
|
interface EventListener {
|
||||||
|
(evt: Event): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
type _EventListenerObject = typeof globalThis extends { onmessage: any } ? {} : EventListenerObject;
|
||||||
|
interface EventListenerObject {
|
||||||
|
handleEvent(object: Event): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
type _EventListenerOptions = typeof globalThis extends { onmessage: any } ? {} : EventListenerOptions;
|
||||||
|
interface EventListenerOptions {
|
||||||
|
capture?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
type _EventTarget = typeof globalThis extends { onmessage: any } ? {} : EventTarget;
|
||||||
|
interface EventTarget {
|
||||||
|
addEventListener(
|
||||||
|
type: string,
|
||||||
|
listener: EventListener | EventListenerObject,
|
||||||
|
options?: AddEventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
dispatchEvent(event: Event): boolean;
|
||||||
|
removeEventListener(
|
||||||
|
type: string,
|
||||||
|
listener: EventListener | EventListenerObject,
|
||||||
|
options?: EventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface AddEventListenerOptions extends _AddEventListenerOptions {}
|
||||||
|
|
||||||
|
interface CustomEvent<T = any> extends _CustomEvent<T> {}
|
||||||
|
var CustomEvent: typeof globalThis extends { onmessage: any; CustomEvent: infer T } ? T
|
||||||
|
: {
|
||||||
|
prototype: CustomEvent;
|
||||||
|
new<T>(type: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
|
||||||
|
};
|
||||||
|
|
||||||
|
interface Event extends _Event {}
|
||||||
|
var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
|
||||||
|
: {
|
||||||
|
prototype: Event;
|
||||||
|
new(type: string, eventInitDict?: EventInit): Event;
|
||||||
|
};
|
||||||
|
|
||||||
|
interface EventListener extends _EventListener {}
|
||||||
|
|
||||||
|
interface EventListenerObject extends _EventListenerObject {}
|
||||||
|
|
||||||
|
interface EventListenerOptions extends _EventListenerOptions {}
|
||||||
|
|
||||||
|
interface EventTarget extends _EventTarget {}
|
||||||
|
var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
|
||||||
|
: {
|
||||||
|
prototype: EventTarget;
|
||||||
|
new(): EventTarget;
|
||||||
|
};
|
||||||
|
}
|
||||||
69
node_modules/@types/node/web-globals/fetch.d.ts
generated
vendored
Normal file
69
node_modules/@types/node/web-globals/fetch.d.ts
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
import * as undici from "undici-types";
|
||||||
|
|
||||||
|
type _CloseEvent = typeof globalThis extends { onmessage: any } ? {} : undici.CloseEvent;
|
||||||
|
type _CloseEventInit = typeof globalThis extends { onmessage: any } ? {} : undici.CloseEventInit;
|
||||||
|
type _ErrorEvent = typeof globalThis extends { onmessage: any } ? {} : undici.ErrorEvent;
|
||||||
|
type _ErrorEventInit = typeof globalThis extends { onmessage: any } ? {} : undici.ErrorEventInit;
|
||||||
|
type _EventSource = typeof globalThis extends { onmessage: any } ? {} : undici.EventSource;
|
||||||
|
type _EventSourceInit = typeof globalThis extends { onmessage: any } ? {} : undici.EventSourceInit;
|
||||||
|
type _FormData = typeof globalThis extends { onmessage: any } ? {} : undici.FormData;
|
||||||
|
type _Headers = typeof globalThis extends { onmessage: any } ? {} : undici.Headers;
|
||||||
|
type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : undici.MessageEvent;
|
||||||
|
type _MessageEventInit = typeof globalThis extends { onmessage: any } ? {} : undici.MessageEventInit;
|
||||||
|
type _Request = typeof globalThis extends { onmessage: any } ? {} : undici.Request;
|
||||||
|
type _RequestInit = typeof globalThis extends { onmessage: any } ? {} : undici.RequestInit;
|
||||||
|
type _Response = typeof globalThis extends { onmessage: any } ? {} : undici.Response;
|
||||||
|
type _ResponseInit = typeof globalThis extends { onmessage: any } ? {} : undici.ResponseInit;
|
||||||
|
type _WebSocket = typeof globalThis extends { onmessage: any } ? {} : undici.WebSocket;
|
||||||
|
type _WebSocketInit = typeof globalThis extends { onmessage: any } ? {} : undici.WebSocketInit;
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
function fetch(
|
||||||
|
input: string | URL | Request,
|
||||||
|
init?: RequestInit,
|
||||||
|
): Promise<Response>;
|
||||||
|
|
||||||
|
interface CloseEvent extends _CloseEvent {}
|
||||||
|
var CloseEvent: typeof globalThis extends { onmessage: any; CloseEvent: infer T } ? T : typeof undici.CloseEvent;
|
||||||
|
|
||||||
|
interface CloseEventInit extends _CloseEventInit {}
|
||||||
|
|
||||||
|
interface ErrorEvent extends _ErrorEvent {}
|
||||||
|
var ErrorEvent: typeof globalThis extends { onmessage: any; ErrorEvent: infer T } ? T : typeof undici.ErrorEvent;
|
||||||
|
|
||||||
|
interface ErrorEventInit extends _ErrorEventInit {}
|
||||||
|
|
||||||
|
interface EventSource extends _EventSource {}
|
||||||
|
var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T : typeof undici.EventSource;
|
||||||
|
|
||||||
|
interface EventSourceInit extends _EventSourceInit {}
|
||||||
|
|
||||||
|
interface FormData extends _FormData {}
|
||||||
|
var FormData: typeof globalThis extends { onmessage: any; FormData: infer T } ? T : typeof undici.FormData;
|
||||||
|
|
||||||
|
interface Headers extends _Headers {}
|
||||||
|
var Headers: typeof globalThis extends { onmessage: any; Headers: infer T } ? T : typeof undici.Headers;
|
||||||
|
|
||||||
|
interface MessageEvent extends _MessageEvent {}
|
||||||
|
var MessageEvent: typeof globalThis extends { onmessage: any; MessageEvent: infer T } ? T
|
||||||
|
: typeof undici.MessageEvent;
|
||||||
|
|
||||||
|
interface MessageEventInit extends _MessageEventInit {}
|
||||||
|
|
||||||
|
interface Request extends _Request {}
|
||||||
|
var Request: typeof globalThis extends { onmessage: any; Request: infer T } ? T : typeof undici.Request;
|
||||||
|
|
||||||
|
interface RequestInit extends _RequestInit {}
|
||||||
|
|
||||||
|
interface Response extends _Response {}
|
||||||
|
var Response: typeof globalThis extends { onmessage: any; Response: infer T } ? T : typeof undici.Response;
|
||||||
|
|
||||||
|
interface ResponseInit extends _ResponseInit {}
|
||||||
|
|
||||||
|
interface WebSocket extends _WebSocket {}
|
||||||
|
var WebSocket: typeof globalThis extends { onmessage: any; WebSocket: infer T } ? T : typeof undici.WebSocket;
|
||||||
|
|
||||||
|
interface WebSocketInit extends _WebSocketInit {}
|
||||||
|
}
|
||||||
13
node_modules/@types/node/web-globals/importmeta.d.ts
generated
vendored
Normal file
13
node_modules/@types/node/web-globals/importmeta.d.ts
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
import { URL } from "node:url";
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface ImportMeta {
|
||||||
|
dirname: string;
|
||||||
|
filename: string;
|
||||||
|
main: boolean;
|
||||||
|
url: string;
|
||||||
|
resolve(specifier: string, parent?: string | URL): string;
|
||||||
|
}
|
||||||
|
}
|
||||||
23
node_modules/@types/node/web-globals/messaging.d.ts
generated
vendored
Normal file
23
node_modules/@types/node/web-globals/messaging.d.ts
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
import * as worker_threads from "node:worker_threads";
|
||||||
|
|
||||||
|
type _BroadcastChannel = typeof globalThis extends { onmessage: any } ? {} : worker_threads.BroadcastChannel;
|
||||||
|
type _MessageChannel = typeof globalThis extends { onmessage: any } ? {} : worker_threads.MessageChannel;
|
||||||
|
type _MessagePort = typeof globalThis extends { onmessage: any } ? {} : worker_threads.MessagePort;
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
function structuredClone<T = any>(value: T, options?: worker_threads.StructuredSerializeOptions): T;
|
||||||
|
|
||||||
|
interface BroadcastChannel extends _BroadcastChannel {}
|
||||||
|
var BroadcastChannel: typeof globalThis extends { onmessage: any; BroadcastChannel: infer T } ? T
|
||||||
|
: typeof worker_threads.BroadcastChannel;
|
||||||
|
|
||||||
|
interface MessageChannel extends _MessageChannel {}
|
||||||
|
var MessageChannel: typeof globalThis extends { onmessage: any; MessageChannel: infer T } ? T
|
||||||
|
: typeof worker_threads.MessageChannel;
|
||||||
|
|
||||||
|
interface MessagePort extends _MessagePort {}
|
||||||
|
var MessagePort: typeof globalThis extends { onmessage: any; MessagePort: infer T } ? T
|
||||||
|
: typeof worker_threads.MessagePort;
|
||||||
|
}
|
||||||
25
node_modules/@types/node/web-globals/navigator.d.ts
generated
vendored
Normal file
25
node_modules/@types/node/web-globals/navigator.d.ts
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
import { LockManager } from "worker_threads";
|
||||||
|
|
||||||
|
// lib.webworker has `WorkerNavigator` rather than `Navigator`, so conditionals use `onabort` instead of `onmessage`
|
||||||
|
type _Navigator = typeof globalThis extends { onabort: any } ? {} : Navigator;
|
||||||
|
interface Navigator {
|
||||||
|
readonly hardwareConcurrency: number;
|
||||||
|
readonly language: string;
|
||||||
|
readonly languages: readonly string[];
|
||||||
|
readonly locks: LockManager;
|
||||||
|
readonly platform: string;
|
||||||
|
readonly userAgent: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Navigator extends _Navigator {}
|
||||||
|
var Navigator: typeof globalThis extends { onabort: any; Navigator: infer T } ? T : {
|
||||||
|
prototype: Navigator;
|
||||||
|
new(): Navigator;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Needs conditional inference for lib.dom and lib.webworker compatibility
|
||||||
|
var navigator: typeof globalThis extends { onmessage: any; navigator: infer T } ? T : Navigator;
|
||||||
|
}
|
||||||
45
node_modules/@types/node/web-globals/performance.d.ts
generated
vendored
Normal file
45
node_modules/@types/node/web-globals/performance.d.ts
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
import * as perf_hooks from "node:perf_hooks";
|
||||||
|
|
||||||
|
type _Performance = typeof globalThis extends { onmessage: any } ? {} : perf_hooks.Performance;
|
||||||
|
type _PerformanceEntry = typeof globalThis extends { onmessage: any } ? {} : perf_hooks.PerformanceEntry;
|
||||||
|
type _PerformanceMark = typeof globalThis extends { onmessage: any } ? {} : perf_hooks.PerformanceMark;
|
||||||
|
type _PerformanceMeasure = typeof globalThis extends { onmessage: any } ? {} : perf_hooks.PerformanceMeasure;
|
||||||
|
type _PerformanceObserver = typeof globalThis extends { onmessage: any } ? {} : perf_hooks.PerformanceObserver;
|
||||||
|
type _PerformanceObserverEntryList = typeof globalThis extends { onmessage: any } ? {}
|
||||||
|
: perf_hooks.PerformanceObserverEntryList;
|
||||||
|
type _PerformanceResourceTiming = typeof globalThis extends { onmessage: any } ? {}
|
||||||
|
: perf_hooks.PerformanceResourceTiming;
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Performance extends _Performance {}
|
||||||
|
var Performance: typeof globalThis extends { onmessage: any; Performance: infer T } ? T
|
||||||
|
: typeof perf_hooks.Performance;
|
||||||
|
|
||||||
|
interface PerformanceEntry extends _PerformanceEntry {}
|
||||||
|
var PerformanceEntry: typeof globalThis extends { onmessage: any; PerformanceEntry: infer T } ? T
|
||||||
|
: typeof perf_hooks.PerformanceEntry;
|
||||||
|
|
||||||
|
interface PerformanceMark extends _PerformanceMark {}
|
||||||
|
var PerformanceMark: typeof globalThis extends { onmessage: any; PerformanceMark: infer T } ? T
|
||||||
|
: typeof perf_hooks.PerformanceMark;
|
||||||
|
|
||||||
|
interface PerformanceMeasure extends _PerformanceMeasure {}
|
||||||
|
var PerformanceMeasure: typeof globalThis extends { onmessage: any; PerformanceMeasure: infer T } ? T
|
||||||
|
: typeof perf_hooks.PerformanceMeasure;
|
||||||
|
|
||||||
|
interface PerformanceObserver extends _PerformanceObserver {}
|
||||||
|
var PerformanceObserver: typeof globalThis extends { onmessage: any; PerformanceObserver: infer T } ? T
|
||||||
|
: typeof perf_hooks.PerformanceObserver;
|
||||||
|
|
||||||
|
interface PerformanceObserverEntryList extends _PerformanceObserverEntryList {}
|
||||||
|
var PerformanceObserverEntryList: typeof globalThis extends
|
||||||
|
{ onmessage: any; PerformanceObserverEntryList: infer T } ? T : typeof perf_hooks.PerformanceObserverEntryList;
|
||||||
|
|
||||||
|
interface PerformanceResourceTiming extends _PerformanceResourceTiming {}
|
||||||
|
var PerformanceResourceTiming: typeof globalThis extends { onmessage: any; PerformanceResourceTiming: infer T } ? T
|
||||||
|
: typeof perf_hooks.PerformanceResourceTiming;
|
||||||
|
|
||||||
|
var performance: typeof globalThis extends { onmessage: any; performance: infer T } ? T : perf_hooks.Performance;
|
||||||
|
}
|
||||||
24
node_modules/@types/node/web-globals/storage.d.ts
generated
vendored
Normal file
24
node_modules/@types/node/web-globals/storage.d.ts
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
// These interfaces are absent from lib.webworker, so the conditionals use `onabort` rather than `onmessage`
|
||||||
|
type _Storage = typeof globalThis extends { onabort: any } ? {} : Storage;
|
||||||
|
interface Storage {
|
||||||
|
readonly length: number;
|
||||||
|
clear(): void;
|
||||||
|
getItem(key: string): string | null;
|
||||||
|
key(index: number): string | null;
|
||||||
|
removeItem(key: string): void;
|
||||||
|
setItem(key: string, value: string): void;
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Storage extends _Storage {}
|
||||||
|
var Storage: typeof globalThis extends { onabort: any; Storage: infer T } ? T : {
|
||||||
|
prototype: Storage;
|
||||||
|
new(): Storage;
|
||||||
|
};
|
||||||
|
|
||||||
|
var localStorage: Storage;
|
||||||
|
var sessionStorage: Storage;
|
||||||
|
}
|
||||||
115
node_modules/@types/node/web-globals/streams.d.ts
generated
vendored
Normal file
115
node_modules/@types/node/web-globals/streams.d.ts
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
import * as webstreams from "stream/web";
|
||||||
|
|
||||||
|
type _ByteLengthQueuingStrategy = typeof globalThis extends { onmessage: any } ? {}
|
||||||
|
: webstreams.ByteLengthQueuingStrategy;
|
||||||
|
type _CompressionStream = typeof globalThis extends { onmessage: any } ? {} : webstreams.CompressionStream;
|
||||||
|
type _CountQueuingStrategy = typeof globalThis extends { onmessage: any } ? {} : webstreams.CountQueuingStrategy;
|
||||||
|
type _DecompressionStream = typeof globalThis extends { onmessage: any } ? {} : webstreams.DecompressionStream;
|
||||||
|
type _QueuingStrategy<T = any> = typeof globalThis extends { onmessage: any } ? {} : webstreams.QueuingStrategy<T>;
|
||||||
|
type _ReadableByteStreamController = typeof globalThis extends { onmessage: any } ? {}
|
||||||
|
: webstreams.ReadableByteStreamController;
|
||||||
|
type _ReadableStream<R = any> = typeof globalThis extends { onmessage: any } ? {} : webstreams.ReadableStream<R>;
|
||||||
|
type _ReadableStreamBYOBReader = typeof globalThis extends { onmessage: any } ? {}
|
||||||
|
: webstreams.ReadableStreamBYOBReader;
|
||||||
|
type _ReadableStreamBYOBRequest = typeof globalThis extends { onmessage: any } ? {}
|
||||||
|
: webstreams.ReadableStreamBYOBRequest;
|
||||||
|
type _ReadableStreamDefaultController<R = any> = typeof globalThis extends { onmessage: any } ? {}
|
||||||
|
: webstreams.ReadableStreamDefaultController<R>;
|
||||||
|
type _ReadableStreamDefaultReader<R = any> = typeof globalThis extends { onmessage: any } ? {}
|
||||||
|
: webstreams.ReadableStreamDefaultReader<R>;
|
||||||
|
type _TextDecoderStream = typeof globalThis extends { onmessage: any } ? {} : webstreams.TextDecoderStream;
|
||||||
|
type _TextEncoderStream = typeof globalThis extends { onmessage: any } ? {} : webstreams.TextEncoderStream;
|
||||||
|
type _TransformStream<I = any, O = any> = typeof globalThis extends { onmessage: any } ? {}
|
||||||
|
: webstreams.TransformStream<I, O>;
|
||||||
|
type _TransformStreamDefaultController<O = any> = typeof globalThis extends { onmessage: any } ? {}
|
||||||
|
: webstreams.TransformStreamDefaultController<O>;
|
||||||
|
type _WritableStream<W = any> = typeof globalThis extends { onmessage: any } ? {} : webstreams.WritableStream<W>;
|
||||||
|
type _WritableStreamDefaultController = typeof globalThis extends { onmessage: any } ? {}
|
||||||
|
: webstreams.WritableStreamDefaultController;
|
||||||
|
type _WritableStreamDefaultWriter<W = any> = typeof globalThis extends { onmessage: any } ? {}
|
||||||
|
: webstreams.WritableStreamDefaultWriter<W>;
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface ByteLengthQueuingStrategy extends _ByteLengthQueuingStrategy {}
|
||||||
|
var ByteLengthQueuingStrategy: typeof globalThis extends { onmessage: any; ByteLengthQueuingStrategy: infer T } ? T
|
||||||
|
: typeof webstreams.ByteLengthQueuingStrategy;
|
||||||
|
|
||||||
|
interface CompressionStream extends _CompressionStream {}
|
||||||
|
var CompressionStream: typeof globalThis extends {
|
||||||
|
onmessage: any;
|
||||||
|
CompressionStream: infer T;
|
||||||
|
} ? T
|
||||||
|
: typeof webstreams.CompressionStream;
|
||||||
|
|
||||||
|
interface CountQueuingStrategy extends _CountQueuingStrategy {}
|
||||||
|
var CountQueuingStrategy: typeof globalThis extends { onmessage: any; CountQueuingStrategy: infer T } ? T
|
||||||
|
: typeof webstreams.CountQueuingStrategy;
|
||||||
|
|
||||||
|
interface DecompressionStream extends _DecompressionStream {}
|
||||||
|
var DecompressionStream: typeof globalThis extends {
|
||||||
|
onmessage: any;
|
||||||
|
DecompressionStream: infer T;
|
||||||
|
} ? T
|
||||||
|
: typeof webstreams.DecompressionStream;
|
||||||
|
|
||||||
|
interface QueuingStrategy<T = any> extends _QueuingStrategy<T> {}
|
||||||
|
|
||||||
|
interface ReadableByteStreamController extends _ReadableByteStreamController {}
|
||||||
|
var ReadableByteStreamController: typeof globalThis extends
|
||||||
|
{ onmessage: any; ReadableByteStreamController: infer T } ? T : typeof webstreams.ReadableByteStreamController;
|
||||||
|
|
||||||
|
interface ReadableStream<R = any> extends _ReadableStream<R> {}
|
||||||
|
var ReadableStream: typeof globalThis extends { onmessage: any; ReadableStream: infer T } ? T
|
||||||
|
: typeof webstreams.ReadableStream;
|
||||||
|
|
||||||
|
interface ReadableStreamBYOBReader extends _ReadableStreamBYOBReader {}
|
||||||
|
var ReadableStreamBYOBReader: typeof globalThis extends { onmessage: any; ReadableStreamBYOBReader: infer T } ? T
|
||||||
|
: typeof webstreams.ReadableStreamBYOBReader;
|
||||||
|
|
||||||
|
interface ReadableStreamBYOBRequest extends _ReadableStreamBYOBRequest {}
|
||||||
|
var ReadableStreamBYOBRequest: typeof globalThis extends { onmessage: any; ReadableStreamBYOBRequest: infer T } ? T
|
||||||
|
: typeof webstreams.ReadableStreamBYOBRequest;
|
||||||
|
|
||||||
|
interface ReadableStreamDefaultController<R = any> extends _ReadableStreamDefaultController<R> {}
|
||||||
|
var ReadableStreamDefaultController: typeof globalThis extends
|
||||||
|
{ onmessage: any; ReadableStreamDefaultController: infer T } ? T
|
||||||
|
: typeof webstreams.ReadableStreamDefaultController;
|
||||||
|
|
||||||
|
interface ReadableStreamDefaultReader<R = any> extends _ReadableStreamDefaultReader<R> {}
|
||||||
|
var ReadableStreamDefaultReader: typeof globalThis extends { onmessage: any; ReadableStreamDefaultReader: infer T }
|
||||||
|
? T
|
||||||
|
: typeof webstreams.ReadableStreamDefaultReader;
|
||||||
|
|
||||||
|
interface TextDecoderStream extends _TextDecoderStream {}
|
||||||
|
var TextDecoderStream: typeof globalThis extends { onmessage: any; TextDecoderStream: infer T } ? T
|
||||||
|
: typeof webstreams.TextDecoderStream;
|
||||||
|
|
||||||
|
interface TextEncoderStream extends _TextEncoderStream {}
|
||||||
|
var TextEncoderStream: typeof globalThis extends { onmessage: any; TextEncoderStream: infer T } ? T
|
||||||
|
: typeof webstreams.TextEncoderStream;
|
||||||
|
|
||||||
|
interface TransformStream<I = any, O = any> extends _TransformStream<I, O> {}
|
||||||
|
var TransformStream: typeof globalThis extends { onmessage: any; TransformStream: infer T } ? T
|
||||||
|
: typeof webstreams.TransformStream;
|
||||||
|
|
||||||
|
interface TransformStreamDefaultController<O = any> extends _TransformStreamDefaultController<O> {}
|
||||||
|
var TransformStreamDefaultController: typeof globalThis extends
|
||||||
|
{ onmessage: any; TransformStreamDefaultController: infer T } ? T
|
||||||
|
: typeof webstreams.TransformStreamDefaultController;
|
||||||
|
|
||||||
|
interface WritableStream<W = any> extends _WritableStream<W> {}
|
||||||
|
var WritableStream: typeof globalThis extends { onmessage: any; WritableStream: infer T } ? T
|
||||||
|
: typeof webstreams.WritableStream;
|
||||||
|
|
||||||
|
interface WritableStreamDefaultController extends _WritableStreamDefaultController {}
|
||||||
|
var WritableStreamDefaultController: typeof globalThis extends
|
||||||
|
{ onmessage: any; WritableStreamDefaultController: infer T } ? T
|
||||||
|
: typeof webstreams.WritableStreamDefaultController;
|
||||||
|
|
||||||
|
interface WritableStreamDefaultWriter<W = any> extends _WritableStreamDefaultWriter<W> {}
|
||||||
|
var WritableStreamDefaultWriter: typeof globalThis extends { onmessage: any; WritableStreamDefaultWriter: infer T }
|
||||||
|
? T
|
||||||
|
: typeof webstreams.WritableStreamDefaultWriter;
|
||||||
|
}
|
||||||
44
node_modules/@types/node/web-globals/timers.d.ts
generated
vendored
Normal file
44
node_modules/@types/node/web-globals/timers.d.ts
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
import * as promises from "node:timers/promises";
|
||||||
|
|
||||||
|
// Note: The timer function definitions allow a single void-accepting argument
|
||||||
|
// to be optional in arguments lists. This allows usage such as
|
||||||
|
// `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
||||||
|
type MakeVoidParameterOptional<TArgs extends any[]> = [void] extends TArgs ? Partial<TArgs> : TArgs;
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
function setImmediate<TArgs extends any[]>(
|
||||||
|
callback: (...args: TArgs) => void,
|
||||||
|
...args: MakeVoidParameterOptional<TArgs>
|
||||||
|
): NodeJS.Immediate;
|
||||||
|
namespace setImmediate {
|
||||||
|
import __promisify__ = promises.setImmediate;
|
||||||
|
export { __promisify__ };
|
||||||
|
}
|
||||||
|
|
||||||
|
function setInterval<TArgs extends any[]>(
|
||||||
|
callback: (...args: TArgs) => void,
|
||||||
|
delay?: number,
|
||||||
|
...args: MakeVoidParameterOptional<TArgs>
|
||||||
|
): NodeJS.Timeout;
|
||||||
|
|
||||||
|
function setTimeout<TArgs extends any[]>(
|
||||||
|
callback: (...args: TArgs) => void,
|
||||||
|
delay?: number,
|
||||||
|
...args: MakeVoidParameterOptional<TArgs>
|
||||||
|
): NodeJS.Timeout;
|
||||||
|
namespace setTimeout {
|
||||||
|
import __promisify__ = promises.setTimeout;
|
||||||
|
export { __promisify__ };
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearImmediate(immediate: NodeJS.Immediate | undefined): void;
|
||||||
|
|
||||||
|
function clearInterval(timeout: NodeJS.Timeout | string | number | undefined): void;
|
||||||
|
|
||||||
|
function clearTimeout(timeout: NodeJS.Timeout | string | number | undefined): void;
|
||||||
|
|
||||||
|
function queueMicrotask(callback: () => void): void;
|
||||||
|
}
|
||||||
24
node_modules/@types/node/web-globals/url.d.ts
generated
vendored
Normal file
24
node_modules/@types/node/web-globals/url.d.ts
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
import * as url from "node:url";
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface URL extends url.URL {}
|
||||||
|
var URL: typeof globalThis extends { onmessage: any; URL: infer T } ? T : typeof url.URL;
|
||||||
|
|
||||||
|
interface URLPattern extends url.URLPattern {}
|
||||||
|
var URLPattern: typeof globalThis extends {
|
||||||
|
onmessage: any;
|
||||||
|
scheduler: any; // Must be a var introduced at the same time as URLPattern.
|
||||||
|
URLPattern: infer T;
|
||||||
|
} ? T
|
||||||
|
: typeof url.URLPattern;
|
||||||
|
|
||||||
|
interface URLPatternInit extends url.URLPatternInit {}
|
||||||
|
|
||||||
|
interface URLPatternResult extends url.URLPatternResult {}
|
||||||
|
|
||||||
|
interface URLSearchParams extends url.URLSearchParams {}
|
||||||
|
var URLSearchParams: typeof globalThis extends { onmessage: any; URLSearchParams: infer T } ? T
|
||||||
|
: typeof url.URLSearchParams;
|
||||||
|
}
|
||||||
717
node_modules/@types/node/worker_threads.d.ts
generated
vendored
Normal file
717
node_modules/@types/node/worker_threads.d.ts
generated
vendored
Normal file
@ -0,0 +1,717 @@
|
|||||||
|
/**
|
||||||
|
* The `node:worker_threads` module enables the use of threads that execute
|
||||||
|
* JavaScript in parallel. To access it:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import worker from 'node:worker_threads';
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Workers (threads) are useful for performing CPU-intensive JavaScript operations.
|
||||||
|
* They do not help much with I/O-intensive work. The Node.js built-in
|
||||||
|
* asynchronous I/O operations are more efficient than Workers can be.
|
||||||
|
*
|
||||||
|
* Unlike `child_process` or `cluster`, `worker_threads` can share memory. They do
|
||||||
|
* so by transferring `ArrayBuffer` instances or sharing `SharedArrayBuffer` instances.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import {
|
||||||
|
* Worker,
|
||||||
|
* isMainThread,
|
||||||
|
* parentPort,
|
||||||
|
* workerData,
|
||||||
|
* } from 'node:worker_threads';
|
||||||
|
*
|
||||||
|
* if (!isMainThread) {
|
||||||
|
* const { parse } = await import('some-js-parsing-library');
|
||||||
|
* const script = workerData;
|
||||||
|
* parentPort.postMessage(parse(script));
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* export default function parseJSAsync(script) {
|
||||||
|
* return new Promise((resolve, reject) => {
|
||||||
|
* const worker = new Worker(new URL(import.meta.url), {
|
||||||
|
* workerData: script,
|
||||||
|
* });
|
||||||
|
* worker.on('message', resolve);
|
||||||
|
* worker.once('error', reject);
|
||||||
|
* worker.once('exit', (code) => {
|
||||||
|
* if (code !== 0)
|
||||||
|
* reject(new Error(`Worker stopped with exit code ${code}`));
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* };
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The above example spawns a Worker thread for each `parseJSAsync()` call. In
|
||||||
|
* practice, use a pool of Workers for these kinds of tasks. Otherwise, the
|
||||||
|
* overhead of creating Workers would likely exceed their benefit.
|
||||||
|
*
|
||||||
|
* When implementing a worker pool, use the `AsyncResource` API to inform
|
||||||
|
* diagnostic tools (e.g. to provide asynchronous stack traces) about the
|
||||||
|
* correlation between tasks and their outcomes. See `"Using AsyncResource for a Worker thread pool"` in the `async_hooks` documentation for an example implementation.
|
||||||
|
*
|
||||||
|
* Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
|
||||||
|
* specifically `argv` and `execArgv` options.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/worker_threads.js)
|
||||||
|
*/
|
||||||
|
declare module "node:worker_threads" {
|
||||||
|
import {
|
||||||
|
EventEmitter,
|
||||||
|
InternalEventEmitter,
|
||||||
|
InternalEventTargetEventProperties,
|
||||||
|
NodeEventTarget,
|
||||||
|
} from "node:events";
|
||||||
|
import { FileHandle } from "node:fs/promises";
|
||||||
|
import { Performance } from "node:perf_hooks";
|
||||||
|
import { Readable, Writable } from "node:stream";
|
||||||
|
import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
|
||||||
|
import { URL } from "node:url";
|
||||||
|
import { CPUProfileHandle, HeapInfo, HeapProfileHandle } from "node:v8";
|
||||||
|
import { Context } from "node:vm";
|
||||||
|
import { MessageEvent } from "undici-types";
|
||||||
|
const isInternalThread: boolean;
|
||||||
|
const isMainThread: boolean;
|
||||||
|
const parentPort: null | MessagePort;
|
||||||
|
const resourceLimits: ResourceLimits;
|
||||||
|
const SHARE_ENV: unique symbol;
|
||||||
|
const threadId: number;
|
||||||
|
const threadName: string | null;
|
||||||
|
const workerData: any;
|
||||||
|
interface WorkerPerformance extends Pick<Performance, "eventLoopUtilization"> {}
|
||||||
|
/** @deprecated Use `import { Transferable } from "node:worker_threads"` instead. */
|
||||||
|
// TODO: remove in a future major @types/node version.
|
||||||
|
type TransferListItem = Transferable;
|
||||||
|
interface WorkerOptions {
|
||||||
|
/**
|
||||||
|
* List of arguments which would be stringified and appended to
|
||||||
|
* `process.argv` in the worker. This is mostly similar to the `workerData`
|
||||||
|
* but the values will be available on the global `process.argv` as if they
|
||||||
|
* were passed as CLI options to the script.
|
||||||
|
*/
|
||||||
|
argv?: any[] | undefined;
|
||||||
|
env?: NodeJS.Dict<string> | typeof SHARE_ENV | undefined;
|
||||||
|
eval?: boolean | undefined;
|
||||||
|
workerData?: any;
|
||||||
|
stdin?: boolean | undefined;
|
||||||
|
stdout?: boolean | undefined;
|
||||||
|
stderr?: boolean | undefined;
|
||||||
|
execArgv?: string[] | undefined;
|
||||||
|
resourceLimits?: ResourceLimits | undefined;
|
||||||
|
/**
|
||||||
|
* Additional data to send in the first worker message.
|
||||||
|
*/
|
||||||
|
transferList?: Transferable[] | undefined;
|
||||||
|
/**
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
|
trackUnmanagedFds?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* An optional `name` to be appended to the worker title
|
||||||
|
* for debugging/identification purposes, making the final title as
|
||||||
|
* `[worker ${id}] ${name}`.
|
||||||
|
*/
|
||||||
|
name?: string | undefined;
|
||||||
|
}
|
||||||
|
interface ResourceLimits {
|
||||||
|
/**
|
||||||
|
* The maximum size of a heap space for recently created objects.
|
||||||
|
*/
|
||||||
|
maxYoungGenerationSizeMb?: number | undefined;
|
||||||
|
/**
|
||||||
|
* The maximum size of the main heap in MB.
|
||||||
|
*/
|
||||||
|
maxOldGenerationSizeMb?: number | undefined;
|
||||||
|
/**
|
||||||
|
* The size of a pre-allocated memory range used for generated code.
|
||||||
|
*/
|
||||||
|
codeRangeSizeMb?: number | undefined;
|
||||||
|
/**
|
||||||
|
* The default maximum stack size for the thread. Small values may lead to unusable Worker instances.
|
||||||
|
* @default 4
|
||||||
|
*/
|
||||||
|
stackSizeMb?: number | undefined;
|
||||||
|
}
|
||||||
|
interface WorkerEventMap {
|
||||||
|
"error": [err: unknown];
|
||||||
|
"exit": [exitCode: number];
|
||||||
|
"message": [value: any];
|
||||||
|
"messageerror": [error: Error];
|
||||||
|
"online": [];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The `Worker` class represents an independent JavaScript execution thread.
|
||||||
|
* Most Node.js APIs are available inside of it.
|
||||||
|
*
|
||||||
|
* Notable differences inside a Worker environment are:
|
||||||
|
*
|
||||||
|
* * The `process.stdin`, `process.stdout`, and `process.stderr` streams may be redirected by the parent thread.
|
||||||
|
* * The `import { isMainThread } from 'node:worker_threads'` variable is set to `false`.
|
||||||
|
* * The `import { parentPort } from 'node:worker_threads'` message port is available.
|
||||||
|
* * `process.exit()` does not stop the whole program, just the single thread,
|
||||||
|
* and `process.abort()` is not available.
|
||||||
|
* * `process.chdir()` and `process` methods that set group or user ids
|
||||||
|
* are not available.
|
||||||
|
* * `process.env` is a copy of the parent thread's environment variables,
|
||||||
|
* unless otherwise specified. Changes to one copy are not visible in other
|
||||||
|
* threads, and are not visible to native add-ons (unless `worker.SHARE_ENV` is passed as the `env` option to the `Worker` constructor). On Windows, unlike the main thread, a copy of the
|
||||||
|
* environment variables operates in a case-sensitive manner.
|
||||||
|
* * `process.title` cannot be modified.
|
||||||
|
* * Signals are not delivered through `process.on('...')`.
|
||||||
|
* * Execution may stop at any point as a result of `worker.terminate()` being invoked.
|
||||||
|
* * IPC channels from parent processes are not accessible.
|
||||||
|
* * The `trace_events` module is not supported.
|
||||||
|
* * Native add-ons can only be loaded from multiple threads if they fulfill `certain conditions`.
|
||||||
|
*
|
||||||
|
* Creating `Worker` instances inside of other `Worker`s is possible.
|
||||||
|
*
|
||||||
|
* Like [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) and the `node:cluster module`, two-way communication
|
||||||
|
* can be achieved through inter-thread message passing. Internally, a `Worker` has
|
||||||
|
* a built-in pair of `MessagePort` s that are already associated with each
|
||||||
|
* other when the `Worker` is created. While the `MessagePort` object on the parent
|
||||||
|
* side is not directly exposed, its functionalities are exposed through `worker.postMessage()` and the `worker.on('message')` event
|
||||||
|
* on the `Worker` object for the parent thread.
|
||||||
|
*
|
||||||
|
* To create custom messaging channels (which is encouraged over using the default
|
||||||
|
* global channel because it facilitates separation of concerns), users can create
|
||||||
|
* a `MessageChannel` object on either thread and pass one of the`MessagePort`s on that `MessageChannel` to the other thread through a
|
||||||
|
* pre-existing channel, such as the global one.
|
||||||
|
*
|
||||||
|
* See `port.postMessage()` for more information on how messages are passed,
|
||||||
|
* and what kind of JavaScript values can be successfully transported through
|
||||||
|
* the thread barrier.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'node:assert';
|
||||||
|
* import {
|
||||||
|
* Worker, MessageChannel, MessagePort, isMainThread, parentPort,
|
||||||
|
* } from 'node:worker_threads';
|
||||||
|
* if (isMainThread) {
|
||||||
|
* const worker = new Worker(__filename);
|
||||||
|
* const subChannel = new MessageChannel();
|
||||||
|
* worker.postMessage({ hereIsYourPort: subChannel.port1 }, [subChannel.port1]);
|
||||||
|
* subChannel.port2.on('message', (value) => {
|
||||||
|
* console.log('received:', value);
|
||||||
|
* });
|
||||||
|
* } else {
|
||||||
|
* parentPort.once('message', (value) => {
|
||||||
|
* assert(value.hereIsYourPort instanceof MessagePort);
|
||||||
|
* value.hereIsYourPort.postMessage('the worker is sending this');
|
||||||
|
* value.hereIsYourPort.close();
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v10.5.0
|
||||||
|
*/
|
||||||
|
class Worker implements EventEmitter {
|
||||||
|
/**
|
||||||
|
* If `stdin: true` was passed to the `Worker` constructor, this is a
|
||||||
|
* writable stream. The data written to this stream will be made available in
|
||||||
|
* the worker thread as `process.stdin`.
|
||||||
|
* @since v10.5.0
|
||||||
|
*/
|
||||||
|
readonly stdin: Writable | null;
|
||||||
|
/**
|
||||||
|
* This is a readable stream which contains data written to `process.stdout` inside the worker thread. If `stdout: true` was not passed to the `Worker` constructor, then data is piped to the
|
||||||
|
* parent thread's `process.stdout` stream.
|
||||||
|
* @since v10.5.0
|
||||||
|
*/
|
||||||
|
readonly stdout: Readable;
|
||||||
|
/**
|
||||||
|
* This is a readable stream which contains data written to `process.stderr` inside the worker thread. If `stderr: true` was not passed to the `Worker` constructor, then data is piped to the
|
||||||
|
* parent thread's `process.stderr` stream.
|
||||||
|
* @since v10.5.0
|
||||||
|
*/
|
||||||
|
readonly stderr: Readable;
|
||||||
|
/**
|
||||||
|
* An integer identifier for the referenced thread. Inside the worker thread,
|
||||||
|
* it is available as `import { threadId } from 'node:worker_threads'`.
|
||||||
|
* This value is unique for each `Worker` instance inside a single process.
|
||||||
|
* @since v10.5.0
|
||||||
|
*/
|
||||||
|
readonly threadId: number;
|
||||||
|
/**
|
||||||
|
* A string identifier for the referenced thread or null if the thread is not running.
|
||||||
|
* Inside the worker thread, it is available as `require('node:worker_threads').threadName`.
|
||||||
|
* @since v24.6.0
|
||||||
|
*/
|
||||||
|
readonly threadName: string | null;
|
||||||
|
/**
|
||||||
|
* Provides the set of JS engine resource constraints for this Worker thread.
|
||||||
|
* If the `resourceLimits` option was passed to the `Worker` constructor,
|
||||||
|
* this matches its values.
|
||||||
|
*
|
||||||
|
* If the worker has stopped, the return value is an empty object.
|
||||||
|
* @since v13.2.0, v12.16.0
|
||||||
|
*/
|
||||||
|
readonly resourceLimits?: ResourceLimits | undefined;
|
||||||
|
/**
|
||||||
|
* An object that can be used to query performance information from a worker
|
||||||
|
* instance. Similar to `perf_hooks.performance`.
|
||||||
|
* @since v15.1.0, v14.17.0, v12.22.0
|
||||||
|
*/
|
||||||
|
readonly performance: WorkerPerformance;
|
||||||
|
/**
|
||||||
|
* @param filename The path to the Worker’s main script or module.
|
||||||
|
* Must be either an absolute path or a relative path (i.e. relative to the current working directory) starting with ./ or ../,
|
||||||
|
* or a WHATWG URL object using file: protocol. If options.eval is true, this is a string containing JavaScript code rather than a path.
|
||||||
|
*/
|
||||||
|
constructor(filename: string | URL, options?: WorkerOptions);
|
||||||
|
/**
|
||||||
|
* Send a message to the worker that is received via `require('node:worker_threads').parentPort.on('message')`.
|
||||||
|
* See `port.postMessage()` for more details.
|
||||||
|
* @since v10.5.0
|
||||||
|
*/
|
||||||
|
postMessage(value: any, transferList?: readonly Transferable[]): void;
|
||||||
|
/**
|
||||||
|
* Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does _not_ let the program exit if it's the only active handle left (the default
|
||||||
|
* behavior). If the worker is `ref()`ed, calling `ref()` again has
|
||||||
|
* no effect.
|
||||||
|
* @since v10.5.0
|
||||||
|
*/
|
||||||
|
ref(): void;
|
||||||
|
/**
|
||||||
|
* Calling `unref()` on a worker allows the thread to exit if this is the only
|
||||||
|
* active handle in the event system. If the worker is already `unref()`ed calling `unref()` again has no effect.
|
||||||
|
* @since v10.5.0
|
||||||
|
*/
|
||||||
|
unref(): void;
|
||||||
|
/**
|
||||||
|
* Stop all JavaScript execution in the worker thread as soon as possible.
|
||||||
|
* Returns a Promise for the exit code that is fulfilled when the `'exit' event` is emitted.
|
||||||
|
* @since v10.5.0
|
||||||
|
*/
|
||||||
|
terminate(): Promise<number>;
|
||||||
|
/**
|
||||||
|
* This method returns a `Promise` that will resolve to an object identical to `process.threadCpuUsage()`,
|
||||||
|
* or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
|
||||||
|
* This methods allows the statistics to be observed from outside the actual thread.
|
||||||
|
* @since v24.6.0
|
||||||
|
*/
|
||||||
|
cpuUsage(prev?: NodeJS.CpuUsage): Promise<NodeJS.CpuUsage>;
|
||||||
|
/**
|
||||||
|
* Returns a readable stream for a V8 snapshot of the current state of the Worker.
|
||||||
|
* See `v8.getHeapSnapshot()` for more details.
|
||||||
|
*
|
||||||
|
* If the Worker thread is no longer running, which may occur before the `'exit' event` is emitted, the returned `Promise` is rejected
|
||||||
|
* immediately with an `ERR_WORKER_NOT_RUNNING` error.
|
||||||
|
* @since v13.9.0, v12.17.0
|
||||||
|
* @return A promise for a Readable Stream containing a V8 heap snapshot
|
||||||
|
*/
|
||||||
|
getHeapSnapshot(): Promise<Readable>;
|
||||||
|
/**
|
||||||
|
* This method returns a `Promise` that will resolve to an object identical to `v8.getHeapStatistics()`,
|
||||||
|
* or reject with an `ERR_WORKER_NOT_RUNNING` error if the worker is no longer running.
|
||||||
|
* This methods allows the statistics to be observed from outside the actual thread.
|
||||||
|
* @since v24.0.0
|
||||||
|
*/
|
||||||
|
getHeapStatistics(): Promise<HeapInfo>;
|
||||||
|
/**
|
||||||
|
* Starting a CPU profile then return a Promise that fulfills with an error
|
||||||
|
* or an `CPUProfileHandle` object. This API supports `await using` syntax.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { Worker } = require('node:worker_threads');
|
||||||
|
*
|
||||||
|
* const worker = new Worker(`
|
||||||
|
* const { parentPort } = require('worker_threads');
|
||||||
|
* parentPort.on('message', () => {});
|
||||||
|
* `, { eval: true });
|
||||||
|
*
|
||||||
|
* worker.on('online', async () => {
|
||||||
|
* const handle = await worker.startCpuProfile();
|
||||||
|
* const profile = await handle.stop();
|
||||||
|
* console.log(profile);
|
||||||
|
* worker.terminate();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* `await using` example.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { Worker } = require('node:worker_threads');
|
||||||
|
*
|
||||||
|
* const w = new Worker(`
|
||||||
|
* const { parentPort } = require('node:worker_threads');
|
||||||
|
* parentPort.on('message', () => {});
|
||||||
|
* `, { eval: true });
|
||||||
|
*
|
||||||
|
* w.on('online', async () => {
|
||||||
|
* // Stop profile automatically when return and profile will be discarded
|
||||||
|
* await using handle = await w.startCpuProfile();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v24.8.0
|
||||||
|
*/
|
||||||
|
startCpuProfile(): Promise<CPUProfileHandle>;
|
||||||
|
/**
|
||||||
|
* Starting a Heap profile then return a Promise that fulfills with an error
|
||||||
|
* or an `HeapProfileHandle` object. This API supports `await using` syntax.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { Worker } = require('node:worker_threads');
|
||||||
|
*
|
||||||
|
* const worker = new Worker(`
|
||||||
|
* const { parentPort } = require('worker_threads');
|
||||||
|
* parentPort.on('message', () => {});
|
||||||
|
* `, { eval: true });
|
||||||
|
*
|
||||||
|
* worker.on('online', async () => {
|
||||||
|
* const handle = await worker.startHeapProfile();
|
||||||
|
* const profile = await handle.stop();
|
||||||
|
* console.log(profile);
|
||||||
|
* worker.terminate();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* `await using` example.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { Worker } = require('node:worker_threads');
|
||||||
|
*
|
||||||
|
* const w = new Worker(`
|
||||||
|
* const { parentPort } = require('node:worker_threads');
|
||||||
|
* parentPort.on('message', () => {});
|
||||||
|
* `, { eval: true });
|
||||||
|
*
|
||||||
|
* w.on('online', async () => {
|
||||||
|
* // Stop profile automatically when return and profile will be discarded
|
||||||
|
* await using handle = await w.startHeapProfile();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
startHeapProfile(): Promise<HeapProfileHandle>;
|
||||||
|
/**
|
||||||
|
* Calls `worker.terminate()` when the dispose scope is exited.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* async function example() {
|
||||||
|
* await using worker = new Worker('for (;;) {}', { eval: true });
|
||||||
|
* // Worker is automatically terminate when the scope is exited.
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v24.2.0
|
||||||
|
*/
|
||||||
|
[Symbol.asyncDispose](): Promise<void>;
|
||||||
|
}
|
||||||
|
interface Worker extends InternalEventEmitter<WorkerEventMap> {}
|
||||||
|
/**
|
||||||
|
* Mark an object as not transferable. If `object` occurs in the transfer list of
|
||||||
|
* a `port.postMessage()` call, it is ignored.
|
||||||
|
*
|
||||||
|
* In particular, this makes sense for objects that can be cloned, rather than
|
||||||
|
* transferred, and which are used by other objects on the sending side.
|
||||||
|
* For example, Node.js marks the `ArrayBuffer`s it uses for its `Buffer pool` with this.
|
||||||
|
*
|
||||||
|
* This operation cannot be undone.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { MessageChannel, markAsUntransferable } from 'node:worker_threads';
|
||||||
|
*
|
||||||
|
* const pooledBuffer = new ArrayBuffer(8);
|
||||||
|
* const typedArray1 = new Uint8Array(pooledBuffer);
|
||||||
|
* const typedArray2 = new Float64Array(pooledBuffer);
|
||||||
|
*
|
||||||
|
* markAsUntransferable(pooledBuffer);
|
||||||
|
*
|
||||||
|
* const { port1 } = new MessageChannel();
|
||||||
|
* port1.postMessage(typedArray1, [ typedArray1.buffer ]);
|
||||||
|
*
|
||||||
|
* // The following line prints the contents of typedArray1 -- it still owns
|
||||||
|
* // its memory and has been cloned, not transferred. Without
|
||||||
|
* // `markAsUntransferable()`, this would print an empty Uint8Array.
|
||||||
|
* // typedArray2 is intact as well.
|
||||||
|
* console.log(typedArray1);
|
||||||
|
* console.log(typedArray2);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* There is no equivalent to this API in browsers.
|
||||||
|
* @since v14.5.0, v12.19.0
|
||||||
|
*/
|
||||||
|
function markAsUntransferable(object: object): void;
|
||||||
|
/**
|
||||||
|
* Check if an object is marked as not transferable with
|
||||||
|
* {@link markAsUntransferable}.
|
||||||
|
* @since v21.0.0
|
||||||
|
*/
|
||||||
|
function isMarkedAsUntransferable(object: object): boolean;
|
||||||
|
/**
|
||||||
|
* Mark an object as not cloneable. If `object` is used as `message` in
|
||||||
|
* a `port.postMessage()` call, an error is thrown. This is a no-op if `object` is a
|
||||||
|
* primitive value.
|
||||||
|
*
|
||||||
|
* This has no effect on `ArrayBuffer`, or any `Buffer` like objects.
|
||||||
|
*
|
||||||
|
* This operation cannot be undone.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { markAsUncloneable } = require('node:worker_threads');
|
||||||
|
*
|
||||||
|
* const anyObject = { foo: 'bar' };
|
||||||
|
* markAsUncloneable(anyObject);
|
||||||
|
* const { port1 } = new MessageChannel();
|
||||||
|
* try {
|
||||||
|
* // This will throw an error, because anyObject is not cloneable.
|
||||||
|
* port1.postMessage(anyObject)
|
||||||
|
* } catch (error) {
|
||||||
|
* // error.name === 'DataCloneError'
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* There is no equivalent to this API in browsers.
|
||||||
|
* @since v22.10.0
|
||||||
|
*/
|
||||||
|
function markAsUncloneable(object: object): void;
|
||||||
|
/**
|
||||||
|
* Transfer a `MessagePort` to a different `vm` Context. The original `port` object is rendered unusable, and the returned `MessagePort` instance
|
||||||
|
* takes its place.
|
||||||
|
*
|
||||||
|
* The returned `MessagePort` is an object in the target context and
|
||||||
|
* inherits from its global `Object` class. Objects passed to the [`port.onmessage()`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage) listener are also created in the
|
||||||
|
* target context
|
||||||
|
* and inherit from its global `Object` class.
|
||||||
|
*
|
||||||
|
* However, the created `MessagePort` no longer inherits from [`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget), and only
|
||||||
|
* [`port.onmessage()`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage) can be used to receive
|
||||||
|
* events using it.
|
||||||
|
* @since v11.13.0
|
||||||
|
* @param port The message port to transfer.
|
||||||
|
* @param contextifiedSandbox A `contextified` object as returned by the `vm.createContext()` method.
|
||||||
|
*/
|
||||||
|
function moveMessagePortToContext(port: MessagePort, contextifiedSandbox: Context): MessagePort;
|
||||||
|
/**
|
||||||
|
* Receive a single message from a given `MessagePort`. If no message is available,`undefined` is returned, otherwise an object with a single `message` property
|
||||||
|
* that contains the message payload, corresponding to the oldest message in the `MessagePort`'s queue.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { MessageChannel, receiveMessageOnPort } from 'node:worker_threads';
|
||||||
|
* const { port1, port2 } = new MessageChannel();
|
||||||
|
* port1.postMessage({ hello: 'world' });
|
||||||
|
*
|
||||||
|
* console.log(receiveMessageOnPort(port2));
|
||||||
|
* // Prints: { message: { hello: 'world' } }
|
||||||
|
* console.log(receiveMessageOnPort(port2));
|
||||||
|
* // Prints: undefined
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* When this function is used, no `'message'` event is emitted and the `onmessage` listener is not invoked.
|
||||||
|
* @since v12.3.0
|
||||||
|
*/
|
||||||
|
function receiveMessageOnPort(port: MessagePort):
|
||||||
|
| {
|
||||||
|
message: any;
|
||||||
|
}
|
||||||
|
| undefined;
|
||||||
|
type Serializable = string | object | number | boolean | bigint;
|
||||||
|
/**
|
||||||
|
* Within a worker thread, `worker.getEnvironmentData()` returns a clone
|
||||||
|
* of data passed to the spawning thread's `worker.setEnvironmentData()`.
|
||||||
|
* Every new `Worker` receives its own copy of the environment data
|
||||||
|
* automatically.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import {
|
||||||
|
* Worker,
|
||||||
|
* isMainThread,
|
||||||
|
* setEnvironmentData,
|
||||||
|
* getEnvironmentData,
|
||||||
|
* } from 'node:worker_threads';
|
||||||
|
*
|
||||||
|
* if (isMainThread) {
|
||||||
|
* setEnvironmentData('Hello', 'World!');
|
||||||
|
* const worker = new Worker(__filename);
|
||||||
|
* } else {
|
||||||
|
* console.log(getEnvironmentData('Hello')); // Prints 'World!'.
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v15.12.0, v14.18.0
|
||||||
|
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
|
||||||
|
*/
|
||||||
|
function getEnvironmentData(key: Serializable): Serializable;
|
||||||
|
/**
|
||||||
|
* The `worker.setEnvironmentData()` API sets the content of `worker.getEnvironmentData()` in the current thread and all new `Worker` instances spawned from the current context.
|
||||||
|
* @since v15.12.0, v14.18.0
|
||||||
|
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
|
||||||
|
* @param value Any arbitrary, cloneable JavaScript value that will be cloned and passed automatically to all new `Worker` instances. If `value` is passed as `undefined`, any previously set value
|
||||||
|
* for the `key` will be deleted.
|
||||||
|
*/
|
||||||
|
function setEnvironmentData(key: Serializable, value?: Serializable): void;
|
||||||
|
/**
|
||||||
|
* Sends a value to another worker, identified by its thread ID.
|
||||||
|
* @param threadId The target thread ID. If the thread ID is invalid, a `ERR_WORKER_MESSAGING_FAILED` error will be thrown.
|
||||||
|
* If the target thread ID is the current thread ID, a `ERR_WORKER_MESSAGING_SAME_THREAD` error will be thrown.
|
||||||
|
* @param value The value to send.
|
||||||
|
* @param transferList If one or more `MessagePort`-like objects are passed in value, a `transferList` is required for those items
|
||||||
|
* or `ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST` is thrown. See `port.postMessage()` for more information.
|
||||||
|
* @param timeout Time to wait for the message to be delivered in milliseconds. By default it's `undefined`, which means wait forever.
|
||||||
|
* If the operation times out, a `ERR_WORKER_MESSAGING_TIMEOUT` error is thrown.
|
||||||
|
* @since v22.5.0
|
||||||
|
*/
|
||||||
|
function postMessageToThread(threadId: number, value: any, timeout?: number): Promise<void>;
|
||||||
|
function postMessageToThread(
|
||||||
|
threadId: number,
|
||||||
|
value: any,
|
||||||
|
transferList: readonly Transferable[],
|
||||||
|
timeout?: number,
|
||||||
|
): Promise<void>;
|
||||||
|
// #region web types
|
||||||
|
type LockMode = "exclusive" | "shared";
|
||||||
|
type Transferable =
|
||||||
|
| ArrayBuffer
|
||||||
|
| MessagePort
|
||||||
|
| AbortSignal
|
||||||
|
| FileHandle
|
||||||
|
| ReadableStream
|
||||||
|
| WritableStream
|
||||||
|
| TransformStream;
|
||||||
|
interface LockGrantedCallback<T> {
|
||||||
|
(lock: Lock | null): T;
|
||||||
|
}
|
||||||
|
interface LockInfo {
|
||||||
|
clientId: string;
|
||||||
|
mode: LockMode;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
interface LockManagerSnapshot {
|
||||||
|
held: LockInfo[];
|
||||||
|
pending: LockInfo[];
|
||||||
|
}
|
||||||
|
interface LockOptions {
|
||||||
|
ifAvailable?: boolean;
|
||||||
|
mode?: LockMode;
|
||||||
|
signal?: AbortSignal;
|
||||||
|
steal?: boolean;
|
||||||
|
}
|
||||||
|
interface StructuredSerializeOptions {
|
||||||
|
transfer?: Transferable[];
|
||||||
|
}
|
||||||
|
interface BroadcastChannelEventMap {
|
||||||
|
"message": MessageEvent;
|
||||||
|
"messageerror": MessageEvent;
|
||||||
|
}
|
||||||
|
interface BroadcastChannel
|
||||||
|
extends EventTarget, InternalEventTargetEventProperties<BroadcastChannelEventMap>, NodeJS.RefCounted
|
||||||
|
{
|
||||||
|
readonly name: string;
|
||||||
|
close(): void;
|
||||||
|
postMessage(message: any): void;
|
||||||
|
addEventListener<K extends keyof BroadcastChannelEventMap>(
|
||||||
|
type: K,
|
||||||
|
listener: (ev: BroadcastChannelEventMap[K]) => void,
|
||||||
|
options?: AddEventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
addEventListener(
|
||||||
|
type: string,
|
||||||
|
listener: EventListener | EventListenerObject,
|
||||||
|
options?: AddEventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
removeEventListener<K extends keyof BroadcastChannelEventMap>(
|
||||||
|
type: K,
|
||||||
|
listener: (ev: BroadcastChannelEventMap[K]) => void,
|
||||||
|
options?: EventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
removeEventListener(
|
||||||
|
type: string,
|
||||||
|
listener: EventListener | EventListenerObject,
|
||||||
|
options?: EventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
}
|
||||||
|
var BroadcastChannel: {
|
||||||
|
prototype: BroadcastChannel;
|
||||||
|
new(name: string): BroadcastChannel;
|
||||||
|
};
|
||||||
|
interface Lock {
|
||||||
|
readonly mode: LockMode;
|
||||||
|
readonly name: string;
|
||||||
|
}
|
||||||
|
// var Lock: {
|
||||||
|
// prototype: Lock;
|
||||||
|
// new(): Lock;
|
||||||
|
// };
|
||||||
|
interface LockManager {
|
||||||
|
query(): Promise<LockManagerSnapshot>;
|
||||||
|
request<T>(name: string, callback: LockGrantedCallback<T>): Promise<Awaited<T>>;
|
||||||
|
request<T>(name: string, options: LockOptions, callback: LockGrantedCallback<T>): Promise<Awaited<T>>;
|
||||||
|
}
|
||||||
|
// var LockManager: {
|
||||||
|
// prototype: LockManager;
|
||||||
|
// new(): LockManager;
|
||||||
|
// };
|
||||||
|
interface MessageChannel {
|
||||||
|
readonly port1: MessagePort;
|
||||||
|
readonly port2: MessagePort;
|
||||||
|
}
|
||||||
|
var MessageChannel: {
|
||||||
|
prototype: MessageChannel;
|
||||||
|
new(): MessageChannel;
|
||||||
|
};
|
||||||
|
interface MessagePortEventMap {
|
||||||
|
"close": Event;
|
||||||
|
"message": MessageEvent;
|
||||||
|
"messageerror": MessageEvent;
|
||||||
|
}
|
||||||
|
interface MessagePort extends NodeEventTarget, InternalEventTargetEventProperties<MessagePortEventMap> {
|
||||||
|
close(): void;
|
||||||
|
postMessage(message: any, transfer: Transferable[]): void;
|
||||||
|
postMessage(message: any, options?: StructuredSerializeOptions): void;
|
||||||
|
start(): void;
|
||||||
|
hasRef(): boolean;
|
||||||
|
ref(): void;
|
||||||
|
unref(): void;
|
||||||
|
addEventListener<K extends keyof MessagePortEventMap>(
|
||||||
|
type: K,
|
||||||
|
listener: (ev: MessagePortEventMap[K]) => void,
|
||||||
|
options?: AddEventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
addEventListener(
|
||||||
|
type: string,
|
||||||
|
listener: EventListener | EventListenerObject,
|
||||||
|
options?: AddEventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
removeEventListener<K extends keyof MessagePortEventMap>(
|
||||||
|
type: K,
|
||||||
|
listener: (ev: MessagePortEventMap[K]) => void,
|
||||||
|
options?: EventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
removeEventListener(
|
||||||
|
type: string,
|
||||||
|
listener: EventListener | EventListenerObject,
|
||||||
|
options?: EventListenerOptions | boolean,
|
||||||
|
): void;
|
||||||
|
// #region NodeEventTarget
|
||||||
|
addListener(event: "close", listener: (ev: Event) => void): this;
|
||||||
|
addListener(event: "message", listener: (value: any) => void): this;
|
||||||
|
addListener(event: "messageerror", listener: (error: Error) => void): this;
|
||||||
|
addListener(event: string, listener: (arg: any) => void): this;
|
||||||
|
emit(event: "close", ev: Event): boolean;
|
||||||
|
emit(event: "message", value: any): boolean;
|
||||||
|
emit(event: "messageerror", error: Error): boolean;
|
||||||
|
emit(event: string, arg: any): boolean;
|
||||||
|
off(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
|
||||||
|
off(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
|
||||||
|
off(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
|
||||||
|
off(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
|
||||||
|
on(event: "close", listener: (ev: Event) => void): this;
|
||||||
|
on(event: "message", listener: (value: any) => void): this;
|
||||||
|
on(event: "messageerror", listener: (error: Error) => void): this;
|
||||||
|
on(event: string, listener: (arg: any) => void): this;
|
||||||
|
once(event: "close", listener: (ev: Event) => void): this;
|
||||||
|
once(event: "message", listener: (value: any) => void): this;
|
||||||
|
once(event: "messageerror", listener: (error: Error) => void): this;
|
||||||
|
once(event: string, listener: (arg: any) => void): this;
|
||||||
|
removeListener(event: "close", listener: (ev: Event) => void, options?: EventListenerOptions): this;
|
||||||
|
removeListener(event: "message", listener: (value: any) => void, options?: EventListenerOptions): this;
|
||||||
|
removeListener(event: "messageerror", listener: (error: Error) => void, options?: EventListenerOptions): this;
|
||||||
|
removeListener(event: string, listener: (arg: any) => void, options?: EventListenerOptions): this;
|
||||||
|
// #endregion
|
||||||
|
}
|
||||||
|
var MessagePort: {
|
||||||
|
prototype: MessagePort;
|
||||||
|
new(): MessagePort;
|
||||||
|
};
|
||||||
|
var locks: LockManager;
|
||||||
|
export import structuredClone = globalThis.structuredClone;
|
||||||
|
// #endregion
|
||||||
|
}
|
||||||
|
declare module "worker_threads" {
|
||||||
|
export * from "node:worker_threads";
|
||||||
|
}
|
||||||
682
node_modules/@types/node/zlib.d.ts
generated
vendored
Normal file
682
node_modules/@types/node/zlib.d.ts
generated
vendored
Normal file
@ -0,0 +1,682 @@
|
|||||||
|
/**
|
||||||
|
* The `node:zlib` module provides compression functionality implemented using
|
||||||
|
* Gzip, Deflate/Inflate, and Brotli.
|
||||||
|
*
|
||||||
|
* To access it:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import zlib from 'node:zlib';
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Compression and decompression are built around the Node.js
|
||||||
|
* [Streams API](https://nodejs.org/docs/latest-v25.x/api/stream.html).
|
||||||
|
*
|
||||||
|
* Compressing or decompressing a stream (such as a file) can be accomplished by
|
||||||
|
* piping the source stream through a `zlib` `Transform` stream into a destination
|
||||||
|
* stream:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { createGzip } from 'node:zlib';
|
||||||
|
* import { pipeline } from 'node:stream';
|
||||||
|
* import {
|
||||||
|
* createReadStream,
|
||||||
|
* createWriteStream,
|
||||||
|
* } from 'node:fs';
|
||||||
|
*
|
||||||
|
* const gzip = createGzip();
|
||||||
|
* const source = createReadStream('input.txt');
|
||||||
|
* const destination = createWriteStream('input.txt.gz');
|
||||||
|
*
|
||||||
|
* pipeline(source, gzip, destination, (err) => {
|
||||||
|
* if (err) {
|
||||||
|
* console.error('An error occurred:', err);
|
||||||
|
* process.exitCode = 1;
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Or, Promisified
|
||||||
|
*
|
||||||
|
* import { promisify } from 'node:util';
|
||||||
|
* const pipe = promisify(pipeline);
|
||||||
|
*
|
||||||
|
* async function do_gzip(input, output) {
|
||||||
|
* const gzip = createGzip();
|
||||||
|
* const source = createReadStream(input);
|
||||||
|
* const destination = createWriteStream(output);
|
||||||
|
* await pipe(source, gzip, destination);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* do_gzip('input.txt', 'input.txt.gz')
|
||||||
|
* .catch((err) => {
|
||||||
|
* console.error('An error occurred:', err);
|
||||||
|
* process.exitCode = 1;
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* It is also possible to compress or decompress data in a single step:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { deflate, unzip } from 'node:zlib';
|
||||||
|
*
|
||||||
|
* const input = '.................................';
|
||||||
|
* deflate(input, (err, buffer) => {
|
||||||
|
* if (err) {
|
||||||
|
* console.error('An error occurred:', err);
|
||||||
|
* process.exitCode = 1;
|
||||||
|
* }
|
||||||
|
* console.log(buffer.toString('base64'));
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* const buffer = Buffer.from('eJzT0yMAAGTvBe8=', 'base64');
|
||||||
|
* unzip(buffer, (err, buffer) => {
|
||||||
|
* if (err) {
|
||||||
|
* console.error('An error occurred:', err);
|
||||||
|
* process.exitCode = 1;
|
||||||
|
* }
|
||||||
|
* console.log(buffer.toString());
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Or, Promisified
|
||||||
|
*
|
||||||
|
* import { promisify } from 'node:util';
|
||||||
|
* const do_unzip = promisify(unzip);
|
||||||
|
*
|
||||||
|
* do_unzip(buffer)
|
||||||
|
* .then((buf) => console.log(buf.toString()))
|
||||||
|
* .catch((err) => {
|
||||||
|
* console.error('An error occurred:', err);
|
||||||
|
* process.exitCode = 1;
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v0.5.8
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/zlib.js)
|
||||||
|
*/
|
||||||
|
declare module "node:zlib" {
|
||||||
|
import { NonSharedBuffer } from "node:buffer";
|
||||||
|
import * as stream from "node:stream";
|
||||||
|
interface ZlibOptions {
|
||||||
|
/**
|
||||||
|
* @default constants.Z_NO_FLUSH
|
||||||
|
*/
|
||||||
|
flush?: number | undefined;
|
||||||
|
/**
|
||||||
|
* @default constants.Z_FINISH
|
||||||
|
*/
|
||||||
|
finishFlush?: number | undefined;
|
||||||
|
/**
|
||||||
|
* @default 16*1024
|
||||||
|
*/
|
||||||
|
chunkSize?: number | undefined;
|
||||||
|
windowBits?: number | undefined;
|
||||||
|
/** compression only */
|
||||||
|
level?: number | undefined;
|
||||||
|
/** compression only */
|
||||||
|
memLevel?: number | undefined;
|
||||||
|
/** compression only */
|
||||||
|
strategy?: number | undefined;
|
||||||
|
/** deflate/inflate only, empty dictionary by default */
|
||||||
|
dictionary?: NodeJS.ArrayBufferView | ArrayBuffer | undefined;
|
||||||
|
/**
|
||||||
|
* If `true`, returns an object with `buffer` and `engine`.
|
||||||
|
*/
|
||||||
|
info?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Limits output size when using convenience methods.
|
||||||
|
* @default buffer.kMaxLength
|
||||||
|
*/
|
||||||
|
maxOutputLength?: number | undefined;
|
||||||
|
}
|
||||||
|
interface BrotliOptions {
|
||||||
|
/**
|
||||||
|
* @default constants.BROTLI_OPERATION_PROCESS
|
||||||
|
*/
|
||||||
|
flush?: number | undefined;
|
||||||
|
/**
|
||||||
|
* @default constants.BROTLI_OPERATION_FINISH
|
||||||
|
*/
|
||||||
|
finishFlush?: number | undefined;
|
||||||
|
/**
|
||||||
|
* @default 16*1024
|
||||||
|
*/
|
||||||
|
chunkSize?: number | undefined;
|
||||||
|
params?:
|
||||||
|
| {
|
||||||
|
/**
|
||||||
|
* Each key is a `constants.BROTLI_*` constant.
|
||||||
|
*/
|
||||||
|
[key: number]: boolean | number;
|
||||||
|
}
|
||||||
|
| undefined;
|
||||||
|
/**
|
||||||
|
* Limits output size when using [convenience methods](https://nodejs.org/docs/latest-v25.x/api/zlib.html#convenience-methods).
|
||||||
|
* @default buffer.kMaxLength
|
||||||
|
*/
|
||||||
|
maxOutputLength?: number | undefined;
|
||||||
|
/**
|
||||||
|
* If `true`, returns an object with `buffer` and `engine`.
|
||||||
|
*/
|
||||||
|
info?: boolean | undefined;
|
||||||
|
}
|
||||||
|
interface ZstdOptions {
|
||||||
|
/**
|
||||||
|
* @default constants.ZSTD_e_continue
|
||||||
|
*/
|
||||||
|
flush?: number | undefined;
|
||||||
|
/**
|
||||||
|
* @default constants.ZSTD_e_end
|
||||||
|
*/
|
||||||
|
finishFlush?: number | undefined;
|
||||||
|
/**
|
||||||
|
* @default 16 * 1024
|
||||||
|
*/
|
||||||
|
chunkSize?: number | undefined;
|
||||||
|
/**
|
||||||
|
* Key-value object containing indexed
|
||||||
|
* [Zstd parameters](https://nodejs.org/docs/latest-v25.x/api/zlib.html#zstd-constants).
|
||||||
|
*/
|
||||||
|
params?: { [key: number]: number | boolean } | undefined;
|
||||||
|
/**
|
||||||
|
* Limits output size when using
|
||||||
|
* [convenience methods](https://nodejs.org/docs/latest-v25.x/api/zlib.html#convenience-methods).
|
||||||
|
* @default buffer.kMaxLength
|
||||||
|
*/
|
||||||
|
maxOutputLength?: number | undefined;
|
||||||
|
/**
|
||||||
|
* If `true`, returns an object with `buffer` and `engine`.
|
||||||
|
*/
|
||||||
|
info?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Optional dictionary used to improve compression efficiency when compressing or decompressing data that
|
||||||
|
* shares common patterns with the dictionary.
|
||||||
|
* @since v24.6.0
|
||||||
|
*/
|
||||||
|
dictionary?: NodeJS.ArrayBufferView | undefined;
|
||||||
|
}
|
||||||
|
interface Zlib {
|
||||||
|
readonly bytesWritten: number;
|
||||||
|
shell?: boolean | string | undefined;
|
||||||
|
close(callback?: () => void): void;
|
||||||
|
flush(kind?: number, callback?: () => void): void;
|
||||||
|
flush(callback?: () => void): void;
|
||||||
|
}
|
||||||
|
interface ZlibParams {
|
||||||
|
params(level: number, strategy: number, callback: () => void): void;
|
||||||
|
}
|
||||||
|
interface ZlibReset {
|
||||||
|
reset(): void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @since v10.16.0
|
||||||
|
*/
|
||||||
|
class BrotliCompress extends stream.Transform {
|
||||||
|
constructor(options?: BrotliOptions);
|
||||||
|
}
|
||||||
|
interface BrotliCompress extends stream.Transform, Zlib {}
|
||||||
|
/**
|
||||||
|
* @since v10.16.0
|
||||||
|
*/
|
||||||
|
class BrotliDecompress extends stream.Transform {
|
||||||
|
constructor(options?: BrotliOptions);
|
||||||
|
}
|
||||||
|
interface BrotliDecompress extends stream.Transform, Zlib {}
|
||||||
|
/**
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
class Gzip extends stream.Transform {
|
||||||
|
constructor(options?: ZlibOptions);
|
||||||
|
}
|
||||||
|
interface Gzip extends stream.Transform, Zlib {}
|
||||||
|
/**
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
class Gunzip extends stream.Transform {
|
||||||
|
constructor(options?: ZlibOptions);
|
||||||
|
}
|
||||||
|
interface Gunzip extends stream.Transform, Zlib {}
|
||||||
|
/**
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
class Deflate extends stream.Transform {
|
||||||
|
constructor(options?: ZlibOptions);
|
||||||
|
}
|
||||||
|
interface Deflate extends stream.Transform, Zlib, ZlibReset, ZlibParams {}
|
||||||
|
/**
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
class Inflate extends stream.Transform {
|
||||||
|
constructor(options?: ZlibOptions);
|
||||||
|
}
|
||||||
|
interface Inflate extends stream.Transform, Zlib, ZlibReset {}
|
||||||
|
/**
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
class DeflateRaw extends stream.Transform {
|
||||||
|
constructor(options?: ZlibOptions);
|
||||||
|
}
|
||||||
|
interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams {}
|
||||||
|
/**
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
class InflateRaw extends stream.Transform {
|
||||||
|
constructor(options?: ZlibOptions);
|
||||||
|
}
|
||||||
|
interface InflateRaw extends stream.Transform, Zlib, ZlibReset {}
|
||||||
|
/**
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
class Unzip extends stream.Transform {
|
||||||
|
constructor(options?: ZlibOptions);
|
||||||
|
}
|
||||||
|
interface Unzip extends stream.Transform, Zlib {}
|
||||||
|
/**
|
||||||
|
* @since v22.15.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
class ZstdCompress extends stream.Transform {
|
||||||
|
constructor(options?: ZstdOptions);
|
||||||
|
}
|
||||||
|
interface ZstdCompress extends stream.Transform, Zlib {}
|
||||||
|
/**
|
||||||
|
* @since v22.15.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
class ZstdDecompress extends stream.Transform {
|
||||||
|
constructor(options?: ZstdOptions);
|
||||||
|
}
|
||||||
|
interface ZstdDecompress extends stream.Transform, Zlib {}
|
||||||
|
/**
|
||||||
|
* Computes a 32-bit [Cyclic Redundancy Check](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) checksum of `data`.
|
||||||
|
* If `value` is specified, it is used as the starting value of the checksum, otherwise, 0 is used as the starting value.
|
||||||
|
* @param data When `data` is a string, it will be encoded as UTF-8 before being used for computation.
|
||||||
|
* @param value An optional starting value. It must be a 32-bit unsigned integer. @default 0
|
||||||
|
* @returns A 32-bit unsigned integer containing the checksum.
|
||||||
|
* @since v22.2.0
|
||||||
|
*/
|
||||||
|
function crc32(data: string | NodeJS.ArrayBufferView, value?: number): number;
|
||||||
|
/**
|
||||||
|
* Creates and returns a new `BrotliCompress` object.
|
||||||
|
* @since v11.7.0, v10.16.0
|
||||||
|
*/
|
||||||
|
function createBrotliCompress(options?: BrotliOptions): BrotliCompress;
|
||||||
|
/**
|
||||||
|
* Creates and returns a new `BrotliDecompress` object.
|
||||||
|
* @since v11.7.0, v10.16.0
|
||||||
|
*/
|
||||||
|
function createBrotliDecompress(options?: BrotliOptions): BrotliDecompress;
|
||||||
|
/**
|
||||||
|
* Creates and returns a new `Gzip` object.
|
||||||
|
* See `example`.
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
function createGzip(options?: ZlibOptions): Gzip;
|
||||||
|
/**
|
||||||
|
* Creates and returns a new `Gunzip` object.
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
function createGunzip(options?: ZlibOptions): Gunzip;
|
||||||
|
/**
|
||||||
|
* Creates and returns a new `Deflate` object.
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
function createDeflate(options?: ZlibOptions): Deflate;
|
||||||
|
/**
|
||||||
|
* Creates and returns a new `Inflate` object.
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
function createInflate(options?: ZlibOptions): Inflate;
|
||||||
|
/**
|
||||||
|
* Creates and returns a new `DeflateRaw` object.
|
||||||
|
*
|
||||||
|
* An upgrade of zlib from 1.2.8 to 1.2.11 changed behavior when `windowBits` is set to 8 for raw deflate streams. zlib would automatically set `windowBits` to 9 if was initially set to 8. Newer
|
||||||
|
* versions of zlib will throw an exception,
|
||||||
|
* so Node.js restored the original behavior of upgrading a value of 8 to 9,
|
||||||
|
* since passing `windowBits = 9` to zlib actually results in a compressed stream
|
||||||
|
* that effectively uses an 8-bit window only.
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
function createDeflateRaw(options?: ZlibOptions): DeflateRaw;
|
||||||
|
/**
|
||||||
|
* Creates and returns a new `InflateRaw` object.
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
function createInflateRaw(options?: ZlibOptions): InflateRaw;
|
||||||
|
/**
|
||||||
|
* Creates and returns a new `Unzip` object.
|
||||||
|
* @since v0.5.8
|
||||||
|
*/
|
||||||
|
function createUnzip(options?: ZlibOptions): Unzip;
|
||||||
|
/**
|
||||||
|
* Creates and returns a new `ZstdCompress` object.
|
||||||
|
* @since v22.15.0
|
||||||
|
*/
|
||||||
|
function createZstdCompress(options?: ZstdOptions): ZstdCompress;
|
||||||
|
/**
|
||||||
|
* Creates and returns a new `ZstdDecompress` object.
|
||||||
|
* @since v22.15.0
|
||||||
|
*/
|
||||||
|
function createZstdDecompress(options?: ZstdOptions): ZstdDecompress;
|
||||||
|
type InputType = string | ArrayBuffer | NodeJS.ArrayBufferView;
|
||||||
|
type CompressCallback = (error: Error | null, result: NonSharedBuffer) => void;
|
||||||
|
/**
|
||||||
|
* @since v11.7.0, v10.16.0
|
||||||
|
*/
|
||||||
|
function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
|
||||||
|
function brotliCompress(buf: InputType, callback: CompressCallback): void;
|
||||||
|
namespace brotliCompress {
|
||||||
|
function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<NonSharedBuffer>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Compress a chunk of data with `BrotliCompress`.
|
||||||
|
* @since v11.7.0, v10.16.0
|
||||||
|
*/
|
||||||
|
function brotliCompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer;
|
||||||
|
/**
|
||||||
|
* @since v11.7.0, v10.16.0
|
||||||
|
*/
|
||||||
|
function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
|
||||||
|
function brotliDecompress(buf: InputType, callback: CompressCallback): void;
|
||||||
|
namespace brotliDecompress {
|
||||||
|
function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<NonSharedBuffer>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Decompress a chunk of data with `BrotliDecompress`.
|
||||||
|
* @since v11.7.0, v10.16.0
|
||||||
|
*/
|
||||||
|
function brotliDecompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer;
|
||||||
|
/**
|
||||||
|
* @since v0.6.0
|
||||||
|
*/
|
||||||
|
function deflate(buf: InputType, callback: CompressCallback): void;
|
||||||
|
function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
||||||
|
namespace deflate {
|
||||||
|
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Compress a chunk of data with `Deflate`.
|
||||||
|
* @since v0.11.12
|
||||||
|
*/
|
||||||
|
function deflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
||||||
|
/**
|
||||||
|
* @since v0.6.0
|
||||||
|
*/
|
||||||
|
function deflateRaw(buf: InputType, callback: CompressCallback): void;
|
||||||
|
function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
||||||
|
namespace deflateRaw {
|
||||||
|
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Compress a chunk of data with `DeflateRaw`.
|
||||||
|
* @since v0.11.12
|
||||||
|
*/
|
||||||
|
function deflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
||||||
|
/**
|
||||||
|
* @since v0.6.0
|
||||||
|
*/
|
||||||
|
function gzip(buf: InputType, callback: CompressCallback): void;
|
||||||
|
function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
||||||
|
namespace gzip {
|
||||||
|
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Compress a chunk of data with `Gzip`.
|
||||||
|
* @since v0.11.12
|
||||||
|
*/
|
||||||
|
function gzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
||||||
|
/**
|
||||||
|
* @since v0.6.0
|
||||||
|
*/
|
||||||
|
function gunzip(buf: InputType, callback: CompressCallback): void;
|
||||||
|
function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
||||||
|
namespace gunzip {
|
||||||
|
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Decompress a chunk of data with `Gunzip`.
|
||||||
|
* @since v0.11.12
|
||||||
|
*/
|
||||||
|
function gunzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
||||||
|
/**
|
||||||
|
* @since v0.6.0
|
||||||
|
*/
|
||||||
|
function inflate(buf: InputType, callback: CompressCallback): void;
|
||||||
|
function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
||||||
|
namespace inflate {
|
||||||
|
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Decompress a chunk of data with `Inflate`.
|
||||||
|
* @since v0.11.12
|
||||||
|
*/
|
||||||
|
function inflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
||||||
|
/**
|
||||||
|
* @since v0.6.0
|
||||||
|
*/
|
||||||
|
function inflateRaw(buf: InputType, callback: CompressCallback): void;
|
||||||
|
function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
||||||
|
namespace inflateRaw {
|
||||||
|
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Decompress a chunk of data with `InflateRaw`.
|
||||||
|
* @since v0.11.12
|
||||||
|
*/
|
||||||
|
function inflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
||||||
|
/**
|
||||||
|
* @since v0.6.0
|
||||||
|
*/
|
||||||
|
function unzip(buf: InputType, callback: CompressCallback): void;
|
||||||
|
function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
||||||
|
namespace unzip {
|
||||||
|
function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Decompress a chunk of data with `Unzip`.
|
||||||
|
* @since v0.11.12
|
||||||
|
*/
|
||||||
|
function unzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
||||||
|
/**
|
||||||
|
* @since v22.15.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
function zstdCompress(buf: InputType, callback: CompressCallback): void;
|
||||||
|
function zstdCompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
|
||||||
|
namespace zstdCompress {
|
||||||
|
function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<NonSharedBuffer>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Compress a chunk of data with `ZstdCompress`.
|
||||||
|
* @since v22.15.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
function zstdCompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer;
|
||||||
|
/**
|
||||||
|
* @since v22.15.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
function zstdDecompress(buf: InputType, callback: CompressCallback): void;
|
||||||
|
function zstdDecompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
|
||||||
|
namespace zstdDecompress {
|
||||||
|
function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<NonSharedBuffer>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Decompress a chunk of data with `ZstdDecompress`.
|
||||||
|
* @since v22.15.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
function zstdDecompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer;
|
||||||
|
namespace constants {
|
||||||
|
const BROTLI_DECODE: number;
|
||||||
|
const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number;
|
||||||
|
const BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: number;
|
||||||
|
const BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: number;
|
||||||
|
const BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: number;
|
||||||
|
const BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: number;
|
||||||
|
const BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: number;
|
||||||
|
const BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_DISTANCE: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_PADDING_1: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_PADDING_2: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_RESERVED: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: number;
|
||||||
|
const BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: number;
|
||||||
|
const BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: number;
|
||||||
|
const BROTLI_DECODER_ERROR_UNREACHABLE: number;
|
||||||
|
const BROTLI_DECODER_NEEDS_MORE_INPUT: number;
|
||||||
|
const BROTLI_DECODER_NEEDS_MORE_OUTPUT: number;
|
||||||
|
const BROTLI_DECODER_NO_ERROR: number;
|
||||||
|
const BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: number;
|
||||||
|
const BROTLI_DECODER_PARAM_LARGE_WINDOW: number;
|
||||||
|
const BROTLI_DECODER_RESULT_ERROR: number;
|
||||||
|
const BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: number;
|
||||||
|
const BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: number;
|
||||||
|
const BROTLI_DECODER_RESULT_SUCCESS: number;
|
||||||
|
const BROTLI_DECODER_SUCCESS: number;
|
||||||
|
const BROTLI_DEFAULT_MODE: number;
|
||||||
|
const BROTLI_DEFAULT_QUALITY: number;
|
||||||
|
const BROTLI_DEFAULT_WINDOW: number;
|
||||||
|
const BROTLI_ENCODE: number;
|
||||||
|
const BROTLI_LARGE_MAX_WINDOW_BITS: number;
|
||||||
|
const BROTLI_MAX_INPUT_BLOCK_BITS: number;
|
||||||
|
const BROTLI_MAX_QUALITY: number;
|
||||||
|
const BROTLI_MAX_WINDOW_BITS: number;
|
||||||
|
const BROTLI_MIN_INPUT_BLOCK_BITS: number;
|
||||||
|
const BROTLI_MIN_QUALITY: number;
|
||||||
|
const BROTLI_MIN_WINDOW_BITS: number;
|
||||||
|
const BROTLI_MODE_FONT: number;
|
||||||
|
const BROTLI_MODE_GENERIC: number;
|
||||||
|
const BROTLI_MODE_TEXT: number;
|
||||||
|
const BROTLI_OPERATION_EMIT_METADATA: number;
|
||||||
|
const BROTLI_OPERATION_FINISH: number;
|
||||||
|
const BROTLI_OPERATION_FLUSH: number;
|
||||||
|
const BROTLI_OPERATION_PROCESS: number;
|
||||||
|
const BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: number;
|
||||||
|
const BROTLI_PARAM_LARGE_WINDOW: number;
|
||||||
|
const BROTLI_PARAM_LGBLOCK: number;
|
||||||
|
const BROTLI_PARAM_LGWIN: number;
|
||||||
|
const BROTLI_PARAM_MODE: number;
|
||||||
|
const BROTLI_PARAM_NDIRECT: number;
|
||||||
|
const BROTLI_PARAM_NPOSTFIX: number;
|
||||||
|
const BROTLI_PARAM_QUALITY: number;
|
||||||
|
const BROTLI_PARAM_SIZE_HINT: number;
|
||||||
|
const DEFLATE: number;
|
||||||
|
const DEFLATERAW: number;
|
||||||
|
const GUNZIP: number;
|
||||||
|
const GZIP: number;
|
||||||
|
const INFLATE: number;
|
||||||
|
const INFLATERAW: number;
|
||||||
|
const UNZIP: number;
|
||||||
|
const ZLIB_VERNUM: number;
|
||||||
|
const ZSTD_CLEVEL_DEFAULT: number;
|
||||||
|
const ZSTD_COMPRESS: number;
|
||||||
|
const ZSTD_DECOMPRESS: number;
|
||||||
|
const ZSTD_btlazy2: number;
|
||||||
|
const ZSTD_btopt: number;
|
||||||
|
const ZSTD_btultra: number;
|
||||||
|
const ZSTD_btultra2: number;
|
||||||
|
const ZSTD_c_chainLog: number;
|
||||||
|
const ZSTD_c_checksumFlag: number;
|
||||||
|
const ZSTD_c_compressionLevel: number;
|
||||||
|
const ZSTD_c_contentSizeFlag: number;
|
||||||
|
const ZSTD_c_dictIDFlag: number;
|
||||||
|
const ZSTD_c_enableLongDistanceMatching: number;
|
||||||
|
const ZSTD_c_hashLog: number;
|
||||||
|
const ZSTD_c_jobSize: number;
|
||||||
|
const ZSTD_c_ldmBucketSizeLog: number;
|
||||||
|
const ZSTD_c_ldmHashLog: number;
|
||||||
|
const ZSTD_c_ldmHashRateLog: number;
|
||||||
|
const ZSTD_c_ldmMinMatch: number;
|
||||||
|
const ZSTD_c_minMatch: number;
|
||||||
|
const ZSTD_c_nbWorkers: number;
|
||||||
|
const ZSTD_c_overlapLog: number;
|
||||||
|
const ZSTD_c_searchLog: number;
|
||||||
|
const ZSTD_c_strategy: number;
|
||||||
|
const ZSTD_c_targetLength: number;
|
||||||
|
const ZSTD_c_windowLog: number;
|
||||||
|
const ZSTD_d_windowLogMax: number;
|
||||||
|
const ZSTD_dfast: number;
|
||||||
|
const ZSTD_e_continue: number;
|
||||||
|
const ZSTD_e_end: number;
|
||||||
|
const ZSTD_e_flush: number;
|
||||||
|
const ZSTD_error_GENERIC: number;
|
||||||
|
const ZSTD_error_checksum_wrong: number;
|
||||||
|
const ZSTD_error_corruption_detected: number;
|
||||||
|
const ZSTD_error_dictionaryCreation_failed: number;
|
||||||
|
const ZSTD_error_dictionary_corrupted: number;
|
||||||
|
const ZSTD_error_dictionary_wrong: number;
|
||||||
|
const ZSTD_error_dstBuffer_null: number;
|
||||||
|
const ZSTD_error_dstSize_tooSmall: number;
|
||||||
|
const ZSTD_error_frameParameter_unsupported: number;
|
||||||
|
const ZSTD_error_frameParameter_windowTooLarge: number;
|
||||||
|
const ZSTD_error_init_missing: number;
|
||||||
|
const ZSTD_error_literals_headerWrong: number;
|
||||||
|
const ZSTD_error_maxSymbolValue_tooLarge: number;
|
||||||
|
const ZSTD_error_maxSymbolValue_tooSmall: number;
|
||||||
|
const ZSTD_error_memory_allocation: number;
|
||||||
|
const ZSTD_error_noForwardProgress_destFull: number;
|
||||||
|
const ZSTD_error_noForwardProgress_inputEmpty: number;
|
||||||
|
const ZSTD_error_no_error: number;
|
||||||
|
const ZSTD_error_parameter_combination_unsupported: number;
|
||||||
|
const ZSTD_error_parameter_outOfBound: number;
|
||||||
|
const ZSTD_error_parameter_unsupported: number;
|
||||||
|
const ZSTD_error_prefix_unknown: number;
|
||||||
|
const ZSTD_error_srcSize_wrong: number;
|
||||||
|
const ZSTD_error_stabilityCondition_notRespected: number;
|
||||||
|
const ZSTD_error_stage_wrong: number;
|
||||||
|
const ZSTD_error_tableLog_tooLarge: number;
|
||||||
|
const ZSTD_error_version_unsupported: number;
|
||||||
|
const ZSTD_error_workSpace_tooSmall: number;
|
||||||
|
const ZSTD_fast: number;
|
||||||
|
const ZSTD_greedy: number;
|
||||||
|
const ZSTD_lazy: number;
|
||||||
|
const ZSTD_lazy2: number;
|
||||||
|
const Z_BEST_COMPRESSION: number;
|
||||||
|
const Z_BEST_SPEED: number;
|
||||||
|
const Z_BLOCK: number;
|
||||||
|
const Z_BUF_ERROR: number;
|
||||||
|
const Z_DATA_ERROR: number;
|
||||||
|
const Z_DEFAULT_CHUNK: number;
|
||||||
|
const Z_DEFAULT_COMPRESSION: number;
|
||||||
|
const Z_DEFAULT_LEVEL: number;
|
||||||
|
const Z_DEFAULT_MEMLEVEL: number;
|
||||||
|
const Z_DEFAULT_STRATEGY: number;
|
||||||
|
const Z_DEFAULT_WINDOWBITS: number;
|
||||||
|
const Z_ERRNO: number;
|
||||||
|
const Z_FILTERED: number;
|
||||||
|
const Z_FINISH: number;
|
||||||
|
const Z_FIXED: number;
|
||||||
|
const Z_FULL_FLUSH: number;
|
||||||
|
const Z_HUFFMAN_ONLY: number;
|
||||||
|
const Z_MAX_CHUNK: number;
|
||||||
|
const Z_MAX_LEVEL: number;
|
||||||
|
const Z_MAX_MEMLEVEL: number;
|
||||||
|
const Z_MAX_WINDOWBITS: number;
|
||||||
|
const Z_MEM_ERROR: number;
|
||||||
|
const Z_MIN_CHUNK: number;
|
||||||
|
const Z_MIN_LEVEL: number;
|
||||||
|
const Z_MIN_MEMLEVEL: number;
|
||||||
|
const Z_MIN_WINDOWBITS: number;
|
||||||
|
const Z_NEED_DICT: number;
|
||||||
|
const Z_NO_COMPRESSION: number;
|
||||||
|
const Z_NO_FLUSH: number;
|
||||||
|
const Z_OK: number;
|
||||||
|
const Z_PARTIAL_FLUSH: number;
|
||||||
|
const Z_RLE: number;
|
||||||
|
const Z_STREAM_END: number;
|
||||||
|
const Z_STREAM_ERROR: number;
|
||||||
|
const Z_SYNC_FLUSH: number;
|
||||||
|
const Z_VERSION_ERROR: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module "zlib" {
|
||||||
|
export * from "node:zlib";
|
||||||
|
}
|
||||||
21
node_modules/undici-types/LICENSE
generated
vendored
Normal file
21
node_modules/undici-types/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Matteo Collina and Undici contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
6
node_modules/undici-types/README.md
generated
vendored
Normal file
6
node_modules/undici-types/README.md
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# undici-types
|
||||||
|
|
||||||
|
This package is a dual-publish of the [undici](https://www.npmjs.com/package/undici) library types. The `undici` package **still contains types**. This package is for users who _only_ need undici types (such as for `@types/node`). It is published alongside every release of `undici`, so you can always use the same version.
|
||||||
|
|
||||||
|
- [GitHub nodejs/undici](https://github.com/nodejs/undici)
|
||||||
|
- [Undici Documentation](https://undici.nodejs.org/#/)
|
||||||
32
node_modules/undici-types/agent.d.ts
generated
vendored
Normal file
32
node_modules/undici-types/agent.d.ts
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { URL } from 'node:url'
|
||||||
|
import Pool from './pool'
|
||||||
|
import Dispatcher from './dispatcher'
|
||||||
|
import TClientStats from './client-stats'
|
||||||
|
import TPoolStats from './pool-stats'
|
||||||
|
|
||||||
|
export default Agent
|
||||||
|
|
||||||
|
declare class Agent extends Dispatcher {
|
||||||
|
constructor (opts?: Agent.Options)
|
||||||
|
/** `true` after `dispatcher.close()` has been called. */
|
||||||
|
closed: boolean
|
||||||
|
/** `true` after `dispatcher.destroyed()` has been called or `dispatcher.close()` has been called and the dispatcher shutdown has completed. */
|
||||||
|
destroyed: boolean
|
||||||
|
/** Dispatches a request. */
|
||||||
|
dispatch (options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
|
||||||
|
/** Aggregate stats for a Agent by origin. */
|
||||||
|
readonly stats: Record<string, TClientStats | TPoolStats>
|
||||||
|
}
|
||||||
|
|
||||||
|
declare namespace Agent {
|
||||||
|
export interface Options extends Pool.Options {
|
||||||
|
/** Default: `(origin, opts) => new Pool(origin, opts)`. */
|
||||||
|
factory?(origin: string | URL, opts: Object): Dispatcher;
|
||||||
|
|
||||||
|
interceptors?: { Agent?: readonly Dispatcher.DispatchInterceptor[] } & Pool.Options['interceptors']
|
||||||
|
maxOrigins?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DispatchOptions extends Dispatcher.DispatchOptions {
|
||||||
|
}
|
||||||
|
}
|
||||||
43
node_modules/undici-types/api.d.ts
generated
vendored
Normal file
43
node_modules/undici-types/api.d.ts
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import { URL, UrlObject } from 'node:url'
|
||||||
|
import { Duplex } from 'node:stream'
|
||||||
|
import Dispatcher from './dispatcher'
|
||||||
|
|
||||||
|
/** Performs an HTTP request. */
|
||||||
|
declare function request<TOpaque = null> (
|
||||||
|
url: string | URL | UrlObject,
|
||||||
|
options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.RequestOptions<TOpaque>, 'origin' | 'path' | 'method'> & Partial<Pick<Dispatcher.RequestOptions, 'method'>>,
|
||||||
|
): Promise<Dispatcher.ResponseData<TOpaque>>
|
||||||
|
|
||||||
|
/** A faster version of `request`. */
|
||||||
|
declare function stream<TOpaque = null> (
|
||||||
|
url: string | URL | UrlObject,
|
||||||
|
options: { dispatcher?: Dispatcher } & Omit<Dispatcher.RequestOptions<TOpaque>, 'origin' | 'path'>,
|
||||||
|
factory: Dispatcher.StreamFactory<TOpaque>
|
||||||
|
): Promise<Dispatcher.StreamData<TOpaque>>
|
||||||
|
|
||||||
|
/** For easy use with `stream.pipeline`. */
|
||||||
|
declare function pipeline<TOpaque = null> (
|
||||||
|
url: string | URL | UrlObject,
|
||||||
|
options: { dispatcher?: Dispatcher } & Omit<Dispatcher.PipelineOptions<TOpaque>, 'origin' | 'path'>,
|
||||||
|
handler: Dispatcher.PipelineHandler<TOpaque>
|
||||||
|
): Duplex
|
||||||
|
|
||||||
|
/** Starts two-way communications with the requested resource. */
|
||||||
|
declare function connect<TOpaque = null> (
|
||||||
|
url: string | URL | UrlObject,
|
||||||
|
options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.ConnectOptions<TOpaque>, 'origin' | 'path'>
|
||||||
|
): Promise<Dispatcher.ConnectData<TOpaque>>
|
||||||
|
|
||||||
|
/** Upgrade to a different protocol. */
|
||||||
|
declare function upgrade (
|
||||||
|
url: string | URL | UrlObject,
|
||||||
|
options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.UpgradeOptions, 'origin' | 'path'>
|
||||||
|
): Promise<Dispatcher.UpgradeData>
|
||||||
|
|
||||||
|
export {
|
||||||
|
request,
|
||||||
|
stream,
|
||||||
|
pipeline,
|
||||||
|
connect,
|
||||||
|
upgrade
|
||||||
|
}
|
||||||
30
node_modules/undici-types/balanced-pool.d.ts
generated
vendored
Normal file
30
node_modules/undici-types/balanced-pool.d.ts
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import Pool from './pool'
|
||||||
|
import Dispatcher from './dispatcher'
|
||||||
|
import { URL } from 'node:url'
|
||||||
|
|
||||||
|
export default BalancedPool
|
||||||
|
|
||||||
|
type BalancedPoolConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>
|
||||||
|
|
||||||
|
declare class BalancedPool extends Dispatcher {
|
||||||
|
constructor (url: string | string[] | URL | URL[], options?: Pool.Options)
|
||||||
|
|
||||||
|
addUpstream (upstream: string | URL): BalancedPool
|
||||||
|
removeUpstream (upstream: string | URL): BalancedPool
|
||||||
|
getUpstream (upstream: string | URL): Pool | undefined
|
||||||
|
upstreams: Array<string>
|
||||||
|
|
||||||
|
/** `true` after `pool.close()` has been called. */
|
||||||
|
closed: boolean
|
||||||
|
/** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */
|
||||||
|
destroyed: boolean
|
||||||
|
|
||||||
|
// Override dispatcher APIs.
|
||||||
|
override connect (
|
||||||
|
options: BalancedPoolConnectOptions
|
||||||
|
): Promise<Dispatcher.ConnectData>
|
||||||
|
override connect (
|
||||||
|
options: BalancedPoolConnectOptions,
|
||||||
|
callback: (err: Error | null, data: Dispatcher.ConnectData) => void
|
||||||
|
): void
|
||||||
|
}
|
||||||
173
node_modules/undici-types/cache-interceptor.d.ts
generated
vendored
Normal file
173
node_modules/undici-types/cache-interceptor.d.ts
generated
vendored
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
import { Readable, Writable } from 'node:stream'
|
||||||
|
|
||||||
|
export default CacheHandler
|
||||||
|
|
||||||
|
declare namespace CacheHandler {
|
||||||
|
export type CacheMethods = 'GET' | 'HEAD' | 'OPTIONS' | 'TRACE'
|
||||||
|
|
||||||
|
export interface CacheHandlerOptions {
|
||||||
|
store: CacheStore
|
||||||
|
|
||||||
|
cacheByDefault?: number
|
||||||
|
|
||||||
|
type?: CacheOptions['type']
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CacheOptions {
|
||||||
|
store?: CacheStore
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The methods to cache
|
||||||
|
* Note we can only cache safe methods. Unsafe methods (i.e. PUT, POST)
|
||||||
|
* invalidate the cache for a origin.
|
||||||
|
* @see https://www.rfc-editor.org/rfc/rfc9111.html#name-invalidating-stored-respons
|
||||||
|
* @see https://www.rfc-editor.org/rfc/rfc9110#section-9.2.1
|
||||||
|
*/
|
||||||
|
methods?: CacheMethods[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RFC9111 allows for caching responses that we aren't explicitly told to
|
||||||
|
* cache or to not cache.
|
||||||
|
* @see https://www.rfc-editor.org/rfc/rfc9111.html#section-3-5
|
||||||
|
* @default undefined
|
||||||
|
*/
|
||||||
|
cacheByDefault?: number
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO docs
|
||||||
|
* @default 'shared'
|
||||||
|
*/
|
||||||
|
type?: 'shared' | 'private'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CacheControlDirectives {
|
||||||
|
'max-stale'?: number;
|
||||||
|
'min-fresh'?: number;
|
||||||
|
'max-age'?: number;
|
||||||
|
's-maxage'?: number;
|
||||||
|
'stale-while-revalidate'?: number;
|
||||||
|
'stale-if-error'?: number;
|
||||||
|
public?: true;
|
||||||
|
private?: true | string[];
|
||||||
|
'no-store'?: true;
|
||||||
|
'no-cache'?: true | string[];
|
||||||
|
'must-revalidate'?: true;
|
||||||
|
'proxy-revalidate'?: true;
|
||||||
|
immutable?: true;
|
||||||
|
'no-transform'?: true;
|
||||||
|
'must-understand'?: true;
|
||||||
|
'only-if-cached'?: true;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CacheKey {
|
||||||
|
origin: string
|
||||||
|
method: string
|
||||||
|
path: string
|
||||||
|
headers?: Record<string, string | string[]>
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CacheValue {
|
||||||
|
statusCode: number
|
||||||
|
statusMessage: string
|
||||||
|
headers: Record<string, string | string[]>
|
||||||
|
vary?: Record<string, string | string[] | null>
|
||||||
|
etag?: string
|
||||||
|
cacheControlDirectives?: CacheControlDirectives
|
||||||
|
cachedAt: number
|
||||||
|
staleAt: number
|
||||||
|
deleteAt: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DeleteByUri {
|
||||||
|
origin: string
|
||||||
|
method: string
|
||||||
|
path: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetResult = {
|
||||||
|
statusCode: number
|
||||||
|
statusMessage: string
|
||||||
|
headers: Record<string, string | string[]>
|
||||||
|
vary?: Record<string, string | string[] | null>
|
||||||
|
etag?: string
|
||||||
|
body?: Readable | Iterable<Buffer> | AsyncIterable<Buffer> | Buffer | Iterable<string> | AsyncIterable<string> | string
|
||||||
|
cacheControlDirectives: CacheControlDirectives,
|
||||||
|
cachedAt: number
|
||||||
|
staleAt: number
|
||||||
|
deleteAt: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Underlying storage provider for cached responses
|
||||||
|
*/
|
||||||
|
export interface CacheStore {
|
||||||
|
get(key: CacheKey): GetResult | Promise<GetResult | undefined> | undefined
|
||||||
|
|
||||||
|
createWriteStream(key: CacheKey, val: CacheValue): Writable | undefined
|
||||||
|
|
||||||
|
delete(key: CacheKey): void | Promise<void>
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MemoryCacheStoreOpts {
|
||||||
|
/**
|
||||||
|
* @default Infinity
|
||||||
|
*/
|
||||||
|
maxCount?: number
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @default Infinity
|
||||||
|
*/
|
||||||
|
maxSize?: number
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @default Infinity
|
||||||
|
*/
|
||||||
|
maxEntrySize?: number
|
||||||
|
|
||||||
|
errorCallback?: (err: Error) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export class MemoryCacheStore implements CacheStore {
|
||||||
|
constructor (opts?: MemoryCacheStoreOpts)
|
||||||
|
|
||||||
|
get (key: CacheKey): GetResult | Promise<GetResult | undefined> | undefined
|
||||||
|
|
||||||
|
createWriteStream (key: CacheKey, value: CacheValue): Writable | undefined
|
||||||
|
|
||||||
|
delete (key: CacheKey): void | Promise<void>
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SqliteCacheStoreOpts {
|
||||||
|
/**
|
||||||
|
* Location of the database
|
||||||
|
* @default ':memory:'
|
||||||
|
*/
|
||||||
|
location?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @default Infinity
|
||||||
|
*/
|
||||||
|
maxCount?: number
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @default Infinity
|
||||||
|
*/
|
||||||
|
maxEntrySize?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SqliteCacheStore implements CacheStore {
|
||||||
|
constructor (opts?: SqliteCacheStoreOpts)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the connection to the database
|
||||||
|
*/
|
||||||
|
close (): void
|
||||||
|
|
||||||
|
get (key: CacheKey): GetResult | Promise<GetResult | undefined> | undefined
|
||||||
|
|
||||||
|
createWriteStream (key: CacheKey, value: CacheValue): Writable | undefined
|
||||||
|
|
||||||
|
delete (key: CacheKey): void | Promise<void>
|
||||||
|
}
|
||||||
|
}
|
||||||
36
node_modules/undici-types/cache.d.ts
generated
vendored
Normal file
36
node_modules/undici-types/cache.d.ts
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import type { RequestInfo, Response, Request } from './fetch'
|
||||||
|
|
||||||
|
export interface CacheStorage {
|
||||||
|
match (request: RequestInfo, options?: MultiCacheQueryOptions): Promise<Response | undefined>,
|
||||||
|
has (cacheName: string): Promise<boolean>,
|
||||||
|
open (cacheName: string): Promise<Cache>,
|
||||||
|
delete (cacheName: string): Promise<boolean>,
|
||||||
|
keys (): Promise<string[]>
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const CacheStorage: {
|
||||||
|
prototype: CacheStorage
|
||||||
|
new(): CacheStorage
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Cache {
|
||||||
|
match (request: RequestInfo, options?: CacheQueryOptions): Promise<Response | undefined>,
|
||||||
|
matchAll (request?: RequestInfo, options?: CacheQueryOptions): Promise<readonly Response[]>,
|
||||||
|
add (request: RequestInfo): Promise<undefined>,
|
||||||
|
addAll (requests: RequestInfo[]): Promise<undefined>,
|
||||||
|
put (request: RequestInfo, response: Response): Promise<undefined>,
|
||||||
|
delete (request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>,
|
||||||
|
keys (request?: RequestInfo, options?: CacheQueryOptions): Promise<readonly Request[]>
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CacheQueryOptions {
|
||||||
|
ignoreSearch?: boolean,
|
||||||
|
ignoreMethod?: boolean,
|
||||||
|
ignoreVary?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MultiCacheQueryOptions extends CacheQueryOptions {
|
||||||
|
cacheName?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare const caches: CacheStorage
|
||||||
15
node_modules/undici-types/client-stats.d.ts
generated
vendored
Normal file
15
node_modules/undici-types/client-stats.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import Client from './client'
|
||||||
|
|
||||||
|
export default ClientStats
|
||||||
|
|
||||||
|
declare class ClientStats {
|
||||||
|
constructor (pool: Client)
|
||||||
|
/** If socket has open connection. */
|
||||||
|
connected: boolean
|
||||||
|
/** Number of open socket connections in this client that do not have an active request. */
|
||||||
|
pending: number
|
||||||
|
/** Number of currently active requests of this client. */
|
||||||
|
running: number
|
||||||
|
/** Number of active, pending, or queued requests of this client. */
|
||||||
|
size: number
|
||||||
|
}
|
||||||
108
node_modules/undici-types/client.d.ts
generated
vendored
Normal file
108
node_modules/undici-types/client.d.ts
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
import { URL } from 'node:url'
|
||||||
|
import Dispatcher from './dispatcher'
|
||||||
|
import buildConnector from './connector'
|
||||||
|
import TClientStats from './client-stats'
|
||||||
|
|
||||||
|
type ClientConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
|
||||||
|
*/
|
||||||
|
export class Client extends Dispatcher {
|
||||||
|
constructor (url: string | URL, options?: Client.Options)
|
||||||
|
/** Property to get and set the pipelining factor. */
|
||||||
|
pipelining: number
|
||||||
|
/** `true` after `client.close()` has been called. */
|
||||||
|
closed: boolean
|
||||||
|
/** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */
|
||||||
|
destroyed: boolean
|
||||||
|
/** Aggregate stats for a Client. */
|
||||||
|
readonly stats: TClientStats
|
||||||
|
|
||||||
|
// Override dispatcher APIs.
|
||||||
|
override connect (
|
||||||
|
options: ClientConnectOptions
|
||||||
|
): Promise<Dispatcher.ConnectData>
|
||||||
|
override connect (
|
||||||
|
options: ClientConnectOptions,
|
||||||
|
callback: (err: Error | null, data: Dispatcher.ConnectData) => void
|
||||||
|
): void
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare namespace Client {
|
||||||
|
export interface OptionsInterceptors {
|
||||||
|
Client: readonly Dispatcher.DispatchInterceptor[];
|
||||||
|
}
|
||||||
|
export interface Options {
|
||||||
|
/** TODO */
|
||||||
|
interceptors?: OptionsInterceptors;
|
||||||
|
/** The maximum length of request headers in bytes. Default: Node.js' `--max-http-header-size` or `16384` (16KiB). */
|
||||||
|
maxHeaderSize?: number;
|
||||||
|
/** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */
|
||||||
|
headersTimeout?: number;
|
||||||
|
/** @deprecated unsupported socketTimeout, use headersTimeout & bodyTimeout instead */
|
||||||
|
socketTimeout?: never;
|
||||||
|
/** @deprecated unsupported requestTimeout, use headersTimeout & bodyTimeout instead */
|
||||||
|
requestTimeout?: never;
|
||||||
|
/** TODO */
|
||||||
|
connectTimeout?: number;
|
||||||
|
/** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */
|
||||||
|
bodyTimeout?: number;
|
||||||
|
/** @deprecated unsupported idleTimeout, use keepAliveTimeout instead */
|
||||||
|
idleTimeout?: never;
|
||||||
|
/** @deprecated unsupported keepAlive, use pipelining=0 instead */
|
||||||
|
keepAlive?: never;
|
||||||
|
/** the timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */
|
||||||
|
keepAliveTimeout?: number;
|
||||||
|
/** @deprecated unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead */
|
||||||
|
maxKeepAliveTimeout?: never;
|
||||||
|
/** the maximum allowed `idleTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */
|
||||||
|
keepAliveMaxTimeout?: number;
|
||||||
|
/** A number of milliseconds subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
|
||||||
|
keepAliveTimeoutThreshold?: number;
|
||||||
|
/** TODO */
|
||||||
|
socketPath?: string;
|
||||||
|
/** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */
|
||||||
|
pipelining?: number;
|
||||||
|
/** @deprecated use the connect option instead */
|
||||||
|
tls?: never;
|
||||||
|
/** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
|
||||||
|
strictContentLength?: boolean;
|
||||||
|
/** TODO */
|
||||||
|
maxCachedSessions?: number;
|
||||||
|
/** TODO */
|
||||||
|
connect?: Partial<buildConnector.BuildOptions> | buildConnector.connector;
|
||||||
|
/** TODO */
|
||||||
|
maxRequestsPerClient?: number;
|
||||||
|
/** TODO */
|
||||||
|
localAddress?: string;
|
||||||
|
/** Max response body size in bytes, -1 is disabled */
|
||||||
|
maxResponseSize?: number;
|
||||||
|
/** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
|
||||||
|
autoSelectFamily?: boolean;
|
||||||
|
/** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */
|
||||||
|
autoSelectFamilyAttemptTimeout?: number;
|
||||||
|
/**
|
||||||
|
* @description Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
allowH2?: boolean;
|
||||||
|
/**
|
||||||
|
* @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
|
||||||
|
* @default 100
|
||||||
|
*/
|
||||||
|
maxConcurrentStreams?: number;
|
||||||
|
}
|
||||||
|
export interface SocketInfo {
|
||||||
|
localAddress?: string
|
||||||
|
localPort?: number
|
||||||
|
remoteAddress?: string
|
||||||
|
remotePort?: number
|
||||||
|
remoteFamily?: string
|
||||||
|
timeout?: number
|
||||||
|
bytesWritten?: number
|
||||||
|
bytesRead?: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Client
|
||||||
34
node_modules/undici-types/connector.d.ts
generated
vendored
Normal file
34
node_modules/undici-types/connector.d.ts
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import { TLSSocket, ConnectionOptions } from 'node:tls'
|
||||||
|
import { IpcNetConnectOpts, Socket, TcpNetConnectOpts } from 'node:net'
|
||||||
|
|
||||||
|
export default buildConnector
|
||||||
|
declare function buildConnector (options?: buildConnector.BuildOptions): buildConnector.connector
|
||||||
|
|
||||||
|
declare namespace buildConnector {
|
||||||
|
export type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & {
|
||||||
|
allowH2?: boolean;
|
||||||
|
maxCachedSessions?: number | null;
|
||||||
|
socketPath?: string | null;
|
||||||
|
timeout?: number | null;
|
||||||
|
port?: number;
|
||||||
|
keepAlive?: boolean | null;
|
||||||
|
keepAliveInitialDelay?: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Options {
|
||||||
|
hostname: string
|
||||||
|
host?: string
|
||||||
|
protocol: string
|
||||||
|
port: string
|
||||||
|
servername?: string
|
||||||
|
localAddress?: string | null
|
||||||
|
httpSocket?: Socket
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Callback = (...args: CallbackArgs) => void
|
||||||
|
type CallbackArgs = [null, Socket | TLSSocket] | [Error, null]
|
||||||
|
|
||||||
|
export interface connector {
|
||||||
|
(options: buildConnector.Options, callback: buildConnector.Callback): void
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user