From a1ea191d508feb8485aceba848389d49f80ca2dc Mon Sep 17 00:00:00 2001 From: James Ives Date: Wed, 12 Jul 2023 01:42:33 +0000 Subject: [PATCH] =?UTF-8?q?Deploy=20Production=20Code=20for=20Commit=20a8b?= =?UTF-8?q?d9aef1855024c235ad911985c97e153ddc9c4=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- node_modules/@types/node/README.md | 2 +- node_modules/@types/node/buffer.d.ts | 11 +- node_modules/@types/node/cluster.d.ts | 4 + node_modules/@types/node/crypto.d.ts | 36 +- node_modules/@types/node/fs.d.ts | 11 +- node_modules/@types/node/fs/promises.d.ts | 2 +- node_modules/@types/node/index.d.ts | 2 +- node_modules/@types/node/module.d.ts | 21 +- node_modules/@types/node/net.d.ts | 14 +- node_modules/@types/node/package.json | 4 +- node_modules/@types/node/process.d.ts | 51 +- node_modules/@types/node/test.d.ts | 617 ++++++++++++++---- node_modules/@types/node/tls.d.ts | 11 + node_modules/@types/node/ts4.8/buffer.d.ts | 9 +- node_modules/@types/node/ts4.8/cluster.d.ts | 4 + node_modules/@types/node/ts4.8/crypto.d.ts | 36 +- node_modules/@types/node/ts4.8/fs.d.ts | 11 +- .../@types/node/ts4.8/fs/promises.d.ts | 2 +- node_modules/@types/node/ts4.8/module.d.ts | 21 +- node_modules/@types/node/ts4.8/net.d.ts | 14 +- node_modules/@types/node/ts4.8/process.d.ts | 51 +- node_modules/@types/node/ts4.8/test.d.ts | 507 +++++++++++--- node_modules/@types/node/ts4.8/tls.d.ts | 11 + node_modules/@types/node/ts4.8/tty.d.ts | 5 +- node_modules/@types/node/ts4.8/util.d.ts | 86 ++- node_modules/@types/node/ts4.8/wasi.d.ts | 4 +- node_modules/@types/node/tty.d.ts | 5 +- node_modules/@types/node/util.d.ts | 86 ++- node_modules/@types/node/wasi.d.ts | 4 +- .../execa/node_modules/semver/CHANGELOG.md | 39 -- .../execa/node_modules/semver/package.json | 28 +- .../execa/node_modules/semver/semver.js | 94 ++- 32 files changed, 1356 insertions(+), 447 deletions(-) delete mode 100644 node_modules/execa/node_modules/semver/CHANGELOG.md diff --git a/node_modules/@types/node/README.md b/node_modules/@types/node/README.md index d41c4d4a..c55be700 100755 --- a/node_modules/@types/node/README.md +++ b/node_modules/@types/node/README.md @@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/). Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node. ### Additional Details - * Last updated: Thu, 25 May 2023 20:34:26 GMT + * Last updated: Fri, 07 Jul 2023 23:02:42 GMT * Dependencies: none * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone` diff --git a/node_modules/@types/node/buffer.d.ts b/node_modules/@types/node/buffer.d.ts index bf537b8a..179a8256 100755 --- a/node_modules/@types/node/buffer.d.ts +++ b/node_modules/@types/node/buffer.d.ts @@ -299,6 +299,10 @@ declare module '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. * @@ -526,7 +530,7 @@ declare module '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 | Buffer | number, encoding?: BufferEncoding): Buffer; + 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. * @@ -550,9 +554,8 @@ declare module 'buffer' { * 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)`, `Buffer.concat()`, and the - * deprecated`new Buffer(size)` constructor only when `size` is less than or equal - * to `Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). + * 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 or equal to`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)`. diff --git a/node_modules/@types/node/cluster.d.ts b/node_modules/@types/node/cluster.d.ts index 6ee51772..4fa9aef1 100755 --- a/node_modules/@types/node/cluster.d.ts +++ b/node_modules/@types/node/cluster.d.ts @@ -56,6 +56,7 @@ declare module 'cluster' { import * as child from 'node:child_process'; import EventEmitter = require('node:events'); import * as net from 'node:net'; + type SerializationType = 'json' | 'advanced'; export interface ClusterSettings { execArgv?: string[] | undefined; // default: process.execArgv exec?: string | undefined; @@ -65,6 +66,9 @@ declare module 'cluster' { uid?: number | undefined; gid?: number | undefined; inspectPort?: number | (() => number) | undefined; + serialization?: SerializationType | undefined; + cwd?: string | undefined; + windowsHide?: boolean | undefined; } export interface Address { address: string; diff --git a/node_modules/@types/node/crypto.d.ts b/node_modules/@types/node/crypto.d.ts index 9d5a2726..90184641 100755 --- a/node_modules/@types/node/crypto.d.ts +++ b/node_modules/@types/node/crypto.d.ts @@ -21,14 +21,14 @@ declare module 'crypto' { import { PeerCertificate } from 'node:tls'; /** * SPKAC is a Certificate Signing Request mechanism originally implemented by - * Netscape and was specified formally as part of [HTML5's `keygen` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/keygen). + * Netscape and was specified formally as part of HTML5's `keygen` element. * * `` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects * should not use this element anymore. * * The `node:crypto` module provides the `Certificate` class for working with SPKAC * data. The most common usage is handling output generated by the HTML5`` element. Node.js uses [OpenSSL's SPKAC - * implementation](https://www.openssl.org/docs/man1.1.0/apps/openssl-spkac.html) internally. + * implementation](https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html) internally. * @since v0.11.8 */ class Certificate { @@ -223,7 +223,9 @@ declare module 'crypto' { * display the available digest algorithms. * * The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is - * a `KeyObject`, its type must be `secret`. + * a `KeyObject`, its type must be `secret`. If it is a string, please consider `caveats when using strings as inputs to cryptographic APIs`. If it was + * obtained from a cryptographically secure source of entropy, such as {@link randomBytes} or {@link generateKey}, its length should not + * exceed the block size of `algorithm` (e.g., 512 bits for SHA-256). * * Example: generating the sha256 HMAC of a file * @@ -683,13 +685,13 @@ declare module 'crypto' { * **GCM, or CCM).** * * The implementation of `crypto.createCipher()` derives keys using the OpenSSL - * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one + * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one * iteration, and no salt. The lack of salt allows dictionary attacks as the same * password always creates the same key. The low iteration count and * non-cryptographically secure hash algorithm allow passwords to be tested very * rapidly. * - * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that + * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that * developers derive a key and IV on * their own using {@link scrypt} and to use {@link createCipheriv} to create the `Cipher` object. Users should not use ciphers with counter mode * (e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when @@ -944,13 +946,13 @@ declare module 'crypto' { * **GCM, or CCM).** * * The implementation of `crypto.createDecipher()` derives keys using the OpenSSL - * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one + * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one * iteration, and no salt. The lack of salt allows dictionary attacks as the same * password always creates the same key. The low iteration count and * non-cryptographically secure hash algorithm allow passwords to be tested very * rapidly. * - * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that + * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that * developers derive a key and IV on * their own using {@link scrypt} and to use {@link createDecipheriv} to create the `Decipher` object. * @since v0.1.94 @@ -1195,11 +1197,14 @@ declare module 'crypto' { * generateKey, * } = await import('node:crypto'); * - * generateKey('hmac', { length: 64 }, (err, key) => { + * generateKey('hmac', { length: 512 }, (err, key) => { * if (err) throw err; * console.log(key.export().toString('hex')); // 46e..........620 * }); * ``` + * + * The size of a generated HMAC key should not exceed the block size of the + * underlying hash function. See {@link createHmac} for more information. * @since v15.0.0 * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. */ @@ -1218,9 +1223,12 @@ declare module 'crypto' { * generateKeySync, * } = await import('node:crypto'); * - * const key = generateKeySync('hmac', { length: 64 }); + * const key = generateKeySync('hmac', { length: 512 }); * console.log(key.export().toString('hex')); // e89..........41e * ``` + * + * The size of a generated HMAC key should not exceed the block size of the + * underlying hash function. See {@link createHmac} for more information. * @since v15.0.0 * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. */ @@ -1508,10 +1516,15 @@ declare module 'crypto' { class DiffieHellman { private constructor(); /** - * Generates private and public Diffie-Hellman key values, and returns + * Generates private and public Diffie-Hellman key values unless they have been + * generated or computed already, and returns * the public key in the specified `encoding`. This key should be * transferred to the other party. * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned. + * + * This function is a thin wrapper around [`DH_generate_key()`](https://www.openssl.org/docs/man3.0/man3/DH_generate_key.html). In particular, + * once a private key has been generated or set, calling this function only updates + * the public key but does not generate a new private key. * @since v0.5.0 * @param encoding The `encoding` of the return value. */ @@ -1583,6 +1596,9 @@ declare module 'crypto' { * Sets the Diffie-Hellman private key. If the `encoding` argument is provided,`privateKey` is expected * to be a string. If no `encoding` is provided, `privateKey` is expected * to be a `Buffer`, `TypedArray`, or `DataView`. + * + * This function does not automatically compute the associated public key. Either `diffieHellman.setPublicKey()` or `diffieHellman.generateKeys()` can be + * used to manually provide the public key or to automatically derive it. * @since v0.5.0 * @param encoding The `encoding` of the `privateKey` string. */ diff --git a/node_modules/@types/node/fs.d.ts b/node_modules/@types/node/fs.d.ts index 9ede55db..00f1cf34 100755 --- a/node_modules/@types/node/fs.d.ts +++ b/node_modules/@types/node/fs.d.ts @@ -1632,18 +1632,19 @@ declare module 'fs' { * * The callback is given a possible exception and, if `recursive` is `true`, the * first directory path created, `(err[, path])`.`path` can still be `undefined` when `recursive` is `true`, if no directory was - * created. + * created (for instance, if it was previously created). * * The optional `options` argument can be an integer specifying `mode` (permission * and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fs.mkdir()` when `path` is a directory that * exists results in an error only - * when `recursive` is false. + * when `recursive` is false. If `recursive` is false and the directory exists, + * an `EEXIST` error occurs. * * ```js * import { mkdir } from 'node:fs'; * - * // Creates /tmp/a/apple, regardless of whether `/tmp` and /tmp/a exist. - * mkdir('/tmp/a/apple', { recursive: true }, (err) => { + * // Create ./tmp/a/apple, regardless of whether ./tmp and ./tmp/a exist. + * mkdir('./tmp/a/apple', { recursive: true }, (err) => { * if (err) throw err; * }); * ``` @@ -3088,7 +3089,7 @@ declare module 'fs' { recursive?: boolean | undefined; } export type WatchEventType = 'rename' | 'change'; - export type WatchListener = (event: WatchEventType, filename: T) => void; + export type WatchListener = (event: WatchEventType, filename: T | null) => void; export type StatsListener = (curr: Stats, prev: Stats) => void; export type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void; /** diff --git a/node_modules/@types/node/fs/promises.d.ts b/node_modules/@types/node/fs/promises.d.ts index 70560a95..f5f15835 100755 --- a/node_modules/@types/node/fs/promises.d.ts +++ b/node_modules/@types/node/fs/promises.d.ts @@ -43,7 +43,7 @@ declare module 'fs/promises' { import { Interface as ReadlineInterface } from 'node:readline'; interface FileChangeInfo { eventType: WatchEventType; - filename: T; + filename: T | null; } interface FlagAndOpenMode { mode?: Mode | undefined; diff --git a/node_modules/@types/node/index.d.ts b/node_modules/@types/node/index.d.ts index 97cb955b..40d2d534 100755 --- a/node_modules/@types/node/index.d.ts +++ b/node_modules/@types/node/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for non-npm package Node.js 20.2 +// Type definitions for non-npm package Node.js 20.4 // Project: https://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped diff --git a/node_modules/@types/node/module.d.ts b/node_modules/@types/node/module.d.ts index e884f32c..201576eb 100755 --- a/node_modules/@types/node/module.d.ts +++ b/node_modules/@types/node/module.d.ts @@ -73,11 +73,24 @@ declare module 'module' { readonly payload: SourceMapPayload; constructor(payload: SourceMapPayload); /** - * Given a line number and column number in the generated source file, returns - * an object representing the position in the original file. The object returned - * consists of the following keys: + * Given a line offset and column offset in the generated source + * file, returns an object representing the SourceMap range in the + * original file if found, or an empty object if not. + * + * The object returned contains the following keys: + * + * The returned value represents the raw range as it appears in the + * SourceMap, based on zero-indexed offsets, _not_ 1-indexed line and + * column numbers as they appear in Error messages and CallSite + * objects. + * + * To get the corresponding 1-indexed line and column numbers from a + * lineNumber and columnNumber as they are reported by Error stacks + * and CallSite objects, use `sourceMap.findOrigin(lineNumber, columnNumber)` + * @param lineOffset The zero-indexed line number offset in the generated source + * @param columnOffset The zero-indexed column number offset in the generated source */ - findEntry(line: number, column: number): SourceMapping; + findEntry(lineOffset: number, columnOffset: number): SourceMapping; } } interface Module extends NodeModule {} diff --git a/node_modules/@types/node/net.d.ts b/node_modules/@types/node/net.d.ts index d180fa07..485a9719 100755 --- a/node_modules/@types/node/net.d.ts +++ b/node_modules/@types/node/net.d.ts @@ -310,12 +310,14 @@ declare module 'net' { */ readonly remoteAddress?: string | undefined; /** - * The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. + * The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. Value may be `undefined` if + * the socket is destroyed (for example, if the client disconnected). * @since v0.11.14 */ readonly remoteFamily?: string | undefined; /** - * The numeric representation of the remote port. For example, `80` or `21`. + * The numeric representation of the remote port. For example, `80` or `21`. Value may be `undefined` if + * the socket is destroyed (for example, if the client disconnected). * @since v0.5.10 */ readonly remotePort?: number | undefined; @@ -744,8 +746,8 @@ declare module 'net' { * * Test this by using `telnet`: * - * ```console - * $ telnet localhost 8124 + * ```bash + * telnet localhost 8124 * ``` * * To listen on the socket `/tmp/echo.sock`: @@ -758,8 +760,8 @@ declare module 'net' { * * Use `nc` to connect to a Unix domain socket server: * - * ```console - * $ nc -U /tmp/echo.sock + * ```bash + * nc -U /tmp/echo.sock * ``` * @since v0.5.0 * @param connectionListener Automatically set as a listener for the {@link 'connection'} event. diff --git a/node_modules/@types/node/package.json b/node_modules/@types/node/package.json index 13e578dc..96fe6481 100755 --- a/node_modules/@types/node/package.json +++ b/node_modules/@types/node/package.json @@ -1,6 +1,6 @@ { "name": "@types/node", - "version": "20.2.4", + "version": "20.4.1", "description": "TypeScript definitions for Node.js", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", "license": "MIT", @@ -232,6 +232,6 @@ }, "scripts": {}, "dependencies": {}, - "typesPublisherContentHash": "2e3b2377433bb56f46cc48c2ae626cac278d92bddb803373733d72c8da681f19", + "typesPublisherContentHash": "cd0e2c7a0a92527e46fbda5fc12bd264c97c2b44ff53770b6b8c6a71e3f2b1dd", "typeScriptVersion": "4.3" } \ No newline at end of file diff --git a/node_modules/@types/node/process.d.ts b/node_modules/@types/node/process.d.ts index 8f093ee9..f122546e 100755 --- a/node_modules/@types/node/process.d.ts +++ b/node_modules/@types/node/process.d.ts @@ -307,8 +307,8 @@ declare module 'process' { * * Launching the Node.js process as: * - * ```console - * $ node process-args.js one two=three four + * ```bash + * node process-args.js one two=three four * ``` * * Would generate the output: @@ -344,8 +344,8 @@ declare module 'process' { * the script name. These options are useful in order to spawn child processes with * the same execution environment as the parent. * - * ```console - * $ node --harmony script.js --version + * ```bash + * node --harmony script.js --version * ``` * * Results in `process.execArgv`: @@ -492,8 +492,8 @@ declare module 'process' { * to other `Worker` threads. * In other words, the following example would not work: * - * ```console - * $ node -e 'process.env.foo = "bar"' && echo $foo + * ```bash + * node -e 'process.env.foo = "bar"' && echo $foo * ``` * * While the following will: @@ -898,21 +898,30 @@ declare module 'process' { * Will generate an object similar to: * * ```console - * { node: '11.13.0', - * v8: '7.0.276.38-node.18', - * uv: '1.27.0', - * zlib: '1.2.11', - * brotli: '1.0.7', - * ares: '1.15.0', - * modules: '67', - * nghttp2: '1.34.0', - * napi: '4', - * llhttp: '1.1.1', - * openssl: '1.1.1b', - * cldr: '34.0', - * icu: '63.1', - * tz: '2018e', - * unicode: '11.0' } + * { node: '20.2.0', + * acorn: '8.8.2', + * ada: '2.4.0', + * ares: '1.19.0', + * base64: '0.5.0', + * brotli: '1.0.9', + * cjs_module_lexer: '1.2.2', + * cldr: '43.0', + * icu: '73.1', + * llhttp: '8.1.0', + * modules: '115', + * napi: '8', + * nghttp2: '1.52.0', + * nghttp3: '0.7.0', + * ngtcp2: '0.8.1', + * openssl: '3.0.8+quic', + * simdutf: '3.2.9', + * tz: '2023c', + * undici: '5.22.0', + * unicode: '15.0', + * uv: '1.44.2', + * uvwasi: '0.0.16', + * v8: '11.3.244.8-node.9', + * zlib: '1.2.13' } * ``` * @since v0.2.0 */ diff --git a/node_modules/@types/node/test.d.ts b/node_modules/@types/node/test.d.ts index 52024544..5980c053 100755 --- a/node_modules/@types/node/test.d.ts +++ b/node_modules/@types/node/test.d.ts @@ -159,35 +159,35 @@ declare module 'node:test' { * @param [name='The name'] The name of the suite, which is displayed when reporting test results. * @param options Configuration options for the suite. supports the same options as `test([name][, options][, fn])`. * @param [fn='A no-op function'] The function under suite declaring all subtests and subsuites. The first argument to this function is a {@link SuiteContext} object. - * @return `undefined`. + * @return Immediately fulfilled with `undefined`. */ - function describe(name?: string, options?: TestOptions, fn?: SuiteFn): void; - function describe(name?: string, fn?: SuiteFn): void; - function describe(options?: TestOptions, fn?: SuiteFn): void; - function describe(fn?: SuiteFn): void; + function describe(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function describe(name?: string, fn?: SuiteFn): Promise; + function describe(options?: TestOptions, fn?: SuiteFn): Promise; + function describe(fn?: SuiteFn): Promise; namespace describe { /** * Shorthand for skipping a suite, same as `describe([name], { skip: true }[, fn])`. */ - function skip(name?: string, options?: TestOptions, fn?: SuiteFn): void; - function skip(name?: string, fn?: SuiteFn): void; - function skip(options?: TestOptions, fn?: SuiteFn): void; - function skip(fn?: SuiteFn): void; + function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function skip(name?: string, fn?: SuiteFn): Promise; + function skip(options?: TestOptions, fn?: SuiteFn): Promise; + function skip(fn?: SuiteFn): Promise; /** * Shorthand for marking a suite as `TODO`, same as `describe([name], { todo: true }[, fn])`. */ - function todo(name?: string, options?: TestOptions, fn?: SuiteFn): void; - function todo(name?: string, fn?: SuiteFn): void; - function todo(options?: TestOptions, fn?: SuiteFn): void; - function todo(fn?: SuiteFn): void; + function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function todo(name?: string, fn?: SuiteFn): Promise; + function todo(options?: TestOptions, fn?: SuiteFn): Promise; + function todo(fn?: SuiteFn): Promise; /** * Shorthand for marking a suite as `only`, same as `describe([name], { only: true }[, fn])`. * @since v18.15.0 */ - function only(name?: string, options?: TestOptions, fn?: SuiteFn): void; - function only(name?: string, fn?: SuiteFn): void; - function only(options?: TestOptions, fn?: SuiteFn): void; - function only(fn?: SuiteFn): void; + function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; + function only(name?: string, fn?: SuiteFn): Promise; + function only(options?: TestOptions, fn?: SuiteFn): Promise; + function only(fn?: SuiteFn): Promise; } /** * Shorthand for `test()`. @@ -195,69 +195,69 @@ declare module 'node:test' { * The `it()` function is imported from the `node:test` module. * @since v18.6.0, v16.17.0 */ - function it(name?: string, options?: TestOptions, fn?: TestFn): void; - function it(name?: string, fn?: TestFn): void; - function it(options?: TestOptions, fn?: TestFn): void; - function it(fn?: TestFn): void; + function it(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function it(name?: string, fn?: TestFn): Promise; + function it(options?: TestOptions, fn?: TestFn): Promise; + function it(fn?: TestFn): Promise; namespace it { /** * Shorthand for skipping a test, same as `it([name], { skip: true }[, fn])`. */ - function skip(name?: string, options?: TestOptions, fn?: TestFn): void; - function skip(name?: string, fn?: TestFn): void; - function skip(options?: TestOptions, fn?: TestFn): void; - function skip(fn?: TestFn): void; + function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function skip(name?: string, fn?: TestFn): Promise; + function skip(options?: TestOptions, fn?: TestFn): Promise; + function skip(fn?: TestFn): Promise; /** * Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`. */ - function todo(name?: string, options?: TestOptions, fn?: TestFn): void; - function todo(name?: string, fn?: TestFn): void; - function todo(options?: TestOptions, fn?: TestFn): void; - function todo(fn?: TestFn): void; + function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function todo(name?: string, fn?: TestFn): Promise; + function todo(options?: TestOptions, fn?: TestFn): Promise; + function todo(fn?: TestFn): Promise; /** * Shorthand for marking a test as `only`, same as `it([name], { only: true }[, fn])`. * @since v18.15.0 */ - function only(name?: string, options?: TestOptions, fn?: TestFn): void; - function only(name?: string, fn?: TestFn): void; - function only(options?: TestOptions, fn?: TestFn): void; - function only(fn?: TestFn): void; + function only(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function only(name?: string, fn?: TestFn): Promise; + function only(options?: TestOptions, fn?: TestFn): Promise; + function only(fn?: TestFn): Promise; } /** * Shorthand for skipping a test, same as `test([name], { skip: true }[, fn])`. * @since v20.2.0 */ - function skip(name?: string, options?: TestOptions, fn?: TestFn): void; - function skip(name?: string, fn?: TestFn): void; - function skip(options?: TestOptions, fn?: TestFn): void; - function skip(fn?: TestFn): void; + function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function skip(name?: string, fn?: TestFn): Promise; + function skip(options?: TestOptions, fn?: TestFn): Promise; + function skip(fn?: TestFn): Promise; /** * Shorthand for marking a test as `TODO`, same as `test([name], { todo: true }[, fn])`. * @since v20.2.0 */ - function todo(name?: string, options?: TestOptions, fn?: TestFn): void; - function todo(name?: string, fn?: TestFn): void; - function todo(options?: TestOptions, fn?: TestFn): void; - function todo(fn?: TestFn): void; + function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function todo(name?: string, fn?: TestFn): Promise; + function todo(options?: TestOptions, fn?: TestFn): Promise; + function todo(fn?: TestFn): Promise; /** * Shorthand for marking a test as `only`, same as `test([name], { only: true }[, fn])`. * @since v20.2.0 */ - function only(name?: string, options?: TestOptions, fn?: TestFn): void; - function only(name?: string, fn?: TestFn): void; - function only(options?: TestOptions, fn?: TestFn): void; - function only(fn?: TestFn): void; + function only(name?: string, options?: TestOptions, fn?: TestFn): Promise; + function only(name?: string, fn?: TestFn): Promise; + function only(options?: TestOptions, fn?: TestFn): Promise; + function only(fn?: TestFn): Promise; /** * The type of a function under test. The first argument to this function is a * {@link TestContext} object. If the test uses callbacks, the callback function is passed as * the second argument. */ - type TestFn = (t: TestContext, done: (result?: any) => void) => any; + type TestFn = (t: TestContext, done: (result?: any) => void) => void | Promise; /** * The type of a function under Suite. * If the test uses callbacks, the callback function is passed as an argument */ - type SuiteFn = (done: (result?: any) => void) => void; + type SuiteFn = (s: SuiteContext) => void | Promise; interface RunOptions { /** * If a number is provided, then that many files would run in parallel. @@ -307,134 +307,50 @@ declare module 'node:test' { addListener(event: 'test:pass', listener: (data: TestPass) => void): this; addListener(event: 'test:plan', listener: (data: TestPlan) => void): this; addListener(event: 'test:start', listener: (data: TestStart) => void): this; + addListener(event: 'test:stderr', listener: (data: TestStderr) => void): this; + addListener(event: 'test:stdout', listener: (data: TestStdout) => void): this; addListener(event: string, listener: (...args: any[]) => void): this; emit(event: 'test:diagnostic', data: DiagnosticData): boolean; emit(event: 'test:fail', data: TestFail): boolean; emit(event: 'test:pass', data: TestPass): boolean; emit(event: 'test:plan', data: TestPlan): boolean; emit(event: 'test:start', data: TestStart): boolean; + emit(event: 'test:stderr', data: TestStderr): boolean; + emit(event: 'test:stdout', data: TestStdout): boolean; emit(event: string | symbol, ...args: any[]): boolean; on(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; on(event: 'test:fail', listener: (data: TestFail) => void): this; on(event: 'test:pass', listener: (data: TestPass) => void): this; on(event: 'test:plan', listener: (data: TestPlan) => void): this; on(event: 'test:start', listener: (data: TestStart) => void): this; + on(event: 'test:stderr', listener: (data: TestStderr) => void): this; + on(event: 'test:stdout', listener: (data: TestStdout) => void): this; on(event: string, listener: (...args: any[]) => void): this; once(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; once(event: 'test:fail', listener: (data: TestFail) => void): this; once(event: 'test:pass', listener: (data: TestPass) => void): this; once(event: 'test:plan', listener: (data: TestPlan) => void): this; once(event: 'test:start', listener: (data: TestStart) => void): this; + once(event: 'test:stderr', listener: (data: TestStderr) => void): this; + once(event: 'test:stdout', listener: (data: TestStdout) => void): this; once(event: string, listener: (...args: any[]) => void): this; prependListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; prependListener(event: 'test:fail', listener: (data: TestFail) => void): this; prependListener(event: 'test:pass', listener: (data: TestPass) => void): this; prependListener(event: 'test:plan', listener: (data: TestPlan) => void): this; prependListener(event: 'test:start', listener: (data: TestStart) => void): this; + prependListener(event: 'test:stderr', listener: (data: TestStderr) => void): this; + prependListener(event: 'test:stdout', listener: (data: TestStdout) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; prependOnceListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; prependOnceListener(event: 'test:fail', listener: (data: TestFail) => void): this; prependOnceListener(event: 'test:pass', listener: (data: TestPass) => void): this; prependOnceListener(event: 'test:plan', listener: (data: TestPlan) => void): this; prependOnceListener(event: 'test:start', listener: (data: TestStart) => void): this; + prependOnceListener(event: 'test:stderr', listener: (data: TestStderr) => void): this; + prependOnceListener(event: 'test:stdout', listener: (data: TestStdout) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; } - interface DiagnosticData { - /** - * The diagnostic message. - */ - message: string; - /** - * The nesting level of the test. - */ - nesting: number; - } - interface TestFail { - /** - * Additional execution metadata. - */ - details: { - /** - * The duration of the test in milliseconds. - */ - duration: number; - /** - * The error thrown by the test. - */ - error: Error; - }; - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The ordinal number of the test. - */ - testNumber: number; - /** - * Present if `context.todo` is called. - */ - todo?: string | boolean; - /** - * Present if `context.skip` is called. - */ - skip?: string | boolean; - } - interface TestPass { - /** - * Additional execution metadata. - */ - details: { - /** - * The duration of the test in milliseconds. - */ - duration: number; - }; - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The ordinal number of the test. - */ - testNumber: number; - /** - * Present if `context.todo` is called. - */ - todo?: string | boolean; - /** - * Present if `context.skip` is called. - */ - skip?: string | boolean; - } - interface TestPlan { - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The number of subtests that have ran. - */ - count: number; - } - interface TestStart { - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - } /** * An instance of `TestContext` is passed to each test function in order to * interact with the test runner. However, the `TestContext` constructor is not @@ -570,6 +486,24 @@ declare module 'node:test' { */ readonly mock: MockTracker; } + /** + * An instance of `SuiteContext` is passed to each suite function in order to + * interact with the test runner. However, the `SuiteContext` constructor is not + * exposed as part of the API. + * @since v18.7.0, v16.17.0 + */ + class SuiteContext { + /** + * The name of the suite. + * @since v18.8.0, v16.18.0 + */ + readonly name: string; + /** + * Can be used to abort test subtasks when the test has been aborted. + * @since v18.7.0, v16.17.0 + */ + readonly signal: AbortSignal; + } interface TestOptions { /** * If a number is provided, then that many tests would run in parallel. @@ -905,6 +839,7 @@ declare module 'node:test' { * @since v19.1.0, v18.13.0 */ restoreAll(): void; + timers: MockTimers; } const mock: MockTracker; interface MockFunctionCall< @@ -1048,5 +983,401 @@ declare module 'node:test' { */ restore(): void; } + type Timer = 'setInterval' | 'clearInterval' | 'setTimeout' | 'clearTimeout'; + /** + * Mocking timers is a technique commonly used in software testing to simulate and + * control the behavior of timers, such as `setInterval` and `setTimeout`, + * without actually waiting for the specified time intervals. + * + * The `MockTracker` provides a top-level `timers` export + * which is a `MockTimers` instance. + * @since v20.4.0 + * @experimental + */ + class MockTimers { + /** + * Enables timer mocking for the specified timers. + * + * **Note:** When you enable mocking for a specific timer, its associated + * clear function will also be implicitly mocked. + * + * Example usage: + * + * ```js + * import { mock } from 'node:test'; + * mock.timers.enable(['setInterval']); + * ``` + * + * ```js + * const { mock } = require('node:test'); + * mock.timers.enable(['setInterval']); + * ``` + * + * The above example enables mocking for the `setInterval` timer and + * implicitly mocks the `clearInterval` function. Only the `setInterval`and `clearInterval` functions from `node:timers`,`node:timers/promises`, and`globalThis` will be mocked. + * + * Alternatively, if you call `mock.timers.enable()` without any parameters: + * + * All timers (`'setInterval'`, `'clearInterval'`, `'setTimeout'`, and `'clearTimeout'`) + * will be mocked. The `setInterval`, `clearInterval`, `setTimeout`, and `clearTimeout`functions from `node:timers`, `node:timers/promises`, + * and `globalThis` will be mocked. + * @since v20.4.0 + */ + enable(timers?: Timer[]): void; + /** + * This function restores the default behavior of all mocks that were previously + * created by this `MockTimers` instance and disassociates the mocks + * from the `MockTracker` instance. + * + * **Note:** After each test completes, this function is called on + * the test context's `MockTracker`. + * + * ```js + * import { mock } from 'node:test'; + * mock.timers.reset(); + * ``` + * + * ```js + * const { mock } = require('node:test'); + * mock.timers.reset(); + * ``` + * @since v20.4.0 + */ + reset(): void; + /** + * Advances time for all mocked timers. + * + * **Note:** This diverges from how `setTimeout` in Node.js behaves and accepts + * only positive numbers. In Node.js, `setTimeout` with negative numbers is + * only supported for web compatibility reasons. + * + * The following example mocks a `setTimeout` function and + * by using `.tick` advances in + * time triggering all pending timers. + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * + * context.mock.timers.enable(['setTimeout']); + * + * setTimeout(fn, 9999); + * + * assert.strictEqual(fn.mock.callCount(), 0); + * + * // Advance in time + * context.mock.timers.tick(9999); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * + * ```js + * const assert = require('node:assert'); + * const { test } = require('node:test'); + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * context.mock.timers.enable(['setTimeout']); + * + * setTimeout(fn, 9999); + * assert.strictEqual(fn.mock.callCount(), 0); + * + * // Advance in time + * context.mock.timers.tick(9999); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * + * Alternativelly, the `.tick` function can be called many times + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * context.mock.timers.enable(['setTimeout']); + * const nineSecs = 9000; + * setTimeout(fn, nineSecs); + * + * const twoSeconds = 3000; + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * + * ```js + * const assert = require('node:assert'); + * const { test } = require('node:test'); + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * context.mock.timers.enable(['setTimeout']); + * const nineSecs = 9000; + * setTimeout(fn, nineSecs); + * + * const twoSeconds = 3000; + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * @since v20.4.0 + */ + tick(milliseconds: number): void; + /** + * Triggers all pending mocked timers immediately. + * + * The example below triggers all pending timers immediately, + * causing them to execute without any delay. + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('runAll functions following the given order', (context) => { + * context.mock.timers.enable(['setTimeout']); + * const results = []; + * setTimeout(() => results.push(1), 9999); + * + * // Notice that if both timers have the same timeout, + * // the order of execution is guaranteed + * setTimeout(() => results.push(3), 8888); + * setTimeout(() => results.push(2), 8888); + * + * assert.deepStrictEqual(results, []); + * + * context.mock.timers.runAll(); + * + * assert.deepStrictEqual(results, [3, 2, 1]); + * }); + * ``` + * + * ```js + * const assert = require('node:assert'); + * const { test } = require('node:test'); + * + * test('runAll functions following the given order', (context) => { + * context.mock.timers.enable(['setTimeout']); + * const results = []; + * setTimeout(() => results.push(1), 9999); + * + * // Notice that if both timers have the same timeout, + * // the order of execution is guaranteed + * setTimeout(() => results.push(3), 8888); + * setTimeout(() => results.push(2), 8888); + * + * assert.deepStrictEqual(results, []); + * + * context.mock.timers.runAll(); + * + * assert.deepStrictEqual(results, [3, 2, 1]); + * }); + * ``` + * + * **Note:** The `runAll()` function is specifically designed for + * triggering timers in the context of timer mocking. + * It does not have any effect on real-time system + * clocks or actual timers outside of the mocking environment. + * @since v20.4.0 + */ + runAll(): void; + } export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock, skip, only, todo }; } + +interface DiagnosticData { + /** + * The diagnostic message. + */ + message: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestFail { + /** + * Additional execution metadata. + */ + details: { + /** + * The duration of the test in milliseconds. + */ + duration: number; + /** + * The error thrown by the test. + */ + error: Error; + }; + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The ordinal number of the test. + */ + testNumber: number; + /** + * Present if `context.todo` is called. + */ + todo?: string | boolean; + /** + * Present if `context.skip` is called. + */ + skip?: string | boolean; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestPass { + /** + * Additional execution metadata. + */ + details: { + /** + * The duration of the test in milliseconds. + */ + duration: number; + }; + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The ordinal number of the test. + */ + testNumber: number; + /** + * Present if `context.todo` is called. + */ + todo?: string | boolean; + /** + * Present if `context.skip` is called. + */ + skip?: string | boolean; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestPlan { + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The number of subtests that have ran. + */ + count: number; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestStart { + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestStderr { + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; + /** + * The message written to `stderr` + */ + message: string; +} +interface TestStdout { + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; + /** + * The message written to `stdout` + */ + message: string; +} + +/** + * The `node:test/reporters` module exposes the builtin-reporters for `node:test`. + * To access it: + * + * ```js + * import test from 'node:test/reporters'; + * ``` + * + * This module is only available under the `node:` scheme. The following will not + * work: + * + * ```js + * import test from 'test/reporters'; + * ``` + * @since v19.9.0 + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/test/reporters.js) + */ +declare module 'node:test/reporters' { + import { Transform } from 'node:stream'; + + type TestEvent = + | { type: 'test:diagnostic', data: DiagnosticData } + | { type: 'test:fail', data: TestFail } + | { type: 'test:pass', data: TestPass } + | { type: 'test:plan', data: TestPlan } + | { type: 'test:start', data: TestStart } + | { type: 'test:stderr', data: TestStderr } + | { type: 'test:stdout', data: TestStdout }; + type TestEventGenerator = AsyncGenerator; + + /** + * 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`. + */ + function dot(source: TestEventGenerator): AsyncGenerator<'\n' | '.' | 'X', void>; + /** + * The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format. + */ + function tap(source: TestEventGenerator): AsyncGenerator; + /** + * The `spec` reporter outputs the test results in a human-readable format. + */ + class Spec extends Transform { + constructor(); + } + export { dot, tap, Spec as spec }; +} diff --git a/node_modules/@types/node/tls.d.ts b/node_modules/@types/node/tls.d.ts index 13ee5635..4992b248 100755 --- a/node_modules/@types/node/tls.d.ts +++ b/node_modules/@types/node/tls.d.ts @@ -728,6 +728,17 @@ declare module 'tls' { } type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1'; interface SecureContextOptions { + /** + * If set, this will be called when a client opens a connection using the ALPN extension. + * One argument will be passed to the callback: an object containing `servername` and `protocols` fields, + * respectively containing the server name from the SNI extension (if any) and an array of + * ALPN protocol name strings. The callback must return either one of the strings listed in `protocols`, + * which will be returned to the client as the selected ALPN protocol, or `undefined`, + * to reject the connection with a fatal alert. If a string is returned that does not match one of + * the client's ALPN protocols, an error will be thrown. + * This option cannot be used with the `ALPNProtocols` option, and setting both options will throw an error. + */ + ALPNCallback?: ((arg: { servername: string; protocols: string[] }) => string | undefined) | undefined; /** * Optionally override the trusted CA certificates. Default is to trust * the well-known CAs curated by Mozilla. Mozilla's CAs are completely diff --git a/node_modules/@types/node/ts4.8/buffer.d.ts b/node_modules/@types/node/ts4.8/buffer.d.ts index bf537b8a..86694b06 100755 --- a/node_modules/@types/node/ts4.8/buffer.d.ts +++ b/node_modules/@types/node/ts4.8/buffer.d.ts @@ -299,6 +299,10 @@ declare module '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. * @@ -550,9 +554,8 @@ declare module 'buffer' { * 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)`, `Buffer.concat()`, and the - * deprecated`new Buffer(size)` constructor only when `size` is less than or equal - * to `Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). + * 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 or equal to`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)`. diff --git a/node_modules/@types/node/ts4.8/cluster.d.ts b/node_modules/@types/node/ts4.8/cluster.d.ts index 6ee51772..4fa9aef1 100755 --- a/node_modules/@types/node/ts4.8/cluster.d.ts +++ b/node_modules/@types/node/ts4.8/cluster.d.ts @@ -56,6 +56,7 @@ declare module 'cluster' { import * as child from 'node:child_process'; import EventEmitter = require('node:events'); import * as net from 'node:net'; + type SerializationType = 'json' | 'advanced'; export interface ClusterSettings { execArgv?: string[] | undefined; // default: process.execArgv exec?: string | undefined; @@ -65,6 +66,9 @@ declare module 'cluster' { uid?: number | undefined; gid?: number | undefined; inspectPort?: number | (() => number) | undefined; + serialization?: SerializationType | undefined; + cwd?: string | undefined; + windowsHide?: boolean | undefined; } export interface Address { address: string; diff --git a/node_modules/@types/node/ts4.8/crypto.d.ts b/node_modules/@types/node/ts4.8/crypto.d.ts index 036abacf..5b512177 100755 --- a/node_modules/@types/node/ts4.8/crypto.d.ts +++ b/node_modules/@types/node/ts4.8/crypto.d.ts @@ -21,14 +21,14 @@ declare module 'crypto' { import { PeerCertificate } from 'node:tls'; /** * SPKAC is a Certificate Signing Request mechanism originally implemented by - * Netscape and was specified formally as part of [HTML5's `keygen` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/keygen). + * Netscape and was specified formally as part of HTML5's `keygen` element. * * `` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects * should not use this element anymore. * * The `node:crypto` module provides the `Certificate` class for working with SPKAC * data. The most common usage is handling output generated by the HTML5`` element. Node.js uses [OpenSSL's SPKAC - * implementation](https://www.openssl.org/docs/man1.1.0/apps/openssl-spkac.html) internally. + * implementation](https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html) internally. * @since v0.11.8 */ class Certificate { @@ -223,7 +223,9 @@ declare module 'crypto' { * display the available digest algorithms. * * The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is - * a `KeyObject`, its type must be `secret`. + * a `KeyObject`, its type must be `secret`. If it is a string, please consider `caveats when using strings as inputs to cryptographic APIs`. If it was + * obtained from a cryptographically secure source of entropy, such as {@link randomBytes} or {@link generateKey}, its length should not + * exceed the block size of `algorithm` (e.g., 512 bits for SHA-256). * * Example: generating the sha256 HMAC of a file * @@ -683,13 +685,13 @@ declare module 'crypto' { * **GCM, or CCM).** * * The implementation of `crypto.createCipher()` derives keys using the OpenSSL - * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one + * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one * iteration, and no salt. The lack of salt allows dictionary attacks as the same * password always creates the same key. The low iteration count and * non-cryptographically secure hash algorithm allow passwords to be tested very * rapidly. * - * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that + * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that * developers derive a key and IV on * their own using {@link scrypt} and to use {@link createCipheriv} to create the `Cipher` object. Users should not use ciphers with counter mode * (e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when @@ -944,13 +946,13 @@ declare module 'crypto' { * **GCM, or CCM).** * * The implementation of `crypto.createDecipher()` derives keys using the OpenSSL - * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one + * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one * iteration, and no salt. The lack of salt allows dictionary attacks as the same * password always creates the same key. The low iteration count and * non-cryptographically secure hash algorithm allow passwords to be tested very * rapidly. * - * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that + * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that * developers derive a key and IV on * their own using {@link scrypt} and to use {@link createDecipheriv} to create the `Decipher` object. * @since v0.1.94 @@ -1195,11 +1197,14 @@ declare module 'crypto' { * generateKey, * } = await import('node:crypto'); * - * generateKey('hmac', { length: 64 }, (err, key) => { + * generateKey('hmac', { length: 512 }, (err, key) => { * if (err) throw err; * console.log(key.export().toString('hex')); // 46e..........620 * }); * ``` + * + * The size of a generated HMAC key should not exceed the block size of the + * underlying hash function. See {@link createHmac} for more information. * @since v15.0.0 * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. */ @@ -1218,9 +1223,12 @@ declare module 'crypto' { * generateKeySync, * } = await import('node:crypto'); * - * const key = generateKeySync('hmac', { length: 64 }); + * const key = generateKeySync('hmac', { length: 512 }); * console.log(key.export().toString('hex')); // e89..........41e * ``` + * + * The size of a generated HMAC key should not exceed the block size of the + * underlying hash function. See {@link createHmac} for more information. * @since v15.0.0 * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. */ @@ -1508,10 +1516,15 @@ declare module 'crypto' { class DiffieHellman { private constructor(); /** - * Generates private and public Diffie-Hellman key values, and returns + * Generates private and public Diffie-Hellman key values unless they have been + * generated or computed already, and returns * the public key in the specified `encoding`. This key should be * transferred to the other party. * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned. + * + * This function is a thin wrapper around [`DH_generate_key()`](https://www.openssl.org/docs/man3.0/man3/DH_generate_key.html). In particular, + * once a private key has been generated or set, calling this function only updates + * the public key but does not generate a new private key. * @since v0.5.0 * @param encoding The `encoding` of the return value. */ @@ -1583,6 +1596,9 @@ declare module 'crypto' { * Sets the Diffie-Hellman private key. If the `encoding` argument is provided,`privateKey` is expected * to be a string. If no `encoding` is provided, `privateKey` is expected * to be a `Buffer`, `TypedArray`, or `DataView`. + * + * This function does not automatically compute the associated public key. Either `diffieHellman.setPublicKey()` or `diffieHellman.generateKeys()` can be + * used to manually provide the public key or to automatically derive it. * @since v0.5.0 * @param encoding The `encoding` of the `privateKey` string. */ diff --git a/node_modules/@types/node/ts4.8/fs.d.ts b/node_modules/@types/node/ts4.8/fs.d.ts index 9ede55db..00f1cf34 100755 --- a/node_modules/@types/node/ts4.8/fs.d.ts +++ b/node_modules/@types/node/ts4.8/fs.d.ts @@ -1632,18 +1632,19 @@ declare module 'fs' { * * The callback is given a possible exception and, if `recursive` is `true`, the * first directory path created, `(err[, path])`.`path` can still be `undefined` when `recursive` is `true`, if no directory was - * created. + * created (for instance, if it was previously created). * * The optional `options` argument can be an integer specifying `mode` (permission * and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fs.mkdir()` when `path` is a directory that * exists results in an error only - * when `recursive` is false. + * when `recursive` is false. If `recursive` is false and the directory exists, + * an `EEXIST` error occurs. * * ```js * import { mkdir } from 'node:fs'; * - * // Creates /tmp/a/apple, regardless of whether `/tmp` and /tmp/a exist. - * mkdir('/tmp/a/apple', { recursive: true }, (err) => { + * // Create ./tmp/a/apple, regardless of whether ./tmp and ./tmp/a exist. + * mkdir('./tmp/a/apple', { recursive: true }, (err) => { * if (err) throw err; * }); * ``` @@ -3088,7 +3089,7 @@ declare module 'fs' { recursive?: boolean | undefined; } export type WatchEventType = 'rename' | 'change'; - export type WatchListener = (event: WatchEventType, filename: T) => void; + export type WatchListener = (event: WatchEventType, filename: T | null) => void; export type StatsListener = (curr: Stats, prev: Stats) => void; export type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void; /** diff --git a/node_modules/@types/node/ts4.8/fs/promises.d.ts b/node_modules/@types/node/ts4.8/fs/promises.d.ts index a06968b7..93e705ea 100755 --- a/node_modules/@types/node/ts4.8/fs/promises.d.ts +++ b/node_modules/@types/node/ts4.8/fs/promises.d.ts @@ -43,7 +43,7 @@ declare module 'fs/promises' { import { Interface as ReadlineInterface } from 'node:readline'; interface FileChangeInfo { eventType: WatchEventType; - filename: T; + filename: T | null; } interface FlagAndOpenMode { mode?: Mode | undefined; diff --git a/node_modules/@types/node/ts4.8/module.d.ts b/node_modules/@types/node/ts4.8/module.d.ts index e884f32c..201576eb 100755 --- a/node_modules/@types/node/ts4.8/module.d.ts +++ b/node_modules/@types/node/ts4.8/module.d.ts @@ -73,11 +73,24 @@ declare module 'module' { readonly payload: SourceMapPayload; constructor(payload: SourceMapPayload); /** - * Given a line number and column number in the generated source file, returns - * an object representing the position in the original file. The object returned - * consists of the following keys: + * Given a line offset and column offset in the generated source + * file, returns an object representing the SourceMap range in the + * original file if found, or an empty object if not. + * + * The object returned contains the following keys: + * + * The returned value represents the raw range as it appears in the + * SourceMap, based on zero-indexed offsets, _not_ 1-indexed line and + * column numbers as they appear in Error messages and CallSite + * objects. + * + * To get the corresponding 1-indexed line and column numbers from a + * lineNumber and columnNumber as they are reported by Error stacks + * and CallSite objects, use `sourceMap.findOrigin(lineNumber, columnNumber)` + * @param lineOffset The zero-indexed line number offset in the generated source + * @param columnOffset The zero-indexed column number offset in the generated source */ - findEntry(line: number, column: number): SourceMapping; + findEntry(lineOffset: number, columnOffset: number): SourceMapping; } } interface Module extends NodeModule {} diff --git a/node_modules/@types/node/ts4.8/net.d.ts b/node_modules/@types/node/ts4.8/net.d.ts index d180fa07..485a9719 100755 --- a/node_modules/@types/node/ts4.8/net.d.ts +++ b/node_modules/@types/node/ts4.8/net.d.ts @@ -310,12 +310,14 @@ declare module 'net' { */ readonly remoteAddress?: string | undefined; /** - * The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. + * The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. Value may be `undefined` if + * the socket is destroyed (for example, if the client disconnected). * @since v0.11.14 */ readonly remoteFamily?: string | undefined; /** - * The numeric representation of the remote port. For example, `80` or `21`. + * The numeric representation of the remote port. For example, `80` or `21`. Value may be `undefined` if + * the socket is destroyed (for example, if the client disconnected). * @since v0.5.10 */ readonly remotePort?: number | undefined; @@ -744,8 +746,8 @@ declare module 'net' { * * Test this by using `telnet`: * - * ```console - * $ telnet localhost 8124 + * ```bash + * telnet localhost 8124 * ``` * * To listen on the socket `/tmp/echo.sock`: @@ -758,8 +760,8 @@ declare module 'net' { * * Use `nc` to connect to a Unix domain socket server: * - * ```console - * $ nc -U /tmp/echo.sock + * ```bash + * nc -U /tmp/echo.sock * ``` * @since v0.5.0 * @param connectionListener Automatically set as a listener for the {@link 'connection'} event. diff --git a/node_modules/@types/node/ts4.8/process.d.ts b/node_modules/@types/node/ts4.8/process.d.ts index 8f093ee9..f122546e 100755 --- a/node_modules/@types/node/ts4.8/process.d.ts +++ b/node_modules/@types/node/ts4.8/process.d.ts @@ -307,8 +307,8 @@ declare module 'process' { * * Launching the Node.js process as: * - * ```console - * $ node process-args.js one two=three four + * ```bash + * node process-args.js one two=three four * ``` * * Would generate the output: @@ -344,8 +344,8 @@ declare module 'process' { * the script name. These options are useful in order to spawn child processes with * the same execution environment as the parent. * - * ```console - * $ node --harmony script.js --version + * ```bash + * node --harmony script.js --version * ``` * * Results in `process.execArgv`: @@ -492,8 +492,8 @@ declare module 'process' { * to other `Worker` threads. * In other words, the following example would not work: * - * ```console - * $ node -e 'process.env.foo = "bar"' && echo $foo + * ```bash + * node -e 'process.env.foo = "bar"' && echo $foo * ``` * * While the following will: @@ -898,21 +898,30 @@ declare module 'process' { * Will generate an object similar to: * * ```console - * { node: '11.13.0', - * v8: '7.0.276.38-node.18', - * uv: '1.27.0', - * zlib: '1.2.11', - * brotli: '1.0.7', - * ares: '1.15.0', - * modules: '67', - * nghttp2: '1.34.0', - * napi: '4', - * llhttp: '1.1.1', - * openssl: '1.1.1b', - * cldr: '34.0', - * icu: '63.1', - * tz: '2018e', - * unicode: '11.0' } + * { node: '20.2.0', + * acorn: '8.8.2', + * ada: '2.4.0', + * ares: '1.19.0', + * base64: '0.5.0', + * brotli: '1.0.9', + * cjs_module_lexer: '1.2.2', + * cldr: '43.0', + * icu: '73.1', + * llhttp: '8.1.0', + * modules: '115', + * napi: '8', + * nghttp2: '1.52.0', + * nghttp3: '0.7.0', + * ngtcp2: '0.8.1', + * openssl: '3.0.8+quic', + * simdutf: '3.2.9', + * tz: '2023c', + * undici: '5.22.0', + * unicode: '15.0', + * uv: '1.44.2', + * uvwasi: '0.0.16', + * v8: '11.3.244.8-node.9', + * zlib: '1.2.13' } * ``` * @since v0.2.0 */ diff --git a/node_modules/@types/node/ts4.8/test.d.ts b/node_modules/@types/node/ts4.8/test.d.ts index 52024544..5ca208ec 100755 --- a/node_modules/@types/node/ts4.8/test.d.ts +++ b/node_modules/@types/node/ts4.8/test.d.ts @@ -159,7 +159,7 @@ declare module 'node:test' { * @param [name='The name'] The name of the suite, which is displayed when reporting test results. * @param options Configuration options for the suite. supports the same options as `test([name][, options][, fn])`. * @param [fn='A no-op function'] The function under suite declaring all subtests and subsuites. The first argument to this function is a {@link SuiteContext} object. - * @return `undefined`. + * @return Immediately fulfilled with `undefined`. */ function describe(name?: string, options?: TestOptions, fn?: SuiteFn): void; function describe(name?: string, fn?: SuiteFn): void; @@ -307,134 +307,50 @@ declare module 'node:test' { addListener(event: 'test:pass', listener: (data: TestPass) => void): this; addListener(event: 'test:plan', listener: (data: TestPlan) => void): this; addListener(event: 'test:start', listener: (data: TestStart) => void): this; + addListener(event: 'test:stderr', listener: (data: TestStderr) => void): this; + addListener(event: 'test:stdout', listener: (data: TestStdout) => void): this; addListener(event: string, listener: (...args: any[]) => void): this; emit(event: 'test:diagnostic', data: DiagnosticData): boolean; emit(event: 'test:fail', data: TestFail): boolean; emit(event: 'test:pass', data: TestPass): boolean; emit(event: 'test:plan', data: TestPlan): boolean; emit(event: 'test:start', data: TestStart): boolean; + emit(event: 'test:stderr', data: TestStderr): boolean; + emit(event: 'test:stdout', data: TestStdout): boolean; emit(event: string | symbol, ...args: any[]): boolean; on(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; on(event: 'test:fail', listener: (data: TestFail) => void): this; on(event: 'test:pass', listener: (data: TestPass) => void): this; on(event: 'test:plan', listener: (data: TestPlan) => void): this; on(event: 'test:start', listener: (data: TestStart) => void): this; + on(event: 'test:stderr', listener: (data: TestStderr) => void): this; + on(event: 'test:stdout', listener: (data: TestStdout) => void): this; on(event: string, listener: (...args: any[]) => void): this; once(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; once(event: 'test:fail', listener: (data: TestFail) => void): this; once(event: 'test:pass', listener: (data: TestPass) => void): this; once(event: 'test:plan', listener: (data: TestPlan) => void): this; once(event: 'test:start', listener: (data: TestStart) => void): this; + once(event: 'test:stderr', listener: (data: TestStderr) => void): this; + once(event: 'test:stdout', listener: (data: TestStdout) => void): this; once(event: string, listener: (...args: any[]) => void): this; prependListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; prependListener(event: 'test:fail', listener: (data: TestFail) => void): this; prependListener(event: 'test:pass', listener: (data: TestPass) => void): this; prependListener(event: 'test:plan', listener: (data: TestPlan) => void): this; prependListener(event: 'test:start', listener: (data: TestStart) => void): this; + prependListener(event: 'test:stderr', listener: (data: TestStderr) => void): this; + prependListener(event: 'test:stdout', listener: (data: TestStdout) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; prependOnceListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this; prependOnceListener(event: 'test:fail', listener: (data: TestFail) => void): this; prependOnceListener(event: 'test:pass', listener: (data: TestPass) => void): this; prependOnceListener(event: 'test:plan', listener: (data: TestPlan) => void): this; prependOnceListener(event: 'test:start', listener: (data: TestStart) => void): this; + prependOnceListener(event: 'test:stderr', listener: (data: TestStderr) => void): this; + prependOnceListener(event: 'test:stdout', listener: (data: TestStdout) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; } - interface DiagnosticData { - /** - * The diagnostic message. - */ - message: string; - /** - * The nesting level of the test. - */ - nesting: number; - } - interface TestFail { - /** - * Additional execution metadata. - */ - details: { - /** - * The duration of the test in milliseconds. - */ - duration: number; - /** - * The error thrown by the test. - */ - error: Error; - }; - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The ordinal number of the test. - */ - testNumber: number; - /** - * Present if `context.todo` is called. - */ - todo?: string | boolean; - /** - * Present if `context.skip` is called. - */ - skip?: string | boolean; - } - interface TestPass { - /** - * Additional execution metadata. - */ - details: { - /** - * The duration of the test in milliseconds. - */ - duration: number; - }; - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The ordinal number of the test. - */ - testNumber: number; - /** - * Present if `context.todo` is called. - */ - todo?: string | boolean; - /** - * Present if `context.skip` is called. - */ - skip?: string | boolean; - } - interface TestPlan { - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The number of subtests that have ran. - */ - count: number; - } - interface TestStart { - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - } /** * An instance of `TestContext` is passed to each test function in order to * interact with the test runner. However, the `TestContext` constructor is not @@ -905,6 +821,7 @@ declare module 'node:test' { * @since v19.1.0, v18.13.0 */ restoreAll(): void; + timers: MockTimers; } const mock: MockTracker; interface MockFunctionCall< @@ -1048,5 +965,401 @@ declare module 'node:test' { */ restore(): void; } + type Timer = 'setInterval' | 'clearInterval' | 'setTimeout' | 'clearTimeout'; + /** + * Mocking timers is a technique commonly used in software testing to simulate and + * control the behavior of timers, such as `setInterval` and `setTimeout`, + * without actually waiting for the specified time intervals. + * + * The `MockTracker` provides a top-level `timers` export + * which is a `MockTimers` instance. + * @since v20.4.0 + * @experimental + */ + class MockTimers { + /** + * Enables timer mocking for the specified timers. + * + * **Note:** When you enable mocking for a specific timer, its associated + * clear function will also be implicitly mocked. + * + * Example usage: + * + * ```js + * import { mock } from 'node:test'; + * mock.timers.enable(['setInterval']); + * ``` + * + * ```js + * const { mock } = require('node:test'); + * mock.timers.enable(['setInterval']); + * ``` + * + * The above example enables mocking for the `setInterval` timer and + * implicitly mocks the `clearInterval` function. Only the `setInterval`and `clearInterval` functions from `node:timers`,`node:timers/promises`, and`globalThis` will be mocked. + * + * Alternatively, if you call `mock.timers.enable()` without any parameters: + * + * All timers (`'setInterval'`, `'clearInterval'`, `'setTimeout'`, and `'clearTimeout'`) + * will be mocked. The `setInterval`, `clearInterval`, `setTimeout`, and `clearTimeout`functions from `node:timers`, `node:timers/promises`, + * and `globalThis` will be mocked. + * @since v20.4.0 + */ + enable(timers?: Timer[]): void; + /** + * This function restores the default behavior of all mocks that were previously + * created by this `MockTimers` instance and disassociates the mocks + * from the `MockTracker` instance. + * + * **Note:** After each test completes, this function is called on + * the test context's `MockTracker`. + * + * ```js + * import { mock } from 'node:test'; + * mock.timers.reset(); + * ``` + * + * ```js + * const { mock } = require('node:test'); + * mock.timers.reset(); + * ``` + * @since v20.4.0 + */ + reset(): void; + /** + * Advances time for all mocked timers. + * + * **Note:** This diverges from how `setTimeout` in Node.js behaves and accepts + * only positive numbers. In Node.js, `setTimeout` with negative numbers is + * only supported for web compatibility reasons. + * + * The following example mocks a `setTimeout` function and + * by using `.tick` advances in + * time triggering all pending timers. + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * + * context.mock.timers.enable(['setTimeout']); + * + * setTimeout(fn, 9999); + * + * assert.strictEqual(fn.mock.callCount(), 0); + * + * // Advance in time + * context.mock.timers.tick(9999); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * + * ```js + * const assert = require('node:assert'); + * const { test } = require('node:test'); + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * context.mock.timers.enable(['setTimeout']); + * + * setTimeout(fn, 9999); + * assert.strictEqual(fn.mock.callCount(), 0); + * + * // Advance in time + * context.mock.timers.tick(9999); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * + * Alternativelly, the `.tick` function can be called many times + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * context.mock.timers.enable(['setTimeout']); + * const nineSecs = 9000; + * setTimeout(fn, nineSecs); + * + * const twoSeconds = 3000; + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * + * ```js + * const assert = require('node:assert'); + * const { test } = require('node:test'); + * + * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { + * const fn = context.mock.fn(); + * context.mock.timers.enable(['setTimeout']); + * const nineSecs = 9000; + * setTimeout(fn, nineSecs); + * + * const twoSeconds = 3000; + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * context.mock.timers.tick(twoSeconds); + * + * assert.strictEqual(fn.mock.callCount(), 1); + * }); + * ``` + * @since v20.4.0 + */ + tick(milliseconds: number): void; + /** + * Triggers all pending mocked timers immediately. + * + * The example below triggers all pending timers immediately, + * causing them to execute without any delay. + * + * ```js + * import assert from 'node:assert'; + * import { test } from 'node:test'; + * + * test('runAll functions following the given order', (context) => { + * context.mock.timers.enable(['setTimeout']); + * const results = []; + * setTimeout(() => results.push(1), 9999); + * + * // Notice that if both timers have the same timeout, + * // the order of execution is guaranteed + * setTimeout(() => results.push(3), 8888); + * setTimeout(() => results.push(2), 8888); + * + * assert.deepStrictEqual(results, []); + * + * context.mock.timers.runAll(); + * + * assert.deepStrictEqual(results, [3, 2, 1]); + * }); + * ``` + * + * ```js + * const assert = require('node:assert'); + * const { test } = require('node:test'); + * + * test('runAll functions following the given order', (context) => { + * context.mock.timers.enable(['setTimeout']); + * const results = []; + * setTimeout(() => results.push(1), 9999); + * + * // Notice that if both timers have the same timeout, + * // the order of execution is guaranteed + * setTimeout(() => results.push(3), 8888); + * setTimeout(() => results.push(2), 8888); + * + * assert.deepStrictEqual(results, []); + * + * context.mock.timers.runAll(); + * + * assert.deepStrictEqual(results, [3, 2, 1]); + * }); + * ``` + * + * **Note:** The `runAll()` function is specifically designed for + * triggering timers in the context of timer mocking. + * It does not have any effect on real-time system + * clocks or actual timers outside of the mocking environment. + * @since v20.4.0 + */ + runAll(): void; + } export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock, skip, only, todo }; } + +interface DiagnosticData { + /** + * The diagnostic message. + */ + message: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestFail { + /** + * Additional execution metadata. + */ + details: { + /** + * The duration of the test in milliseconds. + */ + duration: number; + /** + * The error thrown by the test. + */ + error: Error; + }; + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The ordinal number of the test. + */ + testNumber: number; + /** + * Present if `context.todo` is called. + */ + todo?: string | boolean; + /** + * Present if `context.skip` is called. + */ + skip?: string | boolean; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestPass { + /** + * Additional execution metadata. + */ + details: { + /** + * The duration of the test in milliseconds. + */ + duration: number; + }; + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The ordinal number of the test. + */ + testNumber: number; + /** + * Present if `context.todo` is called. + */ + todo?: string | boolean; + /** + * Present if `context.skip` is called. + */ + skip?: string | boolean; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestPlan { + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The number of subtests that have ran. + */ + count: number; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestStart { + /** + * The test name. + */ + name: string; + /** + * The nesting level of the test. + */ + nesting: number; + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; +} +interface TestStderr { + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; + /** + * The message written to `stderr` + */ + message: string; +} +interface TestStdout { + /** + * The path of the test file, undefined if test is not ran through a file. + */ + file?: string; + /** + * The message written to `stdout` + */ + message: string; +} + +/** + * The `node:test/reporters` module exposes the builtin-reporters for `node:test`. + * To access it: + * + * ```js + * import test from 'node:test/reporters'; + * ``` + * + * This module is only available under the `node:` scheme. The following will not + * work: + * + * ```js + * import test from 'test/reporters'; + * ``` + * @since v19.9.0 + * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/test/reporters.js) + */ +declare module 'node:test/reporters' { + import { Transform } from 'node:stream'; + + type TestEvent = + | { type: 'test:diagnostic', data: DiagnosticData } + | { type: 'test:fail', data: TestFail } + | { type: 'test:pass', data: TestPass } + | { type: 'test:plan', data: TestPlan } + | { type: 'test:start', data: TestStart } + | { type: 'test:stderr', data: TestStderr } + | { type: 'test:stdout', data: TestStdout }; + type TestEventGenerator = AsyncGenerator; + + /** + * 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`. + */ + function dot(source: TestEventGenerator): AsyncGenerator<'\n' | '.' | 'X', void>; + /** + * The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format. + */ + function tap(source: TestEventGenerator): AsyncGenerator; + /** + * The `spec` reporter outputs the test results in a human-readable format. + */ + class Spec extends Transform { + constructor(); + } + export { dot, tap, Spec as spec }; +} diff --git a/node_modules/@types/node/ts4.8/tls.d.ts b/node_modules/@types/node/ts4.8/tls.d.ts index 13ee5635..4992b248 100755 --- a/node_modules/@types/node/ts4.8/tls.d.ts +++ b/node_modules/@types/node/ts4.8/tls.d.ts @@ -728,6 +728,17 @@ declare module 'tls' { } type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1'; interface SecureContextOptions { + /** + * If set, this will be called when a client opens a connection using the ALPN extension. + * One argument will be passed to the callback: an object containing `servername` and `protocols` fields, + * respectively containing the server name from the SNI extension (if any) and an array of + * ALPN protocol name strings. The callback must return either one of the strings listed in `protocols`, + * which will be returned to the client as the selected ALPN protocol, or `undefined`, + * to reject the connection with a fatal alert. If a string is returned that does not match one of + * the client's ALPN protocols, an error will be thrown. + * This option cannot be used with the `ALPNProtocols` option, and setting both options will throw an error. + */ + ALPNCallback?: ((arg: { servername: string; protocols: string[] }) => string | undefined) | undefined; /** * Optionally override the trusted CA certificates. Default is to trust * the well-known CAs curated by Mozilla. Mozilla's CAs are completely diff --git a/node_modules/@types/node/ts4.8/tty.d.ts b/node_modules/@types/node/ts4.8/tty.d.ts index ca9ab823..7653bf80 100755 --- a/node_modules/@types/node/ts4.8/tty.d.ts +++ b/node_modules/@types/node/ts4.8/tty.d.ts @@ -42,7 +42,10 @@ declare module 'tty' { constructor(fd: number, options?: net.SocketConstructorOpts); /** * A `boolean` that is `true` if the TTY is currently configured to operate as a - * raw device. Defaults to `false`. + * raw device. + * + * This flag is always `false` when a process starts, even if the terminal is + * operating in raw mode. Its value will change with subsequent calls to`setRawMode`. * @since v0.7.7 */ isRaw: boolean; diff --git a/node_modules/@types/node/ts4.8/util.d.ts b/node_modules/@types/node/ts4.8/util.d.ts index 228a2c89..df1fd121 100755 --- a/node_modules/@types/node/ts4.8/util.d.ts +++ b/node_modules/@types/node/ts4.8/util.d.ts @@ -1460,32 +1460,72 @@ declare module 'util' { /** * Gets and sets the type portion of the MIME. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const myMIME = new MIMEType('text/javascript'); + * console.log(myMIME.type); + * // Prints: text + * myMIME.type = 'application'; + * console.log(myMIME.type); + * // Prints: application + * console.log(String(myMIME)); + * // Prints: application/javascript + * ``` */ type: string; /** * Gets and sets the subtype portion of the MIME. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const myMIME = new MIMEType('text/ecmascript'); + * console.log(myMIME.subtype); + * // Prints: ecmascript + * myMIME.subtype = 'javascript'; + * console.log(myMIME.subtype); + * // Prints: javascript + * console.log(String(myMIME)); + * // Prints: text/javascript + * ``` */ subtype: string; /** - * Gets the essence of the MIME. - * + * Gets the essence of the MIME. This property is read only. * Use `mime.type` or `mime.subtype` to alter the MIME. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const myMIME = new MIMEType('text/javascript;key=value'); + * console.log(myMIME.essence); + * // Prints: text/javascript + * myMIME.type = 'application'; + * console.log(myMIME.essence); + * // Prints: application/javascript + * console.log(String(myMIME)); + * // Prints: application/javascript;key=value + * ``` */ readonly essence: string; /** - * Gets the `MIMEParams` object representing the parameters of the MIME. + * Gets the `MIMEParams` object representing the + * parameters of the MIME. This property is read-only. See `MIMEParams` documentation for details. */ readonly params: MIMEParams; /** - * Returns the serialized MIME. + * The `toString()` method on the `MIMEType` object returns the serialized MIME. * - * Because of the need for standard compliance, this method - * does not allow users to customize the serialization process of the MIME. + * Because of the need for standard compliance, this method does not allow users + * to customize the serialization process of the MIME. */ toString(): string; } /** - * @since v18.13.0 + * The `MIMEParams` API provides read and write access to the parameters of a`MIMEType`. + * @since v19.1.0, v18.13.0 */ export class MIMEParams { /** @@ -1494,11 +1534,14 @@ declare module 'util' { delete(name: string): void; /** * Returns an iterator over each of the name-value pairs in the parameters. + * Each item of the iterator is a JavaScript `Array`. The first item of the array + * is the `name`, the second item of the array is the `value`. */ entries(): IterableIterator<[string, string]>; /** - * Returns the value of the first name-value pair whose name is `name`. - * If there are no such pairs, `null` is returned. + * Returns the value of the first name-value pair whose name is `name`. If there + * are no such pairs, `null` is returned. + * @return or `null` if there is no name-value pair with the given `name`. */ get(name: string): string | null; /** @@ -1507,12 +1550,33 @@ declare module 'util' { has(name: string): boolean; /** * Returns an iterator over the names of each name-value pair. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const { params } = new MIMEType('text/plain;foo=0;bar=1'); + * for (const name of params.keys()) { + * console.log(name); + * } + * // Prints: + * // foo + * // bar + * ``` */ keys(): IterableIterator; /** - * Sets the value in the `MIMEParams` object associated with `name` to `value`. - * If there are any pre-existing name-value pairs whose names are `name`, + * Sets the value in the `MIMEParams` object associated with `name` to`value`. If there are any pre-existing name-value pairs whose names are `name`, * set the first such pair's value to `value`. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const { params } = new MIMEType('text/plain;foo=0;bar=1'); + * params.set('foo', 'def'); + * params.set('baz', 'xyz'); + * console.log(params.toString()); + * // Prints: foo=def&bar=1&baz=xyz + * ``` */ set(name: string, value: string): void; /** diff --git a/node_modules/@types/node/ts4.8/wasi.d.ts b/node_modules/@types/node/ts4.8/wasi.d.ts index 9262e98b..b430b3a9 100755 --- a/node_modules/@types/node/ts4.8/wasi.d.ts +++ b/node_modules/@types/node/ts4.8/wasi.d.ts @@ -58,8 +58,8 @@ * * Use [wabt](https://github.com/WebAssembly/wabt) to compile `.wat` to `.wasm` * - * ```console - * $ wat2wasm demo.wat + * ```bash + * wat2wasm demo.wat * ``` * @experimental * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/wasi.js) diff --git a/node_modules/@types/node/tty.d.ts b/node_modules/@types/node/tty.d.ts index ca9ab823..7653bf80 100755 --- a/node_modules/@types/node/tty.d.ts +++ b/node_modules/@types/node/tty.d.ts @@ -42,7 +42,10 @@ declare module 'tty' { constructor(fd: number, options?: net.SocketConstructorOpts); /** * A `boolean` that is `true` if the TTY is currently configured to operate as a - * raw device. Defaults to `false`. + * raw device. + * + * This flag is always `false` when a process starts, even if the terminal is + * operating in raw mode. Its value will change with subsequent calls to`setRawMode`. * @since v0.7.7 */ isRaw: boolean; diff --git a/node_modules/@types/node/util.d.ts b/node_modules/@types/node/util.d.ts index ce46cb7d..824975f4 100755 --- a/node_modules/@types/node/util.d.ts +++ b/node_modules/@types/node/util.d.ts @@ -1460,32 +1460,72 @@ declare module 'util' { /** * Gets and sets the type portion of the MIME. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const myMIME = new MIMEType('text/javascript'); + * console.log(myMIME.type); + * // Prints: text + * myMIME.type = 'application'; + * console.log(myMIME.type); + * // Prints: application + * console.log(String(myMIME)); + * // Prints: application/javascript + * ``` */ type: string; /** * Gets and sets the subtype portion of the MIME. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const myMIME = new MIMEType('text/ecmascript'); + * console.log(myMIME.subtype); + * // Prints: ecmascript + * myMIME.subtype = 'javascript'; + * console.log(myMIME.subtype); + * // Prints: javascript + * console.log(String(myMIME)); + * // Prints: text/javascript + * ``` */ subtype: string; /** - * Gets the essence of the MIME. - * + * Gets the essence of the MIME. This property is read only. * Use `mime.type` or `mime.subtype` to alter the MIME. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const myMIME = new MIMEType('text/javascript;key=value'); + * console.log(myMIME.essence); + * // Prints: text/javascript + * myMIME.type = 'application'; + * console.log(myMIME.essence); + * // Prints: application/javascript + * console.log(String(myMIME)); + * // Prints: application/javascript;key=value + * ``` */ readonly essence: string; /** - * Gets the `MIMEParams` object representing the parameters of the MIME. + * Gets the `MIMEParams` object representing the + * parameters of the MIME. This property is read-only. See `MIMEParams` documentation for details. */ readonly params: MIMEParams; /** - * Returns the serialized MIME. + * The `toString()` method on the `MIMEType` object returns the serialized MIME. * - * Because of the need for standard compliance, this method - * does not allow users to customize the serialization process of the MIME. + * Because of the need for standard compliance, this method does not allow users + * to customize the serialization process of the MIME. */ toString(): string; } /** - * @since v18.13.0 + * The `MIMEParams` API provides read and write access to the parameters of a`MIMEType`. + * @since v19.1.0, v18.13.0 */ export class MIMEParams { /** @@ -1494,11 +1534,14 @@ declare module 'util' { delete(name: string): void; /** * Returns an iterator over each of the name-value pairs in the parameters. + * Each item of the iterator is a JavaScript `Array`. The first item of the array + * is the `name`, the second item of the array is the `value`. */ entries(): IterableIterator<[name: string, value: string]>; /** - * Returns the value of the first name-value pair whose name is `name`. - * If there are no such pairs, `null` is returned. + * Returns the value of the first name-value pair whose name is `name`. If there + * are no such pairs, `null` is returned. + * @return or `null` if there is no name-value pair with the given `name`. */ get(name: string): string | null; /** @@ -1507,12 +1550,33 @@ declare module 'util' { has(name: string): boolean; /** * Returns an iterator over the names of each name-value pair. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const { params } = new MIMEType('text/plain;foo=0;bar=1'); + * for (const name of params.keys()) { + * console.log(name); + * } + * // Prints: + * // foo + * // bar + * ``` */ keys(): IterableIterator; /** - * Sets the value in the `MIMEParams` object associated with `name` to `value`. - * If there are any pre-existing name-value pairs whose names are `name`, + * Sets the value in the `MIMEParams` object associated with `name` to`value`. If there are any pre-existing name-value pairs whose names are `name`, * set the first such pair's value to `value`. + * + * ```js + * import { MIMEType } from 'node:util'; + * + * const { params } = new MIMEType('text/plain;foo=0;bar=1'); + * params.set('foo', 'def'); + * params.set('baz', 'xyz'); + * console.log(params.toString()); + * // Prints: foo=def&bar=1&baz=xyz + * ``` */ set(name: string, value: string): void; /** diff --git a/node_modules/@types/node/wasi.d.ts b/node_modules/@types/node/wasi.d.ts index 9262e98b..b430b3a9 100755 --- a/node_modules/@types/node/wasi.d.ts +++ b/node_modules/@types/node/wasi.d.ts @@ -58,8 +58,8 @@ * * Use [wabt](https://github.com/WebAssembly/wabt) to compile `.wat` to `.wasm` * - * ```console - * $ wat2wasm demo.wat + * ```bash + * wat2wasm demo.wat * ``` * @experimental * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/wasi.js) diff --git a/node_modules/execa/node_modules/semver/CHANGELOG.md b/node_modules/execa/node_modules/semver/CHANGELOG.md deleted file mode 100644 index 66304fdd..00000000 --- a/node_modules/execa/node_modules/semver/CHANGELOG.md +++ /dev/null @@ -1,39 +0,0 @@ -# changes log - -## 5.7 - -* Add `minVersion` method - -## 5.6 - -* Move boolean `loose` param to an options object, with - backwards-compatibility protection. -* Add ability to opt out of special prerelease version handling with - the `includePrerelease` option flag. - -## 5.5 - -* Add version coercion capabilities - -## 5.4 - -* Add intersection checking - -## 5.3 - -* Add `minSatisfying` method - -## 5.2 - -* Add `prerelease(v)` that returns prerelease components - -## 5.1 - -* Add Backus-Naur for ranges -* Remove excessively cute inspection methods - -## 5.0 - -* Remove AMD/Browserified build artifacts -* Fix ltr and gtr when using the `*` range -* Fix for range `*` with a prerelease identifier diff --git a/node_modules/execa/node_modules/semver/package.json b/node_modules/execa/node_modules/semver/package.json index 69d2db16..db035e97 100644 --- a/node_modules/execa/node_modules/semver/package.json +++ b/node_modules/execa/node_modules/semver/package.json @@ -1,19 +1,26 @@ { "name": "semver", - "version": "5.7.1", + "version": "5.7.2", "description": "The semantic version parser used by npm.", "main": "semver.js", "scripts": { - "test": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --all; git push origin --tags" + "test": "tap test/ --100 --timeout=30", + "lint": "echo linting disabled", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "snap": "tap test/ --100 --timeout=30", + "posttest": "npm run lint" }, "devDependencies": { - "tap": "^13.0.0-rc.18" + "@npmcli/template-oss": "4.17.0", + "tap": "^12.7.0" }, "license": "ISC", - "repository": "https://github.com/npm/node-semver", + "repository": { + "type": "git", + "url": "https://github.com/npm/node-semver.git" + }, "bin": { "semver": "./bin/semver" }, @@ -22,7 +29,10 @@ "range.bnf", "semver.js" ], - "tap": { - "check-coverage": true + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "content": "./scripts/template-oss", + "version": "4.17.0" } } diff --git a/node_modules/execa/node_modules/semver/semver.js b/node_modules/execa/node_modules/semver/semver.js index d315d5d6..dcb68334 100644 --- a/node_modules/execa/node_modules/semver/semver.js +++ b/node_modules/execa/node_modules/semver/semver.js @@ -26,11 +26,39 @@ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || // Max safe segment length for coercion. var MAX_SAFE_COMPONENT_LENGTH = 16 +var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + // The actual regexps go on exports.re var re = exports.re = [] +var safeRe = exports.safeRe = [] var src = exports.src = [] var R = 0 +var LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +var safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +function makeSafeRe (value) { + for (var i = 0; i < safeRegexReplacements.length; i++) { + var token = safeRegexReplacements[i][0] + var max = safeRegexReplacements[i][1] + value = value + .split(token + '*').join(token + '{0,' + max + '}') + .split(token + '+').join(token + '{1,' + max + '}') + } + return value +} + // The following Regular Expressions can be used for tokenizing, // validating, and parsing SemVer version strings. @@ -40,14 +68,14 @@ var R = 0 var NUMERICIDENTIFIER = R++ src[NUMERICIDENTIFIER] = '0|[1-9]\\d*' var NUMERICIDENTIFIERLOOSE = R++ -src[NUMERICIDENTIFIERLOOSE] = '[0-9]+' +src[NUMERICIDENTIFIERLOOSE] = '\\d+' // ## Non-numeric Identifier // Zero or more digits, followed by a letter or hyphen, and then zero or // more letters, digits, or hyphens. var NONNUMERICIDENTIFIER = R++ -src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*' +src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*' // ## Main Version // Three dot-separated numeric identifiers. @@ -89,7 +117,7 @@ src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + // Any combination of digits, letters, or hyphens. var BUILDIDENTIFIER = R++ -src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+' +src[BUILDIDENTIFIER] = LETTERDASHNUMBER + '+' // ## Build Metadata // Plus sign, followed by one or more period-separated build metadata @@ -174,6 +202,7 @@ src[LONETILDE] = '(?:~>?)' var TILDETRIM = R++ src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+' re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g') +safeRe[TILDETRIM] = new RegExp(makeSafeRe(src[TILDETRIM]), 'g') var tildeTrimReplace = '$1~' var TILDE = R++ @@ -189,6 +218,7 @@ src[LONECARET] = '(?:\\^)' var CARETTRIM = R++ src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+' re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g') +safeRe[CARETTRIM] = new RegExp(makeSafeRe(src[CARETTRIM]), 'g') var caretTrimReplace = '$1^' var CARET = R++ @@ -210,6 +240,7 @@ src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + // this one has to use the /g flag re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g') +safeRe[COMPARATORTRIM] = new RegExp(makeSafeRe(src[COMPARATORTRIM]), 'g') var comparatorTrimReplace = '$1$2$3' // Something like `1.2.3 - 1.2.4` @@ -238,6 +269,14 @@ for (var i = 0; i < R; i++) { debug(i, src[i]) if (!re[i]) { re[i] = new RegExp(src[i]) + + // Replace all greedy whitespace to prevent regex dos issues. These regex are + // used internally via the safeRe object since all inputs in this library get + // normalized first to trim and collapse all extra whitespace. The original + // regexes are exported for userland consumption and lower level usage. A + // future breaking change could export the safer regex only with a note that + // all input should have extra whitespace removed. + safeRe[i] = new RegExp(makeSafeRe(src[i])) } } @@ -262,7 +301,7 @@ function parse (version, options) { return null } - var r = options.loose ? re[LOOSE] : re[FULL] + var r = options.loose ? safeRe[LOOSE] : safeRe[FULL] if (!r.test(version)) { return null } @@ -317,7 +356,7 @@ function SemVer (version, options) { this.options = options this.loose = !!options.loose - var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]) + var m = version.trim().match(options.loose ? safeRe[LOOSE] : safeRe[FULL]) if (!m) { throw new TypeError('Invalid Version: ' + version) @@ -731,6 +770,7 @@ function Comparator (comp, options) { return new Comparator(comp, options) } + comp = comp.trim().split(/\s+/).join(' ') debug('comparator', comp, options) this.options = options this.loose = !!options.loose @@ -747,7 +787,7 @@ function Comparator (comp, options) { var ANY = {} Comparator.prototype.parse = function (comp) { - var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR] + var r = this.options.loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR] var m = comp.match(r) if (!m) { @@ -861,9 +901,16 @@ function Range (range, options) { this.loose = !!options.loose this.includePrerelease = !!options.includePrerelease - // First, split based on boolean or || + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. this.raw = range - this.set = range.split(/\s*\|\|\s*/).map(function (range) { + .trim() + .split(/\s+/) + .join(' ') + + // First, split based on boolean or || + this.set = this.raw.split('||').map(function (range) { return this.parseRange(range.trim()) }, this).filter(function (c) { // throw out any that are not relevant for whatever reason @@ -871,7 +918,7 @@ function Range (range, options) { }) if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range) + throw new TypeError('Invalid SemVer Range: ' + this.raw) } this.format() @@ -890,28 +937,23 @@ Range.prototype.toString = function () { Range.prototype.parseRange = function (range) { var loose = this.options.loose - range = range.trim() // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE] + var hr = loose ? safeRe[HYPHENRANGELOOSE] : safeRe[HYPHENRANGE] range = range.replace(hr, hyphenReplace) debug('hyphen replace', range) // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[COMPARATORTRIM]) + range = range.replace(safeRe[COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, safeRe[COMPARATORTRIM]) // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[TILDETRIM], tildeTrimReplace) + range = range.replace(safeRe[TILDETRIM], tildeTrimReplace) // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[CARETTRIM], caretTrimReplace) - - // normalize spaces - range = range.split(/\s+/).join(' ') + range = range.replace(safeRe[CARETTRIM], caretTrimReplace) // At this point, the range is completely trimmed and // ready to be split into comparators. - - var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR] + var compRe = loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR] var set = range.split(' ').map(function (comp) { return parseComparator(comp, this.options) }, this).join(' ').split(/\s+/) @@ -987,7 +1029,7 @@ function replaceTildes (comp, options) { } function replaceTilde (comp, options) { - var r = options.loose ? re[TILDELOOSE] : re[TILDE] + var r = options.loose ? safeRe[TILDELOOSE] : safeRe[TILDE] return comp.replace(r, function (_, M, m, p, pr) { debug('tilde', comp, _, M, m, p, pr) var ret @@ -1028,7 +1070,7 @@ function replaceCarets (comp, options) { function replaceCaret (comp, options) { debug('caret', comp, options) - var r = options.loose ? re[CARETLOOSE] : re[CARET] + var r = options.loose ? safeRe[CARETLOOSE] : safeRe[CARET] return comp.replace(r, function (_, M, m, p, pr) { debug('caret', comp, _, M, m, p, pr) var ret @@ -1087,7 +1129,7 @@ function replaceXRanges (comp, options) { function replaceXRange (comp, options) { comp = comp.trim() - var r = options.loose ? re[XRANGELOOSE] : re[XRANGE] + var r = options.loose ? safeRe[XRANGELOOSE] : safeRe[XRANGE] return comp.replace(r, function (ret, gtlt, M, m, p, pr) { debug('xRange', comp, ret, gtlt, M, m, p, pr) var xM = isX(M) @@ -1157,10 +1199,10 @@ function replaceXRange (comp, options) { function replaceStars (comp, options) { debug('replaceStars', comp, options) // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[STAR], '') + return comp.trim().replace(safeRe[STAR], '') } -// This function is passed to string.replace(re[HYPHENRANGE]) +// This function is passed to string.replace(safeRe[HYPHENRANGE]) // M, m, patch, prerelease, build // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do @@ -1471,7 +1513,7 @@ function coerce (version) { return null } - var match = version.match(re[COERCE]) + var match = version.match(safeRe[COERCE]) if (match == null) { return null