From 363bb1be96888d08531d6a25382f7e95c5f4eb2a Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Tue, 28 Mar 2023 17:15:22 +0200 Subject: [PATCH] Update deps --- node_modules/.bin/node-which | 2 +- node_modules/.bin/webpod | 1 + node_modules/.package-lock.json | 92 +- node_modules/@types/fs-extra/README.md | 32 +- node_modules/@types/fs-extra/esm.d.mts | 111 ++ node_modules/@types/fs-extra/index.d.ts | 1438 +++++++++++------ node_modules/@types/fs-extra/package.json | 23 +- node_modules/@types/jsonfile/LICENSE | 21 + node_modules/@types/jsonfile/README.md | 16 + node_modules/@types/jsonfile/index.d.ts | 78 + node_modules/@types/jsonfile/package.json | 37 + node_modules/@types/jsonfile/utils.d.ts | 9 + node_modules/@types/node/README.md | 32 +- node_modules/@types/node/async_hooks.d.ts | 12 + node_modules/@types/node/buffer.d.ts | 68 +- node_modules/@types/node/crypto.d.ts | 21 +- .../@types/node/diagnostics_channel.d.ts | 39 + node_modules/@types/node/dns.d.ts | 2 +- node_modules/@types/node/fs.d.ts | 100 ++ node_modules/@types/node/fs/promises.d.ts | 21 + node_modules/@types/node/globals.d.ts | 2 +- node_modules/@types/node/http.d.ts | 7 + node_modules/@types/node/http2.d.ts | 1 - node_modules/@types/node/index.d.ts | 2 +- node_modules/@types/node/module.d.ts | 1 + node_modules/@types/node/net.d.ts | 14 + node_modules/@types/node/os.d.ts | 7 + node_modules/@types/node/package.json | 6 +- node_modules/@types/node/process.d.ts | 6 + node_modules/@types/node/stream.d.ts | 99 ++ node_modules/@types/node/test.d.ts | 380 ++++- node_modules/@types/node/timers.d.ts | 7 + node_modules/@types/node/tls.d.ts | 103 +- .../@types/node/ts4.8/async_hooks.d.ts | 12 + node_modules/@types/node/ts4.8/buffer.d.ts | 68 +- node_modules/@types/node/ts4.8/crypto.d.ts | 16 +- .../node/ts4.8/diagnostics_channel.d.ts | 41 +- node_modules/@types/node/ts4.8/dns.d.ts | 2 +- node_modules/@types/node/ts4.8/globals.d.ts | 2 +- node_modules/@types/node/ts4.8/http2.d.ts | 1 - node_modules/@types/node/ts4.8/module.d.ts | 1 + node_modules/@types/node/ts4.8/net.d.ts | 16 +- node_modules/@types/node/ts4.8/os.d.ts | 7 + node_modules/@types/node/ts4.8/process.d.ts | 6 + node_modules/@types/node/ts4.8/stream.d.ts | 99 ++ node_modules/@types/node/ts4.8/test.d.ts | 380 ++++- node_modules/@types/node/ts4.8/tls.d.ts | 103 +- node_modules/@types/node/ts4.8/util.d.ts | 85 + node_modules/@types/node/ts4.8/v8.d.ts | 51 + node_modules/@types/node/ts4.8/vm.d.ts | 157 +- node_modules/@types/node/util.d.ts | 85 + node_modules/@types/node/v8.d.ts | 51 + node_modules/@types/node/vm.d.ts | 157 +- node_modules/@types/which/README.md | 32 +- node_modules/@types/which/index.d.ts | 10 +- node_modules/@types/which/package.json | 6 +- node_modules/fs-extra/README.md | 34 +- node_modules/fs-extra/lib/copy/copy-sync.js | 14 +- node_modules/fs-extra/lib/copy/copy.js | 37 +- node_modules/fs-extra/lib/esm.mjs | 68 + node_modules/fs-extra/lib/fs/index.js | 50 +- node_modules/fs-extra/lib/move/move-sync.js | 3 +- node_modules/fs-extra/lib/move/move.js | 3 +- node_modules/fs-extra/lib/remove/index.js | 9 +- node_modules/fs-extra/lib/remove/rimraf.js | 302 ---- node_modules/fs-extra/package.json | 18 +- node_modules/graceful-fs/package.json | 9 +- node_modules/graceful-fs/polyfills.js | 2 +- node_modules/minimist/.eslintrc | 75 +- node_modules/minimist/CHANGELOG.md | 88 +- node_modules/minimist/README.md | 24 +- node_modules/minimist/example/parse.js | 2 + node_modules/minimist/index.js | 484 +++--- node_modules/minimist/package.json | 146 +- node_modules/minimist/test/all_bool.js | 50 +- node_modules/minimist/test/bool.js | 281 ++-- node_modules/minimist/test/dash.js | 54 +- node_modules/minimist/test/default_bool.js | 50 +- node_modules/minimist/test/dotted.js | 24 +- node_modules/minimist/test/kv_short.js | 36 +- node_modules/minimist/test/long.js | 54 +- node_modules/minimist/test/num.js | 58 +- node_modules/minimist/test/parse.js | 318 ++-- node_modules/minimist/test/parse_modified.js | 12 +- node_modules/minimist/test/proto.js | 78 +- node_modules/minimist/test/short.js | 112 +- node_modules/minimist/test/stop_early.js | 18 +- node_modules/minimist/test/unknown.js | 164 +- node_modules/minimist/test/whitespace.js | 10 +- node_modules/webpod/LICENSE | 21 + node_modules/webpod/README.md | 34 + node_modules/webpod/dist/cli.d.ts | 1 + node_modules/webpod/dist/cli.js | 1 + node_modules/webpod/dist/index.d.ts | 1 + node_modules/webpod/dist/index.js | 1 + node_modules/webpod/dist/ssh.d.ts | 19 + node_modules/webpod/dist/ssh.js | 79 + node_modules/webpod/dist/utils.d.ts | 3 + node_modules/webpod/dist/utils.js | 35 + node_modules/webpod/mod.ts | 2 + node_modules/webpod/package.json | 25 + node_modules/webpod/src/index.ts | 1 + node_modules/webpod/src/ssh.ts | 188 +++ node_modules/webpod/src/utils.ts | 39 + node_modules/webpod/tsconfig.json | 16 + node_modules/which/CHANGELOG.md | 166 -- node_modules/which/README.md | 22 +- node_modules/which/bin/node-which | 52 - node_modules/which/bin/which.js | 52 + node_modules/which/lib/index.js | 110 ++ node_modules/which/package.json | 45 +- node_modules/which/which.js | 125 -- node_modules/zx/README.md | 145 +- node_modules/zx/build/cli.js | 19 +- node_modules/zx/build/core.d.ts | 10 +- node_modules/zx/build/experimental.d.ts | 7 +- node_modules/zx/build/experimental.js | 83 +- node_modules/zx/build/globals.d.ts | 4 + node_modules/zx/build/goods.d.ts | 6 + node_modules/zx/build/goods.js | 81 +- node_modules/zx/build/index.d.ts | 4 +- node_modules/zx/build/index.js | 4 +- node_modules/zx/build/util.d.ts | 2 +- node_modules/zx/package.json | 33 +- package-lock.json | 177 +- package.json | 2 +- 126 files changed, 5743 insertions(+), 2737 deletions(-) create mode 120000 node_modules/.bin/webpod create mode 100755 node_modules/@types/fs-extra/esm.d.mts create mode 100755 node_modules/@types/jsonfile/LICENSE create mode 100755 node_modules/@types/jsonfile/README.md create mode 100755 node_modules/@types/jsonfile/index.d.ts create mode 100755 node_modules/@types/jsonfile/package.json create mode 100755 node_modules/@types/jsonfile/utils.d.ts create mode 100644 node_modules/fs-extra/lib/esm.mjs delete mode 100644 node_modules/fs-extra/lib/remove/rimraf.js create mode 100644 node_modules/webpod/LICENSE create mode 100644 node_modules/webpod/README.md create mode 100644 node_modules/webpod/dist/cli.d.ts create mode 100644 node_modules/webpod/dist/cli.js create mode 100644 node_modules/webpod/dist/index.d.ts create mode 100755 node_modules/webpod/dist/index.js create mode 100644 node_modules/webpod/dist/ssh.d.ts create mode 100644 node_modules/webpod/dist/ssh.js create mode 100644 node_modules/webpod/dist/utils.d.ts create mode 100644 node_modules/webpod/dist/utils.js create mode 100644 node_modules/webpod/mod.ts create mode 100644 node_modules/webpod/package.json create mode 100644 node_modules/webpod/src/index.ts create mode 100644 node_modules/webpod/src/ssh.ts create mode 100644 node_modules/webpod/src/utils.ts create mode 100644 node_modules/webpod/tsconfig.json delete mode 100644 node_modules/which/CHANGELOG.md delete mode 100755 node_modules/which/bin/node-which create mode 100755 node_modules/which/bin/which.js create mode 100644 node_modules/which/lib/index.js delete mode 100644 node_modules/which/which.js diff --git a/node_modules/.bin/node-which b/node_modules/.bin/node-which index 6f8415e..c4a428a 120000 --- a/node_modules/.bin/node-which +++ b/node_modules/.bin/node-which @@ -1 +1 @@ -../which/bin/node-which \ No newline at end of file +../which/bin/which.js \ No newline at end of file diff --git a/node_modules/.bin/webpod b/node_modules/.bin/webpod new file mode 120000 index 0000000..49aa5a4 --- /dev/null +++ b/node_modules/.bin/webpod @@ -0,0 +1 @@ +../webpod/dist/index.js \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 6c29d56..0233baf 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -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" diff --git a/node_modules/@types/fs-extra/README.md b/node_modules/@types/fs-extra/README.md index 76b4b7b..6c34d79 100755 --- a/node_modules/@types/fs-extra/README.md +++ b/node_modules/@types/fs-extra/README.md @@ -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). diff --git a/node_modules/@types/fs-extra/esm.d.mts b/node_modules/@types/fs-extra/esm.d.mts new file mode 100755 index 0000000..e16f0c8 --- /dev/null +++ b/node_modules/@types/fs-extra/esm.d.mts @@ -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; diff --git a/node_modules/@types/fs-extra/index.d.ts b/node_modules/@types/fs-extra/index.d.ts index 4daa564..a5f2992 100755 --- a/node_modules/@types/fs-extra/index.d.ts +++ b/node_modules/@types/fs-extra/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for fs-extra 9.0 +// Type definitions for fs-extra 11.0 // Project: https://github.com/jprichardson/node-fs-extra // Definitions by: Alan Agius , // midknight41 , @@ -9,555 +9,1001 @@ // Florian Keller // Piotr Błażejewicz // Tiger Oakes +// BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Minimum TypeScript Version: 3.9 +// Minimum TypeScript Version: 4.5 /// import * as fs from 'fs'; -import Stats = fs.Stats; -import PathLike = fs.PathLike; +import * as jsonfile from 'jsonfile'; +import { StringifyOptions } from 'jsonfile/utils'; export * from 'fs'; +/** + * Copy a file or directory. The directory can have contents. + * + * @param src Note that if `src` is a directory it will copy everything inside of this directory, + * not the entire directory itself (see [issue #537](https://github.com/jprichardson/node-fs-extra/issues/537)). + * @param dest Note that if `src` is a file, `dest` cannot be a directory + * (see [issue #323](https://github.com/jprichardson/node-fs-extra/issues/323)). + * + * @example + * import * as fs from 'fs-extra' + * + * // With a callback: + * fs.copy('/tmp/myfile', '/tmp/mynewfile', err => { + * if (err) return console.error(err) + * console.log('success!') + * }) // copies file + * + * fs.copy('/tmp/mydir', '/tmp/mynewdir', err => { + * if (err) return console.error(err) + * console.log('success!') + * }) // copies directory, even if it has subdirectories or files + * + * // With Promises: + * fs.copy('/tmp/myfile', '/tmp/mynewfile') + * .then(() => { + * console.log('success!') + * }) + * .catch(err => { + * console.error(err) + * }) + * + * // With async/await: + * async function asyncAwait () { + * try { + * await fs.copy('/tmp/myfile', '/tmp/mynewfile') + * console.log('success!') + * } catch (err) { + * console.error(err) + * } + * } + * + * asyncAwait() + * + * // Using filter function + * fs.copy( + * '/tmp/mydir', + * '/tmp/mynewdir', + * { + * filter(src, dest) { + * // your logic here + * // it will be copied if return true + * } + * }, + * err => { + * if (err) return console.error(err) + * console.log('success!') + * } + * ) + */ export function copy(src: string, dest: string, options?: CopyOptions): Promise; -export function copy(src: string, dest: string, callback: (err: Error) => void): void; -export function copy(src: string, dest: string, options: CopyOptions, callback: (err: Error) => void): void; +export function copy(src: string, dest: string, callback: NoParamCallbackWithUndefined): void; +export function copy(src: string, dest: string, options: CopyOptions, callback: NoParamCallbackWithUndefined): void; +/** + * Copy a file or directory. The directory can have contents. + * + * @param src Note that if `src` is a directory it will copy everything inside of this directory, + * not the entire directory itself (see [issue #537](https://github.com/jprichardson/node-fs-extra/issues/537)). + * @param dest Note that if `src` is a file, `dest` cannot be a directory + * (see [issue #323](https://github.com/jprichardson/node-fs-extra/issues/323)). + * + * @example + * import * as fs from 'fs-extra' + * + * // copy file + * fs.copySync('/tmp/myfile', '/tmp/mynewfile') + * + * // copy directory, even if it has subdirectories or files + * fs.copySync('/tmp/mydir', '/tmp/mynewdir') + * + * // Using filter function + * fs.copySync('/tmp/mydir', '/tmp/mynewdir', { + * filter(src, dest) { + * // your logic here + * // it will be copied if return true + * } + * }) + */ export function copySync(src: string, dest: string, options?: CopyOptionsSync): void; -export function copyFile(src: string, dest: string, flags?: number): Promise; -export function copyFile(src: string, dest: string, callback: (err: Error) => void): void; -export function copyFile(src: string, dest: string, flags: number, callback: (err: Error) => void): void; - +/** + * Moves a file or directory, even across devices. + * + * @param dest Note: When `src` is a file, `dest` must be a file and when `src` is a directory, `dest` must be a directory. + * + * @example + * import * as fs from 'fs-extra' + * + * const src = '/tmp/file.txt' + * const dest = '/tmp/this/path/does/not/exist/file.txt' + * + * // With a callback: + * fs.move(src, dest, err => { + * if (err) return console.error(err) + * console.log('success!') + * }) + * + * // With Promises: + * fs.move(src, dest) + * .then(() => { + * console.log('success!') + * }) + * .catch(err => { + * console.error(err) + * }) + * + * // With async/await: + * async function asyncAwait () { + * try { + * await fs.move(src, dest) + * console.log('success!') + * } catch (err) { + * console.error(err) + * } + * } + * + * asyncAwait() + * + * // Using `overwrite` option + * fs.move('/tmp/somedir', '/tmp/may/already/exist/somedir', { overwrite: true }, err => { + * if (err) return console.error(err) + * console.log('success!') + * }) + */ export function move(src: string, dest: string, options?: MoveOptions): Promise; -export function move(src: string, dest: string, callback: (err: Error) => void): void; -export function move(src: string, dest: string, options: MoveOptions, callback: (err: Error) => void): void; +export function move(src: string, dest: string, callback: NoParamCallbackWithUndefined): void; +export function move(src: string, dest: string, options: MoveOptions, callback: NoParamCallbackWithUndefined): void; +/** + * Moves a file or directory, even across devices. + * + * @param dest Note: When `src` is a file, `dest` must be a file and when `src` is a directory, `dest` must be a directory. + * + * @example + * import * as fs from 'fs-extra' + * + * fs.moveSync('/tmp/somefile', '/tmp/does/not/exist/yet/somefile') + * + * // Using `overwrite` option + * fs.moveSync('/tmp/somedir', '/tmp/may/already/exist/somedir', { overwrite: true }) + */ export function moveSync(src: string, dest: string, options?: MoveOptions): void; -export function createFile(file: string): Promise; -export function createFile(file: string, callback: (err: Error) => void): void; -export function createFileSync(file: string): void; - -export function createSymlink(src: string, dest: string, type: SymlinkType): Promise; -export function createSymlink(src: string, dest: string, type: SymlinkType, callback?: (err: Error) => void): void; -export function createSymlinkSync(src: string, dest: string, type: SymlinkType): void; - -export function ensureDir(path: string, options?: EnsureOptions | number): Promise; -export function ensureDir(path: string, callback?: (err: Error) => void): void; -export function ensureDir(path: string, options?: EnsureOptions | number, callback?: (err: Error) => void): void; -export function ensureDirSync(path: string, options?: EnsureOptions | number): void; - -export function mkdirs(dir: string): Promise; -export function mkdirs(dir: string, callback: (err: Error) => void): void; -export function mkdirp(dir: string): Promise; -export function mkdirp(dir: string, callback: (err: Error) => void): void; -export function mkdirsSync(dir: string): void; -export function mkdirpSync(dir: string): void; - -export function outputFile( - file: string, - data: any, - options?: WriteFileOptions | BufferEncoding | string, -): Promise; -export function outputFile(file: string, data: any, callback: (err: Error) => void): void; -export function outputFile( - file: string, - data: any, - options: WriteFileOptions | string, - callback: (err: Error) => void, -): void; -export function outputFileSync(file: string, data: any, options?: WriteFileOptions | BufferEncoding | string): void; - -export function readJson(file: string, options?: ReadOptions | BufferEncoding | string): Promise; -export function readJson(file: string, callback: (err: Error, jsonObject: any) => void): void; -export function readJson( - file: string, - options: ReadOptions | BufferEncoding | string, - callback: (err: Error, jsonObject: any) => void, -): void; -export function readJSON(file: string, options?: ReadOptions | BufferEncoding | string): Promise; -export function readJSON(file: string, callback: (err: Error, jsonObject: any) => void): void; -export function readJSON( - file: string, - options: ReadOptions | BufferEncoding | string, - callback: (err: Error, jsonObject: any) => void, -): void; - -export function readJsonSync(file: string, options?: ReadOptions | BufferEncoding | string): any; -export function readJSONSync(file: string, options?: ReadOptions | BufferEncoding | string): any; - -export function remove(dir: string, callback: (err: Error) => void): void; -export function remove(dir: string, callback?: (err: Error) => void): Promise; -export function removeSync(dir: string): void; - -export function outputJSON(file: string, data: any, options?: WriteOptions | BufferEncoding | string): Promise; -export function outputJSON( - file: string, - data: any, - options: WriteOptions | BufferEncoding | string, - callback: (err: Error) => void, -): void; -export function outputJSON(file: string, data: any, callback: (err: Error) => void): void; -export function outputJson(file: string, data: any, options?: WriteOptions | BufferEncoding | string): Promise; -export function outputJson( - file: string, - data: any, - options: WriteOptions | BufferEncoding | string, - callback: (err: Error) => void, -): void; -export function outputJson(file: string, data: any, callback: (err: Error) => void): void; -export function outputJsonSync(file: string, data: any, options?: WriteOptions | BufferEncoding | string): void; -export function outputJSONSync(file: string, data: any, options?: WriteOptions | BufferEncoding | string): void; - -export function writeJSON(file: string, object: any, options?: WriteOptions | BufferEncoding | string): Promise; -export function writeJSON(file: string, object: any, callback: (err: Error) => void): void; -export function writeJSON( - file: string, - object: any, - options: WriteOptions | BufferEncoding | string, - callback: (err: Error) => void, -): void; -export function writeJson(file: string, object: any, options?: WriteOptions | BufferEncoding | string): Promise; -export function writeJson(file: string, object: any, callback: (err: Error) => void): void; -export function writeJson( - file: string, - object: any, - options: WriteOptions | BufferEncoding | string, - callback: (err: Error) => void, -): void; - -export function writeJsonSync(file: string, object: any, options?: WriteOptions | BufferEncoding | string): void; -export function writeJSONSync(file: string, object: any, options?: WriteOptions | BufferEncoding | string): void; - -export function ensureFile(path: string): Promise; -export function ensureFile(path: string, callback: (err: Error) => void): void; -export function ensureFileSync(path: string): void; +/** + * Ensures that the file exists. If the file that is requested to be created is in + * directories that do not exist, these directories are created. If the file already + * exists, it is **NOT MODIFIED**. + * + * @example + * import * as fs from 'fs-extra' + * + * const file = '/tmp/this/path/does/not/exist/file.txt' + * + * // With a callback: + * fs.ensureFile(file, err => { + * console.log(err) // => null + * // file has now been created, including the directory it is to be placed in + * }) + * + * // With Promises: + * fs.ensureFile(file) + * .then(() => { + * console.log('success!') + * }) + * .catch(err => { + * console.error(err) + * }) + * + * // With async/await: + * async function asyncAwait () { + * try { + * await fs.ensureFile(file) + * console.log('success!') + * } catch (err) { + * console.error(err) + * } + * } + * + * asyncAwait() + */ +export function ensureFile(file: string): Promise; +export function ensureFile(file: string, callback: NoParamCallbackWithUndefined): void; +/** + * @see ensureFile + */ +export const createFile: typeof ensureFile; +/** + * Ensures that the file exists. If the file that is requested to be created is in + * directories that do not exist, these directories are created. If the file already + * exists, it is **NOT MODIFIED**. + * + * @example + * import * as fs from 'fs-extra' + * + * const file = '/tmp/this/path/does/not/exist/file.txt' + * fs.ensureFileSync(file) + * // file has now been created, including the directory it is to be placed in + */ +export function ensureFileSync(file: string): void; +/** + * @see ensureFileSync + */ +export const createFileSync: typeof ensureFileSync; +/** + * Ensures that the link exists. If the directory structure does not exist, it is created. + * + * @example + * import * as fs from 'fs-extra' + * + * const srcPath = '/tmp/file.txt' + * const destPath = '/tmp/this/path/does/not/exist/file.txt' + * + * // With a callback: + * fs.ensureLink(srcPath, destPath, err => { + * console.log(err) // => null + * // link has now been created, including the directory it is to be placed in + * }) + * + * // With Promises: + * fs.ensureLink(srcPath, destPath) + * .then(() => { + * console.log('success!') + * }) + * .catch(err => { + * console.error(err) + * }) + * + * // With async/await: + * async function asyncAwait () { + * try { + * await fs.ensureLink(srcPath, destPath) + * console.log('success!') + * } catch (err) { + * console.error(err) + * } + * } + * + * asyncAwait() + */ export function ensureLink(src: string, dest: string): Promise; -export function ensureLink(src: string, dest: string, callback: (err: Error) => void): void; -// alias for ensureLink +export function ensureLink(src: string, dest: string, callback: fs.NoParamCallback): void; +/** + * @see ensureLink + */ export const createLink: typeof ensureLink; +/** + * Ensures that the link exists. If the directory structure does not exist, it is created. + * + * @example + * import * as fs from 'fs-extra' + * + * const srcPath = '/tmp/file.txt' + * const destPath = '/tmp/this/path/does/not/exist/file.txt' + * fs.ensureLinkSync(srcPath, destPath) + * // link has now been created, including the directory it is to be placed in + */ export function ensureLinkSync(src: string, dest: string): void; -// aliased as +/** + * @see ensureLinkSync + */ export const createLinkSync: typeof ensureLinkSync; +/** + * Ensures that the symlink exists. If the directory structure does not exist, it is created. + * + * @param type It is only available on Windows and ignored on other platforms. + * + * @example + * import * as fs from 'fs-extra' + * + * const srcPath = '/tmp/file.txt' + * const destPath = '/tmp/this/path/does/not/exist/file.txt' + * + * // With a callback: + * fs.ensureSymlink(srcPath, destPath, err => { + * console.log(err) // => null + * // symlink has now been created, including the directory it is to be placed in + * }) + * + * // With Promises: + * fs.ensureSymlink(srcPath, destPath) + * .then(() => { + * console.log('success!') + * }) + * .catch(err => { + * console.error(err) + * }) + * + * // With async/await: + * async function asyncAwait () { + * try { + * await fs.ensureSymlink(srcPath, destPath) + * console.log('success!') + * } catch (err) { + * console.error(err) + * } + * } + * + * asyncAwait() + */ export function ensureSymlink(src: string, dest: string, type?: SymlinkType): Promise; -export function ensureSymlink(src: string, dest: string, type: SymlinkType, callback: (err: Error) => void): void; -export function ensureSymlink(src: string, dest: string, callback: (err: Error) => void): void; +export function ensureSymlink(src: string, dest: string, callback: fs.NoParamCallback): void; +export function ensureSymlink(src: string, dest: string, type: SymlinkType, callback: fs.NoParamCallback): void; +/** + * @see ensureSymlink + */ +export const createSymlink: typeof ensureSymlink; +/** + * Ensures that the symlink exists. If the directory structure does not exist, it is created. + * + * @param type It is only available on Windows and ignored on other platforms. + * + * @example + * import * as fs from 'fs-extra' + * + * const srcPath = '/tmp/file.txt' + * const destPath = '/tmp/this/path/does/not/exist/file.txt' + * fs.ensureSymlinkSync(srcPath, destPath) + * // symlink has now been created, including the directory it is to be placed in + */ export function ensureSymlinkSync(src: string, dest: string, type?: SymlinkType): void; +/** + * @see ensureSymlinkSync + */ +export const createSymlinkSync: typeof ensureSymlinkSync; +/** + * Ensures that the directory exists. If the directory structure does not exist, it is created. + * + * @example + * import * as fs from 'fs-extra' + * + * const dir = '/tmp/this/path/does/not/exist' + * const desiredMode = 0o2775 + * const options = { + * mode: 0o2775 + * } + * + * // With a callback: + * fs.ensureDir(dir, err => { + * console.log(err) // => null + * // dir has now been created, including the directory it is to be placed in + * }) + * + * // With a callback and a mode integer + * fs.ensureDir(dir, desiredMode, err => { + * console.log(err) // => null + * // dir has now been created with mode 0o2775, including the directory it is to be placed in + * }) + * + * // With Promises: + * fs.ensureDir(dir) + * .then(() => { + * console.log('success!') + * }) + * .catch(err => { + * console.error(err) + * }) + * + * // With Promises and a mode integer: + * fs.ensureDir(dir, desiredMode) + * .then(() => { + * console.log('success!') + * }) + * .catch(err => { + * console.error(err) + * }) + * + * // With async/await: + * async function asyncAwait () { + * try { + * await fs.ensureDir(dir) + * console.log('success!') + * } catch (err) { + * console.error(err) + * } + * } + * asyncAwait() + * + * // With async/await and an options object, containing mode: + * async function asyncAwaitMode () { + * try { + * await fs.ensureDir(dir, options) + * console.log('success!') + * } catch (err) { + * console.error(err) + * } + * } + * asyncAwaitMode() + */ +export function ensureDir(path: string, options?: EnsureDirOptions | number): Promise; +export function ensureDir(path: string, callback: fs.NoParamCallback): void; +export function ensureDir(path: string, options: EnsureDirOptions | number, callback: fs.NoParamCallback): void; +/** + * Ensures that the directory exists. If the directory structure does not exist, it is created. + * If provided, options may specify the desired mode for the directory. + * + * @example + * import * as fs from 'fs-extra' + * + * const dir = '/tmp/this/path/does/not/exist' + * + * const desiredMode = 0o2775 + * const options = { + * mode: 0o2775 + * } + * + * fs.ensureDirSync(dir) + * // dir has now been created, including the directory it is to be placed in + * + * fs.ensureDirSync(dir, desiredMode) + * // dir has now been created, including the directory it is to be placed in with permission 0o2775 + * + * fs.ensureDirSync(dir, options) + * // dir has now been created, including the directory it is to be placed in with permission 0o2775 + */ +export function ensureDirSync(path: string, options?: EnsureDirOptions | number): void; + +/** + * @see ensureDir + */ +export const mkdirs: typeof ensureDir; +/** + * @see ensureDirSync + */ +export const mkdirsSync: typeof ensureDirSync; + +/** + * @see ensureDir + */ +export const mkdirp: typeof ensureDir; +/** + * @see ensureDirSync + */ +export const mkdirpSync: typeof ensureDirSync; + +/** + * Almost the same as `writeFile` (i.e. it overwrites), except that if the parent directory + * does not exist, it's created. + * + * @example + * import * as fs from 'fs-extra' + * + * const file = '/tmp/this/path/does/not/exist/file.txt' + * + * // With a callback: + * fs.outputFile(file, 'hello!', err => { + * console.log(err) // => null + * + * fs.readFile(file, 'utf8', (err, data) => { + * if (err) return console.error(err) + * console.log(data) // => hello! + * }) + * }) + * + * // With Promises: + * fs.outputFile(file, 'hello!') + * .then(() => fs.readFile(file, 'utf8')) + * .then(data => { + * console.log(data) // => hello! + * }) + * .catch(err => { + * console.error(err) + * }) + * + * // With async/await: + * async function asyncAwait () { + * try { + * await fs.outputFile(file, 'hello!') + * + * const data = await fs.readFile(file, 'utf8') + * + * console.log(data) // => hello! + * } catch (err) { + * console.error(err) + * } + * } + * + * asyncAwait() + */ +export function outputFile( + file: string, + data: string | NodeJS.ArrayBufferView, + options?: fs.WriteFileOptions, +): Promise; +export function outputFile(file: string, data: string | NodeJS.ArrayBufferView, callback: fs.NoParamCallback): void; +export function outputFile( + file: string, + data: string | NodeJS.ArrayBufferView, + options: fs.WriteFileOptions, + callback: fs.NoParamCallback, +): void; +/** + * Almost the same as `writeFileSync` (i.e. it overwrites), except that if the parent directory + * does not exist, it's created. + * + * @example + * import * as fs from 'fs-extra' + * + * const file = '/tmp/this/path/does/not/exist/file.txt' + * fs.outputFileSync(file, 'hello!') + * + * const data = fs.readFileSync(file, 'utf8') + * console.log(data) // => hello! + */ +export function outputFileSync( + file: string, + data: string | NodeJS.ArrayBufferView, + options?: fs.WriteFileOptions, +): void; + +/** + * Reads a JSON file and then parses it into an object. + * + * @example + * import * as fs from 'fs-extra' + * + * // With a callback: + * fs.readJson('./package.json', (err, packageObj) => { + * if (err) console.error(err) + * console.log(packageObj.version) // => 0.1.3 + * }) + * + * // With Promises: + * fs.readJson('./package.json') + * .then(packageObj => { + * console.log(packageObj.version) // => 0.1.3 + * }) + * .catch(err => { + * console.error(err) + * }) + * + * // With async/await: + * async function asyncAwait () { + * try { + * const packageObj = await fs.readJson('./package.json') + * console.log(packageObj.version) // => 0.1.3 + * } catch (err) { + * console.error(err) + * } + * } + * + * asyncAwait() + * + * // `readJsonSync()` can take a `throws` option set to `false` and it won't throw if the JSON is invalid. Example: + * const file = '/tmp/some-invalid.json' + * const data = '{not valid JSON' + * fs.writeFileSync(file, data) + * + * // With a callback: + * fs.readJson(file, { throws: false }, (err, obj) => { + * if (err) console.error(err) + * console.log(obj) // => null + * }) + * + * // With Promises: + * fs.readJson(file, { throws: false }) + * .then(obj => { + * console.log(obj) // => null + * }) + * .catch(err => { + * console.error(err) // Not called + * }) + * + * // With async/await: + * async function asyncAwaitThrows () { + * const obj = await fs.readJson(file, { throws: false }) + * console.log(obj) // => null + * } + * + * asyncAwaitThrows() + */ +export const readJson: typeof jsonfile.readFile; +/** + * @see readJson + */ +export const readJSON: typeof jsonfile.readFile; +/** + * Reads a JSON file and then parses it into an object. + * + * @example + * import * as fs from 'fs-extra' + * + * const packageObj = fs.readJsonSync('./package.json') + * console.log(packageObj.version) // => 2.0.0 + * + * // `readJsonSync()` can take a `throws` option set to `false` and it won't throw if the JSON is invalid. Example: + * const file = '/tmp/some-invalid.json' + * const data = '{not valid JSON' + * fs.writeFileSync(file, data) + * + * const obj = fs.readJsonSync(file, { throws: false }) + * console.log(obj) // => null + */ +export const readJsonSync: typeof jsonfile.readFileSync; +/** + * @see readJsonSync + */ +export const readJSONSync: typeof jsonfile.readFileSync; + +/** + * Writes an object to a JSON file. + * + * @example + * import * as fs from 'fs-extra' + * + * // With a callback: + * fs.writeJson('./package.json', {name: 'fs-extra'}, err => { + * if (err) return console.error(err) + * console.log('success!') + * }) + * + * // With Promises: + * fs.writeJson('./package.json', {name: 'fs-extra'}) + * .then(() => { + * console.log('success!') + * }) + * .catch(err => { + * console.error(err) + * }) + * + * // With async/await: + * async function asyncAwait () { + * try { + * await fs.writeJson('./package.json', {name: 'fs-extra'}) + * console.log('success!') + * } catch (err) { + * console.error(err) + * } + * } + * + * asyncAwait() + */ +export const writeJson: typeof jsonfile.writeFile; +/** + * @see writeJson + */ +export const writeJSON: typeof jsonfile.writeFile; +/** + * Writes an object to a JSON file. + * + * @example + * import * as fs from 'fs-extra' + * + * fs.writeJsonSync('./package.json', {name: 'fs-extra'}) + */ +export const writeJsonSync: typeof jsonfile.writeFileSync; +/** + * @see writeJsonSync + */ +export const writeJSONSync: typeof jsonfile.writeFileSync; + +/** + * Almost the same as `writeJson`, except that if the directory does not exist, it's created. + * + * @example + * import * as fs from 'fs-extra' + * + * const file = '/tmp/this/path/does/not/exist/file.json' + * + * // With a callback: + * fs.outputJson(file, {name: 'JP'}, err => { + * console.log(err) // => null + * + * fs.readJson(file, (err, data) => { + * if (err) return console.error(err) + * console.log(data.name) // => JP + * }) + * }) + * + * // With Promises: + * fs.outputJson(file, {name: 'JP'}) + * .then(() => fs.readJson(file)) + * .then(data => { + * console.log(data.name) // => JP + * }) + * .catch(err => { + * console.error(err) + * }) + * + * // With async/await: + * async function asyncAwait () { + * try { + * await fs.outputJson(file, {name: 'JP'}) + * + * const data = await fs.readJson(file) + * + * console.log(data.name) // => JP + * } catch (err) { + * console.error(err) + * } + * } + * + * asyncAwait() + */ +export function outputJson(file: string, data: any, options?: JsonOutputOptions): Promise; +export function outputJson(file: string, data: any, options: JsonOutputOptions, callback: fs.NoParamCallback): void; +export function outputJson(file: string, data: any, callback: fs.NoParamCallback): void; +/** + * @see outputJson + */ +export const outputJSON: typeof outputJson; +/** + * Almost the same as `writeJsonSync`, except that if the directory does not exist, it's created. + * + * @example + * import * as fs from 'fs-extra' + * + * const file = '/tmp/this/path/does/not/exist/file.json' + * fs.outputJsonSync(file, {name: 'JP'}) + * + * const data = fs.readJsonSync(file) + * console.log(data.name) // => JP + */ +export function outputJsonSync(file: string, data: any, options?: JsonOutputOptions): void; +/** + * @see outputJsonSync + */ +export const outputJSONSync: typeof outputJsonSync; + +/** + * Removes a file or directory. The directory can have contents. If the path does not exist, silently does nothing. + * + * @example + * import * as fs from 'fs-extra' + * + * // remove file + * // With a callback: + * fs.remove('/tmp/myfile', err => { + * if (err) return console.error(err) + * console.log('success!') + * }) + * + * fs.remove('/home/jprichardson', err => { + * if (err) return console.error(err) + * console.log('success!') // I just deleted my entire HOME directory. + * }) + * + * // With Promises: + * fs.remove('/tmp/myfile') + * .then(() => { + * console.log('success!') + * }) + * .catch(err => { + * console.error(err) + * }) + * + * // With async/await: + * async function asyncAwait () { + * try { + * await fs.remove('/tmp/myfile') + * console.log('success!') + * } catch (err) { + * console.error(err) + * } + * } + * + * asyncAwait() + */ +export function remove(dir: string): Promise; +export function remove(dir: string, callback: fs.NoParamCallback): void; +/** + * Removes a file or directory. The directory can have contents. If the path does not exist, silently does nothing. + * + * @example + * import * as fs from 'fs-extra' + * + * // remove file + * fs.removeSync('/tmp/myfile') + * + * fs.removeSync('/home/jprichardson') // I just deleted my entire HOME directory. + */ +export function removeSync(dir: string): void; + +/** + * Ensures that a directory is empty. Deletes directory contents if the directory is not empty. + * If the directory does not exist, it is created. The directory itself is not deleted. + * + * @example + * import * as fs from 'fs-extra' + * + * // assume this directory has a lot of files and folders + * // With a callback: + * fs.emptyDir('/tmp/some/dir', err => { + * if (err) return console.error(err) + * console.log('success!') + * }) + * + * // With Promises: + * fs.emptyDir('/tmp/some/dir') + * .then(() => { + * console.log('success!') + * }) + * .catch(err => { + * console.error(err) + * }) + * + * // With async/await: + * async function asyncAwait () { + * try { + * await fs.emptyDir('/tmp/some/dir') + * console.log('success!') + * } catch (err) { + * console.error(err) + * } + * } + * + * asyncAwait() + */ export function emptyDir(path: string): Promise; -export function emptyDir(path: string, callback: (err: Error) => void): void; +export function emptyDir(path: string, callback: fs.NoParamCallback): void; +/** + * @see emptyDir + */ export const emptydir: typeof emptyDir; - +/** + * Ensures that a directory is empty. Deletes directory contents if the directory is not empty. + * If the directory does not exist, it is created. The directory itself is not deleted. + * + * @example + * import * as fs from 'fs-extra' + * + * // assume this directory has a lot of files and folders + * fs.emptyDirSync('/tmp/some/dir') + */ export function emptyDirSync(path: string): void; +/** + * @see emptyDirSync + */ export const emptydirSync: typeof emptyDirSync; +/** + * Test whether or not the given path exists by checking with the file system. Like + * [`fs.exists`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback), but with a normal + * callback signature (err, exists). Uses `fs.access` under the hood. + * + * @example + * import * as fs from 'fs-extra' + * + * const file = '/tmp/this/path/does/not/exist/file.txt' + * + * // With a callback: + * fs.pathExists(file, (err, exists) => { + * console.log(err) // => null + * console.log(exists) // => false + * }) + * + * // Promise usage: + * fs.pathExists(file) + * .then(exists => console.log(exists)) // => false + * + * // With async/await: + * async function asyncAwait () { + * const exists = await fs.pathExists(file) + * + * console.log(exists) // => false + * } + * + * asyncAwait() + */ export function pathExists(path: string): Promise; -export function pathExists(path: string, callback: (err: Error, exists: boolean) => void): void; +export function pathExists(path: string, callback: (err: NodeJS.ErrnoException | null, exists: boolean) => void): void; +/** + * An alias for [`fs.existsSync`](https://nodejs.org/api/fs.html#fs_fs_existssync_path), created for + * consistency with `pathExists`. + */ export function pathExistsSync(path: string): boolean; -// fs async methods -// copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v6/index.d.ts +export const access: typeof fs.access.__promisify__ & typeof fs.access; +export const appendFile: typeof fs.appendFile.__promisify__ & typeof fs.appendFile; +export const chmod: typeof fs.chmod.__promisify__ & typeof fs.chmod; +export const chown: typeof fs.chown.__promisify__ & typeof fs.chown; +export const close: typeof fs.close.__promisify__ & typeof fs.close; +export const copyFile: typeof fs.copyFile.__promisify__ & typeof fs.copyFile; +export const exists: typeof fs.exists.__promisify__ & typeof fs.exists; +export const fchmod: typeof fs.fchmod.__promisify__ & typeof fs.fchmod; +export const fchown: typeof fs.fchown.__promisify__ & typeof fs.fchown; +export const fdatasync: typeof fs.fdatasync.__promisify__ & typeof fs.fdatasync; +export const fstat: typeof fs.fstat.__promisify__ & typeof fs.fstat; +export const fsync: typeof fs.fsync.__promisify__ & typeof fs.fsync; +export const ftruncate: typeof fs.ftruncate.__promisify__ & typeof fs.ftruncate; +export const futimes: typeof fs.futimes.__promisify__ & typeof fs.futimes; +export const lchmod: typeof fs.lchmod.__promisify__ & typeof fs.lchmod; +export const lchown: typeof fs.lchown.__promisify__ & typeof fs.lchown; +export const link: typeof fs.link.__promisify__ & typeof fs.link; +export const lstat: typeof fs.lstat.__promisify__ & typeof fs.lstat; +export const mkdir: typeof fs.mkdir.__promisify__ & typeof fs.mkdir; +export const mkdtemp: typeof fs.mkdtemp.__promisify__ & typeof fs.mkdtemp; +export const open: typeof fs.open.__promisify__ & typeof fs.open; +export const opendir: typeof fs.opendir.__promisify__ & typeof fs.opendir; +export const read: typeof fs.read.__promisify__ & typeof fs.read; +export const readv: typeof fs.readv.__promisify__ & typeof fs.readv; +export const readdir: typeof fs.readdir.__promisify__ & typeof fs.readdir; +export const readFile: typeof fs.readFile.__promisify__ & typeof fs.readFile; +export const readlink: typeof fs.readlink.__promisify__ & typeof fs.readlink; +export const realpath: typeof fs.realpath.__promisify__ & + typeof fs.realpath & { + native(path: fs.PathLike, options?: fs.EncodingOption): Promise; + native(path: fs.PathLike, options: fs.BufferEncodingOption): Promise; + }; +export const rename: typeof fs.rename.__promisify__ & typeof fs.rename; +export const rm: typeof fs.rm.__promisify__ & typeof fs.rm; +export const rmdir: typeof fs.rmdir.__promisify__ & typeof fs.rmdir; +export const stat: typeof fs.stat.__promisify__ & typeof fs.stat; +export const symlink: typeof fs.symlink.__promisify__ & typeof fs.symlink; +export const truncate: typeof fs.truncate.__promisify__ & typeof fs.truncate; +export const unlink: typeof fs.unlink.__promisify__ & typeof fs.unlink; +export const utimes: typeof fs.utimes.__promisify__ & typeof fs.utimes; +export const write: typeof fs.write.__promisify__ & typeof fs.write; +export const writev: typeof fs.writev.__promisify__ & typeof fs.writev; +export const writeFile: typeof fs.writeFile.__promisify__ & typeof fs.writeFile; -export function access(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; -export function access(path: PathLike, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; -export function access(path: PathLike, mode?: number): Promise; +export type NoParamCallbackWithUndefined = (err: NodeJS.ErrnoException | null | undefined) => void; -export function appendFile( - file: PathLike | number, - data: any, - options: { - encoding?: BufferEncoding | string | undefined; - mode?: number | string | undefined; - flag?: string | undefined; - }, - callback: (err: NodeJS.ErrnoException) => void, -): void; -export function appendFile(file: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; -export function appendFile( - file: PathLike | number, - data: any, - options?: - | { - encoding?: BufferEncoding | string | undefined; - mode?: number | string | undefined; - flag?: string | undefined; - } - | BufferEncoding - | string, -): Promise; - -export function chmod(path: PathLike, mode: Mode, callback: (err: NodeJS.ErrnoException) => void): void; -export function chmod(path: PathLike, mode: Mode): Promise; - -export function chown(path: PathLike, uid: number, gid: number): Promise; -export function chown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; - -export function close(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; -export function close(fd: number): Promise; - -export function fchmod(fd: number, mode: Mode, callback: (err: NodeJS.ErrnoException) => void): void; -export function fchmod(fd: number, mode: Mode): Promise; - -export function fchown(fd: number, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; -export function fchown(fd: number, uid: number, gid: number): Promise; - -export function fdatasync(fd: number, callback: () => void): void; -export function fdatasync(fd: number): Promise; - -export function fstat(fd: number, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void; -export function fstat(fd: number): Promise; - -export function fsync(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; -export function fsync(fd: number): Promise; - -export function ftruncate(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; -export function ftruncate(fd: number, len: number, callback: (err: NodeJS.ErrnoException) => void): void; -export function ftruncate(fd: number, len?: number): Promise; - -export function futimes(fd: number, atime: number, mtime: number, callback: (err: NodeJS.ErrnoException) => void): void; -export function futimes(fd: number, atime: Date, mtime: Date, callback: (err: NodeJS.ErrnoException) => void): void; -export function futimes(fd: number, atime: number, mtime: number): Promise; -export function futimes(fd: number, atime: Date, mtime: Date): Promise; - -export function lchown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; -export function lchown(path: PathLike, uid: number, gid: number): Promise; - -export function link(existingPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; -export function link(existingPath: PathLike, newPath: PathLike): Promise; - -export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void; -export function lstat(path: PathLike): Promise; - -/** - * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. - * - * @param callback No arguments other than a possible exception are given to the completion callback. - */ -export function mkdir(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; -/** - * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. - * - * @param callback No arguments other than a possible exception are given to the completion callback. - */ -export function mkdir( - path: PathLike, - options: Mode | fs.MakeDirectoryOptions | null, - callback: (err: NodeJS.ErrnoException) => void, -): void; -export function mkdir(path: PathLike, options?: Mode | fs.MakeDirectoryOptions | null): Promise; -export function mkdirSync(path: PathLike, options?: Mode | fs.MakeDirectoryOptions | null): void; - -export function open( - path: PathLike, - flags: string | number, - callback: (err: NodeJS.ErrnoException, fd: number) => void, -): void; -export function open( - path: PathLike, - flags: string | number, - mode: Mode, - callback: (err: NodeJS.ErrnoException, fd: number) => void, -): void; -export function open(path: PathLike, flags: string | number, mode?: Mode | null): Promise; - -export function opendir(path: string, cb: (err: NodeJS.ErrnoException | null, dir: fs.Dir) => void): void; -export function opendir( - path: string, - options: fs.OpenDirOptions, - cb: (err: NodeJS.ErrnoException | null, dir: fs.Dir) => void, -): void; -export function opendir(path: string, options?: fs.OpenDirOptions): Promise; - -export function read( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: number | null, - callback: (err: NodeJS.ErrnoException, bytesRead: number, buffer: TBuffer) => void, -): void; -export function read( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: number | null, -): Promise<{ bytesRead: number; buffer: TBuffer }>; - -export function readFile(file: PathLike | number, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; -export function readFile( - file: PathLike | number, - encoding: BufferEncoding | string, - callback: (err: NodeJS.ErrnoException, data: string) => void, -): void; -export function readFile( - file: PathLike | number, - options: { flag?: string | undefined } | { encoding: BufferEncoding | string; flag?: string | undefined }, - callback: (err: NodeJS.ErrnoException, data: Buffer) => void, -): void; -export function readFile( - file: PathLike | number, - options: { flag?: string | undefined } | { encoding: BufferEncoding | string; flag?: string | undefined }, -): Promise; -// tslint:disable-next-line:unified-signatures -export function readFile(file: PathLike | number, encoding: BufferEncoding | string): Promise; -export function readFile(file: PathLike | number): Promise; - -export function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; -export function readdir( - path: PathLike, - options: 'buffer' | { encoding: 'buffer'; withFileTypes?: false | undefined }, -): Promise; -export function readdir( - path: PathLike, - options?: - | { encoding: BufferEncoding | string | null; withFileTypes?: false | undefined } - | BufferEncoding - | string - | null, -): Promise; -export function readdir( - path: PathLike, - options?: { encoding?: BufferEncoding | string | null | undefined; withFileTypes?: false | undefined }, -): Promise; -export function readdir( - path: PathLike, - options: { encoding?: BufferEncoding | string | null | undefined; withFileTypes: true }, -): Promise; - -export function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException, linkString: string) => any): void; -export function readlink(path: PathLike): Promise; - -export function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; -export function realpath( - path: PathLike, - cache: { [path: string]: string }, - callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any, -): void; -export function realpath(path: PathLike, cache?: { [path: string]: string }): Promise; - -/* tslint:disable:unified-signatures */ -export namespace realpath { - const native: { - (path: PathLike, options: { encoding: 'buffer' } | 'buffer'): Promise; - ( - path: PathLike, - options: { encoding: BufferEncoding | string | null } | BufferEncoding | string | undefined | null, - ): Promise; - (path: PathLike, options: { encoding: BufferEncoding | string | null } | string | undefined | null): Promise< - string | Buffer - >; - (path: PathLike): Promise; - } & typeof fs.realpath.native; -} -/* tslint:enable:unified-signatures */ - -export function rename(oldPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; -export function rename(oldPath: PathLike, newPath: PathLike): Promise; - -/** - * Asynchronously removes files and directories (modeled on the standard POSIX - * `rm` utility). - * - * Only available in node >= v14.14.0 - */ -export function rm( - path: PathLike, - options?: { - force?: boolean | undefined; - maxRetries?: number | undefined; - recursive?: boolean | undefined; - retryDelay?: number | undefined; - }, -): Promise; - -/** - * Asynchronous rmdir - removes the directory specified in {path} - * - * @param callback No arguments other than a possible exception are given to the completion callback. - */ -export function rmdir(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; -export function rmdir(path: PathLike, options?: fs.RmDirOptions): Promise; - -export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void; -export function stat(path: PathLike): Promise; - -export function symlink( - target: PathLike, - path: PathLike, - type: SymlinkType | undefined, - callback: (err: NodeJS.ErrnoException) => void, -): void; -export function symlink(target: PathLike, path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; -export function symlink(target: PathLike, path: PathLike, type?: SymlinkType): Promise; - -export function truncate(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; -export function truncate(path: PathLike, len: number, callback: (err: NodeJS.ErrnoException) => void): void; -export function truncate(path: PathLike, len?: number): Promise; - -/** - * Asynchronous unlink - deletes the file specified in {path} - * - * @param callback No arguments other than a possible exception are given to the completion callback. - */ -export function unlink(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; -export function unlink(path: PathLike): Promise; - -export function utimes( - path: PathLike, - atime: number, - mtime: number, - callback: (err: NodeJS.ErrnoException) => void, -): void; -export function utimes(path: PathLike, atime: Date, mtime: Date, callback: (err: NodeJS.ErrnoException) => void): void; -export function utimes(path: PathLike, atime: number, mtime: number): Promise; -export function utimes(path: PathLike, atime: Date, mtime: Date): Promise; - -export function write( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: number | null, - callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void, -): void; -export function write( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void, -): void; -export function write( - fd: number, - data: any, - callback: (err: NodeJS.ErrnoException, written: number, str: string) => void, -): void; -export function write( - fd: number, - data: any, - offset: number, - callback: (err: NodeJS.ErrnoException, written: number, str: string) => void, -): void; -export function write( - fd: number, - data: any, - offset: number, - encoding: BufferEncoding | string, - callback: (err: NodeJS.ErrnoException, written: number, str: string) => void, -): void; -export function write( - fd: number, - buffer: TBuffer, - offset?: number, - length?: number, - position?: number | null, -): Promise<{ bytesWritten: number; buffer: TBuffer }>; -export function write( - fd: number, - data: any, - offset?: number, - encoding?: BufferEncoding | string, -): Promise<{ bytesWritten: number; buffer: string }>; - -export function writeFile(file: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; -export function writeFile( - file: PathLike | number, - data: any, - options?: WriteFileOptions | BufferEncoding | string, -): Promise; -export function writeFile( - file: PathLike | number, - data: any, - options: WriteFileOptions | BufferEncoding | string, - callback: (err: NodeJS.ErrnoException) => void, -): void; - -export function writev( - fd: number, - buffers: NodeJS.ArrayBufferView[], - position: number, - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void, -): void; -export function writev( - fd: number, - buffers: NodeJS.ArrayBufferView[], - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void, -): void; -export function writev(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): Promise; - -/** - * Asynchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * - * @param callback The created folder path is passed as a string to the callback's second parameter. - */ -export function mkdtemp(prefix: string): Promise; -export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException, folder: string) => void): void; - -export interface PathEntry { - path: string; - stats: Stats; -} - -export interface PathEntryStream { - read(): PathEntry | null; -} +export type SymlinkType = fs.symlink.Type; export type CopyFilterSync = (src: string, dest: string) => boolean; export type CopyFilterAsync = (src: string, dest: string) => Promise; -export type SymlinkType = 'dir' | 'file' | 'junction'; - -export type Mode = string | number; - -export type ArrayBufferView = NodeJS.TypedArray | DataView; - export interface CopyOptions { + /** + * Dereference symlinks. + * @default false + */ dereference?: boolean | undefined; + /** + * Overwrite existing file or directory. + * _Note that the copy operation will silently fail if you set this to `false` and the destination exists._ + * Use the `errorOnExist` option to change this behavior. + * @default true + */ overwrite?: boolean | undefined; + /** + * When `true`, will set last modification and access times to the ones of the original source files. + * When `false`, timestamp behavior is OS-dependent. + * @default false + */ preserveTimestamps?: boolean | undefined; + /** + * When `overwrite` is `false` and the destination exists, throw an error. + * @default false + */ errorOnExist?: boolean | undefined; + /** + * Function to filter copied files/directories. Return `true` to copy the item, `false` to ignore it. + * Can also return a `Promise` that resolves to `true` or `false` (or pass in an `async` function). + */ filter?: CopyFilterSync | CopyFilterAsync | undefined; - recursive?: boolean | undefined; } export interface CopyOptionsSync extends CopyOptions { + /** + * Function to filter copied files/directories. Return `true` to copy the item, `false` to ignore it. + */ filter?: CopyFilterSync | undefined; } -export interface EnsureOptions { +export interface EnsureDirOptions { mode?: number | undefined; } export interface MoveOptions { + /** + * Overwrite existing file or directory. + * @default false + */ overwrite?: boolean | undefined; - limit?: number | undefined; + /** + * Dereference symlinks. + * @default false + */ + dereference?: boolean | undefined; } -export interface ReadOptions { - throws?: boolean | undefined; - fs?: object | undefined; - reviver?: any; - encoding?: BufferEncoding | string | undefined; - flag?: string | undefined; -} +export { JFReadOptions as JsonReadOptions, JFWriteOptions as JsonWriteOptions } from 'jsonfile'; -export interface WriteFileOptions { - encoding?: BufferEncoding | string | null | undefined; - flag?: string | undefined; - mode?: number | undefined; -} - -export interface WriteOptions extends WriteFileOptions { - fs?: object | undefined; - replacer?: any; - spaces?: number | string | undefined; - EOL?: string | undefined; -} - -export interface WritevResult { - bytesWritten: number; - buffers: ArrayBufferView[]; -} +export type JsonOutputOptions = fs.WriteFileOptions & StringifyOptions; diff --git a/node_modules/@types/fs-extra/package.json b/node_modules/@types/fs-extra/package.json index 0dc1040..4bf1728 100755 --- a/node_modules/@types/fs-extra/package.json +++ b/node_modules/@types/fs-extra/package.json @@ -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" + } } \ No newline at end of file diff --git a/node_modules/@types/jsonfile/LICENSE b/node_modules/@types/jsonfile/LICENSE new file mode 100755 index 0000000..9e841e7 --- /dev/null +++ b/node_modules/@types/jsonfile/LICENSE @@ -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 diff --git a/node_modules/@types/jsonfile/README.md b/node_modules/@types/jsonfile/README.md new file mode 100755 index 0000000..9d358a7 --- /dev/null +++ b/node_modules/@types/jsonfile/README.md @@ -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). diff --git a/node_modules/@types/jsonfile/index.d.ts b/node_modules/@types/jsonfile/index.d.ts new file mode 100755 index 0000000..86acdc4 --- /dev/null +++ b/node_modules/@types/jsonfile/index.d.ts @@ -0,0 +1,78 @@ +// Type definitions for jsonfile 6.1 +// Project: https://github.com/jprichardson/node-jsonfile#readme +// Definitions by: Daniel Bowring +// BendingBender +// Piotr Błażejewicz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +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; + +/** + * @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; + +/** + * @see {@link https://github.com/jprichardson/node-jsonfile#writefilesyncfilename-obj-options} + */ +export function writeFileSync(file: Path, obj: any, options?: JFWriteOptions): void; diff --git a/node_modules/@types/jsonfile/package.json b/node_modules/@types/jsonfile/package.json new file mode 100755 index 0000000..85a9637 --- /dev/null +++ b/node_modules/@types/jsonfile/package.json @@ -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" +} \ No newline at end of file diff --git a/node_modules/@types/jsonfile/utils.d.ts b/node_modules/@types/jsonfile/utils.d.ts new file mode 100755 index 0000000..901b43b --- /dev/null +++ b/node_modules/@types/jsonfile/utils.d.ts @@ -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; +} diff --git a/node_modules/@types/node/README.md b/node_modules/@types/node/README.md index 38c7b0c..4e190cf 100755 --- a/node_modules/@types/node/README.md +++ b/node_modules/@types/node/README.md @@ -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). diff --git a/node_modules/@types/node/async_hooks.d.ts b/node_modules/@types/node/async_hooks.d.ts index 0bf4739..96908be 100755 --- a/node_modules/@types/node/async_hooks.d.ts +++ b/node_modules/@types/node/async_hooks.d.ts @@ -319,6 +319,16 @@ declare module 'async_hooks' { */ triggerAsyncId(): number; } + interface AsyncLocalStorageOptions { + /** + * 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 { + constructor(options?: AsyncLocalStorageOptions); + /** * Disables the instance of `AsyncLocalStorage`. All subsequent calls * to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again. diff --git a/node_modules/@types/node/buffer.d.ts b/node_modules/@types/node/buffer.d.ts index 5ec326d..d9f7959 100755 --- a/node_modules/@types/node/buffer.d.ts +++ b/node_modules/@types/node/buffer.d.ts @@ -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, 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 | { @@ -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, byteOffset?: number, length?: number): Buffer; + from( + arrayBuffer: WithImplicitCoercion, + 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`. * diff --git a/node_modules/@types/node/crypto.d.ts b/node_modules/@types/node/crypto.d.ts index 20d960c..5880d01 100755 --- a/node_modules/@types/node/crypto.d.ts +++ b/node_modules/@types/node/crypto.d.ts @@ -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. diff --git a/node_modules/@types/node/diagnostics_channel.d.ts b/node_modules/@types/node/diagnostics_channel.d.ts index 3dcaa03..00856b4 100755 --- a/node_modules/@types/node/diagnostics_channel.d.ts +++ b/node_modules/@types/node/diagnostics_channel.d.ts @@ -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 diff --git a/node_modules/@types/node/dns.d.ts b/node_modules/@types/node/dns.d.ts index 305367b..021ed81 100755 --- a/node_modules/@types/node/dns.d.ts +++ b/node_modules/@types/node/dns.d.ts @@ -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; diff --git a/node_modules/@types/node/fs.d.ts b/node_modules/@types/node/fs.d.ts index 75c53fb..ff45ce5 100755 --- a/node_modules/@types/node/fs.d.ts +++ b/node_modules/@types/node/fs.d.ts @@ -131,6 +131,42 @@ declare module 'fs' { * @since v0.1.21 */ export class Stats {} + + export interface StatsFsBase { + /** 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 {} + + /** + * 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 {} + + 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; function __promisify__(path: PathLike, options?: StatOptions): Promise; } + /** + * Asynchronous statfs(2). Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an 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 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; + function __promisify__( + path: PathLike, + options: StatFsOptions & { + bigint: true; + } + ): Promise; + function __promisify__(path: PathLike, options?: StatFsOptions): Promise; + } + + /** + * Synchronous statfs(2). Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an 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. diff --git a/node_modules/@types/node/fs/promises.d.ts b/node_modules/@types/node/fs/promises.d.ts index aca2fd5..f34486c 100755 --- a/node_modules/@types/node/fs/promises.d.ts +++ b/node_modules/@types/node/fs/promises.d.ts @@ -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; function stat(path: PathLike, opts?: StatOptions): Promise; + /** + * @since v18.15.0 + * @return Fulfills with an {fs.StatFs} for the file system. + */ + function statfs( + path: PathLike, + opts?: StatFsOptions & { + bigint?: false | undefined; + } + ): Promise; + function statfs( + path: PathLike, + opts: StatFsOptions & { + bigint: true; + } + ): Promise; + function statfs(path: PathLike, opts?: StatFsOptions): Promise; + /** * 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 diff --git a/node_modules/@types/node/globals.d.ts b/node_modules/@types/node/globals.d.ts index 80fd4cf..bf5632d 100755 --- a/node_modules/@types/node/globals.d.ts +++ b/node_modules/@types/node/globals.d.ts @@ -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. */ diff --git a/node_modules/@types/node/http.d.ts b/node_modules/@types/node/http.d.ts index e14de6c..31a3b73 100755 --- a/node_modules/@types/node/http.d.ts +++ b/node_modules/@types/node/http.d.ts @@ -144,6 +144,7 @@ declare module 'http' { socketPath?: string | undefined; timeout?: number | undefined; uniqueHeaders?: Array | 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. diff --git a/node_modules/@types/node/http2.d.ts b/node_modules/@types/node/http2.d.ts index 0e36826..fc78169 100755 --- a/node_modules/@types/node/http2.d.ts +++ b/node_modules/@types/node/http2.d.ts @@ -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; diff --git a/node_modules/@types/node/index.d.ts b/node_modules/@types/node/index.d.ts index 9db5f47..1950db4 100755 --- a/node_modules/@types/node/index.d.ts +++ b/node_modules/@types/node/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for non-npm package Node.js 18.11 +// Type definitions for non-npm package Node.js 18.15 // Project: https://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped diff --git a/node_modules/@types/node/module.d.ts b/node_modules/@types/node/module.d.ts index d83aec9..5a60a5f 100755 --- a/node_modules/@types/node/module.d.ts +++ b/node_modules/@types/node/module.d.ts @@ -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); } diff --git a/node_modules/@types/node/net.d.ts b/node_modules/@types/node/net.d.ts index b735538..f7602a7 100755 --- a/node_modules/@types/node/net.d.ts +++ b/node_modules/@types/node/net.d.ts @@ -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. */ diff --git a/node_modules/@types/node/os.d.ts b/node_modules/@types/node/os.d.ts index 3c55599..ebe02da 100755 --- a/node_modules/@types/node/os.d.ts +++ b/node_modules/@types/node/os.d.ts @@ -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. diff --git a/node_modules/@types/node/package.json b/node_modules/@types/node/package.json index 1570db1..4062c29 100755 --- a/node_modules/@types/node/package.json +++ b/node_modules/@types/node/package.json @@ -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" } \ No newline at end of file diff --git a/node_modules/@types/node/process.d.ts b/node_modules/@types/node/process.d.ts index 12148f9..157914d 100755 --- a/node_modules/@types/node/process.d.ts +++ b/node_modules/@types/node/process.d.ts @@ -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 diff --git a/node_modules/@types/node/stream.d.ts b/node_modules/@types/node/stream.d.ts index 711fd9c..16fc3c3 100755 --- a/node_modules/@types/node/stream.d.ts +++ b/node_modules/@types/node/stream.d.ts @@ -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 { diff --git a/node_modules/@types/node/test.d.ts b/node_modules/@types/node/test.d.ts index 8e20710..b8c8e9c 100755 --- a/node_modules/@types/node/test.d.ts +++ b/node_modules/@types/node/test.d.ts @@ -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 & { + mock: MockFunctionContext; + }; + + type NoOpFunction = (...args: any[]) => undefined; + + type FunctionPropertyNames = { + [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(original?: F, options?: MockFunctionOptions): Mock; + fn(original?: F, implementation?: Implementation, options?: MockFunctionOptions): Mock; + + /** + * 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, + >( + object: MockedObject, + methodName: MethodName, + options?: MockFunctionOptions, + ): MockedObject[MethodName] extends Function + ? Mock + : never; + method< + MockedObject extends object, + MethodName extends FunctionPropertyNames, + Implementation extends Function, + >( + object: MockedObject, + methodName: MethodName, + implementation: Implementation, + options?: MockFunctionOptions, + ): MockedObject[MethodName] extends Function + ? Mock + : never; + method( + object: MockedObject, + methodName: keyof MockedObject, + options: MockMethodOptions, + ): Mock; + method( + object: MockedObject, + methodName: keyof MockedObject, + implementation: Function, + options: MockMethodOptions, + ): Mock; + + /** + * 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 { + /** + * A getter that returns a copy of the internal array used to track calls to the mock. + */ + readonly calls: Array>; + + /** + * 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 }; } diff --git a/node_modules/@types/node/timers.d.ts b/node_modules/@types/node/timers.d.ts index b26f3ce..1d142c0 100755 --- a/node_modules/@types/node/timers.d.ts +++ b/node_modules/@types/node/timers.d.ts @@ -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(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout; // util.promisify no rest args compability // tslint:disable-next-line void-return diff --git a/node_modules/@types/node/tls.d.ts b/node_modules/@types/node/tls.d.ts index 2cbc716..2c55eb9 100755 --- a/node_modules/@types/node/tls.d.ts +++ b/node_modules/@types/node/tls.d.ts @@ -41,21 +41,100 @@ declare module 'tls' { CN: string; } interface PeerCertificate { - subject: Certificate; - issuer: Certificate; - subjectaltname: string; - infoAccess: NodeJS.Dict; - 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; + /** + * 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 { diff --git a/node_modules/@types/node/ts4.8/async_hooks.d.ts b/node_modules/@types/node/ts4.8/async_hooks.d.ts index 0bf4739..96908be 100755 --- a/node_modules/@types/node/ts4.8/async_hooks.d.ts +++ b/node_modules/@types/node/ts4.8/async_hooks.d.ts @@ -319,6 +319,16 @@ declare module 'async_hooks' { */ triggerAsyncId(): number; } + interface AsyncLocalStorageOptions { + /** + * 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 { + constructor(options?: AsyncLocalStorageOptions); + /** * Disables the instance of `AsyncLocalStorage`. All subsequent calls * to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again. diff --git a/node_modules/@types/node/ts4.8/buffer.d.ts b/node_modules/@types/node/ts4.8/buffer.d.ts index ea859cd..aa83e40 100755 --- a/node_modules/@types/node/ts4.8/buffer.d.ts +++ b/node_modules/@types/node/ts4.8/buffer.d.ts @@ -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, 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 | { @@ -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, byteOffset?: number, length?: number): Buffer; + from( + arrayBuffer: WithImplicitCoercion, + 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`. * diff --git a/node_modules/@types/node/ts4.8/crypto.d.ts b/node_modules/@types/node/ts4.8/crypto.d.ts index 20d960c..28d8e4d 100755 --- a/node_modules/@types/node/ts4.8/crypto.d.ts +++ b/node_modules/@types/node/ts4.8/crypto.d.ts @@ -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; diff --git a/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts b/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts index 3dcaa03..1c6ca23 100755 --- a/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +++ b/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts @@ -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 diff --git a/node_modules/@types/node/ts4.8/dns.d.ts b/node_modules/@types/node/ts4.8/dns.d.ts index 305367b..021ed81 100755 --- a/node_modules/@types/node/ts4.8/dns.d.ts +++ b/node_modules/@types/node/ts4.8/dns.d.ts @@ -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; diff --git a/node_modules/@types/node/ts4.8/globals.d.ts b/node_modules/@types/node/ts4.8/globals.d.ts index f401d95..c238d17 100755 --- a/node_modules/@types/node/ts4.8/globals.d.ts +++ b/node_modules/@types/node/ts4.8/globals.d.ts @@ -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. */ diff --git a/node_modules/@types/node/ts4.8/http2.d.ts b/node_modules/@types/node/ts4.8/http2.d.ts index 0e36826..fc78169 100755 --- a/node_modules/@types/node/ts4.8/http2.d.ts +++ b/node_modules/@types/node/ts4.8/http2.d.ts @@ -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; diff --git a/node_modules/@types/node/ts4.8/module.d.ts b/node_modules/@types/node/ts4.8/module.d.ts index d83aec9..5a60a5f 100755 --- a/node_modules/@types/node/ts4.8/module.d.ts +++ b/node_modules/@types/node/ts4.8/module.d.ts @@ -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); } diff --git a/node_modules/@types/node/ts4.8/net.d.ts b/node_modules/@types/node/ts4.8/net.d.ts index 72cebc8..9bff88f 100755 --- a/node_modules/@types/node/ts4.8/net.d.ts +++ b/node_modules/@types/node/ts4.8/net.d.ts @@ -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} diff --git a/node_modules/@types/node/ts4.8/os.d.ts b/node_modules/@types/node/ts4.8/os.d.ts index 3c55599..ebe02da 100755 --- a/node_modules/@types/node/ts4.8/os.d.ts +++ b/node_modules/@types/node/ts4.8/os.d.ts @@ -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. diff --git a/node_modules/@types/node/ts4.8/process.d.ts b/node_modules/@types/node/ts4.8/process.d.ts index 12148f9..157914d 100755 --- a/node_modules/@types/node/ts4.8/process.d.ts +++ b/node_modules/@types/node/ts4.8/process.d.ts @@ -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 diff --git a/node_modules/@types/node/ts4.8/stream.d.ts b/node_modules/@types/node/ts4.8/stream.d.ts index a0df689..926a564 100755 --- a/node_modules/@types/node/ts4.8/stream.d.ts +++ b/node_modules/@types/node/ts4.8/stream.d.ts @@ -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 { diff --git a/node_modules/@types/node/ts4.8/test.d.ts b/node_modules/@types/node/ts4.8/test.d.ts index 8e20710..b8c8e9c 100755 --- a/node_modules/@types/node/ts4.8/test.d.ts +++ b/node_modules/@types/node/ts4.8/test.d.ts @@ -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 & { + mock: MockFunctionContext; + }; + + type NoOpFunction = (...args: any[]) => undefined; + + type FunctionPropertyNames = { + [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(original?: F, options?: MockFunctionOptions): Mock; + fn(original?: F, implementation?: Implementation, options?: MockFunctionOptions): Mock; + + /** + * 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, + >( + object: MockedObject, + methodName: MethodName, + options?: MockFunctionOptions, + ): MockedObject[MethodName] extends Function + ? Mock + : never; + method< + MockedObject extends object, + MethodName extends FunctionPropertyNames, + Implementation extends Function, + >( + object: MockedObject, + methodName: MethodName, + implementation: Implementation, + options?: MockFunctionOptions, + ): MockedObject[MethodName] extends Function + ? Mock + : never; + method( + object: MockedObject, + methodName: keyof MockedObject, + options: MockMethodOptions, + ): Mock; + method( + object: MockedObject, + methodName: keyof MockedObject, + implementation: Function, + options: MockMethodOptions, + ): Mock; + + /** + * 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 { + /** + * A getter that returns a copy of the internal array used to track calls to the mock. + */ + readonly calls: Array>; + + /** + * 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 }; } diff --git a/node_modules/@types/node/ts4.8/tls.d.ts b/node_modules/@types/node/ts4.8/tls.d.ts index 2cbc716..2c55eb9 100755 --- a/node_modules/@types/node/ts4.8/tls.d.ts +++ b/node_modules/@types/node/ts4.8/tls.d.ts @@ -41,21 +41,100 @@ declare module 'tls' { CN: string; } interface PeerCertificate { - subject: Certificate; - issuer: Certificate; - subjectaltname: string; - infoAccess: NodeJS.Dict; - 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; + /** + * 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 { diff --git a/node_modules/@types/node/ts4.8/util.d.ts b/node_modules/@types/node/ts4.8/util.d.ts index 6d35019..c821051 100755 --- a/node_modules/@types/node/ts4.8/util.d.ts +++ b/node_modules/@types/node/ts4.8/util.d.ts @@ -1426,6 +1426,91 @@ declare module 'util' { tokens?: Token[]; } : PreciseParsedResults; + + /** + * @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; + /** + * 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; + /** + * 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'; diff --git a/node_modules/@types/node/ts4.8/v8.d.ts b/node_modules/@types/node/ts4.8/v8.d.ts index 6685dc2..e7247a6 100755 --- a/node_modules/@types/node/ts4.8/v8.d.ts +++ b/node_modules/@types/node/ts4.8/v8.d.ts @@ -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'; diff --git a/node_modules/@types/node/ts4.8/vm.d.ts b/node_modules/@types/node/ts4.8/vm.d.ts index c96513a..181b9dc 100755 --- a/node_modules/@types/node/ts4.8/vm.d.ts +++ b/node_modules/@types/node/ts4.8/vm.d.ts @@ -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, options?: CompileFunctionOptions): Function; + function compileFunction(code: string, params?: ReadonlyArray, 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; + + interface ModuleEvaluateOptions { + timeout?: RunningScriptOptions['timeout'] | undefined; + breakOnSigint?: RunningScriptOptions['breakOnSigint'] | undefined; + } + type ModuleLinker = (specifier: string, referencingModule: Module, extra: { assert: Object }) => Module | Promise; + 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; + /** + * Link module dependencies. This method must be called before evaluation, and can only be called once per module. + */ + link(linker: ModuleLinker): Promise; + } + + 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'; diff --git a/node_modules/@types/node/util.d.ts b/node_modules/@types/node/util.d.ts index 6d35019..bb1100e 100755 --- a/node_modules/@types/node/util.d.ts +++ b/node_modules/@types/node/util.d.ts @@ -1426,6 +1426,91 @@ declare module 'util' { tokens?: Token[]; } : PreciseParsedResults; + + /** + * @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; + /** + * 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; + /** + * 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'; diff --git a/node_modules/@types/node/v8.d.ts b/node_modules/@types/node/v8.d.ts index 6685dc2..e7247a6 100755 --- a/node_modules/@types/node/v8.d.ts +++ b/node_modules/@types/node/v8.d.ts @@ -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'; diff --git a/node_modules/@types/node/vm.d.ts b/node_modules/@types/node/vm.d.ts index c96513a..181b9dc 100755 --- a/node_modules/@types/node/vm.d.ts +++ b/node_modules/@types/node/vm.d.ts @@ -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, options?: CompileFunctionOptions): Function; + function compileFunction(code: string, params?: ReadonlyArray, 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; + + interface ModuleEvaluateOptions { + timeout?: RunningScriptOptions['timeout'] | undefined; + breakOnSigint?: RunningScriptOptions['breakOnSigint'] | undefined; + } + type ModuleLinker = (specifier: string, referencingModule: Module, extra: { assert: Object }) => Module | Promise; + 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; + /** + * Link module dependencies. This method must be called before evaluation, and can only be called once per module. + */ + link(linker: ModuleLinker): Promise; + } + + 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'; diff --git a/node_modules/@types/which/README.md b/node_modules/@types/which/README.md index 3b12c36..53907bd 100755 --- a/node_modules/@types/which/README.md +++ b/node_modules/@types/which/README.md @@ -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). diff --git a/node_modules/@types/which/index.d.ts b/node_modules/@types/which/index.d.ts index e4f01cb..e494a01 100755 --- a/node_modules/@types/which/index.d.ts +++ b/node_modules/@types/which/index.d.ts @@ -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 | 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 | 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; -declare function which(cmd: string, options?: which.AsyncOptions & which.OptionsFirst): Promise; +declare function which(cmd: string, options: which.Options & which.AsyncOptions & which.OptionsAll): Promise; +declare function which(cmd: string, options?: which.Options & which.AsyncOptions & which.OptionsFirst): Promise; declare namespace which { /** Finds all instances of a specified executable in the PATH environment variable */ diff --git a/node_modules/@types/which/package.json b/node_modules/@types/which/package.json index f4d1045..d8603cf 100755 --- a/node_modules/@types/which/package.json +++ b/node_modules/@types/which/package.json @@ -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" } \ No newline at end of file diff --git a/node_modules/fs-extra/README.md b/node_modules/fs-extra/README.md index 6ed8b6a..245de66 100644 --- a/node_modules/fs-extra/README.md +++ b/node_modules/fs-extra/README.md @@ -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 diff --git a/node_modules/fs-extra/lib/copy/copy-sync.js b/node_modules/fs-extra/lib/copy/copy-sync.js index 551abe0..8bc6011 100644 --- a/node_modules/fs-extra/lib/copy/copy-sync.js +++ b/node_modules/fs-extra/lib/copy/copy-sync.js @@ -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) diff --git a/node_modules/fs-extra/lib/copy/copy.js b/node_modules/fs-extra/lib/copy/copy.js index 09d53df..bc188fb 100644 --- a/node_modules/fs-extra/lib/copy/copy.js +++ b/node_modules/fs-extra/lib/copy/copy.js @@ -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) diff --git a/node_modules/fs-extra/lib/esm.mjs b/node_modules/fs-extra/lib/esm.mjs new file mode 100644 index 0000000..27b7a1f --- /dev/null +++ b/node_modules/fs-extra/lib/esm.mjs @@ -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 +} diff --git a/node_modules/fs-extra/lib/fs/index.js b/node_modules/fs-extra/lib/fs/index.js index 7b025e2..3c3ec51 100644 --- a/node_modules/fs-extra/lib/fs/index.js +++ b/node_modules/fs-extra/lib/fs/index.js @@ -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 diff --git a/node_modules/fs-extra/lib/move/move-sync.js b/node_modules/fs-extra/lib/move/move-sync.js index 8453366..c456ab3 100644 --- a/node_modules/fs-extra/lib/move/move-sync.js +++ b/node_modules/fs-extra/lib/move/move-sync.js @@ -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) diff --git a/node_modules/fs-extra/lib/move/move.js b/node_modules/fs-extra/lib/move/move.js index 7dc6ecd..5c4d74f 100644 --- a/node_modules/fs-extra/lib/move/move.js +++ b/node_modules/fs-extra/lib/move/move.js @@ -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) diff --git a/node_modules/fs-extra/lib/remove/index.js b/node_modules/fs-extra/lib/remove/index.js index 4428e59..da746c7 100644 --- a/node_modules/fs-extra/lib/remove/index.js +++ b/node_modules/fs-extra/lib/remove/index.js @@ -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 = { diff --git a/node_modules/fs-extra/lib/remove/rimraf.js b/node_modules/fs-extra/lib/remove/rimraf.js deleted file mode 100644 index 2c77102..0000000 --- a/node_modules/fs-extra/lib/remove/rimraf.js +++ /dev/null @@ -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 diff --git a/node_modules/fs-extra/package.json b/node_modules/fs-extra/package.json index 059000e..c8bfb8f 100644 --- a/node_modules/fs-extra/package.json +++ b/node_modules/fs-extra/package.json @@ -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 } diff --git a/node_modules/graceful-fs/package.json b/node_modules/graceful-fs/package.json index 3057856..87babf0 100644 --- a/node_modules/graceful-fs/package.json +++ b/node_modules/graceful-fs/package.json @@ -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" + } } diff --git a/node_modules/graceful-fs/polyfills.js b/node_modules/graceful-fs/polyfills.js index 46dea36..453f1a9 100644 --- a/node_modules/graceful-fs/polyfills.js +++ b/node_modules/graceful-fs/polyfills.js @@ -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) { diff --git a/node_modules/minimist/.eslintrc b/node_modules/minimist/.eslintrc index 137f67b..bd1a5e0 100644 --- a/node_modules/minimist/.eslintrc +++ b/node_modules/minimist/.eslintrc @@ -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, + }, + }, + ] } diff --git a/node_modules/minimist/CHANGELOG.md b/node_modules/minimist/CHANGELOG.md index e0e00bd..c9a1e15 100644 --- a/node_modules/minimist/CHANGELOG.md +++ b/node_modules/minimist/CHANGELOG.md @@ -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 diff --git a/node_modules/minimist/README.md b/node_modules/minimist/README.md index 30ff92d..74da323 100644 --- a/node_modules/minimist/README.md +++ b/node_modules/minimist/README.md @@ -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 diff --git a/node_modules/minimist/example/parse.js b/node_modules/minimist/example/parse.js index f7c8d49..9d90ffb 100644 --- a/node_modules/minimist/example/parse.js +++ b/node_modules/minimist/example/parse.js @@ -1,2 +1,4 @@ +'use strict'; + var argv = require('../')(process.argv.slice(2)); console.log(argv); diff --git a/node_modules/minimist/index.js b/node_modules/minimist/index.js index d9c3eb7..f020f39 100644 --- a/node_modules/minimist/index.js +++ b/node_modules/minimist/index.js @@ -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__'; -} diff --git a/node_modules/minimist/package.json b/node_modules/minimist/package.json index 89a639e..c10a334 100644 --- a/node_modules/minimist/package.json +++ b/node_modules/minimist/package.json @@ -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" + ] + } } diff --git a/node_modules/minimist/test/all_bool.js b/node_modules/minimist/test/all_bool.js index ac83548..befa0c9 100644 --- a/node_modules/minimist/test/all_bool.js +++ b/node_modules/minimist/test/all_bool.js @@ -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(); }); diff --git a/node_modules/minimist/test/bool.js b/node_modules/minimist/test/bool.js index 5f7dbde..e58d47e 100644 --- a/node_modules/minimist/test/bool.js +++ b/node_modules/minimist/test/bool.js @@ -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(); -}); \ No newline at end of file + t.same(result, expected); + t.end(); +}); diff --git a/node_modules/minimist/test/dash.js b/node_modules/minimist/test/dash.js index 5a4fa5b..7078817 100644 --- a/node_modules/minimist/test/dash.js +++ b/node_modules/minimist/test/dash.js @@ -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: '---', _: [] }); +}); + diff --git a/node_modules/minimist/test/default_bool.js b/node_modules/minimist/test/default_bool.js index 780a311..4e9f625 100644 --- a/node_modules/minimist/test/default_bool.js +++ b/node_modules/minimist/test/default_bool.js @@ -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(); +}); diff --git a/node_modules/minimist/test/dotted.js b/node_modules/minimist/test/dotted.js index d8b3e85..126ff03 100644 --- a/node_modules/minimist/test/dotted.js +++ b/node_modules/minimist/test/dotted.js @@ -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(); }); diff --git a/node_modules/minimist/test/kv_short.js b/node_modules/minimist/test/kv_short.js index f813b30..6d1b53a 100644 --- a/node_modules/minimist/test/kv_short.js +++ b/node_modules/minimist/test/kv_short.js @@ -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', _: [] }); }); diff --git a/node_modules/minimist/test/long.js b/node_modules/minimist/test/long.js index 5d3a1e0..9fef51f 100644 --- a/node_modules/minimist/test/long.js +++ b/node_modules/minimist/test/long.js @@ -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(); }); diff --git a/node_modules/minimist/test/num.js b/node_modules/minimist/test/num.js index 2cc77f4..074393e 100644 --- a/node_modules/minimist/test/num.js +++ b/node_modules/minimist/test/num.js @@ -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(); }); diff --git a/node_modules/minimist/test/parse.js b/node_modules/minimist/test/parse.js index 7b4a2a1..65d9d90 100644 --- a/node_modules/minimist/test/parse.js +++ b/node_modules/minimist/test/parse.js @@ -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(); }); diff --git a/node_modules/minimist/test/parse_modified.js b/node_modules/minimist/test/parse_modified.js index ab620dc..32965d1 100644 --- a/node_modules/minimist/test/parse_modified.js +++ b/node_modules/minimist/test/parse_modified.js @@ -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] }); }); diff --git a/node_modules/minimist/test/proto.js b/node_modules/minimist/test/proto.js index 4ac62df..6e629dd 100644 --- a/node_modules/minimist/test/proto.js +++ b/node_modules/minimist/test/proto.js @@ -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(); +}); diff --git a/node_modules/minimist/test/short.js b/node_modules/minimist/test/short.js index d513a1c..4a7b843 100644 --- a/node_modules/minimist/test/short.js +++ b/node_modules/minimist/test/short.js @@ -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(); }); diff --git a/node_modules/minimist/test/stop_early.js b/node_modules/minimist/test/stop_early.js index bdf9fbc..52a6a91 100644 --- a/node_modules/minimist/test/stop_early.js +++ b/node_modules/minimist/test/stop_early.js @@ -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(); }); diff --git a/node_modules/minimist/test/unknown.js b/node_modules/minimist/test/unknown.js index 462a36b..4f2e0ca 100644 --- a/node_modules/minimist/test/unknown.js +++ b/node_modules/minimist/test/unknown.js @@ -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(); }); diff --git a/node_modules/minimist/test/whitespace.js b/node_modules/minimist/test/whitespace.js index 8a52a58..4fdaf1d 100644 --- a/node_modules/minimist/test/whitespace.js +++ b/node_modules/minimist/test/whitespace.js @@ -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'); }); diff --git a/node_modules/webpod/LICENSE b/node_modules/webpod/LICENSE new file mode 100644 index 0000000..d992f46 --- /dev/null +++ b/node_modules/webpod/LICENSE @@ -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. diff --git a/node_modules/webpod/README.md b/node_modules/webpod/README.md new file mode 100644 index 0000000..9fc5e3b --- /dev/null +++ b/node_modules/webpod/README.md @@ -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) diff --git a/node_modules/webpod/dist/cli.d.ts b/node_modules/webpod/dist/cli.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/node_modules/webpod/dist/cli.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/webpod/dist/cli.js b/node_modules/webpod/dist/cli.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/node_modules/webpod/dist/cli.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/webpod/dist/index.d.ts b/node_modules/webpod/dist/index.d.ts new file mode 100644 index 0000000..d5ae441 --- /dev/null +++ b/node_modules/webpod/dist/index.d.ts @@ -0,0 +1 @@ +export { ssh } from './ssh.js'; diff --git a/node_modules/webpod/dist/index.js b/node_modules/webpod/dist/index.js new file mode 100755 index 0000000..d5ae441 --- /dev/null +++ b/node_modules/webpod/dist/index.js @@ -0,0 +1 @@ +export { ssh } from './ssh.js'; diff --git a/node_modules/webpod/dist/ssh.d.ts b/node_modules/webpod/dist/ssh.d.ts new file mode 100644 index 0000000..4884b6c --- /dev/null +++ b/node_modules/webpod/dist/ssh.d.ts @@ -0,0 +1,19 @@ +export type RemoteShell = ((pieces: TemplateStringsArray, ...values: any[]) => Promise) & { + 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'; diff --git a/node_modules/webpod/dist/ssh.js b/node_modules/webpod/dist/ssh.js new file mode 100644 index 0000000..ad45338 --- /dev/null +++ b/node_modules/webpod/dist/ssh.js @@ -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; + } +} diff --git a/node_modules/webpod/dist/utils.d.ts b/node_modules/webpod/dist/utils.d.ts new file mode 100644 index 0000000..8862aca --- /dev/null +++ b/node_modules/webpod/dist/utils.d.ts @@ -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; diff --git a/node_modules/webpod/dist/utils.js b/node_modules/webpod/dist/utils.js new file mode 100644 index 0000000..a92bfc8 --- /dev/null +++ b/node_modules/webpod/dist/utils.js @@ -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') + + `'`); +} diff --git a/node_modules/webpod/mod.ts b/node_modules/webpod/mod.ts new file mode 100644 index 0000000..a3ce71c --- /dev/null +++ b/node_modules/webpod/mod.ts @@ -0,0 +1,2 @@ +// @deno-types="./dist/index.d.ts" +export * from './dist/index.js' diff --git a/node_modules/webpod/package.json b/node_modules/webpod/package.json new file mode 100644 index 0000000..bfa2808 --- /dev/null +++ b/node_modules/webpod/package.json @@ -0,0 +1,25 @@ +{ + "name": "webpod", + "version": "0.0.2", + "description": "Self-hosted sites", + "type": "module", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "bin": { + "webpod": "dist/index.js" + }, + "scripts": { + "build": "tsc" + }, + "keywords": [ + "self-hosted" + ], + "author": "Anton Medvedev ", + "license": "MIT", + "homepage": "https://webpod.dev", + "repository": "webpod/webpod", + "devDependencies": { + "typescript": "^4.9.5", + "@types/node": "^18.14.0" + } +} diff --git a/node_modules/webpod/src/index.ts b/node_modules/webpod/src/index.ts new file mode 100644 index 0000000..2d58ce1 --- /dev/null +++ b/node_modules/webpod/src/index.ts @@ -0,0 +1 @@ +export {ssh} from './ssh.js' diff --git a/node_modules/webpod/src/ssh.ts b/node_modules/webpod/src/ssh.ts new file mode 100644 index 0000000..f6c3f8e --- /dev/null +++ b/node_modules/webpod/src/ssh.ts @@ -0,0 +1,188 @@ +import { spawn, spawnSync } from 'node:child_process' +import process from 'node:process' +import { controlPath, escapeshellarg } from './utils.js' + +export type RemoteShell = ( + (pieces: TemplateStringsArray, ...values: any[]) => Promise + ) & { + exit: () => void +} + +export type Options = { + port?: number | string + forwardAgent?: boolean + shell?: string + options?: (SshOption | `${SshOption}=${string}`)[] +} + +export function ssh(host: string, options: Options = {}): RemoteShell { + const $: RemoteShell = 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: any) => escapeshellarg(x)).join(' ') + } else { + s = escapeshellarg(values[i]) + } + cmd += s + pieces[++i] + } + let resolve: (out: Result) => void, reject: (out: Result) => void + const promise = new Promise((...args) => ([resolve, reject] = args)) + const shellID = 'id$' + Math.random().toString(36).slice(2) + const args: string[] = [ + 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: any) => { + stdout += data + combined += data + } + const onStderr = (data: any) => { + 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 { + 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) { + super(combined) + this.source = source + this.stdout = stdout + this.stderr = stderr + this.exitCode = exitCode + this.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' diff --git a/node_modules/webpod/src/utils.ts b/node_modules/webpod/src/utils.ts new file mode 100644 index 0000000..8fe32c9 --- /dev/null +++ b/node_modules/webpod/src/utils.ts @@ -0,0 +1,39 @@ +import fs from 'node:fs' +import os from 'node:os' +import process from 'node:process' + +export function isWritable(path: string): boolean { + try { + fs.accessSync(path, fs.constants.W_OK) + return true + } catch (err) { + return false + } +} + +export function controlPath(host: string) { + 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: string) { + 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') + + `'` + ) +} diff --git a/node_modules/webpod/tsconfig.json b/node_modules/webpod/tsconfig.json new file mode 100644 index 0000000..d4148a2 --- /dev/null +++ b/node_modules/webpod/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "ES2021", + "lib": [ + "ES2021" + ], + "module": "NodeNext", + "moduleResolution": "NodeNext", + "strict": true, + "declaration": true, + "outDir": "dist", + }, + "include": [ + "src/**/*" + ] +} diff --git a/node_modules/which/CHANGELOG.md b/node_modules/which/CHANGELOG.md deleted file mode 100644 index 7fb1f20..0000000 --- a/node_modules/which/CHANGELOG.md +++ /dev/null @@ -1,166 +0,0 @@ -# Changes - - -## 2.0.2 - -* Rename bin to `node-which` - -## 2.0.1 - -* generate changelog and publish on version bump -* enforce 100% test coverage -* Promise interface - -## 2.0.0 - -* Parallel tests, modern JavaScript, and drop support for node < 8 - -## 1.3.1 - -* update deps -* update travis - -## v1.3.0 - -* Add nothrow option to which.sync -* update tap - -## v1.2.14 - -* appveyor: drop node 5 and 0.x -* travis-ci: add node 6, drop 0.x - -## v1.2.13 - -* test: Pass missing option to pass on windows -* update tap -* update isexe to 2.0.0 -* neveragain.tech pledge request - -## v1.2.12 - -* Removed unused require - -## v1.2.11 - -* Prevent changelog script from being included in package - -## v1.2.10 - -* Use env.PATH only, not env.Path - -## v1.2.9 - -* fix for paths starting with ../ -* Remove unused `is-absolute` module - -## v1.2.8 - -* bullet items in changelog that contain (but don't start with) # - -## v1.2.7 - -* strip 'update changelog' changelog entries out of changelog - -## v1.2.6 - -* make the changelog bulleted - -## v1.2.5 - -* make a changelog, and keep it up to date -* don't include tests in package -* Properly handle relative-path executables -* appveyor -* Attach error code to Not Found error -* Make tests pass on Windows - -## v1.2.4 - -* Fix typo - -## v1.2.3 - -* update isexe, fix regression in pathExt handling - -## v1.2.2 - -* update deps, use isexe module, test windows - -## v1.2.1 - -* Sometimes windows PATH entries are quoted -* Fixed a bug in the check for group and user mode bits. This bug was introduced during refactoring for supporting strict mode. -* doc cli - -## v1.2.0 - -* Add support for opt.all and -as cli flags -* test the bin -* update travis -* Allow checking for multiple programs in bin/which -* tap 2 - -## v1.1.2 - -* travis -* Refactored and fixed undefined error on Windows -* Support strict mode - -## v1.1.1 - -* test +g exes against secondary groups, if available -* Use windows exe semantics on cygwin & msys -* cwd should be first in path on win32, not last -* Handle lower-case 'env.Path' on Windows -* Update docs -* use single-quotes - -## v1.1.0 - -* Add tests, depend on is-absolute - -## v1.0.9 - -* which.js: root is allowed to execute files owned by anyone - -## v1.0.8 - -* don't use graceful-fs - -## v1.0.7 - -* add license to package.json - -## v1.0.6 - -* isc license - -## 1.0.5 - -* Awful typo - -## 1.0.4 - -* Test for path absoluteness properly -* win: Allow '' as a pathext if cmd has a . in it - -## 1.0.3 - -* Remove references to execPath -* Make `which.sync()` work on Windows by honoring the PATHEXT variable. -* Make `isExe()` always return true on Windows. -* MIT - -## 1.0.2 - -* Only files can be exes - -## 1.0.1 - -* Respect the PATHEXT env for win32 support -* should 0755 the bin -* binary -* guts -* package -* 1st diff --git a/node_modules/which/README.md b/node_modules/which/README.md index cd83350..a6e86ab 100644 --- a/node_modules/which/README.md +++ b/node_modules/which/README.md @@ -9,30 +9,24 @@ needed when the PATH changes. ## USAGE ```javascript -var which = require('which') +const which = require('which') // async usage -which('node', function (er, resolvedPath) { - // er is returned if no "node" is found on the PATH - // if it is found, then the absolute path to the exec is returned -}) +// rejects if not found +const resolved = await which('node') -// or promise -which('node').then(resolvedPath => { ... }).catch(er => { ... not found ... }) +// if nothrow option is used, returns null if not found +const resolvedOrNull = await which('node', { nothrow: true }) // sync usage // throws if not found -var resolved = which.sync('node') +const resolved = which.sync('node') // if nothrow option is used, returns null if not found -resolved = which.sync('node', {nothrow: true}) +const resolvedOrNull = which.sync('node', { nothrow: true }) // Pass options to override the PATH and PATHEXT environment vars. -which('node', { path: someOtherPath }, function (er, resolved) { - if (er) - throw er - console.log('found at %j', resolved) -}) +await which('node', { path: someOtherPath, pathExt: somePathExt }) ``` ## CLI USAGE diff --git a/node_modules/which/bin/node-which b/node_modules/which/bin/node-which deleted file mode 100755 index 7cee372..0000000 --- a/node_modules/which/bin/node-which +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env node -var which = require("../") -if (process.argv.length < 3) - usage() - -function usage () { - console.error('usage: which [-as] program ...') - process.exit(1) -} - -var all = false -var silent = false -var dashdash = false -var args = process.argv.slice(2).filter(function (arg) { - if (dashdash || !/^-/.test(arg)) - return true - - if (arg === '--') { - dashdash = true - return false - } - - var flags = arg.substr(1).split('') - for (var f = 0; f < flags.length; f++) { - var flag = flags[f] - switch (flag) { - case 's': - silent = true - break - case 'a': - all = true - break - default: - console.error('which: illegal option -- ' + flag) - usage() - } - } - return false -}) - -process.exit(args.reduce(function (pv, current) { - try { - var f = which.sync(current, { all: all }) - if (all) - f = f.join('\n') - if (!silent) - console.log(f) - return pv; - } catch (e) { - return 1; - } -}, 0)) diff --git a/node_modules/which/bin/which.js b/node_modules/which/bin/which.js new file mode 100755 index 0000000..6df16f2 --- /dev/null +++ b/node_modules/which/bin/which.js @@ -0,0 +1,52 @@ +#!/usr/bin/env node + +const which = require('../lib') +const argv = process.argv.slice(2) + +const usage = (err) => { + if (err) { + console.error(`which: ${err}`) + } + console.error('usage: which [-as] program ...') + process.exit(1) +} + +if (!argv.length) { + return usage() +} + +let dashdash = false +const [commands, flags] = argv.reduce((acc, arg) => { + if (dashdash || arg === '--') { + dashdash = true + return acc + } + + if (!/^-/.test(arg)) { + acc[0].push(arg) + return acc + } + + for (const flag of arg.slice(1).split('')) { + if (flag === 's') { + acc[1].silent = true + } else if (flag === 'a') { + acc[1].all = true + } else { + usage(`illegal option -- ${flag}`) + } + } + + return acc +}, [[], {}]) + +for (const command of commands) { + try { + const res = which.sync(command, { all: flags.all }) + if (!flags.silent) { + console.log([].concat(res).join('\n')) + } + } catch (err) { + process.exitCode = 1 + } +} diff --git a/node_modules/which/lib/index.js b/node_modules/which/lib/index.js new file mode 100644 index 0000000..8de3388 --- /dev/null +++ b/node_modules/which/lib/index.js @@ -0,0 +1,110 @@ +const isexe = require('isexe') +const { join, delimiter, sep, posix } = require('path') + +const isWindows = process.platform === 'win32' + +// used to check for slashed in commands passed in. always checks for the posix +// seperator on all platforms, and checks for the current separator when not on +// a posix platform. don't use the isWindows check for this since that is mocked +// in tests but we still need the code to actually work when called. that is also +// why it is ignored from coverage. +/* istanbul ignore next */ +const rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? '' : sep}]`.replace(/(\\)/g, '\\$1')) +const rRel = new RegExp(`^\\.${rSlash.source}`) + +const getNotFoundError = (cmd) => + Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' }) + +const getPathInfo = (cmd, { + path: optPath = process.env.PATH, + pathExt: optPathExt = process.env.PATHEXT, + delimiter: optDelimiter = delimiter, +}) => { + // If it has a slash, then we don't bother searching the pathenv. + // just check the file itself, and that's it. + const pathEnv = cmd.match(rSlash) ? [''] : [ + // windows always checks the cwd first + ...(isWindows ? [process.cwd()] : []), + ...(optPath || /* istanbul ignore next: very unusual */ '').split(optDelimiter), + ] + + if (isWindows) { + const pathExtExe = optPathExt || ['.EXE', '.CMD', '.BAT', '.COM'].join(optDelimiter) + const pathExt = pathExtExe.split(optDelimiter) + if (cmd.includes('.') && pathExt[0] !== '') { + pathExt.unshift('') + } + return { pathEnv, pathExt, pathExtExe } + } + + return { pathEnv, pathExt: [''] } +} + +const getPathPart = (raw, cmd) => { + const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw + const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : '' + return prefix + join(pathPart, cmd) +} + +const which = async (cmd, opt = {}) => { + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + for (const envPart of pathEnv) { + const p = getPathPart(envPart, cmd) + + for (const ext of pathExt) { + const withExt = p + ext + const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true }) + if (is) { + if (!opt.all) { + return withExt + } + found.push(withExt) + } + } + } + + if (opt.all && found.length) { + return found + } + + if (opt.nothrow) { + return null + } + + throw getNotFoundError(cmd) +} + +const whichSync = (cmd, opt = {}) => { + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + for (const pathEnvPart of pathEnv) { + const p = getPathPart(pathEnvPart, cmd) + + for (const ext of pathExt) { + const withExt = p + ext + const is = isexe.sync(withExt, { pathExt: pathExtExe, ignoreErrors: true }) + if (is) { + if (!opt.all) { + return withExt + } + found.push(withExt) + } + } + } + + if (opt.all && found.length) { + return found + } + + if (opt.nothrow) { + return null + } + + throw getNotFoundError(cmd) +} + +module.exports = which +which.sync = whichSync diff --git a/node_modules/which/package.json b/node_modules/which/package.json index 97ad7fb..bde1563 100644 --- a/node_modules/which/package.json +++ b/node_modules/which/package.json @@ -1,43 +1,50 @@ { - "author": "Isaac Z. Schlueter (http://blog.izs.me)", + "author": "GitHub Inc.", "name": "which", "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", - "version": "2.0.2", + "version": "3.0.0", "repository": { "type": "git", - "url": "git://github.com/isaacs/node-which.git" + "url": "https://github.com/npm/node-which.git" }, - "main": "which.js", + "main": "lib/index.js", "bin": { - "node-which": "./bin/node-which" + "node-which": "./bin/which.js" }, "license": "ISC", "dependencies": { "isexe": "^2.0.0" }, "devDependencies": { - "mkdirp": "^0.5.0", - "rimraf": "^2.6.2", - "tap": "^14.6.9" + "@npmcli/eslint-config": "^4.0.0", + "@npmcli/template-oss": "4.8.0", + "tap": "^16.3.0" }, "scripts": { "test": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "prepublish": "npm run changelog", - "prechangelog": "bash gen-changelog.sh", - "changelog": "git add CHANGELOG.md", - "postchangelog": "git commit -m 'update changelog - '${npm_package_version}", - "postpublish": "git push origin --follow-tags" + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "snap": "tap", + "posttest": "npm run lint" }, "files": [ - "which.js", - "bin/node-which" + "bin/", + "lib/" ], "tap": { - "check-coverage": true + "check-coverage": true, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] }, "engines": { - "node": ">= 8" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.8.0" } } diff --git a/node_modules/which/which.js b/node_modules/which/which.js deleted file mode 100644 index 82afffd..0000000 --- a/node_modules/which/which.js +++ /dev/null @@ -1,125 +0,0 @@ -const isWindows = process.platform === 'win32' || - process.env.OSTYPE === 'cygwin' || - process.env.OSTYPE === 'msys' - -const path = require('path') -const COLON = isWindows ? ';' : ':' -const isexe = require('isexe') - -const getNotFoundError = (cmd) => - Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' }) - -const getPathInfo = (cmd, opt) => { - const colon = opt.colon || COLON - - // If it has a slash, then we don't bother searching the pathenv. - // just check the file itself, and that's it. - const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [''] - : ( - [ - // windows always checks the cwd first - ...(isWindows ? [process.cwd()] : []), - ...(opt.path || process.env.PATH || - /* istanbul ignore next: very unusual */ '').split(colon), - ] - ) - const pathExtExe = isWindows - ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' - : '' - const pathExt = isWindows ? pathExtExe.split(colon) : [''] - - if (isWindows) { - if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') - pathExt.unshift('') - } - - return { - pathEnv, - pathExt, - pathExtExe, - } -} - -const which = (cmd, opt, cb) => { - if (typeof opt === 'function') { - cb = opt - opt = {} - } - if (!opt) - opt = {} - - const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) - const found = [] - - const step = i => new Promise((resolve, reject) => { - if (i === pathEnv.length) - return opt.all && found.length ? resolve(found) - : reject(getNotFoundError(cmd)) - - const ppRaw = pathEnv[i] - const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw - - const pCmd = path.join(pathPart, cmd) - const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd - : pCmd - - resolve(subStep(p, i, 0)) - }) - - const subStep = (p, i, ii) => new Promise((resolve, reject) => { - if (ii === pathExt.length) - return resolve(step(i + 1)) - const ext = pathExt[ii] - isexe(p + ext, { pathExt: pathExtExe }, (er, is) => { - if (!er && is) { - if (opt.all) - found.push(p + ext) - else - return resolve(p + ext) - } - return resolve(subStep(p, i, ii + 1)) - }) - }) - - return cb ? step(0).then(res => cb(null, res), cb) : step(0) -} - -const whichSync = (cmd, opt) => { - opt = opt || {} - - const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) - const found = [] - - for (let i = 0; i < pathEnv.length; i ++) { - const ppRaw = pathEnv[i] - const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw - - const pCmd = path.join(pathPart, cmd) - const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd - : pCmd - - for (let j = 0; j < pathExt.length; j ++) { - const cur = p + pathExt[j] - try { - const is = isexe.sync(cur, { pathExt: pathExtExe }) - if (is) { - if (opt.all) - found.push(cur) - else - return cur - } - } catch (ex) {} - } - } - - if (opt.all && found.length) - return found - - if (opt.nothrow) - return null - - throw getNotFoundError(cmd) -} - -module.exports = which -which.sync = whichSync diff --git a/node_modules/zx/README.md b/node_modules/zx/README.md index 3b96c18..bd86a8e 100644 --- a/node_modules/zx/README.md +++ b/node_modules/zx/README.md @@ -35,10 +35,13 @@ npm i -g zx ## Goods -[$](#command-) · [cd()](#cd) · [fetch()](#fetch) · [question()](#question) · [sleep()](#sleep) · [echo()](#echo) · [stdin()](#stdin) · [within()](#within) · +[$](#command-) · [cd()](#cd) · [fetch()](#fetch) · [question()](#question) · [sleep()](#sleep) · [echo()](#echo) · [stdin()](#stdin) · [within()](#within) · [retry()](#retry) · [spinner()](#spinner) · [chalk](#chalk-package) · [fs](#fs-package) · [os](#os-package) · [path](#path-package) · [glob](#globby-package) · [yaml](#yaml-package) · [minimist](#minimist-package) · [which](#which-package) · [__filename](#__filename--__dirname) · [__dirname](#__filename--__dirname) · [require()](#require) +For running commands on remote hosts, +see [webpod](https://github.com/webpod/webpod). + ## Documentation Write your scripts in a file with an `.mjs` extension in order to @@ -46,11 +49,13 @@ use `await` at the top level. If you prefer the `.js` extension, wrap your scripts in something like `void async function () {...}()`. Add the following shebang to the beginning of your `zx` scripts: + ```bash #!/usr/bin/env zx ``` Now you will be able to run your script like so: + ```bash chmod +x ./script.mjs ./script.mjs @@ -117,9 +122,13 @@ class ProcessPromise extends Promise { stdout: Readable stderr: Readable exitCode: Promise + pipe(dest): ProcessPromise + kill(): Promise + nothrow(): this + quiet(): this } ``` @@ -134,11 +143,13 @@ class ProcessOutput { readonly stderr: string readonly signal: string readonly exitCode: number + toString(): string // Combined stdout & stderr. } ``` -The output of the process is captured as-is. Usually, programs print a new line `\n` at the end. +The output of the process is captured as-is. Usually, programs print a new +line `\n` at the end. If `ProcessOutput` is used as an argument to some other `$` process, **zx** will use stdout and trim the new line. @@ -160,7 +171,8 @@ await $`pwd` // => /tmp ### `fetch()` -A wrapper around the [node-fetch](https://www.npmjs.com/package/node-fetch) package. +A wrapper around the [node-fetch](https://www.npmjs.com/package/node-fetch) +package. ```js let resp = await fetch('https://medv.io') @@ -228,6 +240,32 @@ let version = await within(async () => { }) ``` +### `retry()` + +Retries a callback for a few times. Will return after the first +successful attempt, or will throw after specifies attempts count. + +```js +let p = await retry(10, () => $`curl https://medv.io`) + +// With a specified delay between attempts. +let p = await retry(20, '1s', () => $`curl https://medv.io`) + +// With an exponential backoff. +let p = await retry(30, expBackoff(), () => $`curl https://medv.io`) +``` + +### `spinner()` + +Starts a simple CLI spinner. + +```js +await spinner(() => $`long-running command`) + +// With a message. +await spinner('working...', () => $`sleep 99`) +``` + ## Packages The following packages are available without importing inside scripts. @@ -286,7 +324,9 @@ The [minimist](https://www.npmjs.com/package/minimist) package available as global const `argv`. ```js -if( argv.someFlag ){ echo('yes') } +if (argv.someFlag) { + echo('yes') +} ``` ### `which` package @@ -372,7 +412,8 @@ $.log = (entry: LogEntry) => { ### `__filename` & `__dirname` In [ESM](https://nodejs.org/api/esm.html) modules, Node.js does not provide -`__filename` and `__dirname` globals. As such globals are really handy in scripts, +`__filename` and `__dirname` globals. As such globals are really handy in +scripts, `zx` provides these for use in `.mjs` files (when using the `zx` executable). ### `require()` @@ -386,42 +427,6 @@ files (when using `zx` executable). let {version} = require('./package.json') ``` -## Experimental - -The zx provides a few experimental functions. Please leave feedback about -those features in [the discussion](https://github.com/google/zx/discussions/299). -To enable new features via CLI pass `--experimental` flag. - -### `retry()` - -Retries a callback for a few times. Will return after the first -successful attempt, or will throw after specifies attempts count. - -```js -import { retry, expBackoff } from 'zx/experimental' - -let p = await retry(10, () => $`curl https://medv.io`) - -// With a specified delay between attempts. -let p = await retry(20, '1s', () => $`curl https://medv.io`) - -// With an exponential backoff. -let p = await retry(30, expBackoff(), () => $`curl https://medv.io`) -``` - -### `spinner()` - -Starts a simple CLI spinner. - -```js -import { spinner } from 'zx/experimental' - -await spinner(() => $`long-running command`) - -// With a message. -await spinner('working...', () => $`sleep 99`) -``` - ## FAQ ### Passing env variables @@ -433,10 +438,12 @@ await $`echo $FOO` ### Passing array of values -When passing an array of values as an argument to `$`, items of the array will be escaped +When passing an array of values as an argument to `$`, items of the array will +be escaped individually and concatenated via space. Example: + ```js let files = [...] await $`tar cz ${files}` @@ -448,14 +455,16 @@ It is possible to make use of `$` and other functions via explicit imports: ```js #!/usr/bin/env node -import {$} from 'zx' +import { $ } from 'zx' + await $`date` ``` ### Scripts without extensions If script does not have a file extension (like `.git/hooks/pre-commit`), zx -assumes that it is an [ESM](https://nodejs.org/api/modules.html#modules_module_createrequire_filename) +assumes that it is +an [ESM](https://nodejs.org/api/modules.html#modules_module_createrequire_filename) module. ### Markdown scripts @@ -469,7 +478,7 @@ zx docs/markdown.md ### TypeScript scripts ```ts -import {$} from 'zx' +import { $ } from 'zx' // Or import 'zx/globals' @@ -479,7 +488,8 @@ void async function () { ``` Set [`"type": "module"`](https://nodejs.org/api/packages.html#packages_type) -in **package.json** and [`"module": "ESNext"`](https://www.typescriptlang.org/tsconfig/#module) +in **package.json** +and [`"module": "ESNext"`](https://www.typescriptlang.org/tsconfig/#module) in **tsconfig.json**. ### Executing remote scripts @@ -496,7 +506,7 @@ zx https://medv.io/game-of-life.js The `zx` supports executing scripts from stdin. ```js -zx <<'EOF' +zx << 'EOF' await $`pwd` EOF ``` @@ -514,27 +524,41 @@ cat package.json | zx --eval 'let v = JSON.parse(await stdin()).version; echo(v) ```js // script.mjs: import sh from 'tinysh' + sh.say('Hello, world!') ``` -Add `--install` flag to the `zx` command to install missing dependencies +Add `--install` flag to the `zx` command to install missing dependencies automatically. ```bash zx --install script.mjs ``` -You can also specify needed version by adding comment with `@` after +You can also specify needed version by adding comment with `@` after the import. ```js import sh from 'tinysh' // @^1 ``` +### Executing commands on remote hosts + +The `zx` uses [webpod](https://github.com/webpod/webpod) to execute commands on +remote hosts. + +```js +import { ssh } from 'zx' + +await ssh('user@host')`echo Hello, world!` +``` + + + ### Attaching a profile By default `child_process` does not include aliases and bash functions. -But you are still able to do it by hand. Just attach necessary directives +But you are still able to do it by hand. Just attach necessary directives to the `$.prefix`. ```js @@ -551,19 +575,22 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Build - env: - FORCE_COLOR: 3 - run: | - npx zx <<'EOF' - await $`...` - EOF + - name: Build + env: + FORCE_COLOR: 3 + run: | + npx zx <<'EOF' + await $`...` + EOF ``` ### Canary / Beta / RC builds -Impatient early adopters can try the experimental zx versions. But keep in mind: these builds are ⚠️️ __unstable__ in every sense. + +Impatient early adopters can try the experimental zx versions. +But keep in mind: these builds are ⚠️️__beta__ in every sense. + ```bash npm i zx@dev npx zx@dev --install --quiet <<< 'import _ from "lodash" /* 4.17.15 */; console.log(_.VERSION)' diff --git a/node_modules/zx/build/cli.js b/node_modules/zx/build/cli.js index 9e99cdb..7b52c2c 100755 --- a/node_modules/zx/build/cli.js +++ b/node_modules/zx/build/cli.js @@ -167,7 +167,11 @@ function transformMarkdown(buf) { const source = buf.toString(); const output = []; let state = 'root'; + let codeBlockEnd = ''; let prevLineIsEmpty = true; + const jsCodeBlock = /^(```+|~~~+)(js|javascript)$/; + const shCodeBlock = /^(```+|~~~+)(sh|bash)$/; + const otherCodeBlock = /^(```+|~~~+)(.*)$/; for (let line of source.split('\n')) { switch (state) { case 'root': @@ -175,17 +179,20 @@ function transformMarkdown(buf) { output.push(line); state = 'tab'; } - else if (/^```(js|javascript)$/.test(line)) { + else if (jsCodeBlock.test(line)) { output.push(''); state = 'js'; + codeBlockEnd = line.match(jsCodeBlock)[1]; } - else if (/^```(sh|bash)$/.test(line)) { + else if (shCodeBlock.test(line)) { output.push('await $`'); state = 'bash'; + codeBlockEnd = line.match(shCodeBlock)[1]; } - else if (/^```.*$/.test(line)) { + else if (otherCodeBlock.test(line)) { output.push(''); state = 'other'; + codeBlockEnd = line.match(otherCodeBlock)[1]; } else { prevLineIsEmpty = line === ''; @@ -205,7 +212,7 @@ function transformMarkdown(buf) { } break; case 'js': - if (/^```$/.test(line)) { + if (line === codeBlockEnd) { output.push(''); state = 'root'; } @@ -214,7 +221,7 @@ function transformMarkdown(buf) { } break; case 'bash': - if (/^```$/.test(line)) { + if (line === codeBlockEnd) { output.push('`'); state = 'root'; } @@ -223,7 +230,7 @@ function transformMarkdown(buf) { } break; case 'other': - if (/^```$/.test(line)) { + if (line === codeBlockEnd) { output.push(''); state = 'root'; } diff --git a/node_modules/zx/build/core.d.ts b/node_modules/zx/build/core.d.ts index fe59347..6409a0f 100644 --- a/node_modules/zx/build/core.d.ts +++ b/node_modules/zx/build/core.d.ts @@ -8,9 +8,9 @@ import { Readable, Writable } from 'node:stream'; import { inspect } from 'node:util'; import { RequestInfo, RequestInit } from 'node-fetch'; import { Duration, noop, quote } from './util.js'; -export declare type Shell = (pieces: TemplateStringsArray, ...args: any[]) => ProcessPromise; +export type Shell = (pieces: TemplateStringsArray, ...args: any[]) => ProcessPromise; declare const processCwd: unique symbol; -export declare type Options = { +export type Options = { [processCwd]: string; cwd?: string; verbose: boolean; @@ -23,8 +23,8 @@ export declare type Options = { }; export declare const defaults: Options; export declare const $: Shell & Options; -declare type Resolve = (out: ProcessOutput) => void; -declare type IO = StdioPipe | StdioNull; +type Resolve = (out: ProcessOutput) => void; +type IO = StdioPipe | StdioNull; export declare class ProcessPromise extends Promise { child?: ChildProcess; private _command; @@ -75,7 +75,7 @@ export declare class ProcessOutput extends Error { } export declare function within(callback: () => R): R; export declare function cd(dir: string): void; -export declare type LogEntry = { +export type LogEntry = { kind: 'cmd'; verbose: boolean; cmd: string; diff --git a/node_modules/zx/build/experimental.d.ts b/node_modules/zx/build/experimental.d.ts index f8e60b3..4f14540 100644 --- a/node_modules/zx/build/experimental.d.ts +++ b/node_modules/zx/build/experimental.d.ts @@ -1,6 +1 @@ -import { Duration } from './util.js'; -export declare function retry(count: number, callback: () => T): Promise; -export declare function retry(count: number, duration: Duration | Generator, callback: () => T): Promise; -export declare function expBackoff(max?: Duration, rand?: Duration): Generator; -export declare function spinner(callback: () => T): Promise; -export declare function spinner(title: string, callback: () => T): Promise; +export { spinner, retry, expBackoff, echo } from './goods.js'; diff --git a/node_modules/zx/build/experimental.js b/node_modules/zx/build/experimental.js index 5d1b853..db45e47 100644 --- a/node_modules/zx/build/experimental.js +++ b/node_modules/zx/build/experimental.js @@ -11,84 +11,5 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -import assert from 'node:assert'; -import chalk from 'chalk'; -import { $, within } from './core.js'; -import { sleep } from './goods.js'; -import { parseDuration } from './util.js'; -export async function retry(count, a, b) { - const total = count; - let callback; - let delayStatic = 0; - let delayGen; - if (typeof a == 'function') { - callback = a; - } - else { - if (typeof a == 'object') { - delayGen = a; - } - else { - delayStatic = parseDuration(a); - } - assert(b); - callback = b; - } - let lastErr; - let attempt = 0; - while (count-- > 0) { - attempt++; - try { - return await callback(); - } - catch (err) { - let delay = 0; - if (delayStatic > 0) - delay = delayStatic; - if (delayGen) - delay = delayGen.next().value; - $.log({ - kind: 'retry', - error: chalk.bgRed.white(' FAIL ') + - ` Attempt: ${attempt}${total == Infinity ? '' : `/${total}`}` + - (delay > 0 ? `; next in ${delay}ms` : ''), - }); - lastErr = err; - if (count == 0) - break; - if (delay) - await sleep(delay); - } - } - throw lastErr; -} -export function* expBackoff(max = '60s', rand = '100ms') { - const maxMs = parseDuration(max); - const randMs = parseDuration(rand); - let n = 1; - while (true) { - const ms = Math.floor(Math.random() * randMs); - yield Math.min(2 ** n++, maxMs) + ms; - } -} -export async function spinner(title, callback) { - if (typeof title == 'function') { - callback = title; - title = ''; - } - let i = 0; - const spin = () => process.stderr.write(` ${'⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'[i++ % 10]} ${title}\r`); - return within(async () => { - $.verbose = false; - const id = setInterval(spin, 100); - let result; - try { - result = await callback(); - } - finally { - clearInterval(id); - process.stderr.write(' '.repeat(process.stdout.columns - 1) + '\r'); - } - return result; - }); -} +// TODO(antonmedv): Remove this export in next v8 release. +export { spinner, retry, expBackoff, echo } from './goods.js'; diff --git a/node_modules/zx/build/globals.d.ts b/node_modules/zx/build/globals.d.ts index 0da4048..23b6de2 100644 --- a/node_modules/zx/build/globals.d.ts +++ b/node_modules/zx/build/globals.d.ts @@ -13,6 +13,7 @@ declare global { var cd: typeof _.cd; var chalk: typeof _.chalk; var echo: typeof _.echo; + var expBackoff: typeof _.expBackoff; var fs: typeof _.fs; var glob: typeof _.glob; var globby: typeof _.globby; @@ -23,7 +24,10 @@ declare global { var quiet: typeof _.quiet; var quote: typeof _.quote; var quotePowerShell: typeof _.quotePowerShell; + var retry: typeof _.retry; var sleep: typeof _.sleep; + var spinner: typeof _.spinner; + var ssh: typeof _.ssh; var stdin: typeof _.stdin; var which: typeof _.which; var within: typeof _.within; diff --git a/node_modules/zx/build/goods.d.ts b/node_modules/zx/build/goods.d.ts index ddf63da..b1fb938 100644 --- a/node_modules/zx/build/goods.d.ts +++ b/node_modules/zx/build/goods.d.ts @@ -8,6 +8,7 @@ export { default as which } from 'which'; export { default as YAML } from 'yaml'; export { default as path } from 'node:path'; export { default as os } from 'node:os'; +export { ssh } from 'webpod'; export declare let argv: minimist.ParsedArgs; export declare function updateArgv(args: string[]): void; export declare const globby: ((patterns: string | readonly string[], options?: globbyModule.Options) => Promise) & typeof globbyModule; @@ -19,3 +20,8 @@ export declare function question(query?: string, options?: { choices: string[]; }): Promise; export declare function stdin(): Promise; +export declare function retry(count: number, callback: () => T): Promise; +export declare function retry(count: number, duration: Duration | Generator, callback: () => T): Promise; +export declare function expBackoff(max?: Duration, rand?: Duration): Generator; +export declare function spinner(callback: () => T): Promise; +export declare function spinner(title: string, callback: () => T): Promise; diff --git a/node_modules/zx/build/goods.js b/node_modules/zx/build/goods.js index d361d29..28a13e7 100644 --- a/node_modules/zx/build/goods.js +++ b/node_modules/zx/build/goods.js @@ -11,18 +11,21 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +import assert from 'node:assert'; import * as globbyModule from 'globby'; import minimist from 'minimist'; import nodeFetch from 'node-fetch'; import { createInterface } from 'node:readline'; -import { $, ProcessOutput } from './core.js'; +import { $, within, ProcessOutput } from './core.js'; import { isString, parseDuration } from './util.js'; +import chalk from 'chalk'; export { default as chalk } from 'chalk'; export { default as fs } from 'fs-extra'; export { default as which } from 'which'; export { default as YAML } from 'yaml'; export { default as path } from 'node:path'; export { default as os } from 'node:os'; +export { ssh } from 'webpod'; export let argv = minimist(process.argv.slice(2)); export function updateArgv(args) { argv = minimist(args); @@ -90,3 +93,79 @@ export async function stdin() { } return buf; } +export async function retry(count, a, b) { + const total = count; + let callback; + let delayStatic = 0; + let delayGen; + if (typeof a == 'function') { + callback = a; + } + else { + if (typeof a == 'object') { + delayGen = a; + } + else { + delayStatic = parseDuration(a); + } + assert(b); + callback = b; + } + let lastErr; + let attempt = 0; + while (count-- > 0) { + attempt++; + try { + return await callback(); + } + catch (err) { + let delay = 0; + if (delayStatic > 0) + delay = delayStatic; + if (delayGen) + delay = delayGen.next().value; + $.log({ + kind: 'retry', + error: chalk.bgRed.white(' FAIL ') + + ` Attempt: ${attempt}${total == Infinity ? '' : `/${total}`}` + + (delay > 0 ? `; next in ${delay}ms` : ''), + }); + lastErr = err; + if (count == 0) + break; + if (delay) + await sleep(delay); + } + } + throw lastErr; +} +export function* expBackoff(max = '60s', rand = '100ms') { + const maxMs = parseDuration(max); + const randMs = parseDuration(rand); + let n = 1; + while (true) { + const ms = Math.floor(Math.random() * randMs); + yield Math.min(2 ** n++, maxMs) + ms; + } +} +export async function spinner(title, callback) { + if (typeof title == 'function') { + callback = title; + title = ''; + } + let i = 0; + const spin = () => process.stderr.write(` ${'⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'[i++ % 10]} ${title}\r`); + return within(async () => { + $.verbose = false; + const id = setInterval(spin, 100); + let result; + try { + result = await callback(); + } + finally { + clearInterval(id); + process.stderr.write(' '.repeat(process.stdout.columns - 1) + '\r'); + } + return result; + }); +} diff --git a/node_modules/zx/build/index.d.ts b/node_modules/zx/build/index.d.ts index 8680155..ee5175d 100644 --- a/node_modules/zx/build/index.d.ts +++ b/node_modules/zx/build/index.d.ts @@ -1,6 +1,6 @@ import { ProcessPromise } from './core.js'; -export { $, Shell, Options, ProcessPromise, ProcessOutput, within, cd, log, LogEntry, } from './core.js'; -export { argv, chalk, echo, fetch, fs, glob, globby, os, path, question, sleep, stdin, which, YAML, } from './goods.js'; +export * from './core.js'; +export * from './goods.js'; export { Duration, quote, quotePowerShell } from './util.js'; /** * @deprecated Use $.nothrow() instead. diff --git a/node_modules/zx/build/index.js b/node_modules/zx/build/index.js index 4b9a5c7..f93bfe7 100644 --- a/node_modules/zx/build/index.js +++ b/node_modules/zx/build/index.js @@ -11,8 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -export { $, ProcessPromise, ProcessOutput, within, cd, log, } from './core.js'; -export { argv, chalk, echo, fetch, fs, glob, globby, os, path, question, sleep, stdin, which, YAML, } from './goods.js'; +export * from './core.js'; +export * from './goods.js'; export { quote, quotePowerShell } from './util.js'; /** * @deprecated Use $.nothrow() instead. diff --git a/node_modules/zx/build/util.d.ts b/node_modules/zx/build/util.d.ts index 8b0efc5..836338c 100644 --- a/node_modules/zx/build/util.d.ts +++ b/node_modules/zx/build/util.d.ts @@ -7,6 +7,6 @@ export declare function quote(arg: string): string; export declare function quotePowerShell(arg: string): string; export declare function exitCodeInfo(exitCode: number | null): string | undefined; export declare function errnoMessage(errno: number | undefined): string; -export declare type Duration = number | `${number}s` | `${number}ms`; +export type Duration = number | `${number}s` | `${number}ms`; export declare function parseDuration(d: Duration): number; export declare function formatCmd(cmd?: string): string; diff --git a/node_modules/zx/package.json b/node_modules/zx/package.json index c813989..733bfb8 100644 --- a/node_modules/zx/package.json +++ b/node_modules/zx/package.json @@ -1,6 +1,6 @@ { "name": "zx", - "version": "7.1.1", + "version": "7.2.1", "description": "A tool for writing better scripts.", "type": "module", "main": "./build/index.js", @@ -50,27 +50,28 @@ "circular": "madge --circular src/*" }, "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" }, "devDependencies": { - "@stryker-mutator/core": "^6.2.2", - "c8": "^7.12.0", - "madge": "^5.0.1", - "prettier": "^2.7.1", - "tsd": "^0.24.1", - "typescript": "^4.8.3", + "@stryker-mutator/core": "^6.4.1", + "c8": "^7.13.0", + "madge": "^6.0.0", + "prettier": "^2.8.4", + "tsd": "^0.25.0", + "typescript": "^4.9.5", "uvu": "^0.5.6" }, "publishConfig": { diff --git a/package-lock.json b/package-lock.json index cf142d4..f712c20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "": { "dependencies": { "@actions/core": "^1.10.0", - "zx": "^7.1.1" + "zx": "^7.2.1" }, "engines": { "node": ">=16" @@ -62,9 +62,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": "*" } @@ -75,9 +84,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", @@ -85,9 +94,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", @@ -222,16 +231,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": { @@ -264,9 +273,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", @@ -306,7 +315,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", @@ -345,9 +354,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" } @@ -556,18 +565,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": { @@ -579,23 +596,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" @@ -647,9 +665,18 @@ } }, "@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==", + "requires": { + "@types/jsonfile": "*", + "@types/node": "*" + } + }, + "@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==", "requires": { "@types/node": "*" } @@ -660,9 +687,9 @@ "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==" }, "@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==" }, "@types/ps-tree": { "version": "1.1.2", @@ -670,9 +697,9 @@ "integrity": "sha512-ZREFYlpUmPQJ0esjxoG1fMvB2HNaD3z+mjqdSosZvd3RalncI9NEur73P8ZJz4YQdL64CmV1w0RuqoRUlhQRBw==" }, "@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==" }, "braces": { "version": "3.0.2", @@ -770,9 +797,9 @@ "integrity": "sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==" }, "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==", "requires": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", @@ -800,9 +827,9 @@ } }, "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==" }, "ignore": { "version": "5.2.4", @@ -830,7 +857,7 @@ "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==" }, "jsonfile": { "version": "6.1.0", @@ -861,9 +888,9 @@ } }, "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==" }, "node-domexception": { "version": "1.0.0", @@ -978,10 +1005,15 @@ "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==" }, + "webpod": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/webpod/-/webpod-0.0.2.tgz", + "integrity": "sha512-cSwwQIeg8v4i3p4ajHhwgR7N6VyxAf+KYSSsY6Pd3aETE+xEU4vbitz7qQkB0I321xnhDdgtxuiSfk5r/FVtjg==" + }, "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==", "requires": { "isexe": "^2.0.0" } @@ -992,23 +1024,24 @@ "integrity": "sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==" }, "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==", "requires": { - "@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" } } } diff --git a/package.json b/package.json index 60fcd6c..f6b4a74 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "type": "module", "dependencies": { "@actions/core": "^1.10.0", - "zx": "^7.1.1" + "zx": "^7.2.1" }, "engines": { "node": ">=16"