Update deps

This commit is contained in:
Anton Medvedev 2023-03-28 17:15:22 +02:00
parent eed58e3496
commit 363bb1be96
126 changed files with 5743 additions and 2737 deletions

2
node_modules/.bin/node-which generated vendored

@ -1 +1 @@
../which/bin/node-which
../which/bin/which.js

1
node_modules/.bin/webpod generated vendored Symbolic link

@ -0,0 +1 @@
../webpod/dist/index.js

92
node_modules/.package-lock.json generated vendored

@ -53,9 +53,18 @@
}
},
"node_modules/@types/fs-extra": {
"version": "9.0.13",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz",
"integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==",
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.1.tgz",
"integrity": "sha512-MxObHvNl4A69ofaTRU8DFqvgzzv8s9yRtaPPm5gud9HDNvpB3GPQFvNuTWAI59B9huVGV5jXYJwbCsmBsOGYWA==",
"dependencies": {
"@types/jsonfile": "*",
"@types/node": "*"
}
},
"node_modules/@types/jsonfile": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.1.tgz",
"integrity": "sha512-GSgiRCVeapDN+3pqA35IkQwasaCh/0YFH5dEF6S88iDvEn901DjOeH3/QPY+XYP1DFzDZPvIvfeEgk+7br5png==",
"dependencies": {
"@types/node": "*"
}
@ -66,9 +75,9 @@
"integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ=="
},
"node_modules/@types/node": {
"version": "18.11.18",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz",
"integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA=="
"version": "18.15.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.10.tgz",
"integrity": "sha512-9avDaQJczATcXgfmMAW3MIWArOO7A+m90vuCFLr8AotWf8igO/mRoYukrk2cqZVtv38tHs33retzHEilM7FpeQ=="
},
"node_modules/@types/ps-tree": {
"version": "1.1.2",
@ -76,9 +85,9 @@
"integrity": "sha512-ZREFYlpUmPQJ0esjxoG1fMvB2HNaD3z+mjqdSosZvd3RalncI9NEur73P8ZJz4YQdL64CmV1w0RuqoRUlhQRBw=="
},
"node_modules/@types/which": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@types/which/-/which-2.0.1.tgz",
"integrity": "sha512-Jjakcv8Roqtio6w1gr0D7y6twbhx6gGgFGF5BLwajPpnOIOxFkakFhCq+LmyyeAz7BX6ULrjBOxdKaCDy+4+dQ=="
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@types/which/-/which-2.0.2.tgz",
"integrity": "sha512-113D3mDkZDjo+EeUEHCFy0qniNc1ZpecGiAU7WSo7YDoSzolZIQKpYFHrPpjkB2nuyahcKfrmLXeQlh7gqJYdw=="
},
"node_modules/braces": {
"version": "3.0.2",
@ -213,16 +222,16 @@
"integrity": "sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g=="
},
"node_modules/fs-extra": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
"integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz",
"integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==",
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
},
"engines": {
"node": ">=12"
"node": ">=14.14"
}
},
"node_modules/glob-parent": {
@ -255,9 +264,9 @@
}
},
"node_modules/graceful-fs": {
"version": "4.2.10",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
"integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA=="
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="
},
"node_modules/ignore": {
"version": "5.2.4",
@ -297,7 +306,7 @@
"node_modules/isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
},
"node_modules/jsonfile": {
"version": "6.1.0",
@ -336,9 +345,9 @@
}
},
"node_modules/minimist": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==",
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
@ -547,18 +556,26 @@
"node": ">= 8"
}
},
"node_modules/webpod": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/webpod/-/webpod-0.0.2.tgz",
"integrity": "sha512-cSwwQIeg8v4i3p4ajHhwgR7N6VyxAf+KYSSsY6Pd3aETE+xEU4vbitz7qQkB0I321xnhDdgtxuiSfk5r/FVtjg==",
"bin": {
"webpod": "dist/index.js"
}
},
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/which/-/which-3.0.0.tgz",
"integrity": "sha512-nla//68K9NU6yRiwDY/Q8aU6siKlSs64aEC7+IV56QoAuyQT2ovsJcgGYGyqMOmI/CGN1BOR6mM5EN0FBO+zyQ==",
"dependencies": {
"isexe": "^2.0.0"
},
"bin": {
"node-which": "bin/node-which"
"node-which": "bin/which.js"
},
"engines": {
"node": ">= 8"
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
}
},
"node_modules/yaml": {
@ -570,23 +587,24 @@
}
},
"node_modules/zx": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/zx/-/zx-7.1.1.tgz",
"integrity": "sha512-5YlTO2AJ+Ku2YuZKSSSqnUKuagcM/f/j4LmHs15O84Ch80Z9gzR09ZK3gR7GV+rc8IFpz2H/XNFtFVmj31yrZA==",
"version": "7.2.1",
"resolved": "https://registry.npmjs.org/zx/-/zx-7.2.1.tgz",
"integrity": "sha512-TgKwppaMLMNAXHhlhbBh7rMoOSx3/9qqnkv8frmhVlSomEuWkDijh/BCmYntkoS7ZQyemApAUyEi24jIrrS+hA==",
"dependencies": {
"@types/fs-extra": "^9.0.13",
"@types/fs-extra": "^11.0.1",
"@types/minimist": "^1.2.2",
"@types/node": "^18.7.20",
"@types/node": "^18.14.2",
"@types/ps-tree": "^1.1.2",
"@types/which": "^2.0.1",
"chalk": "^5.0.1",
"fs-extra": "^10.1.0",
"globby": "^13.1.2",
"minimist": "^1.2.6",
"@types/which": "^2.0.2",
"chalk": "^5.2.0",
"fs-extra": "^11.1.0",
"globby": "^13.1.3",
"minimist": "^1.2.8",
"node-fetch": "3.2.10",
"ps-tree": "^1.2.0",
"which": "^2.0.2",
"yaml": "^2.1.1"
"webpod": "^0",
"which": "^3.0.0",
"yaml": "^2.2.1"
},
"bin": {
"zx": "build/cli.js"

@ -1,16 +1,16 @@
# Installation
> `npm install --save @types/fs-extra`
# Summary
This package contains type definitions for fs-extra (https://github.com/jprichardson/node-fs-extra).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra.
### Additional Details
* Last updated: Tue, 21 Sep 2021 19:02:14 GMT
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
* Global values: none
# Credits
These definitions were written by [Alan Agius](https://github.com/alan-agius4), [midknight41](https://github.com/midknight41), [Brendan Forster](https://github.com/shiftkey), [Mees van Dijk](https://github.com/mees-), [Justin Rockwood](https://github.com/jrockwood), [Sang Dang](https://github.com/sangdth), [Florian Keller](https://github.com/ffflorian), [Piotr Błażejewicz](https://github.com/peterblazejewicz), and [Tiger Oakes](https://github.com/NotWoods).
# Installation
> `npm install --save @types/fs-extra`
# Summary
This package contains type definitions for fs-extra (https://github.com/jprichardson/node-fs-extra).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra.
### Additional Details
* Last updated: Tue, 10 Jan 2023 19:32:54 GMT
* Dependencies: [@types/jsonfile](https://npmjs.com/package/@types/jsonfile), [@types/node](https://npmjs.com/package/@types/node)
* Global values: none
# Credits
These definitions were written by [Alan Agius](https://github.com/alan-agius4), [midknight41](https://github.com/midknight41), [Brendan Forster](https://github.com/shiftkey), [Mees van Dijk](https://github.com/mees-), [Justin Rockwood](https://github.com/jrockwood), [Sang Dang](https://github.com/sangdth), [Florian Keller](https://github.com/ffflorian), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Tiger Oakes](https://github.com/NotWoods), and [BendingBender](https://github.com/BendingBender).

111
node_modules/@types/fs-extra/esm.d.mts generated vendored Executable file

@ -0,0 +1,111 @@
import * as fse from './index.js';
export {
copy,
copySync,
emptyDirSync,
emptydirSync,
emptyDir,
emptydir,
createFile,
createFileSync,
ensureFile,
ensureFileSync,
createLink,
createLinkSync,
ensureLink,
ensureLinkSync,
createSymlink,
createSymlinkSync,
ensureSymlink,
ensureSymlinkSync,
readJson,
readJSON,
readJsonSync,
readJSONSync,
writeJson,
writeJSON,
writeJsonSync,
writeJSONSync,
outputJson,
outputJSON,
outputJsonSync,
outputJSONSync,
mkdirs,
mkdirsSync,
mkdirp,
mkdirpSync,
ensureDir,
ensureDirSync,
move,
moveSync,
outputFile,
outputFileSync,
pathExists,
pathExistsSync,
remove,
removeSync,
PathLike,
NoParamCallback,
NoParamCallbackWithUndefined,
SymlinkType,
CopyFilterSync,
CopyFilterAsync,
CopyOptions,
CopyOptionsSync,
EnsureDirOptions,
MoveOptions,
WriteFileOptions,
JsonReadOptions,
JsonWriteOptions,
JsonOutputOptions,
} from './index.js';
declare const fsExtra: {
copy: typeof fse.copy;
copySync: typeof fse.copySync;
emptyDirSync: typeof fse.emptyDirSync;
emptydirSync: typeof fse.emptydirSync;
emptyDir: typeof fse.emptyDir;
emptydir: typeof fse.emptydir;
createFile: typeof fse.createFile;
createFileSync: typeof fse.createFileSync;
ensureFile: typeof fse.ensureFile;
ensureFileSync: typeof fse.ensureFileSync;
createLink: typeof fse.createLink;
createLinkSync: typeof fse.createLinkSync;
ensureLink: typeof fse.ensureLink;
ensureLinkSync: typeof fse.ensureLinkSync;
createSymlink: typeof fse.createSymlink;
createSymlinkSync: typeof fse.createSymlinkSync;
ensureSymlink: typeof fse.ensureSymlink;
ensureSymlinkSync: typeof fse.ensureSymlinkSync;
readJson: typeof fse.readJson;
readJSON: typeof fse.readJSON;
readJsonSync: typeof fse.readJsonSync;
readJSONSync: typeof fse.readJSONSync;
writeJson: typeof fse.writeJson;
writeJSON: typeof fse.writeJSON;
writeJsonSync: typeof fse.writeJsonSync;
writeJSONSync: typeof fse.writeJSONSync;
outputJson: typeof fse.outputJson;
outputJSON: typeof fse.outputJSON;
outputJsonSync: typeof fse.outputJsonSync;
outputJSONSync: typeof fse.outputJSONSync;
mkdirs: typeof fse.mkdirs;
mkdirsSync: typeof fse.mkdirsSync;
mkdirp: typeof fse.mkdirp;
mkdirpSync: typeof fse.mkdirpSync;
ensureDir: typeof fse.ensureDir;
ensureDirSync: typeof fse.ensureDirSync;
move: typeof fse.move;
moveSync: typeof fse.moveSync;
outputFile: typeof fse.outputFile;
outputFileSync: typeof fse.outputFileSync;
pathExists: typeof fse.pathExists;
pathExistsSync: typeof fse.pathExistsSync;
remove: typeof fse.remove;
removeSync: typeof fse.removeSync;
};
export default fsExtra;

1438
node_modules/@types/fs-extra/index.d.ts generated vendored

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
{
"name": "@types/fs-extra",
"version": "9.0.13",
"version": "11.0.1",
"description": "TypeScript definitions for fs-extra",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra",
"license": "MIT",
@ -49,6 +49,11 @@
"name": "Tiger Oakes",
"url": "https://github.com/NotWoods",
"githubUsername": "NotWoods"
},
{
"name": "BendingBender",
"url": "https://github.com/BendingBender",
"githubUsername": "BendingBender"
}
],
"main": "",
@ -60,8 +65,20 @@
},
"scripts": {},
"dependencies": {
"@types/jsonfile": "*",
"@types/node": "*"
},
"typesPublisherContentHash": "75e10d16a18d936a50e54414024604aa9484e8345b37c2027921869f254523ee",
"typeScriptVersion": "3.9"
"typesPublisherContentHash": "9244941e71bf5edda5456eb8aee9bd3d796ad970d74fb7991788553ac18c5d83",
"typeScriptVersion": "4.5",
"exports": {
".": {
"types": "./index.d.ts"
},
"./esm": {
"types": {
"import": "./esm.d.mts"
}
},
"./package.json": "./package.json"
}
}

21
node_modules/@types/jsonfile/LICENSE generated vendored Executable file

@ -0,0 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

16
node_modules/@types/jsonfile/README.md generated vendored Executable file

@ -0,0 +1,16 @@
# Installation
> `npm install --save @types/jsonfile`
# Summary
This package contains type definitions for jsonfile (https://github.com/jprichardson/node-jsonfile#readme).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jsonfile.
### Additional Details
* Last updated: Mon, 09 Jan 2023 00:02:44 GMT
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
* Global values: none
# Credits
These definitions were written by [Daniel Bowring](https://github.com/dbowring), [BendingBender](https://github.com/BendingBender), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).

78
node_modules/@types/jsonfile/index.d.ts generated vendored Executable file

@ -0,0 +1,78 @@
// Type definitions for jsonfile 6.1
// Project: https://github.com/jprichardson/node-jsonfile#readme
// Definitions by: Daniel Bowring <https://github.com/dbowring>
// BendingBender <https://github.com/BendingBender>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
import { Url } from 'url';
import {
PathLike,
readFile as fsReadFile,
readFileSync as fsReadFileSync,
writeFile as fsWriteFile,
writeFileSync as fsWriteFileSync,
} from 'fs';
export type Path = PathLike | Url;
export interface FS {
readFile: typeof fsReadFile;
readFileSync: typeof fsReadFileSync;
writeFile: typeof fsWriteFile;
writeFileSync: typeof fsWriteFileSync;
}
export type JFReadOptions =
| {
encoding?: string | null | undefined;
flag?: string | undefined;
throws?: boolean | undefined;
fs?: FS | undefined;
reviver?: ((key: any, value: any) => any) | undefined;
}
| string
| null
| undefined;
export type JFWriteOptions =
| {
encoding?: string | null | undefined;
mode?: string | number | undefined;
flag?: string | undefined;
fs?: FS | undefined;
EOL?: string | undefined;
spaces?: string | number | undefined;
replacer?: ((key: string, value: any) => any) | undefined;
}
| string
| null;
export type ReadCallback = (err: NodeJS.ErrnoException | null, data: any) => void;
export type WriteCallback = (err: NodeJS.ErrnoException | null) => void;
/**
* @see {@link https://github.com/jprichardson/node-jsonfile#readfilefilename-options-callback}
*/
export function readFile(file: Path, options: JFReadOptions, callback: ReadCallback): void;
export function readFile(file: Path, callback: ReadCallback): void;
export function readFile(file: Path, options?: JFReadOptions): Promise<any>;
/**
* @see {@link https://github.com/jprichardson/node-jsonfile#readfilesyncfilename-options}
*/
export function readFileSync(file: Path, options?: JFReadOptions): any;
/**
* @see {@link https://github.com/jprichardson/node-jsonfile#writefilefilename-obj-options-callback}
*/
export function writeFile(file: Path, obj: any, options: JFWriteOptions, callback: WriteCallback): void;
export function writeFile(file: Path, obj: any, callback: WriteCallback): void;
export function writeFile(file: Path, obj: any, options?: JFWriteOptions): Promise<void>;
/**
* @see {@link https://github.com/jprichardson/node-jsonfile#writefilesyncfilename-obj-options}
*/
export function writeFileSync(file: Path, obj: any, options?: JFWriteOptions): void;

37
node_modules/@types/jsonfile/package.json generated vendored Executable file

@ -0,0 +1,37 @@
{
"name": "@types/jsonfile",
"version": "6.1.1",
"description": "TypeScript definitions for jsonfile",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jsonfile",
"license": "MIT",
"contributors": [
{
"name": "Daniel Bowring",
"url": "https://github.com/dbowring",
"githubUsername": "dbowring"
},
{
"name": "BendingBender",
"url": "https://github.com/BendingBender",
"githubUsername": "BendingBender"
},
{
"name": "Piotr Błażejewicz",
"url": "https://github.com/peterblazejewicz",
"githubUsername": "peterblazejewicz"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/jsonfile"
},
"scripts": {},
"dependencies": {
"@types/node": "*"
},
"typesPublisherContentHash": "c1cbc44e364fab01fba30bb4617cea593123234baa610c3e5ad34decb6bb6799",
"typeScriptVersion": "4.2"
}

9
node_modules/@types/jsonfile/utils.d.ts generated vendored Executable file

@ -0,0 +1,9 @@
export function stringify(obj: any, options?: StringifyOptions): string;
export function stripBom(content: string): string;
export interface StringifyOptions {
EOL?: string | undefined;
finalEOL?: boolean | undefined;
replacer?: ((key: string, value: any) => any) | undefined;
spaces?: string | number | undefined;
}

32
node_modules/@types/node/README.md generated vendored

@ -1,16 +1,16 @@
# Installation
> `npm install --save @types/node`
# Summary
This package contains type definitions for Node.js (https://nodejs.org/).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
### Additional Details
* Last updated: Mon, 26 Dec 2022 17:32:37 GMT
* Dependencies: none
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
# Credits
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).
# Installation
> `npm install --save @types/node`
# Summary
This package contains type definitions for Node.js (https://nodejs.org/).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
### Additional Details
* Last updated: Sat, 25 Mar 2023 22:33:05 GMT
* Dependencies: none
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
# Credits
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).

@ -319,6 +319,16 @@ declare module 'async_hooks' {
*/
triggerAsyncId(): number;
}
interface AsyncLocalStorageOptions<T> {
/**
* Optional callback invoked before a store is propagated to a new async resource.
* Returning `true` allows propagation, returning `false` avoids it. Default is to propagate always.
* @param type The type of async event.
* @param store The current store.
* @since v18.13.0
*/
onPropagate?: ((type: string, store: T) => boolean) | undefined;
}
/**
* This class creates stores that stay coherent through asynchronous operations.
*
@ -368,6 +378,8 @@ declare module 'async_hooks' {
* @since v13.10.0, v12.17.0
*/
class AsyncLocalStorage<T> {
constructor(options?: AsyncLocalStorageOptions<T>);
/**
* Disables the instance of `AsyncLocalStorage`. All subsequent calls
* to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.

68
node_modules/@types/node/buffer.d.ts generated vendored

@ -46,6 +46,8 @@
declare module 'buffer' {
import { BinaryLike } from 'node:crypto';
import { ReadableStream as WebReadableStream } from 'node:stream/web';
export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
export const INSPECT_MAX_BYTES: number;
export const kMaxLength: number;
export const kStringMaxLength: number;
@ -163,17 +165,56 @@ declare module 'buffer' {
*/
stream(): WebReadableStream;
}
export interface FileOptions {
/**
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be
* converted to the platform native line-ending as specified by `require('node:os').EOL`.
*/
endings?: 'native' | 'transparent';
/** The File content-type. */
type?: string;
/** The last modified date of the file. `Default`: Date.now(). */
lastModified?: number;
}
/**
* A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files.
* @experimental
* @since v18.13.0
*/
export class File extends Blob {
constructor(sources: Array<BinaryLike | Blob>, fileName: string, options?: FileOptions);
/**
* The name of the `File`.
* @since v18.13.0
*/
readonly name: string;
/**
* The last modified date of the `File`.
* @since v18.13.0
*/
readonly lastModified: number;
}
export import atob = globalThis.atob;
export import btoa = globalThis.btoa;
import { Blob as NodeBlob } from 'buffer';
// This conditional type will be the existing global Blob in a browser, or
// the copy below in a Node environment.
type __Blob = typeof globalThis extends { onmessage: any, Blob: infer T }
? T : NodeBlob;
type __Blob = typeof globalThis extends { onmessage: any; Blob: infer T } ? T : NodeBlob;
global {
// Buffer class
type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex';
type BufferEncoding =
| 'ascii'
| 'utf8'
| 'utf-8'
| 'utf16le'
| 'ucs2'
| 'ucs-2'
| 'base64'
| 'base64url'
| 'latin1'
| 'binary'
| 'hex';
type WithImplicitCoercion<T> =
| T
| {
@ -247,7 +288,11 @@ declare module 'buffer' {
* `Buffer.from(array)` and `Buffer.from(string)` may also use the internal`Buffer` pool like `Buffer.allocUnsafe()` does.
* @since v5.10.0
*/
from(arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>, byteOffset?: number, length?: number): Buffer;
from(
arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>,
byteOffset?: number,
length?: number,
): Buffer;
/**
* Creates a new Buffer using the passed {data}
* @param data data to create a new Buffer
@ -265,7 +310,7 @@ declare module 'buffer' {
| {
[Symbol.toPrimitive](hint: 'string'): string;
},
encoding?: BufferEncoding
encoding?: BufferEncoding,
): Buffer;
/**
* Creates a new Buffer using the passed {data}
@ -339,7 +384,10 @@ declare module 'buffer' {
* @param [encoding='utf8'] If `string` is a string, this is its encoding.
* @return The number of bytes contained within `string`.
*/
byteLength(string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, encoding?: BufferEncoding): number;
byteLength(
string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
encoding?: BufferEncoding,
): number;
/**
* Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together.
*
@ -710,7 +758,13 @@ declare module 'buffer' {
* @param [sourceStart=0] The offset within `buf` at which to begin comparison.
* @param [sourceEnd=buf.length] The offset within `buf` at which to end comparison (not inclusive).
*/
compare(target: Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): -1 | 0 | 1;
compare(
target: Uint8Array,
targetStart?: number,
targetEnd?: number,
sourceStart?: number,
sourceEnd?: number,
): -1 | 0 | 1;
/**
* Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`.
*

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

@ -1190,11 +1190,13 @@ declare module 'crypto' {
format?: KeyFormat | undefined;
type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined;
passphrase?: string | Buffer | undefined;
encoding?: string | undefined;
}
interface PublicKeyInput {
key: string | Buffer;
format?: KeyFormat | undefined;
type?: 'pkcs1' | 'spki' | undefined;
encoding?: string | undefined;
}
/**
* Asynchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
@ -1305,6 +1307,7 @@ declare module 'crypto' {
interface VerifyKeyObjectInput extends SigningOptions {
key: KeyObject;
}
interface VerifyJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {}
type KeyLike = string | Buffer | KeyObject;
/**
* The `Sign` class is a utility for generating signatures. It can be used in one
@ -1459,8 +1462,8 @@ declare module 'crypto' {
* be passed instead of a public key.
* @since v0.1.92
*/
verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean;
verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean;
verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: NodeJS.ArrayBufferView): boolean;
verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean;
}
/**
* Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
@ -2968,11 +2971,16 @@ declare module 'crypto' {
* If the `callback` function is provided this function uses libuv's threadpool.
* @since v12.0.0
*/
function verify(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean;
function verify(
algorithm: string | null | undefined,
data: NodeJS.ArrayBufferView,
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput,
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
signature: NodeJS.ArrayBufferView
): boolean;
function verify(
algorithm: string | null | undefined,
data: NodeJS.ArrayBufferView,
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
signature: NodeJS.ArrayBufferView,
callback: (error: Error | null, result: boolean) => void
): void;
@ -3121,12 +3129,13 @@ declare module 'crypto' {
*/
disableEntropyCache?: boolean | undefined;
}
type UUID = `${string}-${string}-${string}-${string}-${string}`;
/**
* Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a
* cryptographic pseudorandom number generator.
* @since v15.6.0, v14.17.0
*/
function randomUUID(options?: RandomUUIDOptions): string;
function randomUUID(options?: RandomUUIDOptions): UUID;
interface X509CheckOptions {
/**
* @default 'always'
@ -3638,7 +3647,7 @@ declare module 'crypto' {
* The UUID is generated using a cryptographic pseudorandom number generator.
* @since v16.7.0
*/
randomUUID(): string;
randomUUID(): UUID;
CryptoKey: CryptoKeyConstructor;
}
// This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable.

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

2
node_modules/@types/node/dns.d.ts generated vendored

@ -174,7 +174,7 @@ declare module 'dns' {
type: 'AAAA';
}
export interface CaaRecord {
critial: number;
critical: number;
issue?: string | undefined;
issuewild?: string | undefined;
iodef?: string | undefined;

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

@ -131,6 +131,42 @@ declare module 'fs' {
* @since v0.1.21
*/
export class Stats {}
export interface StatsFsBase<T> {
/** Type of file system. */
type: T;
/** Optimal transfer block size. */
bsize: T;
/** Total data blocks in file system. */
blocks: T;
/** Free blocks in file system. */
bfree: T;
/** Available blocks for unprivileged users */
bavail: T;
/** Total file nodes in file system. */
files: T;
/** Free file nodes in file system. */
ffree: T;
}
export interface StatsFs extends StatsFsBase<number> {}
/**
* Provides information about a mounted file system
*
* Objects returned from {@link statfs} and {@link statfsSync} are of this type.
* If `bigint` in the `options` passed to those methods is true, the numeric values
* will be `bigint` instead of `number`.
* @since v18.15.0
*/
export class StatsFs {}
export interface BigIntStatsFs extends StatsFsBase<bigint> {}
export interface StatFsOptions {
bigint?: boolean | undefined;
}
/**
* A representation of a directory entry, which can be a file or a subdirectory
* within the directory, as returned by reading from an `fs.Dir`. The
@ -1081,6 +1117,70 @@ declare module 'fs' {
): Promise<BigIntStats>;
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
}
/**
* Asynchronous statfs(2). Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an <fs.StatFs> object.
* In case of an error, the err.code will be one of Common System Errors.
* @param path A path to an existing file or directory on the file system to be queried.
* @param callback
*/
export function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void;
export function statfs(
path: PathLike,
options:
| (StatFsOptions & {
bigint?: false | undefined;
})
| undefined,
callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void
): void;
export function statfs(
path: PathLike,
options: StatFsOptions & {
bigint: true;
},
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStatsFs) => void
): void;
export function statfs(path: PathLike, options: StatFsOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs | BigIntStatsFs) => void): void;
export namespace statfs {
/**
* Asynchronous statfs(2) - Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an <fs.StatFs> object.
* @param path A path to an existing file or directory on the file system to be queried.
*/
function __promisify__(
path: PathLike,
options?: StatFsOptions & {
bigint?: false | undefined;
}
): Promise<StatsFs>;
function __promisify__(
path: PathLike,
options: StatFsOptions & {
bigint: true;
}
): Promise<BigIntStatsFs>;
function __promisify__(path: PathLike, options?: StatFsOptions): Promise<StatsFs | BigIntStatsFs>;
}
/**
* Synchronous statfs(2). Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an <fs.StatFs> object.
* In case of an error, the err.code will be one of Common System Errors.
* @param path A path to an existing file or directory on the file system to be queried.
* @param callback
*/
export function statfsSync(
path: PathLike,
options?: StatFsOptions & {
bigint?: false | undefined;
}
): StatsFs;
export function statfsSync(
path: PathLike,
options: StatFsOptions & {
bigint: true;
}
): BigIntStatsFs;
export function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs;
/**
* Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.

@ -14,6 +14,7 @@ declare module 'fs/promises' {
import { ReadableStream } from 'node:stream/web';
import {
BigIntStats,
BigIntStatsFs,
BufferEncodingOption,
constants as fsConstants,
CopyOptions,
@ -30,7 +31,9 @@ declare module 'fs/promises' {
RmDirOptions,
RmOptions,
StatOptions,
StatFsOptions,
Stats,
StatsFs,
TimeLike,
WatchEventType,
WatchOptions,
@ -745,6 +748,24 @@ declare module 'fs/promises' {
}
): Promise<BigIntStats>;
function stat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
/**
* @since v18.15.0
* @return Fulfills with an {fs.StatFs} for the file system.
*/
function statfs(
path: PathLike,
opts?: StatFsOptions & {
bigint?: false | undefined;
}
): Promise<StatsFs>;
function statfs(
path: PathLike,
opts: StatFsOptions & {
bigint: true;
}
): Promise<BigIntStatsFs>;
function statfs(path: PathLike, opts?: StatFsOptions): Promise<StatsFs | BigIntStatsFs>;
/**
* Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail.
* @since v10.0.0

@ -53,7 +53,7 @@ interface AbortController {
/**
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
*/
abort(): void;
abort(reason?: any): void;
}
/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */

7
node_modules/@types/node/http.d.ts generated vendored

@ -144,6 +144,7 @@ declare module 'http' {
socketPath?: string | undefined;
timeout?: number | undefined;
uniqueHeaders?: Array<string | string[]> | undefined;
joinDuplicateHeaders?: boolean;
}
interface ServerOptions<
Request extends typeof IncomingMessage = typeof IncomingMessage,
@ -164,6 +165,12 @@ declare module 'http' {
* @since v18.0.0
*/
requestTimeout?: number | undefined;
/**
* It joins the field line values of multiple headers in a request with `, ` instead of discarding the duplicates.
* @default false
* @since v18.14.0
*/
joinDuplicateHeaders?: boolean;
/**
* The number of milliseconds of inactivity a server needs to wait for additional incoming data,
* after it has finished writing the last response, before a socket will be destroyed.

@ -1053,7 +1053,6 @@ declare module 'http2' {
*/
unknownProtocolTimeout?: number | undefined;
selectPadding?(frameLen: number, maxFrameLen: number): number;
createConnection?(authority: url.URL, option: SessionOptions): stream.Duplex;
}
export interface ClientSessionOptions extends SessionOptions {
maxReservedRemoteStreams?: number | undefined;

@ -1,4 +1,4 @@
// Type definitions for non-npm package Node.js 18.11
// Type definitions for non-npm package Node.js 18.15
// Project: https://nodejs.org/
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
// DefinitelyTyped <https://github.com/DefinitelyTyped>

@ -85,6 +85,7 @@ declare module 'module' {
static wrap(code: string): string;
static createRequire(path: string | URL): NodeRequire;
static builtinModules: string[];
static isBuiltin(moduleName: string): boolean;
static Module: typeof Module;
constructor(id: string, parent?: Module);
}

14
node_modules/@types/node/net.d.ts generated vendored

@ -57,6 +57,14 @@ declare module 'net' {
noDelay?: boolean | undefined;
keepAlive?: boolean | undefined;
keepAliveInitialDelay?: number | undefined;
/**
* @since v18.13.0
*/
autoSelectFamily?: boolean | undefined;
/**
* @since v18.13.0
*/
autoSelectFamilyAttemptTimeout?: number | undefined;
}
interface IpcSocketConnectOpts extends ConnectOpts {
path: string;
@ -261,6 +269,12 @@ declare module 'net' {
* @since v6.1.0
*/
readonly connecting: boolean;
/**
* This is `true` if the socket is not connected yet, either because `.connect()`
* has not yet been called or because it is still in the process of connecting (see `socket.connecting`).
* @since v10.16.0
*/
readonly pending: boolean;
/**
* See `writable.destroyed` for further details.
*/

7
node_modules/@types/node/os.d.ts generated vendored

@ -132,6 +132,13 @@ declare module 'os' {
* @since v0.3.3
*/
function cpus(): CpuInfo[];
/**
* Returns an estimate of the default amount of parallelism a program should use. Always returns a value greater than zero.
*
* This function is a small wrapper about libuv's [`uv_available_parallelism()`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_available_parallelism).
* @since 18.4.0
*/
function availableParallelism(): number;
/**
* Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it
* returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.

@ -1,6 +1,6 @@
{
"name": "@types/node",
"version": "18.11.18",
"version": "18.15.10",
"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": "540ec74ad976942ed4b12e09fd57842adfd77a63a4ea099f15f0602ad707835c",
"typeScriptVersion": "4.2"
"typesPublisherContentHash": "d968764271bc711c7d024195dad3ccfa3e82756092d060a8df0f5a57a517c842",
"typeScriptVersion": "4.3"
}

@ -1089,6 +1089,12 @@ declare module 'process' {
*/
mainModule?: Module | undefined;
memoryUsage: MemoryUsageFn;
/**
* Gets the amount of memory available to the process (in bytes) based on
* limits imposed by the OS. If there is no such constraint, or the constraint
* is unknown, `undefined` is returned.
*/
constrainedMemory(): number | undefined;
/**
* The `process.cpuUsage()` method returns the user and system CPU time usage of
* the current process, in an object with properties `user` and `system`, whose

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

@ -912,6 +912,105 @@ declare module 'stream' {
end(chunk: any, encoding?: BufferEncoding, cb?: () => void): this;
cork(): void;
uncork(): void;
/**
* Event emitter
* The defined events on documents including:
* 1. close
* 2. data
* 3. drain
* 4. end
* 5. error
* 6. finish
* 7. pause
* 8. pipe
* 9. readable
* 10. resume
* 11. unpipe
*/
addListener(event: 'close', listener: () => void): this;
addListener(event: 'data', listener: (chunk: any) => void): this;
addListener(event: 'drain', listener: () => void): this;
addListener(event: 'end', listener: () => void): this;
addListener(event: 'error', listener: (err: Error) => void): this;
addListener(event: 'finish', listener: () => void): this;
addListener(event: 'pause', listener: () => void): this;
addListener(event: 'pipe', listener: (src: Readable) => void): this;
addListener(event: 'readable', listener: () => void): this;
addListener(event: 'resume', listener: () => void): this;
addListener(event: 'unpipe', listener: (src: Readable) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: 'close'): boolean;
emit(event: 'data', chunk: any): boolean;
emit(event: 'drain'): boolean;
emit(event: 'end'): boolean;
emit(event: 'error', err: Error): boolean;
emit(event: 'finish'): boolean;
emit(event: 'pause'): boolean;
emit(event: 'pipe', src: Readable): boolean;
emit(event: 'readable'): boolean;
emit(event: 'resume'): boolean;
emit(event: 'unpipe', src: Readable): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: 'close', listener: () => void): this;
on(event: 'data', listener: (chunk: any) => void): this;
on(event: 'drain', listener: () => void): this;
on(event: 'end', listener: () => void): this;
on(event: 'error', listener: (err: Error) => void): this;
on(event: 'finish', listener: () => void): this;
on(event: 'pause', listener: () => void): this;
on(event: 'pipe', listener: (src: Readable) => void): this;
on(event: 'readable', listener: () => void): this;
on(event: 'resume', listener: () => void): this;
on(event: 'unpipe', listener: (src: Readable) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: 'close', listener: () => void): this;
once(event: 'data', listener: (chunk: any) => void): this;
once(event: 'drain', listener: () => void): this;
once(event: 'end', listener: () => void): this;
once(event: 'error', listener: (err: Error) => void): this;
once(event: 'finish', listener: () => void): this;
once(event: 'pause', listener: () => void): this;
once(event: 'pipe', listener: (src: Readable) => void): this;
once(event: 'readable', listener: () => void): this;
once(event: 'resume', listener: () => void): this;
once(event: 'unpipe', listener: (src: Readable) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: 'close', listener: () => void): this;
prependListener(event: 'data', listener: (chunk: any) => void): this;
prependListener(event: 'drain', listener: () => void): this;
prependListener(event: 'end', listener: () => void): this;
prependListener(event: 'error', listener: (err: Error) => void): this;
prependListener(event: 'finish', listener: () => void): this;
prependListener(event: 'pause', listener: () => void): this;
prependListener(event: 'pipe', listener: (src: Readable) => void): this;
prependListener(event: 'readable', listener: () => void): this;
prependListener(event: 'resume', listener: () => void): this;
prependListener(event: 'unpipe', listener: (src: Readable) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: 'close', listener: () => void): this;
prependOnceListener(event: 'data', listener: (chunk: any) => void): this;
prependOnceListener(event: 'drain', listener: () => void): this;
prependOnceListener(event: 'end', listener: () => void): this;
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
prependOnceListener(event: 'finish', listener: () => void): this;
prependOnceListener(event: 'pause', listener: () => void): this;
prependOnceListener(event: 'pipe', listener: (src: Readable) => void): this;
prependOnceListener(event: 'readable', listener: () => void): this;
prependOnceListener(event: 'resume', listener: () => void): this;
prependOnceListener(event: 'unpipe', listener: (src: Readable) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeListener(event: 'close', listener: () => void): this;
removeListener(event: 'data', listener: (chunk: any) => void): this;
removeListener(event: 'drain', listener: () => void): this;
removeListener(event: 'end', listener: () => void): this;
removeListener(event: 'error', listener: (err: Error) => void): this;
removeListener(event: 'finish', listener: () => void): this;
removeListener(event: 'pause', listener: () => void): this;
removeListener(event: 'pipe', listener: (src: Readable) => void): this;
removeListener(event: 'readable', listener: () => void): this;
removeListener(event: 'resume', listener: () => void): this;
removeListener(event: 'unpipe', listener: (src: Readable) => void): this;
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
type TransformCallback = (error?: Error | null, data?: any) => void;
interface TransformOptions extends DuplexOptions {

380
node_modules/@types/node/test.d.ts generated vendored

@ -7,16 +7,16 @@ declare module 'node:test' {
* Programmatically start the test runner.
* @since v18.9.0
* @param options Configuration options for running tests.
* @returns A {@link TapStream} that emits events about the test execution.
* @returns A {@link TestsStream} that emits events about the test execution.
*/
function run(options?: RunOptions): TapStream;
function run(options?: RunOptions): TestsStream;
/**
* The `test()` function is the value imported from the test module. Each invocation of this
* function results in the creation of a test point in the TAP output.
* function results in reporting the test to the {@link TestsStream}.
*
* The {@link TestContext} object passed to the fn argument can be used to perform actions
* related to the current test. Examples include skipping the test, adding additional TAP
* related to the current test. Examples include skipping the test, adding additional
* diagnostic information, or creating subtests.
*
* `test()` returns a {@link Promise} that resolves once the test completes. The return value
@ -158,54 +158,88 @@ declare module 'node:test' {
}
/**
* A successful call of the `run()` method will return a new `TapStream` object,
* streaming a [TAP](https://testanything.org/) output.
* `TapStream` will emit events in the order of the tests' definitions.
* A successful call of the `run()` method will return a new `TestsStream` object,
* streaming a series of events representing the execution of the tests.
* `TestsStream` will emit events in the order of the tests' definitions.
* @since v18.9.0
*/
interface TapStream extends NodeJS.ReadableStream {
addListener(event: 'test:diagnostic', listener: (message: string) => void): this;
interface TestsStream extends NodeJS.ReadableStream {
addListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
addListener(event: 'test:fail', listener: (data: TestFail) => void): this;
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: string, listener: (...args: any[]) => void): this;
emit(event: 'test:diagnostic', message: string): boolean;
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: string | symbol, ...args: any[]): boolean;
on(event: 'test:diagnostic', listener: (message: string) => void): this;
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: string, listener: (...args: any[]) => void): this;
once(event: 'test:diagnostic', listener: (message: string) => 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: string, listener: (...args: any[]) => void): this;
prependListener(event: 'test:diagnostic', listener: (message: string) => 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: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: 'test:diagnostic', listener: (message: string) => 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: string, listener: (...args: any[]) => void): this;
}
interface DiagnosticData {
/**
* The diagnostic message.
*/
message: string;
/**
* The nesting level of the test.
*/
nesting: number;
}
interface TestFail {
/**
* The test duration.
* Additional execution metadata.
*/
duration: number;
details: {
/**
* The duration of the test in milliseconds.
*/
duration: number;
/**
* The failure casing test to fail.
*/
error: Error;
/**
* 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.
*/
@ -214,25 +248,35 @@ declare module 'node:test' {
/**
* Present if `context.todo` is called.
*/
todo?: string;
todo?: string | boolean;
/**
* Present if `context.skip` is called.
*/
skip?: string;
skip?: string | boolean;
}
interface TestPass {
/**
* The test duration.
* Additional execution metadata.
*/
duration: number;
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.
*/
@ -241,12 +285,36 @@ declare module 'node:test' {
/**
* Present if `context.todo` is called.
*/
todo?: string;
todo?: string | boolean;
/**
* Present if `context.skip` is called.
*/
skip?: string;
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;
}
/**
@ -264,6 +332,15 @@ declare module 'node:test' {
*/
beforeEach: typeof beforeEach;
/**
* This function is used to create a hook that runs after the current test finishes.
* @param fn The hook function. If the hook uses callbacks, the callback function is passed as
* the second argument. Default: A no-op function.
* @param options Configuration options for the hook.
* @since v18.13.0
*/
after: typeof after;
/**
* This function is used to create a hook running after each subtest of the current test.
* @param fn The hook function. If the hook uses callbacks, the callback function is passed as
@ -274,9 +351,9 @@ declare module 'node:test' {
afterEach: typeof afterEach;
/**
* This function is used to write TAP diagnostics to the output. Any diagnostic information is
* This function is used to write diagnostics to the output. Any diagnostic information is
* included at the end of the test's results. This function does not return a value.
* @param message Message to be displayed as a TAP diagnostic.
* @param message Message to be reported.
* @since v18.0.0
*/
diagnostic(message: string): void;
@ -304,18 +381,18 @@ declare module 'node:test' {
/**
* This function causes the test's output to indicate the test as skipped. If `message` is
* provided, it is included in the TAP output. Calling `skip()` does not terminate execution of
* provided, it is included in the output. Calling `skip()` does not terminate execution of
* the test function. This function does not return a value.
* @param message Optional skip message to be displayed in TAP output.
* @param message Optional skip message.
* @since v18.0.0
*/
skip(message?: string): void;
/**
* This function adds a `TODO` directive to the test's output. If `message` is provided, it is
* included in the TAP output. Calling `todo()` does not terminate execution of the test
* included in the output. Calling `todo()` does not terminate execution of the test
* function. This function does not return a value.
* @param message Optional `TODO` message to be displayed in TAP output.
* @param message Optional `TODO` message.
* @since v18.0.0
*/
todo(message?: string): void;
@ -333,6 +410,10 @@ declare module 'node:test' {
* @returns A {@link Promise} resolved with `undefined` once the test completes.
*/
test: typeof test;
/**
* Each test provides its own MockTracker instance.
*/
readonly mock: MockTracker;
}
interface TestOptions {
@ -442,5 +523,238 @@ declare module 'node:test' {
timeout?: number | undefined;
}
export { test as default, run, test, describe, it, before, after, beforeEach, afterEach };
interface MockFunctionOptions {
/**
* The number of times that the mock will use the behavior of `implementation`.
* Once the mock function has been called `times` times,
* it will automatically restore the behavior of `original`.
* This value must be an integer greater than zero.
* @default Infinity
*/
times?: number | undefined;
}
interface MockMethodOptions extends MockFunctionOptions {
/**
* If `true`, `object[methodName]` is treated as a getter.
* This option cannot be used with the `setter` option.
*/
getter?: boolean | undefined;
/**
* If `true`, `object[methodName]` is treated as a setter.
* This option cannot be used with the `getter` option.
*/
setter?: boolean | undefined;
}
type Mock<F extends Function> = F & {
mock: MockFunctionContext<F>;
};
type NoOpFunction = (...args: any[]) => undefined;
type FunctionPropertyNames<T> = {
[K in keyof T]: T[K] extends Function ? K : never;
}[keyof T];
interface MockTracker {
/**
* This function is used to create a mock function.
* @param original An optional function to create a mock on.
* @param implementation An optional function used as the mock implementation for `original`.
* This is useful for creating mocks that exhibit one behavior for a specified number of calls and then restore the behavior of `original`.
* @param options Optional configuration options for the mock function.
*/
fn<F extends Function = NoOpFunction>(original?: F, options?: MockFunctionOptions): Mock<F>;
fn<F extends Function = NoOpFunction, Implementation extends Function = F>(original?: F, implementation?: Implementation, options?: MockFunctionOptions): Mock<F | Implementation>;
/**
* This function is used to create a mock on an existing object method.
* @param object The object whose method is being mocked.
* @param methodName The identifier of the method on `object` to mock. If `object[methodName]` is not a function, an error is thrown.
* @param implementation An optional function used as the mock implementation for `object[methodName]`.
* @param options Optional configuration options for the mock method.
*/
method<
MockedObject extends object,
MethodName extends FunctionPropertyNames<MockedObject>,
>(
object: MockedObject,
methodName: MethodName,
options?: MockFunctionOptions,
): MockedObject[MethodName] extends Function
? Mock<MockedObject[MethodName]>
: never;
method<
MockedObject extends object,
MethodName extends FunctionPropertyNames<MockedObject>,
Implementation extends Function,
>(
object: MockedObject,
methodName: MethodName,
implementation: Implementation,
options?: MockFunctionOptions,
): MockedObject[MethodName] extends Function
? Mock<MockedObject[MethodName] | Implementation>
: never;
method<MockedObject extends object>(
object: MockedObject,
methodName: keyof MockedObject,
options: MockMethodOptions,
): Mock<Function>;
method<MockedObject extends object>(
object: MockedObject,
methodName: keyof MockedObject,
implementation: Function,
options: MockMethodOptions,
): Mock<Function>;
/**
* This function is syntax sugar for {@link MockTracker.method} with `options.getter` set to `true`.
*/
getter<
MockedObject extends object,
MethodName extends keyof MockedObject,
>(
object: MockedObject,
methodName: MethodName,
options?: MockFunctionOptions,
): Mock<() => MockedObject[MethodName]>;
getter<
MockedObject extends object,
MethodName extends keyof MockedObject,
Implementation extends Function,
>(
object: MockedObject,
methodName: MethodName,
implementation?: Implementation,
options?: MockFunctionOptions,
): Mock<(() => MockedObject[MethodName]) | Implementation>;
/**
* This function is syntax sugar for {@link MockTracker.method} with `options.setter` set to `true`.
*/
setter<
MockedObject extends object,
MethodName extends keyof MockedObject,
>(
object: MockedObject,
methodName: MethodName,
options?: MockFunctionOptions,
): Mock<(value: MockedObject[MethodName]) => void>;
setter<
MockedObject extends object,
MethodName extends keyof MockedObject,
Implementation extends Function,
>(
object: MockedObject,
methodName: MethodName,
implementation?: Implementation,
options?: MockFunctionOptions,
): Mock<((value: MockedObject[MethodName]) => void) | Implementation>;
/**
* This function restores the default behavior of all mocks that were previously created by this `MockTracker`
* and disassociates the mocks from the `MockTracker` instance. Once disassociated, the mocks can still be used,
* but the `MockTracker` instance can no longer be used to reset their behavior or otherwise interact with them.
*
* After each test completes, this function is called on the test context's `MockTracker`.
* If the global `MockTracker` is used extensively, calling this function manually is recommended.
*/
reset(): void;
/**
* This function restores the default behavior of all mocks that were previously created by this `MockTracker`.
* Unlike `mock.reset()`, `mock.restoreAll()` does not disassociate the mocks from the `MockTracker` instance.
*/
restoreAll(): void;
}
const mock: MockTracker;
interface MockFunctionCall<
F extends Function,
ReturnType = F extends (...args: any) => infer T
? T
: F extends abstract new (...args: any) => infer T
? T
: unknown,
Args = F extends (...args: infer Y) => any
? Y
: F extends abstract new (...args: infer Y) => any
? Y
: unknown[],
> {
/**
* An array of the arguments passed to the mock function.
*/
arguments: Args;
/**
* If the mocked function threw then this property contains the thrown value.
*/
error: unknown | undefined;
/**
* The value returned by the mocked function.
*
* If the mocked function threw, it will be `undefined`.
*/
result: ReturnType | undefined;
/**
* An `Error` object whose stack can be used to determine the callsite of the mocked function invocation.
*/
stack: Error;
/**
* If the mocked function is a constructor, this field contains the class being constructed.
* Otherwise this will be `undefined`.
*/
target: F extends abstract new (...args: any) => any ? F : undefined;
/**
* The mocked function's `this` value.
*/
this: unknown;
}
interface MockFunctionContext<F extends Function> {
/**
* A getter that returns a copy of the internal array used to track calls to the mock.
*/
readonly calls: Array<MockFunctionCall<F>>;
/**
* This function returns the number of times that this mock has been invoked.
* This function is more efficient than checking `ctx.calls.length`
* because `ctx.calls` is a getter that creates a copy of the internal call tracking array.
*/
callCount(): number;
/**
* This function is used to change the behavior of an existing mock.
* @param implementation The function to be used as the mock's new implementation.
*/
mockImplementation(implementation: Function): void;
/**
* This function is used to change the behavior of an existing mock for a single invocation.
* Once invocation `onCall` has occurred, the mock will revert to whatever behavior
* it would have used had `mockImplementationOnce()` not been called.
* @param implementation The function to be used as the mock's implementation for the invocation number specified by `onCall`.
* @param onCall The invocation number that will use `implementation`.
* If the specified invocation has already occurred then an exception is thrown.
*/
mockImplementationOnce(implementation: Function, onCall?: number): void;
/**
* Resets the call history of the mock function.
*/
resetCalls(): void;
/**
* Resets the implementation of the mock function to its original behavior.
* The mock can still be used after calling this function.
*/
restore(): void;
}
export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock };
}

@ -62,6 +62,13 @@ declare module 'timers' {
[Symbol.toPrimitive](): number;
}
}
/**
* Schedules execution of a one-time `callback` after `delay` milliseconds. The `callback` will likely not be invoked in precisely `delay` milliseconds.
* Node.js makes no guarantees about the exact timing of when callbacks will fire, nor of their ordering. The callback will be called as close as possible to the time specified.
* When `delay` is larger than `2147483647` or less than `1`, the `delay` will be set to `1`. Non-integer delays are truncated to an integer.
* If `callback` is not a function, a [TypeError](https://nodejs.org/api/errors.html#class-typeerror) will be thrown.
* @since v0.0.1
*/
function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
// util.promisify no rest args compability
// tslint:disable-next-line void-return

103
node_modules/@types/node/tls.d.ts generated vendored

@ -41,21 +41,100 @@ declare module 'tls' {
CN: string;
}
interface PeerCertificate {
subject: Certificate;
issuer: Certificate;
subjectaltname: string;
infoAccess: NodeJS.Dict<string[]>;
modulus: string;
exponent: string;
valid_from: string;
valid_to: string;
fingerprint: string;
fingerprint256: string;
ext_key_usage: string[];
serialNumber: string;
/**
* `true` if a Certificate Authority (CA), `false` otherwise.
* @since v18.13.0
*/
ca: boolean;
/**
* The DER encoded X.509 certificate data.
*/
raw: Buffer;
/**
* The certificate subject.
*/
subject: Certificate;
/**
* The certificate issuer, described in the same terms as the `subject`.
*/
issuer: Certificate;
/**
* The date-time the certificate is valid from.
*/
valid_from: string;
/**
* The date-time the certificate is valid to.
*/
valid_to: string;
/**
* The certificate serial number, as a hex string.
*/
serialNumber: string;
/**
* The SHA-1 digest of the DER encoded certificate.
* It is returned as a `:` separated hexadecimal string.
*/
fingerprint: string;
/**
* The SHA-256 digest of the DER encoded certificate.
* It is returned as a `:` separated hexadecimal string.
*/
fingerprint256: string;
/**
* The SHA-512 digest of the DER encoded certificate.
* It is returned as a `:` separated hexadecimal string.
*/
fingerprint512: string;
/**
* The extended key usage, a set of OIDs.
*/
ext_key_usage?: string[];
/**
* A string containing concatenated names for the subject,
* an alternative to the `subject` names.
*/
subjectaltname?: string;
/**
* An array describing the AuthorityInfoAccess, used with OCSP.
*/
infoAccess?: NodeJS.Dict<string[]>;
/**
* For RSA keys: The RSA bit size.
*
* For EC keys: The key size in bits.
*/
bits?: number;
/**
* The RSA exponent, as a string in hexadecimal number notation.
*/
exponent?: string;
/**
* The RSA modulus, as a hexadecimal string.
*/
modulus?: string;
/**
* The public key.
*/
pubkey?: Buffer;
/**
* The ASN.1 name of the OID of the elliptic curve.
* Well-known curves are identified by an OID.
* While it is unusual, it is possible that the curve
* is identified by its mathematical properties,
* in which case it will not have an OID.
*/
asn1Curve?: string;
/**
* The NIST name for the elliptic curve,if it has one
* (not all well-known curves have been assigned names by NIST).
*/
nistCurve?: string;
}
interface DetailedPeerCertificate extends PeerCertificate {
/**
* The issuer certificate object.
* For self-signed certificates, this may be a circular reference.
*/
issuerCertificate: DetailedPeerCertificate;
}
interface CipherNameAndProtocol {

@ -319,6 +319,16 @@ declare module 'async_hooks' {
*/
triggerAsyncId(): number;
}
interface AsyncLocalStorageOptions<T> {
/**
* Optional callback invoked before a store is propagated to a new async resource.
* Returning `true` allows propagation, returning `false` avoids it. Default is to propagate always.
* @param type The type of async event.
* @param store The current store.
* @since v18.13.0
*/
onPropagate?: ((type: string, store: T) => boolean) | undefined;
}
/**
* This class creates stores that stay coherent through asynchronous operations.
*
@ -368,6 +378,8 @@ declare module 'async_hooks' {
* @since v13.10.0, v12.17.0
*/
class AsyncLocalStorage<T> {
constructor(options?: AsyncLocalStorageOptions<T>);
/**
* Disables the instance of `AsyncLocalStorage`. All subsequent calls
* to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.

@ -46,6 +46,8 @@
declare module 'buffer' {
import { BinaryLike } from 'node:crypto';
import { ReadableStream as WebReadableStream } from 'node:stream/web';
export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
export const INSPECT_MAX_BYTES: number;
export const kMaxLength: number;
export const kStringMaxLength: number;
@ -163,18 +165,57 @@ declare module 'buffer' {
*/
stream(): WebReadableStream;
}
export interface FileOptions {
/**
* One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be
* converted to the platform native line-ending as specified by `require('node:os').EOL`.
*/
endings?: 'native' | 'transparent';
/** The File content-type. */
type?: string;
/** The last modified date of the file. `Default`: Date.now(). */
lastModified?: number;
}
/**
* A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files.
* @experimental
* @since v18.13.0
*/
export class File extends Blob {
constructor(sources: Array<BinaryLike | Blob>, fileName: string, options?: FileOptions);
/**
* The name of the `File`.
* @since v18.13.0
*/
readonly name: string;
/**
* The last modified date of the `File`.
* @since v18.13.0
*/
readonly lastModified: number;
}
export import atob = globalThis.atob;
export import btoa = globalThis.btoa;
import { Blob as NodeBlob } from 'buffer';
// This conditional type will be the existing global Blob in a browser, or
// the copy below in a Node environment.
type __Blob = typeof globalThis extends { onmessage: any, Blob: any }
? {} : NodeBlob;
type __Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : NodeBlob;
global {
// Buffer class
type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex';
type BufferEncoding =
| 'ascii'
| 'utf8'
| 'utf-8'
| 'utf16le'
| 'ucs2'
| 'ucs-2'
| 'base64'
| 'base64url'
| 'latin1'
| 'binary'
| 'hex';
type WithImplicitCoercion<T> =
| T
| {
@ -248,7 +289,11 @@ declare module 'buffer' {
* `Buffer.from(array)` and `Buffer.from(string)` may also use the internal`Buffer` pool like `Buffer.allocUnsafe()` does.
* @since v5.10.0
*/
from(arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>, byteOffset?: number, length?: number): Buffer;
from(
arrayBuffer: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>,
byteOffset?: number,
length?: number,
): Buffer;
/**
* Creates a new Buffer using the passed {data}
* @param data data to create a new Buffer
@ -266,7 +311,7 @@ declare module 'buffer' {
| {
[Symbol.toPrimitive](hint: 'string'): string;
},
encoding?: BufferEncoding
encoding?: BufferEncoding,
): Buffer;
/**
* Creates a new Buffer using the passed {data}
@ -340,7 +385,10 @@ declare module 'buffer' {
* @param [encoding='utf8'] If `string` is a string, this is its encoding.
* @return The number of bytes contained within `string`.
*/
byteLength(string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, encoding?: BufferEncoding): number;
byteLength(
string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
encoding?: BufferEncoding,
): number;
/**
* Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together.
*
@ -711,7 +759,13 @@ declare module 'buffer' {
* @param [sourceStart=0] The offset within `buf` at which to begin comparison.
* @param [sourceEnd=buf.length] The offset within `buf` at which to end comparison (not inclusive).
*/
compare(target: Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): -1 | 0 | 1;
compare(
target: Uint8Array,
targetStart?: number,
targetEnd?: number,
sourceStart?: number,
sourceEnd?: number,
): -1 | 0 | 1;
/**
* Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`.
*

@ -1190,11 +1190,13 @@ declare module 'crypto' {
format?: KeyFormat | undefined;
type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined;
passphrase?: string | Buffer | undefined;
encoding?: string | undefined;
}
interface PublicKeyInput {
key: string | Buffer;
format?: KeyFormat | undefined;
type?: 'pkcs1' | 'spki' | undefined;
encoding?: string | undefined;
}
/**
* Asynchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
@ -1305,6 +1307,7 @@ declare module 'crypto' {
interface VerifyKeyObjectInput extends SigningOptions {
key: KeyObject;
}
interface VerifyJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {}
type KeyLike = string | Buffer | KeyObject;
/**
* The `Sign` class is a utility for generating signatures. It can be used in one
@ -1459,8 +1462,8 @@ declare module 'crypto' {
* be passed instead of a public key.
* @since v0.1.92
*/
verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean;
verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean;
verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: NodeJS.ArrayBufferView): boolean;
verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean;
}
/**
* Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
@ -2968,11 +2971,16 @@ declare module 'crypto' {
* If the `callback` function is provided this function uses libuv's threadpool.
* @since v12.0.0
*/
function verify(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean;
function verify(
algorithm: string | null | undefined,
data: NodeJS.ArrayBufferView,
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput,
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
signature: NodeJS.ArrayBufferView
): boolean;
function verify(
algorithm: string | null | undefined,
data: NodeJS.ArrayBufferView,
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
signature: NodeJS.ArrayBufferView,
callback: (error: Error | null, result: boolean) => void
): void;

@ -20,7 +20,7 @@
* should generally include the module name to avoid collisions with data from
* other modules.
* @experimental
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/diagnostics_channel.js)
* @see [source](https://github.com/nodejs/node/blob/v18.7.0/lib/diagnostics_channel.js)
*/
declare module 'diagnostics_channel' {
/**
@ -58,6 +58,45 @@ declare module 'diagnostics_channel' {
*/
function channel(name: string | symbol): Channel;
type ChannelListener = (message: unknown, name: string | symbol) => void;
/**
* Register a message handler to subscribe to this channel. This message handler will be run synchronously
* whenever a message is published to the channel. Any errors thrown in the message handler will
* trigger an 'uncaughtException'.
*
* ```js
* import diagnostics_channel from 'diagnostics_channel';
*
* diagnostics_channel.subscribe('my-channel', (message, name) => {
* // Received data
* });
* ```
*
* @since v18.7.0, v16.17.0
* @param name The channel name
* @param onMessage The handler to receive channel messages
*/
function subscribe(name: string | symbol, onMessage: ChannelListener): void;
/**
* Remove a message handler previously registered to this channel with diagnostics_channel.subscribe(name, onMessage).
*
* ```js
* import diagnostics_channel from 'diagnostics_channel';
*
* function onMessage(message, name) {
* // Received data
* }
*
* diagnostics_channel.subscribe('my-channel', onMessage);
*
* diagnostics_channel.unsubscribe('my-channel', onMessage);
* ```
*
* @since v18.7.0, v16.17.0
* @param name The channel name
* @param onMessage The previous subscribed handler to remove
* @returns `true` if the handler was found, `false` otherwise
*/
function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean;
/**
* The class `Channel` represents an individual named channel within the data
* pipeline. It is use to track subscribers and to publish messages when there

@ -174,7 +174,7 @@ declare module 'dns' {
type: 'AAAA';
}
export interface CaaRecord {
critial: number;
critical: number;
issue?: string | undefined;
issuewild?: string | undefined;
iodef?: string | undefined;

@ -53,7 +53,7 @@ interface AbortController {
/**
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
*/
abort(): void;
abort(reason?: any): void;
}
/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */

@ -1053,7 +1053,6 @@ declare module 'http2' {
*/
unknownProtocolTimeout?: number | undefined;
selectPadding?(frameLen: number, maxFrameLen: number): number;
createConnection?(authority: url.URL, option: SessionOptions): stream.Duplex;
}
export interface ClientSessionOptions extends SessionOptions {
maxReservedRemoteStreams?: number | undefined;

@ -85,6 +85,7 @@ declare module 'module' {
static wrap(code: string): string;
static createRequire(path: string | URL): NodeRequire;
static builtinModules: string[];
static isBuiltin(moduleName: string): boolean;
static Module: typeof Module;
constructor(id: string, parent?: Module);
}

@ -57,6 +57,14 @@ declare module 'net' {
noDelay?: boolean | undefined;
keepAlive?: boolean | undefined;
keepAliveInitialDelay?: number | undefined;
/**
* @since v18.13.0
*/
autoSelectFamily?: boolean | undefined;
/**
* @since v18.13.0
*/
autoSelectFamilyAttemptTimeout?: number | undefined;
}
interface IpcSocketConnectOpts extends ConnectOpts {
path: string;
@ -281,7 +289,13 @@ declare module 'net' {
* The string representation of the local IP family. `'IPv4'` or `'IPv6'`.
* @since v18.8.0
*/
readonly localFamily?: string;
readonly localFamily?: string;
/**
* This is `true` if the socket is not connected yet, either because `.connect()`
* has not yet been called or because it is still in the process of connecting (see `socket.connecting`).
* @since v10.16.0
*/
readonly pending: boolean;
/**
* This property represents the state of the connection as a string.
* @see {https://nodejs.org/api/net.html#socketreadystate}

@ -132,6 +132,13 @@ declare module 'os' {
* @since v0.3.3
*/
function cpus(): CpuInfo[];
/**
* Returns an estimate of the default amount of parallelism a program should use. Always returns a value greater than zero.
*
* This function is a small wrapper about libuv's [`uv_available_parallelism()`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_available_parallelism).
* @since 18.4.0
*/
function availableParallelism(): number;
/**
* Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it
* returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.

@ -1089,6 +1089,12 @@ declare module 'process' {
*/
mainModule?: Module | undefined;
memoryUsage: MemoryUsageFn;
/**
* Gets the amount of memory available to the process (in bytes) based on
* limits imposed by the OS. If there is no such constraint, or the constraint
* is unknown, `undefined` is returned.
*/
constrainedMemory(): number | undefined;
/**
* The `process.cpuUsage()` method returns the user and system CPU time usage of
* the current process, in an object with properties `user` and `system`, whose

@ -912,6 +912,105 @@ declare module 'stream' {
end(chunk: any, encoding?: BufferEncoding, cb?: () => void): this;
cork(): void;
uncork(): void;
/**
* Event emitter
* The defined events on documents including:
* 1. close
* 2. data
* 3. drain
* 4. end
* 5. error
* 6. finish
* 7. pause
* 8. pipe
* 9. readable
* 10. resume
* 11. unpipe
*/
addListener(event: 'close', listener: () => void): this;
addListener(event: 'data', listener: (chunk: any) => void): this;
addListener(event: 'drain', listener: () => void): this;
addListener(event: 'end', listener: () => void): this;
addListener(event: 'error', listener: (err: Error) => void): this;
addListener(event: 'finish', listener: () => void): this;
addListener(event: 'pause', listener: () => void): this;
addListener(event: 'pipe', listener: (src: Readable) => void): this;
addListener(event: 'readable', listener: () => void): this;
addListener(event: 'resume', listener: () => void): this;
addListener(event: 'unpipe', listener: (src: Readable) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
emit(event: 'close'): boolean;
emit(event: 'data', chunk: any): boolean;
emit(event: 'drain'): boolean;
emit(event: 'end'): boolean;
emit(event: 'error', err: Error): boolean;
emit(event: 'finish'): boolean;
emit(event: 'pause'): boolean;
emit(event: 'pipe', src: Readable): boolean;
emit(event: 'readable'): boolean;
emit(event: 'resume'): boolean;
emit(event: 'unpipe', src: Readable): boolean;
emit(event: string | symbol, ...args: any[]): boolean;
on(event: 'close', listener: () => void): this;
on(event: 'data', listener: (chunk: any) => void): this;
on(event: 'drain', listener: () => void): this;
on(event: 'end', listener: () => void): this;
on(event: 'error', listener: (err: Error) => void): this;
on(event: 'finish', listener: () => void): this;
on(event: 'pause', listener: () => void): this;
on(event: 'pipe', listener: (src: Readable) => void): this;
on(event: 'readable', listener: () => void): this;
on(event: 'resume', listener: () => void): this;
on(event: 'unpipe', listener: (src: Readable) => void): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: 'close', listener: () => void): this;
once(event: 'data', listener: (chunk: any) => void): this;
once(event: 'drain', listener: () => void): this;
once(event: 'end', listener: () => void): this;
once(event: 'error', listener: (err: Error) => void): this;
once(event: 'finish', listener: () => void): this;
once(event: 'pause', listener: () => void): this;
once(event: 'pipe', listener: (src: Readable) => void): this;
once(event: 'readable', listener: () => void): this;
once(event: 'resume', listener: () => void): this;
once(event: 'unpipe', listener: (src: Readable) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
prependListener(event: 'close', listener: () => void): this;
prependListener(event: 'data', listener: (chunk: any) => void): this;
prependListener(event: 'drain', listener: () => void): this;
prependListener(event: 'end', listener: () => void): this;
prependListener(event: 'error', listener: (err: Error) => void): this;
prependListener(event: 'finish', listener: () => void): this;
prependListener(event: 'pause', listener: () => void): this;
prependListener(event: 'pipe', listener: (src: Readable) => void): this;
prependListener(event: 'readable', listener: () => void): this;
prependListener(event: 'resume', listener: () => void): this;
prependListener(event: 'unpipe', listener: (src: Readable) => void): this;
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: 'close', listener: () => void): this;
prependOnceListener(event: 'data', listener: (chunk: any) => void): this;
prependOnceListener(event: 'drain', listener: () => void): this;
prependOnceListener(event: 'end', listener: () => void): this;
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
prependOnceListener(event: 'finish', listener: () => void): this;
prependOnceListener(event: 'pause', listener: () => void): this;
prependOnceListener(event: 'pipe', listener: (src: Readable) => void): this;
prependOnceListener(event: 'readable', listener: () => void): this;
prependOnceListener(event: 'resume', listener: () => void): this;
prependOnceListener(event: 'unpipe', listener: (src: Readable) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeListener(event: 'close', listener: () => void): this;
removeListener(event: 'data', listener: (chunk: any) => void): this;
removeListener(event: 'drain', listener: () => void): this;
removeListener(event: 'end', listener: () => void): this;
removeListener(event: 'error', listener: (err: Error) => void): this;
removeListener(event: 'finish', listener: () => void): this;
removeListener(event: 'pause', listener: () => void): this;
removeListener(event: 'pipe', listener: (src: Readable) => void): this;
removeListener(event: 'readable', listener: () => void): this;
removeListener(event: 'resume', listener: () => void): this;
removeListener(event: 'unpipe', listener: (src: Readable) => void): this;
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
type TransformCallback = (error?: Error | null, data?: any) => void;
interface TransformOptions extends DuplexOptions {

@ -7,16 +7,16 @@ declare module 'node:test' {
* Programmatically start the test runner.
* @since v18.9.0
* @param options Configuration options for running tests.
* @returns A {@link TapStream} that emits events about the test execution.
* @returns A {@link TestsStream} that emits events about the test execution.
*/
function run(options?: RunOptions): TapStream;
function run(options?: RunOptions): TestsStream;
/**
* The `test()` function is the value imported from the test module. Each invocation of this
* function results in the creation of a test point in the TAP output.
* function results in reporting the test to the {@link TestsStream}.
*
* The {@link TestContext} object passed to the fn argument can be used to perform actions
* related to the current test. Examples include skipping the test, adding additional TAP
* related to the current test. Examples include skipping the test, adding additional
* diagnostic information, or creating subtests.
*
* `test()` returns a {@link Promise} that resolves once the test completes. The return value
@ -158,54 +158,88 @@ declare module 'node:test' {
}
/**
* A successful call of the `run()` method will return a new `TapStream` object,
* streaming a [TAP](https://testanything.org/) output.
* `TapStream` will emit events in the order of the tests' definitions.
* A successful call of the `run()` method will return a new `TestsStream` object,
* streaming a series of events representing the execution of the tests.
* `TestsStream` will emit events in the order of the tests' definitions.
* @since v18.9.0
*/
interface TapStream extends NodeJS.ReadableStream {
addListener(event: 'test:diagnostic', listener: (message: string) => void): this;
interface TestsStream extends NodeJS.ReadableStream {
addListener(event: 'test:diagnostic', listener: (data: DiagnosticData) => void): this;
addListener(event: 'test:fail', listener: (data: TestFail) => void): this;
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: string, listener: (...args: any[]) => void): this;
emit(event: 'test:diagnostic', message: string): boolean;
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: string | symbol, ...args: any[]): boolean;
on(event: 'test:diagnostic', listener: (message: string) => void): this;
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: string, listener: (...args: any[]) => void): this;
once(event: 'test:diagnostic', listener: (message: string) => 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: string, listener: (...args: any[]) => void): this;
prependListener(event: 'test:diagnostic', listener: (message: string) => 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: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: 'test:diagnostic', listener: (message: string) => 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: string, listener: (...args: any[]) => void): this;
}
interface DiagnosticData {
/**
* The diagnostic message.
*/
message: string;
/**
* The nesting level of the test.
*/
nesting: number;
}
interface TestFail {
/**
* The test duration.
* Additional execution metadata.
*/
duration: number;
details: {
/**
* The duration of the test in milliseconds.
*/
duration: number;
/**
* The failure casing test to fail.
*/
error: Error;
/**
* 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.
*/
@ -214,25 +248,35 @@ declare module 'node:test' {
/**
* Present if `context.todo` is called.
*/
todo?: string;
todo?: string | boolean;
/**
* Present if `context.skip` is called.
*/
skip?: string;
skip?: string | boolean;
}
interface TestPass {
/**
* The test duration.
* Additional execution metadata.
*/
duration: number;
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.
*/
@ -241,12 +285,36 @@ declare module 'node:test' {
/**
* Present if `context.todo` is called.
*/
todo?: string;
todo?: string | boolean;
/**
* Present if `context.skip` is called.
*/
skip?: string;
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;
}
/**
@ -264,6 +332,15 @@ declare module 'node:test' {
*/
beforeEach: typeof beforeEach;
/**
* This function is used to create a hook that runs after the current test finishes.
* @param fn The hook function. If the hook uses callbacks, the callback function is passed as
* the second argument. Default: A no-op function.
* @param options Configuration options for the hook.
* @since v18.13.0
*/
after: typeof after;
/**
* This function is used to create a hook running after each subtest of the current test.
* @param fn The hook function. If the hook uses callbacks, the callback function is passed as
@ -274,9 +351,9 @@ declare module 'node:test' {
afterEach: typeof afterEach;
/**
* This function is used to write TAP diagnostics to the output. Any diagnostic information is
* This function is used to write diagnostics to the output. Any diagnostic information is
* included at the end of the test's results. This function does not return a value.
* @param message Message to be displayed as a TAP diagnostic.
* @param message Message to be reported.
* @since v18.0.0
*/
diagnostic(message: string): void;
@ -304,18 +381,18 @@ declare module 'node:test' {
/**
* This function causes the test's output to indicate the test as skipped. If `message` is
* provided, it is included in the TAP output. Calling `skip()` does not terminate execution of
* provided, it is included in the output. Calling `skip()` does not terminate execution of
* the test function. This function does not return a value.
* @param message Optional skip message to be displayed in TAP output.
* @param message Optional skip message.
* @since v18.0.0
*/
skip(message?: string): void;
/**
* This function adds a `TODO` directive to the test's output. If `message` is provided, it is
* included in the TAP output. Calling `todo()` does not terminate execution of the test
* included in the output. Calling `todo()` does not terminate execution of the test
* function. This function does not return a value.
* @param message Optional `TODO` message to be displayed in TAP output.
* @param message Optional `TODO` message.
* @since v18.0.0
*/
todo(message?: string): void;
@ -333,6 +410,10 @@ declare module 'node:test' {
* @returns A {@link Promise} resolved with `undefined` once the test completes.
*/
test: typeof test;
/**
* Each test provides its own MockTracker instance.
*/
readonly mock: MockTracker;
}
interface TestOptions {
@ -442,5 +523,238 @@ declare module 'node:test' {
timeout?: number | undefined;
}
export { test as default, run, test, describe, it, before, after, beforeEach, afterEach };
interface MockFunctionOptions {
/**
* The number of times that the mock will use the behavior of `implementation`.
* Once the mock function has been called `times` times,
* it will automatically restore the behavior of `original`.
* This value must be an integer greater than zero.
* @default Infinity
*/
times?: number | undefined;
}
interface MockMethodOptions extends MockFunctionOptions {
/**
* If `true`, `object[methodName]` is treated as a getter.
* This option cannot be used with the `setter` option.
*/
getter?: boolean | undefined;
/**
* If `true`, `object[methodName]` is treated as a setter.
* This option cannot be used with the `getter` option.
*/
setter?: boolean | undefined;
}
type Mock<F extends Function> = F & {
mock: MockFunctionContext<F>;
};
type NoOpFunction = (...args: any[]) => undefined;
type FunctionPropertyNames<T> = {
[K in keyof T]: T[K] extends Function ? K : never;
}[keyof T];
interface MockTracker {
/**
* This function is used to create a mock function.
* @param original An optional function to create a mock on.
* @param implementation An optional function used as the mock implementation for `original`.
* This is useful for creating mocks that exhibit one behavior for a specified number of calls and then restore the behavior of `original`.
* @param options Optional configuration options for the mock function.
*/
fn<F extends Function = NoOpFunction>(original?: F, options?: MockFunctionOptions): Mock<F>;
fn<F extends Function = NoOpFunction, Implementation extends Function = F>(original?: F, implementation?: Implementation, options?: MockFunctionOptions): Mock<F | Implementation>;
/**
* This function is used to create a mock on an existing object method.
* @param object The object whose method is being mocked.
* @param methodName The identifier of the method on `object` to mock. If `object[methodName]` is not a function, an error is thrown.
* @param implementation An optional function used as the mock implementation for `object[methodName]`.
* @param options Optional configuration options for the mock method.
*/
method<
MockedObject extends object,
MethodName extends FunctionPropertyNames<MockedObject>,
>(
object: MockedObject,
methodName: MethodName,
options?: MockFunctionOptions,
): MockedObject[MethodName] extends Function
? Mock<MockedObject[MethodName]>
: never;
method<
MockedObject extends object,
MethodName extends FunctionPropertyNames<MockedObject>,
Implementation extends Function,
>(
object: MockedObject,
methodName: MethodName,
implementation: Implementation,
options?: MockFunctionOptions,
): MockedObject[MethodName] extends Function
? Mock<MockedObject[MethodName] | Implementation>
: never;
method<MockedObject extends object>(
object: MockedObject,
methodName: keyof MockedObject,
options: MockMethodOptions,
): Mock<Function>;
method<MockedObject extends object>(
object: MockedObject,
methodName: keyof MockedObject,
implementation: Function,
options: MockMethodOptions,
): Mock<Function>;
/**
* This function is syntax sugar for {@link MockTracker.method} with `options.getter` set to `true`.
*/
getter<
MockedObject extends object,
MethodName extends keyof MockedObject,
>(
object: MockedObject,
methodName: MethodName,
options?: MockFunctionOptions,
): Mock<() => MockedObject[MethodName]>;
getter<
MockedObject extends object,
MethodName extends keyof MockedObject,
Implementation extends Function,
>(
object: MockedObject,
methodName: MethodName,
implementation?: Implementation,
options?: MockFunctionOptions,
): Mock<(() => MockedObject[MethodName]) | Implementation>;
/**
* This function is syntax sugar for {@link MockTracker.method} with `options.setter` set to `true`.
*/
setter<
MockedObject extends object,
MethodName extends keyof MockedObject,
>(
object: MockedObject,
methodName: MethodName,
options?: MockFunctionOptions,
): Mock<(value: MockedObject[MethodName]) => void>;
setter<
MockedObject extends object,
MethodName extends keyof MockedObject,
Implementation extends Function,
>(
object: MockedObject,
methodName: MethodName,
implementation?: Implementation,
options?: MockFunctionOptions,
): Mock<((value: MockedObject[MethodName]) => void) | Implementation>;
/**
* This function restores the default behavior of all mocks that were previously created by this `MockTracker`
* and disassociates the mocks from the `MockTracker` instance. Once disassociated, the mocks can still be used,
* but the `MockTracker` instance can no longer be used to reset their behavior or otherwise interact with them.
*
* After each test completes, this function is called on the test context's `MockTracker`.
* If the global `MockTracker` is used extensively, calling this function manually is recommended.
*/
reset(): void;
/**
* This function restores the default behavior of all mocks that were previously created by this `MockTracker`.
* Unlike `mock.reset()`, `mock.restoreAll()` does not disassociate the mocks from the `MockTracker` instance.
*/
restoreAll(): void;
}
const mock: MockTracker;
interface MockFunctionCall<
F extends Function,
ReturnType = F extends (...args: any) => infer T
? T
: F extends abstract new (...args: any) => infer T
? T
: unknown,
Args = F extends (...args: infer Y) => any
? Y
: F extends abstract new (...args: infer Y) => any
? Y
: unknown[],
> {
/**
* An array of the arguments passed to the mock function.
*/
arguments: Args;
/**
* If the mocked function threw then this property contains the thrown value.
*/
error: unknown | undefined;
/**
* The value returned by the mocked function.
*
* If the mocked function threw, it will be `undefined`.
*/
result: ReturnType | undefined;
/**
* An `Error` object whose stack can be used to determine the callsite of the mocked function invocation.
*/
stack: Error;
/**
* If the mocked function is a constructor, this field contains the class being constructed.
* Otherwise this will be `undefined`.
*/
target: F extends abstract new (...args: any) => any ? F : undefined;
/**
* The mocked function's `this` value.
*/
this: unknown;
}
interface MockFunctionContext<F extends Function> {
/**
* A getter that returns a copy of the internal array used to track calls to the mock.
*/
readonly calls: Array<MockFunctionCall<F>>;
/**
* This function returns the number of times that this mock has been invoked.
* This function is more efficient than checking `ctx.calls.length`
* because `ctx.calls` is a getter that creates a copy of the internal call tracking array.
*/
callCount(): number;
/**
* This function is used to change the behavior of an existing mock.
* @param implementation The function to be used as the mock's new implementation.
*/
mockImplementation(implementation: Function): void;
/**
* This function is used to change the behavior of an existing mock for a single invocation.
* Once invocation `onCall` has occurred, the mock will revert to whatever behavior
* it would have used had `mockImplementationOnce()` not been called.
* @param implementation The function to be used as the mock's implementation for the invocation number specified by `onCall`.
* @param onCall The invocation number that will use `implementation`.
* If the specified invocation has already occurred then an exception is thrown.
*/
mockImplementationOnce(implementation: Function, onCall?: number): void;
/**
* Resets the call history of the mock function.
*/
resetCalls(): void;
/**
* Resets the implementation of the mock function to its original behavior.
* The mock can still be used after calling this function.
*/
restore(): void;
}
export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock };
}

@ -41,21 +41,100 @@ declare module 'tls' {
CN: string;
}
interface PeerCertificate {
subject: Certificate;
issuer: Certificate;
subjectaltname: string;
infoAccess: NodeJS.Dict<string[]>;
modulus: string;
exponent: string;
valid_from: string;
valid_to: string;
fingerprint: string;
fingerprint256: string;
ext_key_usage: string[];
serialNumber: string;
/**
* `true` if a Certificate Authority (CA), `false` otherwise.
* @since v18.13.0
*/
ca: boolean;
/**
* The DER encoded X.509 certificate data.
*/
raw: Buffer;
/**
* The certificate subject.
*/
subject: Certificate;
/**
* The certificate issuer, described in the same terms as the `subject`.
*/
issuer: Certificate;
/**
* The date-time the certificate is valid from.
*/
valid_from: string;
/**
* The date-time the certificate is valid to.
*/
valid_to: string;
/**
* The certificate serial number, as a hex string.
*/
serialNumber: string;
/**
* The SHA-1 digest of the DER encoded certificate.
* It is returned as a `:` separated hexadecimal string.
*/
fingerprint: string;
/**
* The SHA-256 digest of the DER encoded certificate.
* It is returned as a `:` separated hexadecimal string.
*/
fingerprint256: string;
/**
* The SHA-512 digest of the DER encoded certificate.
* It is returned as a `:` separated hexadecimal string.
*/
fingerprint512: string;
/**
* The extended key usage, a set of OIDs.
*/
ext_key_usage?: string[];
/**
* A string containing concatenated names for the subject,
* an alternative to the `subject` names.
*/
subjectaltname?: string;
/**
* An array describing the AuthorityInfoAccess, used with OCSP.
*/
infoAccess?: NodeJS.Dict<string[]>;
/**
* For RSA keys: The RSA bit size.
*
* For EC keys: The key size in bits.
*/
bits?: number;
/**
* The RSA exponent, as a string in hexadecimal number notation.
*/
exponent?: string;
/**
* The RSA modulus, as a hexadecimal string.
*/
modulus?: string;
/**
* The public key.
*/
pubkey?: Buffer;
/**
* The ASN.1 name of the OID of the elliptic curve.
* Well-known curves are identified by an OID.
* While it is unusual, it is possible that the curve
* is identified by its mathematical properties,
* in which case it will not have an OID.
*/
asn1Curve?: string;
/**
* The NIST name for the elliptic curve,if it has one
* (not all well-known curves have been assigned names by NIST).
*/
nistCurve?: string;
}
interface DetailedPeerCertificate extends PeerCertificate {
/**
* The issuer certificate object.
* For self-signed certificates, this may be a circular reference.
*/
issuerCertificate: DetailedPeerCertificate;
}
interface CipherNameAndProtocol {

@ -1426,6 +1426,91 @@ declare module 'util' {
tokens?: Token[];
}
: PreciseParsedResults<T>;
/**
* @since v18.13.0
*/
export class MIMEType {
/**
* Creates a new MIMEType object by parsing the input.
*
* A `TypeError` will be thrown if the `input` is not a valid MIME.
* Note that an effort will be made to coerce the given values into strings.
* @param input The input MIME to parse.
*/
constructor(input: string | { toString: () => string });
/**
* Gets and sets the type portion of the MIME.
*/
type: string;
/**
* Gets and sets the subtype portion of the MIME.
*/
subtype: string;
/**
* Gets the essence of the MIME.
*
* Use `mime.type` or `mime.subtype` to alter the MIME.
*/
readonly essence: string;
/**
* Gets the `MIMEParams` object representing the parameters of the MIME.
*/
readonly params: MIMEParams;
/**
* 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.
*/
toString(): string;
}
/**
* @since v18.13.0
*/
export class MIMEParams {
/**
* Remove all name-value pairs whose name is `name`.
*/
delete(name: string): void;
/**
* Returns an iterator over each of the name-value pairs in the parameters.
*/
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.
*/
get(name: string): string | null;
/**
* Returns `true` if there is at least one name-value pair whose name is `name`.
*/
has(name: string): boolean;
/**
* Returns an iterator over the names of each name-value pair.
*/
keys(): IterableIterator<string>;
/**
* 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`.
*/
set(name: string, value: string): void;
/**
* Returns an iterator over the values of each name-value pair.
*/
values(): IterableIterator<string>;
/**
* Returns an iterator over each of the name-value pairs in the parameters.
*/
[Symbol.iterator]: typeof MIMEParams.prototype.entries;
}
}
declare module 'util/types' {
export * from 'util/types';

@ -390,6 +390,57 @@ declare module 'v8' {
* @since v15.1.0, v14.18.0, v12.22.0
*/
function stopCoverage(): void;
/**
* This API collects GC data in current thread.
*/
class GCProfiler {
/**
* Start collecting GC data.
*/
start(): void;
/**
* Stop collecting GC data and return a object.
*/
stop(): GCProfilerResult;
}
interface GCProfilerResult {
version: number;
startTime: number;
endTime: number;
statistics: Array<{
gcType: string;
cost: number;
beforeGC: {
heapStatistics: HeapStatistics;
heapSpaceStatistics: HeapSpaceStatistics[];
};
afterGC: {
heapStatistics: HeapStatistics;
heapSpaceStatistics: HeapSpaceStatistics[];
};
}>;
}
interface HeapStatistics {
totalHeapSize: number;
totalHeapSizeExecutable: number;
totalPhysicalSize: number;
totalAvailableSize: number;
totalGlobalHandlesSize: number;
usedGlobalHandlesSize: number;
usedHeapSize: number;
heapSizeLimit: number;
mallocedMemory: number;
externalMemory: number;
peakMallocedMemory: number;
}
interface HeapSpaceStatistics {
spaceName: string;
spaceSize: number;
spaceUsedSize: number;
spaceAvailableSize: number;
physicalSpaceSize: number;
}
}
declare module 'node:v8' {
export * from 'v8';

@ -56,11 +56,17 @@ declare module 'vm' {
columnOffset?: number | undefined;
}
interface ScriptOptions extends BaseOptions {
displayErrors?: boolean | undefined;
timeout?: number | undefined;
cachedData?: Buffer | undefined;
/**
* V8's code cache data for the supplied source.
*/
cachedData?: Buffer | NodeJS.ArrayBufferView | undefined;
/** @deprecated in favor of `script.createCachedData()` */
produceCachedData?: boolean | undefined;
/**
* Called during evaluation of this module when `import()` is called.
* If this option is not specified, calls to `import()` will reject with `ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`.
*/
importModuleDynamically?: ((specifier: string, script: Script, importAssertions: Object) => Module) | undefined;
}
interface RunningScriptOptions extends BaseOptions {
/**
@ -80,10 +86,31 @@ declare module 'vm' {
* Default: `false`.
*/
breakOnSigint?: boolean | undefined;
}
interface RunningScriptInNewContextOptions extends RunningScriptOptions {
/**
* Human-readable name of the newly created context.
*/
contextName?: CreateContextOptions['name'];
/**
* Origin corresponding to the newly created context for display purposes. The origin should be formatted like a URL,
* but with only the scheme, host, and port (if necessary), like the value of the `url.origin` property of a `URL` object.
* Most notably, this string should omit the trailing slash, as that denotes a path.
*/
contextOrigin?: CreateContextOptions['origin'];
contextCodeGeneration?: CreateContextOptions['codeGeneration'];
/**
* If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
*/
microtaskMode?: 'afterEvaluate' | undefined;
microtaskMode?: CreateContextOptions['microtaskMode'];
}
interface RunningCodeOptions extends RunningScriptOptions {
cachedData?: ScriptOptions['cachedData'];
importModuleDynamically?: ScriptOptions['importModuleDynamically'];
}
interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions {
cachedData?: ScriptOptions['cachedData'];
importModuleDynamically?: ScriptOptions['importModuleDynamically'];
}
interface CompileFunctionOptions extends BaseOptions {
/**
@ -144,7 +171,10 @@ declare module 'vm' {
* @default 'summary'
*/
mode?: MeasureMemoryMode | undefined;
context?: Context | undefined;
/**
* @default 'default'
*/
execution?: 'default' | 'eager' | undefined;
}
interface MemoryMeasurement {
total: {
@ -158,7 +188,7 @@ declare module 'vm' {
* @since v0.3.1
*/
class Script {
constructor(code: string, options?: ScriptOptions);
constructor(code: string, options?: ScriptOptions | string);
/**
* Runs the compiled code contained by the `vm.Script` object within the given`contextifiedObject` and returns the result. Running code does not have access
* to local scope.
@ -220,7 +250,7 @@ declare module 'vm' {
* @param contextObject An object that will be `contextified`. If `undefined`, a new object will be created.
* @return the result of the very last statement executed in the script.
*/
runInNewContext(contextObject?: Context, options?: RunningScriptOptions): any;
runInNewContext(contextObject?: Context, options?: RunningScriptInNewContextOptions): any;
/**
* Runs the compiled code contained by the `vm.Script` within the context of the
* current `global` object. Running code does not have access to local scope, but _does_ have access to the current `global` object.
@ -273,6 +303,10 @@ declare module 'vm' {
cachedDataProduced?: boolean | undefined;
cachedDataRejected?: boolean | undefined;
cachedData?: Buffer | undefined;
/**
* When the script is compiled from a source that contains a source map magic comment, this property will be set to the URL of the source map.
*/
sourceMapURL?: string | undefined;
}
/**
* If given a `contextObject`, the `vm.createContext()` method will `prepare
@ -345,7 +379,7 @@ declare module 'vm' {
* @param contextifiedObject The `contextified` object that will be used as the `global` when the `code` is compiled and run.
* @return the result of the very last statement executed in the script.
*/
function runInContext(code: string, contextifiedObject: Context, options?: RunningScriptOptions | string): any;
function runInContext(code: string, contextifiedObject: Context, options?: RunningCodeOptions | string): any;
/**
* The `vm.runInNewContext()` first contextifies the given `contextObject` (or
* creates a new `contextObject` if passed as `undefined`), compiles the `code`,
@ -374,7 +408,7 @@ declare module 'vm' {
* @param contextObject An object that will be `contextified`. If `undefined`, a new object will be created.
* @return the result of the very last statement executed in the script.
*/
function runInNewContext(code: string, contextObject?: Context, options?: RunningScriptOptions | string): any;
function runInNewContext(code: string, contextObject?: Context, options?: RunningCodeInNewContextOptions | string): any;
/**
* `vm.runInThisContext()` compiles `code`, runs it within the context of the
* current `global` and returns the result. Running code does not have access to
@ -437,7 +471,7 @@ declare module 'vm' {
* @param code The JavaScript code to compile and run.
* @return the result of the very last statement executed in the script.
*/
function runInThisContext(code: string, options?: RunningScriptOptions | string): any;
function runInThisContext(code: string, options?: RunningCodeOptions | string): any;
/**
* Compiles the given code into the provided context (if no context is
* supplied, the current context is used), and returns it wrapped inside a
@ -446,7 +480,11 @@ declare module 'vm' {
* @param code The body of the function to compile.
* @param params An array of strings containing all parameters for the function.
*/
function compileFunction(code: string, params?: ReadonlyArray<string>, options?: CompileFunctionOptions): Function;
function compileFunction(code: string, params?: ReadonlyArray<string>, options?: CompileFunctionOptions): Function & {
cachedData?: Script['cachedData'] | undefined;
cachedDataProduced?: Script['cachedDataProduced'] | undefined;
cachedDataRejected?: Script['cachedDataRejected'] | undefined;
};
/**
* Measure the memory known to V8 and used by all contexts known to the
* current V8 isolate, or the main context.
@ -503,6 +541,103 @@ declare module 'vm' {
* @experimental
*/
function measureMemory(options?: MeasureMemoryOptions): Promise<MemoryMeasurement>;
interface ModuleEvaluateOptions {
timeout?: RunningScriptOptions['timeout'] | undefined;
breakOnSigint?: RunningScriptOptions['breakOnSigint'] | undefined;
}
type ModuleLinker = (specifier: string, referencingModule: Module, extra: { assert: Object }) => Module | Promise<Module>;
type ModuleStatus = 'unlinked' | 'linking' | 'linked' | 'evaluating' | 'evaluated' | 'errored';
class Module {
/**
* The specifiers of all dependencies of this module.
*/
dependencySpecifiers: readonly string[];
/**
* If the `module.status` is `'errored'`, this property contains the exception thrown by the module during evaluation.
* If the status is anything else, accessing this property will result in a thrown exception.
*/
error: any;
/**
* The identifier of the current module, as set in the constructor.
*/
identifier: string;
context: Context;
/**
* The namespace object of the module. This is only available after linking (`module.link()`) has completed.
*/
namespace: Object;
/**
* The current status of the module.
*/
status: ModuleStatus;
/**
* Evaluate the module.
*
* This must be called after the module has been linked; otherwise it will reject
* It could be called also when the module has already been evaluated, in which case it will either do nothing
* if the initial evaluation ended in success (`module.status` is `'evaluated'`) or it will re-throw the exception
* that the initial evaluation resulted in (`module.status` is `'errored'`).
*
* This method cannot be called while the module is being evaluated (`module.status` is `'evaluating'`).
*/
evaluate(options?: ModuleEvaluateOptions): Promise<void>;
/**
* Link module dependencies. This method must be called before evaluation, and can only be called once per module.
*/
link(linker: ModuleLinker): Promise<void>;
}
interface SourceTextModuleOptions {
/**
* String used in stack traces.
* @default 'vm:module(i)' where i is a context-specific ascending index.
*/
identifier?: string | undefined;
cachedData?: ScriptOptions['cachedData'] | undefined;
context?: Context | undefined;
lineOffset?: BaseOptions['lineOffset'] | undefined;
columnOffset?: BaseOptions['columnOffset'] | undefined;
/**
* Called during evaluation of this module to initialize the `import.meta`.
*/
initializeImportMeta?: ((meta: ImportMeta, module: SourceTextModule) => void) | undefined;
importModuleDynamically?: ScriptOptions['importModuleDynamically'] | undefined;
}
class SourceTextModule extends Module {
/**
* Creates a new `SourceTextModule` instance.
* @param code JavaScript Module code to parse
*/
constructor(code: string, options?: SourceTextModuleOptions);
}
interface SyntheticModuleOptions {
/**
* String used in stack traces.
* @default 'vm:module(i)' where i is a context-specific ascending index.
*/
identifier?: string | undefined;
/**
* The contextified object as returned by the `vm.createContext()` method, to compile and evaluate this module in.
*/
context?: Context | undefined;
}
class SyntheticModule extends Module {
/**
* Creates a new `SyntheticModule` instance.
* @param exportNames Array of names that will be exported from the module.
* @param evaluateCallback Called when the module is evaluated.
*/
constructor(exportNames: string[], evaluateCallback: (this: SyntheticModule) => void, options?: SyntheticModuleOptions);
/**
* This method is used after the module is linked to set the values of exports.
* If it is called before the module is linked, an `ERR_VM_MODULE_STATUS` error will be thrown.
* @param name
* @param value
*/
setExport(name: string, value: any): void;
}
}
declare module 'node:vm' {
export * from 'vm';

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

@ -1426,6 +1426,91 @@ declare module 'util' {
tokens?: Token[];
}
: PreciseParsedResults<T>;
/**
* @since v18.13.0
*/
export class MIMEType {
/**
* Creates a new MIMEType object by parsing the input.
*
* A `TypeError` will be thrown if the `input` is not a valid MIME.
* Note that an effort will be made to coerce the given values into strings.
* @param input The input MIME to parse.
*/
constructor(input: string | { toString: () => string });
/**
* Gets and sets the type portion of the MIME.
*/
type: string;
/**
* Gets and sets the subtype portion of the MIME.
*/
subtype: string;
/**
* Gets the essence of the MIME.
*
* Use `mime.type` or `mime.subtype` to alter the MIME.
*/
readonly essence: string;
/**
* Gets the `MIMEParams` object representing the parameters of the MIME.
*/
readonly params: MIMEParams;
/**
* 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.
*/
toString(): string;
}
/**
* @since v18.13.0
*/
export class MIMEParams {
/**
* Remove all name-value pairs whose name is `name`.
*/
delete(name: string): void;
/**
* Returns an iterator over each of the name-value pairs in the parameters.
*/
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.
*/
get(name: string): string | null;
/**
* Returns `true` if there is at least one name-value pair whose name is `name`.
*/
has(name: string): boolean;
/**
* Returns an iterator over the names of each name-value pair.
*/
keys(): IterableIterator<string>;
/**
* 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`.
*/
set(name: string, value: string): void;
/**
* Returns an iterator over the values of each name-value pair.
*/
values(): IterableIterator<string>;
/**
* Returns an iterator over each of the name-value pairs in the parameters.
*/
[Symbol.iterator]: typeof MIMEParams.prototype.entries;
}
}
declare module 'util/types' {
export * from 'util/types';

51
node_modules/@types/node/v8.d.ts generated vendored

@ -390,6 +390,57 @@ declare module 'v8' {
* @since v15.1.0, v14.18.0, v12.22.0
*/
function stopCoverage(): void;
/**
* This API collects GC data in current thread.
*/
class GCProfiler {
/**
* Start collecting GC data.
*/
start(): void;
/**
* Stop collecting GC data and return a object.
*/
stop(): GCProfilerResult;
}
interface GCProfilerResult {
version: number;
startTime: number;
endTime: number;
statistics: Array<{
gcType: string;
cost: number;
beforeGC: {
heapStatistics: HeapStatistics;
heapSpaceStatistics: HeapSpaceStatistics[];
};
afterGC: {
heapStatistics: HeapStatistics;
heapSpaceStatistics: HeapSpaceStatistics[];
};
}>;
}
interface HeapStatistics {
totalHeapSize: number;
totalHeapSizeExecutable: number;
totalPhysicalSize: number;
totalAvailableSize: number;
totalGlobalHandlesSize: number;
usedGlobalHandlesSize: number;
usedHeapSize: number;
heapSizeLimit: number;
mallocedMemory: number;
externalMemory: number;
peakMallocedMemory: number;
}
interface HeapSpaceStatistics {
spaceName: string;
spaceSize: number;
spaceUsedSize: number;
spaceAvailableSize: number;
physicalSpaceSize: number;
}
}
declare module 'node:v8' {
export * from 'v8';

157
node_modules/@types/node/vm.d.ts generated vendored

@ -56,11 +56,17 @@ declare module 'vm' {
columnOffset?: number | undefined;
}
interface ScriptOptions extends BaseOptions {
displayErrors?: boolean | undefined;
timeout?: number | undefined;
cachedData?: Buffer | undefined;
/**
* V8's code cache data for the supplied source.
*/
cachedData?: Buffer | NodeJS.ArrayBufferView | undefined;
/** @deprecated in favor of `script.createCachedData()` */
produceCachedData?: boolean | undefined;
/**
* Called during evaluation of this module when `import()` is called.
* If this option is not specified, calls to `import()` will reject with `ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`.
*/
importModuleDynamically?: ((specifier: string, script: Script, importAssertions: Object) => Module) | undefined;
}
interface RunningScriptOptions extends BaseOptions {
/**
@ -80,10 +86,31 @@ declare module 'vm' {
* Default: `false`.
*/
breakOnSigint?: boolean | undefined;
}
interface RunningScriptInNewContextOptions extends RunningScriptOptions {
/**
* Human-readable name of the newly created context.
*/
contextName?: CreateContextOptions['name'];
/**
* Origin corresponding to the newly created context for display purposes. The origin should be formatted like a URL,
* but with only the scheme, host, and port (if necessary), like the value of the `url.origin` property of a `URL` object.
* Most notably, this string should omit the trailing slash, as that denotes a path.
*/
contextOrigin?: CreateContextOptions['origin'];
contextCodeGeneration?: CreateContextOptions['codeGeneration'];
/**
* If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
*/
microtaskMode?: 'afterEvaluate' | undefined;
microtaskMode?: CreateContextOptions['microtaskMode'];
}
interface RunningCodeOptions extends RunningScriptOptions {
cachedData?: ScriptOptions['cachedData'];
importModuleDynamically?: ScriptOptions['importModuleDynamically'];
}
interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions {
cachedData?: ScriptOptions['cachedData'];
importModuleDynamically?: ScriptOptions['importModuleDynamically'];
}
interface CompileFunctionOptions extends BaseOptions {
/**
@ -144,7 +171,10 @@ declare module 'vm' {
* @default 'summary'
*/
mode?: MeasureMemoryMode | undefined;
context?: Context | undefined;
/**
* @default 'default'
*/
execution?: 'default' | 'eager' | undefined;
}
interface MemoryMeasurement {
total: {
@ -158,7 +188,7 @@ declare module 'vm' {
* @since v0.3.1
*/
class Script {
constructor(code: string, options?: ScriptOptions);
constructor(code: string, options?: ScriptOptions | string);
/**
* Runs the compiled code contained by the `vm.Script` object within the given`contextifiedObject` and returns the result. Running code does not have access
* to local scope.
@ -220,7 +250,7 @@ declare module 'vm' {
* @param contextObject An object that will be `contextified`. If `undefined`, a new object will be created.
* @return the result of the very last statement executed in the script.
*/
runInNewContext(contextObject?: Context, options?: RunningScriptOptions): any;
runInNewContext(contextObject?: Context, options?: RunningScriptInNewContextOptions): any;
/**
* Runs the compiled code contained by the `vm.Script` within the context of the
* current `global` object. Running code does not have access to local scope, but _does_ have access to the current `global` object.
@ -273,6 +303,10 @@ declare module 'vm' {
cachedDataProduced?: boolean | undefined;
cachedDataRejected?: boolean | undefined;
cachedData?: Buffer | undefined;
/**
* When the script is compiled from a source that contains a source map magic comment, this property will be set to the URL of the source map.
*/
sourceMapURL?: string | undefined;
}
/**
* If given a `contextObject`, the `vm.createContext()` method will `prepare
@ -345,7 +379,7 @@ declare module 'vm' {
* @param contextifiedObject The `contextified` object that will be used as the `global` when the `code` is compiled and run.
* @return the result of the very last statement executed in the script.
*/
function runInContext(code: string, contextifiedObject: Context, options?: RunningScriptOptions | string): any;
function runInContext(code: string, contextifiedObject: Context, options?: RunningCodeOptions | string): any;
/**
* The `vm.runInNewContext()` first contextifies the given `contextObject` (or
* creates a new `contextObject` if passed as `undefined`), compiles the `code`,
@ -374,7 +408,7 @@ declare module 'vm' {
* @param contextObject An object that will be `contextified`. If `undefined`, a new object will be created.
* @return the result of the very last statement executed in the script.
*/
function runInNewContext(code: string, contextObject?: Context, options?: RunningScriptOptions | string): any;
function runInNewContext(code: string, contextObject?: Context, options?: RunningCodeInNewContextOptions | string): any;
/**
* `vm.runInThisContext()` compiles `code`, runs it within the context of the
* current `global` and returns the result. Running code does not have access to
@ -437,7 +471,7 @@ declare module 'vm' {
* @param code The JavaScript code to compile and run.
* @return the result of the very last statement executed in the script.
*/
function runInThisContext(code: string, options?: RunningScriptOptions | string): any;
function runInThisContext(code: string, options?: RunningCodeOptions | string): any;
/**
* Compiles the given code into the provided context (if no context is
* supplied, the current context is used), and returns it wrapped inside a
@ -446,7 +480,11 @@ declare module 'vm' {
* @param code The body of the function to compile.
* @param params An array of strings containing all parameters for the function.
*/
function compileFunction(code: string, params?: ReadonlyArray<string>, options?: CompileFunctionOptions): Function;
function compileFunction(code: string, params?: ReadonlyArray<string>, options?: CompileFunctionOptions): Function & {
cachedData?: Script['cachedData'] | undefined;
cachedDataProduced?: Script['cachedDataProduced'] | undefined;
cachedDataRejected?: Script['cachedDataRejected'] | undefined;
};
/**
* Measure the memory known to V8 and used by all contexts known to the
* current V8 isolate, or the main context.
@ -503,6 +541,103 @@ declare module 'vm' {
* @experimental
*/
function measureMemory(options?: MeasureMemoryOptions): Promise<MemoryMeasurement>;
interface ModuleEvaluateOptions {
timeout?: RunningScriptOptions['timeout'] | undefined;
breakOnSigint?: RunningScriptOptions['breakOnSigint'] | undefined;
}
type ModuleLinker = (specifier: string, referencingModule: Module, extra: { assert: Object }) => Module | Promise<Module>;
type ModuleStatus = 'unlinked' | 'linking' | 'linked' | 'evaluating' | 'evaluated' | 'errored';
class Module {
/**
* The specifiers of all dependencies of this module.
*/
dependencySpecifiers: readonly string[];
/**
* If the `module.status` is `'errored'`, this property contains the exception thrown by the module during evaluation.
* If the status is anything else, accessing this property will result in a thrown exception.
*/
error: any;
/**
* The identifier of the current module, as set in the constructor.
*/
identifier: string;
context: Context;
/**
* The namespace object of the module. This is only available after linking (`module.link()`) has completed.
*/
namespace: Object;
/**
* The current status of the module.
*/
status: ModuleStatus;
/**
* Evaluate the module.
*
* This must be called after the module has been linked; otherwise it will reject
* It could be called also when the module has already been evaluated, in which case it will either do nothing
* if the initial evaluation ended in success (`module.status` is `'evaluated'`) or it will re-throw the exception
* that the initial evaluation resulted in (`module.status` is `'errored'`).
*
* This method cannot be called while the module is being evaluated (`module.status` is `'evaluating'`).
*/
evaluate(options?: ModuleEvaluateOptions): Promise<void>;
/**
* Link module dependencies. This method must be called before evaluation, and can only be called once per module.
*/
link(linker: ModuleLinker): Promise<void>;
}
interface SourceTextModuleOptions {
/**
* String used in stack traces.
* @default 'vm:module(i)' where i is a context-specific ascending index.
*/
identifier?: string | undefined;
cachedData?: ScriptOptions['cachedData'] | undefined;
context?: Context | undefined;
lineOffset?: BaseOptions['lineOffset'] | undefined;
columnOffset?: BaseOptions['columnOffset'] | undefined;
/**
* Called during evaluation of this module to initialize the `import.meta`.
*/
initializeImportMeta?: ((meta: ImportMeta, module: SourceTextModule) => void) | undefined;
importModuleDynamically?: ScriptOptions['importModuleDynamically'] | undefined;
}
class SourceTextModule extends Module {
/**
* Creates a new `SourceTextModule` instance.
* @param code JavaScript Module code to parse
*/
constructor(code: string, options?: SourceTextModuleOptions);
}
interface SyntheticModuleOptions {
/**
* String used in stack traces.
* @default 'vm:module(i)' where i is a context-specific ascending index.
*/
identifier?: string | undefined;
/**
* The contextified object as returned by the `vm.createContext()` method, to compile and evaluate this module in.
*/
context?: Context | undefined;
}
class SyntheticModule extends Module {
/**
* Creates a new `SyntheticModule` instance.
* @param exportNames Array of names that will be exported from the module.
* @param evaluateCallback Called when the module is evaluated.
*/
constructor(exportNames: string[], evaluateCallback: (this: SyntheticModule) => void, options?: SyntheticModuleOptions);
/**
* This method is used after the module is linked to set the values of exports.
* If it is called before the module is linked, an `ERR_VM_MODULE_STATUS` error will be thrown.
* @param name
* @param value
*/
setExport(name: string, value: any): void;
}
}
declare module 'node:vm' {
export * from 'vm';

32
node_modules/@types/which/README.md generated vendored

@ -1,16 +1,16 @@
# Installation
> `npm install --save @types/which`
# Summary
This package contains type definitions for which (https://github.com/isaacs/node-which).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/which.
### Additional Details
* Last updated: Fri, 02 Jul 2021 18:05:37 GMT
* Dependencies: none
* Global values: none
# Credits
These definitions were written by [vvakame](https://github.com/vvakame), [cspotcode](https://github.com/cspotcode), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
# Installation
> `npm install --save @types/which`
# Summary
This package contains type definitions for which (https://github.com/isaacs/node-which).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/which.
### Additional Details
* Last updated: Tue, 14 Feb 2023 10:32:35 GMT
* Dependencies: none
* Global values: none
# Credits
These definitions were written by [vvakame](https://github.com/vvakame), [cspotcode](https://github.com/cspotcode), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).

10
node_modules/@types/which/index.d.ts generated vendored

@ -8,22 +8,22 @@
/** Finds all instances of a specified executable in the PATH environment variable */
declare function which(
cmd: string,
options: which.AsyncOptions & which.OptionsAll,
options: which.Options & which.AsyncOptions & which.OptionsAll,
cb: (err: Error | null, paths: ReadonlyArray<string> | undefined) => void,
): void;
declare function which(
cmd: string,
options: which.AsyncOptions & which.OptionsFirst,
options: which.Options & which.AsyncOptions & which.OptionsFirst,
cb: (err: Error | null, path: string | undefined) => void,
): void;
declare function which(
cmd: string,
options: which.AsyncOptions,
options: which.Options & which.AsyncOptions,
cb: (err: Error | null, path: string | ReadonlyArray<string> | undefined) => void,
): void;
declare function which(cmd: string, cb: (err: Error | null, path: string | undefined) => void): void;
declare function which(cmd: string, options: which.AsyncOptions & which.OptionsAll): Promise<string[]>;
declare function which(cmd: string, options?: which.AsyncOptions & which.OptionsFirst): Promise<string>;
declare function which(cmd: string, options: which.Options & which.AsyncOptions & which.OptionsAll): Promise<string[]>;
declare function which(cmd: string, options?: which.Options & which.AsyncOptions & which.OptionsFirst): Promise<string>;
declare namespace which {
/** Finds all instances of a specified executable in the PATH environment variable */

@ -1,6 +1,6 @@
{
"name": "@types/which",
"version": "2.0.1",
"version": "2.0.2",
"description": "TypeScript definitions for which",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/which",
"license": "MIT",
@ -30,6 +30,6 @@
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "b70db9efe60b94c4178ccefc342ca6a90ad08c44cb5a3bd77922b2768a452c52",
"typeScriptVersion": "3.6"
"typesPublisherContentHash": "bb030e810883f6391704f6dba53e9fc0bb1b782bdbd6ba24719d196e92745b1e",
"typeScriptVersion": "4.2"
}

34
node_modules/fs-extra/README.md generated vendored

@ -5,7 +5,7 @@ Node.js: fs-extra
[![npm Package](https://img.shields.io/npm/v/fs-extra.svg)](https://www.npmjs.org/package/fs-extra)
[![License](https://img.shields.io/npm/l/fs-extra.svg)](https://github.com/jprichardson/node-fs-extra/blob/master/LICENSE)
[![build status](https://img.shields.io/github/workflow/status/jprichardson/node-fs-extra/Node.js%20CI/master)](https://github.com/jprichardson/node-fs-extra/actions/workflows/ci.yml?query=branch%3Amaster)
[![build status](https://img.shields.io/github/actions/workflow/status/jprichardson/node-fs-extra/ci.yml?branch=master)](https://github.com/jprichardson/node-fs-extra/actions/workflows/ci.yml?query=branch%3Amaster)
[![downloads per month](http://img.shields.io/npm/dm/fs-extra.svg)](https://www.npmjs.org/package/fs-extra)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
@ -27,6 +27,8 @@ Installation
Usage
-----
### CommonJS
`fs-extra` is a drop in replacement for native `fs`. All methods in `fs` are attached to `fs-extra`. All `fs` methods return promises if the callback isn't passed.
You don't ever need to include the original `fs` module again:
@ -55,6 +57,31 @@ const fs = require('fs')
const fse = require('fs-extra')
```
### ESM
There is also an `fs-extra/esm` import, that supports both default and named exports. However, note that `fs` methods are not included in `fs-extra/esm`; you still need to import `fs` and/or `fs/promises` seperately:
```js
import { readFileSync } from 'fs'
import { readFile } from 'fs/promises'
import { outputFile, outputFileSync } from 'fs-extra/esm'
```
Default exports are supported:
```js
import fs from 'fs'
import fse from 'fs-extra/esm'
// fse.readFileSync is not a function; must use fs.readFileSync
```
but you probably want to just use regular `fs-extra` instead of `fs-extra/esm` for default exports:
```js
import fs from 'fs-extra'
// both fs and fs-extra methods are defined
```
Sync vs Async vs Async/Await
-------------
Most methods are async by default. All async methods will return a promise if the callback isn't passed.
@ -197,7 +224,10 @@ fs-extra contains hundreds of tests.
- `npm run lint`: runs the linter ([standard](http://standardjs.com/))
- `npm run unit`: runs the unit tests
- `npm test`: runs both the linter and the tests
- `npm run unit-esm`: runs tests for `fs-extra/esm` exports
- `npm test`: runs the linter and all tests
When running unit tests, set the environment variable `CROSS_DEVICE_PATH` to the absolute path of an empty directory on another device (like a thumb drive) to enable cross-device move tests.
### Windows

@ -26,21 +26,12 @@ function copySync (src, dest, opts) {
const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts)
stat.checkParentPathsSync(src, srcStat, dest, 'copy')
return handleFilterAndCopy(destStat, src, dest, opts)
}
function handleFilterAndCopy (destStat, src, dest, opts) {
if (opts.filter && !opts.filter(src, dest)) return
const destParent = path.dirname(dest)
if (!fs.existsSync(destParent)) mkdirsSync(destParent)
return getStats(destStat, src, dest, opts)
}
function startCopy (destStat, src, dest, opts) {
if (opts.filter && !opts.filter(src, dest)) return
return getStats(destStat, src, dest, opts)
}
function getStats (destStat, src, dest, opts) {
const statSync = opts.dereference ? fs.statSync : fs.lstatSync
const srcStat = statSync(src)
@ -121,8 +112,9 @@ function copyDir (src, dest, opts) {
function copyDirItem (item, src, dest, opts) {
const srcItem = path.join(src, item)
const destItem = path.join(dest, item)
if (opts.filter && !opts.filter(srcItem, destItem)) return
const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy', opts)
return startCopy(destStat, srcItem, destItem, opts)
return getStats(destStat, srcItem, destItem, opts)
}
function onLink (destStat, src, dest, opts) {
@ -154,7 +146,7 @@ function onLink (destStat, src, dest, opts) {
// prevent copy if src is a subdir of dest since unlinking
// dest in this case would result in removing src contents
// and therefore a broken symlink would be created.
if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
}
return copyLink(resolvedSrc, dest)

@ -35,8 +35,12 @@ function copy (src, dest, opts, cb) {
const { srcStat, destStat } = stats
stat.checkParentPaths(src, srcStat, dest, 'copy', err => {
if (err) return cb(err)
if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb)
return checkParentDir(destStat, src, dest, opts, cb)
runFilter(src, dest, opts, (err, include) => {
if (err) return cb(err)
if (!include) return cb()
checkParentDir(destStat, src, dest, opts, cb)
})
})
})
}
@ -53,16 +57,10 @@ function checkParentDir (destStat, src, dest, opts, cb) {
})
}
function handleFilter (onInclude, destStat, src, dest, opts, cb) {
Promise.resolve(opts.filter(src, dest)).then(include => {
if (include) return onInclude(destStat, src, dest, opts, cb)
return cb()
}, error => cb(error))
}
function startCopy (destStat, src, dest, opts, cb) {
if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb)
return getStats(destStat, src, dest, opts, cb)
function runFilter (src, dest, opts, cb) {
if (!opts.filter) return cb(null, true)
Promise.resolve(opts.filter(src, dest))
.then(include => cb(null, include), error => cb(error))
}
function getStats (destStat, src, dest, opts, cb) {
@ -178,12 +176,17 @@ function copyDirItems (items, src, dest, opts, cb) {
function copyDirItem (items, item, src, dest, opts, cb) {
const srcItem = path.join(src, item)
const destItem = path.join(dest, item)
stat.checkPaths(srcItem, destItem, 'copy', opts, (err, stats) => {
runFilter(srcItem, destItem, opts, (err, include) => {
if (err) return cb(err)
const { destStat } = stats
startCopy(destStat, srcItem, destItem, opts, err => {
if (!include) return copyDirItems(items, src, dest, opts, cb)
stat.checkPaths(srcItem, destItem, 'copy', opts, (err, stats) => {
if (err) return cb(err)
return copyDirItems(items, src, dest, opts, cb)
const { destStat } = stats
getStats(destStat, srcItem, destItem, opts, err => {
if (err) return cb(err)
return copyDirItems(items, src, dest, opts, cb)
})
})
})
}
@ -216,7 +219,7 @@ function onLink (destStat, src, dest, opts, cb) {
// do not copy if src is a subdir of dest since unlinking
// dest in this case would result in removing src contents
// and therefore a broken symlink would be created.
if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`))
}
return copyLink(resolvedSrc, dest, cb)

68
node_modules/fs-extra/lib/esm.mjs generated vendored Normal file

@ -0,0 +1,68 @@
import _copy from './copy/index.js'
import _empty from './empty/index.js'
import _ensure from './ensure/index.js'
import _json from './json/index.js'
import _mkdirs from './mkdirs/index.js'
import _move from './move/index.js'
import _outputFile from './output-file/index.js'
import _pathExists from './path-exists/index.js'
import _remove from './remove/index.js'
// NOTE: Only exports fs-extra's functions; fs functions must be imported from "node:fs" or "node:fs/promises"
export const copy = _copy.copy
export const copySync = _copy.copySync
export const emptyDirSync = _empty.emptyDirSync
export const emptydirSync = _empty.emptydirSync
export const emptyDir = _empty.emptyDir
export const emptydir = _empty.emptydir
export const createFile = _ensure.createFile
export const createFileSync = _ensure.createFileSync
export const ensureFile = _ensure.ensureFile
export const ensureFileSync = _ensure.ensureFileSync
export const createLink = _ensure.createLink
export const createLinkSync = _ensure.createLinkSync
export const ensureLink = _ensure.ensureLink
export const ensureLinkSync = _ensure.ensureLinkSync
export const createSymlink = _ensure.createSymlink
export const createSymlinkSync = _ensure.createSymlinkSync
export const ensureSymlink = _ensure.ensureSymlink
export const ensureSymlinkSync = _ensure.ensureSymlinkSync
export const readJson = _json.readJson
export const readJSON = _json.readJSON
export const readJsonSync = _json.readJsonSync
export const readJSONSync = _json.readJSONSync
export const writeJson = _json.writeJson
export const writeJSON = _json.writeJSON
export const writeJsonSync = _json.writeJsonSync
export const writeJSONSync = _json.writeJSONSync
export const outputJson = _json.outputJson
export const outputJSON = _json.outputJSON
export const outputJsonSync = _json.outputJsonSync
export const outputJSONSync = _json.outputJSONSync
export const mkdirs = _mkdirs.mkdirs
export const mkdirsSync = _mkdirs.mkdirsSync
export const mkdirp = _mkdirs.mkdirp
export const mkdirpSync = _mkdirs.mkdirpSync
export const ensureDir = _mkdirs.ensureDir
export const ensureDirSync = _mkdirs.ensureDirSync
export const move = _move.move
export const moveSync = _move.moveSync
export const outputFile = _outputFile.outputFile
export const outputFileSync = _outputFile.outputFileSync
export const pathExists = _pathExists.pathExists
export const pathExistsSync = _pathExists.pathExistsSync
export const remove = _remove.remove
export const removeSync = _remove.removeSync
export default {
..._copy,
..._empty,
..._ensure,
..._json,
..._mkdirs,
..._move,
..._outputFile,
..._pathExists,
..._remove
}

@ -41,8 +41,7 @@ const api = [
'writeFile'
].filter(key => {
// Some commands are not available on some systems. Ex:
// fs.opendir was added in Node.js v12.12.0
// fs.rm was added in Node.js v14.14.0
// fs.cp was added in Node.js v16.7.0
// fs.lchown is not available on at least some Linux
return typeof fs[key] === 'function'
})
@ -66,7 +65,7 @@ exports.exists = function (filename, callback) {
})
}
// fs.read(), fs.write(), & fs.writev() need special treatment due to multiple callback args
// fs.read(), fs.write(), fs.readv(), & fs.writev() need special treatment due to multiple callback args
exports.read = function (fd, buffer, offset, length, position, callback) {
if (typeof callback === 'function') {
@ -98,23 +97,36 @@ exports.write = function (fd, buffer, ...args) {
})
}
// fs.writev only available in Node v12.9.0+
if (typeof fs.writev === 'function') {
// Function signature is
// s.writev(fd, buffers[, position], callback)
// We need to handle the optional arg, so we use ...args
exports.writev = function (fd, buffers, ...args) {
if (typeof args[args.length - 1] === 'function') {
return fs.writev(fd, buffers, ...args)
}
return new Promise((resolve, reject) => {
fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
if (err) return reject(err)
resolve({ bytesWritten, buffers })
})
})
// Function signature is
// s.readv(fd, buffers[, position], callback)
// We need to handle the optional arg, so we use ...args
exports.readv = function (fd, buffers, ...args) {
if (typeof args[args.length - 1] === 'function') {
return fs.readv(fd, buffers, ...args)
}
return new Promise((resolve, reject) => {
fs.readv(fd, buffers, ...args, (err, bytesRead, buffers) => {
if (err) return reject(err)
resolve({ bytesRead, buffers })
})
})
}
// Function signature is
// s.writev(fd, buffers[, position], callback)
// We need to handle the optional arg, so we use ...args
exports.writev = function (fd, buffers, ...args) {
if (typeof args[args.length - 1] === 'function') {
return fs.writev(fd, buffers, ...args)
}
return new Promise((resolve, reject) => {
fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
if (err) return reject(err)
resolve({ bytesWritten, buffers })
})
})
}
// fs.realpath.native sometimes not available if fs is monkey-patched

@ -45,7 +45,8 @@ function rename (src, dest, overwrite) {
function moveAcrossDevice (src, dest, overwrite) {
const opts = {
overwrite,
errorOnExist: true
errorOnExist: true,
preserveTimestamps: true
}
copySync(src, dest, opts)
return removeSync(src)

@ -64,7 +64,8 @@ function rename (src, dest, overwrite, cb) {
function moveAcrossDevice (src, dest, overwrite, cb) {
const opts = {
overwrite,
errorOnExist: true
errorOnExist: true,
preserveTimestamps: true
}
copy(src, dest, opts, err => {
if (err) return cb(err)

@ -2,18 +2,13 @@
const fs = require('graceful-fs')
const u = require('universalify').fromCallback
const rimraf = require('./rimraf')
function remove (path, callback) {
// Node 14.14.0+
if (fs.rm) return fs.rm(path, { recursive: true, force: true }, callback)
rimraf(path, callback)
fs.rm(path, { recursive: true, force: true }, callback)
}
function removeSync (path) {
// Node 14.14.0+
if (fs.rmSync) return fs.rmSync(path, { recursive: true, force: true })
rimraf.sync(path)
fs.rmSync(path, { recursive: true, force: true })
}
module.exports = {

@ -1,302 +0,0 @@
'use strict'
const fs = require('graceful-fs')
const path = require('path')
const assert = require('assert')
const isWindows = (process.platform === 'win32')
function defaults (options) {
const methods = [
'unlink',
'chmod',
'stat',
'lstat',
'rmdir',
'readdir'
]
methods.forEach(m => {
options[m] = options[m] || fs[m]
m = m + 'Sync'
options[m] = options[m] || fs[m]
})
options.maxBusyTries = options.maxBusyTries || 3
}
function rimraf (p, options, cb) {
let busyTries = 0
if (typeof options === 'function') {
cb = options
options = {}
}
assert(p, 'rimraf: missing path')
assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string')
assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required')
assert(options, 'rimraf: invalid options argument provided')
assert.strictEqual(typeof options, 'object', 'rimraf: options should be object')
defaults(options)
rimraf_(p, options, function CB (er) {
if (er) {
if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') &&
busyTries < options.maxBusyTries) {
busyTries++
const time = busyTries * 100
// try again, with the same exact callback as this one.
return setTimeout(() => rimraf_(p, options, CB), time)
}
// already gone
if (er.code === 'ENOENT') er = null
}
cb(er)
})
}
// Two possible strategies.
// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR
// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR
//
// Both result in an extra syscall when you guess wrong. However, there
// are likely far more normal files in the world than directories. This
// is based on the assumption that a the average number of files per
// directory is >= 1.
//
// If anyone ever complains about this, then I guess the strategy could
// be made configurable somehow. But until then, YAGNI.
function rimraf_ (p, options, cb) {
assert(p)
assert(options)
assert(typeof cb === 'function')
// sunos lets the root user unlink directories, which is... weird.
// so we have to lstat here and make sure it's not a dir.
options.lstat(p, (er, st) => {
if (er && er.code === 'ENOENT') {
return cb(null)
}
// Windows can EPERM on stat. Life is suffering.
if (er && er.code === 'EPERM' && isWindows) {
return fixWinEPERM(p, options, er, cb)
}
if (st && st.isDirectory()) {
return rmdir(p, options, er, cb)
}
options.unlink(p, er => {
if (er) {
if (er.code === 'ENOENT') {
return cb(null)
}
if (er.code === 'EPERM') {
return (isWindows)
? fixWinEPERM(p, options, er, cb)
: rmdir(p, options, er, cb)
}
if (er.code === 'EISDIR') {
return rmdir(p, options, er, cb)
}
}
return cb(er)
})
})
}
function fixWinEPERM (p, options, er, cb) {
assert(p)
assert(options)
assert(typeof cb === 'function')
options.chmod(p, 0o666, er2 => {
if (er2) {
cb(er2.code === 'ENOENT' ? null : er)
} else {
options.stat(p, (er3, stats) => {
if (er3) {
cb(er3.code === 'ENOENT' ? null : er)
} else if (stats.isDirectory()) {
rmdir(p, options, er, cb)
} else {
options.unlink(p, cb)
}
})
}
})
}
function fixWinEPERMSync (p, options, er) {
let stats
assert(p)
assert(options)
try {
options.chmodSync(p, 0o666)
} catch (er2) {
if (er2.code === 'ENOENT') {
return
} else {
throw er
}
}
try {
stats = options.statSync(p)
} catch (er3) {
if (er3.code === 'ENOENT') {
return
} else {
throw er
}
}
if (stats.isDirectory()) {
rmdirSync(p, options, er)
} else {
options.unlinkSync(p)
}
}
function rmdir (p, options, originalEr, cb) {
assert(p)
assert(options)
assert(typeof cb === 'function')
// try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)
// if we guessed wrong, and it's not a directory, then
// raise the original error.
options.rmdir(p, er => {
if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) {
rmkids(p, options, cb)
} else if (er && er.code === 'ENOTDIR') {
cb(originalEr)
} else {
cb(er)
}
})
}
function rmkids (p, options, cb) {
assert(p)
assert(options)
assert(typeof cb === 'function')
options.readdir(p, (er, files) => {
if (er) return cb(er)
let n = files.length
let errState
if (n === 0) return options.rmdir(p, cb)
files.forEach(f => {
rimraf(path.join(p, f), options, er => {
if (errState) {
return
}
if (er) return cb(errState = er)
if (--n === 0) {
options.rmdir(p, cb)
}
})
})
})
}
// this looks simpler, and is strictly *faster*, but will
// tie up the JavaScript thread and fail on excessively
// deep directory trees.
function rimrafSync (p, options) {
let st
options = options || {}
defaults(options)
assert(p, 'rimraf: missing path')
assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string')
assert(options, 'rimraf: missing options')
assert.strictEqual(typeof options, 'object', 'rimraf: options should be object')
try {
st = options.lstatSync(p)
} catch (er) {
if (er.code === 'ENOENT') {
return
}
// Windows can EPERM on stat. Life is suffering.
if (er.code === 'EPERM' && isWindows) {
fixWinEPERMSync(p, options, er)
}
}
try {
// sunos lets the root user unlink directories, which is... weird.
if (st && st.isDirectory()) {
rmdirSync(p, options, null)
} else {
options.unlinkSync(p)
}
} catch (er) {
if (er.code === 'ENOENT') {
return
} else if (er.code === 'EPERM') {
return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)
} else if (er.code !== 'EISDIR') {
throw er
}
rmdirSync(p, options, er)
}
}
function rmdirSync (p, options, originalEr) {
assert(p)
assert(options)
try {
options.rmdirSync(p)
} catch (er) {
if (er.code === 'ENOTDIR') {
throw originalEr
} else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') {
rmkidsSync(p, options)
} else if (er.code !== 'ENOENT') {
throw er
}
}
}
function rmkidsSync (p, options) {
assert(p)
assert(options)
options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options))
if (isWindows) {
// We only end up here once we got ENOTEMPTY at least once, and
// at this point, we are guaranteed to have removed all the kids.
// So, we know that it won't be ENOENT or ENOTDIR or anything else.
// try really hard to delete stuff on windows, because it has a
// PROFOUNDLY annoying habit of not closing handles promptly when
// files are deleted, resulting in spurious ENOTEMPTY errors.
const startTime = Date.now()
do {
try {
const ret = options.rmdirSync(p, options)
return ret
} catch {}
} while (Date.now() - startTime < 500) // give up after 500ms
} else {
const ret = options.rmdirSync(p, options)
return ret
}
}
module.exports = rimraf
rimraf.sync = rimrafSync

18
node_modules/fs-extra/package.json generated vendored

@ -1,9 +1,9 @@
{
"name": "fs-extra",
"version": "10.1.0",
"version": "11.1.1",
"description": "fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.",
"engines": {
"node": ">=12"
"node": ">=14.14"
},
"homepage": "https://github.com/jprichardson/node-fs-extra",
"repository": {
@ -42,17 +42,20 @@
"universalify": "^2.0.0"
},
"devDependencies": {
"at-least-node": "^1.0.0",
"klaw": "^2.1.1",
"klaw-sync": "^3.0.2",
"minimist": "^1.1.1",
"mocha": "^5.0.5",
"mocha": "^10.1.0",
"nyc": "^15.0.0",
"proxyquire": "^2.0.1",
"read-dir-files": "^0.1.1",
"standard": "^16.0.3"
"standard": "^17.0.0"
},
"main": "./lib/index.js",
"exports": {
".": "./lib/index.js",
"./esm": "./lib/esm.mjs"
},
"files": [
"lib/",
"!lib/**/__tests__/"
@ -60,8 +63,9 @@
"scripts": {
"lint": "standard",
"test-find": "find ./lib/**/__tests__ -name *.test.js | xargs mocha",
"test": "npm run lint && npm run unit",
"unit": "nyc node test.js"
"test": "npm run lint && npm run unit && npm run unit-esm",
"unit": "nyc node test.js",
"unit-esm": "node test.mjs"
},
"sideEffects": false
}

@ -1,7 +1,7 @@
{
"name": "graceful-fs",
"description": "A drop-in replacement for fs, making various improvements.",
"version": "4.2.10",
"version": "4.2.11",
"repository": {
"type": "git",
"url": "https://github.com/isaacs/node-graceful-fs"
@ -38,7 +38,7 @@
"import-fresh": "^2.0.0",
"mkdirp": "^0.5.0",
"rimraf": "^2.2.8",
"tap": "^12.7.0"
"tap": "^16.3.4"
},
"files": [
"fs.js",
@ -46,5 +46,8 @@
"legacy-streams.js",
"polyfills.js",
"clone.js"
]
],
"tap": {
"reporter": "classic"
}
}

@ -101,7 +101,7 @@ function patch (fs) {
var backoff = 0;
fs$rename(from, to, function CB (er) {
if (er
&& (er.code === "EACCES" || er.code === "EPERM")
&& (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY")
&& Date.now() - start < 60000) {
setTimeout(function() {
fs.stat(to, function (stater, st) {

75
node_modules/minimist/.eslintrc generated vendored

@ -1,54 +1,29 @@
{
"root": true,
"root": true,
"extends": "@ljharb/eslint-config/node/0.4",
"extends": "@ljharb/eslint-config/node/0.4",
"rules": {
"array-bracket-spacing": 0,
"array-element-newline": 0,
"brace-style": 1,
"camelcase": 1,
"comma-dangle": 1,
"comma-spacing": 1,
"complexity": 0,
"curly": 1,
"dot-notation": 1,
"eol-last": 1,
"func-style": 1,
"function-paren-newline": 1,
"indent": [1, 4],
"key-spacing": 1,
"max-lines-per-function": 0,
"max-nested-callbacks": 1,
"max-statements": 0,
"multiline-comment-style": 1,
"no-array-constructor": 1,
"no-continue": 1,
"no-div-regex": 1,
"no-extra-parens": 1,
"no-mixed-operators": 1,
"no-multi-spaces": 1,
"no-multiple-empty-lines": 1,
"no-param-reassign": 1,
"no-plusplus": 1,
"no-proto": 1,
"no-redeclare": 1,
"no-restricted-syntax": 1,
"no-shadow": 1,
"no-trailing-spaces": 1,
"no-unused-vars": 1,
"no-use-before-define": 1,
"object-curly-newline": 1,
"object-curly-spacing": 1,
"operator-linebreak": 1,
"quote-props": 1,
"quotes": 1,
"semi-style": 1,
"semi": 1,
"space-before-blocks": 1,
"space-before-function-paren": 1,
"space-infix-ops": 1,
"strict": 1,
"wrap-regex": 1,
},
"rules": {
"array-element-newline": 0,
"complexity": 0,
"func-style": [2, "declaration"],
"max-lines-per-function": 0,
"max-nested-callbacks": 1,
"max-statements-per-line": 1,
"max-statements": 0,
"multiline-comment-style": 0,
"no-continue": 1,
"no-param-reassign": 1,
"no-restricted-syntax": 1,
"object-curly-newline": 0,
},
"overrides": [
{
"files": "test/**",
"rules": {
"camelcase": 0,
},
},
]
}

88
node_modules/minimist/CHANGELOG.md generated vendored

@ -5,6 +5,52 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.2.8](https://github.com/minimistjs/minimist/compare/v1.2.7...v1.2.8) - 2023-02-09
### Merged
- [Fix] Fix long option followed by single dash [`#17`](https://github.com/minimistjs/minimist/pull/17)
- [Tests] Remove duplicate test [`#12`](https://github.com/minimistjs/minimist/pull/12)
- [Fix] opt.string works with multiple aliases [`#10`](https://github.com/minimistjs/minimist/pull/10)
### Fixed
- [Fix] Fix long option followed by single dash (#17) [`#15`](https://github.com/minimistjs/minimist/issues/15)
- [Tests] Remove duplicate test (#12) [`#8`](https://github.com/minimistjs/minimist/issues/8)
- [Fix] Fix long option followed by single dash [`#15`](https://github.com/minimistjs/minimist/issues/15)
- [Fix] opt.string works with multiple aliases (#10) [`#9`](https://github.com/minimistjs/minimist/issues/9)
- [Fix] Fix handling of short option with non-trivial equals [`#5`](https://github.com/minimistjs/minimist/issues/5)
- [Tests] Remove duplicate test [`#8`](https://github.com/minimistjs/minimist/issues/8)
- [Fix] opt.string works with multiple aliases [`#9`](https://github.com/minimistjs/minimist/issues/9)
### Commits
- Merge tag 'v0.2.3' [`a026794`](https://github.com/minimistjs/minimist/commit/a0267947c7870fc5847cf2d437fbe33f392767da)
- [eslint] fix indentation and whitespace [`5368ca4`](https://github.com/minimistjs/minimist/commit/5368ca4147e974138a54cc0dc4cea8f756546b70)
- [eslint] fix indentation and whitespace [`e5f5067`](https://github.com/minimistjs/minimist/commit/e5f5067259ceeaf0b098d14bec910f87e58708c7)
- [eslint] more cleanup [`62fde7d`](https://github.com/minimistjs/minimist/commit/62fde7d935f83417fb046741531a9e2346a36976)
- [eslint] more cleanup [`36ac5d0`](https://github.com/minimistjs/minimist/commit/36ac5d0d95e4947d074e5737d94814034ca335d1)
- [meta] add `auto-changelog` [`73923d2`](https://github.com/minimistjs/minimist/commit/73923d223553fca08b1ba77e3fbc2a492862ae4c)
- [actions] add reusable workflows [`d80727d`](https://github.com/minimistjs/minimist/commit/d80727df77bfa9e631044d7f16368d8f09242c91)
- [eslint] add eslint; rules to enable later are warnings [`48bc06a`](https://github.com/minimistjs/minimist/commit/48bc06a1b41f00e9cdf183db34f7a51ba70e98d4)
- [eslint] fix indentation [`34b0f1c`](https://github.com/minimistjs/minimist/commit/34b0f1ccaa45183c3c4f06a91f9b405180a6f982)
- [readme] rename and add badges [`5df0fe4`](https://github.com/minimistjs/minimist/commit/5df0fe49211bd09a3636f8686a7cb3012c3e98f0)
- [Dev Deps] switch from `covert` to `nyc` [`a48b128`](https://github.com/minimistjs/minimist/commit/a48b128fdb8d427dfb20a15273f83e38d97bef07)
- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`f0fb958`](https://github.com/minimistjs/minimist/commit/f0fb958e9a1fe980cdffc436a211b0bda58f621b)
- [meta] create FUNDING.yml; add `funding` in package.json [`3639e0c`](https://github.com/minimistjs/minimist/commit/3639e0c819359a366387e425ab6eabf4c78d3caa)
- [meta] use `npmignore` to autogenerate an npmignore file [`be2e038`](https://github.com/minimistjs/minimist/commit/be2e038c342d8333b32f0fde67a0026b79c8150e)
- Only apps should have lockfiles [`282b570`](https://github.com/minimistjs/minimist/commit/282b570e7489d01b03f2d6d3dabf79cd3e5f84cf)
- isConstructorOrProto adapted from PR [`ef9153f`](https://github.com/minimistjs/minimist/commit/ef9153fc52b6cea0744b2239921c5dcae4697f11)
- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`098873c`](https://github.com/minimistjs/minimist/commit/098873c213cdb7c92e55ae1ef5aa1af3a8192a79)
- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`3124ed3`](https://github.com/minimistjs/minimist/commit/3124ed3e46306301ebb3c834874ce0241555c2c4)
- [meta] add `safe-publish-latest` [`4b927de`](https://github.com/minimistjs/minimist/commit/4b927de696d561c636b4f43bf49d4597cb36d6d6)
- [Tests] add `aud` in `posttest` [`b32d9bd`](https://github.com/minimistjs/minimist/commit/b32d9bd0ab340f4e9f8c3a97ff2a4424f25fab8c)
- [meta] update repo URLs [`f9fdfc0`](https://github.com/minimistjs/minimist/commit/f9fdfc032c54884d9a9996a390c63cd0719bbe1a)
- [actions] Avoid 0.6 tests due to build failures [`ba92fe6`](https://github.com/minimistjs/minimist/commit/ba92fe6ebbdc0431cca9a2ea8f27beb492f5e4ec)
- [Dev Deps] update `tape` [`950eaa7`](https://github.com/minimistjs/minimist/commit/950eaa74f112e04d23e9c606c67472c46739b473)
- [Dev Deps] add missing `npmignore` dev dep [`3226afa`](https://github.com/minimistjs/minimist/commit/3226afaf09e9d127ca369742437fe6e88f752d6b)
- Merge tag 'v0.2.2' [`980d7ac`](https://github.com/minimistjs/minimist/commit/980d7ac61a0b4bd552711251ac107d506b23e41f)
## [v1.2.7](https://github.com/minimistjs/minimist/compare/v1.2.6...v1.2.7) - 2022-10-10
### Commits
@ -109,13 +155,53 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- coverage script [`e5531ba`](https://github.com/minimistjs/minimist/commit/e5531ba0479da3b8138d3d8cac545d84ccb1c8df)
- extra fn to get 100% coverage again [`a6972da`](https://github.com/minimistjs/minimist/commit/a6972da89e56bf77642f8ec05a13b6558db93498)
## [v1.0.0](https://github.com/minimistjs/minimist/compare/v0.2.1...v1.0.0) - 2014-08-10
## [v1.0.0](https://github.com/minimistjs/minimist/compare/v0.2.3...v1.0.0) - 2014-08-10
### Commits
- added stopEarly option [`471c7e4`](https://github.com/minimistjs/minimist/commit/471c7e4a7e910fc7ad8f9df850a186daf32c64e9)
- fix list [`fef6ae7`](https://github.com/minimistjs/minimist/commit/fef6ae79c38b9dc1c49569abb7cd04eb965eac5e)
## [v0.2.3](https://github.com/minimistjs/minimist/compare/v0.2.2...v0.2.3) - 2023-02-09
### Merged
- [Fix] Fix long option followed by single dash [`#17`](https://github.com/minimistjs/minimist/pull/17)
- [Tests] Remove duplicate test [`#12`](https://github.com/minimistjs/minimist/pull/12)
- [Fix] opt.string works with multiple aliases [`#10`](https://github.com/minimistjs/minimist/pull/10)
### Fixed
- [Fix] Fix long option followed by single dash (#17) [`#15`](https://github.com/minimistjs/minimist/issues/15)
- [Tests] Remove duplicate test (#12) [`#8`](https://github.com/minimistjs/minimist/issues/8)
- [Fix] opt.string works with multiple aliases (#10) [`#9`](https://github.com/minimistjs/minimist/issues/9)
### Commits
- [eslint] fix indentation and whitespace [`e5f5067`](https://github.com/minimistjs/minimist/commit/e5f5067259ceeaf0b098d14bec910f87e58708c7)
- [eslint] more cleanup [`36ac5d0`](https://github.com/minimistjs/minimist/commit/36ac5d0d95e4947d074e5737d94814034ca335d1)
- [eslint] fix indentation [`34b0f1c`](https://github.com/minimistjs/minimist/commit/34b0f1ccaa45183c3c4f06a91f9b405180a6f982)
- isConstructorOrProto adapted from PR [`ef9153f`](https://github.com/minimistjs/minimist/commit/ef9153fc52b6cea0744b2239921c5dcae4697f11)
- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`098873c`](https://github.com/minimistjs/minimist/commit/098873c213cdb7c92e55ae1ef5aa1af3a8192a79)
- [Dev Deps] add missing `npmignore` dev dep [`3226afa`](https://github.com/minimistjs/minimist/commit/3226afaf09e9d127ca369742437fe6e88f752d6b)
## [v0.2.2](https://github.com/minimistjs/minimist/compare/v0.2.1...v0.2.2) - 2022-10-10
### Commits
- [meta] add `auto-changelog` [`73923d2`](https://github.com/minimistjs/minimist/commit/73923d223553fca08b1ba77e3fbc2a492862ae4c)
- [actions] add reusable workflows [`d80727d`](https://github.com/minimistjs/minimist/commit/d80727df77bfa9e631044d7f16368d8f09242c91)
- [eslint] add eslint; rules to enable later are warnings [`48bc06a`](https://github.com/minimistjs/minimist/commit/48bc06a1b41f00e9cdf183db34f7a51ba70e98d4)
- [readme] rename and add badges [`5df0fe4`](https://github.com/minimistjs/minimist/commit/5df0fe49211bd09a3636f8686a7cb3012c3e98f0)
- [Dev Deps] switch from `covert` to `nyc` [`a48b128`](https://github.com/minimistjs/minimist/commit/a48b128fdb8d427dfb20a15273f83e38d97bef07)
- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`f0fb958`](https://github.com/minimistjs/minimist/commit/f0fb958e9a1fe980cdffc436a211b0bda58f621b)
- [meta] create FUNDING.yml; add `funding` in package.json [`3639e0c`](https://github.com/minimistjs/minimist/commit/3639e0c819359a366387e425ab6eabf4c78d3caa)
- [meta] use `npmignore` to autogenerate an npmignore file [`be2e038`](https://github.com/minimistjs/minimist/commit/be2e038c342d8333b32f0fde67a0026b79c8150e)
- Only apps should have lockfiles [`282b570`](https://github.com/minimistjs/minimist/commit/282b570e7489d01b03f2d6d3dabf79cd3e5f84cf)
- [meta] add `safe-publish-latest` [`4b927de`](https://github.com/minimistjs/minimist/commit/4b927de696d561c636b4f43bf49d4597cb36d6d6)
- [Tests] add `aud` in `posttest` [`b32d9bd`](https://github.com/minimistjs/minimist/commit/b32d9bd0ab340f4e9f8c3a97ff2a4424f25fab8c)
- [meta] update repo URLs [`f9fdfc0`](https://github.com/minimistjs/minimist/commit/f9fdfc032c54884d9a9996a390c63cd0719bbe1a)
## [v0.2.1](https://github.com/minimistjs/minimist/compare/v0.2.0...v0.2.1) - 2020-03-12
## [v0.2.0](https://github.com/minimistjs/minimist/compare/v0.1.0...v0.2.0) - 2014-06-19

24
node_modules/minimist/README.md generated vendored

@ -26,14 +26,16 @@ $ node example/parse.js -a beep -b boop
```
$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
{ _: [ 'foo', 'bar', 'baz' ],
x: 3,
y: 4,
n: 5,
a: true,
b: true,
c: true,
beep: 'boop' }
{
_: ['foo', 'bar', 'baz'],
x: 3,
y: 4,
n: 5,
a: true,
b: true,
c: true,
beep: 'boop'
}
```
# security
@ -81,8 +83,10 @@ and `argv['--']` with everything after the `--`. Here's an example:
```
> require('./')('one two three -- four five --six'.split(' '), { '--': true })
{ _: [ 'one', 'two', 'three' ],
'--': [ 'four', 'five', '--six' ] }
{
_: ['one', 'two', 'three'],
'--': ['four', 'five', '--six']
}
```
Note that with `opts['--']` set, parsing for arguments still stops after the

@ -1,2 +1,4 @@
'use strict';
var argv = require('../')(process.argv.slice(2));
console.log(argv);

484
node_modules/minimist/index.js generated vendored

@ -1,249 +1,263 @@
'use strict';
function hasKey(obj, keys) {
var o = obj;
keys.slice(0, -1).forEach(function (key) {
o = o[key] || {};
});
var key = keys[keys.length - 1];
return key in o;
}
function isNumber(x) {
if (typeof x === 'number') { return true; }
if ((/^0x[0-9a-f]+$/i).test(x)) { return true; }
return (/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/).test(x);
}
function isConstructorOrProto(obj, key) {
return (key === 'constructor' && typeof obj[key] === 'function') || key === '__proto__';
}
module.exports = function (args, opts) {
if (!opts) opts = {};
var flags = { bools : {}, strings : {}, unknownFn: null };
if (!opts) { opts = {}; }
if (typeof opts['unknown'] === 'function') {
flags.unknownFn = opts['unknown'];
}
var flags = {
bools: {},
strings: {},
unknownFn: null,
};
if (typeof opts['boolean'] === 'boolean' && opts['boolean']) {
flags.allBools = true;
} else {
[].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
flags.bools[key] = true;
});
}
var aliases = {};
Object.keys(opts.alias || {}).forEach(function (key) {
aliases[key] = [].concat(opts.alias[key]);
aliases[key].forEach(function (x) {
aliases[x] = [key].concat(aliases[key].filter(function (y) {
return x !== y;
}));
});
});
if (typeof opts.unknown === 'function') {
flags.unknownFn = opts.unknown;
}
[].concat(opts.string).filter(Boolean).forEach(function (key) {
flags.strings[key] = true;
if (aliases[key]) {
flags.strings[aliases[key]] = true;
}
});
if (typeof opts.boolean === 'boolean' && opts.boolean) {
flags.allBools = true;
} else {
[].concat(opts.boolean).filter(Boolean).forEach(function (key) {
flags.bools[key] = true;
});
}
var defaults = opts['default'] || {};
var argv = { _ : [] };
Object.keys(flags.bools).forEach(function (key) {
setArg(key, defaults[key] === undefined ? false : defaults[key]);
});
var notFlags = [];
var aliases = {};
if (args.indexOf('--') !== -1) {
notFlags = args.slice(args.indexOf('--')+1);
args = args.slice(0, args.indexOf('--'));
}
function aliasIsBoolean(key) {
return aliases[key].some(function (x) {
return flags.bools[x];
});
}
function argDefined(key, arg) {
return (flags.allBools && /^--[^=]+$/.test(arg)) ||
flags.strings[key] || flags.bools[key] || aliases[key];
}
Object.keys(opts.alias || {}).forEach(function (key) {
aliases[key] = [].concat(opts.alias[key]);
aliases[key].forEach(function (x) {
aliases[x] = [key].concat(aliases[key].filter(function (y) {
return x !== y;
}));
});
});
function setArg (key, val, arg) {
if (arg && flags.unknownFn && !argDefined(key, arg)) {
if (flags.unknownFn(arg) === false) return;
}
[].concat(opts.string).filter(Boolean).forEach(function (key) {
flags.strings[key] = true;
if (aliases[key]) {
[].concat(aliases[key]).forEach(function (k) {
flags.strings[k] = true;
});
}
});
var value = !flags.strings[key] && isNumber(val)
? Number(val) : val
;
setKey(argv, key.split('.'), value);
(aliases[key] || []).forEach(function (x) {
setKey(argv, x.split('.'), value);
});
}
var defaults = opts.default || {};
function setKey (obj, keys, value) {
var o = obj;
for (var i = 0; i < keys.length-1; i++) {
var key = keys[i];
if (isConstructorOrProto(o, key)) return;
if (o[key] === undefined) o[key] = {};
if (o[key] === Object.prototype || o[key] === Number.prototype
|| o[key] === String.prototype) o[key] = {};
if (o[key] === Array.prototype) o[key] = [];
o = o[key];
}
var argv = { _: [] };
var key = keys[keys.length - 1];
if (isConstructorOrProto(o, key)) return;
if (o === Object.prototype || o === Number.prototype
|| o === String.prototype) o = {};
if (o === Array.prototype) o = [];
if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
o[key] = value;
}
else if (Array.isArray(o[key])) {
o[key].push(value);
}
else {
o[key] = [ o[key], value ];
}
}
function aliasIsBoolean(key) {
return aliases[key].some(function (x) {
return flags.bools[x];
});
}
function argDefined(key, arg) {
return (flags.allBools && (/^--[^=]+$/).test(arg))
|| flags.strings[key]
|| flags.bools[key]
|| aliases[key];
}
for (var i = 0; i < args.length; i++) {
var arg = args[i];
if (/^--.+=/.test(arg)) {
// Using [\s\S] instead of . because js doesn't support the
// 'dotall' regex modifier. See:
// http://stackoverflow.com/a/1068308/13216
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
var key = m[1];
var value = m[2];
if (flags.bools[key]) {
value = value !== 'false';
}
setArg(key, value, arg);
}
else if (/^--no-.+/.test(arg)) {
var key = arg.match(/^--no-(.+)/)[1];
setArg(key, false, arg);
}
else if (/^--.+/.test(arg)) {
var key = arg.match(/^--(.+)/)[1];
var next = args[i + 1];
if (next !== undefined && !/^-/.test(next)
&& !flags.bools[key]
&& !flags.allBools
&& (aliases[key] ? !aliasIsBoolean(key) : true)) {
setArg(key, next, arg);
i++;
}
else if (/^(true|false)$/.test(next)) {
setArg(key, next === 'true', arg);
i++;
}
else {
setArg(key, flags.strings[key] ? '' : true, arg);
}
}
else if (/^-[^-]+/.test(arg)) {
var letters = arg.slice(1,-1).split('');
var broken = false;
for (var j = 0; j < letters.length; j++) {
var next = arg.slice(j+2);
if (next === '-') {
setArg(letters[j], next, arg)
continue;
}
if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
setArg(letters[j], next.split('=')[1], arg);
broken = true;
break;
}
if (/[A-Za-z]/.test(letters[j])
&& /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
setArg(letters[j], next, arg);
broken = true;
break;
}
if (letters[j+1] && letters[j+1].match(/\W/)) {
setArg(letters[j], arg.slice(j+2), arg);
broken = true;
break;
}
else {
setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
}
}
var key = arg.slice(-1)[0];
if (!broken && key !== '-') {
if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
&& !flags.bools[key]
&& (aliases[key] ? !aliasIsBoolean(key) : true)) {
setArg(key, args[i+1], arg);
i++;
}
else if (args[i+1] && /^(true|false)$/.test(args[i+1])) {
setArg(key, args[i+1] === 'true', arg);
i++;
}
else {
setArg(key, flags.strings[key] ? '' : true, arg);
}
}
}
else {
if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
argv._.push(
flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
);
}
if (opts.stopEarly) {
argv._.push.apply(argv._, args.slice(i + 1));
break;
}
}
}
Object.keys(defaults).forEach(function (key) {
if (!hasKey(argv, key.split('.'))) {
setKey(argv, key.split('.'), defaults[key]);
(aliases[key] || []).forEach(function (x) {
setKey(argv, x.split('.'), defaults[key]);
});
}
});
if (opts['--']) {
argv['--'] = new Array();
notFlags.forEach(function(key) {
argv['--'].push(key);
});
}
else {
notFlags.forEach(function(key) {
argv._.push(key);
});
}
function setKey(obj, keys, value) {
var o = obj;
for (var i = 0; i < keys.length - 1; i++) {
var key = keys[i];
if (isConstructorOrProto(o, key)) { return; }
if (o[key] === undefined) { o[key] = {}; }
if (
o[key] === Object.prototype
|| o[key] === Number.prototype
|| o[key] === String.prototype
) {
o[key] = {};
}
if (o[key] === Array.prototype) { o[key] = []; }
o = o[key];
}
return argv;
var lastKey = keys[keys.length - 1];
if (isConstructorOrProto(o, lastKey)) { return; }
if (
o === Object.prototype
|| o === Number.prototype
|| o === String.prototype
) {
o = {};
}
if (o === Array.prototype) { o = []; }
if (o[lastKey] === undefined || flags.bools[lastKey] || typeof o[lastKey] === 'boolean') {
o[lastKey] = value;
} else if (Array.isArray(o[lastKey])) {
o[lastKey].push(value);
} else {
o[lastKey] = [o[lastKey], value];
}
}
function setArg(key, val, arg) {
if (arg && flags.unknownFn && !argDefined(key, arg)) {
if (flags.unknownFn(arg) === false) { return; }
}
var value = !flags.strings[key] && isNumber(val)
? Number(val)
: val;
setKey(argv, key.split('.'), value);
(aliases[key] || []).forEach(function (x) {
setKey(argv, x.split('.'), value);
});
}
Object.keys(flags.bools).forEach(function (key) {
setArg(key, defaults[key] === undefined ? false : defaults[key]);
});
var notFlags = [];
if (args.indexOf('--') !== -1) {
notFlags = args.slice(args.indexOf('--') + 1);
args = args.slice(0, args.indexOf('--'));
}
for (var i = 0; i < args.length; i++) {
var arg = args[i];
var key;
var next;
if ((/^--.+=/).test(arg)) {
// Using [\s\S] instead of . because js doesn't support the
// 'dotall' regex modifier. See:
// http://stackoverflow.com/a/1068308/13216
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
key = m[1];
var value = m[2];
if (flags.bools[key]) {
value = value !== 'false';
}
setArg(key, value, arg);
} else if ((/^--no-.+/).test(arg)) {
key = arg.match(/^--no-(.+)/)[1];
setArg(key, false, arg);
} else if ((/^--.+/).test(arg)) {
key = arg.match(/^--(.+)/)[1];
next = args[i + 1];
if (
next !== undefined
&& !(/^(-|--)[^-]/).test(next)
&& !flags.bools[key]
&& !flags.allBools
&& (aliases[key] ? !aliasIsBoolean(key) : true)
) {
setArg(key, next, arg);
i += 1;
} else if ((/^(true|false)$/).test(next)) {
setArg(key, next === 'true', arg);
i += 1;
} else {
setArg(key, flags.strings[key] ? '' : true, arg);
}
} else if ((/^-[^-]+/).test(arg)) {
var letters = arg.slice(1, -1).split('');
var broken = false;
for (var j = 0; j < letters.length; j++) {
next = arg.slice(j + 2);
if (next === '-') {
setArg(letters[j], next, arg);
continue;
}
if ((/[A-Za-z]/).test(letters[j]) && next[0] === '=') {
setArg(letters[j], next.slice(1), arg);
broken = true;
break;
}
if (
(/[A-Za-z]/).test(letters[j])
&& (/-?\d+(\.\d*)?(e-?\d+)?$/).test(next)
) {
setArg(letters[j], next, arg);
broken = true;
break;
}
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
setArg(letters[j], arg.slice(j + 2), arg);
broken = true;
break;
} else {
setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
}
}
key = arg.slice(-1)[0];
if (!broken && key !== '-') {
if (
args[i + 1]
&& !(/^(-|--)[^-]/).test(args[i + 1])
&& !flags.bools[key]
&& (aliases[key] ? !aliasIsBoolean(key) : true)
) {
setArg(key, args[i + 1], arg);
i += 1;
} else if (args[i + 1] && (/^(true|false)$/).test(args[i + 1])) {
setArg(key, args[i + 1] === 'true', arg);
i += 1;
} else {
setArg(key, flags.strings[key] ? '' : true, arg);
}
}
} else {
if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));
}
if (opts.stopEarly) {
argv._.push.apply(argv._, args.slice(i + 1));
break;
}
}
}
Object.keys(defaults).forEach(function (k) {
if (!hasKey(argv, k.split('.'))) {
setKey(argv, k.split('.'), defaults[k]);
(aliases[k] || []).forEach(function (x) {
setKey(argv, x.split('.'), defaults[k]);
});
}
});
if (opts['--']) {
argv['--'] = notFlags.slice();
} else {
notFlags.forEach(function (k) {
argv._.push(k);
});
}
return argv;
};
function hasKey (obj, keys) {
var o = obj;
keys.slice(0,-1).forEach(function (key) {
o = (o[key] || {});
});
var key = keys[keys.length - 1];
return key in o;
}
function isNumber (x) {
if (typeof x === 'number') return true;
if (/^0x[0-9a-f]+$/i.test(x)) return true;
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
}
function isConstructorOrProto (obj, key) {
return key === 'constructor' && typeof obj[key] === 'function' || key === '__proto__';
}

146
node_modules/minimist/package.json generated vendored

@ -1,75 +1,75 @@
{
"name": "minimist",
"version": "1.2.7",
"description": "parse argument options",
"main": "index.js",
"devDependencies": {
"@ljharb/eslint-config": "^21.0.0",
"aud": "^2.0.1",
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"in-publish": "^2.0.1",
"npmignore": "^0.3.0",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.6.1"
},
"scripts": {
"prepack": "npmignore --auto --commentLines=auto",
"prepublishOnly": "safe-publish-latest",
"prepublish": "not-in-publish || npm run prepublishOnly",
"lint": "eslint --ext=js,mjs .",
"pretest": "npm run lint",
"tests-only": "nyc tape test/*.js",
"test": "npm run tests-only",
"posttest": "aud --production",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"testling": {
"files": "test/*.js",
"browsers": [
"ie/6..latest",
"ff/5",
"firefox/latest",
"chrome/10",
"chrome/latest",
"safari/5.1",
"safari/latest",
"opera/12"
]
},
"repository": {
"type": "git",
"url": "git://github.com/minimistjs/minimist.git"
},
"homepage": "https://github.com/minimistjs/minimist",
"keywords": [
"argv",
"getopt",
"parser",
"optimist"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
}
"name": "minimist",
"version": "1.2.8",
"description": "parse argument options",
"main": "index.js",
"devDependencies": {
"@ljharb/eslint-config": "^21.0.1",
"aud": "^2.0.2",
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"in-publish": "^2.0.1",
"npmignore": "^0.3.0",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.6.3"
},
"scripts": {
"prepack": "npmignore --auto --commentLines=auto",
"prepublishOnly": "safe-publish-latest",
"prepublish": "not-in-publish || npm run prepublishOnly",
"lint": "eslint --ext=js,mjs .",
"pretest": "npm run lint",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "aud --production",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"testling": {
"files": "test/*.js",
"browsers": [
"ie/6..latest",
"ff/5",
"firefox/latest",
"chrome/10",
"chrome/latest",
"safari/5.1",
"safari/latest",
"opera/12"
]
},
"repository": {
"type": "git",
"url": "git://github.com/minimistjs/minimist.git"
},
"homepage": "https://github.com/minimistjs/minimist",
"keywords": [
"argv",
"getopt",
"parser",
"optimist"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
}
}

@ -1,32 +1,34 @@
'use strict';
var parse = require('../');
var test = require('tape');
test('flag boolean true (default all --args to boolean)', function (t) {
var argv = parse(['moo', '--honk', 'cow'], {
boolean: true
});
t.deepEqual(argv, {
honk: true,
_: ['moo', 'cow']
});
t.deepEqual(typeof argv.honk, 'boolean');
t.end();
var argv = parse(['moo', '--honk', 'cow'], {
boolean: true,
});
t.deepEqual(argv, {
honk: true,
_: ['moo', 'cow'],
});
t.deepEqual(typeof argv.honk, 'boolean');
t.end();
});
test('flag boolean true only affects double hyphen arguments without equals signs', function (t) {
var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], {
boolean: true
});
t.deepEqual(argv, {
honk: true,
tacos: 'good',
p: 55,
_: ['moo', 'cow']
});
t.deepEqual(typeof argv.honk, 'boolean');
t.end();
var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], {
boolean: true,
});
t.deepEqual(argv, {
honk: true,
tacos: 'good',
p: 55,
_: ['moo', 'cow'],
});
t.deepEqual(typeof argv.honk, 'boolean');
t.end();
});

281
node_modules/minimist/test/bool.js generated vendored

@ -1,178 +1,177 @@
'use strict';
var parse = require('../');
var test = require('tape');
test('flag boolean default false', function (t) {
var argv = parse(['moo'], {
boolean: ['t', 'verbose'],
default: { verbose: false, t: false }
});
t.deepEqual(argv, {
verbose: false,
t: false,
_: ['moo']
});
t.deepEqual(typeof argv.verbose, 'boolean');
t.deepEqual(typeof argv.t, 'boolean');
t.end();
var argv = parse(['moo'], {
boolean: ['t', 'verbose'],
default: { verbose: false, t: false },
});
t.deepEqual(argv, {
verbose: false,
t: false,
_: ['moo'],
});
t.deepEqual(typeof argv.verbose, 'boolean');
t.deepEqual(typeof argv.t, 'boolean');
t.end();
});
test('boolean groups', function (t) {
var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], {
boolean: ['x','y','z']
});
t.deepEqual(argv, {
x : true,
y : false,
z : true,
_ : [ 'one', 'two', 'three' ]
});
t.deepEqual(typeof argv.x, 'boolean');
t.deepEqual(typeof argv.y, 'boolean');
t.deepEqual(typeof argv.z, 'boolean');
t.end();
var argv = parse(['-x', '-z', 'one', 'two', 'three'], {
boolean: ['x', 'y', 'z'],
});
t.deepEqual(argv, {
x: true,
y: false,
z: true,
_: ['one', 'two', 'three'],
});
t.deepEqual(typeof argv.x, 'boolean');
t.deepEqual(typeof argv.y, 'boolean');
t.deepEqual(typeof argv.z, 'boolean');
t.end();
});
test('boolean and alias with chainable api', function (t) {
var aliased = [ '-h', 'derp' ];
var regular = [ '--herp', 'derp' ];
var opts = {
herp: { alias: 'h', boolean: true }
};
var aliasedArgv = parse(aliased, {
boolean: 'herp',
alias: { h: 'herp' }
});
var propertyArgv = parse(regular, {
boolean: 'herp',
alias: { h: 'herp' }
});
var expected = {
herp: true,
h: true,
'_': [ 'derp' ]
};
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.end();
var aliased = ['-h', 'derp'];
var regular = ['--herp', 'derp'];
var aliasedArgv = parse(aliased, {
boolean: 'herp',
alias: { h: 'herp' },
});
var propertyArgv = parse(regular, {
boolean: 'herp',
alias: { h: 'herp' },
});
var expected = {
herp: true,
h: true,
_: ['derp'],
};
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.end();
});
test('boolean and alias with options hash', function (t) {
var aliased = [ '-h', 'derp' ];
var regular = [ '--herp', 'derp' ];
var opts = {
alias: { 'h': 'herp' },
boolean: 'herp'
};
var aliasedArgv = parse(aliased, opts);
var propertyArgv = parse(regular, opts);
var expected = {
herp: true,
h: true,
'_': [ 'derp' ]
};
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.end();
var aliased = ['-h', 'derp'];
var regular = ['--herp', 'derp'];
var opts = {
alias: { h: 'herp' },
boolean: 'herp',
};
var aliasedArgv = parse(aliased, opts);
var propertyArgv = parse(regular, opts);
var expected = {
herp: true,
h: true,
_: ['derp'],
};
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.end();
});
test('boolean and alias array with options hash', function (t) {
var aliased = [ '-h', 'derp' ];
var regular = [ '--herp', 'derp' ];
var alt = [ '--harp', 'derp' ];
var opts = {
alias: { 'h': ['herp', 'harp'] },
boolean: 'h'
};
var aliasedArgv = parse(aliased, opts);
var propertyArgv = parse(regular, opts);
var altPropertyArgv = parse(alt, opts);
var expected = {
harp: true,
herp: true,
h: true,
'_': [ 'derp' ]
};
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.same(altPropertyArgv, expected);
t.end();
var aliased = ['-h', 'derp'];
var regular = ['--herp', 'derp'];
var alt = ['--harp', 'derp'];
var opts = {
alias: { h: ['herp', 'harp'] },
boolean: 'h',
};
var aliasedArgv = parse(aliased, opts);
var propertyArgv = parse(regular, opts);
var altPropertyArgv = parse(alt, opts);
var expected = {
harp: true,
herp: true,
h: true,
_: ['derp'],
};
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.same(altPropertyArgv, expected);
t.end();
});
test('boolean and alias using explicit true', function (t) {
var aliased = [ '-h', 'true' ];
var regular = [ '--herp', 'true' ];
var opts = {
alias: { h: 'herp' },
boolean: 'h'
};
var aliasedArgv = parse(aliased, opts);
var propertyArgv = parse(regular, opts);
var expected = {
herp: true,
h: true,
'_': [ ]
};
var aliased = ['-h', 'true'];
var regular = ['--herp', 'true'];
var opts = {
alias: { h: 'herp' },
boolean: 'h',
};
var aliasedArgv = parse(aliased, opts);
var propertyArgv = parse(regular, opts);
var expected = {
herp: true,
h: true,
_: [],
};
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.end();
t.same(aliasedArgv, expected);
t.same(propertyArgv, expected);
t.end();
});
// regression, see https://github.com/substack/node-optimist/issues/71
test('boolean and --x=true', function(t) {
var parsed = parse(['--boool', '--other=true'], {
boolean: 'boool'
});
test('boolean and --x=true', function (t) {
var parsed = parse(['--boool', '--other=true'], {
boolean: 'boool',
});
t.same(parsed.boool, true);
t.same(parsed.other, 'true');
t.same(parsed.boool, true);
t.same(parsed.other, 'true');
parsed = parse(['--boool', '--other=false'], {
boolean: 'boool'
});
t.same(parsed.boool, true);
t.same(parsed.other, 'false');
t.end();
parsed = parse(['--boool', '--other=false'], {
boolean: 'boool',
});
t.same(parsed.boool, true);
t.same(parsed.other, 'false');
t.end();
});
test('boolean --boool=true', function (t) {
var parsed = parse(['--boool=true'], {
default: {
boool: false
},
boolean: ['boool']
});
var parsed = parse(['--boool=true'], {
default: {
boool: false,
},
boolean: ['boool'],
});
t.same(parsed.boool, true);
t.end();
t.same(parsed.boool, true);
t.end();
});
test('boolean --boool=false', function (t) {
var parsed = parse(['--boool=false'], {
default: {
boool: true
},
boolean: ['boool']
});
var parsed = parse(['--boool=false'], {
default: {
boool: true,
},
boolean: ['boool'],
});
t.same(parsed.boool, false);
t.end();
t.same(parsed.boool, false);
t.end();
});
test('boolean using something similar to true', function (t) {
var opts = { boolean: 'h' };
var result = parse(['-h', 'true.txt'], opts);
var expected = {
h: true,
'_': ['true.txt']
};
var opts = { boolean: 'h' };
var result = parse(['-h', 'true.txt'], opts);
var expected = {
h: true,
_: ['true.txt'],
};
t.same(result, expected);
t.end();
});
t.same(result, expected);
t.end();
});

54
node_modules/minimist/test/dash.js generated vendored

@ -1,31 +1,43 @@
'use strict';
var parse = require('../');
var test = require('tape');
test('-', function (t) {
t.plan(5);
t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] });
t.deepEqual(parse([ '-' ]), { _: [ '-' ] });
t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] });
t.deepEqual(
parse([ '-b', '-' ], { boolean: 'b' }),
{ b: true, _: [ '-' ] }
);
t.deepEqual(
parse([ '-s', '-' ], { string: 's' }),
{ s: '-', _: [] }
);
t.plan(6);
t.deepEqual(parse(['-n', '-']), { n: '-', _: [] });
t.deepEqual(parse(['--nnn', '-']), { nnn: '-', _: [] });
t.deepEqual(parse(['-']), { _: ['-'] });
t.deepEqual(parse(['-f-']), { f: '-', _: [] });
t.deepEqual(
parse(['-b', '-'], { boolean: 'b' }),
{ b: true, _: ['-'] }
);
t.deepEqual(
parse(['-s', '-'], { string: 's' }),
{ s: '-', _: [] }
);
});
test('-a -- b', function (t) {
t.plan(3);
t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] });
t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
t.plan(2);
t.deepEqual(parse(['-a', '--', 'b']), { a: true, _: ['b'] });
t.deepEqual(parse(['--a', '--', 'b']), { a: true, _: ['b'] });
});
test('move arguments after the -- into their own `--` array', function(t) {
t.plan(1);
t.deepEqual(
parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }),
{ name: 'John', _: [ 'before' ], '--': [ 'after' ] });
test('move arguments after the -- into their own `--` array', function (t) {
t.plan(1);
t.deepEqual(
parse(['--name', 'John', 'before', '--', 'after'], { '--': true }),
{ name: 'John', _: ['before'], '--': ['after'] }
);
});
test('--- option value', function (t) {
// A multi-dash value is largely an edge case, but check the behaviour is as expected,
// and in particular the same for short option and long option (as made consistent in Jan 2023).
t.plan(2);
t.deepEqual(parse(['-n', '---']), { n: '---', _: [] });
t.deepEqual(parse(['--nnn', '---']), { nnn: '---', _: [] });
});

@ -1,35 +1,37 @@
'use strict';
var test = require('tape');
var parse = require('../');
test('boolean default true', function (t) {
var argv = parse([], {
boolean: 'sometrue',
default: { sometrue: true }
});
t.equal(argv.sometrue, true);
t.end();
var argv = parse([], {
boolean: 'sometrue',
default: { sometrue: true },
});
t.equal(argv.sometrue, true);
t.end();
});
test('boolean default false', function (t) {
var argv = parse([], {
boolean: 'somefalse',
default: { somefalse: false }
});
t.equal(argv.somefalse, false);
t.end();
var argv = parse([], {
boolean: 'somefalse',
default: { somefalse: false },
});
t.equal(argv.somefalse, false);
t.end();
});
test('boolean default to null', function (t) {
var argv = parse([], {
boolean: 'maybe',
default: { maybe: null }
});
t.equal(argv.maybe, null);
var argv = parse(['--maybe'], {
boolean: 'maybe',
default: { maybe: null }
});
t.equal(argv.maybe, true);
t.end();
var argv = parse([], {
boolean: 'maybe',
default: { maybe: null },
});
t.equal(argv.maybe, null);
})
var argvLong = parse(['--maybe'], {
boolean: 'maybe',
default: { maybe: null },
});
t.equal(argvLong.maybe, true);
t.end();
});

24
node_modules/minimist/test/dotted.js generated vendored

@ -1,22 +1,24 @@
'use strict';
var parse = require('../');
var test = require('tape');
test('dotted alias', function (t) {
var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
t.equal(argv.a.b, 22);
t.equal(argv.aa.bb, 22);
t.end();
var argv = parse(['--a.b', '22'], { default: { 'a.b': 11 }, alias: { 'a.b': 'aa.bb' } });
t.equal(argv.a.b, 22);
t.equal(argv.aa.bb, 22);
t.end();
});
test('dotted default', function (t) {
var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
t.equal(argv.a.b, 11);
t.equal(argv.aa.bb, 11);
t.end();
var argv = parse('', { default: { 'a.b': 11 }, alias: { 'a.b': 'aa.bb' } });
t.equal(argv.a.b, 11);
t.equal(argv.aa.bb, 11);
t.end();
});
test('dotted default with no alias', function (t) {
var argv = parse('', {default: {'a.b': 11}});
t.equal(argv.a.b, 11);
t.end();
var argv = parse('', { default: { 'a.b': 11 } });
t.equal(argv.a.b, 11);
t.end();
});

@ -1,16 +1,32 @@
'use strict';
var parse = require('../');
var test = require('tape');
test('short -k=v' , function (t) {
t.plan(1);
var argv = parse([ '-b=123' ]);
t.deepEqual(argv, { b: 123, _: [] });
test('short -k=v', function (t) {
t.plan(1);
var argv = parse(['-b=123']);
t.deepEqual(argv, { b: 123, _: [] });
});
test('multi short -k=v' , function (t) {
t.plan(1);
var argv = parse([ '-a=whatever', '-b=robots' ]);
t.deepEqual(argv, { a: 'whatever', b: 'robots', _: [] });
test('multi short -k=v', function (t) {
t.plan(1);
var argv = parse(['-a=whatever', '-b=robots']);
t.deepEqual(argv, { a: 'whatever', b: 'robots', _: [] });
});
test('short with embedded equals -k=a=b', function (t) {
t.plan(1);
var argv = parse(['-k=a=b']);
t.deepEqual(argv, { k: 'a=b', _: [] });
});
test('short with later equals like -ab=c', function (t) {
t.plan(1);
var argv = parse(['-ab=c']);
t.deepEqual(argv, { a: true, b: 'c', _: [] });
});

54
node_modules/minimist/test/long.js generated vendored

@ -1,31 +1,33 @@
'use strict';
var test = require('tape');
var parse = require('../');
test('long opts', function (t) {
t.deepEqual(
parse([ '--bool' ]),
{ bool : true, _ : [] },
'long boolean'
);
t.deepEqual(
parse([ '--pow', 'xixxle' ]),
{ pow : 'xixxle', _ : [] },
'long capture sp'
);
t.deepEqual(
parse([ '--pow=xixxle' ]),
{ pow : 'xixxle', _ : [] },
'long capture eq'
);
t.deepEqual(
parse([ '--host', 'localhost', '--port', '555' ]),
{ host : 'localhost', port : 555, _ : [] },
'long captures sp'
);
t.deepEqual(
parse([ '--host=localhost', '--port=555' ]),
{ host : 'localhost', port : 555, _ : [] },
'long captures eq'
);
t.end();
t.deepEqual(
parse(['--bool']),
{ bool: true, _: [] },
'long boolean'
);
t.deepEqual(
parse(['--pow', 'xixxle']),
{ pow: 'xixxle', _: [] },
'long capture sp'
);
t.deepEqual(
parse(['--pow=xixxle']),
{ pow: 'xixxle', _: [] },
'long capture eq'
);
t.deepEqual(
parse(['--host', 'localhost', '--port', '555']),
{ host: 'localhost', port: 555, _: [] },
'long captures sp'
);
t.deepEqual(
parse(['--host=localhost', '--port=555']),
{ host: 'localhost', port: 555, _: [] },
'long captures eq'
);
t.end();
});

58
node_modules/minimist/test/num.js generated vendored

@ -1,36 +1,38 @@
'use strict';
var parse = require('../');
var test = require('tape');
test('nums', function (t) {
var argv = parse([
'-x', '1234',
'-y', '5.67',
'-z', '1e7',
'-w', '10f',
'--hex', '0xdeadbeef',
'789'
]);
t.deepEqual(argv, {
x : 1234,
y : 5.67,
z : 1e7,
w : '10f',
hex : 0xdeadbeef,
_ : [ 789 ]
});
t.deepEqual(typeof argv.x, 'number');
t.deepEqual(typeof argv.y, 'number');
t.deepEqual(typeof argv.z, 'number');
t.deepEqual(typeof argv.w, 'string');
t.deepEqual(typeof argv.hex, 'number');
t.deepEqual(typeof argv._[0], 'number');
t.end();
var argv = parse([
'-x', '1234',
'-y', '5.67',
'-z', '1e7',
'-w', '10f',
'--hex', '0xdeadbeef',
'789',
]);
t.deepEqual(argv, {
x: 1234,
y: 5.67,
z: 1e7,
w: '10f',
hex: 0xdeadbeef,
_: [789],
});
t.deepEqual(typeof argv.x, 'number');
t.deepEqual(typeof argv.y, 'number');
t.deepEqual(typeof argv.z, 'number');
t.deepEqual(typeof argv.w, 'string');
t.deepEqual(typeof argv.hex, 'number');
t.deepEqual(typeof argv._[0], 'number');
t.end();
});
test('already a number', function (t) {
var argv = parse([ '-x', 1234, 789 ]);
t.deepEqual(argv, { x : 1234, _ : [ 789 ] });
t.deepEqual(typeof argv.x, 'number');
t.deepEqual(typeof argv._[0], 'number');
t.end();
var argv = parse(['-x', 1234, 789]);
t.deepEqual(argv, { x: 1234, _: [789] });
t.deepEqual(typeof argv.x, 'number');
t.deepEqual(typeof argv._[0], 'number');
t.end();
});

318
node_modules/minimist/test/parse.js generated vendored

@ -1,197 +1,209 @@
'use strict';
var parse = require('../');
var test = require('tape');
test('parse args', function (t) {
t.deepEqual(
parse([ '--no-moo' ]),
{ moo : false, _ : [] },
'no'
);
t.deepEqual(
parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]),
{ v : ['a','b','c'], _ : [] },
'multi'
);
t.end();
t.deepEqual(
parse(['--no-moo']),
{ moo: false, _: [] },
'no'
);
t.deepEqual(
parse(['-v', 'a', '-v', 'b', '-v', 'c']),
{ v: ['a', 'b', 'c'], _: [] },
'multi'
);
t.end();
});
test('comprehensive', function (t) {
t.deepEqual(
parse([
'--name=meowmers', 'bare', '-cats', 'woo',
'-h', 'awesome', '--multi=quux',
'--key', 'value',
'-b', '--bool', '--no-meep', '--multi=baz',
'--', '--not-a-flag', 'eek'
]),
{
c : true,
a : true,
t : true,
s : 'woo',
h : 'awesome',
b : true,
bool : true,
key : 'value',
multi : [ 'quux', 'baz' ],
meep : false,
name : 'meowmers',
_ : [ 'bare', '--not-a-flag', 'eek' ]
}
);
t.end();
t.deepEqual(
parse([
'--name=meowmers', 'bare', '-cats', 'woo',
'-h', 'awesome', '--multi=quux',
'--key', 'value',
'-b', '--bool', '--no-meep', '--multi=baz',
'--', '--not-a-flag', 'eek',
]),
{
c: true,
a: true,
t: true,
s: 'woo',
h: 'awesome',
b: true,
bool: true,
key: 'value',
multi: ['quux', 'baz'],
meep: false,
name: 'meowmers',
_: ['bare', '--not-a-flag', 'eek'],
}
);
t.end();
});
test('flag boolean', function (t) {
var argv = parse([ '-t', 'moo' ], { boolean: 't' });
t.deepEqual(argv, { t : true, _ : [ 'moo' ] });
t.deepEqual(typeof argv.t, 'boolean');
t.end();
var argv = parse(['-t', 'moo'], { boolean: 't' });
t.deepEqual(argv, { t: true, _: ['moo'] });
t.deepEqual(typeof argv.t, 'boolean');
t.end();
});
test('flag boolean value', function (t) {
var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], {
boolean: [ 't', 'verbose' ],
default: { verbose: true }
});
t.deepEqual(argv, {
verbose: false,
t: true,
_: ['moo']
});
t.deepEqual(typeof argv.verbose, 'boolean');
t.deepEqual(typeof argv.t, 'boolean');
t.end();
var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], {
boolean: ['t', 'verbose'],
default: { verbose: true },
});
t.deepEqual(argv, {
verbose: false,
t: true,
_: ['moo'],
});
t.deepEqual(typeof argv.verbose, 'boolean');
t.deepEqual(typeof argv.t, 'boolean');
t.end();
});
test('newlines in params' , function (t) {
var args = parse([ '-s', "X\nX" ])
t.deepEqual(args, { _ : [], s : "X\nX" });
// reproduce in bash:
// VALUE="new
// line"
// node program.js --s="$VALUE"
args = parse([ "--s=X\nX" ])
t.deepEqual(args, { _ : [], s : "X\nX" });
t.end();
test('newlines in params', function (t) {
var args = parse(['-s', 'X\nX']);
t.deepEqual(args, { _: [], s: 'X\nX' });
// reproduce in bash:
// VALUE="new
// line"
// node program.js --s="$VALUE"
args = parse(['--s=X\nX']);
t.deepEqual(args, { _: [], s: 'X\nX' });
t.end();
});
test('strings' , function (t) {
var s = parse([ '-s', '0001234' ], { string: 's' }).s;
t.equal(s, '0001234');
t.equal(typeof s, 'string');
var x = parse([ '-x', '56' ], { string: 'x' }).x;
t.equal(x, '56');
t.equal(typeof x, 'string');
t.end();
test('strings', function (t) {
var s = parse(['-s', '0001234'], { string: 's' }).s;
t.equal(s, '0001234');
t.equal(typeof s, 'string');
var x = parse(['-x', '56'], { string: 'x' }).x;
t.equal(x, '56');
t.equal(typeof x, 'string');
t.end();
});
test('stringArgs', function (t) {
var s = parse([ ' ', ' ' ], { string: '_' })._;
t.same(s.length, 2);
t.same(typeof s[0], 'string');
t.same(s[0], ' ');
t.same(typeof s[1], 'string');
t.same(s[1], ' ');
t.end();
var s = parse([' ', ' '], { string: '_' })._;
t.same(s.length, 2);
t.same(typeof s[0], 'string');
t.same(s[0], ' ');
t.same(typeof s[1], 'string');
t.same(s[1], ' ');
t.end();
});
test('empty strings', function(t) {
var s = parse([ '-s' ], { string: 's' }).s;
t.equal(s, '');
t.equal(typeof s, 'string');
test('empty strings', function (t) {
var s = parse(['-s'], { string: 's' }).s;
t.equal(s, '');
t.equal(typeof s, 'string');
var str = parse([ '--str' ], { string: 'str' }).str;
t.equal(str, '');
t.equal(typeof str, 'string');
var str = parse(['--str'], { string: 'str' }).str;
t.equal(str, '');
t.equal(typeof str, 'string');
var letters = parse([ '-art' ], {
string: [ 'a', 't' ]
});
var letters = parse(['-art'], {
string: ['a', 't'],
});
t.equal(letters.a, '');
t.equal(letters.r, true);
t.equal(letters.t, '');
t.equal(letters.a, '');
t.equal(letters.r, true);
t.equal(letters.t, '');
t.end();
t.end();
});
test('string and alias', function (t) {
var x = parse(['--str', '000123'], {
string: 's',
alias: { s: 'str' },
});
test('string and alias', function(t) {
var x = parse([ '--str', '000123' ], {
string: 's',
alias: { s: 'str' }
});
t.equal(x.str, '000123');
t.equal(typeof x.str, 'string');
t.equal(x.s, '000123');
t.equal(typeof x.s, 'string');
t.equal(x.str, '000123');
t.equal(typeof x.str, 'string');
t.equal(x.s, '000123');
t.equal(typeof x.s, 'string');
var y = parse(['-s', '000123'], {
string: 'str',
alias: { str: 's' },
});
var y = parse([ '-s', '000123' ], {
string: 'str',
alias: { str: 's' }
});
t.equal(y.str, '000123');
t.equal(typeof y.str, 'string');
t.equal(y.s, '000123');
t.equal(typeof y.s, 'string');
t.equal(y.str, '000123');
t.equal(typeof y.str, 'string');
t.equal(y.s, '000123');
t.equal(typeof y.s, 'string');
t.end();
var z = parse(['-s123'], {
alias: { str: ['s', 'S'] },
string: ['str'],
});
t.deepEqual(
z,
{ _: [], s: '123', S: '123', str: '123' },
'opt.string works with multiple aliases'
);
t.end();
});
test('slashBreak', function (t) {
t.same(
parse([ '-I/foo/bar/baz' ]),
{ I : '/foo/bar/baz', _ : [] }
);
t.same(
parse([ '-xyz/foo/bar/baz' ]),
{ x : true, y : true, z : '/foo/bar/baz', _ : [] }
);
t.end();
t.same(
parse(['-I/foo/bar/baz']),
{ I: '/foo/bar/baz', _: [] }
);
t.same(
parse(['-xyz/foo/bar/baz']),
{ x: true, y: true, z: '/foo/bar/baz', _: [] }
);
t.end();
});
test('alias', function (t) {
var argv = parse([ '-f', '11', '--zoom', '55' ], {
alias: { z: 'zoom' }
});
t.equal(argv.zoom, 55);
t.equal(argv.z, argv.zoom);
t.equal(argv.f, 11);
t.end();
var argv = parse(['-f', '11', '--zoom', '55'], {
alias: { z: 'zoom' },
});
t.equal(argv.zoom, 55);
t.equal(argv.z, argv.zoom);
t.equal(argv.f, 11);
t.end();
});
test('multiAlias', function (t) {
var argv = parse([ '-f', '11', '--zoom', '55' ], {
alias: { z: [ 'zm', 'zoom' ] }
});
t.equal(argv.zoom, 55);
t.equal(argv.z, argv.zoom);
t.equal(argv.z, argv.zm);
t.equal(argv.f, 11);
t.end();
var argv = parse(['-f', '11', '--zoom', '55'], {
alias: { z: ['zm', 'zoom'] },
});
t.equal(argv.zoom, 55);
t.equal(argv.z, argv.zoom);
t.equal(argv.z, argv.zm);
t.equal(argv.f, 11);
t.end();
});
test('nested dotted objects', function (t) {
var argv = parse([
'--foo.bar', '3', '--foo.baz', '4',
'--foo.quux.quibble', '5', '--foo.quux.o_O',
'--beep.boop'
]);
t.same(argv.foo, {
bar : 3,
baz : 4,
quux : {
quibble : 5,
o_O : true
}
});
t.same(argv.beep, { boop : true });
t.end();
var argv = parse([
'--foo.bar', '3', '--foo.baz', '4',
'--foo.quux.quibble', '5', '--foo.quux.o_O',
'--beep.boop',
]);
t.same(argv.foo, {
bar: 3,
baz: 4,
quux: {
quibble: 5,
o_O: true,
},
});
t.same(argv.beep, { boop: true });
t.end();
});

@ -1,9 +1,11 @@
'use strict';
var parse = require('../');
var test = require('tape');
test('parse with modifier functions' , function (t) {
t.plan(1);
var argv = parse([ '-b', '123' ], { boolean: 'b' });
t.deepEqual(argv, { b: true, _: [123] });
test('parse with modifier functions', function (t) {
t.plan(1);
var argv = parse(['-b', '123'], { boolean: 'b' });
t.deepEqual(argv, { b: true, _: [123] });
});

78
node_modules/minimist/test/proto.js generated vendored

@ -1,60 +1,64 @@
'use strict';
/* eslint no-proto: 0 */
var parse = require('../');
var test = require('tape');
test('proto pollution', function (t) {
var argv = parse(['--__proto__.x','123']);
t.equal({}.x, undefined);
t.equal(argv.__proto__.x, undefined);
t.equal(argv.x, undefined);
t.end();
var argv = parse(['--__proto__.x', '123']);
t.equal({}.x, undefined);
t.equal(argv.__proto__.x, undefined);
t.equal(argv.x, undefined);
t.end();
});
test('proto pollution (array)', function (t) {
var argv = parse(['--x','4','--x','5','--x.__proto__.z','789']);
t.equal({}.z, undefined);
t.deepEqual(argv.x, [4,5]);
t.equal(argv.x.z, undefined);
t.equal(argv.x.__proto__.z, undefined);
t.end();
var argv = parse(['--x', '4', '--x', '5', '--x.__proto__.z', '789']);
t.equal({}.z, undefined);
t.deepEqual(argv.x, [4, 5]);
t.equal(argv.x.z, undefined);
t.equal(argv.x.__proto__.z, undefined);
t.end();
});
test('proto pollution (number)', function (t) {
var argv = parse(['--x','5','--x.__proto__.z','100']);
t.equal({}.z, undefined);
t.equal((4).z, undefined);
t.equal(argv.x, 5);
t.equal(argv.x.z, undefined);
t.end();
var argv = parse(['--x', '5', '--x.__proto__.z', '100']);
t.equal({}.z, undefined);
t.equal((4).z, undefined);
t.equal(argv.x, 5);
t.equal(argv.x.z, undefined);
t.end();
});
test('proto pollution (string)', function (t) {
var argv = parse(['--x','abc','--x.__proto__.z','def']);
t.equal({}.z, undefined);
t.equal('...'.z, undefined);
t.equal(argv.x, 'abc');
t.equal(argv.x.z, undefined);
t.end();
var argv = parse(['--x', 'abc', '--x.__proto__.z', 'def']);
t.equal({}.z, undefined);
t.equal('...'.z, undefined);
t.equal(argv.x, 'abc');
t.equal(argv.x.z, undefined);
t.end();
});
test('proto pollution (constructor)', function (t) {
var argv = parse(['--constructor.prototype.y','123']);
t.equal({}.y, undefined);
t.equal(argv.y, undefined);
t.end();
var argv = parse(['--constructor.prototype.y', '123']);
t.equal({}.y, undefined);
t.equal(argv.y, undefined);
t.end();
});
test('proto pollution (constructor function)', function (t) {
var argv = parse(['--_.concat.constructor.prototype.y', '123']);
function fnToBeTested() {}
t.equal(fnToBeTested.y, undefined);
t.equal(argv.y, undefined);
t.end();
var argv = parse(['--_.concat.constructor.prototype.y', '123']);
function fnToBeTested() {}
t.equal(fnToBeTested.y, undefined);
t.equal(argv.y, undefined);
t.end();
});
// powered by snyk - https://github.com/backstage/backstage/issues/10343
test('proto pollution (constructor function) snyk', function (t) {
var argv = parse('--_.constructor.constructor.prototype.foo bar'.split(' '));
t.equal((function(){}).foo, undefined);
t.equal(argv.y, undefined);
t.end();
})
var argv = parse('--_.constructor.constructor.prototype.foo bar'.split(' '));
t.equal(function () {}.foo, undefined);
t.equal(argv.y, undefined);
t.end();
});

112
node_modules/minimist/test/short.js generated vendored

@ -1,67 +1,69 @@
'use strict';
var parse = require('../');
var test = require('tape');
test('numeric short args', function (t) {
t.plan(2);
t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] });
t.deepEqual(
parse([ '-123', '456' ]),
{ 1: true, 2: true, 3: 456, _: [] }
);
t.plan(2);
t.deepEqual(parse(['-n123']), { n: 123, _: [] });
t.deepEqual(
parse(['-123', '456']),
{ 1: true, 2: true, 3: 456, _: [] }
);
});
test('short', function (t) {
t.deepEqual(
parse([ '-b' ]),
{ b : true, _ : [] },
'short boolean'
);
t.deepEqual(
parse([ 'foo', 'bar', 'baz' ]),
{ _ : [ 'foo', 'bar', 'baz' ] },
'bare'
);
t.deepEqual(
parse([ '-cats' ]),
{ c : true, a : true, t : true, s : true, _ : [] },
'group'
);
t.deepEqual(
parse([ '-cats', 'meow' ]),
{ c : true, a : true, t : true, s : 'meow', _ : [] },
'short group next'
);
t.deepEqual(
parse([ '-h', 'localhost' ]),
{ h : 'localhost', _ : [] },
'short capture'
);
t.deepEqual(
parse([ '-h', 'localhost', '-p', '555' ]),
{ h : 'localhost', p : 555, _ : [] },
'short captures'
);
t.end();
t.deepEqual(
parse(['-b']),
{ b: true, _: [] },
'short boolean'
);
t.deepEqual(
parse(['foo', 'bar', 'baz']),
{ _: ['foo', 'bar', 'baz'] },
'bare'
);
t.deepEqual(
parse(['-cats']),
{ c: true, a: true, t: true, s: true, _: [] },
'group'
);
t.deepEqual(
parse(['-cats', 'meow']),
{ c: true, a: true, t: true, s: 'meow', _: [] },
'short group next'
);
t.deepEqual(
parse(['-h', 'localhost']),
{ h: 'localhost', _: [] },
'short capture'
);
t.deepEqual(
parse(['-h', 'localhost', '-p', '555']),
{ h: 'localhost', p: 555, _: [] },
'short captures'
);
t.end();
});
test('mixed short bool and capture', function (t) {
t.same(
parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),
{
f : true, p : 555, h : 'localhost',
_ : [ 'script.js' ]
}
);
t.end();
t.same(
parse(['-h', 'localhost', '-fp', '555', 'script.js']),
{
f: true, p: 555, h: 'localhost',
_: ['script.js'],
}
);
t.end();
});
test('short and long', function (t) {
t.deepEqual(
parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),
{
f : true, p : 555, h : 'localhost',
_ : [ 'script.js' ]
}
);
t.end();
t.deepEqual(
parse(['-h', 'localhost', '-fp', '555', 'script.js']),
{
f: true, p: 555, h: 'localhost',
_: ['script.js'],
}
);
t.end();
});

@ -1,15 +1,17 @@
'use strict';
var parse = require('../');
var test = require('tape');
test('stops parsing on the first non-option when stopEarly is set', function (t) {
var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], {
stopEarly: true
});
var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], {
stopEarly: true,
});
t.deepEqual(argv, {
aaa: 'bbb',
_: ['ccc', '--ddd']
});
t.deepEqual(argv, {
aaa: 'bbb',
_: ['ccc', '--ddd'],
});
t.end();
t.end();
});

164
node_modules/minimist/test/unknown.js generated vendored

@ -1,102 +1,104 @@
'use strict';
var parse = require('../');
var test = require('tape');
test('boolean and alias is not unknown', function (t) {
var unknown = [];
function unknownFn(arg) {
unknown.push(arg);
return false;
}
var aliased = [ '-h', 'true', '--derp', 'true' ];
var regular = [ '--herp', 'true', '-d', 'true' ];
var opts = {
alias: { h: 'herp' },
boolean: 'h',
unknown: unknownFn
};
var aliasedArgv = parse(aliased, opts);
var propertyArgv = parse(regular, opts);
var unknown = [];
function unknownFn(arg) {
unknown.push(arg);
return false;
}
var aliased = ['-h', 'true', '--derp', 'true'];
var regular = ['--herp', 'true', '-d', 'true'];
var opts = {
alias: { h: 'herp' },
boolean: 'h',
unknown: unknownFn,
};
parse(aliased, opts);
parse(regular, opts);
t.same(unknown, ['--derp', '-d']);
t.end();
t.same(unknown, ['--derp', '-d']);
t.end();
});
test('flag boolean true any double hyphen argument is not unknown', function (t) {
var unknown = [];
function unknownFn(arg) {
unknown.push(arg);
return false;
}
var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], {
boolean: true,
unknown: unknownFn
});
t.same(unknown, ['--tacos=good', 'cow', '-p']);
t.same(argv, {
honk: true,
_: []
});
t.end();
var unknown = [];
function unknownFn(arg) {
unknown.push(arg);
return false;
}
var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], {
boolean: true,
unknown: unknownFn,
});
t.same(unknown, ['--tacos=good', 'cow', '-p']);
t.same(argv, {
honk: true,
_: [],
});
t.end();
});
test('string and alias is not unknown', function (t) {
var unknown = [];
function unknownFn(arg) {
unknown.push(arg);
return false;
}
var aliased = [ '-h', 'hello', '--derp', 'goodbye' ];
var regular = [ '--herp', 'hello', '-d', 'moon' ];
var opts = {
alias: { h: 'herp' },
string: 'h',
unknown: unknownFn
};
var aliasedArgv = parse(aliased, opts);
var propertyArgv = parse(regular, opts);
var unknown = [];
function unknownFn(arg) {
unknown.push(arg);
return false;
}
var aliased = ['-h', 'hello', '--derp', 'goodbye'];
var regular = ['--herp', 'hello', '-d', 'moon'];
var opts = {
alias: { h: 'herp' },
string: 'h',
unknown: unknownFn,
};
parse(aliased, opts);
parse(regular, opts);
t.same(unknown, ['--derp', '-d']);
t.end();
t.same(unknown, ['--derp', '-d']);
t.end();
});
test('default and alias is not unknown', function (t) {
var unknown = [];
function unknownFn(arg) {
unknown.push(arg);
return false;
}
var aliased = [ '-h', 'hello' ];
var regular = [ '--herp', 'hello' ];
var opts = {
default: { 'h': 'bar' },
alias: { 'h': 'herp' },
unknown: unknownFn
};
var aliasedArgv = parse(aliased, opts);
var propertyArgv = parse(regular, opts);
var unknown = [];
function unknownFn(arg) {
unknown.push(arg);
return false;
}
var aliased = ['-h', 'hello'];
var regular = ['--herp', 'hello'];
var opts = {
default: { h: 'bar' },
alias: { h: 'herp' },
unknown: unknownFn,
};
parse(aliased, opts);
parse(regular, opts);
t.same(unknown, []);
t.end();
unknownFn(); // exercise fn for 100% coverage
t.same(unknown, []);
t.end();
unknownFn(); // exercise fn for 100% coverage
});
test('value following -- is not unknown', function (t) {
var unknown = [];
function unknownFn(arg) {
unknown.push(arg);
return false;
}
var aliased = [ '--bad', '--', 'good', 'arg' ];
var opts = {
'--': true,
unknown: unknownFn
};
var argv = parse(aliased, opts);
var unknown = [];
function unknownFn(arg) {
unknown.push(arg);
return false;
}
var aliased = ['--bad', '--', 'good', 'arg'];
var opts = {
'--': true,
unknown: unknownFn,
};
var argv = parse(aliased, opts);
t.same(unknown, ['--bad']);
t.same(argv, {
'--': ['good', 'arg'],
'_': []
})
t.end();
t.same(unknown, ['--bad']);
t.same(argv, {
'--': ['good', 'arg'],
_: [],
});
t.end();
});

@ -1,8 +1,10 @@
'use strict';
var parse = require('../');
var test = require('tape');
test('whitespace should be whitespace' , function (t) {
t.plan(1);
var x = parse([ '-x', '\t' ]).x;
t.equal(x, '\t');
test('whitespace should be whitespace', function (t) {
t.plan(1);
var x = parse(['-x', '\t']).x;
t.equal(x, '\t');
});

21
node_modules/webpod/LICENSE generated vendored Normal file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Anton Medvedev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

34
node_modules/webpod/README.md generated vendored Normal file

@ -0,0 +1,34 @@
# Webpod
```js
import { ssh } from 'webpod'
const $ = ssh('user@host')
const branch = await $`git branch --show-current`
await $`echo ${branch}`
await $`mkdir /tmp/${'foo bar'}`
```
## Installation
```sh
npm install webpod
```
```sh
deno install -A -r https://deno.land/x/webpod/webpod.ts
```
## Usage
### ssh()
```js
ssh('user@host', {port: 22, options: ['StrictHostKeyChecking=no']})
```
## License
[MIT](LICENSE)

1
node_modules/webpod/dist/cli.d.ts generated vendored Normal file

@ -0,0 +1 @@
export {};

1
node_modules/webpod/dist/cli.js generated vendored Normal file

@ -0,0 +1 @@
export {};

1
node_modules/webpod/dist/index.d.ts generated vendored Normal file

@ -0,0 +1 @@
export { ssh } from './ssh.js';

1
node_modules/webpod/dist/index.js generated vendored Executable file

@ -0,0 +1 @@
export { ssh } from './ssh.js';

19
node_modules/webpod/dist/ssh.d.ts generated vendored Normal file

@ -0,0 +1,19 @@
export type RemoteShell = ((pieces: TemplateStringsArray, ...values: any[]) => Promise<Result>) & {
exit: () => void;
};
export type Options = {
port?: number | string;
forwardAgent?: boolean;
shell?: string;
options?: (SshOption | `${SshOption}=${string}`)[];
};
export declare function ssh(host: string, options?: Options): RemoteShell;
export declare class Result extends String {
readonly source: string;
readonly stdout: string;
readonly stderr: string;
readonly exitCode: number | null;
readonly error?: Error;
constructor(source: string, exitCode: number | null, stdout: string, stderr: string, combined: string, error?: Error);
}
export type SshOption = 'AddKeysToAgent' | 'AddressFamily' | 'BatchMode' | 'BindAddress' | 'CanonicalDomains' | 'CanonicalizeFallbackLocal' | 'CanonicalizeHostname' | 'CanonicalizeMaxDots' | 'CanonicalizePermittedCNAMEs' | 'CASignatureAlgorithms' | 'CertificateFile' | 'ChallengeResponseAuthentication' | 'CheckHostIP' | 'Ciphers' | 'ClearAllForwardings' | 'Compression' | 'ConnectionAttempts' | 'ConnectTimeout' | 'ControlMaster' | 'ControlPath' | 'ControlPersist' | 'DynamicForward' | 'EscapeChar' | 'ExitOnForwardFailure' | 'FingerprintHash' | 'ForwardAgent' | 'ForwardX11' | 'ForwardX11Timeout' | 'ForwardX11Trusted' | 'GatewayPorts' | 'GlobalKnownHostsFile' | 'GSSAPIAuthentication' | 'GSSAPIDelegateCredentials' | 'HashKnownHosts' | 'Host' | 'HostbasedAcceptedAlgorithms' | 'HostbasedAuthentication' | 'HostKeyAlgorithms' | 'HostKeyAlias' | 'Hostname' | 'IdentitiesOnly' | 'IdentityAgent' | 'IdentityFile' | 'IPQoS' | 'KbdInteractiveAuthentication' | 'KbdInteractiveDevices' | 'KexAlgorithms' | 'KnownHostsCommand' | 'LocalCommand' | 'LocalForward' | 'LogLevel' | 'MACs' | 'Match' | 'NoHostAuthenticationForLocalhost' | 'NumberOfPasswordPrompts' | 'PasswordAuthentication' | 'PermitLocalCommand' | 'PermitRemoteOpen' | 'PKCS11Provider' | 'Port' | 'PreferredAuthentications' | 'ProxyCommand' | 'ProxyJump' | 'ProxyUseFdpass' | 'PubkeyAcceptedAlgorithms' | 'PubkeyAuthentication' | 'RekeyLimit' | 'RemoteCommand' | 'RemoteForward' | 'RequestTTY' | 'SendEnv' | 'ServerAliveInterval' | 'ServerAliveCountMax' | 'SetEnv' | 'StreamLocalBindMask' | 'StreamLocalBindUnlink' | 'StrictHostKeyChecking' | 'TCPKeepAlive' | 'Tunnel' | 'TunnelDevice' | 'UpdateHostKeys' | 'UseKeychain' | 'User' | 'UserKnownHostsFile' | 'VerifyHostKeyDNS' | 'VisualHostKey' | 'XAuthLocation';

79
node_modules/webpod/dist/ssh.js generated vendored Normal file

@ -0,0 +1,79 @@
import { spawn, spawnSync } from 'node:child_process';
import process from 'node:process';
import { controlPath, escapeshellarg } from './utils.js';
export function ssh(host, options = {}) {
const $ = function (pieces, ...values) {
const source = new Error().stack.split(/^\s*at\s/m)[2].trim();
if (pieces.some(p => p == undefined)) {
throw new Error(`Malformed command at ${source}`);
}
let cmd = pieces[0], i = 0;
while (i < values.length) {
let s;
if (Array.isArray(values[i])) {
s = values[i].map((x) => escapeshellarg(x)).join(' ');
}
else {
s = escapeshellarg(values[i]);
}
cmd += s + pieces[++i];
}
let resolve, reject;
const promise = new Promise((...args) => ([resolve, reject] = args));
const shellID = 'id$' + Math.random().toString(36).slice(2);
const args = [
host,
'-o', 'ControlMaster=auto',
'-o', 'ControlPath=' + controlPath(host),
'-o', 'ControlPersist=5m',
...(options.port ? ['-p', `${options.port}`] : []),
...(options.forwardAgent ? ['-A'] : []),
...(options.options || []).flatMap(x => ['-o', x]),
`: ${shellID}; ` + (options.shell || 'bash -ls')
];
if (process.env.WEBPOD_DEBUG) {
console.log('ssh', args.join(' '));
}
const child = spawn('ssh', args, {
stdio: ['pipe', 'pipe', 'pipe'],
windowsHide: true,
});
let stdout = '', stderr = '', combined = '';
const onStdout = (data) => {
stdout += data;
combined += data;
};
const onStderr = (data) => {
stderr += data;
combined += data;
};
child.stdout.on('data', onStdout);
child.stderr.on('data', onStderr);
child.on('close', (code) => {
if (code === 0) {
resolve(new Result(source, code, stdout, stderr, combined));
}
else {
reject(new Result(source, code, stdout, stderr, combined));
}
});
child.on('error', err => {
reject(new Result(source, null, stdout, stderr, combined, err));
});
child.stdin.write(cmd);
child.stdin.end();
return promise;
};
$.exit = () => spawnSync('ssh', [host, '-O', 'exit', '-o', `ControlPath=${controlPath(host)}`]);
return $;
}
export class Result extends String {
constructor(source, exitCode, stdout, stderr, combined, error) {
super(combined);
this.source = source;
this.stdout = stdout;
this.stderr = stderr;
this.exitCode = exitCode;
this.error = error;
}
}

3
node_modules/webpod/dist/utils.d.ts generated vendored Normal file

@ -0,0 +1,3 @@
export declare function isWritable(path: string): boolean;
export declare function controlPath(host: string): string;
export declare function escapeshellarg(arg: string): string;

35
node_modules/webpod/dist/utils.js generated vendored Normal file

@ -0,0 +1,35 @@
import fs from 'node:fs';
import os from 'node:os';
import process from 'node:process';
export function isWritable(path) {
try {
fs.accessSync(path, fs.constants.W_OK);
return true;
}
catch (err) {
return false;
}
}
export function controlPath(host) {
let c = 'ssh-' + host;
if ('CI' in process.env && isWritable('/dev/shm')) {
return `/dev/shm/${c}`;
}
return `${os.homedir()}/.ssh/${c}`;
}
export function escapeshellarg(arg) {
if (/^[a-z0-9/_.\-@:=]+$/i.test(arg) || arg === '') {
return arg;
}
return (`$'` +
arg
.replace(/\\/g, '\\\\')
.replace(/'/g, '\\\'')
.replace(/\f/g, '\\f')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/\t/g, '\\t')
.replace(/\v/g, '\\v')
.replace(/\0/g, '\\0') +
`'`);
}

2
node_modules/webpod/mod.ts generated vendored Normal file

@ -0,0 +1,2 @@
// @deno-types="./dist/index.d.ts"
export * from './dist/index.js'

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