diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 7eb50bfb11..6936e37754 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -1285,22 +1285,22 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/ava": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/ava/-/ava-4.3.3.tgz", - "integrity": "sha512-9Egq/d9R74ExrWohHeqUlexjDbgZJX5jA1Wq4KCTqc3wIfpGEK79zVy4rBtofJ9YKIxs4PzhJ8BgbW5PlAYe6w==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/ava/-/ava-5.1.1.tgz", + "integrity": "sha512-od1CWgWVIKZSdEc1dhQWhbsd6KBs0EYjek7eqZNGPvy+NyC9Q1bXixcadlgOXwDG9aM0zLMQZwRXfe9gMb1LQQ==", "dev": true, "dependencies": { - "acorn": "^8.7.1", + "acorn": "^8.8.1", "acorn-walk": "^8.2.0", - "ansi-styles": "^6.1.0", + "ansi-styles": "^6.2.1", "arrgv": "^1.0.2", "arrify": "^3.0.0", "callsites": "^4.0.0", "cbor": "^8.1.0", - "chalk": "^5.0.1", + "chalk": "^5.2.0", "chokidar": "^3.5.3", "chunkd": "^2.0.1", - "ci-info": "^3.3.1", + "ci-info": "^3.7.1", "ci-parallel-vars": "^1.0.1", "clean-yaml-object": "^0.1.0", "cli-truncate": "^3.1.0", @@ -1309,10 +1309,10 @@ "concordance": "^5.0.4", "currently-unhandled": "^0.4.1", "debug": "^4.3.4", - "del": "^6.1.1", - "emittery": "^0.11.0", - "figures": "^4.0.1", - "globby": "^13.1.1", + "del": "^7.0.0", + "emittery": "^1.0.1", + "figures": "^5.0.0", + "globby": "^13.1.3", "ignore-by-default": "^2.1.0", "indent-string": "^5.0.0", "is-error": "^2.2.2", @@ -1322,25 +1322,25 @@ "mem": "^9.0.2", "ms": "^2.1.3", "p-event": "^5.0.1", - "p-map": "^5.4.0", + "p-map": "^5.5.0", "picomatch": "^2.3.1", "pkg-conf": "^4.0.0", "plur": "^5.1.0", - "pretty-ms": "^7.0.1", + "pretty-ms": "^8.0.0", "resolve-cwd": "^3.0.0", "slash": "^3.0.0", - "stack-utils": "^2.0.5", + "stack-utils": "^2.0.6", "strip-ansi": "^7.0.1", "supertap": "^3.0.1", - "temp-dir": "^2.0.0", - "write-file-atomic": "^4.0.1", - "yargs": "^17.5.1" + "temp-dir": "^3.0.0", + "write-file-atomic": "^5.0.0", + "yargs": "^17.6.2" }, "bin": { "ava": "entrypoints/cli.mjs" }, "engines": { - "node": ">=12.22 <13 || >=14.17 <15 || >=16.4 <17 || >=18" + "node": ">=14.19 <15 || >=16.15 <17 || >=18" }, "peerDependencies": { "@ava/typescript": "*" @@ -1352,9 +1352,9 @@ } }, "node_modules/ava/node_modules/acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -1392,9 +1392,9 @@ } }, "node_modules/ava/node_modules/ansi-styles": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.1.0.tgz", - "integrity": "sha512-VbqNsoz55SYGczauuup0MFUyXNQviSpFTj1RQtFzmQLk18qbVSpTFFGMT293rmDaQuKCT6InmbuEyUne4mTuxQ==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", "dev": true, "engines": { "node": ">=12" @@ -1428,9 +1428,9 @@ } }, "node_modules/ava/node_modules/chalk": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz", - "integrity": "sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", "dev": true, "engines": { "node": "^12.17.0 || ^14.13 || >=16.0.0" @@ -1454,6 +1454,40 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/ava/node_modules/del": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-7.0.0.tgz", + "integrity": "sha512-tQbV/4u5WVB8HMJr08pgw0b6nG4RGt/tj+7Numvq+zqcvUFeMaIWWOUFltiU+6go8BSO2/ogsB4EasDaj0y68Q==", + "dev": true, + "dependencies": { + "globby": "^13.1.2", + "graceful-fs": "^4.2.10", + "is-glob": "^4.0.3", + "is-path-cwd": "^3.0.0", + "is-path-inside": "^4.0.0", + "p-map": "^5.5.0", + "rimraf": "^3.0.2", + "slash": "^4.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ava/node_modules/del/node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/ava/node_modules/escape-string-regexp": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", @@ -1467,9 +1501,9 @@ } }, "node_modules/ava/node_modules/globby": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.2.tgz", - "integrity": "sha512-LKSDZXToac40u8Q1PQtZihbNdTYSNMuWe+K5l+oa6KgDzSvVrHXlJy40hUP522RjAIoNLJYBJi7ow+rbFpIhHQ==", + "version": "13.1.3", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.3.tgz", + "integrity": "sha512-8krCNHXvlCgHDpegPzleMq07yMYTO2sXKASmZmquEYWEmCx6J5UTRbp5RwMJkTJGtcQ44YpiUYUiN0b9mzy8Bw==", "dev": true, "dependencies": { "dir-glob": "^3.0.1", @@ -1509,6 +1543,30 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/ava/node_modules/is-path-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-3.0.0.tgz", + "integrity": "sha512-kyiNFFLU0Ampr6SDZitD/DwUo4Zs1nSdnygUBqsu3LooL00Qvb5j+UnvApUn/TTj1J3OuE6BTdQ5rudKmU2ZaA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ava/node_modules/is-path-inside": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-4.0.0.tgz", + "integrity": "sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/ava/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -1675,10 +1733,19 @@ "dev": true }, "node_modules/ci-info": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.2.tgz", - "integrity": "sha512-xmDt/QIAdeZ9+nfdPsaBCpMvHNLFiLdjj59qjqn+6iPe6YmHGQ35sBnQ8uslRBXFmXkiZQOJRjvQeoGppoTjjg==", - "dev": true + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.7.1.tgz", + "integrity": "sha512-4jYS4MOAaCIStSRwiuxc4B8MYhIe676yO1sYGzARnjXkWpmzZMMYxY6zu8WYWDhSuth5zhrQ1rhNSibyyvv4/w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } }, "node_modules/ci-parallel-vars": { "version": "1.0.1", @@ -1768,14 +1835,17 @@ } }, "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", "dev": true, "dependencies": { "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", + "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" } }, "node_modules/code-excerpt": { @@ -2012,12 +2082,12 @@ "dev": true }, "node_modules/emittery": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.11.0.tgz", - "integrity": "sha512-S/7tzL6v5i+4iJd627Nhv9cLFIo5weAIlGccqJFpnBoDB8U1TF2k5tez4J/QNuxyyhWuFqHg1L84Kd3m7iXg6g==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-1.0.1.tgz", + "integrity": "sha512-2ID6FdrMD9KDLldGesP6317G78K7km/kMcwItRtVFva7I/cSEOIaLpewaUb+YLXVwdAp3Ctfxh/V5zIl1sj7dQ==", "dev": true, "engines": { - "node": ">=12" + "node": ">=14.16" }, "funding": { "url": "https://github.com/sindresorhus/emittery?sponsor=1" @@ -2983,16 +3053,16 @@ } }, "node_modules/figures": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/figures/-/figures-4.0.1.tgz", - "integrity": "sha512-rElJwkA/xS04Vfg+CaZodpso7VqBknOYbzi6I76hI4X80RUjkSxO2oAyPmGbuXUppywjqndOrQDl817hDnI++w==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", + "integrity": "sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==", "dev": true, "dependencies": { "escape-string-regexp": "^5.0.0", "is-unicode-supported": "^1.2.0" }, "engines": { - "node": ">=12" + "node": ">=14" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3244,9 +3314,9 @@ } }, "node_modules/graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, "node_modules/has": { "version": "1.0.3", @@ -3491,8 +3561,9 @@ } }, "node_modules/is-glob": { - "version": "4.0.1", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dependencies": { "is-extglob": "^2.1.1" }, @@ -3617,9 +3688,9 @@ } }, "node_modules/is-unicode-supported": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.2.0.tgz", - "integrity": "sha512-wH+U77omcRzevfIG8dDhTS0V9zZyweakfD01FULl97+0EHiJTTZtJqxPSkIIo/SDPv/i07k/C9jAPY+jwLLeUQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", "dev": true, "engines": { "node": ">=12" @@ -4278,12 +4349,15 @@ } }, "node_modules/parse-ms": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz", - "integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-3.0.0.tgz", + "integrity": "sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==", "dev": true, "engines": { - "node": ">=6" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/path": { @@ -4495,15 +4569,15 @@ } }, "node_modules/pretty-ms": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-7.0.1.tgz", - "integrity": "sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-8.0.0.tgz", + "integrity": "sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==", "dev": true, "dependencies": { - "parse-ms": "^2.1.0" + "parse-ms": "^3.0.0" }, "engines": { - "node": ">=10" + "node": ">=14.16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -5017,9 +5091,9 @@ "dev": true }, "node_modules/stack-utils": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz", - "integrity": "sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", "dev": true, "dependencies": { "escape-string-regexp": "^2.0.0" @@ -5292,11 +5366,12 @@ } }, "node_modules/temp-dir": { - "version": "2.0.0", - "integrity": "sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-3.0.0.tgz", + "integrity": "sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==", "dev": true, "engines": { - "node": ">=8" + "node": ">=14.16" } }, "node_modules/text-table": { @@ -5629,16 +5704,16 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "node_modules/write-file-atomic": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", - "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.0.tgz", + "integrity": "sha512-R7NYMnHSlV42K54lwY9lvW6MnSm1HSJqZL3xiSgi9E7//FYaI74r2G0rd+/X6VAMkHEdzxQaU5HUOXWUz5kA/w==", "dev": true, "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^3.0.7" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/xml2js": { @@ -5676,18 +5751,18 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/yargs": { - "version": "17.5.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz", - "integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==", + "version": "17.6.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", + "integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", "dev": true, "dependencies": { - "cliui": "^7.0.2", + "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^21.0.0" + "yargs-parser": "^21.1.1" }, "engines": { "node": ">=12" diff --git a/node_modules/ava/entrypoints/eslint-plugin-helper.cjs b/node_modules/ava/entrypoints/eslint-plugin-helper.cjs index ab1bcfa38d..61a223371c 100644 --- a/node_modules/ava/entrypoints/eslint-plugin-helper.cjs +++ b/node_modules/ava/entrypoints/eslint-plugin-helper.cjs @@ -1,8 +1,8 @@ 'use strict'; -const path = require('path'); -const url = require('url'); -const v8 = require('v8'); -const {Worker} = require('worker_threads'); +const path = require('node:path'); +const url = require('node:url'); +const v8 = require('node:v8'); +const {Worker} = require('node:worker_threads'); const { classify, diff --git a/node_modules/ava/entrypoints/index.d.cts b/node_modules/ava/entrypoints/index.d.cts deleted file mode 100644 index 91c40063fd..0000000000 --- a/node_modules/ava/entrypoints/index.d.cts +++ /dev/null @@ -1,2 +0,0 @@ -export {default} from '../index.js'; -export * from '../index.js'; diff --git a/node_modules/ava/entrypoints/main.d.cts b/node_modules/ava/entrypoints/main.d.cts new file mode 100644 index 0000000000..d4fcdc160c --- /dev/null +++ b/node_modules/ava/entrypoints/main.d.cts @@ -0,0 +1,12 @@ +import type {TestFn} from '../types/test-fn.cjs'; + +export * from '../types/assertions.cjs'; +export * from '../types/try-fn.cjs'; +export * from '../types/test-fn.cjs'; +export * from '../types/subscribable.cjs'; + +/** Call to declare a test, or chain to declare hooks or test modifiers */ +declare const test: TestFn; + +/** Call to declare a test, or chain to declare hooks or test modifiers */ +export default test; diff --git a/node_modules/ava/entrypoints/main.d.ts b/node_modules/ava/entrypoints/main.d.ts new file mode 100644 index 0000000000..d4fcdc160c --- /dev/null +++ b/node_modules/ava/entrypoints/main.d.ts @@ -0,0 +1,12 @@ +import type {TestFn} from '../types/test-fn.cjs'; + +export * from '../types/assertions.cjs'; +export * from '../types/try-fn.cjs'; +export * from '../types/test-fn.cjs'; +export * from '../types/subscribable.cjs'; + +/** Call to declare a test, or chain to declare hooks or test modifiers */ +declare const test: TestFn; + +/** Call to declare a test, or chain to declare hooks or test modifiers */ +export default test; diff --git a/node_modules/ava/entrypoints/plugin.d.cts b/node_modules/ava/entrypoints/plugin.d.cts index b66e07dcb8..9e5871101f 100644 --- a/node_modules/ava/entrypoints/plugin.d.cts +++ b/node_modules/ava/entrypoints/plugin.d.cts @@ -1 +1,6 @@ -export * from '../plugin.js' +import type {SharedWorker} from '../types/shared-worker.cjs'; + +export function registerSharedWorker(options: SharedWorker.Plugin.RegistrationOptions<'ava-4', Data>): SharedWorker.Plugin.Protocol; +// Add overloads for additional protocols. + +export type {SharedWorker} from '../types/shared-worker.cjs'; diff --git a/node_modules/ava/entrypoints/plugin.d.ts b/node_modules/ava/entrypoints/plugin.d.ts new file mode 100644 index 0000000000..9e5871101f --- /dev/null +++ b/node_modules/ava/entrypoints/plugin.d.ts @@ -0,0 +1,6 @@ +import type {SharedWorker} from '../types/shared-worker.cjs'; + +export function registerSharedWorker(options: SharedWorker.Plugin.RegistrationOptions<'ava-4', Data>): SharedWorker.Plugin.Protocol; +// Add overloads for additional protocols. + +export type {SharedWorker} from '../types/shared-worker.cjs'; diff --git a/node_modules/ava/index.d.ts b/node_modules/ava/index.d.ts index 50f1570d74..66c0e85d2a 100644 --- a/node_modules/ava/index.d.ts +++ b/node_modules/ava/index.d.ts @@ -1,12 +1,4 @@ -import type {TestFn} from './types/test-fn.js'; +// For compatibility with resolution algorithms other than Node16. -export * from './types/assertions.js'; -export * from './types/try-fn.js'; -export * from './types/test-fn.js'; -export * from './types/subscribable.js'; - -/** Call to declare a test, or chain to declare hooks or test modifiers */ -declare const test: TestFn; - -/** Call to declare a test, or chain to declare hooks or test modifiers */ -export default test; +export * from './entrypoints/main.cjs'; +export {default} from './entrypoints/main.cjs'; diff --git a/node_modules/ava/lib/api.js b/node_modules/ava/lib/api.js index 1ebe27ce54..eaf2236509 100644 --- a/node_modules/ava/lib/api.js +++ b/node_modules/ava/lib/api.js @@ -16,6 +16,7 @@ import fork from './fork.js'; import * as globs from './globs.js'; import isCi from './is-ci.js'; import {getApplicableLineNumbers} from './line-numbers.js'; +import {setCappedTimeout} from './now-and-timers.cjs'; import {observeWorkerProcess} from './plugin-support/shared-workers.js'; import RunStatus from './run-status.js'; import scheduler from './scheduler.js'; @@ -52,7 +53,7 @@ class TimeoutTrigger { debounce() { if (this.timer === undefined) { - this.timer = setTimeout(() => this.trigger(), this.waitMs); + this.timer = setCappedTimeout(() => this.trigger(), this.waitMs); } else { this.timer.refresh(); } @@ -246,14 +247,16 @@ export default class Api extends Emittery { } })); - // Resolve the correct concurrency value. - let concurrency = Math.min(os.cpus().length, isCi ? 2 : Number.POSITIVE_INFINITY); - if (apiOptions.concurrency > 0) { - concurrency = apiOptions.concurrency; - } - + // Resolve the correct concurrency value. Note that `os.cpus()` can return empty arrays on + // platforms not officially supported by Node.js. Use 1 as a minimum. + // See . + let concurrency = Math.max(1, os.cpus().length); if (apiOptions.serial) { concurrency = 1; + } else if (apiOptions.concurrency > 0) { + concurrency = apiOptions.concurrency; + } else if (isCi) { + concurrency = 2; } const deregisteredSharedWorkers = []; diff --git a/node_modules/ava/lib/assert.js b/node_modules/ava/lib/assert.js index 5d5477071f..15818739c4 100644 --- a/node_modules/ava/lib/assert.js +++ b/node_modules/ava/lib/assert.js @@ -8,8 +8,10 @@ import {SnapshotError, VersionMismatchError} from './snapshot-manager.js'; function formatDescriptorDiff(actualDescriptor, expectedDescriptor, options) { options = {...options, ...concordanceOptions}; + const {diffGutters} = options.theme; + const {insertLine, deleteLine} = options.theme.string.diff; return { - label: 'Difference:', + label: `Difference (${diffGutters.actual}${deleteLine.open}actual${deleteLine.close}, ${diffGutters.expected}${insertLine.open}expected${insertLine.close}):`, formatted: concordance.diffDescriptors(actualDescriptor, expectedDescriptor, options), }; } @@ -48,7 +50,7 @@ export class AssertionError extends Error { // use the values for custom diff views this.raw = options.raw; - this.savedError = options.savedError ? options.savedError : getErrorWithLongStackTrace(); + this.savedError = options.savedError || getErrorWithLongStackTrace(); } } @@ -141,14 +143,17 @@ function validateExpectations(assertion, expectations, numberArgs) { // eslint-d case 'is': case 'message': case 'name': - case 'code': + case 'code': { continue; - default: + } + + default: { throw new AssertionError({ assertion, message: `The second argument to \`t.${assertion}()\` contains unexpected properties`, values: [formatWithLabel('Called with:', expectations)], }); + } } } } diff --git a/node_modules/ava/lib/cli.js b/node_modules/ava/lib/cli.js index a4c89ac098..afe5528019 100644 --- a/node_modules/ava/lib/cli.js +++ b/node_modules/ava/lib/cli.js @@ -5,10 +5,10 @@ import process from 'node:process'; import arrify from 'arrify'; import ciParallelVars from 'ci-parallel-vars'; -import del from 'del'; +import {deleteAsync} from 'del'; import figures from 'figures'; import yargs from 'yargs'; -import {hideBin} from 'yargs/helpers'; // eslint-disable-line node/file-extension-in-import +import {hideBin} from 'yargs/helpers'; // eslint-disable-line n/file-extension-in-import import Api from './api.js'; import {chalk} from './chalk.js'; @@ -124,7 +124,7 @@ export default async function loadCli() { // eslint-disable-line complexity // run AVA with the debug command, though it's allowed. let activeInspector = false; try { - const {default: inspector} = await import('node:inspector'); // eslint-disable-line node/no-unsupported-features/es-syntax + const {default: inspector} = await import('node:inspector'); activeInspector = inspector.url() !== undefined; } catch {} @@ -242,16 +242,16 @@ export default async function loadCli() { // eslint-disable-line complexity const chalkOptions = {level: 0}; if (combined.color !== false) { - const {supportsColor: {level}} = await import('chalk'); // eslint-disable-line node/no-unsupported-features/es-syntax, unicorn/import-style + const {supportsColor: {level}} = await import('chalk'); // eslint-disable-line unicorn/import-style chalkOptions.level = level; } - const {set: setChalk} = await import('./chalk.js'); // eslint-disable-line node/no-unsupported-features/es-syntax + const {set: setChalk} = await import('./chalk.js'); setChalk(chalkOptions); if (confError) { - if (confError.parent) { - exit(`${confError.message}\n\n${chalk.gray((confError.parent && confError.parent.stack) || confError.parent)}`); + if (confError.cause) { + exit(`${confError.message}\n\n${chalk.gray(confError.cause?.stack ?? confError.cause)}`); } else { exit(confError.message); } @@ -262,7 +262,7 @@ export default async function loadCli() { // eslint-disable-line complexity const cacheDir = path.join(projectDir, 'node_modules', '.cache', 'ava'); try { - const deletedFilePaths = await del('*', {cwd: cacheDir}); + const deletedFilePaths = await deleteAsync('*', {cwd: cacheDir}); if (deletedFilePaths.length === 0) { console.log(`\n${chalk.green(figures.tick)} No cache files to remove`); diff --git a/node_modules/ava/lib/code-excerpt.js b/node_modules/ava/lib/code-excerpt.js index ca9ab05863..a46d012eb0 100644 --- a/node_modules/ava/lib/code-excerpt.js +++ b/node_modules/ava/lib/code-excerpt.js @@ -43,7 +43,7 @@ export default function exceptCode(source, options = {}) { const coloredLineNumber = isErrorSource ? lineNumber : chalk.grey(lineNumber); const result = ` ${coloredLineNumber} ${item.value.padEnd(extendedWidth)}`; - return isErrorSource ? chalk.bgRed(result) : result; + return isErrorSource ? chalk.bgRed.bold(result) : result; }) .join('\n'); } diff --git a/node_modules/ava/lib/concordance-options.js b/node_modules/ava/lib/concordance-options.js index 48a367054b..3e5fbf4beb 100644 --- a/node_modules/ava/lib/concordance-options.js +++ b/node_modules/ava/lib/concordance-options.js @@ -85,7 +85,7 @@ const colorTheme = { undefined: ansiStyles.yellow, }; -const plainTheme = JSON.parse(JSON.stringify(colorTheme), value => typeof value === 'string' ? stripAnsi(value) : value); +const plainTheme = JSON.parse(JSON.stringify(colorTheme), (_name, value) => typeof value === 'string' ? stripAnsi(value) : value); const theme = chalk.level > 0 ? colorTheme : plainTheme; diff --git a/node_modules/ava/lib/eslint-plugin-helper-worker.js b/node_modules/ava/lib/eslint-plugin-helper-worker.js index fb7ce60541..71a45ca252 100644 --- a/node_modules/ava/lib/eslint-plugin-helper-worker.js +++ b/node_modules/ava/lib/eslint-plugin-helper-worker.js @@ -33,7 +33,7 @@ const buildGlobs = ({conf, providers, projectDir, overrideExtensions, overrideFi cwd: projectDir, ...normalizeGlobs({ extensions, - files: overrideFiles ? overrideFiles : conf.files, + files: overrideFiles || conf.files, providers, }), }; @@ -69,5 +69,5 @@ const handleMessage = async ({projectDir, overrideExtensions, overrideFiles}) => }; parentPort.on('message', handleMessage); -handleMessage(workerData.firstMessage); +handleMessage(workerData.firstMessage); // eslint-disable-line unicorn/prefer-top-level-await delete workerData.firstMessage; diff --git a/node_modules/ava/lib/fork.js b/node_modules/ava/lib/fork.js index 3f77039bd1..7630baa396 100644 --- a/node_modules/ava/lib/fork.js +++ b/node_modules/ava/lib/fork.js @@ -109,9 +109,11 @@ export default function loadFork(file, options, execArgv = process.execArgv) { } switch (message.ava.type) { - case 'ready-for-options': + case 'ready-for-options': { send({type: 'options', options}); break; + } + case 'shared-worker-connect': { const {channelId, filename, initialData, port} = message.ava; emitter.emit('connectSharedWorker', { @@ -125,11 +127,14 @@ export default function loadFork(file, options, execArgv = process.execArgv) { break; } - case 'ping': + case 'ping': { send({type: 'pong'}); break; - default: + } + + default: { emitStateChange(message.ava); + } } }); diff --git a/node_modules/ava/lib/glob-helpers.cjs b/node_modules/ava/lib/glob-helpers.cjs index 6e42c550f0..2421e98d68 100644 --- a/node_modules/ava/lib/glob-helpers.cjs +++ b/node_modules/ava/lib/glob-helpers.cjs @@ -1,6 +1,6 @@ 'use strict'; -const path = require('path'); -const process = require('process'); +const path = require('node:path'); +const process = require('node:process'); const ignoreByDefault = require('ignore-by-default'); const picomatch = require('picomatch'); diff --git a/node_modules/ava/lib/load-config.js b/node_modules/ava/lib/load-config.js index e3c70fd708..eca4232ae2 100644 --- a/node_modules/ava/lib/load-config.js +++ b/node_modules/ava/lib/load-config.js @@ -11,7 +11,7 @@ const MISSING_DEFAULT_EXPORT = Symbol('missing default export'); const EXPERIMENTS = new Set(); const importConfig = async ({configFile, fileForErrorMessage}) => { - const {default: config = MISSING_DEFAULT_EXPORT} = await import(url.pathToFileURL(configFile)); // eslint-disable-line node/no-unsupported-features/es-syntax + const {default: config = MISSING_DEFAULT_EXPORT} = await import(url.pathToFileURL(configFile)); if (config === MISSING_DEFAULT_EXPORT) { throw new Error(`${fileForErrorMessage} must have a default export`); } @@ -29,17 +29,13 @@ const loadConfigFile = async ({projectDir, configFile}) => { return null; } - throw Object.assign(new Error(`Error loading ${fileForErrorMessage}: ${error.message}`), {parent: error}); + throw Object.assign(new Error(`Error loading ${fileForErrorMessage}: ${error.message}`), {cause: error}); } }; function resolveConfigFile(configFile) { if (configFile) { configFile = path.resolve(configFile); // Relative to CWD - - if (!configFile.endsWith('.js') && !configFile.endsWith('.cjs') && !configFile.endsWith('.mjs')) { - throw new Error('Config files must have .js, .cjs or .mjs extensions'); - } } return configFile; @@ -78,7 +74,7 @@ async function checkJsonFile(searchDir) { } } -export async function loadConfig({configFile, resolveFrom = process.cwd(), defaults = {}} = {}) { +export async function loadConfig({configFile, resolveFrom = process.cwd(), defaults = {}} = {}) { // eslint-disable-line complexity let packageConf = await packageConfig('ava', {cwd: resolveFrom}); const filepath = packageJsonPath(packageConf); const projectDir = filepath === undefined ? resolveFrom : path.dirname(filepath); @@ -94,7 +90,17 @@ export async function loadConfig({configFile, resolveFrom = process.cwd(), defau let fileForErrorMessage; let conflicting = []; if (configFile) { - const loaded = await loadConfigFile({projectDir, configFile}); + let loaded; + try { + loaded = await loadConfigFile({projectDir, configFile}); + } catch (error) { + if (!configFile.endsWith('.js') && !configFile.endsWith('.cjs') && !configFile.endsWith('.mjs')) { + throw Object.assign(new Error('Could not load config file; it should have .js, .cjs or .mjs extension'), {cause: error}); + } + + throw error; + } + if (loaded !== null) { ({config: fileConf, fileForErrorMessage} = loaded); } diff --git a/node_modules/ava/lib/module-types.js b/node_modules/ava/lib/module-types.js index 3b482a9a0a..91e7a16ca4 100644 --- a/node_modules/ava/lib/module-types.js +++ b/node_modules/ava/lib/module-types.js @@ -6,21 +6,28 @@ const requireTrueValue = value => { const normalize = (extension, type, defaultModuleType) => { switch (extension) { - case 'cjs': + case 'cjs': { requireTrueValue(type); return 'commonjs'; - case 'mjs': + } + + case 'mjs': { requireTrueValue(type); return 'module'; - case 'js': + } + + case 'js': { requireTrueValue(type); return defaultModuleType; - default: + } + + default: { if (type !== 'commonjs' && type !== 'module') { throw new TypeError(`Module type for ’${extension}’ must be ’commonjs’ or ’module’`); } return type; + } } }; @@ -37,17 +44,24 @@ const deriveFromArray = (extensions, defaultModuleType) => { const moduleTypes = {}; for (const extension of extensions) { switch (extension) { - case 'cjs': + case 'cjs': { moduleTypes.cjs = 'commonjs'; break; - case 'mjs': + } + + case 'mjs': { moduleTypes.mjs = 'module'; break; - case 'js': + } + + case 'js': { moduleTypes.js = defaultModuleType; break; - default: + } + + default: { moduleTypes[extension] = 'commonjs'; + } } } diff --git a/node_modules/ava/lib/now-and-timers.cjs b/node_modules/ava/lib/now-and-timers.cjs index 2576d7ef9c..59d916aac2 100644 --- a/node_modules/ava/lib/now-and-timers.cjs +++ b/node_modules/ava/lib/now-and-timers.cjs @@ -1,5 +1,16 @@ 'use strict'; -const timers = require('timers'); +const timers = require('node:timers'); Object.assign(exports, timers); exports.now = Date.now; + +// Any delay larger than this value is ignored by Node.js, with a delay of `1` +// used instead. See . +const MAX_DELAY = (2 ** 31) - 1; + +function setCappedTimeout(callback, delay) { + const safeDelay = Math.min(delay, MAX_DELAY); + return timers.setTimeout(callback, safeDelay); +} + +exports.setCappedTimeout = setCappedTimeout; diff --git a/node_modules/ava/lib/plugin-support/shared-worker-loader.js b/node_modules/ava/lib/plugin-support/shared-worker-loader.js index 2813fe69c8..c544bfce8b 100644 --- a/node_modules/ava/lib/plugin-support/shared-worker-loader.js +++ b/node_modules/ava/lib/plugin-support/shared-worker-loader.js @@ -156,7 +156,7 @@ function broadcastMessage(data) { } async function loadFactory() { - const {default: factory} = await import(workerData.filename); // eslint-disable-line node/no-unsupported-features/es-syntax + const {default: factory} = await import(workerData.filename); return factory; } @@ -166,7 +166,8 @@ let signalAvailable = () => { }; let fatal; -loadFactory(workerData.filename).then(factory => { +try { + const factory = await loadFactory(workerData.filename); if (typeof factory !== 'function') { throw new TypeError(`Missing default factory function export for shared worker plugin at ${workerData.filename}`); } @@ -236,14 +237,12 @@ loadFactory(workerData.filename).then(factory => { }; }, }); -}).catch(error => { - if (fatal === undefined) { - fatal = error; - } -}).finally(() => { +} catch (error) { + fatal = fatal ?? error; +} finally { if (fatal !== undefined) { process.nextTick(() => { throw fatal; }); } -}); +} diff --git a/node_modules/ava/lib/plugin-support/shared-workers.js b/node_modules/ava/lib/plugin-support/shared-workers.js index 94030ced5b..2d65454ab6 100644 --- a/node_modules/ava/lib/plugin-support/shared-workers.js +++ b/node_modules/ava/lib/plugin-support/shared-workers.js @@ -49,35 +49,54 @@ function launchWorker(filename, initialData) { } export async function observeWorkerProcess(fork, runStatus) { - let registrationCount = 0; - let signalDeregistered; - const deregistered = new Promise(resolve => { - signalDeregistered = resolve; + let signalDone; + + const done = new Promise(resolve => { + signalDone = () => { + resolve(); + }; }); - fork.promise.finally(() => { - if (registrationCount === 0) { - signalDeregistered(); + const activeInstances = new Set(); + + const removeInstance = instance => { + instance.worker.unref(); + activeInstances.delete(instance); + + if (activeInstances.size === 0) { + signalDone(); + } + }; + + const removeAllInstances = () => { + if (activeInstances.size === 0) { + signalDone(); + return; } + + for (const instance of activeInstances) { + removeInstance(instance); + } + }; + + fork.promise.finally(() => { + removeAllInstances(); }); fork.onConnectSharedWorker(async ({filename, initialData, port, signalError}) => { const launched = launchWorker(filename, initialData); + activeInstances.add(launched); const handleWorkerMessage = async message => { if (message.type === 'deregistered-test-worker' && message.id === fork.threadId) { launched.worker.off('message', handleWorkerMessage); - - registrationCount--; - if (registrationCount === 0) { - signalDeregistered(); - } + removeInstance(launched); } }; launched.statePromises.error.then(error => { - signalDeregistered(); launched.worker.off('message', handleWorkerMessage); + removeAllInstances(); runStatus.emitStateChange({type: 'shared-worker-error', err: serializeError('Shared worker error', true, error)}); signalError(); }); @@ -85,8 +104,6 @@ export async function observeWorkerProcess(fork, runStatus) { try { await launched.statePromises.available; - registrationCount++; - port.postMessage({type: 'ready'}); launched.worker.postMessage({ @@ -104,15 +121,8 @@ export async function observeWorkerProcess(fork, runStatus) { }); launched.worker.on('message', handleWorkerMessage); - } catch { - return; - } finally { - // Attaching listeners has the side-effect of referencing the worker. - // Explicitly unreference it now so it does not prevent the main process - // from exiting. - launched.worker.unref(); - } + } catch {} }); - return deregistered; + return done; } diff --git a/node_modules/ava/lib/provider-manager.js b/node_modules/ava/lib/provider-manager.js index c3b7c85d8e..faf61f78b1 100644 --- a/node_modules/ava/lib/provider-manager.js +++ b/node_modules/ava/lib/provider-manager.js @@ -15,7 +15,7 @@ const levelsByProtocol = { async function load(providerModule, projectDir) { const ava = {version: pkg.version}; - const {default: makeProvider} = await import(providerModule); // eslint-disable-line node/no-unsupported-features/es-syntax + const {default: makeProvider} = await import(providerModule); let fatal; let level; diff --git a/node_modules/ava/lib/reporters/default.js b/node_modules/ava/lib/reporters/default.js index 8a612deef6..804e285cc3 100644 --- a/node_modules/ava/lib/reporters/default.js +++ b/node_modules/ava/lib/reporters/default.js @@ -233,6 +233,16 @@ export default class Reporter { break; } + case 'process-exit': { + this.write(colors.error(`${figures.cross} Exiting due to process.exit() when running ${this.relativeFile(event.testFile)}`)); + + this.lineWriter.writeLine(); + this.lineWriter.writeLine(colors.errorStack(event.stack)); + this.lineWriter.writeLine(); + + break; + } + case 'hook-finished': { if (event.logs.length > 0) { this.lineWriter.writeLine(` ${this.prefixTitle(event.testFile, event.title)}`); @@ -244,9 +254,9 @@ export default class Reporter { case 'selected-test': { if (event.skip) { - this.lineWriter.writeLine(colors.skip(`- ${this.prefixTitle(event.testFile, event.title)}`)); + this.lineWriter.writeLine(colors.skip(`- [skip] ${this.prefixTitle(event.testFile, event.title)}`)); } else if (event.todo) { - this.lineWriter.writeLine(colors.todo(`- ${this.prefixTitle(event.testFile, event.title)}`)); + this.lineWriter.writeLine(colors.todo(`- [todo] ${this.prefixTitle(event.testFile, event.title)}`)); } break; @@ -360,8 +370,11 @@ export default class Reporter { } this.lineWriter.writeLine(`${testsInFile.size} tests were pending in ${this.relativeFile(file)}\n`); + const testTitleToLogs = evt.pendingTestsLogs.get(file); for (const title of testsInFile) { + const logs = testTitleToLogs?.get(title); this.lineWriter.writeLine(`${figures.circleDotted} ${this.prefixTitle(file, title)}`); + this.writeLogs({logs}); } this.lineWriter.writeLine(''); @@ -504,15 +517,30 @@ export default class Reporter { } writeTestSummary(event) { + // Prefix icon indicates matched expectations vs. not. + // Prefix color indicates passed-as-expected vs. not (fail or unexpected pass). + // This yields four possibilities, which in the standard configuration render as: + // * normal test, pass: + // * normal test, fail: ✘ [fail] + // * fail-expected test, fail: ✔ [expected fail] + // * fail-expected test, pass: ✘ [unexpected pass] + let prefix; + let suffix; if (event.type === 'hook-failed' || event.type === 'test-failed') { - this.write(`${colors.error(figures.cross)} ${this.prefixTitle(event.testFile, event.title)} ${colors.error(event.err.message)}`); + const type = event.knownFailing ? '[unexpected pass]' : '[fail]'; + prefix = colors.error(`${figures.cross} ${type}:`); + suffix = chalk.italic(colors.error(event.err.message)); } else if (event.knownFailing) { - this.write(`${colors.error(figures.tick)} ${colors.error(this.prefixTitle(event.testFile, event.title))}`); + prefix = colors.error(figures.tick + ' [expected fail]'); } else { - const duration = event.duration > this.durationThreshold ? colors.duration(' (' + prettyMs(event.duration) + ')') : ''; - this.write(`${colors.pass(figures.tick)} ${this.prefixTitle(event.testFile, event.title)}${duration}`); + prefix = colors.pass(figures.tick); + if (event.duration > this.durationThreshold) { + suffix = colors.duration(`(${prettyMs(event.duration)})`); + } } + const label = this.prefixTitle(event.testFile, event.title); + this.write(`${prefix} ${label}${suffix ? ' ' + suffix : ''}`); this.writeLogs(event); } @@ -658,8 +686,8 @@ export default class Reporter { this.lineWriter.writeLine(colors.error(`${this.stats.uncaughtExceptions} uncaught ${plur('exception', this.stats.uncaughtExceptions)}`)); } - if (this.stats.timeouts > 0) { - this.lineWriter.writeLine(colors.error(`${this.stats.timeouts} ${plur('test', this.stats.timeouts)} remained pending after a timeout`)); + if (this.stats.timedOutTests > 0) { + this.lineWriter.writeLine(colors.error(`${this.stats.timedOutTests} ${plur('test', this.stats.timedOutTests)} remained pending after a timeout`)); } if (this.previousFailures > 0) { diff --git a/node_modules/ava/lib/reporters/tap.js b/node_modules/ava/lib/reporters/tap.js index 51a55cdb6a..b1989a4d60 100644 --- a/node_modules/ava/lib/reporters/tap.js +++ b/node_modules/ava/lib/reporters/tap.js @@ -29,7 +29,7 @@ function dumpError(error) { } if (error.values.length > 0) { - object.values = Object.fromEntries(error.values.map(({label, formatted}) => [label, stripAnsi(formatted)])); + object.values = Object.fromEntries(error.values.map(({label, formatted}) => [stripAnsi(label), stripAnsi(formatted)])); } } @@ -128,6 +128,17 @@ export default class TapReporter { } } + writeProcessExit(evt) { + const error = new Error(`Exiting due to process.exit() when running ${this.relativeFile(evt.testFile)}`); + error.stack = evt.stack; + + for (const [testFile, tests] of evt.pendingTests) { + for (const title of tests) { + this.writeTest({testFile, title, err: error}, {passed: false, todo: false, skip: false}); + } + } + } + writeTimeout(evt) { const error = new Error(`Exited because no new tests completed within the last ${evt.period}ms of inactivity`); @@ -142,23 +153,38 @@ export default class TapReporter { const fileStats = this.stats && evt.testFile ? this.stats.byFile.get(evt.testFile) : null; switch (evt.type) { - case 'declared-test': + case 'declared-test': { // Ignore break; - case 'hook-failed': + } + + case 'hook-failed': { this.writeTest(evt, {passed: false, todo: false, skip: false}); break; - case 'hook-finished': + } + + case 'hook-finished': { this.writeComment(evt, {}); break; - case 'internal-error': + } + + case 'internal-error': { this.writeCrash(evt); break; - case 'missing-ava-import': + } + + case 'missing-ava-import': { this.filesWithMissingAvaImports.add(evt.testFile); this.writeCrash(evt, `No tests found in ${this.relativeFile(evt.testFile)}, make sure to import "ava" at the top of your test file`); break; - case 'selected-test': + } + + case 'process-exit': { + this.writeProcessExit(evt); + break; + } + + case 'selected-test': { if (evt.skip) { this.writeTest(evt, {passed: true, todo: false, skip: true}); } else if (evt.todo) { @@ -166,25 +192,39 @@ export default class TapReporter { } break; - case 'stats': + } + + case 'stats': { this.stats = evt.stats; break; - case 'test-failed': + } + + case 'test-failed': { this.writeTest(evt, {passed: false, todo: false, skip: false}); break; - case 'test-passed': + } + + case 'test-passed': { this.writeTest(evt, {passed: true, todo: false, skip: false}); break; - case 'timeout': + } + + case 'timeout': { this.writeTimeout(evt); break; - case 'uncaught-exception': + } + + case 'uncaught-exception': { this.writeCrash(evt); break; - case 'unhandled-rejection': + } + + case 'unhandled-rejection': { this.writeCrash(evt); break; - case 'worker-failed': + } + + case 'worker-failed': { if (!this.filesWithMissingAvaImports.has(evt.testFile)) { if (evt.nonZeroExitCode) { this.writeCrash(evt, `${this.relativeFile(evt.testFile)} exited with a non-zero exit code: ${evt.nonZeroExitCode}`); @@ -194,7 +234,9 @@ export default class TapReporter { } break; - case 'worker-finished': + } + + case 'worker-finished': { if (!evt.forcedExit && !this.filesWithMissingAvaImports.has(evt.testFile)) { if (fileStats.declaredTests === 0) { this.writeCrash(evt, `No tests found in ${this.relativeFile(evt.testFile)}`); @@ -204,12 +246,17 @@ export default class TapReporter { } break; + } + case 'worker-stderr': - case 'worker-stdout': + case 'worker-stdout': { this.stdStream.write(evt.chunk); break; - default: + } + + default: { break; + } } } } diff --git a/node_modules/ava/lib/run-status.js b/node_modules/ava/lib/run-status.js index 7d6b26c015..84713456a0 100644 --- a/node_modules/ava/lib/run-status.js +++ b/node_modules/ava/lib/run-status.js @@ -9,6 +9,7 @@ export default class RunStatus extends Emittery { super(); this.pendingTests = new Map(); + this.pendingTestsLogs = new Map(); this.emptyParallelRun = parallelRuns && parallelRuns.currentFileCount === 0 @@ -33,6 +34,7 @@ export default class RunStatus extends Emittery { selectedTests: 0, sharedWorkerErrors: 0, skippedTests: 0, + timedOutTests: 0, timeouts: 0, todoTests: 0, uncaughtExceptions: 0, @@ -59,31 +61,39 @@ export default class RunStatus extends Emittery { }); this.pendingTests.set(testFile, new Set()); + this.pendingTestsLogs.set(testFile, new Map()); worker.onStateChange(data => this.emitStateChange(data)); } + // eslint-disable-next-line complexity emitStateChange(event) { const {stats} = this; const fileStats = stats.byFile.get(event.testFile); let changedStats = true; switch (event.type) { - case 'declared-test': + case 'declared-test': { stats.declaredTests++; fileStats.declaredTests++; break; - case 'hook-failed': + } + + case 'hook-failed': { stats.failedHooks++; fileStats.failedHooks++; break; - case 'internal-error': + } + + case 'internal-error': { stats.internalErrors++; if (event.testFile) { fileStats.internalErrors++; } break; - case 'selected-test': + } + + case 'selected-test': { stats.selectedTests++; fileStats.selectedTests++; if (event.skip) { @@ -99,17 +109,23 @@ export default class RunStatus extends Emittery { } break; - case 'shared-worker-error': + } + + case 'shared-worker-error': { stats.sharedWorkerErrors++; break; - case 'test-failed': + } + + case 'test-failed': { stats.failedTests++; fileStats.failedTests++; stats.remainingTests--; fileStats.remainingTests--; this.removePendingTest(event); break; - case 'test-passed': + } + + case 'test-passed': { if (event.knownFailing) { stats.passedKnownFailingTests++; fileStats.passedKnownFailingTests++; @@ -122,35 +138,68 @@ export default class RunStatus extends Emittery { fileStats.remainingTests--; this.removePendingTest(event); break; - case 'timeout': + } + + case 'test-register-log-reference': { + this.addPendingTestLogs(event); + break; + } + + case 'timeout': { + stats.timeouts++; event.pendingTests = this.pendingTests; + event.pendingTestsLogs = this.pendingTestsLogs; this.pendingTests = new Map(); + this.pendingTestsLogs = new Map(); for (const testsInFile of event.pendingTests.values()) { - stats.timeouts += testsInFile.size; + stats.timedOutTests += testsInFile.size; } break; - case 'interrupt': + } + + case 'interrupt': { event.pendingTests = this.pendingTests; + event.pendingTestsLogs = this.pendingTestsLogs; this.pendingTests = new Map(); + this.pendingTestsLogs = new Map(); break; - case 'uncaught-exception': + } + + case 'process-exit': { + event.pendingTests = this.pendingTests; + event.pendingTestsLogs = this.pendingTestsLogs; + this.pendingTests = new Map(); + this.pendingTestsLogs = new Map(); + break; + } + + case 'uncaught-exception': { stats.uncaughtExceptions++; fileStats.uncaughtExceptions++; break; - case 'unhandled-rejection': + } + + case 'unhandled-rejection': { stats.unhandledRejections++; fileStats.unhandledRejections++; break; - case 'worker-failed': + } + + case 'worker-failed': { stats.failedWorkers++; break; - case 'worker-finished': + } + + case 'worker-finished': { stats.finishedWorkers++; break; - default: + } + + default: { changedStats = false; break; + } } if (changedStats) { @@ -175,6 +224,7 @@ export default class RunStatus extends Emittery { || this.stats.failedHooks > 0 || this.stats.failedTests > 0 || this.stats.failedWorkers > 0 + || this.stats.remainingTests > 0 || this.stats.sharedWorkerErrors > 0 || this.stats.timeouts > 0 || this.stats.uncaughtExceptions > 0 @@ -190,6 +240,10 @@ export default class RunStatus extends Emittery { return 0; } + addPendingTestLogs(event) { + this.pendingTestsLogs.get(event.testFile)?.set(event.title, event.logs); + } + addPendingTest(event) { if (this.pendingTests.has(event.testFile)) { this.pendingTests.get(event.testFile).add(event.title); diff --git a/node_modules/ava/lib/runner.js b/node_modules/ava/lib/runner.js index 181e287581..bb5dd647eb 100644 --- a/node_modules/ava/lib/runner.js +++ b/node_modules/ava/lib/runner.js @@ -358,6 +358,12 @@ export default class Runner extends Emittery { notifyTimeoutUpdate: this.notifyTimeoutUpdate, }); + this.emit('stateChange', { + type: 'test-register-log-reference', + title: task.title, + logs: test.logs, + }); + const result = await this.runSingle(test); testOk = result.passed; diff --git a/node_modules/ava/lib/test.js b/node_modules/ava/lib/test.js index d2bb93e2e7..d6a39444a6 100644 --- a/node_modules/ava/lib/test.js +++ b/node_modules/ava/lib/test.js @@ -405,7 +405,7 @@ export default class Test { this.clearTimeout(); this.timeoutMs = ms; - this.timeoutTimer = nowAndTimers.setTimeout(() => { + this.timeoutTimer = nowAndTimers.setCappedTimeout(() => { this.saveFirstError(new Error(message || 'Test timeout exceeded')); if (this.finishDueToTimeout) { diff --git a/node_modules/ava/lib/watcher.js b/node_modules/ava/lib/watcher.js index 58d59e2452..29107a6328 100644 --- a/node_modules/ava/lib/watcher.js +++ b/node_modules/ava/lib/watcher.js @@ -294,14 +294,18 @@ export default class Watcher { switch (evt.type) { case 'hook-failed': case 'internal-error': + case 'process-exit': case 'test-failed': case 'uncaught-exception': case 'unhandled-rejection': - case 'worker-failed': + case 'worker-failed': { this.countFailure(evt.testFile, currentVector); break; - default: + } + + default: { break; + } } }); }); diff --git a/node_modules/ava/lib/worker/base.js b/node_modules/ava/lib/worker/base.js index e62e30eb49..cdd3c4a1a2 100644 --- a/node_modules/ava/lib/worker/base.js +++ b/node_modules/ava/lib/worker/base.js @@ -19,6 +19,41 @@ import {flags, refs, sharedWorkerTeardowns} from './state.cjs'; import {isRunningInThread, isRunningInChildProcess} from './utils.cjs'; const currentlyUnhandled = setUpCurrentlyUnhandled(); +let runner; + +// Override process.exit with an undetectable replacement +// to report when it is called from a test (which it should never be). +const {apply} = Reflect; +const realExit = process.exit; + +async function exit(code, forceSync = false) { + dependencyTracking.flush(); + const flushing = channel.flush(); + if (!forceSync) { + await flushing; + } + + apply(realExit, process, [code]); +} + +const handleProcessExit = (fn, receiver, args) => { + const error = new Error('Unexpected process.exit()'); + Error.captureStackTrace(error, handleProcessExit); + const {stack} = serializeError('', true, error); + channel.send({type: 'process-exit', stack}); + + // Make sure to extract the code only from `args` rather than e.g. `Array.prototype`. + // This level of paranoia is usually unwarranted, but we're dealing with test code + // that has already colored outside the lines. + const code = args.length > 0 ? args[0] : undefined; + + // Force a synchronous exit as guaranteed by the real process.exit(). + exit(code, true); +}; + +process.exit = new Proxy(realExit, { + apply: handleProcessExit, +}); const run = async options => { setOptions(options); @@ -29,16 +64,6 @@ const run = async options => { global.console = Object.assign(global.console, new console.Console({stdout, stderr, colorMode: true})); } - async function exit(code) { - if (!process.exitCode) { - process.exitCode = code; - } - - dependencyTracking.flush(); - await channel.flush(); - process.exit(); // eslint-disable-line unicorn/no-process-exit - } - let checkSelectedByLineNumbers; try { checkSelectedByLineNumbers = lineNumberSelection({ @@ -50,7 +75,7 @@ const run = async options => { checkSelectedByLineNumbers = () => false; } - const runner = new Runner({ + runner = new Runner({ checkSelectedByLineNumbers, experiments: options.experiments, failFast: options.failFast, @@ -141,7 +166,7 @@ const run = async options => { for (const extension of extensionsToLoadAsModules) { if (ref.endsWith(`.${extension}`)) { - return import(pathToFileURL(ref)); // eslint-disable-line node/no-unsupported-features/es-syntax + return import(pathToFileURL(ref)); } } @@ -161,7 +186,7 @@ const run = async options => { if (options.debug && options.debug.port !== undefined && options.debug.host !== undefined) { // If an inspector was active when the main process started, and is // already active for the worker process, do not open a new one. - const {default: inspector} = await import('node:inspector'); // eslint-disable-line node/no-unsupported-features/es-syntax + const {default: inspector} = await import('node:inspector'); if (!options.debug.active || inspector.url() === undefined) { inspector.open(options.debug.port, options.debug.host, true); } @@ -197,12 +222,18 @@ const onError = error => { }); }; +let options; if (isRunningInThread) { channel.send({type: 'starting'}); // AVA won't terminate the worker thread until it's seen this message. - const {options} = workerData; + ({options} = workerData); delete workerData.options; // Don't allow user code access. - run(options).catch(onError); } else if (isRunningInChildProcess) { channel.send({type: 'ready-for-options'}); - channel.options.then(run).catch(onError); + options = await channel.options; +} + +try { + await run(options); +} catch (error) { + onError(error); } diff --git a/node_modules/ava/lib/worker/channel.cjs b/node_modules/ava/lib/worker/channel.cjs index 7eed7960a0..5d44498101 100644 --- a/node_modules/ava/lib/worker/channel.cjs +++ b/node_modules/ava/lib/worker/channel.cjs @@ -1,7 +1,7 @@ 'use strict'; -const events = require('events'); -const process = require('process'); -const {MessageChannel, threadId} = require('worker_threads'); +const events = require('node:events'); +const process = require('node:process'); +const {MessageChannel, threadId} = require('node:worker_threads'); const timers = require('../now-and-timers.cjs'); @@ -15,7 +15,7 @@ let pEvent = async (emitter, event, options) => { emitter.on(event, addToBuffer); try { - ({pEvent} = await import('p-event')); // eslint-disable-line node/no-unsupported-features/es-syntax + ({pEvent} = await import('p-event')); } finally { emitter.off(event, addToBuffer); } @@ -125,7 +125,7 @@ if (isRunningInChildProcess) { const {controlFlow} = require('../ipc-flow-control.cjs'); handle = new IpcHandle(controlFlow(process)); } else if (isRunningInThread) { - const {parentPort} = require('worker_threads'); + const {parentPort} = require('node:worker_threads'); handle = new MessagePortHandle(parentPort); } @@ -133,7 +133,7 @@ if (isRunningInChildProcess) { // Node.js. In order to keep track, explicitly reference before attaching. handle.ref(); -exports.options = pEvent(handle.channel, 'message', selectAvaMessage('options')).then(message => message.ava.options); +exports.options = pEvent(handle.channel, 'message', selectAvaMessage('options')).then(message => message.ava.options); // eslint-disable-line unicorn/prefer-top-level-await exports.peerFailed = pEvent(handle.channel, 'message', selectAvaMessage('peer-failed')); exports.send = handle.send.bind(handle); exports.unref = handle.unref.bind(handle); diff --git a/node_modules/ava/lib/worker/guard-environment.cjs b/node_modules/ava/lib/worker/guard-environment.cjs index d7909f30af..2a17a84b81 100644 --- a/node_modules/ava/lib/worker/guard-environment.cjs +++ b/node_modules/ava/lib/worker/guard-environment.cjs @@ -1,6 +1,6 @@ 'use strict'; -const path = require('path'); -const process = require('process'); +const path = require('node:path'); +const process = require('node:process'); const {isRunningInThread, isRunningInChildProcess} = require('./utils.cjs'); diff --git a/node_modules/ava/lib/worker/line-numbers.js b/node_modules/ava/lib/worker/line-numbers.js index 4e8013defa..bf3280311c 100644 --- a/node_modules/ava/lib/worker/line-numbers.js +++ b/node_modules/ava/lib/worker/line-numbers.js @@ -12,7 +12,7 @@ function parse(file) { const walk = require('acorn-walk'); const ast = acorn.parse(fs.readFileSync(file, 'utf8'), { - ecmaVersion: 11, + ecmaVersion: 'latest', locations: true, sourceType: 'module', }); diff --git a/node_modules/ava/lib/worker/main.cjs b/node_modules/ava/lib/worker/main.cjs index b6afc0d00a..4b8d6b4c4f 100644 --- a/node_modules/ava/lib/worker/main.cjs +++ b/node_modules/ava/lib/worker/main.cjs @@ -1,7 +1,7 @@ 'use strict'; require('./guard-environment.cjs'); // eslint-disable-line import/no-unassigned-import -const assert = require('assert'); +const assert = require('node:assert'); const {flags, refs} = require('./state.cjs'); diff --git a/node_modules/ava/lib/worker/utils.cjs b/node_modules/ava/lib/worker/utils.cjs index b92153b816..a24bbf589a 100644 --- a/node_modules/ava/lib/worker/utils.cjs +++ b/node_modules/ava/lib/worker/utils.cjs @@ -1,6 +1,6 @@ 'use strict'; -const process = require('process'); -const {isMainThread} = require('worker_threads'); +const process = require('node:process'); +const {isMainThread} = require('node:worker_threads'); exports.isRunningInThread = isMainThread === false; exports.isRunningInChildProcess = typeof process.send === 'function'; diff --git a/node_modules/ava/node_modules/acorn/CHANGELOG.md b/node_modules/ava/node_modules/acorn/CHANGELOG.md index ea8d6c04db..cf40d7cfd1 100644 --- a/node_modules/ava/node_modules/acorn/CHANGELOG.md +++ b/node_modules/ava/node_modules/acorn/CHANGELOG.md @@ -1,3 +1,9 @@ +## 8.8.1 (2022-10-24) + +### Bug fixes + +Make type for `Comment` compatible with estree types. + ## 8.8.0 (2022-07-21) ### Bug fixes diff --git a/node_modules/ava/node_modules/acorn/dist/acorn.d.ts b/node_modules/ava/node_modules/acorn/dist/acorn.d.ts index 140f6ed128..d6d5b824c3 100644 --- a/node_modules/ava/node_modules/acorn/dist/acorn.d.ts +++ b/node_modules/ava/node_modules/acorn/dist/acorn.d.ts @@ -224,7 +224,7 @@ declare namespace acorn { } interface Comment extends AbstractToken { - type: string + type: 'Line' | 'Block' value: string start: number end: number diff --git a/node_modules/ava/node_modules/acorn/dist/acorn.js b/node_modules/ava/node_modules/acorn/dist/acorn.js index 8e8b225b0b..5a291db155 100644 --- a/node_modules/ava/node_modules/acorn/dist/acorn.js +++ b/node_modules/ava/node_modules/acorn/dist/acorn.js @@ -5527,7 +5527,7 @@ // Acorn is a tiny, fast JavaScript parser written in JavaScript. - var version = "8.8.0"; + var version = "8.8.1"; Parser.acorn = { Parser: Parser, diff --git a/node_modules/ava/node_modules/acorn/dist/acorn.mjs b/node_modules/ava/node_modules/acorn/dist/acorn.mjs index 5ae045a7f2..7ddf96b2a8 100644 --- a/node_modules/ava/node_modules/acorn/dist/acorn.mjs +++ b/node_modules/ava/node_modules/acorn/dist/acorn.mjs @@ -5521,7 +5521,7 @@ pp.readWord = function() { // Acorn is a tiny, fast JavaScript parser written in JavaScript. -var version = "8.8.0"; +var version = "8.8.1"; Parser.acorn = { Parser: Parser, diff --git a/node_modules/ava/node_modules/acorn/package.json b/node_modules/ava/node_modules/acorn/package.json index 896061c412..579d89f5ff 100644 --- a/node_modules/ava/node_modules/acorn/package.json +++ b/node_modules/ava/node_modules/acorn/package.json @@ -16,7 +16,7 @@ ], "./package.json": "./package.json" }, - "version": "8.8.0", + "version": "8.8.1", "engines": { "node": ">=0.4.0" }, diff --git a/node_modules/ava/node_modules/ansi-styles/index.d.ts b/node_modules/ava/node_modules/ansi-styles/index.d.ts index 951bb95239..58f133abe9 100644 --- a/node_modules/ava/node_modules/ansi-styles/index.d.ts +++ b/node_modules/ava/node_modules/ansi-styles/index.d.ts @@ -1,4 +1,4 @@ -export interface CSPair { +export interface CSPair { // eslint-disable-line @typescript-eslint/naming-convention /** The ANSI terminal control sequence for starting this style. */ @@ -180,6 +180,52 @@ export interface ConvertColor { hexToAnsi(hex: string): number; } +/** +Basic modifier names. +*/ +export type ModifierName = keyof Modifier; + +/** +Basic foreground color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type ForegroundColorName = keyof ForegroundColor; + +/** +Basic background color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type BackgroundColorName = keyof BackgroundColor; + +/** +Basic color names. The combination of foreground and background color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type ColorName = ForegroundColorName | BackgroundColorName; + +/** +Basic modifier names. +*/ +export const modifierNames: readonly ModifierName[]; + +/** +Basic foreground color names. +*/ +export const foregroundColorNames: readonly ForegroundColorName[]; + +/** +Basic background color names. +*/ +export const backgroundColorNames: readonly BackgroundColorName[]; + +/* +Basic color names. The combination of foreground and background color names. +*/ +export const colorNames: readonly ColorName[]; + declare const ansiStyles: { readonly modifier: Modifier; readonly color: ColorBase & ForegroundColor; diff --git a/node_modules/ava/node_modules/ansi-styles/index.js b/node_modules/ava/node_modules/ansi-styles/index.js index e732c06534..d7bede44b7 100644 --- a/node_modules/ava/node_modules/ansi-styles/index.js +++ b/node_modules/ava/node_modules/ansi-styles/index.js @@ -6,74 +6,78 @@ const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`; const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`; +const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + overline: [53, 55], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29], + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + gray: [90, 39], // Alias of `blackBright` + grey: [90, 39], // Alias of `blackBright` + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39], + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgGray: [100, 49], // Alias of `bgBlackBright` + bgGrey: [100, 49], // Alias of `bgBlackBright` + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49], + }, +}; + +export const modifierNames = Object.keys(styles.modifier); +export const foregroundColorNames = Object.keys(styles.color); +export const backgroundColorNames = Object.keys(styles.bgColor); +export const colorNames = [...foregroundColorNames, ...backgroundColorNames]; + function assembleStyles() { const codes = new Map(); - const styles = { - modifier: { - reset: [0, 0], - // 21 isn't widely supported and 22 does the same thing - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - overline: [53, 55], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29] - }, - color: { - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - - // Bright color - blackBright: [90, 39], - redBright: [91, 39], - greenBright: [92, 39], - yellowBright: [93, 39], - blueBright: [94, 39], - magentaBright: [95, 39], - cyanBright: [96, 39], - whiteBright: [97, 39] - }, - bgColor: { - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], - - // Bright color - bgBlackBright: [100, 49], - bgRedBright: [101, 49], - bgGreenBright: [102, 49], - bgYellowBright: [103, 49], - bgBlueBright: [104, 49], - bgMagentaBright: [105, 49], - bgCyanBright: [106, 49], - bgWhiteBright: [107, 49] - } - }; - - // Alias bright black as gray (and grey) - styles.color.gray = styles.color.blackBright; - styles.bgColor.bgGray = styles.bgColor.bgBlackBright; - styles.color.grey = styles.color.blackBright; - styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; for (const [groupName, group] of Object.entries(styles)) { for (const [styleName, style] of Object.entries(group)) { styles[styleName] = { open: `\u001B[${style[0]}m`, - close: `\u001B[${style[1]}m` + close: `\u001B[${style[1]}m`, }; group[styleName] = styles[styleName]; @@ -83,13 +87,13 @@ function assembleStyles() { Object.defineProperty(styles, groupName, { value: group, - enumerable: false + enumerable: false, }); } Object.defineProperty(styles, 'codes', { value: codes, - enumerable: false + enumerable: false, }); styles.color.close = '\u001B[39m'; @@ -120,39 +124,41 @@ function assembleStyles() { return Math.round(((red - 8) / 247) * 24) + 232; } - return 16 + - (36 * Math.round(red / 255 * 5)) + - (6 * Math.round(green / 255 * 5)) + - Math.round(blue / 255 * 5); + return 16 + + (36 * Math.round(red / 255 * 5)) + + (6 * Math.round(green / 255 * 5)) + + Math.round(blue / 255 * 5); }, - enumerable: false + enumerable: false, }, hexToRgb: { value: hex => { - const matches = /(?[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16)); + const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16)); if (!matches) { return [0, 0, 0]; } - let {colorString} = matches.groups; + let [colorString] = matches; if (colorString.length === 3) { - colorString = colorString.split('').map(character => character + character).join(''); + colorString = [...colorString].map(character => character + character).join(''); } const integer = Number.parseInt(colorString, 16); return [ + /* eslint-disable no-bitwise */ (integer >> 16) & 0xFF, (integer >> 8) & 0xFF, - integer & 0xFF + integer & 0xFF, + /* eslint-enable no-bitwise */ ]; }, - enumerable: false + enumerable: false, }, hexToAnsi256: { value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)), - enumerable: false + enumerable: false, }, ansi256ToAnsi: { value: code => { @@ -188,6 +194,7 @@ function assembleStyles() { return 30; } + // eslint-disable-next-line no-bitwise let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red)); if (value === 2) { @@ -196,16 +203,16 @@ function assembleStyles() { return result; }, - enumerable: false + enumerable: false, }, rgbToAnsi: { value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)), - enumerable: false + enumerable: false, }, hexToAnsi: { value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)), - enumerable: false - } + enumerable: false, + }, }); return styles; diff --git a/node_modules/ava/node_modules/ansi-styles/package.json b/node_modules/ava/node_modules/ansi-styles/package.json index 5710e7f8cd..77141efe66 100644 --- a/node_modules/ava/node_modules/ansi-styles/package.json +++ b/node_modules/ava/node_modules/ansi-styles/package.json @@ -1,6 +1,6 @@ { "name": "ansi-styles", - "version": "6.1.0", + "version": "6.2.1", "description": "ANSI escape codes for styling strings in the terminal", "license": "MIT", "repository": "chalk/ansi-styles", @@ -48,7 +48,7 @@ "devDependencies": { "ava": "^3.15.0", "svg-term-cli": "^2.1.1", - "tsd": "^0.14.0", - "xo": "^0.38.2" + "tsd": "^0.19.0", + "xo": "^0.47.0" } } diff --git a/node_modules/ava/node_modules/ansi-styles/readme.md b/node_modules/ava/node_modules/ansi-styles/readme.md index 4b07dbbf2a..6d04183f0c 100644 --- a/node_modules/ava/node_modules/ansi-styles/readme.md +++ b/node_modules/ava/node_modules/ansi-styles/readme.md @@ -4,12 +4,12 @@ You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. - +![](screenshot.png) ## Install -``` -$ npm install ansi-styles +```sh +npm install ansi-styles ``` ## Usage @@ -32,8 +32,26 @@ console.log(`${styles.color.ansi16m(...styles.hexToRgb('#abcdef'))}Hello World${ ## API +### `open` and `close` + Each style has an `open` and `close` property. +### `modifierNames`, `foregroundColorNames`, `backgroundColorNames`, and `colorNames` + +All supported style strings are exposed as an array of strings for convenience. `colorNames` is the combination of `foregroundColorNames` and `backgroundColorNames`. + +This can be useful if you need to validate input: + +```js +import {modifierNames, foregroundColorNames} from 'ansi-styles'; + +console.log(modifierNames.includes('bold')); +//=> true + +console.log(foregroundColorNames.includes('pink')); +//=> false +``` + ## Styles ### Modifiers diff --git a/node_modules/ava/node_modules/chalk/package.json b/node_modules/ava/node_modules/chalk/package.json index 7193bff26e..bf495b7ed2 100644 --- a/node_modules/ava/node_modules/chalk/package.json +++ b/node_modules/ava/node_modules/chalk/package.json @@ -1,6 +1,6 @@ { "name": "chalk", - "version": "5.0.1", + "version": "5.2.0", "description": "Terminal string styling done right", "license": "MIT", "repository": "chalk/chalk", @@ -58,12 +58,15 @@ "log-update": "^5.0.0", "matcha": "^0.7.0", "tsd": "^0.19.0", - "xo": "^0.47.0", + "xo": "^0.53.0", "yoctodelay": "^2.0.0" }, "xo": { "rules": { - "unicorn/prefer-string-slice": "off" + "unicorn/prefer-string-slice": "off", + "@typescript-eslint/consistent-type-imports": "off", + "@typescript-eslint/consistent-type-exports": "off", + "@typescript-eslint/consistent-type-definitions": "off" } }, "c8": { diff --git a/node_modules/ava/node_modules/chalk/readme.md b/node_modules/ava/node_modules/chalk/readme.md index f6adc80eef..93511c01ea 100644 --- a/node_modules/ava/node_modules/chalk/readme.md +++ b/node_modules/ava/node_modules/chalk/readme.md @@ -10,11 +10,11 @@ > Terminal string styling done right [![Coverage Status](https://codecov.io/gh/chalk/chalk/branch/main/graph/badge.svg)](https://codecov.io/gh/chalk/chalk) -[![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) -[![run on repl.it](https://repl.it/badge/github/chalk/chalk)](https://repl.it/github/chalk/chalk) -[![Support Chalk on DEV](https://badge.devprotocol.xyz/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15/descriptive)](https://stakes.social/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15) +[![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) +[![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) +[![run on repl.it](https://img.shields.io/badge/Run_on_Replit-f26207?logo=replit&logoColor=white)](https://repl.it/github/chalk/chalk) - +![](media/screenshot.png)
@@ -24,34 +24,22 @@

- Sindre Sorhus' open source work is supported by the community on GitHub Sponsors and Dev + Sindre Sorhus' open source work is supported by the community on GitHub Sponsors

Special thanks to:

- +

- +

- -
- Doppler -
- All your environment variables, in one place -
- Stop struggling with scattered API keys, hacking together home-brewed tools, -
- and avoiding access controls. Keep your team and servers in sync with Doppler. -
-
-
Strapi @@ -61,6 +49,16 @@ It’s 100% JavaScript, fully customizable, and developer-first.
+
+
+ +
+ StackAid +
+ Fund your open source dependencies +
+
+

@@ -79,7 +77,7 @@ - Doesn't extend `String.prototype` - Clean and focused - Actively maintained -- [Used by ~76,000 packages](https://www.npmjs.com/browse/depended/chalk) as of October 26, 2021 +- [Used by ~86,000 packages](https://www.npmjs.com/browse/depended/chalk) as of October 4, 2022 ## Install @@ -200,6 +198,22 @@ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color= `chalkStderr` contains a separate instance configured with color support detected for `stderr` stream instead of `stdout`. Override rules from `supportsColor` apply to this too. `supportsColorStderr` is exposed for convenience. +### modifierNames, foregroundColorNames, backgroundColorNames, and colorNames + +All supported style strings are exposed as an array of strings for convenience. `colorNames` is the combination of `foregroundColorNames` and `backgroundColorNames`. + +This can be useful if you wrap Chalk and need to validate input: + +```js +import {modifierNames, foregroundColorNames} from 'chalk'; + +console.log(modifierNames.includes('bold')); +//=> true + +console.log(foregroundColorNames.includes('pink')); +//=> false +``` + ## Styles ### Modifiers @@ -255,7 +269,7 @@ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color= ## 256 and Truecolor color support -Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps. +Chalk supports 256 colors and [Truecolor](https://github.com/termstandard/colors) (16 million colors) on supported terminal apps. Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red). @@ -287,12 +301,6 @@ If you're on Windows, do yourself a favor and use [Windows Terminal](https://git [colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative. -## chalk for enterprise - -Available as part of the Tidelift Subscription. - -The maintainers of chalk and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-chalk?utm_source=npm-chalk&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - ## Related - [chalk-template](https://github.com/chalk/chalk-template) - [Tagged template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates) support for this module diff --git a/node_modules/ava/node_modules/chalk/source/index.d.ts b/node_modules/ava/node_modules/chalk/source/index.d.ts index b2408c6ede..b0cd2aee6d 100644 --- a/node_modules/ava/node_modules/chalk/source/index.d.ts +++ b/node_modules/ava/node_modules/chalk/source/index.d.ts @@ -1,76 +1,9 @@ // TODO: Make it this when TS suports that. +// import {ModifierName, ForegroundColor, BackgroundColor, ColorName} from '#ansi-styles'; // import {ColorInfo, ColorSupportLevel} from '#supports-color'; +import {ModifierName, ForegroundColorName, BackgroundColorName, ColorName} from './vendor/ansi-styles/index.js'; import {ColorInfo, ColorSupportLevel} from './vendor/supports-color/index.js'; -/** -Basic foreground colors. - -[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) -*/ -export type ForegroundColor = - | 'black' - | 'red' - | 'green' - | 'yellow' - | 'blue' - | 'magenta' - | 'cyan' - | 'white' - | 'gray' - | 'grey' - | 'blackBright' - | 'redBright' - | 'greenBright' - | 'yellowBright' - | 'blueBright' - | 'magentaBright' - | 'cyanBright' - | 'whiteBright'; - -/** -Basic background colors. - -[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) -*/ -export type BackgroundColor = - | 'bgBlack' - | 'bgRed' - | 'bgGreen' - | 'bgYellow' - | 'bgBlue' - | 'bgMagenta' - | 'bgCyan' - | 'bgWhite' - | 'bgGray' - | 'bgGrey' - | 'bgBlackBright' - | 'bgRedBright' - | 'bgGreenBright' - | 'bgYellowBright' - | 'bgBlueBright' - | 'bgMagentaBright' - | 'bgCyanBright' - | 'bgWhiteBright'; - -/** -Basic colors. - -[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) -*/ -export type Color = ForegroundColor | BackgroundColor; - -export type Modifiers = - | 'reset' - | 'bold' - | 'dim' - | 'italic' - | 'underline' - | 'overline' - | 'inverse' - | 'hidden' - | 'strikethrough' - | 'visible'; - export interface Options { /** Specify the color support for Chalk. @@ -308,6 +241,12 @@ export const supportsColor: ColorInfo; export const chalkStderr: typeof chalk; export const supportsColorStderr: typeof supportsColor; +export { + ModifierName, ForegroundColorName, BackgroundColorName, ColorName, + modifierNames, foregroundColorNames, backgroundColorNames, colorNames, +// } from '#ansi-styles'; +} from './vendor/ansi-styles/index.js'; + export { ColorInfo, ColorSupport, @@ -315,4 +254,67 @@ export { // } from '#supports-color'; } from './vendor/supports-color/index.js'; +// TODO: Remove these aliases in the next major version +/** +@deprecated Use `ModifierName` instead. + +Basic modifier names. +*/ +export type Modifiers = ModifierName; + +/** +@deprecated Use `ForegroundColorName` instead. + +Basic foreground color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type ForegroundColor = ForegroundColorName; + +/** +@deprecated Use `BackgroundColorName` instead. + +Basic background color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type BackgroundColor = BackgroundColorName; + +/** +@deprecated Use `ColorName` instead. + +Basic color names. The combination of foreground and background color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type Color = ColorName; + +/** +@deprecated Use `modifierNames` instead. + +Basic modifier names. +*/ +export const modifiers: readonly Modifiers[]; + +/** +@deprecated Use `foregroundColorNames` instead. + +Basic foreground color names. +*/ +export const foregroundColors: readonly ForegroundColor[]; + +/** +@deprecated Use `backgroundColorNames` instead. + +Basic background color names. +*/ +export const backgroundColors: readonly BackgroundColor[]; + +/** +@deprecated Use `colorNames` instead. + +Basic color names. The combination of foreground and background color names. +*/ +export const colors: readonly Color[]; + export default chalk; diff --git a/node_modules/ava/node_modules/chalk/source/index.js b/node_modules/ava/node_modules/chalk/source/index.js index 302024b632..8bc993da5d 100644 --- a/node_modules/ava/node_modules/chalk/source/index.js +++ b/node_modules/ava/node_modules/chalk/source/index.js @@ -204,6 +204,19 @@ Object.defineProperties(createChalk.prototype, styles); const chalk = createChalk(); export const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0}); +export { + modifierNames, + foregroundColorNames, + backgroundColorNames, + colorNames, + + // TODO: Remove these aliases in the next major version + modifierNames as modifiers, + foregroundColorNames as foregroundColors, + backgroundColorNames as backgroundColors, + colorNames as colors, +} from './vendor/ansi-styles/index.js'; + export { stdoutColor as supportsColor, stderrColor as supportsColorStderr, diff --git a/node_modules/ava/node_modules/chalk/source/utilities.js b/node_modules/ava/node_modules/chalk/source/utilities.js index 5d49dad357..4366dee0d8 100644 --- a/node_modules/ava/node_modules/chalk/source/utilities.js +++ b/node_modules/ava/node_modules/chalk/source/utilities.js @@ -9,7 +9,7 @@ export function stringReplaceAll(string, substring, replacer) { let endIndex = 0; let returnValue = ''; do { - returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; + returnValue += string.slice(endIndex, index) + substring + replacer; endIndex = index + substringLength; index = string.indexOf(substring, endIndex); } while (index !== -1); @@ -23,7 +23,7 @@ export function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) { let returnValue = ''; do { const gotCR = string[index - 1] === '\r'; - returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; + returnValue += string.slice(endIndex, (gotCR ? index - 1 : index)) + prefix + (gotCR ? '\r\n' : '\n') + postfix; endIndex = index + 1; index = string.indexOf('\n', endIndex); } while (index !== -1); diff --git a/node_modules/ava/node_modules/chalk/source/vendor/ansi-styles/index.d.ts b/node_modules/ava/node_modules/chalk/source/vendor/ansi-styles/index.d.ts index 7518d2a362..58f133abe9 100644 --- a/node_modules/ava/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +++ b/node_modules/ava/node_modules/chalk/source/vendor/ansi-styles/index.d.ts @@ -180,6 +180,52 @@ export interface ConvertColor { hexToAnsi(hex: string): number; } +/** +Basic modifier names. +*/ +export type ModifierName = keyof Modifier; + +/** +Basic foreground color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type ForegroundColorName = keyof ForegroundColor; + +/** +Basic background color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type BackgroundColorName = keyof BackgroundColor; + +/** +Basic color names. The combination of foreground and background color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type ColorName = ForegroundColorName | BackgroundColorName; + +/** +Basic modifier names. +*/ +export const modifierNames: readonly ModifierName[]; + +/** +Basic foreground color names. +*/ +export const foregroundColorNames: readonly ForegroundColorName[]; + +/** +Basic background color names. +*/ +export const backgroundColorNames: readonly BackgroundColorName[]; + +/* +Basic color names. The combination of foreground and background color names. +*/ +export const colorNames: readonly ColorName[]; + declare const ansiStyles: { readonly modifier: Modifier; readonly color: ColorBase & ForegroundColor; diff --git a/node_modules/ava/node_modules/chalk/source/vendor/ansi-styles/index.js b/node_modules/ava/node_modules/chalk/source/vendor/ansi-styles/index.js index 57465372be..eaa7bed6cb 100644 --- a/node_modules/ava/node_modules/chalk/source/vendor/ansi-styles/index.js +++ b/node_modules/ava/node_modules/chalk/source/vendor/ansi-styles/index.js @@ -6,68 +6,72 @@ const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`; const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`; +const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + overline: [53, 55], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29], + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + gray: [90, 39], // Alias of `blackBright` + grey: [90, 39], // Alias of `blackBright` + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39], + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgGray: [100, 49], // Alias of `bgBlackBright` + bgGrey: [100, 49], // Alias of `bgBlackBright` + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49], + }, +}; + +export const modifierNames = Object.keys(styles.modifier); +export const foregroundColorNames = Object.keys(styles.color); +export const backgroundColorNames = Object.keys(styles.bgColor); +export const colorNames = [...foregroundColorNames, ...backgroundColorNames]; + function assembleStyles() { const codes = new Map(); - const styles = { - modifier: { - reset: [0, 0], - // 21 isn't widely supported and 22 does the same thing - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - overline: [53, 55], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29], - }, - color: { - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - - // Bright color - blackBright: [90, 39], - redBright: [91, 39], - greenBright: [92, 39], - yellowBright: [93, 39], - blueBright: [94, 39], - magentaBright: [95, 39], - cyanBright: [96, 39], - whiteBright: [97, 39], - }, - bgColor: { - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], - - // Bright color - bgBlackBright: [100, 49], - bgRedBright: [101, 49], - bgGreenBright: [102, 49], - bgYellowBright: [103, 49], - bgBlueBright: [104, 49], - bgMagentaBright: [105, 49], - bgCyanBright: [106, 49], - bgWhiteBright: [107, 49], - }, - }; - - // Alias bright black as gray (and grey) - styles.color.gray = styles.color.blackBright; - styles.bgColor.bgGray = styles.bgColor.bgBlackBright; - styles.color.grey = styles.color.blackBright; - styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; for (const [groupName, group] of Object.entries(styles)) { for (const [styleName, style] of Object.entries(group)) { @@ -105,7 +109,7 @@ function assembleStyles() { // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js Object.defineProperties(styles, { rgbToAnsi256: { - value: (red, green, blue) => { + value(red, green, blue) { // We use the extended greyscale palette here, with the exception of // black and white. normal palette only has 4 greyscale shades. if (red === green && green === blue) { @@ -128,13 +132,13 @@ function assembleStyles() { enumerable: false, }, hexToRgb: { - value: hex => { - const matches = /(?[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16)); + value(hex) { + const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16)); if (!matches) { return [0, 0, 0]; } - let {colorString} = matches.groups; + let [colorString] = matches; if (colorString.length === 3) { colorString = [...colorString].map(character => character + character).join(''); @@ -157,7 +161,7 @@ function assembleStyles() { enumerable: false, }, ansi256ToAnsi: { - value: code => { + value(code) { if (code < 8) { return 30 + code; } diff --git a/node_modules/ava/node_modules/chalk/source/vendor/supports-color/browser.js b/node_modules/ava/node_modules/chalk/source/vendor/supports-color/browser.js index f4e9acd91d..9fa6888f10 100644 --- a/node_modules/ava/node_modules/chalk/source/vendor/supports-color/browser.js +++ b/node_modules/ava/node_modules/chalk/source/vendor/supports-color/browser.js @@ -1,13 +1,26 @@ /* eslint-env browser */ -const isBlinkBasedBrowser = /\b(Chrome|Chromium)\//.test(navigator.userAgent); +const level = (() => { + if (navigator.userAgentData) { + const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium'); + if (brand && brand.version > 93) { + return 3; + } + } -const colorSupport = isBlinkBasedBrowser ? { - level: 1, + if (/\b(Chrome|Chromium)\//.test(navigator.userAgent)) { + return 1; + } + + return 0; +})(); + +const colorSupport = level !== 0 && { + level, hasBasic: true, - has256: false, - has16m: false, -} : false; + has256: level >= 2, + has16m: level >= 3, +}; const supportsColor = { stdout: colorSupport, diff --git a/node_modules/ava/node_modules/chalk/source/vendor/supports-color/index.d.ts b/node_modules/ava/node_modules/chalk/source/vendor/supports-color/index.d.ts index 98e3618728..db44a78519 100644 --- a/node_modules/ava/node_modules/chalk/source/vendor/supports-color/index.d.ts +++ b/node_modules/ava/node_modules/chalk/source/vendor/supports-color/index.d.ts @@ -1,13 +1,13 @@ -import {WriteStream} from 'node:tty'; +import type {WriteStream} from 'node:tty'; -export interface Options { +export type Options = { /** Whether `process.argv` should be sniffed for `--color` and `--no-color` flags. @default true */ readonly sniffFlags?: boolean; -} +}; /** Levels: @@ -21,7 +21,7 @@ export type ColorSupportLevel = 0 | 1 | 2 | 3; /** Detect whether the terminal supports color. */ -export interface ColorSupport { +export type ColorSupport = { /** The color level. */ @@ -41,11 +41,11 @@ export interface ColorSupport { Whether Truecolor 16 million colors are supported. */ has16m: boolean; -} +}; export type ColorInfo = ColorSupport | false; -export function createSupportsColor(stream: WriteStream, options?: Options): ColorInfo; +export function createSupportsColor(stream?: WriteStream, options?: Options): ColorInfo; declare const supportsColor: { stdout: ColorInfo; diff --git a/node_modules/ava/node_modules/chalk/source/vendor/supports-color/index.js b/node_modules/ava/node_modules/chalk/source/vendor/supports-color/index.js index 55f813c48d..a7cea61e9e 100644 --- a/node_modules/ava/node_modules/chalk/source/vendor/supports-color/index.js +++ b/node_modules/ava/node_modules/chalk/source/vendor/supports-color/index.js @@ -3,7 +3,7 @@ import os from 'node:os'; import tty from 'node:tty'; // From: https://github.com/sindresorhus/has-flag/blob/main/index.js -function hasFlag(flag, argv = process.argv) { +function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) { const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); const position = argv.indexOf(prefix + flag); const terminatorPosition = argv.indexOf('--'); @@ -80,6 +80,12 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) { } } + // Check for Azure DevOps pipelines. + // Has to be above the `!streamIsTTY` check. + if ('TF_BUILD' in env && 'AGENT_NAME' in env) { + return 1; + } + if (haveStream && !streamIsTTY && forceColor === undefined) { return 0; } @@ -105,7 +111,11 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) { } if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + if ('GITHUB_ACTIONS' in env) { + return 3; + } + + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { return 1; } @@ -116,12 +126,11 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) { return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; } - // Check for Azure DevOps pipelines - if ('TF_BUILD' in env && 'AGENT_NAME' in env) { - return 1; + if (env.COLORTERM === 'truecolor') { + return 3; } - if (env.COLORTERM === 'truecolor') { + if (env.TERM === 'xterm-kitty') { return 3; } @@ -129,10 +138,13 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) { const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); switch (env.TERM_PROGRAM) { - case 'iTerm.app': + case 'iTerm.app': { return version >= 3 ? 3 : 2; - case 'Apple_Terminal': + } + + case 'Apple_Terminal': { return 2; + } // No default } } diff --git a/node_modules/ava/node_modules/del/index.d.ts b/node_modules/ava/node_modules/del/index.d.ts new file mode 100644 index 0000000000..3fcb0f10c1 --- /dev/null +++ b/node_modules/ava/node_modules/del/index.d.ts @@ -0,0 +1,106 @@ +import {Options as GlobbyOptions} from 'globby'; + +export interface ProgressData { + /** + Deleted files and directories count. + */ + readonly deletedCount: number; + + /** + Total files and directories count. + */ + readonly totalCount: number; + + /** + Completed percentage. A value between `0` and `1`. + */ + readonly percent: number; +} + +export interface Options extends GlobbyOptions { + /** + Allow deleting the current working directory and outside. + + @default false + */ + readonly force?: boolean; + + /** + See what would be deleted. + + @default false + + @example + ``` + import {deleteAsync} from 'del'; + + const deletedPaths = await deleteAsync(['temp/*.js'], {dryRun: true}); + + console.log('Files and directories that would be deleted:\n', deletedPaths.join('\n')); + ``` + */ + readonly dryRun?: boolean; + + /** + Concurrency limit. Minimum: `1`. + + @default Infinity + */ + readonly concurrency?: number; + + /** + Called after each file or directory is deleted. + + @example + ``` + import {deleteAsync} from 'del'; + + await deleteAsync(patterns, { + onProgress: progress => { + // … + }}); + ``` + */ + readonly onProgress?: (progress: ProgressData) => void; +} + +/** +Delete files and directories using glob patterns. + +Note that glob patterns can only contain forward-slashes, not backward-slashes. Windows file paths can use backward-slashes as long as the path does not contain any glob-like characters, otherwise use `path.posix.join()` instead of `path.join()`. + +@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). +- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/main/test/test.js) +- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns) +@param options - You can specify any of the [`globby` options](https://github.com/sindresorhus/globby#options) in addition to the `del` options. In contrast to the `globby` defaults, `expandDirectories`, `onlyFiles`, and `followSymbolicLinks` are `false` by default. +@returns The deleted paths. + +@example +``` +import {deleteAsync} from 'del'; + +const deletedPaths = await deleteAsync(['temp/*.js', '!temp/unicorn.js']); + +console.log('Deleted files and directories:\n', deletedPaths.join('\n')); +``` +*/ +export function deleteAsync( + patterns: string | readonly string[], + options?: Options +): Promise; + +/** +Synchronously delete files and directories using glob patterns. + +Note that glob patterns can only contain forward-slashes, not backward-slashes. Windows file paths can use backward-slashes as long as the path does not contain any glob-like characters, otherwise use `path.posix.join()` instead of `path.join()`. + +@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). +- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/main/test/test.js) +- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns) +@param options - You can specify any of the [`globby` options](https://github.com/sindresorhus/globby#options) in addition to the `del` options. In contrast to the `globby` defaults, `expandDirectories`, `onlyFiles`, and `followSymbolicLinks` are `false` by default. +@returns The deleted paths. +*/ +export function deleteSync( + patterns: string | readonly string[], + options?: Options +): string[]; diff --git a/node_modules/ava/node_modules/del/index.js b/node_modules/ava/node_modules/del/index.js new file mode 100644 index 0000000000..5e2a43a8c8 --- /dev/null +++ b/node_modules/ava/node_modules/del/index.js @@ -0,0 +1,139 @@ +import {promisify} from 'node:util'; +import path from 'node:path'; +import process from 'node:process'; +import {globby, globbySync} from 'globby'; +import isGlob from 'is-glob'; +import slash from 'slash'; +import gracefulFs from 'graceful-fs'; +import isPathCwd from 'is-path-cwd'; +import isPathInside from 'is-path-inside'; +import rimraf from 'rimraf'; +import pMap from 'p-map'; + +const rimrafP = promisify(rimraf); + +const rimrafOptions = { + glob: false, + unlink: gracefulFs.unlink, + unlinkSync: gracefulFs.unlinkSync, + chmod: gracefulFs.chmod, + chmodSync: gracefulFs.chmodSync, + stat: gracefulFs.stat, + statSync: gracefulFs.statSync, + lstat: gracefulFs.lstat, + lstatSync: gracefulFs.lstatSync, + rmdir: gracefulFs.rmdir, + rmdirSync: gracefulFs.rmdirSync, + readdir: gracefulFs.readdir, + readdirSync: gracefulFs.readdirSync, +}; + +function safeCheck(file, cwd) { + if (isPathCwd(file)) { + throw new Error('Cannot delete the current working directory. Can be overridden with the `force` option.'); + } + + if (!isPathInside(file, cwd)) { + throw new Error('Cannot delete files/directories outside the current working directory. Can be overridden with the `force` option.'); + } +} + +function normalizePatterns(patterns) { + patterns = Array.isArray(patterns) ? patterns : [patterns]; + + patterns = patterns.map(pattern => { + if (process.platform === 'win32' && isGlob(pattern) === false) { + return slash(pattern); + } + + return pattern; + }); + + return patterns; +} + +export async function deleteAsync(patterns, {force, dryRun, cwd = process.cwd(), onProgress = () => {}, ...options} = {}) { + options = { + expandDirectories: false, + onlyFiles: false, + followSymbolicLinks: false, + cwd, + ...options, + }; + + patterns = normalizePatterns(patterns); + + const paths = await globby(patterns, options); + const files = paths.sort((a, b) => b.localeCompare(a)); + + if (files.length === 0) { + onProgress({ + totalCount: 0, + deletedCount: 0, + percent: 1, + }); + } + + let deletedCount = 0; + + const mapper = async file => { + file = path.resolve(cwd, file); + + if (!force) { + safeCheck(file, cwd); + } + + if (!dryRun) { + await rimrafP(file, rimrafOptions); + } + + deletedCount += 1; + + onProgress({ + totalCount: files.length, + deletedCount, + percent: deletedCount / files.length, + }); + + return file; + }; + + const removedFiles = await pMap(files, mapper, options); + + removedFiles.sort((a, b) => a.localeCompare(b)); + + return removedFiles; +} + +export function deleteSync(patterns, {force, dryRun, cwd = process.cwd(), ...options} = {}) { + options = { + expandDirectories: false, + onlyFiles: false, + followSymbolicLinks: false, + cwd, + ...options, + }; + + patterns = normalizePatterns(patterns); + + const files = globbySync(patterns, options) + .sort((a, b) => b.localeCompare(a)); + + const removedFiles = files.map(file => { + file = path.resolve(cwd, file); + + if (!force) { + safeCheck(file, cwd); + } + + if (!dryRun) { + rimraf.sync(file, rimrafOptions); + } + + return file; + }); + + removedFiles.sort((a, b) => a.localeCompare(b)); + + return removedFiles; +} diff --git a/node_modules/ava/node_modules/del/license b/node_modules/ava/node_modules/del/license new file mode 100644 index 0000000000..fa7ceba3eb --- /dev/null +++ b/node_modules/ava/node_modules/del/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +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/ava/node_modules/del/node_modules/slash/index.d.ts b/node_modules/ava/node_modules/del/node_modules/slash/index.d.ts new file mode 100644 index 0000000000..10438fbe72 --- /dev/null +++ b/node_modules/ava/node_modules/del/node_modules/slash/index.d.ts @@ -0,0 +1,23 @@ +/** +Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`. + +[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters. + +@param path - A Windows backslash path. +@returns A path with forward slashes. + +@example +``` +import path from 'path'; +import slash from 'slash'; + +const string = path.join('foo', 'bar'); +// Unix => foo/bar +// Windows => foo\\bar + +slash(string); +// Unix => foo/bar +// Windows => foo/bar +``` +*/ +export default function slash(path: string): string; diff --git a/node_modules/ava/node_modules/del/node_modules/slash/index.js b/node_modules/ava/node_modules/del/node_modules/slash/index.js new file mode 100644 index 0000000000..b52d8de885 --- /dev/null +++ b/node_modules/ava/node_modules/del/node_modules/slash/index.js @@ -0,0 +1,10 @@ +export default function slash(path) { + const isExtendedLengthPath = /^\\\\\?\\/.test(path); + const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex + + if (isExtendedLengthPath || hasNonAscii) { + return path; + } + + return path.replace(/\\/g, '/'); +} diff --git a/node_modules/ava/node_modules/del/node_modules/slash/license b/node_modules/ava/node_modules/del/node_modules/slash/license new file mode 100644 index 0000000000..fa7ceba3eb --- /dev/null +++ b/node_modules/ava/node_modules/del/node_modules/slash/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +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/ava/node_modules/del/node_modules/slash/package.json b/node_modules/ava/node_modules/del/node_modules/slash/package.json new file mode 100644 index 0000000000..a9f2df6218 --- /dev/null +++ b/node_modules/ava/node_modules/del/node_modules/slash/package.json @@ -0,0 +1,38 @@ +{ + "name": "slash", + "version": "4.0.0", + "description": "Convert Windows backslash paths to slash paths", + "license": "MIT", + "repository": "sindresorhus/slash", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "path", + "seperator", + "slash", + "backslash", + "windows", + "convert" + ], + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.14.0", + "xo": "^0.38.2" + } +} diff --git a/node_modules/ava/node_modules/del/node_modules/slash/readme.md b/node_modules/ava/node_modules/del/node_modules/slash/readme.md new file mode 100644 index 0000000000..2a66eefb77 --- /dev/null +++ b/node_modules/ava/node_modules/del/node_modules/slash/readme.md @@ -0,0 +1,48 @@ +# slash + +> Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar` + +[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters. + +This was created since the `path` methods in Node.js outputs `\\` paths on Windows. + +## Install + +``` +$ npm install slash +``` + +## Usage + +```js +import path from 'path'; +import slash from 'slash'; + +const string = path.join('foo', 'bar'); +// Unix => foo/bar +// Windows => foo\\bar + +slash(string); +// Unix => foo/bar +// Windows => foo/bar +``` + +## API + +### slash(path) + +Type: `string` + +Accepts a Windows backslash path and returns a path with forward slashes. + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/ava/node_modules/del/package.json b/node_modules/ava/node_modules/del/package.json new file mode 100644 index 0000000000..411f328f78 --- /dev/null +++ b/node_modules/ava/node_modules/del/package.json @@ -0,0 +1,73 @@ +{ + "name": "del", + "version": "7.0.0", + "description": "Delete files and directories", + "license": "MIT", + "repository": "sindresorhus/del", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "types": "./index.d.ts", + "engines": { + "node": ">=14.16" + }, + "scripts": { + "test": "xo && ava && tsd", + "bench": "node benchmark.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "delete", + "files", + "folders", + "directories", + "remove", + "destroy", + "trash", + "unlink", + "clean", + "cleaning", + "cleanup", + "rm", + "rmrf", + "rimraf", + "rmdir", + "glob", + "gulpfriendly", + "file", + "folder", + "directory", + "fs", + "filesystem" + ], + "dependencies": { + "globby": "^13.1.2", + "graceful-fs": "^4.2.10", + "is-glob": "^4.0.3", + "is-path-cwd": "^3.0.0", + "is-path-inside": "^4.0.0", + "p-map": "^5.5.0", + "rimraf": "^3.0.2", + "slash": "^4.0.0" + }, + "devDependencies": { + "ava": "^4.3.1", + "benchmark": "^2.1.4", + "make-dir": "^3.1.0", + "tempy": "^3.0.0", + "tsd": "^0.22.0", + "xo": "^0.50.0" + }, + "ava": { + "serial": true, + "workerThreads": false + } +} diff --git a/node_modules/ava/node_modules/del/readme.md b/node_modules/ava/node_modules/del/readme.md new file mode 100644 index 0000000000..2327d23fd7 --- /dev/null +++ b/node_modules/ava/node_modules/del/readme.md @@ -0,0 +1,147 @@ +# del + +> Delete files and directories using [globs](https://github.com/sindresorhus/globby#globbing-patterns) + +Similar to [rimraf](https://github.com/isaacs/rimraf), but with a Promise API and support for multiple files and globbing. It also protects you against deleting the current working directory and above. + +## Install + +```sh +npm install del +``` + +## Usage + +```js +import {deleteAsync} from 'del'; + +const deletedFilePaths = await deleteAsync(['temp/*.js', '!temp/unicorn.js']); +const deletedDirectoryPaths = await deleteAsync(['temp', 'public']); + +console.log('Deleted files:\n', deletedFilePaths.join('\n')); +console.log('\n\n'); +console.log('Deleted directories:\n', deletedDirectoryPaths.join('\n')); +``` + +## Beware + +The glob pattern `**` matches all children and *the parent*. + +So this won't work: + +```js +deleteSync(['public/assets/**', '!public/assets/goat.png']); +``` + +You have to explicitly ignore the parent directories too: + +```js +deleteSync(['public/assets/**', '!public/assets', '!public/assets/goat.png']); +``` + +To delete all subdirectories inside `public/`, you can do: + +```js +deleteSync(['public/*/']); +``` + +Suggestions on how to improve this welcome! + +## API + +Note that glob patterns can only contain forward-slashes, not backward-slashes. Windows file paths can use backward-slashes as long as the path does not contain any glob-like characters, otherwise use `path.posix.join()` instead of `path.join()`. + +### deleteAsync(patterns, options?) + +Returns `Promise` with the deleted paths. + +### deleteSync(patterns, options?) + +Returns `string[]` with the deleted paths. + +#### patterns + +Type: `string | string[]` + +See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). + +- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/main/test/test.js) +- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns) + +#### options + +Type: `object` + +You can specify any of the [`globby` options](https://github.com/sindresorhus/globby#options) in addition to the below options. In contrast to the `globby` defaults, `expandDirectories`, `onlyFiles`, and `followSymbolicLinks` are `false` by default. + +##### force + +Type: `boolean`\ +Default: `false` + +Allow deleting the current working directory and outside. + +##### dryRun + +Type: `boolean`\ +Default: `false` + +See what would be deleted. + +```js +import {deleteAsync} from 'del'; + +const deletedPaths = await deleteAsync(['temp/*.js'], {dryRun: true}); + +console.log('Files and directories that would be deleted:\n', deletedPaths.join('\n')); +``` + +##### concurrency + +Type: `number`\ +Default: `Infinity`\ +Minimum: `1` + +Concurrency limit. + +##### onProgress + +Type: `(progress: ProgressData) => void` + +Called after each file or directory is deleted. + +```js +import {deleteAsync} from 'del'; + +await deleteAsync(patterns, { + onProgress: progress => { + // … +}}); +``` + +###### ProgressData + +```js +{ + totalCount: number, + deletedCount: number, + percent: number +} +``` + +- `percent` is a value between `0` and `1` + +## CLI + +See [del-cli](https://github.com/sindresorhus/del-cli) for a CLI for this module and [trash-cli](https://github.com/sindresorhus/trash-cli) for a safe version that is suitable for running by hand. + +## del for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of del and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-del?utm_source=npm-del&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + +## Related + +- [make-dir](https://github.com/sindresorhus/make-dir) - Make a directory and its parents if needed +- [globby](https://github.com/sindresorhus/globby) - User-friendly glob matching diff --git a/node_modules/ava/node_modules/globby/ignore.js b/node_modules/ava/node_modules/globby/ignore.js index c6172f9d37..7de494a319 100644 --- a/node_modules/ava/node_modules/globby/ignore.js +++ b/node_modules/ava/node_modules/globby/ignore.js @@ -52,7 +52,7 @@ const getIsIgnoredPredicate = (files, cwd) => { return fileOrDirectory => { fileOrDirectory = toPath(fileOrDirectory); fileOrDirectory = toRelativePath(fileOrDirectory, cwd); - return ignores.ignores(slash(fileOrDirectory)); + return fileOrDirectory ? ignores.ignores(slash(fileOrDirectory)) : false; }; }; diff --git a/node_modules/ava/node_modules/globby/package.json b/node_modules/ava/node_modules/globby/package.json index 30418b9f78..c24c3ca0e8 100644 --- a/node_modules/ava/node_modules/globby/package.json +++ b/node_modules/ava/node_modules/globby/package.json @@ -1,6 +1,6 @@ { "name": "globby", - "version": "13.1.2", + "version": "13.1.3", "description": "User-friendly glob matching", "license": "MIT", "repository": "sindresorhus/globby", diff --git a/node_modules/ava/node_modules/is-path-cwd/index.d.ts b/node_modules/ava/node_modules/is-path-cwd/index.d.ts new file mode 100644 index 0000000000..2c6cd6b89c --- /dev/null +++ b/node_modules/ava/node_modules/is-path-cwd/index.d.ts @@ -0,0 +1,15 @@ +/** +Check if a path is the [current working directory](https://en.wikipedia.org/wiki/Working_directory). + +@example +``` +import isPathCwd from 'is-path-cwd'; + +isPathCwd(process.cwd()); +//=> true + +isPathCwd('unicorn'); +//=> false +``` +*/ +export default function isPathCwd(path: string): boolean; diff --git a/node_modules/ava/node_modules/is-path-cwd/index.js b/node_modules/ava/node_modules/is-path-cwd/index.js new file mode 100644 index 0000000000..229e38dae4 --- /dev/null +++ b/node_modules/ava/node_modules/is-path-cwd/index.js @@ -0,0 +1,15 @@ +import process from 'node:process'; +import path from 'node:path'; + +export default function isPathCwd(path_) { + let cwd = process.cwd(); + + path_ = path.resolve(path_); + + if (process.platform === 'win32') { + cwd = cwd.toLowerCase(); + path_ = path_.toLowerCase(); + } + + return path_ === cwd; +} diff --git a/node_modules/ava/node_modules/is-path-cwd/license b/node_modules/ava/node_modules/is-path-cwd/license new file mode 100644 index 0000000000..fa7ceba3eb --- /dev/null +++ b/node_modules/ava/node_modules/is-path-cwd/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +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/ava/node_modules/is-path-cwd/package.json b/node_modules/ava/node_modules/is-path-cwd/package.json new file mode 100644 index 0000000000..0dfd9e5505 --- /dev/null +++ b/node_modules/ava/node_modules/is-path-cwd/package.json @@ -0,0 +1,39 @@ +{ + "name": "is-path-cwd", + "version": "3.0.0", + "description": "Check if a path is the current working directory", + "license": "MIT", + "repository": "sindresorhus/is-path-cwd", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "path", + "cwd", + "pwd", + "check", + "filepath", + "file", + "folder" + ], + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.17.0", + "xo": "^0.44.0" + } +} diff --git a/node_modules/ava/node_modules/is-path-cwd/readme.md b/node_modules/ava/node_modules/is-path-cwd/readme.md new file mode 100644 index 0000000000..3115b6ffb8 --- /dev/null +++ b/node_modules/ava/node_modules/is-path-cwd/readme.md @@ -0,0 +1,33 @@ +# is-path-cwd + +> Check if a path is the [current working directory](https://en.wikipedia.org/wiki/Working_directory) + +## Install + +``` +$ npm install is-path-cwd +``` + +## Usage + +```js +import isPathCwd from 'is-path-cwd'; + +isPathCwd(process.cwd()); +//=> true + +isPathCwd('unicorn'); +//=> false +``` + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/ava/node_modules/is-path-inside/index.d.ts b/node_modules/ava/node_modules/is-path-inside/index.d.ts new file mode 100644 index 0000000000..f185a393ac --- /dev/null +++ b/node_modules/ava/node_modules/is-path-inside/index.d.ts @@ -0,0 +1,25 @@ +/** +Check if a path is inside another path. + +Note that relative paths are resolved against `process.cwd()` to make them absolute. + +_Important:_ This package is meant for use with path manipulation. It does not check if the paths exist nor does it resolve symlinks. You should not use this as a security mechanism to guard against access to certain places on the file system. + +@example +``` +import isPathInside from 'is-path-inside'; + +isPathInside('a/b/c', 'a/b'); +//=> true + +isPathInside('a/b/c', 'x/y'); +//=> false + +isPathInside('a/b/c', 'a/b/c'); +//=> false + +isPathInside('/Users/sindresorhus/dev/unicorn', '/Users/sindresorhus'); +//=> true +``` +*/ +export default function isPathInside(childPath: string, parentPath: string): boolean; diff --git a/node_modules/ava/node_modules/is-path-inside/index.js b/node_modules/ava/node_modules/is-path-inside/index.js new file mode 100644 index 0000000000..761916bd01 --- /dev/null +++ b/node_modules/ava/node_modules/is-path-inside/index.js @@ -0,0 +1,12 @@ +import path from 'node:path'; + +export default function isPathInside(childPath, parentPath) { + const relation = path.relative(parentPath, childPath); + + return Boolean( + relation && + relation !== '..' && + !relation.startsWith(`..${path.sep}`) && + relation !== path.resolve(childPath) + ); +} diff --git a/node_modules/ava/node_modules/is-path-inside/license b/node_modules/ava/node_modules/is-path-inside/license new file mode 100644 index 0000000000..fa7ceba3eb --- /dev/null +++ b/node_modules/ava/node_modules/is-path-inside/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +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/ava/node_modules/is-path-inside/package.json b/node_modules/ava/node_modules/is-path-inside/package.json new file mode 100644 index 0000000000..23a6c739fa --- /dev/null +++ b/node_modules/ava/node_modules/is-path-inside/package.json @@ -0,0 +1,38 @@ +{ + "name": "is-path-inside", + "version": "4.0.0", + "description": "Check if a path is inside another path", + "license": "MIT", + "repository": "sindresorhus/is-path-inside", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "path", + "inside", + "folder", + "directory", + "file", + "resolve" + ], + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.14.0", + "xo": "^0.39.1" + } +} diff --git a/node_modules/ava/node_modules/is-path-inside/readme.md b/node_modules/ava/node_modules/is-path-inside/readme.md new file mode 100644 index 0000000000..90878297a9 --- /dev/null +++ b/node_modules/ava/node_modules/is-path-inside/readme.md @@ -0,0 +1,59 @@ +# is-path-inside + +> Check if a path is inside another path + +## Install + +``` +$ npm install is-path-inside +``` + +## Usage + +```js +import isPathInside from 'is-path-inside'; + +isPathInside('a/b/c', 'a/b'); +//=> true + +isPathInside('a/b/c', 'x/y'); +//=> false + +isPathInside('a/b/c', 'a/b/c'); +//=> false + +isPathInside('/Users/sindresorhus/dev/unicorn', '/Users/sindresorhus'); +//=> true +``` + +## API + +### isPathInside(childPath, parentPath) + +Note that relative paths are resolved against `process.cwd()` to make them absolute. + +**Important:** This package is meant for use with path manipulation. It does not check if the paths exist nor does it resolve symlinks. You should not use this as a security mechanism to guard against access to certain places on the file system. + +#### childPath + +Type: `string` + +The path that should be inside `parentPath`. + +#### parentPath + +Type: `string` + +The path that should contain `childPath`. + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/ava/package.json b/node_modules/ava/package.json index 7c2c6d1686..2756f05d85 100644 --- a/node_modules/ava/package.json +++ b/node_modules/ava/package.json @@ -1,6 +1,6 @@ { "name": "ava", - "version": "4.3.3", + "version": "5.1.1", "description": "Node.js test runner that lets you develop with confidence.", "license": "MIT", "repository": "avajs/ava", @@ -11,18 +11,18 @@ "exports": { ".": { "import": { - "types": "./index.d.ts", + "types": "./entrypoints/main.d.ts", "default": "./entrypoints/main.mjs" }, "require": { - "types": "./entrypoints/index.d.cts", + "types": "./entrypoints/main.d.cts", "default": "./entrypoints/main.cjs" } }, "./eslint-plugin-helper": "./entrypoints/eslint-plugin-helper.cjs", "./plugin": { "import": { - "types": "./plugin.d.ts", + "types": "./entrypoints/plugin.d.ts", "default": "./entrypoints/plugin.mjs" }, "require": { @@ -33,18 +33,17 @@ }, "type": "module", "engines": { - "node": ">=12.22 <13 || >=14.17 <15 || >=16.4 <17 || >=18" + "node": ">=14.19 <15 || >=16.15 <17 || >=18" }, "scripts": { "cover": "c8 --report=none test-ava && c8 --report=none --no-clean tap && c8 report", - "test": "xo && tsd && npm run -s cover" + "test": "xo && tsc --noEmit && npm run -s cover" }, "files": [ "entrypoints", "lib", "types", - "index.d.ts", - "plugin.d.ts" + "*.d.ts" ], "keywords": [ "🦄", @@ -82,17 +81,17 @@ "typescript" ], "dependencies": { - "acorn": "^8.7.1", + "acorn": "^8.8.1", "acorn-walk": "^8.2.0", - "ansi-styles": "^6.1.0", + "ansi-styles": "^6.2.1", "arrgv": "^1.0.2", "arrify": "^3.0.0", "callsites": "^4.0.0", "cbor": "^8.1.0", - "chalk": "^5.0.1", + "chalk": "^5.2.0", "chokidar": "^3.5.3", "chunkd": "^2.0.1", - "ci-info": "^3.3.1", + "ci-info": "^3.7.1", "ci-parallel-vars": "^1.0.1", "clean-yaml-object": "^0.1.0", "cli-truncate": "^3.1.0", @@ -101,10 +100,10 @@ "concordance": "^5.0.4", "currently-unhandled": "^0.4.1", "debug": "^4.3.4", - "del": "^6.1.1", - "emittery": "^0.11.0", - "figures": "^4.0.1", - "globby": "^13.1.1", + "del": "^7.0.0", + "emittery": "^1.0.1", + "figures": "^5.0.0", + "globby": "^13.1.3", "ignore-by-default": "^2.1.0", "indent-string": "^5.0.0", "is-error": "^2.2.2", @@ -114,40 +113,40 @@ "mem": "^9.0.2", "ms": "^2.1.3", "p-event": "^5.0.1", - "p-map": "^5.4.0", + "p-map": "^5.5.0", "picomatch": "^2.3.1", "pkg-conf": "^4.0.0", "plur": "^5.1.0", - "pretty-ms": "^7.0.1", + "pretty-ms": "^8.0.0", "resolve-cwd": "^3.0.0", "slash": "^3.0.0", - "stack-utils": "^2.0.5", + "stack-utils": "^2.0.6", "strip-ansi": "^7.0.1", "supertap": "^3.0.1", - "temp-dir": "^2.0.0", - "write-file-atomic": "^4.0.1", - "yargs": "^17.5.1" + "temp-dir": "^3.0.0", + "write-file-atomic": "^5.0.0", + "yargs": "^17.6.2" }, "devDependencies": { "@ava/test": "github:avajs/test", "@ava/typescript": "^3.0.1", - "@sinonjs/fake-timers": "^9.1.2", - "ansi-escapes": "^5.0.0", - "c8": "^7.11.3", + "@sindresorhus/tsconfig": "^3.0.1", + "ansi-escapes": "^6.0.0", + "c8": "^7.12.0", "delay": "^5.0.0", "execa": "^6.1.0", - "fs-extra": "^10.1.0", + "fs-extra": "^11.1.0", "get-stream": "^6.0.1", "replace-string": "^4.0.0", - "sinon": "^13.0.2", - "tap": "^16.2.0", + "sinon": "^15.0.1", + "tap": "^16.3.3", "temp-write": "^5.0.0", - "tempy": "^2.0.0", + "tempy": "^3.0.0", "touch": "^3.1.0", - "tsd": "^0.20.0", - "typescript": "^4.7.2", - "xo": "^0.49.0", - "zen-observable": "^0.8.15" + "tsd": "^0.25.0", + "typescript": "^4.9.4", + "xo": "^0.53.1", + "zen-observable": "^0.10.0" }, "peerDependencies": { "@ava/typescript": "*" @@ -158,7 +157,7 @@ } }, "volta": { - "node": "18.3.0", - "npm": "8.12.0" + "node": "18.13.0", + "npm": "9.3.0" } } diff --git a/node_modules/ava/plugin.d.ts b/node_modules/ava/plugin.d.ts index a2f68e1797..a1524f2cca 100644 --- a/node_modules/ava/plugin.d.ts +++ b/node_modules/ava/plugin.d.ts @@ -1,77 +1,3 @@ -import {URL} from 'node:url'; +// For compatibility with resolution algorithms other than Node16. -export namespace SharedWorker { - export type ProtocolIdentifier = 'ava-4'; - - export type FactoryOptions = { - negotiateProtocol (supported: readonly ['ava-4']): Protocol; - // Add overloads for additional protocols. - }; - - export type Factory = (options: FactoryOptions) => void; - - export type Protocol = { - readonly initialData: Data; - readonly protocol: 'ava-4'; - broadcast: (data: Data) => BroadcastMessage; - ready: () => Protocol; - subscribe: () => AsyncIterableIterator>; - testWorkers: () => AsyncIterableIterator>; - }; - - export type BroadcastMessage = { - readonly id: string; - replies: () => AsyncIterableIterator>; - }; - - export type PublishedMessage = { - readonly id: string; - replies: () => AsyncIterableIterator>; - }; - - export type ReceivedMessage = { - readonly data: Data; - readonly id: string; - readonly testWorker: TestWorker; - reply: (data: Data) => PublishedMessage; - }; - - export type TestWorker = { - readonly id: string; - readonly file: string; - publish: (data: Data) => PublishedMessage; - subscribe: () => AsyncIterableIterator>; - teardown: (fn: (() => Promise) | (() => void)) => () => Promise; - }; - - export namespace Plugin { - export type RegistrationOptions = { - readonly filename: string | URL; - readonly initialData?: Data; - readonly supportedProtocols: readonly Identifier[]; - readonly teardown?: () => void; - }; - - export type Protocol = { - readonly available: Promise; - readonly currentlyAvailable: boolean; - readonly protocol: 'ava-4'; - publish: (data: Data) => PublishedMessage; - subscribe: () => AsyncIterableIterator>; - }; - - export type PublishedMessage = { - readonly id: string; - replies: () => AsyncIterableIterator>; - }; - - export type ReceivedMessage = { - readonly data: Data; - readonly id: string; - reply: (data: Data) => PublishedMessage; - }; - } -} - -export function registerSharedWorker(options: SharedWorker.Plugin.RegistrationOptions<'ava-4', Data>): SharedWorker.Plugin.Protocol; -// Add overloads for additional protocols. +export * from './entrypoints/plugin.cjs'; diff --git a/node_modules/ava/types/assertions.d.ts b/node_modules/ava/types/assertions.d.cts similarity index 93% rename from node_modules/ava/types/assertions.d.ts rename to node_modules/ava/types/assertions.d.cts index 68fd8d85b2..08c3e05f19 100644 --- a/node_modules/ava/types/assertions.d.ts +++ b/node_modules/ava/types/assertions.d.cts @@ -18,7 +18,7 @@ export type ThrowsExpectation = { name?: string; }; -export interface Assertions { +export type Assertions = { /** * Assert that `actual` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), returning a boolean * indicating whether the assertion passed. @@ -118,9 +118,9 @@ export interface Assertions { * indicating whether the assertion passed. */ truthy: TruthyAssertion; -} +}; -export interface AssertAssertion { +export type AssertAssertion = { /** * Assert that `actual` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), returning a boolean * indicating whether the assertion passed. @@ -129,9 +129,9 @@ export interface AssertAssertion { /** Skip this assertion. */ skip(actual: any, message?: string): void; -} +}; -export interface DeepEqualAssertion { +export type DeepEqualAssertion = { /** * Assert that `actual` is [deeply equal](https://github.com/concordancejs/concordance#comparison-details) to * `expected`, returning a boolean indicating whether the assertion passed. @@ -152,9 +152,9 @@ export interface DeepEqualAssertion { /** Skip this assertion. */ skip(actual: any, expected: any, message?: string): void; -} +}; -export interface LikeAssertion { +export type LikeAssertion = { /** * Assert that `value` is like `selector`, returning a boolean indicating whether the assertion passed. */ @@ -162,17 +162,17 @@ export interface LikeAssertion { /** Skip this assertion. */ skip(value: any, selector: any, message?: string): void; -} +}; -export interface FailAssertion { +export type FailAssertion = { /** Fail the test, always returning `false`. */ (message?: string): boolean; /** Skip this assertion. */ skip(message?: string): void; -} +}; -export interface FalseAssertion { +export type FalseAssertion = { /** * Assert that `actual` is strictly false, returning a boolean indicating whether the assertion passed. */ @@ -180,9 +180,9 @@ export interface FalseAssertion { /** Skip this assertion. */ skip(actual: any, message?: string): void; -} +}; -export interface FalsyAssertion { +export type FalsyAssertion = { /** * Assert that `actual` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy), returning a boolean * indicating whether the assertion passed. @@ -191,9 +191,9 @@ export interface FalsyAssertion { /** Skip this assertion. */ skip(actual: any, message?: string): void; -} +}; -export interface IsAssertion { +export type IsAssertion = { /** * Assert that `actual` is [the same * value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) as `expected`, @@ -203,9 +203,9 @@ export interface IsAssertion { /** Skip this assertion. */ skip(actual: any, expected: any, message?: string): void; -} +}; -export interface NotAssertion { +export type NotAssertion = { /** * Assert that `actual` is not [the same * value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) as `expected`, @@ -215,9 +215,9 @@ export interface NotAssertion { /** Skip this assertion. */ skip(actual: any, expected: any, message?: string): void; -} +}; -export interface NotDeepEqualAssertion { +export type NotDeepEqualAssertion = { /** * Assert that `actual` is not [deeply equal](https://github.com/concordancejs/concordance#comparison-details) to * `expected`, returning a boolean indicating whether the assertion passed. @@ -226,9 +226,9 @@ export interface NotDeepEqualAssertion { /** Skip this assertion. */ skip(actual: any, expected: any, message?: string): void; -} +}; -export interface NotRegexAssertion { +export type NotRegexAssertion = { /** * Assert that `string` does not match the regular expression, returning a boolean indicating whether the assertion * passed. @@ -237,17 +237,17 @@ export interface NotRegexAssertion { /** Skip this assertion. */ skip(string: string, regex: RegExp, message?: string): void; -} +}; -export interface NotThrowsAssertion { +export type NotThrowsAssertion = { /** Assert that the function does not throw. */ (fn: () => any, message?: string): void; /** Skip this assertion. */ skip(fn: () => any, message?: string): void; -} +}; -export interface NotThrowsAsyncAssertion { +export type NotThrowsAsyncAssertion = { /** Assert that the async function does not throw. You must await the result. */ (fn: () => PromiseLike, message?: string): Promise; @@ -256,17 +256,17 @@ export interface NotThrowsAsyncAssertion { /** Skip this assertion. */ skip(nonThrower: any, message?: string): void; -} +}; -export interface PassAssertion { +export type PassAssertion = { /** Count a passing assertion, always returning `true`. */ (message?: string): boolean; /** Skip this assertion. */ skip(message?: string): void; -} +}; -export interface RegexAssertion { +export type RegexAssertion = { /** * Assert that `string` matches the regular expression, returning a boolean indicating whether the assertion passed. */ @@ -274,9 +274,9 @@ export interface RegexAssertion { /** Skip this assertion. */ skip(string: string, regex: RegExp, message?: string): void; -} +}; -export interface SnapshotAssertion { +export type SnapshotAssertion = { /** * Assert that `expected` is [deeply equal](https://github.com/concordancejs/concordance#comparison-details) to a * previously recorded [snapshot](https://github.com/concordancejs/concordance#serialization-details), or if @@ -286,9 +286,9 @@ export interface SnapshotAssertion { /** Skip this assertion. */ skip(expected: any, message?: string): void; -} +}; -export interface ThrowsAssertion { +export type ThrowsAssertion = { /** * Assert that the function throws [an error](https://www.npmjs.com/package/is-error). If so, returns the error value. * The error must satisfy all expectations. Returns undefined when the assertion fails. @@ -297,9 +297,9 @@ export interface ThrowsAssertion { /** Skip this assertion. */ skip(fn: () => any, expectations?: any, message?: string): void; -} +}; -export interface ThrowsAsyncAssertion { +export type ThrowsAsyncAssertion = { /** * Assert that the async function throws [an error](https://www.npmjs.com/package/is-error). If so, returns the error * value. Returns undefined when the assertion fails. You must await the result. The error must satisfy all expectations. @@ -315,9 +315,9 @@ export interface ThrowsAsyncAssertion { /** Skip this assertion. */ skip(thrower: any, expectations?: any, message?: string): void; -} +}; -export interface TrueAssertion { +export type TrueAssertion = { /** * Assert that `actual` is strictly true, returning a boolean indicating whether the assertion passed. */ @@ -325,9 +325,9 @@ export interface TrueAssertion { /** Skip this assertion. */ skip(actual: any, message?: string): void; -} +}; -export interface TruthyAssertion { +export type TruthyAssertion = { /** * Assert that `actual` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), returning a boolean * indicating whether the assertion passed. @@ -336,4 +336,4 @@ export interface TruthyAssertion { /** Skip this assertion. */ skip(actual: any, message?: string): void; -} +}; diff --git a/node_modules/ava/types/shared-worker.d.cts b/node_modules/ava/types/shared-worker.d.cts new file mode 100644 index 0000000000..bcb57d99cc --- /dev/null +++ b/node_modules/ava/types/shared-worker.d.cts @@ -0,0 +1,74 @@ +import type {URL} from 'node:url'; + +export namespace SharedWorker { + export type ProtocolIdentifier = 'ava-4'; + + export type FactoryOptions = { + negotiateProtocol (supported: readonly ['ava-4']): Protocol; + // Add overloads for additional protocols. + }; + + export type Factory = (options: FactoryOptions) => void; + + export type Protocol = { + readonly initialData: Data; + readonly protocol: 'ava-4'; + broadcast: (data: Data) => BroadcastMessage; + ready: () => Protocol; + subscribe: () => AsyncIterableIterator>; + testWorkers: () => AsyncIterableIterator>; + }; + + export type BroadcastMessage = { + readonly id: string; + replies: () => AsyncIterableIterator>; + }; + + export type PublishedMessage = { + readonly id: string; + replies: () => AsyncIterableIterator>; + }; + + export type ReceivedMessage = { + readonly data: Data; + readonly id: string; + readonly testWorker: TestWorker; + reply: (data: Data) => PublishedMessage; + }; + + export type TestWorker = { + readonly id: string; + readonly file: string; + publish: (data: Data) => PublishedMessage; + subscribe: () => AsyncIterableIterator>; + teardown: (fn: (() => Promise) | (() => void)) => () => Promise; + }; + + export namespace Plugin { + export type RegistrationOptions = { + readonly filename: string | URL; + readonly initialData?: Data; + readonly supportedProtocols: readonly Identifier[]; + readonly teardown?: () => void; + }; + + export type Protocol = { + readonly available: Promise; + readonly currentlyAvailable: boolean; + readonly protocol: 'ava-4'; + publish: (data: Data) => PublishedMessage; + subscribe: () => AsyncIterableIterator>; + }; + + export type PublishedMessage = { + readonly id: string; + replies: () => AsyncIterableIterator>; + }; + + export type ReceivedMessage = { + readonly data: Data; + readonly id: string; + reply: (data: Data) => PublishedMessage; + }; + } +} diff --git a/node_modules/ava/types/subscribable.d.ts b/node_modules/ava/types/subscribable.d.cts similarity index 70% rename from node_modules/ava/types/subscribable.d.ts rename to node_modules/ava/types/subscribable.d.cts index 3a3399bca1..42bb0f17c5 100644 --- a/node_modules/ava/types/subscribable.d.ts +++ b/node_modules/ava/types/subscribable.d.cts @@ -1,6 +1,6 @@ -export interface Subscribable { +export type Subscribable = { subscribe(observer: { error(error: any): void; complete(): void; }): void; -} +}; diff --git a/node_modules/ava/types/test-fn.d.ts b/node_modules/ava/types/test-fn.d.cts similarity index 90% rename from node_modules/ava/types/test-fn.d.ts rename to node_modules/ava/types/test-fn.d.cts index 730651ddb7..8eb16785df 100644 --- a/node_modules/ava/types/test-fn.d.ts +++ b/node_modules/ava/types/test-fn.d.cts @@ -1,9 +1,9 @@ -import type {Assertions} from './assertions.js'; -import type {Subscribable} from './subscribable.js'; -import type {TryFn} from './try-fn.js'; +import type {Assertions} from './assertions.cjs'; +import type {Subscribable} from './subscribable.cjs'; +import type {TryFn} from './try-fn.cjs'; /** The `t` value passed to test & hook implementations. */ -export interface ExecutionContext extends Assertions { +export type ExecutionContext = { /** Test context, shared with hooks. */ context: Context; @@ -18,17 +18,17 @@ export interface ExecutionContext extends Assertions { readonly teardown: TeardownFn; readonly timeout: TimeoutFn; readonly try: TryFn; -} +} & Assertions; -export interface LogFn { +export type LogFn = { /** Log one or more values. */ (...values: any[]): void; /** Skip logging. */ skip(...values: any[]): void; -} +}; -export interface PlanFn { +export type PlanFn = { /** * Plan how many assertion there are in the test. The test will fail if the actual assertion count doesn't match the * number of planned assertions. See [assertion planning](https://github.com/avajs/ava#assertion-planning). @@ -37,7 +37,7 @@ export interface PlanFn { /** Don't plan assertions. */ skip(count: number): void; -} +}; /** * Set a timeout for the test, in milliseconds. The test will fail if the timeout is exceeded. @@ -67,7 +67,7 @@ export type Macro = { /** A test or hook implementation. */ export type Implementation = ImplementationFn | Macro; -export interface TestFn { +export type TestFn = { /** Declare a concurrent test. Additional arguments are passed to the implementation or macro. */ (title: string, implementation: Implementation, ...args: Args): void; @@ -88,9 +88,9 @@ export interface TestFn { serial: SerialFn; skip: SkipFn; todo: TodoFn; -} +}; -export interface AfterFn { +export type AfterFn = { /** * Declare a hook that is run once, after all tests have passed. * Additional arguments are passed to the implementation or macro. @@ -105,9 +105,9 @@ export interface AfterFn { always: AlwaysInterface; skip: HookSkipFn; -} +}; -export interface AlwaysInterface { +export type AlwaysInterface = { /** * Declare a hook that is run once, after all tests are done. * Additional arguments are passed to the implementation or macro. @@ -121,9 +121,9 @@ export interface AlwaysInterface { (implementation: Implementation, ...args: Args): void; skip: HookSkipFn; -} +}; -export interface BeforeFn { +export type BeforeFn = { /** * Declare a hook that is run once, before all tests. * Additional arguments are passed to the implementation or macro. @@ -137,9 +137,9 @@ export interface BeforeFn { (implementation: Implementation, ...args: Args): void; skip: HookSkipFn; -} +}; -export interface FailingFn { +export type FailingFn = { /** * Declare a concurrent test that is expected to fail. * Additional arguments are passed to the implementation or macro. @@ -154,17 +154,17 @@ export interface FailingFn { only: OnlyFn; skip: SkipFn; -} +}; -export interface HookSkipFn { +export type HookSkipFn = { /** Skip this hook. */ (title: string, implementation: Implementation, ...args: Args): void; /** Skip this hook. */ (implementation: Implementation, ...args: Args): void; -} +}; -export interface OnlyFn { +export type OnlyFn = { /** * Declare a test. Only this test and others declared with `.only()` are run. * Additional arguments are passed to the implementation or macro. @@ -176,9 +176,9 @@ export interface OnlyFn { * Additional arguments are passed to the macro. The macro is responsible for generating a unique test title. */ (macro: Macro, ...args: Args): void; -} +}; -export interface SerialFn { +export type SerialFn = { /** Declare a serial test. Additional arguments are passed to the implementation or macro. */ (title: string, implementation: Implementation, ...args: Args): void; @@ -195,15 +195,15 @@ export interface SerialFn { only: OnlyFn; skip: SkipFn; todo: TodoFn; -} +}; -export interface SkipFn { +export type SkipFn = { /** Skip this test. */ (title: string, implementation: Implementation, ...args: Args): void; /** Skip this test. */ (macro: Macro, ...args: Args): void; -} +}; /** Declare a test that should be implemented later. */ export type TodoFn = (title: string) => void; @@ -216,16 +216,16 @@ export type MacroDeclarationOptions = title: TitleFn; }; -export interface MacroFn { +export type MacroFn = { /** Declare a reusable test implementation. */ (/** The function that is executed when the macro is used. */ exec: ImplementationFn): Macro; (declaration: MacroDeclarationOptions): Macro; -} +}; -export interface Meta { +export type Meta = { /** Path to the test file being executed. */ file: string; /** Directory where snapshots are stored. */ snapshotDirectory: string; -} +}; diff --git a/node_modules/ava/types/try-fn.d.ts b/node_modules/ava/types/try-fn.d.cts similarity index 87% rename from node_modules/ava/types/try-fn.d.ts rename to node_modules/ava/types/try-fn.d.cts index 8009df0c96..802c834dba 100644 --- a/node_modules/ava/types/try-fn.d.ts +++ b/node_modules/ava/types/try-fn.d.cts @@ -1,4 +1,4 @@ -import type {Implementation} from './test-fn.js'; +import type {Implementation} from './test-fn.cjs'; export type CommitDiscardOptions = { /** @@ -7,9 +7,9 @@ export type CommitDiscardOptions = { retainLogs?: boolean; }; -export interface AssertionError extends Error {} +export type AssertionError = Record & Error; -export interface TryResult { +export type TryResult = { /** * Title of the attempt, helping you tell attempts aparts. */ @@ -40,9 +40,9 @@ export interface TryResult { * Discard the attempt. */ discard(options?: CommitDiscardOptions): void; -} +}; -export interface TryFn { +export type TryFn = { /** * Attempt to run some assertions. The result must be explicitly committed or discarded or else * the test will fail. The title may help distinguish attempts from one another. @@ -54,5 +54,5 @@ export interface TryFn { * the test will fail. */ (fn: Implementation, ...args: Args): Promise; -} +}; diff --git a/node_modules/ci-info/CHANGELOG.md b/node_modules/ci-info/CHANGELOG.md index a05c1c17dd..7e748e5d66 100644 --- a/node_modules/ci-info/CHANGELOG.md +++ b/node_modules/ci-info/CHANGELOG.md @@ -1,8 +1,46 @@ # Changelog +## v3.7.1 + +- ignore ci detection when CI is set to `'false'` [24cc450](https://github.com/watson/ci-info/commit/24cc450) + +## v3.7.0 + +- support Sourcehut CI [85b96ea](https://github.com/watson/ci-info/commit/85b96ea) +- support ReleaseHub CI [409d886](https://github.com/watson/ci-info/commit/409d886) + +## v3.6.2 + +- fix VERCEL environment detection ([#98](https://github.com/watson/ci-info/pull/98)) + +## v3.6.1 + +- fix error in typings [357b454](https://github.com/watson/ci-info/commit/357b454) + +## v3.6.0 + +This release attempts to bring parity with [@npmcli/ci-detect](https://github.com/npm/ci-detect). See [#95](https://github.com/watson/ci-info/pull/95) for more details. + +- support gerrit ([#95](https://github.com/watson/ci-info/pull/95)) +- support google cloud build ([#95](https://github.com/watson/ci-info/pull/95)) +- support heroku ([#95](https://github.com/watson/ci-info/pull/95)) +- support anonymous CI's that exposes BUILD_ID and CI_NAME env vars ([#95](https://github.com/watson/ci-info/pull/95)) +- support more vercel environments ([#95](https://github.com/watson/ci-info/pull/95)) + +## v3.5.0 + +- support Woodpecker CI ([#90](https://github.com/watson/ci-info/pull/90)) + +## v3.4.0 + +- partial support Appflow CI (only CI detection) ([#84](https://github.com/watson/ci-info/pull/84)) +- support Codemagic CI ([#85](https://github.com/watson/ci-info/pull/85)) +- support Xcode Server CI ([#86](https://github.com/watson/ci-info/pull/86)) +- support Xcode Cloud CI ([#86](https://github.com/watson/ci-info/pull/86)) + ## v3.3.2 - - fix: export correct typings for `EAS` +- fix: export correct typings for `EAS` ## v3.3.1 @@ -57,10 +95,9 @@ Breaking changes: Breaking changes: -- Drop support for Node.js end-of-life versions: 0.10, 0.12, 4, 5, 7, - and 9 -- Team Foundation Server will now be detected as Azure Pipelines. The - constant `ci.TFS` no longer exists - use `ci.AZURE_PIPELINES` instead +- Drop support for Node.js end-of-life versions: 0.10, 0.12, 4, 5, 7, and 9 +- Team Foundation Server will now be detected as Azure Pipelines. The constant `ci.TFS` no longer exists - use + `ci.AZURE_PIPELINES` instead - Remove deprecated `ci.TDDIUM` constant - use `ci.SOLANDO` instead New features: @@ -93,7 +130,8 @@ New features: ## v1.3.1 -- chore: reduce npm package size by not including `.github` folder content ([#11](https://github.com/watson/ci-info/pull/11)) +- chore: reduce npm package size by not including `.github` folder content + ([#11](https://github.com/watson/ci-info/pull/11)) ## v1.3.0 diff --git a/node_modules/ci-info/LICENSE b/node_modules/ci-info/LICENSE index 2cc7405a82..44ca33aa61 100644 --- a/node_modules/ci-info/LICENSE +++ b/node_modules/ci-info/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016-2021 Thomas Watson Steen +Copyright (c) 2016-2023 Thomas Watson Steen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/node_modules/ci-info/README.md b/node_modules/ci-info/README.md index e7790b39b2..2a0c8beff6 100644 --- a/node_modules/ci-info/README.md +++ b/node_modules/ci-info/README.md @@ -32,45 +32,51 @@ if (ci.isCI) { Officially supported CI servers: -| Name | Constant | isPR | -| ------------------------------------------------------------------------------- | -------------------- | ---- | -| [AWS CodeBuild](https://aws.amazon.com/codebuild/) | `ci.CODEBUILD` | 🚫 | -| [AppVeyor](http://www.appveyor.com) | `ci.APPVEYOR` | ✅ | -| [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) | `ci.AZURE_PIPELINES` | ✅ | -| [Appcircle](https://appcircle.io/) | `ci.APPCIRCLE` | 🚫 | -| [Bamboo](https://www.atlassian.com/software/bamboo) by Atlassian | `ci.BAMBOO` | 🚫 | -| [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) | `ci.BITBUCKET` | ✅ | -| [Bitrise](https://www.bitrise.io/) | `ci.BITRISE` | ✅ | -| [Buddy](https://buddy.works/) | `ci.BUDDY` | ✅ | -| [Buildkite](https://buildkite.com) | `ci.BUILDKITE` | ✅ | -| [CircleCI](http://circleci.com) | `ci.CIRCLE` | ✅ | -| [Cirrus CI](https://cirrus-ci.org) | `ci.CIRRUS` | ✅ | -| [Codefresh](https://codefresh.io/) | `ci.CODEFRESH` | ✅ | -| [Codeship](https://codeship.com) | `ci.CODESHIP` | 🚫 | -| [Drone](https://drone.io) | `ci.DRONE` | ✅ | -| [dsari](https://github.com/rfinnie/dsari) | `ci.DSARI` | 🚫 | -| [Expo Application Services](https://expo.dev/eas) | `ci.EAS_BUILD` | 🚫 | -| [GitHub Actions](https://github.com/features/actions/) | `ci.GITHUB_ACTIONS` | ✅ | -| [GitLab CI](https://about.gitlab.com/gitlab-ci/) | `ci.GITLAB` | ✅ | -| [GoCD](https://www.go.cd/) | `ci.GOCD` | 🚫 | -| [Hudson](http://hudson-ci.org) | `ci.HUDSON` | 🚫 | -| [Jenkins CI](https://jenkins-ci.org) | `ci.JENKINS` | ✅ | -| [LayerCI](https://layerci.com/) | `ci.LAYERCI` | ✅ | -| [Magnum CI](https://magnum-ci.com) | `ci.MAGNUM` | 🚫 | -| [Netlify CI](https://www.netlify.com/) | `ci.NETLIFY` | ✅ | -| [Nevercode](http://nevercode.io/) | `ci.NEVERCODE` | ✅ | -| [Render](https://render.com/) | `ci.RENDER` | ✅ | -| [Sail CI](https://sail.ci/) | `ci.SAIL` | ✅ | -| [Screwdriver](https://screwdriver.cd/) | `ci.SCREWDRIVER` | ✅ | -| [Semaphore](https://semaphoreci.com) | `ci.SEMAPHORE` | ✅ | -| [Shippable](https://www.shippable.com/) | `ci.SHIPPABLE` | ✅ | -| [Solano CI](https://www.solanolabs.com/) | `ci.SOLANO` | ✅ | -| [Strider CD](https://strider-cd.github.io/) | `ci.STRIDER` | 🚫 | -| [TaskCluster](http://docs.taskcluster.net) | `ci.TASKCLUSTER` | 🚫 | -| [TeamCity](https://www.jetbrains.com/teamcity/) by JetBrains | `ci.TEAMCITY` | 🚫 | -| [Travis CI](http://travis-ci.org) | `ci.TRAVIS` | ✅ | -| [Vercel](https://vercel.com/) | `ci.VERCEL` | 🚫 | -| [Visual Studio App Center](https://appcenter.ms/) | `ci.APPCENTER` | 🚫 | +| Name | Constant | isPR | +| ------------------------------------------------------------------------------- | -------------------- | ---- | +| [AWS CodeBuild](https://aws.amazon.com/codebuild/) | `ci.CODEBUILD` | 🚫 | +| [AppVeyor](http://www.appveyor.com) | `ci.APPVEYOR` | ✅ | +| [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) | `ci.AZURE_PIPELINES` | ✅ | +| [Appcircle](https://appcircle.io/) | `ci.APPCIRCLE` | 🚫 | +| [Bamboo](https://www.atlassian.com/software/bamboo) by Atlassian | `ci.BAMBOO` | 🚫 | +| [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) | `ci.BITBUCKET` | ✅ | +| [Bitrise](https://www.bitrise.io/) | `ci.BITRISE` | ✅ | +| [Buddy](https://buddy.works/) | `ci.BUDDY` | ✅ | +| [Buildkite](https://buildkite.com) | `ci.BUILDKITE` | ✅ | +| [CircleCI](http://circleci.com) | `ci.CIRCLE` | ✅ | +| [Cirrus CI](https://cirrus-ci.org) | `ci.CIRRUS` | ✅ | +| [Codefresh](https://codefresh.io/) | `ci.CODEFRESH` | ✅ | +| [Codeship](https://codeship.com) | `ci.CODESHIP` | 🚫 | +| [Drone](https://drone.io) | `ci.DRONE` | ✅ | +| [dsari](https://github.com/rfinnie/dsari) | `ci.DSARI` | 🚫 | +| [Expo Application Services](https://expo.dev/eas) | `ci.EAS` | 🚫 | +| [Gerrit CI](https://www.gerritcodereview.com) | `ci.GERRIT` | 🚫 | +| [GitHub Actions](https://github.com/features/actions/) | `ci.GITHUB_ACTIONS` | ✅ | +| [GitLab CI](https://about.gitlab.com/gitlab-ci/) | `ci.GITLAB` | ✅ | +| [GoCD](https://www.go.cd/) | `ci.GOCD` | 🚫 | +| [Google Cloud Build](https://cloud.google.com/build) | `ci.GOOGLE_CLOUD_BUILD` | 🚫 | +| [Heroku](https://www.heroku.com) | `ci.HEROKU` | 🚫 | +| [Hudson](http://hudson-ci.org) | `ci.HUDSON` | 🚫 | +| [Jenkins CI](https://jenkins-ci.org) | `ci.JENKINS` | ✅ | +| [LayerCI](https://layerci.com/) | `ci.LAYERCI` | ✅ | +| [Magnum CI](https://magnum-ci.com) | `ci.MAGNUM` | 🚫 | +| [Netlify CI](https://www.netlify.com/) | `ci.NETLIFY` | ✅ | +| [Nevercode](http://nevercode.io/) | `ci.NEVERCODE` | ✅ | +| [ReleaseHub](https://releasehub.com/) | `ci.RELEASEHUB` | 🚫 | +| [Render](https://render.com/) | `ci.RENDER` | ✅ | +| [Sail CI](https://sail.ci/) | `ci.SAIL` | ✅ | +| [Screwdriver](https://screwdriver.cd/) | `ci.SCREWDRIVER` | ✅ | +| [Semaphore](https://semaphoreci.com) | `ci.SEMAPHORE` | ✅ | +| [Shippable](https://www.shippable.com/) | `ci.SHIPPABLE` | ✅ | +| [Solano CI](https://www.solanolabs.com/) | `ci.SOLANO` | ✅ | +| [Sourcehut](https://sourcehut.org/) | `ci.SOURCEHUT` | 🚫 | +| [Strider CD](https://strider-cd.github.io/) | `ci.STRIDER` | 🚫 | +| [TaskCluster](http://docs.taskcluster.net) | `ci.TASKCLUSTER` | 🚫 | +| [TeamCity](https://www.jetbrains.com/teamcity/) by JetBrains | `ci.TEAMCITY` | 🚫 | +| [Travis CI](http://travis-ci.org) | `ci.TRAVIS` | ✅ | +| [Vercel](https://vercel.com/) | `ci.VERCEL` | 🚫 | +| [Visual Studio App Center](https://appcenter.ms/) | `ci.APPCENTER` | 🚫 | +| [Woodpecker](https://woodpecker-ci.org/) | `ci.WOODPECKER` | ✅ | ## API @@ -113,6 +119,16 @@ release: - `ci.TDDIUM` (Solano CI) This have been renamed `ci.SOLANO` +## Ports + +ci-info has been ported to the following languages + +| Language | Repository | +|----------|------------| +| Go | https://github.com/hofstadter-io/cinful | +| Rust | https://github.com/sagiegurari/ci_info | +| Kotlin | https://github.com/cloudflightio/ci-info | + ## License [MIT](LICENSE) diff --git a/node_modules/ci-info/index.d.ts b/node_modules/ci-info/index.d.ts index 3e7dc2c46f..816d63a867 100644 --- a/node_modules/ci-info/index.d.ts +++ b/node_modules/ci-info/index.d.ts @@ -1,3 +1,5 @@ +// This file is generated at pre-commit by running `node create-typings.js`. + /** * Returns a boolean. Will be `true` if the code is running on a CI server, * otherwise `false`. @@ -24,9 +26,10 @@ export const isPR: boolean | null; */ export const name: string | null; +export const APPCIRCLE: boolean; export const APPVEYOR: boolean; +export const CODEBUILD: boolean; export const AZURE_PIPELINES: boolean; -export const APPCIRCLE: boolean; export const BAMBOO: boolean; export const BITBUCKET: boolean; export const BITRISE: boolean; @@ -34,8 +37,8 @@ export const BUDDY: boolean; export const BUILDKITE: boolean; export const CIRCLE: boolean; export const CIRRUS: boolean; -export const CODEBUILD: boolean; export const CODEFRESH: boolean; +export const CODEMAGIC: boolean; export const CODESHIP: boolean; export const DRONE: boolean; export const DSARI: boolean; @@ -43,21 +46,29 @@ export const EAS: boolean; export const GITHUB_ACTIONS: boolean; export const GITLAB: boolean; export const GOCD: boolean; +export const GOOGLE_CLOUD_BUILD: boolean; +export const LAYERCI: boolean; +export const GERRIT: boolean; +export const HEROKU: boolean; export const HUDSON: boolean; export const JENKINS: boolean; -export const LAYERCI: boolean; export const MAGNUM: boolean; export const NETLIFY: boolean; export const NEVERCODE: boolean; +export const RELEASEHUB: boolean; export const RENDER: boolean; export const SAIL: boolean; -export const SEMAPHORE: boolean; export const SCREWDRIVER: boolean; +export const SEMAPHORE: boolean; export const SHIPPABLE: boolean; export const SOLANO: boolean; +export const SOURCEHUT: boolean; export const STRIDER: boolean; export const TASKCLUSTER: boolean; export const TEAMCITY: boolean; export const TRAVIS: boolean; export const VERCEL: boolean; export const APPCENTER: boolean; +export const WOODPECKER: boolean; +export const XCODE_CLOUD: boolean; +export const XCODE_SERVER: boolean; diff --git a/node_modules/ci-info/index.js b/node_modules/ci-info/index.js index 302e5f2fe0..4790726458 100644 --- a/node_modules/ci-info/index.js +++ b/node_modules/ci-info/index.js @@ -22,46 +22,68 @@ vendors.forEach(function (vendor) { exports[vendor.constant] = isCI - if (isCI) { - exports.name = vendor.name + if (!isCI) { + return + } + + exports.name = vendor.name - switch (typeof vendor.pr) { - case 'string': - // "pr": "CIRRUS_PR" - exports.isPR = !!env[vendor.pr] - break - case 'object': - if ('env' in vendor.pr) { - // "pr": { "env": "BUILDKITE_PULL_REQUEST", "ne": "false" } - exports.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne - } else if ('any' in vendor.pr) { - // "pr": { "any": ["ghprbPullId", "CHANGE_ID"] } - exports.isPR = vendor.pr.any.some(function (key) { - return !!env[key] - }) - } else { - // "pr": { "DRONE_BUILD_EVENT": "pull_request" } - exports.isPR = checkEnv(vendor.pr) - } - break - default: - // PR detection not supported for this vendor - exports.isPR = null - } + switch (typeof vendor.pr) { + case 'string': + // "pr": "CIRRUS_PR" + exports.isPR = !!env[vendor.pr] + break + case 'object': + if ('env' in vendor.pr) { + // "pr": { "env": "BUILDKITE_PULL_REQUEST", "ne": "false" } + exports.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne + } else if ('any' in vendor.pr) { + // "pr": { "any": ["ghprbPullId", "CHANGE_ID"] } + exports.isPR = vendor.pr.any.some(function (key) { + return !!env[key] + }) + } else { + // "pr": { "DRONE_BUILD_EVENT": "pull_request" } + exports.isPR = checkEnv(vendor.pr) + } + break + default: + // PR detection not supported for this vendor + exports.isPR = null } }) exports.isCI = !!( + env.CI !== 'false' && // Bypass all checks if CI env is explicitly set to 'false' + (env.BUILD_ID || // Jenkins, Cloudbees + env.BUILD_NUMBER || // Jenkins, TeamCity env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari + env.CI_APP_ID || // Appflow + env.CI_BUILD_ID || // Appflow + env.CI_BUILD_NUMBER || // Appflow + env.CI_NAME || // Codeship and others env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI - env.BUILD_NUMBER || // Jenkins, TeamCity env.RUN_ID || // TaskCluster, dsari exports.name || - false + false) ) function checkEnv (obj) { + // "env": "CIRRUS" if (typeof obj === 'string') return !!env[obj] + + // "env": { "env": "NODE", "includes": "/app/.heroku/node/bin/node" } + if ('env' in obj) { + // Currently there are no other types, uncomment when there are + // if ('includes' in obj) { + return env[obj.env] && env[obj.env].includes(obj.includes) + // } + } + if ('any' in obj) { + return obj.any.some(function (k) { + return !!env[k] + }) + } return Object.keys(obj).every(function (k) { return env[k] === obj[k] }) diff --git a/node_modules/ci-info/package.json b/node_modules/ci-info/package.json index 86af7495f1..e05f375faf 100644 --- a/node_modules/ci-info/package.json +++ b/node_modules/ci-info/package.json @@ -1,6 +1,6 @@ { "name": "ci-info", - "version": "3.3.2", + "version": "3.7.1", "description": "Get details about the current Continuous Integration environment", "main": "index.js", "typings": "index.d.ts", @@ -22,12 +22,24 @@ "index.d.ts", "CHANGELOG.md" ], + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], "scripts": { - "test": "standard && node test.js" + "lint:fix": "standard --fix", + "test": "standard && node test.js", + "prepare": "husky install" }, "devDependencies": { "clear-module": "^4.1.2", + "husky": "^8.0.2", "standard": "^17.0.0", - "tape": "^5.5.3" + "tape": "^5.6.1" + }, + "engines": { + "node": ">=8" } } diff --git a/node_modules/ci-info/vendors.json b/node_modules/ci-info/vendors.json index 1c9e2ee490..00c1601b51 100644 --- a/node_modules/ci-info/vendors.json +++ b/node_modules/ci-info/vendors.json @@ -1,21 +1,26 @@ [ + { + "name": "Appcircle", + "constant": "APPCIRCLE", + "env": "AC_APPCIRCLE" + }, { "name": "AppVeyor", "constant": "APPVEYOR", "env": "APPVEYOR", "pr": "APPVEYOR_PULL_REQUEST_NUMBER" }, + { + "name": "AWS CodeBuild", + "constant": "CODEBUILD", + "env": "CODEBUILD_BUILD_ARN" + }, { "name": "Azure Pipelines", "constant": "AZURE_PIPELINES", "env": "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI", "pr": "SYSTEM_PULLREQUEST_PULLREQUESTID" }, - { - "name": "Appcircle", - "constant": "APPCIRCLE", - "env": "AC_APPCIRCLE" - }, { "name": "Bamboo", "constant": "BAMBOO", @@ -57,17 +62,18 @@ "env": "CIRRUS_CI", "pr": "CIRRUS_PR" }, - { - "name": "AWS CodeBuild", - "constant": "CODEBUILD", - "env": "CODEBUILD_BUILD_ARN" - }, { "name": "Codefresh", "constant": "CODEFRESH", "env": "CF_BUILD_ID", "pr": { "any": ["CF_PULL_REQUEST_NUMBER", "CF_PULL_REQUEST_ID"] } }, + { + "name": "Codemagic", + "constant": "CODEMAGIC", + "env": "CM_BUILD_ID", + "pr": "CM_PULL_REQUEST" + }, { "name": "Codeship", "constant": "CODESHIP", @@ -106,12 +112,27 @@ "constant": "GOCD", "env": "GO_PIPELINE_LABEL" }, + { + "name": "Google Cloud Build", + "constant": "GOOGLE_CLOUD_BUILD", + "env": "BUILDER_OUTPUT" + }, { "name": "LayerCI", "constant": "LAYERCI", "env": "LAYERCI", "pr": "LAYERCI_PULL_REQUEST" }, + { + "name": "Gerrit", + "constant": "GERRIT", + "env": "GERRIT_PROJECT" + }, + { + "name": "Heroku", + "constant": "HEROKU", + "env": { "env": "NODE", "includes": "/app/.heroku/node/bin/node" } + }, { "name": "Hudson", "constant": "HUDSON", @@ -140,6 +161,11 @@ "env": "NEVERCODE", "pr": { "env": "NEVERCODE_PULL_REQUEST", "ne": "false" } }, + { + "name": "ReleaseHub", + "constant": "RELEASEHUB", + "env": "RELEASE_BUILD_ID" + }, { "name": "Render", "constant": "RENDER", @@ -152,18 +178,18 @@ "env": "SAILCI", "pr": "SAIL_PULL_REQUEST_NUMBER" }, - { - "name": "Semaphore", - "constant": "SEMAPHORE", - "env": "SEMAPHORE", - "pr": "PULL_REQUEST_NUMBER" - }, { "name": "Screwdriver", "constant": "SCREWDRIVER", "env": "SCREWDRIVER", "pr": { "env": "SD_PULL_REQUEST", "ne": "false" } }, + { + "name": "Semaphore", + "constant": "SEMAPHORE", + "env": "SEMAPHORE", + "pr": "PULL_REQUEST_NUMBER" + }, { "name": "Shippable", "constant": "SHIPPABLE", @@ -176,6 +202,11 @@ "env": "TDDIUM", "pr": "TDDIUM_PR_ID" }, + { + "name": "Sourcehut", + "constant": "SOURCEHUT", + "env": { "CI_NAME": "sourcehut" } + }, { "name": "Strider CD", "constant": "STRIDER", @@ -200,11 +231,28 @@ { "name": "Vercel", "constant": "VERCEL", - "env": "NOW_BUILDER" + "env": { "any": ["NOW_BUILDER", "VERCEL"] } }, { "name": "Visual Studio App Center", "constant": "APPCENTER", "env": "APPCENTER_BUILD_ID" + }, + { + "name": "Woodpecker", + "constant": "WOODPECKER", + "env": { "CI": "woodpecker" }, + "pr": { "CI_BUILD_EVENT": "pull_request" } + }, + { + "name": "Xcode Cloud", + "constant": "XCODE_CLOUD", + "env": "CI_XCODE_PROJECT", + "pr": "CI_PULL_REQUEST_NUMBER" + }, + { + "name": "Xcode Server", + "constant": "XCODE_SERVER", + "env": "XCS" } ] diff --git a/node_modules/cliui/CHANGELOG.md b/node_modules/cliui/CHANGELOG.md index d6a7e3f8d3..61f06c3fc2 100644 --- a/node_modules/cliui/CHANGELOG.md +++ b/node_modules/cliui/CHANGELOG.md @@ -2,6 +2,24 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [8.0.1](https://github.com/yargs/cliui/compare/v8.0.0...v8.0.1) (2022-10-01) + + +### Bug Fixes + +* **deps:** move rollup-plugin-ts to dev deps ([#124](https://github.com/yargs/cliui/issues/124)) ([7c8bd6b](https://github.com/yargs/cliui/commit/7c8bd6ba024d61e4eeae310c7959ab8ab6829081)) + +## [8.0.0](https://github.com/yargs/cliui/compare/v7.0.4...v8.0.0) (2022-09-30) + + +### ⚠ BREAKING CHANGES + +* **deps:** drop Node 10 to release CVE-2021-3807 patch (#122) + +### Bug Fixes + +* **deps:** drop Node 10 to release CVE-2021-3807 patch ([#122](https://github.com/yargs/cliui/issues/122)) ([f156571](https://github.com/yargs/cliui/commit/f156571ce4f2ebf313335e3a53ad905589da5a30)) + ### [7.0.4](https://www.github.com/yargs/cliui/compare/v7.0.3...v7.0.4) (2020-11-08) diff --git a/node_modules/cliui/build/index.d.cts b/node_modules/cliui/build/index.d.cts new file mode 100644 index 0000000000..4567f945e8 --- /dev/null +++ b/node_modules/cliui/build/index.d.cts @@ -0,0 +1,43 @@ +interface UIOptions { + width: number; + wrap?: boolean; + rows?: string[]; +} +interface Column { + text: string; + width?: number; + align?: "right" | "left" | "center"; + padding: number[]; + border?: boolean; +} +interface ColumnArray extends Array { + span: boolean; +} +interface Line { + hidden?: boolean; + text: string; + span?: boolean; +} +declare class UI { + width: number; + wrap: boolean; + rows: ColumnArray[]; + constructor(opts: UIOptions); + span(...args: ColumnArray): void; + resetOutput(): void; + div(...args: (Column | string)[]): ColumnArray; + private shouldApplyLayoutDSL; + private applyLayoutDSL; + private colFromString; + private measurePadding; + toString(): string; + rowToString(row: ColumnArray, lines: Line[]): Line[]; + // if the full 'source' can render in + // the target line, do so. + private renderInline; + private rasterize; + private negatePadding; + private columnWidths; +} +declare function ui(opts: UIOptions): UI; +export { ui as default }; diff --git a/node_modules/cliui/package.json b/node_modules/cliui/package.json index 3426665dc4..eab6bf47c1 100644 --- a/node_modules/cliui/package.json +++ b/node_modules/cliui/package.json @@ -1,6 +1,6 @@ { "name": "cliui", - "version": "7.0.4", + "version": "8.0.1", "description": "easily create complex multi-column command-line-interfaces", "main": "build/index.cjs", "exports": { @@ -50,14 +50,13 @@ "license": "ISC", "dependencies": { "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", + "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" }, "devDependencies": { "@types/node": "^14.0.27", "@typescript-eslint/eslint-plugin": "^4.0.0", "@typescript-eslint/parser": "^4.0.0", - "@wessberg/rollup-plugin-ts": "^1.3.2", "c8": "^7.3.0", "chai": "^4.2.0", "chalk": "^4.1.0", @@ -66,9 +65,10 @@ "eslint-plugin-import": "^2.22.0", "eslint-plugin-node": "^11.1.0", "gts": "^3.0.0", - "mocha": "^8.1.1", + "mocha": "^10.0.0", "rimraf": "^3.0.2", "rollup": "^2.23.1", + "rollup-plugin-ts": "^3.0.2", "standardx": "^7.0.0", "typescript": "^4.0.0" }, @@ -77,7 +77,7 @@ "index.mjs", "!*.d.ts" ], - "engine": { - "node": ">=10" + "engines": { + "node": ">=12" } } diff --git a/node_modules/emittery/index.d.ts b/node_modules/emittery/index.d.ts index de19515663..a21cbebc12 100644 --- a/node_modules/emittery/index.d.ts +++ b/node_modules/emittery/index.d.ts @@ -1,11 +1,9 @@ -/* eslint-disable no-redeclare */ - /** Emittery accepts strings, symbols, and numbers as event names. Symbol event names are preferred given that they can be used to avoid name collisions when your classes are extended, especially for internal events. */ -type EventName = PropertyKey; +export type EventName = PropertyKey; // Helper type for turning the passed `EventData` type map into a list of string keys that don't require data alongside the event name when emitting. Uses the same trick that `Omit` does internally to filter keys by building a map of keys to keys we want to keep, and then accessing all the keys to return just the list of keys we want to keep. type DatalessEventNames = { @@ -14,7 +12,7 @@ type DatalessEventNames = { declare const listenerAdded: unique symbol; declare const listenerRemoved: unique symbol; -type _OmnipresentEventData = {[listenerAdded]: Emittery.ListenerChangedData; [listenerRemoved]: Emittery.ListenerChangedData}; +type OmnipresentEventData = {[listenerAdded]: ListenerChangedData; [listenerRemoved]: ListenerChangedData}; /** Emittery can collect and log debug information. @@ -23,12 +21,12 @@ To enable this feature set the `DEBUG` environment variable to `emittery` or `*` See API for more information on how debugging works. */ -type DebugLogger = (type: string, debugName: string, eventName?: Name, eventData?: EventData[Name]) => void; +export type DebugLogger = (type: string, debugName: string, eventName?: Name, eventData?: EventData[Name]) => void; /** Configure debug options of an instance. */ -interface DebugOptions { +export type DebugOptions = { /** Define a name for the instance of Emittery to use when outputting debug data. @@ -36,7 +34,7 @@ interface DebugOptions { @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; Emittery.isDebugEnabled = true; @@ -60,7 +58,7 @@ interface DebugOptions { @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; const emitter1 = new Emittery({debug: {name: 'emitter1', enabled: true}}); const emitter2 = new Emittery({debug: {name: 'emitter2'}}); @@ -80,7 +78,7 @@ interface DebugOptions { emitter2.emit('test'); ``` */ - enabled?: boolean; + readonly enabled?: boolean; /** Function that handles debug data. @@ -102,9 +100,11 @@ interface DebugOptions { @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; - const myLogger = (type, debugName, eventName, eventData) => console.log(`[${type}]: ${eventName}`); + const myLogger = (type, debugName, eventName, eventData) => { + console.log(`[${type}]: ${eventName}`); + }; const emitter = new Emittery({ debug: { @@ -122,15 +122,42 @@ interface DebugOptions { //=> [subscribe]: test ``` */ - logger?: DebugLogger; -} + readonly logger?: DebugLogger; +}; /** Configuration options for Emittery. */ -interface Options { - debug?: DebugOptions; -} +export type Options = { + readonly debug?: DebugOptions; +}; + +/** +A promise returned from `emittery.once` with an extra `off` method to cancel your subscription. +*/ +export type EmitteryOncePromise = { + off(): void; +} & Promise; + +/** +Removes an event subscription. +*/ +export type UnsubscribeFunction = () => void; + +/** +The data provided as `eventData` when listening for `Emittery.listenerAdded` or `Emittery.listenerRemoved`. +*/ +export type ListenerChangedData = { + /** + The listener that was added or removed. + */ + listener: (eventData?: unknown) => (void | Promise); + + /** + The name of the event that was added or removed if `.on()` or `.off()` was used, or `undefined` if `.onAny()` or `.offAny()` was used. + */ + eventName?: EventName; +}; /** Emittery is a strictly typed, fully async EventEmitter implementation. Event listeners can be registered with `on` or `once`, and events can be emitted with `emit`. @@ -139,7 +166,7 @@ Emittery is a strictly typed, fully async EventEmitter implementation. Event lis @example ``` -import Emittery = require('emittery'); +import Emittery from 'emittery'; const emitter = new Emittery< // Pass `{[eventName: ]: undefined | }` as the first type argument for events that pass data to their listeners. @@ -163,10 +190,10 @@ emitter.emit('open', 1); emitter.emit('other'); ``` */ -declare class Emittery< - EventData = Record, - AllEventData = EventData & _OmnipresentEventData, - DatalessEvents = DatalessEventNames +export default class Emittery< + EventData = Record, // TODO: Use `unknown` instead of `any`. + AllEventData = EventData & OmnipresentEventData, + DatalessEvents = DatalessEventNames, > { /** Toggle debug mode for all instances. @@ -175,7 +202,7 @@ declare class Emittery< @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; Emittery.isDebugEnabled = true; @@ -208,7 +235,7 @@ declare class Emittery< @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; const emitter = new Emittery(); @@ -234,7 +261,7 @@ declare class Emittery< @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; const emitter = new Emittery(); @@ -255,24 +282,12 @@ declare class Emittery< */ static readonly listenerRemoved: typeof listenerRemoved; - /** - Debugging options for the current instance. - */ - debug: DebugOptions; - - /** - Create a new Emittery instance with the specified options. - - @returns An instance of Emittery that you can use to listen for and emit events. - */ - constructor(options?: Options); - /** In TypeScript, it returns a decorator which mixins `Emittery` as property `emitteryPropertyName` and `methodNames`, or all `Emittery` methods if `methodNames` is not defined, into the target class. @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; @Emittery.mixin('emittery') class MyClass {} @@ -285,7 +300,19 @@ declare class Emittery< static mixin( emitteryPropertyName: string | symbol, methodNames?: readonly string[] - ): (klass: T) => T; // eslint-disable-line @typescript-eslint/prefer-function-type + ): (klass: T) => T; // eslint-disable-line @typescript-eslint/prefer-function-type + + /** + Debugging options for the current instance. + */ + debug: DebugOptions; + + /** + Create a new Emittery instance with the specified options. + + @returns An instance of Emittery that you can use to listen for and emit events. + */ + constructor(options?: Options); /** Subscribe to one or more events. @@ -296,7 +323,7 @@ declare class Emittery< @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; const emitter = new Emittery(); @@ -313,9 +340,9 @@ declare class Emittery< ``` */ on( - eventName: Name | Name[], + eventName: Name | readonly Name[], listener: (eventData: AllEventData[Name]) => void | Promise - ): Emittery.UnsubscribeFn; + ): UnsubscribeFunction; /** Get an async iterator which buffers data each time an event is emitted. @@ -324,7 +351,7 @@ declare class Emittery< @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; const emitter = new Emittery(); const iterator = emitter.events('🦄'); @@ -354,7 +381,7 @@ declare class Emittery< @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; const emitter = new Emittery(); const iterator = emitter.events('🦄'); @@ -374,7 +401,7 @@ declare class Emittery< @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; const emitter = new Emittery(); const iterator = emitter.events(['🦄', '🦊']); @@ -401,7 +428,7 @@ declare class Emittery< ``` */ events( - eventName: Name | Name[] + eventName: Name | readonly Name[] ): AsyncIterableIterator; /** @@ -409,26 +436,27 @@ declare class Emittery< @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; const emitter = new Emittery(); - const listener = data => console.log(data); - (async () => { - emitter.on(['🦄', '🐶', '🦊'], listener); - await emitter.emit('🦄', 'a'); - await emitter.emit('🐶', 'b'); - await emitter.emit('🦊', 'c'); - emitter.off('🦄', listener); - emitter.off(['🐶', '🦊'], listener); - await emitter.emit('🦄', 'a'); // nothing happens - await emitter.emit('🐶', 'b'); // nothing happens - await emitter.emit('🦊', 'c'); // nothing happens - })(); + const listener = data => { + console.log(data); + }; + + emitter.on(['🦄', '🐶', '🦊'], listener); + await emitter.emit('🦄', 'a'); + await emitter.emit('🐶', 'b'); + await emitter.emit('🦊', 'c'); + emitter.off('🦄', listener); + emitter.off(['🐶', '🦊'], listener); + await emitter.emit('🦄', 'a'); // nothing happens + await emitter.emit('🐶', 'b'); // nothing happens + await emitter.emit('🦊', 'c'); // nothing happens ``` */ off( - eventName: Name | Name[], + eventName: Name | readonly Name[], listener: (eventData: AllEventData[Name]) => void | Promise ): void; @@ -436,11 +464,11 @@ declare class Emittery< Subscribe to one or more events only once. It will be unsubscribed after the first event. - @returns The event data when `eventName` is emitted. + @returns The promise of event data when `eventName` is emitted. This promise is extended with an `off` method. @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; const emitter = new Emittery(); @@ -457,7 +485,7 @@ declare class Emittery< emitter.emit('🐶', '🍖'); // Nothing happens ``` */ - once(eventName: Name | Name[]): Promise; + once(eventName: Name | readonly Name[]): EmitteryOncePromise; /** Trigger an event asynchronously, optionally with some data. Listeners are called in the order they were added, but executed concurrently. @@ -493,7 +521,7 @@ declare class Emittery< eventName: keyof EventData, eventData: EventData[keyof EventData] ) => void | Promise - ): Emittery.UnsubscribeFn; + ): UnsubscribeFunction; /** Get an async iterator which buffers a tuple of an event name and data each time an event is emitted. @@ -504,7 +532,7 @@ declare class Emittery< @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; const emitter = new Emittery(); const iterator = emitter.anyEvent(); @@ -548,19 +576,19 @@ declare class Emittery< If `eventName` is given, only the listeners for that event are cleared. */ - clearListeners(eventName?: Name | Name[]): void; + clearListeners(eventName?: Name | readonly Name[]): void; /** The number of listeners for the `eventName` or all events if not specified. */ - listenerCount(eventName?: Name | Name[]): number; + listenerCount(eventName?: Name | readonly Name[]): number; /** Bind the given `methodNames`, or all `Emittery` methods if `methodNames` is not defined, into the `target` object. @example ``` - import Emittery = require('emittery'); + import Emittery from 'emittery'; const object = {}; @@ -571,29 +599,3 @@ declare class Emittery< */ bindMethods(target: Record, methodNames?: readonly string[]): void; } - -declare namespace Emittery { - /** - Removes an event subscription. - */ - type UnsubscribeFn = () => void; - - /** - The data provided as `eventData` when listening for `Emittery.listenerAdded` or `Emittery.listenerRemoved`. - */ - interface ListenerChangedData { - /** - The listener that was added or removed. - */ - listener: (eventData?: unknown) => void | Promise; - - /** - The name of the event that was added or removed if `.on()` or `.off()` was used, or `undefined` if `.onAny()` or `.offAny()` was used. - */ - eventName?: EventName; - } - - type OmnipresentEventData = _OmnipresentEventData; -} - -export = Emittery; diff --git a/node_modules/emittery/index.js b/node_modules/emittery/index.js index 09c2fcc21e..5b5f217bcf 100644 --- a/node_modules/emittery/index.js +++ b/node_modules/emittery/index.js @@ -1,8 +1,5 @@ -'use strict'; +import {anyMap, producersMap, eventsMap} from './maps.js'; -const anyMap = new WeakMap(); -const eventsMap = new WeakMap(); -const producersMap = new WeakMap(); const anyProducer = Symbol('anyProducer'); const resolvedPromise = Promise.resolve(); @@ -10,19 +7,13 @@ const resolvedPromise = Promise.resolve(); const listenerAdded = Symbol('listenerAdded'); const listenerRemoved = Symbol('listenerRemoved'); -// Define a symbol that allows internal code to emit meta events, but prevents userland from doing so. -const metaEventsAllowed = Symbol('metaEventsAllowed'); - +let canEmitMetaEvents = false; let isGlobalDebugEnabled = false; -function assertEventName(eventName, allowMetaEvents) { +function assertEventName(eventName) { if (typeof eventName !== 'string' && typeof eventName !== 'symbol' && typeof eventName !== 'number') { throw new TypeError('`eventName` must be a string, symbol, or number'); } - - if (isMetaEvent(eventName) && allowMetaEvents !== metaEventsAllowed) { - throw new TypeError('`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`'); - } } function assertListener(listener) { @@ -34,7 +25,7 @@ function assertListener(listener) { function getListeners(instance, eventName) { const events = eventsMap.get(instance); if (!events.has(eventName)) { - events.set(eventName, new Set()); + return; } return events.get(eventName); @@ -44,7 +35,7 @@ function getEventProducers(instance, eventName) { const key = typeof eventName === 'string' || typeof eventName === 'symbol' || typeof eventName === 'number' ? eventName : anyProducer; const producers = producersMap.get(instance); if (!producers.has(key)) { - producers.set(key, new Set()); + return; } return producers.get(key); @@ -81,11 +72,18 @@ function iterator(instance, eventNames) { finish() { isFinished = true; flush(); - } + }, }; for (const eventName of eventNames) { - getEventProducers(instance, eventName).add(producer); + let set = getEventProducers(instance, eventName); + if (!set) { + set = new Set(); + const producers = producersMap.get(instance); + producers.set(eventName, set); + } + + set.add(producer); } return { @@ -109,7 +107,7 @@ function iterator(instance, eventNames) { return { done: false, - value: await queue.shift() + value: await queue.shift(), }; }, @@ -117,19 +115,26 @@ function iterator(instance, eventNames) { queue = undefined; for (const eventName of eventNames) { - getEventProducers(instance, eventName).delete(producer); + const set = getEventProducers(instance, eventName); + if (set) { + set.delete(producer); + if (set.size === 0) { + const producers = producersMap.get(instance); + producers.delete(eventName); + } + } } flush(); - return arguments.length > 0 ? - {done: true, value: await value} : - {done: true}; + return arguments.length > 0 + ? {done: true, value: await value} + : {done: true}; }, [Symbol.asyncIterator]() { return this; - } + }, }; } @@ -157,7 +162,18 @@ function defaultMethodNamesOrAssert(methodNames) { const isMetaEvent = eventName => eventName === listenerAdded || eventName === listenerRemoved; -class Emittery { +function emitMetaEvent(emitter, eventName, eventData) { + if (isMetaEvent(eventName)) { + try { + canEmitMetaEvents = true; + emitter.emit(eventName, eventData); + } finally { + canEmitMetaEvents = false; + } + } +} + +export default class Emittery { static mixin(emitteryPropertyName, methodNames) { methodNames = defaultMethodNamesOrAssert(methodNames); return target => { @@ -174,14 +190,14 @@ class Emittery { function getEmitteryProperty() { Object.defineProperty(this, emitteryPropertyName, { enumerable: false, - value: new Emittery() + value: new Emittery(), }); return this[emitteryPropertyName]; } Object.defineProperty(target.prototype, emitteryPropertyName, { enumerable: false, - get: getEmitteryProperty + get: getEmitteryProperty, }); const emitteryMethodCaller = methodName => function (...args) { @@ -191,7 +207,7 @@ class Emittery { for (const methodName of methodNames) { Object.defineProperty(target.prototype, methodName, { enumerable: false, - value: emitteryMethodCaller(methodName) + value: emitteryMethodCaller(methodName), }); } @@ -200,11 +216,15 @@ class Emittery { } static get isDebugEnabled() { - if (typeof process !== 'object') { + // In a browser environment, `globalThis.process` can potentially reference a DOM Element with a `#process` ID, + // so instead of just type checking `globalThis.process`, we need to make sure that `globalThis.process.env` exists. + // eslint-disable-next-line n/prefer-global/process + if (typeof globalThis.process?.env !== 'object') { return isGlobalDebugEnabled; } - const {env} = process || {env: {}}; + // eslint-disable-next-line n/prefer-global/process + const {env} = globalThis.process ?? {env: {}}; return env.DEBUG === 'emittery' || env.DEBUG === '*' || isGlobalDebugEnabled; } @@ -216,7 +236,10 @@ class Emittery { anyMap.set(this, new Set()); eventsMap.set(this, new Map()); producersMap.set(this, new Map()); - this.debug = options.debug || {}; + + producersMap.get(this).set(anyProducer, new Set()); + + this.debug = options.debug ?? {}; if (this.debug.enabled === undefined) { this.debug.enabled = false; @@ -253,13 +276,20 @@ class Emittery { eventNames = Array.isArray(eventNames) ? eventNames : [eventNames]; for (const eventName of eventNames) { - assertEventName(eventName, metaEventsAllowed); - getListeners(this, eventName).add(listener); + assertEventName(eventName); + let set = getListeners(this, eventName); + if (!set) { + set = new Set(); + const events = eventsMap.get(this); + events.set(eventName, set); + } + + set.add(listener); this.logIfDebugEnabled('subscribe', eventName, undefined); if (!isMetaEvent(eventName)) { - this.emit(listenerAdded, {eventName, listener}, metaEventsAllowed); + emitMetaEvent(this, listenerAdded, {eventName, listener}); } } @@ -271,43 +301,59 @@ class Emittery { eventNames = Array.isArray(eventNames) ? eventNames : [eventNames]; for (const eventName of eventNames) { - assertEventName(eventName, metaEventsAllowed); - getListeners(this, eventName).delete(listener); + assertEventName(eventName); + const set = getListeners(this, eventName); + if (set) { + set.delete(listener); + if (set.size === 0) { + const events = eventsMap.get(this); + events.delete(eventName); + } + } this.logIfDebugEnabled('unsubscribe', eventName, undefined); if (!isMetaEvent(eventName)) { - this.emit(listenerRemoved, {eventName, listener}, metaEventsAllowed); + emitMetaEvent(this, listenerRemoved, {eventName, listener}); } } } once(eventNames) { - return new Promise(resolve => { - const off = this.on(eventNames, data => { - off(); + let off_; + + const promise = new Promise(resolve => { + off_ = this.on(eventNames, data => { + off_(); resolve(data); }); }); + + promise.off = off_; + return promise; } events(eventNames) { eventNames = Array.isArray(eventNames) ? eventNames : [eventNames]; for (const eventName of eventNames) { - assertEventName(eventName, metaEventsAllowed); + assertEventName(eventName); } return iterator(this, eventNames); } - async emit(eventName, eventData, allowMetaEvents) { - assertEventName(eventName, allowMetaEvents); + async emit(eventName, eventData) { + assertEventName(eventName); + + if (isMetaEvent(eventName) && !canEmitMetaEvents) { + throw new TypeError('`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`'); + } this.logIfDebugEnabled('emit', eventName, eventData); enqueueProducers(this, eventName, eventData); - const listeners = getListeners(this, eventName); + const listeners = getListeners(this, eventName) ?? new Set(); const anyListeners = anyMap.get(this); const staticListeners = [...listeners]; const staticAnyListeners = isMetaEvent(eventName) ? [] : [...anyListeners]; @@ -323,16 +369,20 @@ class Emittery { if (anyListeners.has(listener)) { return listener(eventName, eventData); } - }) + }), ]); } - async emitSerial(eventName, eventData, allowMetaEvents) { - assertEventName(eventName, allowMetaEvents); + async emitSerial(eventName, eventData) { + assertEventName(eventName); + + if (isMetaEvent(eventName) && !canEmitMetaEvents) { + throw new TypeError('`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`'); + } this.logIfDebugEnabled('emitSerial', eventName, eventData); - const listeners = getListeners(this, eventName); + const listeners = getListeners(this, eventName) ?? new Set(); const anyListeners = anyMap.get(this); const staticListeners = [...listeners]; const staticAnyListeners = [...anyListeners]; @@ -359,7 +409,7 @@ class Emittery { this.logIfDebugEnabled('subscribeAny', undefined, undefined); anyMap.get(this).add(listener); - this.emit(listenerAdded, {listener}, metaEventsAllowed); + emitMetaEvent(this, listenerAdded, {listener}); return this.offAny.bind(this, listener); } @@ -372,7 +422,7 @@ class Emittery { this.logIfDebugEnabled('unsubscribeAny', undefined, undefined); - this.emit(listenerRemoved, {listener}, metaEventsAllowed); + emitMetaEvent(this, listenerRemoved, {listener}); anyMap.get(this).delete(listener); } @@ -383,28 +433,34 @@ class Emittery { this.logIfDebugEnabled('clear', eventName, undefined); if (typeof eventName === 'string' || typeof eventName === 'symbol' || typeof eventName === 'number') { - getListeners(this, eventName).clear(); + const set = getListeners(this, eventName); + if (set) { + set.clear(); + } const producers = getEventProducers(this, eventName); + if (producers) { + for (const producer of producers) { + producer.finish(); + } - for (const producer of producers) { - producer.finish(); + producers.clear(); } - - producers.clear(); } else { anyMap.get(this).clear(); - for (const listeners of eventsMap.get(this).values()) { + for (const [eventName, listeners] of eventsMap.get(this).entries()) { listeners.clear(); + eventsMap.get(this).delete(eventName); } - for (const producers of producersMap.get(this).values()) { + for (const [eventName, producers] of producersMap.get(this).entries()) { for (const producer of producers) { producer.finish(); } producers.clear(); + producersMap.get(this).delete(eventName); } } } @@ -416,13 +472,16 @@ class Emittery { for (const eventName of eventNames) { if (typeof eventName === 'string') { - count += anyMap.get(this).size + getListeners(this, eventName).size + - getEventProducers(this, eventName).size + getEventProducers(this).size; + count += anyMap.get(this).size + + (getListeners(this, eventName)?.size ?? 0) + + (getEventProducers(this, eventName)?.size ?? 0) + + (getEventProducers(this)?.size ?? 0); + continue; } if (typeof eventName !== 'undefined') { - assertEventName(eventName, metaEventsAllowed); + assertEventName(eventName); } count += anyMap.get(this).size; @@ -453,7 +512,7 @@ class Emittery { Object.defineProperty(target, methodName, { enumerable: false, - value: this[methodName].bind(this) + value: this[methodName].bind(this), }); } } @@ -465,13 +524,11 @@ Object.defineProperty(Emittery, 'listenerAdded', { value: listenerAdded, writable: false, enumerable: true, - configurable: false + configurable: false, }); Object.defineProperty(Emittery, 'listenerRemoved', { value: listenerRemoved, writable: false, enumerable: true, - configurable: false + configurable: false, }); - -module.exports = Emittery; diff --git a/node_modules/emittery/maps.js b/node_modules/emittery/maps.js new file mode 100644 index 0000000000..c0df85dd3c --- /dev/null +++ b/node_modules/emittery/maps.js @@ -0,0 +1,3 @@ +export const anyMap = new WeakMap(); +export const eventsMap = new WeakMap(); +export const producersMap = new WeakMap(); diff --git a/node_modules/emittery/package.json b/node_modules/emittery/package.json index 752b5c0280..1b5f30738a 100644 --- a/node_modules/emittery/package.json +++ b/node_modules/emittery/package.json @@ -1,6 +1,6 @@ { "name": "emittery", - "version": "0.11.0", + "version": "1.0.1", "description": "Simple and modern async event emitter", "license": "MIT", "repository": "sindresorhus/emittery", @@ -10,15 +10,19 @@ "email": "sindresorhus@gmail.com", "url": "https://sindresorhus.com" }, + "type": "module", + "exports": "./index.js", + "types": "./index.d.ts", "engines": { - "node": ">=12" + "node": ">=14.16" }, "scripts": { "test": "xo && nyc ava && tsd" }, "files": [ "index.js", - "index.d.ts" + "index.d.ts", + "maps.js" ], "keywords": [ "event", @@ -48,13 +52,13 @@ "typed" ], "devDependencies": { - "@types/node": "^15.6.1", - "ava": "^2.4.0", - "delay": "^4.3.0", - "nyc": "^15.0.0", - "p-event": "^4.1.0", - "tsd": "^0.19.1", - "xo": "^0.39.0" + "@types/node": "^18.7.15", + "ava": "^4.3.3", + "delay": "^5.0.0", + "nyc": "^15.1.0", + "p-event": "^5.0.1", + "tsd": "^0.23.0", + "xo": "^0.52.3" }, "nyc": { "reporter": [ diff --git a/node_modules/emittery/readme.md b/node_modules/emittery/readme.md index eba9168373..25c2b23753 100644 --- a/node_modules/emittery/readme.md +++ b/node_modules/emittery/readme.md @@ -2,7 +2,7 @@ > Simple and modern async event emitter -[![Coverage Status](https://codecov.io/gh/sindresorhus/emittery/branch/main/graph/badge.svg)](https://codecov.io/gh/sindresorhus/emittery) + [![](https://badgen.net/bundlephobia/minzip/emittery)](https://bundlephobia.com/result?p=emittery) It works in Node.js and the browser (using a bundler). @@ -11,14 +11,14 @@ Emitting events asynchronously is important for production code where you want t ## Install -``` -$ npm install emittery +```sh +npm install emittery ``` ## Usage ```js -const Emittery = require('emittery'); +import Emittery from 'emittery'; const emitter = new Emittery(); @@ -53,7 +53,7 @@ Default: `true` if the `DEBUG` environment variable is set to `emittery` or `*`, Example: ```js -const Emittery = require('emittery'); +import Emittery from 'emittery'; Emittery.isDebugEnabled = true; @@ -103,7 +103,7 @@ Define a name for the instance of Emittery to use when outputting debug data. Example: ```js -const Emittery = require('emittery'); +import Emittery from 'emittery'; Emittery.isDebugEnabled = true; @@ -128,7 +128,7 @@ Toggle debug logging just for this instance. Example: ```js -const Emittery = require('emittery'); +import Emittery from 'emittery'; const emitter1 = new Emittery({debug: {name: 'emitter1', enabled: true}}); const emitter2 = new Emittery({debug: {name: 'emitter2'}}); @@ -175,9 +175,11 @@ Function that handles debug data. Example: ```js -const Emittery = require('emittery'); +import Emittery from 'emittery'; -const myLogger = (type, debugName, eventName, eventData) => console.log(`[${type}]: ${eventName}`); +const myLogger = (type, debugName, eventName, eventData) => { + console.log(`[${type}]: ${eventName}`); +}; const emitter = new Emittery({ debug: { @@ -204,7 +206,7 @@ Returns an unsubscribe method. Using the same listener multiple times for the same event will result in only one method call per emitted event. ```js -const Emittery = require('emittery'); +import Emittery from 'emittery'; const emitter = new Emittery(); @@ -228,7 +230,7 @@ Emittery exports some symbols which represent "meta" events that can be passed t - `Emittery.listenerRemoved` - Fires when an event listener was removed. ```js -const Emittery = require('emittery'); +import Emittery from 'emittery'; const emitter = new Emittery(); @@ -259,23 +261,23 @@ Only events that are not of this type are able to trigger these events. Remove one or more event subscriptions. ```js -const Emittery = require('emittery'); +import Emittery from 'emittery'; const emitter = new Emittery(); -const listener = data => console.log(data); - -(async () => { - emitter.on(['🦄', '🐶', '🦊'], listener); - await emitter.emit('🦄', 'a'); - await emitter.emit('🐶', 'b'); - await emitter.emit('🦊', 'c'); - emitter.off('🦄', listener); - emitter.off(['🐶', '🦊'], listener); - await emitter.emit('🦄', 'a'); // Nothing happens - await emitter.emit('🐶', 'b'); // Nothing happens - await emitter.emit('🦊', 'c'); // Nothing happens -})(); +const listener = data => { + console.log(data); +}; + +emitter.on(['🦄', '🐶', '🦊'], listener); +await emitter.emit('🦄', 'a'); +await emitter.emit('🐶', 'b'); +await emitter.emit('🦊', 'c'); +emitter.off('🦄', listener); +emitter.off(['🐶', '🦊'], listener); +await emitter.emit('🦄', 'a'); // Nothing happens +await emitter.emit('🐶', 'b'); // Nothing happens +await emitter.emit('🦊', 'c'); // Nothing happens ``` ##### listener(data) @@ -284,10 +286,10 @@ const listener = data => console.log(data); Subscribe to one or more events only once. It will be unsubscribed after the first event. -Returns a promise for the event data when `eventName` is emitted. +Returns a promise for the event data when `eventName` is emitted. This promise is extended with an `off` method. ```js -const Emittery = require('emittery'); +import Emittery from 'emittery'; const emitter = new Emittery(); @@ -311,7 +313,7 @@ Get an async iterator which buffers data each time an event is emitted. Call `return()` on the iterator to remove the subscription. ```js -const Emittery = require('emittery'); +import Emittery from 'emittery'; const emitter = new Emittery(); const iterator = emitter.events('🦄'); @@ -340,7 +342,7 @@ iterator In practice, you would usually consume the events using the [for await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of) statement. In that case, to revoke the subscription simply break the loop. ```js -const Emittery = require('emittery'); +import Emittery from 'emittery'; const emitter = new Emittery(); const iterator = emitter.events('🦄'); @@ -359,7 +361,7 @@ for await (const data of iterator) { It accepts multiple event names. ```js -const Emittery = require('emittery'); +import Emittery from 'emittery'; const emitter = new Emittery(); const iterator = emitter.events(['🦄', '🦊']); @@ -416,7 +418,7 @@ Get an async iterator which buffers a tuple of an event name and data each time Call `return()` on the iterator to remove the subscription. ```js -const Emittery = require('emittery'); +import Emittery from 'emittery'; const emitter = new Emittery(); const iterator = emitter.anyEvent(); @@ -458,7 +460,7 @@ The number of listeners for the `eventNames` or all events if not specified. Bind the given `methodNames`, or all `Emittery` methods if `methodNames` is not defined, into the `target` object. ```js -import Emittery = require('emittery'); +import Emittery from 'emittery'; const object = {}; @@ -472,7 +474,7 @@ object.emit('event'); The default `Emittery` class has generic types that can be provided by TypeScript users to strongly type the list of events and the data passed to their event listeners. ```ts -import Emittery = require('emittery'); +import Emittery from 'emittery'; const emitter = new Emittery< // Pass `{[eventName]: undefined | }` as the first type argument for events that pass data to their listeners. @@ -501,7 +503,7 @@ emitter.emit('other'); A decorator which mixins `Emittery` as property `emitteryPropertyName` and `methodNames`, or all `Emittery` methods if `methodNames` is not defined, into the target class. ```ts -import Emittery = require('emittery'); +import Emittery from 'emittery'; @Emittery.mixin('emittery') class MyClass {} @@ -521,7 +523,7 @@ Note that when using `.emitSerial()`, a slow listener will delay invocation of s Emittery can collect and log debug information. -To enable this feature set the DEBUG environment variable to 'emittery' or '*'. Additionally you can set the static `isDebugEnabled` variable to true on the Emittery class, or `myEmitter.debug.enabled` on an instance of it for debugging a single instance. +To enable this feature set the DEBUG environment variable to `'emittery'` or `'*'`. Additionally you can set the static `isDebugEnabled` variable to true on the Emittery class, or `myEmitter.debug.enabled` on an instance of it for debugging a single instance. See [API](#api) for more details on how debugging works. diff --git a/node_modules/figures/index.js b/node_modules/figures/index.js index 857636d5c9..18ff31984c 100644 --- a/node_modules/figures/index.js +++ b/node_modules/figures/index.js @@ -216,7 +216,7 @@ export const mainSymbols = { tick: '✔', info: 'ℹ', warning: '⚠', - cross: '✖', + cross: '✘', squareSmall: '◻', squareSmallFilled: '◼', circle: '◯', diff --git a/node_modules/figures/package.json b/node_modules/figures/package.json index d6efeffc38..9039c0ef46 100644 --- a/node_modules/figures/package.json +++ b/node_modules/figures/package.json @@ -1,6 +1,6 @@ { "name": "figures", - "version": "4.0.1", + "version": "5.0.0", "description": "Unicode symbols with fallbacks for older terminals", "license": "MIT", "repository": "sindresorhus/figures", @@ -13,7 +13,7 @@ "type": "module", "exports": "./index.js", "engines": { - "node": ">=12" + "node": ">=14" }, "scripts": { "test": "xo && ava && tsd" @@ -39,9 +39,8 @@ "is-unicode-supported": "^1.2.0" }, "devDependencies": { - "ava": "^4.1.0", - "tsd": "^0.19.1", - "typescript": "^4.6.3", - "xo": "^0.48.0" + "ava": "^4.3.1", + "tsd": "^0.22.0", + "xo": "^0.51.0" } } diff --git a/node_modules/figures/readme.md b/node_modules/figures/readme.md index 7e483ed85e..bd06267a56 100644 --- a/node_modules/figures/readme.md +++ b/node_modules/figures/readme.md @@ -10,8 +10,8 @@ Terminals such as Windows Console Host (and CMD) only support a [limited charact ## Install -``` -$ npm install figures +```sh +npm install figures ``` ## Usage @@ -62,7 +62,6 @@ Type: `string` String where the Unicode symbols will be replaced with fallback symbols depending on the terminal. - ## Figures `Fallback` characters are only shown when they differ from the `Main` ones. @@ -72,7 +71,7 @@ String where the Unicode symbols will be replaced with fallback symbols dependin | tick | `✔` | `√` | | info | `ℹ` | `i` | | warning | `⚠` | `‼` | -| cross | `✖` | `×` | +| cross | `✘` | `×` | | square | `█` | | | squareSmall | `◻` | `□` | | squareSmallFilled | `◼` | `■` | diff --git a/node_modules/graceful-fs/LICENSE b/node_modules/graceful-fs/LICENSE index 9d2c803696..e906a25acf 100644 --- a/node_modules/graceful-fs/LICENSE +++ b/node_modules/graceful-fs/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) Isaac Z. Schlueter, Ben Noordhuis, and Contributors +Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, and Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/node_modules/graceful-fs/graceful-fs.js b/node_modules/graceful-fs/graceful-fs.js index 947cd94bb4..8d5b89e4fa 100644 --- a/node_modules/graceful-fs/graceful-fs.js +++ b/node_modules/graceful-fs/graceful-fs.js @@ -191,16 +191,35 @@ function patch (fs) { var fs$readdir = fs.readdir fs.readdir = readdir + var noReaddirOptionVersions = /^v[0-5]\./ function readdir (path, options, cb) { if (typeof options === 'function') cb = options, options = null + var go$readdir = noReaddirOptionVersions.test(process.version) + ? function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, fs$readdirCallback( + path, options, cb, startTime + )) + } + : function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, options, fs$readdirCallback( + path, options, cb, startTime + )) + } + return go$readdir(path, options, cb) - function go$readdir (path, options, cb, startTime) { - return fs$readdir(path, options, function (err, files) { + function fs$readdirCallback (path, options, cb, startTime) { + return function (err, files) { if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) + enqueue([ + go$readdir, + [path, options, cb], + err, + startTime || Date.now(), + Date.now() + ]) else { if (files && files.sort) files.sort() @@ -208,7 +227,7 @@ function patch (fs) { if (typeof cb === 'function') cb.call(this, err, files) } - }) + } } } diff --git a/node_modules/graceful-fs/package.json b/node_modules/graceful-fs/package.json index 032c7d0b58..3057856872 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.8", + "version": "4.2.10", "repository": { "type": "git", "url": "https://github.com/isaacs/node-graceful-fs" diff --git a/node_modules/graceful-fs/polyfills.js b/node_modules/graceful-fs/polyfills.js index 1287da1aa4..46dea36cc4 100644 --- a/node_modules/graceful-fs/polyfills.js +++ b/node_modules/graceful-fs/polyfills.js @@ -71,13 +71,13 @@ function patch (fs) { fs.lstatSync = statFixSync(fs.lstatSync) // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { + if (fs.chmod && !fs.lchmod) { fs.lchmod = function (path, mode, cb) { if (cb) process.nextTick(cb) } fs.lchmodSync = function () {} } - if (!fs.lchown) { + if (fs.chown && !fs.lchown) { fs.lchown = function (path, uid, gid, cb) { if (cb) process.nextTick(cb) } @@ -94,32 +94,38 @@ function patch (fs) { // CPU to a busy looping process, which can cause the program causing the lock // contention to be starved of CPU by node, so the contention doesn't resolve. if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) + fs.rename = typeof fs.rename !== 'function' ? fs.rename + : (function (fs$rename) { + function rename (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename) + return rename + })(fs.rename) } // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { + fs.read = typeof fs.read !== 'function' ? fs.read + : (function (fs$read) { function read (fd, buffer, offset, length, position, callback_) { var callback if (callback_ && typeof callback_ === 'function') { @@ -140,7 +146,8 @@ function patch (fs) { return read })(fs.read) - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync + : (function (fs$readSync) { return function (fd, buffer, offset, length, position) { var eagCounter = 0 while (true) { try { @@ -199,7 +206,7 @@ function patch (fs) { } function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { + if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) { fs.lutimes = function (path, at, mt, cb) { fs.open(path, constants.O_SYMLINK, function (er, fd) { if (er) { @@ -233,7 +240,7 @@ function patch (fs) { return ret } - } else { + } else if (fs.futimes) { fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } fs.lutimesSync = function () {} } @@ -310,8 +317,10 @@ function patch (fs) { return function (target, options) { var stats = options ? orig.call(fs, target, options) : orig.call(fs, target) - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } return stats; } } diff --git a/node_modules/is-glob/README.md b/node_modules/is-glob/README.md index 59444ebe69..740724b276 100644 --- a/node_modules/is-glob/README.md +++ b/node_modules/is-glob/README.md @@ -1,4 +1,4 @@ -# is-glob [![NPM version](https://img.shields.io/npm/v/is-glob.svg?style=flat)](https://www.npmjs.com/package/is-glob) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![NPM total downloads](https://img.shields.io/npm/dt/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![Linux Build Status](https://img.shields.io/travis/micromatch/is-glob.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/is-glob) [![Windows Build Status](https://img.shields.io/appveyor/ci/micromatch/is-glob.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/micromatch/is-glob) +# is-glob [![NPM version](https://img.shields.io/npm/v/is-glob.svg?style=flat)](https://www.npmjs.com/package/is-glob) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![NPM total downloads](https://img.shields.io/npm/dt/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![Build Status](https://img.shields.io/github/workflow/status/micromatch/is-glob/dev)](https://github.com/micromatch/is-glob/actions) > Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience. diff --git a/node_modules/is-glob/index.js b/node_modules/is-glob/index.js index 55826510ce..620f563ecc 100644 --- a/node_modules/is-glob/index.js +++ b/node_modules/is-glob/index.js @@ -7,8 +7,128 @@ var isExtglob = require('is-extglob'); var chars = { '{': '}', '(': ')', '[': ']'}; -var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; -var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/; +var strictCheck = function(str) { + if (str[0] === '!') { + return true; + } + var index = 0; + var pipeIndex = -2; + var closeSquareIndex = -2; + var closeCurlyIndex = -2; + var closeParenIndex = -2; + var backSlashIndex = -2; + while (index < str.length) { + if (str[index] === '*') { + return true; + } + + if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) { + return true; + } + + if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') { + if (closeSquareIndex < index) { + closeSquareIndex = str.indexOf(']', index); + } + if (closeSquareIndex > index) { + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + } + } + + if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') { + closeCurlyIndex = str.indexOf('}', index); + if (closeCurlyIndex > index) { + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) { + return true; + } + } + } + + if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') { + closeParenIndex = str.indexOf(')', index); + if (closeParenIndex > index) { + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } + } + + if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') { + if (pipeIndex < index) { + pipeIndex = str.indexOf('|', index); + } + if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') { + closeParenIndex = str.indexOf(')', pipeIndex); + if (closeParenIndex > pipeIndex) { + backSlashIndex = str.indexOf('\\', pipeIndex); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } + } + } + + if (str[index] === '\\') { + var open = str[index + 1]; + index += 2; + var close = chars[open]; + + if (close) { + var n = str.indexOf(close, index); + if (n !== -1) { + index = n + 1; + } + } + + if (str[index] === '!') { + return true; + } + } else { + index++; + } + } + return false; +}; + +var relaxedCheck = function(str) { + if (str[0] === '!') { + return true; + } + var index = 0; + while (index < str.length) { + if (/[*?{}()[\]]/.test(str[index])) { + return true; + } + + if (str[index] === '\\') { + var open = str[index + 1]; + index += 2; + var close = chars[open]; + + if (close) { + var n = str.indexOf(close, index); + if (n !== -1) { + index = n + 1; + } + } + + if (str[index] === '!') { + return true; + } + } else { + index++; + } + } + return false; +}; module.exports = function isGlob(str, options) { if (typeof str !== 'string' || str === '') { @@ -19,30 +139,12 @@ module.exports = function isGlob(str, options) { return true; } - var regex = strictRegex; - var match; + var check = strictCheck; - // optionally relax regex + // optionally relax check if (options && options.strict === false) { - regex = relaxedRegex; + check = relaxedCheck; } - while ((match = regex.exec(str))) { - if (match[2]) return true; - var idx = match.index + match[0].length; - - // if an open bracket/brace/paren is escaped, - // set the index to the next closing character - var open = match[1]; - var close = open ? chars[open] : null; - if (open && close) { - var n = str.indexOf(close, idx); - if (n !== -1) { - idx = n + 1; - } - } - - str = str.slice(idx); - } - return false; + return check(str); }; diff --git a/node_modules/is-glob/package.json b/node_modules/is-glob/package.json index 806000dbda..858af0378e 100644 --- a/node_modules/is-glob/package.json +++ b/node_modules/is-glob/package.json @@ -1,7 +1,7 @@ { "name": "is-glob", "description": "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.", - "version": "4.0.1", + "version": "4.0.3", "homepage": "https://github.com/micromatch/is-glob", "author": "Jon Schlinkert (https://github.com/jonschlinkert)", "contributors": [ @@ -22,7 +22,7 @@ "node": ">=0.10.0" }, "scripts": { - "test": "mocha" + "test": "mocha && node benchmark.js" }, "dependencies": { "is-extglob": "^2.1.1" diff --git a/node_modules/is-unicode-supported/index.js b/node_modules/is-unicode-supported/index.js index e2e1736190..d3938c58d8 100644 --- a/node_modules/is-unicode-supported/index.js +++ b/node_modules/is-unicode-supported/index.js @@ -7,7 +7,9 @@ export default function isUnicodeSupported() { return Boolean(process.env.CI) || Boolean(process.env.WT_SESSION) // Windows Terminal + || Boolean(process.env.TERMINUS_SUBLIME) // Terminus (<0.2.27) || process.env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder + || process.env.TERM_PROGRAM === 'Terminus-Sublime' || process.env.TERM_PROGRAM === 'vscode' || process.env.TERM === 'xterm-256color' || process.env.TERM === 'alacritty' diff --git a/node_modules/is-unicode-supported/package.json b/node_modules/is-unicode-supported/package.json index 587908918e..c1126b6328 100644 --- a/node_modules/is-unicode-supported/package.json +++ b/node_modules/is-unicode-supported/package.json @@ -1,6 +1,6 @@ { "name": "is-unicode-supported", - "version": "1.2.0", + "version": "1.3.0", "description": "Detect whether the terminal supports Unicode", "license": "MIT", "repository": "sindresorhus/is-unicode-supported", diff --git a/node_modules/parse-ms/index.d.ts b/node_modules/parse-ms/index.d.ts index 5d72fce248..cd0dd861b8 100644 --- a/node_modules/parse-ms/index.d.ts +++ b/node_modules/parse-ms/index.d.ts @@ -1,13 +1,11 @@ -declare namespace parseMilliseconds { - interface Parsed { - days: number; - hours: number; - minutes: number; - seconds: number; - milliseconds: number; - microseconds: number; - nanoseconds: number; - } +export interface TimeComponents { + days: number; + hours: number; + minutes: number; + seconds: number; + milliseconds: number; + microseconds: number; + nanoseconds: number; } /** @@ -15,7 +13,7 @@ Parse milliseconds into an object. @example ``` -import parseMilliseconds = require('parse-ms'); +import parseMilliseconds from 'parse-ms'; parseMilliseconds(1337000001); // { @@ -29,8 +27,4 @@ parseMilliseconds(1337000001); // } ``` */ -declare function parseMilliseconds( - milliseconds: number -): parseMilliseconds.Parsed; - -export = parseMilliseconds; +export default function parseMilliseconds(milliseconds: number): TimeComponents; diff --git a/node_modules/parse-ms/index.js b/node_modules/parse-ms/index.js index f9c98b96b9..48bc04d4d0 100644 --- a/node_modules/parse-ms/index.js +++ b/node_modules/parse-ms/index.js @@ -1,5 +1,4 @@ -'use strict'; -module.exports = milliseconds => { +export default function parseMilliseconds(milliseconds) { if (typeof milliseconds !== 'number') { throw new TypeError('Expected a number'); } @@ -15,4 +14,4 @@ module.exports = milliseconds => { microseconds: roundTowardsZero(milliseconds * 1000) % 1000, nanoseconds: roundTowardsZero(milliseconds * 1e6) % 1000 }; -}; +} diff --git a/node_modules/parse-ms/license b/node_modules/parse-ms/license index e7af2f7710..fa7ceba3eb 100644 --- a/node_modules/parse-ms/license +++ b/node_modules/parse-ms/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://sindresorhus.com) 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: diff --git a/node_modules/parse-ms/package.json b/node_modules/parse-ms/package.json index c9dc8ff357..d24f4401d1 100644 --- a/node_modules/parse-ms/package.json +++ b/node_modules/parse-ms/package.json @@ -1,16 +1,19 @@ { "name": "parse-ms", - "version": "2.1.0", + "version": "3.0.0", "description": "Parse milliseconds into an object", "license": "MIT", "repository": "sindresorhus/parse-ms", + "funding": "https://github.com/sponsors/sindresorhus", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, + "type": "module", + "exports": "./index.js", "engines": { - "node": ">=6" + "node": ">=12" }, "scripts": { "test": "xo && ava && tsd" @@ -33,8 +36,8 @@ "interval" ], "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" + "ava": "^3.15.0", + "tsd": "^0.14.0", + "xo": "^0.38.2" } } diff --git a/node_modules/parse-ms/readme.md b/node_modules/parse-ms/readme.md index c804b4c120..cbb5f2e725 100644 --- a/node_modules/parse-ms/readme.md +++ b/node_modules/parse-ms/readme.md @@ -1,19 +1,17 @@ -# parse-ms [![Build Status](https://travis-ci.org/sindresorhus/parse-ms.svg?branch=master)](https://travis-ci.org/sindresorhus/parse-ms) +# parse-ms > Parse milliseconds into an object - ## Install ``` $ npm install parse-ms ``` - ## Usage ```js -const parseMilliseconds = require('parse-ms'); +import parseMilliseconds from 'parse-ms'; parseMilliseconds(1337000001); /* @@ -29,13 +27,7 @@ parseMilliseconds(1337000001); */ ``` - ## Related - [to-milliseconds](https://github.com/sindresorhus/to-milliseconds) - The inverse of this module - [pretty-ms](https://github.com/sindresorhus/pretty-ms) - Convert milliseconds to a human readable string - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/pretty-ms/index.d.ts b/node_modules/pretty-ms/index.d.ts index f8401e1b9c..00eeae3368 100644 --- a/node_modules/pretty-ms/index.d.ts +++ b/node_modules/pretty-ms/index.d.ts @@ -1,82 +1,80 @@ -declare namespace prettyMilliseconds { - interface Options { - /** - Number of digits to appear after the seconds decimal point. +export interface Options { + /** + Number of digits to appear after the seconds decimal point. - @default 1 - */ - readonly secondsDecimalDigits?: number; + @default 1 + */ + readonly secondsDecimalDigits?: number; - /** - Number of digits to appear after the milliseconds decimal point. + /** + Number of digits to appear after the milliseconds decimal point. - Useful in combination with [`process.hrtime()`](https://nodejs.org/api/process.html#process_process_hrtime). + Useful in combination with [`process.hrtime()`](https://nodejs.org/api/process.html#process_process_hrtime). - @default 0 - */ - readonly millisecondsDecimalDigits?: number; + @default 0 + */ + readonly millisecondsDecimalDigits?: number; - /** - Keep milliseconds on whole seconds: `13s` → `13.0s`. + /** + Keep milliseconds on whole seconds: `13s` → `13.0s`. - Useful when you are showing a number of seconds spent on an operation and don't want the width of the output to change when hitting a whole number. + Useful when you are showing a number of seconds spent on an operation and don't want the width of the output to change when hitting a whole number. - @default false - */ - readonly keepDecimalsOnWholeSeconds?: boolean; + @default false + */ + readonly keepDecimalsOnWholeSeconds?: boolean; - /** - Only show the first unit: `1h 10m` → `1h`. + /** + Only show the first unit: `1h 10m` → `1h`. - Also ensures that `millisecondsDecimalDigits` and `secondsDecimalDigits` are both set to `0`. + Also ensures that `millisecondsDecimalDigits` and `secondsDecimalDigits` are both set to `0`. - @default false - */ - readonly compact?: boolean; + @default false + */ + readonly compact?: boolean; - /** - Number of units to show. Setting `compact` to `true` overrides this option. + /** + Number of units to show. Setting `compact` to `true` overrides this option. - @default Infinity - */ - readonly unitCount?: number; + @default Infinity + */ + readonly unitCount?: number; - /** - Use full-length units: `5h 1m 45s` → `5 hours 1 minute 45 seconds`. + /** + Use full-length units: `5h 1m 45s` → `5 hours 1 minute 45 seconds`. - @default false - */ - readonly verbose?: boolean; + @default false + */ + readonly verbose?: boolean; - /** - Show milliseconds separately. This means they won't be included in the decimal part of the seconds. + /** + Show milliseconds separately. This means they won't be included in the decimal part of the seconds. - @default false - */ - readonly separateMilliseconds?: boolean; + @default false + */ + readonly separateMilliseconds?: boolean; - /** - Show microseconds and nanoseconds. + /** + Show microseconds and nanoseconds. - @default false - */ - readonly formatSubMilliseconds?: boolean; + @default false + */ + readonly formatSubMilliseconds?: boolean; - /** - Display time using colon notation: `5h 1m 45s` → `5:01:45`. Always shows time in at least minutes: `1s` → `0:01` + /** + Display time using colon notation: `5h 1m 45s` → `5:01:45`. Always shows time in at least minutes: `1s` → `0:01` - Useful when you want to display time without the time units, similar to a digital watch. + Useful when you want to display time without the time units, similar to a digital watch. - Setting `colonNotation` to `true` overrides the following options to `false`: - - `compact` - - `formatSubMilliseconds` - - `separateMilliseconds` - - `verbose` + Setting `colonNotation` to `true` overrides the following options to `false`: + - `compact` + - `formatSubMilliseconds` + - `separateMilliseconds` + - `verbose` - @default false - */ - readonly colonNotation?: boolean; - } + @default false + */ + readonly colonNotation?: boolean; } /** @@ -86,7 +84,7 @@ Convert milliseconds to a human readable string: `1337000000` → `15d 11h 23m 2 @example ``` -import prettyMilliseconds = require('pretty-ms'); +import prettyMilliseconds from 'pretty-ms'; prettyMilliseconds(1337000000); //=> '15d 11h 23m 20s' @@ -118,9 +116,8 @@ prettyMilliseconds(new Date(2014, 0, 1, 10, 40) - new Date(2014, 0, 1, 10, 5)) //=> '35m' ``` */ -declare function prettyMilliseconds( +export default function prettyMilliseconds( milliseconds: number, - options?: prettyMilliseconds.Options + options?: Options ): string; -export = prettyMilliseconds; diff --git a/node_modules/pretty-ms/index.js b/node_modules/pretty-ms/index.js index 42e7679058..dd9a31d7b7 100644 --- a/node_modules/pretty-ms/index.js +++ b/node_modules/pretty-ms/index.js @@ -1,11 +1,10 @@ -'use strict'; -const parseMilliseconds = require('parse-ms'); +import parseMilliseconds from 'parse-ms'; const pluralize = (word, count) => count === 1 ? word : `${word}s`; -const SECOND_ROUNDING_EPSILON = 0.0000001; +const SECOND_ROUNDING_EPSILON = 0.000_000_1; -module.exports = (milliseconds, options = {}) => { +export default function prettyMilliseconds(milliseconds, options = {}) { if (!Number.isFinite(milliseconds)) { throw new TypeError('Expected a finite number'); } @@ -60,9 +59,9 @@ module.exports = (milliseconds, options = {}) => { add(parsed.minutes, 'minute', 'm'); if ( - options.separateMilliseconds || - options.formatSubMilliseconds || - (!options.colonNotation && milliseconds < 1000) + options.separateMilliseconds + || options.formatSubMilliseconds + || (!options.colonNotation && milliseconds < 1000) ) { add(parsed.seconds, 'second', 's'); if (options.formatSubMilliseconds) { @@ -70,42 +69,42 @@ module.exports = (milliseconds, options = {}) => { add(parsed.microseconds, 'microsecond', 'µs'); add(parsed.nanoseconds, 'nanosecond', 'ns'); } else { - const millisecondsAndBelow = - parsed.milliseconds + - (parsed.microseconds / 1000) + - (parsed.nanoseconds / 1e6); + const millisecondsAndBelow + = parsed.milliseconds + + (parsed.microseconds / 1000) + + (parsed.nanoseconds / 1e6); - const millisecondsDecimalDigits = - typeof options.millisecondsDecimalDigits === 'number' ? - options.millisecondsDecimalDigits : - 0; + const millisecondsDecimalDigits + = typeof options.millisecondsDecimalDigits === 'number' + ? options.millisecondsDecimalDigits + : 0; - const roundedMiliseconds = millisecondsAndBelow >= 1 ? - Math.round(millisecondsAndBelow) : - Math.ceil(millisecondsAndBelow); + const roundedMiliseconds = millisecondsAndBelow >= 1 + ? Math.round(millisecondsAndBelow) + : Math.ceil(millisecondsAndBelow); - const millisecondsString = millisecondsDecimalDigits ? - millisecondsAndBelow.toFixed(millisecondsDecimalDigits) : - roundedMiliseconds; + const millisecondsString = millisecondsDecimalDigits + ? millisecondsAndBelow.toFixed(millisecondsDecimalDigits) + : roundedMiliseconds; add( - Number.parseFloat(millisecondsString, 10), + Number.parseFloat(millisecondsString), 'millisecond', 'ms', - millisecondsString + millisecondsString, ); } } else { const seconds = (milliseconds / 1000) % 60; - const secondsDecimalDigits = - typeof options.secondsDecimalDigits === 'number' ? - options.secondsDecimalDigits : - 1; + const secondsDecimalDigits + = typeof options.secondsDecimalDigits === 'number' + ? options.secondsDecimalDigits + : 1; const secondsFixed = floorDecimals(seconds, secondsDecimalDigits); - const secondsString = options.keepDecimalsOnWholeSeconds ? - secondsFixed : - secondsFixed.replace(/\.0+$/, ''); - add(Number.parseFloat(secondsString, 10), 'second', 's', secondsString); + const secondsString = options.keepDecimalsOnWholeSeconds + ? secondsFixed + : secondsFixed.replace(/\.0+$/, ''); + add(Number.parseFloat(secondsString), 'second', 's', secondsString); } if (result.length === 0) { @@ -122,4 +121,4 @@ module.exports = (milliseconds, options = {}) => { } return options.colonNotation ? result.join('') : result.join(' '); -}; +} diff --git a/node_modules/pretty-ms/license b/node_modules/pretty-ms/license index e7af2f7710..fa7ceba3eb 100644 --- a/node_modules/pretty-ms/license +++ b/node_modules/pretty-ms/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://sindresorhus.com) 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: diff --git a/node_modules/pretty-ms/package.json b/node_modules/pretty-ms/package.json index e38540118a..1b03610e18 100644 --- a/node_modules/pretty-ms/package.json +++ b/node_modules/pretty-ms/package.json @@ -1,6 +1,6 @@ { "name": "pretty-ms", - "version": "7.0.1", + "version": "8.0.0", "description": "Convert milliseconds to a human readable string: `1337000000` → `15d 11h 23m 20s`", "license": "MIT", "repository": "sindresorhus/pretty-ms", @@ -10,8 +10,11 @@ "email": "sindresorhus@gmail.com", "url": "https://sindresorhus.com" }, + "type": "module", + "exports": "./index.js", + "types": "./index.d.ts", "engines": { - "node": ">=10" + "node": ">=14.16" }, "scripts": { "test": "xo && ava && tsd" @@ -39,11 +42,11 @@ "hrtime" ], "dependencies": { - "parse-ms": "^2.1.0" + "parse-ms": "^3.0.0" }, "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.11.0", - "xo": "^0.30.0" + "ava": "^4.3.0", + "tsd": "^0.20.0", + "xo": "^0.49.0" } } diff --git a/node_modules/pretty-ms/readme.md b/node_modules/pretty-ms/readme.md index 6c6cbc221b..b1e823f885 100644 --- a/node_modules/pretty-ms/readme.md +++ b/node_modules/pretty-ms/readme.md @@ -1,17 +1,17 @@ -# pretty-ms [![Build Status](https://travis-ci.com/sindresorhus/pretty-ms.svg?branch=master)](https://travis-ci.com/sindresorhus/pretty-ms) +# pretty-ms > Convert milliseconds to a human readable string: `1337000000` → `15d 11h 23m 20s` ## Install -``` -$ npm install pretty-ms +```sh +npm install pretty-ms ``` ## Usage ```js -const prettyMilliseconds = require('pretty-ms'); +import prettyMilliseconds from 'pretty-ms'; prettyMilliseconds(1337000000); //=> '15d 11h 23m 20s' diff --git a/node_modules/stack-utils/license b/node_modules/stack-utils/LICENSE.md similarity index 88% rename from node_modules/stack-utils/license rename to node_modules/stack-utils/LICENSE.md index 28441ca9f5..97df98176f 100644 --- a/node_modules/stack-utils/license +++ b/node_modules/stack-utils/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) Isaac Z. Schlueter , James Talmage (github.com/jamestalmage), and Contributors +Copyright (c) 2016-2022 Isaac Z. Schlueter , James Talmage (github.com/jamestalmage), and Contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/node_modules/stack-utils/index.js b/node_modules/stack-utils/index.js index ed14bd3857..f567133ee2 100644 --- a/node_modules/stack-utils/index.js +++ b/node_modules/stack-utils/index.js @@ -161,7 +161,10 @@ class StackUtils { setFile(res, site.getFileName(), this._cwd); if (site.isConstructor()) { - res.constructor = true; + Object.defineProperty(res, 'constructor', { + value: true, + configurable: true, + }); } if (site.isEval()) { @@ -260,7 +263,10 @@ class StackUtils { setFile(res, file, this._cwd); if (ctor) { - res.constructor = true; + Object.defineProperty(res, 'constructor', { + value: true, + configurable: true, + }); } if (evalOrigin) { diff --git a/node_modules/stack-utils/package.json b/node_modules/stack-utils/package.json index 565acf6ef7..00acfa37e2 100644 --- a/node_modules/stack-utils/package.json +++ b/node_modules/stack-utils/package.json @@ -1,6 +1,6 @@ { "name": "stack-utils", - "version": "2.0.5", + "version": "2.0.6", "description": "Captures and cleans stack traces", "license": "MIT", "repository": "tapjs/stack-utils", @@ -34,6 +34,6 @@ "pify": "^4.0.1", "q": "^1.5.1", "source-map-support": "^0.5.20", - "tap": "^15.0.9" + "tap": "^16.3.0" } } diff --git a/node_modules/temp-dir/index.d.ts b/node_modules/temp-dir/index.d.ts index 000767b915..fea8417a13 100644 --- a/node_modules/temp-dir/index.d.ts +++ b/node_modules/temp-dir/index.d.ts @@ -3,16 +3,20 @@ Get the real path of the system temp directory. @example ``` -import * as os from 'os'; -import tempDirectory = require('temp-dir'); +import temporaryDirectory from 'temp-dir'; -console.log(tempDirectory); +console.log(temporaryDirectory); //=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T' +``` + +@example +``` +import os from 'node:os'; console.log(os.tmpdir()); //=> '/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T' // <= Symlink ``` */ -declare const tempDirectory: string; +declare const temporaryDirectory: string; -export = tempDirectory; +export default temporaryDirectory; diff --git a/node_modules/temp-dir/index.js b/node_modules/temp-dir/index.js index e588f8a733..45040dc43c 100644 --- a/node_modules/temp-dir/index.js +++ b/node_modules/temp-dir/index.js @@ -1,13 +1,6 @@ -'use strict'; -const fs = require('fs'); -const os = require('os'); +import {promises as fs} from 'node:fs'; +import os from 'node:os'; -const tempDirectorySymbol = Symbol.for('__RESOLVED_TEMP_DIRECTORY__'); +const temporaryDirectory = await fs.realpath(os.tmpdir()); -if (!global[tempDirectorySymbol]) { - Object.defineProperty(global, tempDirectorySymbol, { - value: fs.realpathSync(os.tmpdir()) - }); -} - -module.exports = global[tempDirectorySymbol]; +export default temporaryDirectory; diff --git a/node_modules/temp-dir/license b/node_modules/temp-dir/license index e7af2f7710..fa7ceba3eb 100644 --- a/node_modules/temp-dir/license +++ b/node_modules/temp-dir/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://sindresorhus.com) 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: diff --git a/node_modules/temp-dir/package.json b/node_modules/temp-dir/package.json index ec1c7c1e17..b376928aa8 100644 --- a/node_modules/temp-dir/package.json +++ b/node_modules/temp-dir/package.json @@ -1,16 +1,19 @@ { "name": "temp-dir", - "version": "2.0.0", + "version": "3.0.0", "description": "Get the real path of the system temp directory", "license": "MIT", "repository": "sindresorhus/temp-dir", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, + "type": "module", + "exports": "./index.js", + "types": "./index.d.ts", "engines": { - "node": ">=8" + "node": ">=14.16" }, "scripts": { "test": "xo && ava && tsd" @@ -33,9 +36,14 @@ "folder" ], "devDependencies": { - "ava": "^1.4.1", - "proxyquire": "^2.1.0", - "tsd": "^0.7.2", - "xo": "^0.24.0" + "ava": "^4.3.3", + "quibble": "^0.6.14", + "tsd": "^0.24.1", + "xo": "^0.52.3" + }, + "ava": { + "nodeArguments": [ + "--loader=quibble" + ] } } diff --git a/node_modules/temp-dir/readme.md b/node_modules/temp-dir/readme.md index c0ff5b19f9..d0d7a1bebb 100644 --- a/node_modules/temp-dir/readme.md +++ b/node_modules/temp-dir/readme.md @@ -1,30 +1,27 @@ -# temp-dir [![Build Status](https://travis-ci.org/sindresorhus/temp-dir.svg?branch=master)](https://travis-ci.org/sindresorhus/temp-dir) +# temp-dir > Get the real path of the system temp directory [The `os.tmpdir()` built-in doesn't return the real path.](https://github.com/nodejs/node/issues/11422) That can cause problems when the returned path is a symlink, which is the case on macOS. Use this module to get the resolved path. - ## Install +```sh +npm install temp-dir ``` -$ npm install temp-dir -``` - ## Usage ```js -const tempDirectory = require('temp-dir'); +import temporaryDirectory from 'temp-dir'; -console.log(tempDirectory); +console.log(temporaryDirectory); //=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T' - -console.log(require('os').tmpdir()); -//=> '/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T' // <= Symlink ``` +```js +import os from 'node:os'; -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) +console.log(os.tmpdir()); +//=> '/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T' // <= Symlink +``` diff --git a/node_modules/write-file-atomic/package.json b/node_modules/write-file-atomic/package.json index 86e2a0fbad..5c9bce457a 100644 --- a/node_modules/write-file-atomic/package.json +++ b/node_modules/write-file-atomic/package.json @@ -1,6 +1,6 @@ { "name": "write-file-atomic", - "version": "4.0.2", + "version": "5.0.0", "description": "Write files in an atomic fashion w/configurable ownership", "main": "./lib/index.js", "scripts": { @@ -8,9 +8,6 @@ "posttest": "npm run lint", "lint": "eslint \"**/*.js\"", "postlint": "template-oss-check", - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", "lintfix": "npm run lint -- --fix", "snap": "tap", "template-oss-apply": "template-oss-apply --force" @@ -35,7 +32,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.5.0", + "@npmcli/template-oss": "4.5.1", "mkdirp": "^1.0.4", "rimraf": "^3.0.2", "tap": "^16.0.1" @@ -45,11 +42,17 @@ "lib/" ], "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "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.", "windowsCI": false, - "version": "3.5.0" + "version": "4.5.1" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] } } diff --git a/node_modules/yargs/build/index.cjs b/node_modules/yargs/build/index.cjs index 55237f004f..9641ad8405 100644 --- a/node_modules/yargs/build/index.cjs +++ b/node_modules/yargs/build/index.cjs @@ -1 +1 @@ -"use strict";var t=require("assert");class e extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}let s,i=[];function n(t,o,a,h){s=h;let l={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if("string"!=typeof t.extends)return l;const r=/\.json|\..*rc$/.test(t.extends);let h=null;if(r)h=function(t,e){return s.path.resolve(t,e)}(o,t.extends);else try{h=require.resolve(t.extends)}catch(e){return t}!function(t){if(i.indexOf(t)>-1)throw new e(`Circular extended configurations: '${t}'.`)}(h),i.push(h),l=r?JSON.parse(s.readFileSync(h,"utf8")):require(t.extends),delete t.extends,l=n(l,s.path.dirname(h),a,s)}return i=[],a?r(l,t):Object.assign({},l,t)}function r(t,e){const s={};function i(t){return t&&"object"==typeof t&&!Array.isArray(t)}Object.assign(s,t);for(const n of Object.keys(e))i(e[n])&&i(s[n])?s[n]=r(t[n],e[n]):s[n]=e[n];return s}function o(t){const e=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),s=/\.*[\][<>]/g,i=e.shift();if(!i)throw new Error(`No command found in: ${t}`);const n={cmd:i.replace(s,""),demanded:[],optional:[]};return e.forEach(((t,i)=>{let r=!1;t=t.replace(/\s/g,""),/\.+[\]>]/.test(t)&&i===e.length-1&&(r=!0),/^\[/.test(t)?n.optional.push({cmd:t.replace(s,"").split("|"),variadic:r}):n.demanded.push({cmd:t.replace(s,"").split("|"),variadic:r})})),n}const a=["first","second","third","fourth","fifth","sixth"];function h(t,s,i){try{let n=0;const[r,a,h]="object"==typeof t?[{demanded:[],optional:[]},t,s]:[o(`cmd ${t}`),s,i],f=[].slice.call(a);for(;f.length&&void 0===f[f.length-1];)f.pop();const d=h||f.length;if(du)throw new e(`Too many arguments provided. Expected max ${u} but received ${d}.`);r.demanded.forEach((t=>{const e=l(f.shift());0===t.cmd.filter((t=>t===e||"*"===t)).length&&c(e,t.cmd,n),n+=1})),r.optional.forEach((t=>{if(0===f.length)return;const e=l(f.shift());0===t.cmd.filter((t=>t===e||"*"===t)).length&&c(e,t.cmd,n),n+=1}))}catch(t){console.warn(t.stack)}}function l(t){return Array.isArray(t)?"array":null===t?"null":typeof t}function c(t,s,i){throw new e(`Invalid ${a[i]||"manyith"} argument. Expected ${s.join(" or ")} but received ${t}.`)}function f(t){return!!t&&!!t.then&&"function"==typeof t.then}function d(t,e,s,i){s.assert.notStrictEqual(t,e,i)}function u(t,e){e.assert.strictEqual(typeof t,"string")}function p(t){return Object.keys(t)}function g(t={},e=(()=>!0)){const s={};return p(t).forEach((i=>{e(i,t[i])&&(s[i]=t[i])})),s}function m(){return process.versions.electron&&!process.defaultApp?0:1}function y(){return process.argv[m()]}var b=Object.freeze({__proto__:null,hideBin:function(t){return t.slice(m()+1)},getProcessArgvBin:y});function v(t,e,s,i){if("a"===s&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function O(t,e,s,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,s):n?n.value=s:e.set(t,s),s}class w{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,s=!0,i=!1){if(h(" [boolean] [boolean] [boolean]",[t,e,s],arguments.length),Array.isArray(t)){for(let i=0;i{const i=[...s[e]||[],e];return!t.option||!i.includes(t.option)})),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const t=this.frozens.pop();void 0!==t&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter((t=>t.global))}}function C(t,e,s,i){return s.reduce(((t,s)=>{if(s.applyBeforeValidation!==i)return t;if(s.mutates){if(s.applied)return t;s.applied=!0}if(f(t))return t.then((t=>Promise.all([t,s(t,e)]))).then((([t,e])=>Object.assign(t,e)));{const i=s(t,e);return f(i)?i.then((e=>Object.assign(t,e))):Object.assign(t,i)}}),t)}function j(t,e,s=(t=>{throw t})){try{const s="function"==typeof t?t():t;return f(s)?s.then((t=>e(t))):e(s)}catch(t){return s(t)}}const _=/(^\*)|(^\$0)/;class M{constructor(t,e,s,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=t,this.globalMiddleware=s,this.validation=e}addDirectory(t,e,s,i){"boolean"!=typeof(i=i||{}).recurse&&(i.recurse=!1),Array.isArray(i.extensions)||(i.extensions=["js"]);const n="function"==typeof i.visit?i.visit:t=>t;i.visit=(t,e,s)=>{const i=n(t,e,s);if(i){if(this.requireCache.has(e))return i;this.requireCache.add(e),this.addHandler(i)}return i},this.shim.requireDirectory({require:e,filename:s},t,i)}addHandler(t,e,s,i,n,r){let a=[];const h=function(t){return t?t.map((t=>(t.applyBeforeValidation=!1,t))):[]}(n);if(i=i||(()=>{}),Array.isArray(t))if(function(t){return t.every((t=>"string"==typeof t))}(t))[t,...a]=t;else for(const e of t)this.addHandler(e);else{if(function(t){return"object"==typeof t&&!Array.isArray(t)}(t)){let e=Array.isArray(t.command)||"string"==typeof t.command?t.command:this.moduleName(t);return t.aliases&&(e=[].concat(e).concat(t.aliases)),void this.addHandler(e,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated)}if(k(s))return void this.addHandler([t].concat(a),e,s.builder,s.handler,s.middlewares,s.deprecated)}if("string"==typeof t){const n=o(t);a=a.map((t=>o(t).cmd));let l=!1;const c=[n.cmd].concat(a).filter((t=>!_.test(t)||(l=!0,!1)));0===c.length&&l&&c.push("$0"),l&&(n.cmd=c[0],a=c.slice(1),t=t.replace(_,n.cmd)),a.forEach((t=>{this.aliasMap[t]=n.cmd})),!1!==e&&this.usage.command(t,e,l,a,r),this.handlers[n.cmd]={original:t,description:e,handler:i,builder:s||{},middlewares:h,deprecated:r,demanded:n.demanded,optional:n.optional},l&&(this.defaultCommand=this.handlers[n.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,s,i,n,r){const o=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,a=e.getInternalMethods().getContext(),h=a.commands.slice(),l=!t;t&&(a.commands.push(t),a.fullCommands.push(o.original));const c=this.applyBuilderUpdateUsageAndParse(l,o,e,s.aliases,h,i,n,r);return f(c)?c.then((t=>this.applyMiddlewareAndGetResult(l,o,t.innerArgv,a,n,t.aliases,e))):this.applyMiddlewareAndGetResult(l,o,c.innerArgv,a,n,c.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,s,i,n,r,o,a){const h=e.builder;let l=s;if(x(h)){const c=h(s.getInternalMethods().reset(i),a);if(f(c))return c.then((i=>{var a;return l=(a=i)&&"function"==typeof a.getInternalMethods?i:s,this.parseAndUpdateUsage(t,e,l,n,r,o)}))}else(function(t){return"object"==typeof t})(h)&&(l=s.getInternalMethods().reset(i),Object.keys(e.builder).forEach((t=>{l.option(t,h[t])})));return this.parseAndUpdateUsage(t,e,l,n,r,o)}parseAndUpdateUsage(t,e,s,i,n,r){t&&s.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(s)&&s.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,e),e.description);const o=s.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,n,r);return f(o)?o.then((t=>({aliases:s.parsed.aliases,innerArgv:t}))):{aliases:s.parsed.aliases,innerArgv:o}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&0===t.getInternalMethods().getUsageInstance().getUsage().length}usageFromParentCommandsCommandHandler(t,e){const s=_.test(e.original)?e.original.replace(_,"").trim():e.original,i=t.filter((t=>!_.test(t)));return i.push(s),`$0 ${i.join(" ")}`}handleValidationAndGetResult(t,e,s,i,n,r,o,a){if(!r.getInternalMethods().getHasOutput()){const e=r.getInternalMethods().runValidation(n,a,r.parsed.error,t);s=j(s,(t=>(e(t),t)))}if(e.handler&&!r.getInternalMethods().getHasOutput()){r.getInternalMethods().setHasOutput();const i=!!r.getOptions().configuration["populate--"];r.getInternalMethods().postProcess(s,i,!1,!1),s=j(s=C(s,r,o,!1),(t=>{const s=e.handler(t);return f(s)?s.then((()=>t)):t})),t||r.getInternalMethods().getUsageInstance().cacheHelpMessage(),f(s)&&!r.getInternalMethods().hasParseCallback()&&s.catch((t=>{try{r.getInternalMethods().getUsageInstance().fail(null,t)}catch(t){}}))}return t||(i.commands.pop(),i.fullCommands.pop()),s}applyMiddlewareAndGetResult(t,e,s,i,n,r,o){let a={};if(n)return s;o.getInternalMethods().getHasOutput()||(a=this.populatePositionals(e,s,i,o));const h=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),l=C(s,o,h,!0);return f(l)?l.then((s=>this.handleValidationAndGetResult(t,e,s,i,r,o,h,a))):this.handleValidationAndGetResult(t,e,l,i,r,o,h,a)}populatePositionals(t,e,s,i){e._=e._.slice(s.commands.length);const n=t.demanded.slice(0),r=t.optional.slice(0),o={};for(this.validation.positionalCount(n.length,e._.length);n.length;){const t=n.shift();this.populatePositional(t,e,o)}for(;r.length;){const t=r.shift();this.populatePositional(t,e,o)}return e._=s.commands.concat(e._.map((t=>""+t))),this.postProcessPositionals(e,o,this.cmdToParseOptions(t.original),i),o}populatePositional(t,e,s){const i=t.cmd[0];t.variadic?s[i]=e._.splice(0).map(String):e._.length&&(s[i]=[String(e._.shift())])}cmdToParseOptions(t){const e={array:[],default:{},alias:{},demand:{}},s=o(t);return s.demanded.forEach((t=>{const[s,...i]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=i,e.demand[s]=!0})),s.optional.forEach((t=>{const[s,...i]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=i})),e}postProcessPositionals(t,e,s,i){const n=Object.assign({},i.getOptions());n.default=Object.assign(s.default,n.default);for(const t of Object.keys(s.alias))n.alias[t]=(n.alias[t]||[]).concat(s.alias[t]);n.array=n.array.concat(s.array),n.config={};const r=[];if(Object.keys(e).forEach((t=>{e[t].map((e=>{n.configuration["unknown-options-as-args"]&&(n.key[t]=!0),r.push(`--${t}`),r.push(e)}))})),!r.length)return;const o=Object.assign({},n.configuration,{"populate--":!1}),a=this.shim.Parser.detailed(r,Object.assign({},n,{configuration:o}));if(a.error)i.getInternalMethods().getUsageInstance().fail(a.error.message,a.error);else{const s=Object.keys(e);Object.keys(e).forEach((t=>{s.push(...a.aliases[t])})),Object.keys(a.argv).forEach((n=>{s.includes(n)&&(e[n]||(e[n]=a.argv[n]),!this.isInConfigs(i,n)&&!this.isDefaulted(i,n)&&Object.prototype.hasOwnProperty.call(t,n)&&Object.prototype.hasOwnProperty.call(a.argv,n)&&(Array.isArray(t[n])||Array.isArray(a.argv[n]))?t[n]=[].concat(t[n],a.argv[n]):t[n]=a.argv[n])}))}}isDefaulted(t,e){const{default:s}=t.getOptions();return Object.prototype.hasOwnProperty.call(s,e)||Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(e))}isInConfigs(t,e){const{configObjects:s}=t.getOptions();return s.some((t=>Object.prototype.hasOwnProperty.call(t,e)))||s.some((t=>Object.prototype.hasOwnProperty.call(t,this.shim.Parser.camelCase(e))))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){const e=_.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(e,this.defaultCommand.description)}const e=this.defaultCommand.builder;if(x(e))return e(t,!0);k(e)||Object.keys(e).forEach((s=>{t.option(s,e[s])}))}moduleName(t){const e=function(t){if("undefined"==typeof require)return null;for(let e,s=0,i=Object.keys(require.cache);s{const s=e;s._handle&&s.isTTY&&"function"==typeof s._handle.setBlocking&&s._handle.setBlocking(t)}))}function A(t){return"boolean"==typeof t}function P(t,s){const i=s.y18n.__,n={},r=[];n.failFn=function(t){r.push(t)};let o=null,a=null,h=!0;n.showHelpOnFail=function(e=!0,s){const[i,r]="string"==typeof e?[!0,e]:[e,s];return t.getInternalMethods().isGlobalContext()&&(a=r),o=r,h=i,n};let l=!1;n.fail=function(s,i){const c=t.getInternalMethods().getLoggerInstance();if(!r.length){if(t.getExitProcess()&&E(!0),!l){l=!0,h&&(t.showHelp("error"),c.error()),(s||i)&&c.error(s||i);const e=o||a;e&&((s||i)&&c.error(""),c.error(e))}if(i=i||new e(s),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,i);throw i}for(let t=r.length-1;t>=0;--t){const e=r[t];if(A(e)){if(i)throw i;if(s)throw Error(s)}else e(s,i,n)}};let c=[],f=!1;n.usage=(t,e)=>null===t?(f=!0,c=[],n):(f=!1,c.push([t,e||""]),n),n.getUsage=()=>c,n.getUsageDisabled=()=>f,n.getPositionalGroupName=()=>i("Positionals:");let d=[];n.example=(t,e)=>{d.push([t,e||""])};let u=[];n.command=function(t,e,s,i,n=!1){s&&(u=u.map((t=>(t[2]=!1,t)))),u.push([t,e||"",s,i,n])},n.getCommands=()=>u;let p={};n.describe=function(t,e){Array.isArray(t)?t.forEach((t=>{n.describe(t,e)})):"object"==typeof t?Object.keys(t).forEach((e=>{n.describe(e,t[e])})):p[t]=e},n.getDescriptions=()=>p;let m=[];n.epilog=t=>{m.push(t)};let y,b=!1;function v(){return b||(y=function(){const t=80;return s.process.stdColumns?Math.min(t,s.process.stdColumns):t}(),b=!0),y}n.wrap=t=>{b=!0,y=t};const O="__yargsString__:";function w(t,e,i){let n=0;return Array.isArray(t)||(t=Object.values(t).map((t=>[t]))),t.forEach((t=>{n=Math.max(s.stringWidth(i?`${i} ${I(t[0])}`:I(t[0]))+$(t[0]),n)})),e&&(n=Math.min(n,parseInt((.5*e).toString(),10))),n}let C;function j(e){return t.getOptions().hiddenOptions.indexOf(e)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}function _(t,e){let s=`[${i("default:")} `;if(void 0===t&&!e)return null;if(e)s+=e;else switch(typeof t){case"string":s+=`"${t}"`;break;case"object":s+=JSON.stringify(t);break;default:s+=t}return`${s}]`}n.deferY18nLookup=t=>O+t,n.help=function(){if(C)return C;!function(){const e=t.getDemandedOptions(),s=t.getOptions();(Object.keys(s.alias)||[]).forEach((i=>{s.alias[i].forEach((r=>{p[r]&&n.describe(i,p[r]),r in e&&t.demandOption(i,e[r]),s.boolean.includes(r)&&t.boolean(i),s.count.includes(r)&&t.count(i),s.string.includes(r)&&t.string(i),s.normalize.includes(r)&&t.normalize(i),s.array.includes(r)&&t.array(i),s.number.includes(r)&&t.number(i)}))}))}();const e=t.customScriptName?t.$0:s.path.basename(t.$0),r=t.getDemandedOptions(),o=t.getDemandedCommands(),a=t.getDeprecatedOptions(),h=t.getGroups(),l=t.getOptions();let g=[];g=g.concat(Object.keys(p)),g=g.concat(Object.keys(r)),g=g.concat(Object.keys(o)),g=g.concat(Object.keys(l.default)),g=g.filter(j),g=Object.keys(g.reduce(((t,e)=>("_"!==e&&(t[e]=!0),t)),{}));const y=v(),b=s.cliui({width:y,wrap:!!y});if(!f)if(c.length)c.forEach((t=>{b.div({text:`${t[0].replace(/\$0/g,e)}`}),t[1]&&b.div({text:`${t[1]}`,padding:[1,0,0,0]})})),b.div();else if(u.length){let t=null;t=o._?`${e} <${i("command")}>\n`:`${e} [${i("command")}]\n`,b.div(`${t}`)}if(u.length>1||1===u.length&&!u[0][2]){b.div(i("Commands:"));const s=t.getInternalMethods().getContext(),n=s.commands.length?`${s.commands.join(" ")} `:"";!0===t.getInternalMethods().getParserConfiguration()["sort-commands"]&&(u=u.sort(((t,e)=>t[0].localeCompare(e[0]))));const r=e?`${e} `:"";u.forEach((t=>{const s=`${r}${n}${t[0].replace(/^\$0 ?/,"")}`;b.span({text:s,padding:[0,2,0,2],width:w(u,y,`${e}${n}`)+4},{text:t[1]});const o=[];t[2]&&o.push(`[${i("default")}]`),t[3]&&t[3].length&&o.push(`[${i("aliases:")} ${t[3].join(", ")}]`),t[4]&&("string"==typeof t[4]?o.push(`[${i("deprecated: %s",t[4])}]`):o.push(`[${i("deprecated")}]`)),o.length?b.div({text:o.join(" "),padding:[0,0,0,2],align:"right"}):b.div()})),b.div()}const M=(Object.keys(l.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);g=g.filter((e=>!t.parsed.newAliases[e]&&M.every((t=>-1===(l.alias[t]||[]).indexOf(e)))));const k=i("Options:");h[k]||(h[k]=[]),function(t,e,s,i){let n=[],r=null;Object.keys(s).forEach((t=>{n=n.concat(s[t])})),t.forEach((t=>{r=[t].concat(e[t]),r.some((t=>-1!==n.indexOf(t)))||s[i].push(t)}))}(g,l.alias,h,k);const x=t=>/^--/.test(I(t)),E=Object.keys(h).filter((t=>h[t].length>0)).map((t=>({groupName:t,normalizedKeys:h[t].filter(j).map((t=>{if(M.includes(t))return t;for(let e,s=0;void 0!==(e=M[s]);s++)if((l.alias[e]||[]).includes(t))return e;return t}))}))).filter((({normalizedKeys:t})=>t.length>0)).map((({groupName:t,normalizedKeys:e})=>{const s=e.reduce(((e,s)=>(e[s]=[s].concat(l.alias[s]||[]).map((e=>t===n.getPositionalGroupName()?e:(/^[0-9]$/.test(e)?l.boolean.includes(s)?"-":"--":e.length>1?"--":"-")+e)).sort(((t,e)=>x(t)===x(e)?0:x(t)?1:-1)).join(", "),e)),{});return{groupName:t,normalizedKeys:e,switches:s}}));if(E.filter((({groupName:t})=>t!==n.getPositionalGroupName())).some((({normalizedKeys:t,switches:e})=>!t.every((t=>x(e[t])))))&&E.filter((({groupName:t})=>t!==n.getPositionalGroupName())).forEach((({normalizedKeys:t,switches:e})=>{t.forEach((t=>{var s,i;x(e[t])&&(e[t]=(s=e[t],i="-x, ".length,S(s)?{text:s.text,indentation:s.indentation+i}:{text:s,indentation:i}))}))})),E.forEach((({groupName:t,normalizedKeys:e,switches:s})=>{b.div(t),e.forEach((t=>{const e=s[t];let o=p[t]||"",h=null;o.includes(O)&&(o=i(o.substring(O.length))),l.boolean.includes(t)&&(h=`[${i("boolean")}]`),l.count.includes(t)&&(h=`[${i("count")}]`),l.string.includes(t)&&(h=`[${i("string")}]`),l.normalize.includes(t)&&(h=`[${i("string")}]`),l.array.includes(t)&&(h=`[${i("array")}]`),l.number.includes(t)&&(h=`[${i("number")}]`);const c=[t in a?(f=a[t],"string"==typeof f?`[${i("deprecated: %s",f)}]`:`[${i("deprecated")}]`):null,h,t in r?`[${i("required")}]`:null,l.choices&&l.choices[t]?`[${i("choices:")} ${n.stringifiedValues(l.choices[t])}]`:null,_(l.default[t],l.defaultDescription[t])].filter(Boolean).join(" ");var f;b.span({text:I(e),padding:[0,2,0,2+$(e)],width:w(s,y)+4},o),c?b.div({text:c,padding:[0,0,0,2],align:"right"}):b.div()})),b.div()})),d.length&&(b.div(i("Examples:")),d.forEach((t=>{t[0]=t[0].replace(/\$0/g,e)})),d.forEach((t=>{""===t[1]?b.div({text:t[0],padding:[0,2,0,2]}):b.div({text:t[0],padding:[0,2,0,2],width:w(d,y)+4},{text:t[1]})})),b.div()),m.length>0){const t=m.map((t=>t.replace(/\$0/g,e))).join("\n");b.div(`${t}\n`)}return b.toString().replace(/\s*$/,"")},n.cacheHelpMessage=function(){C=this.help()},n.clearCachedHelpMessage=function(){C=void 0},n.hasCachedHelpMessage=function(){return!!C},n.showHelp=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(n.help())},n.functionDescription=t=>["(",t.name?s.Parser.decamelize(t.name,"-"):i("generated-value"),")"].join(""),n.stringifiedValues=function(t,e){let s="";const i=e||", ",n=[].concat(t);return t&&n.length?(n.forEach((t=>{s.length&&(s+=i),s+=JSON.stringify(t)})),s):s};let M=null;n.version=t=>{M=t},n.showVersion=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(M)},n.reset=function(t){return o=null,l=!1,c=[],f=!1,m=[],d=[],u=[],p=g(p,(e=>!t[e])),n};const k=[];return n.freeze=function(){k.push({failMessage:o,failureOutput:l,usages:c,usageDisabled:f,epilogs:m,examples:d,commands:u,descriptions:p})},n.unfreeze=function(t=!1){const e=k.pop();e&&(t?(p={...e.descriptions,...p},u=[...e.commands,...u],c=[...e.usages,...c],d=[...e.examples,...d],m=[...e.epilogs,...m]):({failMessage:o,failureOutput:l,usages:c,usageDisabled:f,epilogs:m,examples:d,commands:u,descriptions:p}=e))},n}function S(t){return"object"==typeof t}function $(t){return S(t)?t.indentation:0}function I(t){return S(t)?t.text:t}class D{constructor(t,e,s,i){var n,r,o;this.yargs=t,this.usage=e,this.command=s,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=null!==(o=(null===(n=this.shim.getEnv("SHELL"))||void 0===n?void 0:n.includes("zsh"))||(null===(r=this.shim.getEnv("ZSH_NAME"))||void 0===r?void 0:r.includes("zsh")))&&void 0!==o&&o}defaultCompletion(t,e,s,i){const n=this.command.getCommandHandlers();for(let e=0,s=t.length;e{const i=o(s[0]).cmd;if(-1===e.indexOf(i))if(this.zshShell){const e=s[1]||"";t.push(i.replace(/:/g,"\\:")+":"+e)}else t.push(i)}))}optionCompletions(t,e,s,i){if((i.match(/^-/)||""===i&&0===t.length)&&!this.previousArgHasChoices(e)){const s=this.yargs.getOptions(),n=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach((r=>{const o=!!s.configuration["boolean-negation"]&&s.boolean.includes(r);n.includes(r)||s.hiddenOptions.includes(r)||this.argsContainKey(e,r,o)||(this.completeOptionKey(r,t,i),o&&s.default[r]&&this.completeOptionKey(`no-${r}`,t,i))}))}}choicesFromOptionsCompletions(t,e,s,i){if(this.previousArgHasChoices(e)){const s=this.getPreviousArgChoices(e);s&&s.length>0&&t.push(...s.map((t=>t.replace(/:/g,"\\:"))))}}choicesFromPositionalsCompletions(t,e,s,i){if(""===i&&t.length>0&&this.previousArgHasChoices(e))return;const n=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],r=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),o=n[s._.length-r-1];if(!o)return;const a=this.yargs.getOptions().choices[o]||[];for(const e of a)e.startsWith(i)&&t.push(e.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],s="";if(!e.startsWith("-")&&t.length>1&&(s=e,e=t[t.length-2]),!e.startsWith("-"))return;const i=e.replace(/^-+/,""),n=this.yargs.getOptions(),r=[i,...this.yargs.getAliases()[i]||[]];let o;for(const t of r)if(Object.prototype.hasOwnProperty.call(n.key,t)&&Array.isArray(n.choices[t])){o=n.choices[t];break}return o?o.filter((t=>!s||t.startsWith(s))):void 0}previousArgHasChoices(t){const e=this.getPreviousArgChoices(t);return void 0!==e&&e.length>0}argsContainKey(t,e,s){const i=e=>-1!==t.indexOf((/^[^0-9]$/.test(e)?"-":"--")+e);if(i(e))return!0;if(s&&i(`no-${e}`))return!0;if(this.aliases)for(const t of this.aliases[e])if(i(t))return!0;return!1}completeOptionKey(t,e,s){const i=this.usage.getDescriptions(),n=!/^--/.test(s)&&(t=>/^[^0-9]$/.test(t))(t)?"-":"--";if(this.zshShell){const s=i[t]||"";e.push(n+`${t.replace(/:/g,"\\:")}:${s.replace("__yargsString__:","")}`)}else e.push(n+t)}customCompletion(t,e,s,i){if(d(this.customCompletionFunction,null,this.shim),this.customCompletionFunction.length<3){const t=this.customCompletionFunction(s,e);return f(t)?t.then((t=>{this.shim.process.nextTick((()=>{i(null,t)}))})).catch((t=>{this.shim.process.nextTick((()=>{i(t,void 0)}))})):i(null,t)}return function(t){return t.length>3}(this.customCompletionFunction)?this.customCompletionFunction(s,e,((n=i)=>this.defaultCompletion(t,e,s,n)),(t=>{i(null,t)})):this.customCompletionFunction(s,e,(t=>{i(null,t)}))}getCompletion(t,e){const s=t.length?t[t.length-1]:"",i=this.yargs.parse(t,!0),n=this.customCompletionFunction?i=>this.customCompletion(t,i,s,e):i=>this.defaultCompletion(t,i,s,e);return f(i)?i.then(n):n(i)}generateCompletionScript(t,e){let s=this.zshShell?'#compdef {{app_name}}\n###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$\'\n\' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "${words[@]}"))\n IFS=$si\n _describe \'values\' reply\n}\ncompdef _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n':'###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word="${COMP_WORDS[COMP_CWORD]}"\n args=("${COMP_WORDS[@]}")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions "${args[@]}")\n\n COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n';const i=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),s=s.replace(/{{app_name}}/g,i),s=s.replace(/{{completion_command}}/g,e),s.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}}function N(t,e){if(0===t.length)return e.length;if(0===e.length)return t.length;const s=[];let i,n;for(i=0;i<=e.length;i++)s[i]=[i];for(n=0;n<=t.length;n++)s[0][n]=n;for(i=1;i<=e.length;i++)for(n=1;n<=t.length;n++)e.charAt(i-1)===t.charAt(n-1)?s[i][n]=s[i-1][n-1]:i>1&&n>1&&e.charAt(i-2)===t.charAt(n-1)&&e.charAt(i-1)===t.charAt(n-2)?s[i][n]=s[i-2][n-2]+1:s[i][n]=Math.min(s[i-1][n-1]+1,Math.min(s[i][n-1]+1,s[i-1][n]+1));return s[e.length][t.length]}const H=["$0","--","_"];var z,q,W,F,U,L,V,G,R,T,K,B,Y,J,Z,X,Q,tt,et,st,it,nt,rt,ot,at,ht,lt,ct,ft,dt,ut,pt,gt,mt;const yt=Symbol("copyDoubleDash"),bt=Symbol("copyDoubleDash"),vt=Symbol("deleteFromParserHintObject"),Ot=Symbol("emitWarning"),wt=Symbol("freeze"),Ct=Symbol("getDollarZero"),jt=Symbol("getParserConfiguration"),_t=Symbol("guessLocale"),Mt=Symbol("guessVersion"),kt=Symbol("parsePositionalNumbers"),xt=Symbol("pkgUp"),Et=Symbol("populateParserHintArray"),At=Symbol("populateParserHintSingleValueDictionary"),Pt=Symbol("populateParserHintArrayDictionary"),St=Symbol("populateParserHintDictionary"),$t=Symbol("sanitizeKey"),It=Symbol("setKey"),Dt=Symbol("unfreeze"),Nt=Symbol("validateAsync"),Ht=Symbol("getCommandInstance"),zt=Symbol("getContext"),qt=Symbol("getHasOutput"),Wt=Symbol("getLoggerInstance"),Ft=Symbol("getParseContext"),Ut=Symbol("getUsageInstance"),Lt=Symbol("getValidationInstance"),Vt=Symbol("hasParseCallback"),Gt=Symbol("isGlobalContext"),Rt=Symbol("postProcess"),Tt=Symbol("rebase"),Kt=Symbol("reset"),Bt=Symbol("runYargsParserAndExecuteCommands"),Yt=Symbol("runValidation"),Jt=Symbol("setHasOutput"),Zt=Symbol("kTrackManuallySetKeys");class Xt{constructor(t=[],e,s,i){this.customScriptName=!1,this.parsed=!1,z.set(this,void 0),q.set(this,void 0),W.set(this,{commands:[],fullCommands:[]}),F.set(this,null),U.set(this,null),L.set(this,"show-hidden"),V.set(this,null),G.set(this,!0),R.set(this,{}),T.set(this,!0),K.set(this,[]),B.set(this,void 0),Y.set(this,{}),J.set(this,!1),Z.set(this,null),X.set(this,!0),Q.set(this,void 0),tt.set(this,""),et.set(this,void 0),st.set(this,void 0),it.set(this,{}),nt.set(this,null),rt.set(this,null),ot.set(this,{}),at.set(this,{}),ht.set(this,void 0),lt.set(this,!1),ct.set(this,void 0),ft.set(this,!1),dt.set(this,!1),ut.set(this,!1),pt.set(this,void 0),gt.set(this,null),mt.set(this,void 0),O(this,ct,i,"f"),O(this,ht,t,"f"),O(this,q,e,"f"),O(this,st,s,"f"),O(this,B,new w(this),"f"),this.$0=this[Ct](),this[Kt](),O(this,z,v(this,z,"f"),"f"),O(this,pt,v(this,pt,"f"),"f"),O(this,mt,v(this,mt,"f"),"f"),O(this,et,v(this,et,"f"),"f"),v(this,et,"f").showHiddenOpt=v(this,L,"f"),O(this,Q,this[bt](),"f")}addHelpOpt(t,e){return h("[string|boolean] [string]",[t,e],arguments.length),v(this,Z,"f")&&(this[vt](v(this,Z,"f")),O(this,Z,null,"f")),!1===t&&void 0===e||(O(this,Z,"string"==typeof t?t:"help","f"),this.boolean(v(this,Z,"f")),this.describe(v(this,Z,"f"),e||v(this,pt,"f").deferY18nLookup("Show help"))),this}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(h("[string|boolean] [string]",[t,e],arguments.length),!1===t&&void 0===e)return this;const s="string"==typeof t?t:v(this,L,"f");return this.boolean(s),this.describe(s,e||v(this,pt,"f").deferY18nLookup("Show hidden options")),v(this,et,"f").showHiddenOpt=s,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return h(" [string|array]",[t,e],arguments.length),this[Pt](this.alias.bind(this),"alias",t,e),this}array(t){return h("",[t],arguments.length),this[Et]("array",t),this[Zt](t),this}boolean(t){return h("",[t],arguments.length),this[Et]("boolean",t),this[Zt](t),this}check(t,e){return h(" [boolean]",[t,e],arguments.length),this.middleware(((e,s)=>j((()=>t(e,s.getOptions())),(s=>(s?("string"==typeof s||s instanceof Error)&&v(this,pt,"f").fail(s.toString(),s):v(this,pt,"f").fail(v(this,ct,"f").y18n.__("Argument check failed: %s",t.toString())),e)),(t=>(v(this,pt,"f").fail(t.message?t.message:t.toString(),t),e)))),!1,e),this}choices(t,e){return h(" [string|array]",[t,e],arguments.length),this[Pt](this.choices.bind(this),"choices",t,e),this}coerce(t,s){if(h(" [function]",[t,s],arguments.length),Array.isArray(t)){if(!s)throw new e("coerce callback must be provided");for(const e of t)this.coerce(e,s);return this}if("object"==typeof t){for(const e of Object.keys(t))this.coerce(e,t[e]);return this}if(!s)throw new e("coerce callback must be provided");return v(this,et,"f").key[t]=!0,v(this,B,"f").addCoerceMiddleware(((i,n)=>{let r;return Object.prototype.hasOwnProperty.call(i,t)?j((()=>(r=n.getAliases(),s(i[t]))),(e=>{i[t]=e;const s=n.getInternalMethods().getParserConfiguration()["strip-aliased"];if(r[t]&&!0!==s)for(const s of r[t])i[s]=e;return i}),(t=>{throw new e(t.message)})):i}),t),this}conflicts(t,e){return h(" [string|array]",[t,e],arguments.length),v(this,mt,"f").conflicts(t,e),this}config(t="config",e,s){return h("[object|string] [string|function] [function]",[t,e,s],arguments.length),"object"!=typeof t||Array.isArray(t)?("function"==typeof e&&(s=e,e=void 0),this.describe(t,e||v(this,pt,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach((t=>{v(this,et,"f").config[t]=s||!0})),this):(t=n(t,v(this,q,"f"),this[jt]()["deep-merge-config"]||!1,v(this,ct,"f")),v(this,et,"f").configObjects=(v(this,et,"f").configObjects||[]).concat(t),this)}completion(t,e,s){return h("[string] [string|boolean|function] [function]",[t,e,s],arguments.length),"function"==typeof e&&(s=e,e=void 0),O(this,U,t||v(this,U,"f")||"completion","f"),e||!1===e||(e="generate completion script"),this.command(v(this,U,"f"),e),s&&v(this,F,"f").registerFunction(s),this}command(t,e,s,i,n,r){return h(" [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,s,i,n,r],arguments.length),v(this,z,"f").addHandler(t,e,s,i,n,r),this}commands(t,e,s,i,n,r){return this.command(t,e,s,i,n,r)}commandDir(t,e){h(" [object]",[t,e],arguments.length);const s=v(this,st,"f")||v(this,ct,"f").require;return v(this,z,"f").addDirectory(t,s,v(this,ct,"f").getCallerFile(),e),this}count(t){return h("",[t],arguments.length),this[Et]("count",t),this[Zt](t),this}default(t,e,s){return h(" [*] [string]",[t,e,s],arguments.length),s&&(u(t,v(this,ct,"f")),v(this,et,"f").defaultDescription[t]=s),"function"==typeof e&&(u(t,v(this,ct,"f")),v(this,et,"f").defaultDescription[t]||(v(this,et,"f").defaultDescription[t]=v(this,pt,"f").functionDescription(e)),e=e.call()),this[At](this.default.bind(this),"default",t,e),this}defaults(t,e,s){return this.default(t,e,s)}demandCommand(t=1,e,s,i){return h("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,s,i],arguments.length),"number"!=typeof e&&(s=e,e=1/0),this.global("_",!1),v(this,et,"f").demandedCommands._={min:t,max:e,minMsg:s,maxMsg:i},this}demand(t,e,s){return Array.isArray(e)?(e.forEach((t=>{d(s,!0,v(this,ct,"f")),this.demandOption(t,s)})),e=1/0):"number"!=typeof e&&(s=e,e=1/0),"number"==typeof t?(d(s,!0,v(this,ct,"f")),this.demandCommand(t,e,s,s)):Array.isArray(t)?t.forEach((t=>{d(s,!0,v(this,ct,"f")),this.demandOption(t,s)})):"string"==typeof s?this.demandOption(t,s):!0!==s&&void 0!==s||this.demandOption(t),this}demandOption(t,e){return h(" [string]",[t,e],arguments.length),this[At](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return h(" [string|boolean]",[t,e],arguments.length),v(this,et,"f").deprecatedOptions[t]=e,this}describe(t,e){return h(" [string]",[t,e],arguments.length),this[It](t,!0),v(this,pt,"f").describe(t,e),this}detectLocale(t){return h("",[t],arguments.length),O(this,G,t,"f"),this}env(t){return h("[string|boolean]",[t],arguments.length),!1===t?delete v(this,et,"f").envPrefix:v(this,et,"f").envPrefix=t||"",this}epilogue(t){return h("",[t],arguments.length),v(this,pt,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return h(" [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach((t=>this.example(...t))):v(this,pt,"f").example(t,e),this}exit(t,e){O(this,J,!0,"f"),O(this,V,e,"f"),v(this,T,"f")&&v(this,ct,"f").process.exit(t)}exitProcess(t=!0){return h("[boolean]",[t],arguments.length),O(this,T,t,"f"),this}fail(t){if(h("",[t],arguments.length),"boolean"==typeof t&&!1!==t)throw new e("Invalid first argument. Expected function or boolean 'false'");return v(this,pt,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return h(" [function]",[t,e],arguments.length),e?v(this,F,"f").getCompletion(t,e):new Promise(((e,s)=>{v(this,F,"f").getCompletion(t,((t,i)=>{t?s(t):e(i)}))}))}getDemandedOptions(){return h([],0),v(this,et,"f").demandedOptions}getDemandedCommands(){return h([],0),v(this,et,"f").demandedCommands}getDeprecatedOptions(){return h([],0),v(this,et,"f").deprecatedOptions}getDetectLocale(){return v(this,G,"f")}getExitProcess(){return v(this,T,"f")}getGroups(){return Object.assign({},v(this,Y,"f"),v(this,at,"f"))}getHelp(){if(O(this,J,!0,"f"),!v(this,pt,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[Bt](v(this,ht,"f"),void 0,void 0,0,!0);if(f(t))return t.then((()=>v(this,pt,"f").help()))}const t=v(this,z,"f").runDefaultBuilderOn(this);if(f(t))return t.then((()=>v(this,pt,"f").help()))}return Promise.resolve(v(this,pt,"f").help())}getOptions(){return v(this,et,"f")}getStrict(){return v(this,ft,"f")}getStrictCommands(){return v(this,dt,"f")}getStrictOptions(){return v(this,ut,"f")}global(t,e){return h(" [boolean]",[t,e],arguments.length),t=[].concat(t),!1!==e?v(this,et,"f").local=v(this,et,"f").local.filter((e=>-1===t.indexOf(e))):t.forEach((t=>{v(this,et,"f").local.includes(t)||v(this,et,"f").local.push(t)})),this}group(t,e){h(" ",[t,e],arguments.length);const s=v(this,at,"f")[e]||v(this,Y,"f")[e];v(this,at,"f")[e]&&delete v(this,at,"f")[e];const i={};return v(this,Y,"f")[e]=(s||[]).concat(t).filter((t=>!i[t]&&(i[t]=!0))),this}hide(t){return h("",[t],arguments.length),v(this,et,"f").hiddenOptions.push(t),this}implies(t,e){return h(" [number|string|array]",[t,e],arguments.length),v(this,mt,"f").implies(t,e),this}locale(t){return h("[string]",[t],arguments.length),void 0===t?(this[_t](),v(this,ct,"f").y18n.getLocale()):(O(this,G,!1,"f"),v(this,ct,"f").y18n.setLocale(t),this)}middleware(t,e,s){return v(this,B,"f").addMiddleware(t,!!e,s)}nargs(t,e){return h(" [number]",[t,e],arguments.length),this[At](this.nargs.bind(this),"narg",t,e),this}normalize(t){return h("",[t],arguments.length),this[Et]("normalize",t),this}number(t){return h("",[t],arguments.length),this[Et]("number",t),this[Zt](t),this}option(t,e){if(h(" [object]",[t,e],arguments.length),"object"==typeof t)Object.keys(t).forEach((e=>{this.options(e,t[e])}));else{"object"!=typeof e&&(e={}),this[Zt](t),!v(this,gt,"f")||"version"!==t&&"version"!==(null==e?void 0:e.alias)||this[Ot](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join("\n"),void 0,"versionWarning"),v(this,et,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);const s=e.deprecate||e.deprecated;s&&this.deprecateOption(t,s);const i=e.demand||e.required||e.require;i&&this.demand(t,i),e.demandOption&&this.demandOption(t,"string"==typeof e.demandOption?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),void 0!==e.implies&&this.implies(t,e.implies),void 0!==e.nargs&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||"boolean"===e.type)&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||"array"===e.type)&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||"number"===e.type)&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||"string"===e.type)&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||"count"===e.type)&&this.count(t),"boolean"==typeof e.global&&this.global(t,e.global),e.defaultDescription&&(v(this,et,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);const n=e.describe||e.description||e.desc;this.describe(t,n),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,s){h("[string|array] [function|boolean|object] [function]",[t,e,s],arguments.length),this[wt](),void 0===t&&(t=v(this,ht,"f")),"object"==typeof e&&(O(this,rt,e,"f"),e=s),"function"==typeof e&&(O(this,nt,e,"f"),e=!1),e||O(this,ht,t,"f"),v(this,nt,"f")&&O(this,T,!1,"f");const i=this[Bt](t,!!e),n=this.parsed;return v(this,F,"f").setParsed(this.parsed),f(i)?i.then((t=>(v(this,nt,"f")&&v(this,nt,"f").call(this,v(this,V,"f"),t,v(this,tt,"f")),t))).catch((t=>{throw v(this,nt,"f")&&v(this,nt,"f")(t,this.parsed.argv,v(this,tt,"f")),t})).finally((()=>{this[Dt](),this.parsed=n})):(v(this,nt,"f")&&v(this,nt,"f").call(this,v(this,V,"f"),i,v(this,tt,"f")),this[Dt](),this.parsed=n,i)}parseAsync(t,e,s){const i=this.parse(t,e,s);return f(i)?i:Promise.resolve(i)}parseSync(t,s,i){const n=this.parse(t,s,i);if(f(n))throw new e(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return n}parserConfiguration(t){return h("",[t],arguments.length),O(this,it,t,"f"),this}pkgConf(t,e){h(" [string]",[t,e],arguments.length);let s=null;const i=this[xt](e||v(this,q,"f"));return i[t]&&"object"==typeof i[t]&&(s=n(i[t],e||v(this,q,"f"),this[jt]()["deep-merge-config"]||!1,v(this,ct,"f")),v(this,et,"f").configObjects=(v(this,et,"f").configObjects||[]).concat(s)),this}positional(t,e){h(" ",[t,e],arguments.length);const s=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=g(e,((t,e)=>!("type"===t&&!["string","number","boolean"].includes(e))&&s.includes(t)));const i=v(this,W,"f").fullCommands[v(this,W,"f").fullCommands.length-1],n=i?v(this,z,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return p(n).forEach((s=>{const i=n[s];Array.isArray(i)?-1!==i.indexOf(t)&&(e[s]=!0):i[t]&&!(s in e)&&(e[s]=i[t])})),this.group(t,v(this,pt,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return h("[boolean]",[t],arguments.length),O(this,lt,t,"f"),this}required(t,e,s){return this.demand(t,e,s)}require(t,e,s){return this.demand(t,e,s)}requiresArg(t){return h(" [number]",[t],arguments.length),"string"==typeof t&&v(this,et,"f").narg[t]||this[At](this.requiresArg.bind(this),"narg",t,NaN),this}showCompletionScript(t,e){return h("[string] [string]",[t,e],arguments.length),t=t||this.$0,v(this,Q,"f").log(v(this,F,"f").generateCompletionScript(t,e||v(this,U,"f")||"completion")),this}showHelp(t){if(h("[string|function]",[t],arguments.length),O(this,J,!0,"f"),!v(this,pt,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[Bt](v(this,ht,"f"),void 0,void 0,0,!0);if(f(e))return e.then((()=>{v(this,pt,"f").showHelp(t)})),this}const e=v(this,z,"f").runDefaultBuilderOn(this);if(f(e))return e.then((()=>{v(this,pt,"f").showHelp(t)})),this}return v(this,pt,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return h("[boolean|string] [string]",[t,e],arguments.length),v(this,pt,"f").showHelpOnFail(t,e),this}showVersion(t){return h("[string|function]",[t],arguments.length),v(this,pt,"f").showVersion(t),this}skipValidation(t){return h("",[t],arguments.length),this[Et]("skipValidation",t),this}strict(t){return h("[boolean]",[t],arguments.length),O(this,ft,!1!==t,"f"),this}strictCommands(t){return h("[boolean]",[t],arguments.length),O(this,dt,!1!==t,"f"),this}strictOptions(t){return h("[boolean]",[t],arguments.length),O(this,ut,!1!==t,"f"),this}string(t){return h("",[t],arguments.length),this[Et]("string",t),this[Zt](t),this}terminalWidth(){return h([],0),v(this,ct,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return h("",[t],arguments.length),O(this,G,!1,"f"),v(this,ct,"f").y18n.updateLocale(t),this}usage(t,s,i,n){if(h(" [string|boolean] [function|object] [function]",[t,s,i,n],arguments.length),void 0!==s){if(d(t,null,v(this,ct,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,s,i,n);throw new e(".usage() description must start with $0 if being used as alias for .command()")}return v(this,pt,"f").usage(t),this}version(t,e,s){const i="version";if(h("[boolean|string] [string] [string]",[t,e,s],arguments.length),v(this,gt,"f")&&(this[vt](v(this,gt,"f")),v(this,pt,"f").version(void 0),O(this,gt,null,"f")),0===arguments.length)s=this[Mt](),t=i;else if(1===arguments.length){if(!1===t)return this;s=t,t=i}else 2===arguments.length&&(s=e,e=void 0);return O(this,gt,"string"==typeof t?t:i,"f"),e=e||v(this,pt,"f").deferY18nLookup("Show version number"),v(this,pt,"f").version(s||void 0),this.boolean(v(this,gt,"f")),this.describe(v(this,gt,"f"),e),this}wrap(t){return h("",[t],arguments.length),v(this,pt,"f").wrap(t),this}[(z=new WeakMap,q=new WeakMap,W=new WeakMap,F=new WeakMap,U=new WeakMap,L=new WeakMap,V=new WeakMap,G=new WeakMap,R=new WeakMap,T=new WeakMap,K=new WeakMap,B=new WeakMap,Y=new WeakMap,J=new WeakMap,Z=new WeakMap,X=new WeakMap,Q=new WeakMap,tt=new WeakMap,et=new WeakMap,st=new WeakMap,it=new WeakMap,nt=new WeakMap,rt=new WeakMap,ot=new WeakMap,at=new WeakMap,ht=new WeakMap,lt=new WeakMap,ct=new WeakMap,ft=new WeakMap,dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,gt=new WeakMap,mt=new WeakMap,yt)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch(t){}return t}[bt](){return{log:(...t)=>{this[Vt]()||console.log(...t),O(this,J,!0,"f"),v(this,tt,"f").length&&O(this,tt,v(this,tt,"f")+"\n","f"),O(this,tt,v(this,tt,"f")+t.join(" "),"f")},error:(...t)=>{this[Vt]()||console.error(...t),O(this,J,!0,"f"),v(this,tt,"f").length&&O(this,tt,v(this,tt,"f")+"\n","f"),O(this,tt,v(this,tt,"f")+t.join(" "),"f")}}}[vt](t){p(v(this,et,"f")).forEach((e=>{if("configObjects"===e)return;const s=v(this,et,"f")[e];Array.isArray(s)?s.includes(t)&&s.splice(s.indexOf(t),1):"object"==typeof s&&delete s[t]})),delete v(this,pt,"f").getDescriptions()[t]}[Ot](t,e,s){v(this,R,"f")[s]||(v(this,ct,"f").process.emitWarning(t,e),v(this,R,"f")[s]=!0)}[wt](){v(this,K,"f").push({options:v(this,et,"f"),configObjects:v(this,et,"f").configObjects.slice(0),exitProcess:v(this,T,"f"),groups:v(this,Y,"f"),strict:v(this,ft,"f"),strictCommands:v(this,dt,"f"),strictOptions:v(this,ut,"f"),completionCommand:v(this,U,"f"),output:v(this,tt,"f"),exitError:v(this,V,"f"),hasOutput:v(this,J,"f"),parsed:this.parsed,parseFn:v(this,nt,"f"),parseContext:v(this,rt,"f")}),v(this,pt,"f").freeze(),v(this,mt,"f").freeze(),v(this,z,"f").freeze(),v(this,B,"f").freeze()}[Ct](){let t,e="";return t=/\b(node|iojs|electron)(\.exe)?$/.test(v(this,ct,"f").process.argv()[0])?v(this,ct,"f").process.argv().slice(1,2):v(this,ct,"f").process.argv().slice(0,1),e=t.map((t=>{const e=this[Tt](v(this,q,"f"),t);return t.match(/^(\/|([a-zA-Z]:)?\\)/)&&e.lengthe.includes("package.json")?"package.json":void 0));d(i,void 0,v(this,ct,"f")),s=JSON.parse(v(this,ct,"f").readFileSync(i,"utf8"))}catch(t){}return v(this,ot,"f")[e]=s||{},v(this,ot,"f")[e]}[Et](t,e){(e=[].concat(e)).forEach((e=>{e=this[$t](e),v(this,et,"f")[t].push(e)}))}[At](t,e,s,i){this[St](t,e,s,i,((t,e,s)=>{v(this,et,"f")[t][e]=s}))}[Pt](t,e,s,i){this[St](t,e,s,i,((t,e,s)=>{v(this,et,"f")[t][e]=(v(this,et,"f")[t][e]||[]).concat(s)}))}[St](t,e,s,i,n){if(Array.isArray(s))s.forEach((e=>{t(e,i)}));else if((t=>"object"==typeof t)(s))for(const e of p(s))t(e,s[e]);else n(e,this[$t](s),i)}[$t](t){return"__proto__"===t?"___proto___":t}[It](t,e){return this[At](this[It].bind(this),"key",t,e),this}[Dt](){var t,e,s,i,n,r,o,a,h,l,c,f;const u=v(this,K,"f").pop();let p;d(u,void 0,v(this,ct,"f")),t=this,e=this,s=this,i=this,n=this,r=this,o=this,a=this,h=this,l=this,c=this,f=this,({options:{set value(e){O(t,et,e,"f")}}.value,configObjects:p,exitProcess:{set value(t){O(e,T,t,"f")}}.value,groups:{set value(t){O(s,Y,t,"f")}}.value,output:{set value(t){O(i,tt,t,"f")}}.value,exitError:{set value(t){O(n,V,t,"f")}}.value,hasOutput:{set value(t){O(r,J,t,"f")}}.value,parsed:this.parsed,strict:{set value(t){O(o,ft,t,"f")}}.value,strictCommands:{set value(t){O(a,dt,t,"f")}}.value,strictOptions:{set value(t){O(h,ut,t,"f")}}.value,completionCommand:{set value(t){O(l,U,t,"f")}}.value,parseFn:{set value(t){O(c,nt,t,"f")}}.value,parseContext:{set value(t){O(f,rt,t,"f")}}.value}=u),v(this,et,"f").configObjects=p,v(this,pt,"f").unfreeze(),v(this,mt,"f").unfreeze(),v(this,z,"f").unfreeze(),v(this,B,"f").unfreeze()}[Nt](t,e){return j(e,(e=>(t(e),e)))}getInternalMethods(){return{getCommandInstance:this[Ht].bind(this),getContext:this[zt].bind(this),getHasOutput:this[qt].bind(this),getLoggerInstance:this[Wt].bind(this),getParseContext:this[Ft].bind(this),getParserConfiguration:this[jt].bind(this),getUsageInstance:this[Ut].bind(this),getValidationInstance:this[Lt].bind(this),hasParseCallback:this[Vt].bind(this),isGlobalContext:this[Gt].bind(this),postProcess:this[Rt].bind(this),reset:this[Kt].bind(this),runValidation:this[Yt].bind(this),runYargsParserAndExecuteCommands:this[Bt].bind(this),setHasOutput:this[Jt].bind(this)}}[Ht](){return v(this,z,"f")}[zt](){return v(this,W,"f")}[qt](){return v(this,J,"f")}[Wt](){return v(this,Q,"f")}[Ft](){return v(this,rt,"f")||{}}[Ut](){return v(this,pt,"f")}[Lt](){return v(this,mt,"f")}[Vt](){return!!v(this,nt,"f")}[Gt](){return v(this,X,"f")}[Rt](t,e,s,i){if(s)return t;if(f(t))return t;e||(t=this[yt](t));return(this[jt]()["parse-positional-numbers"]||void 0===this[jt]()["parse-positional-numbers"])&&(t=this[kt](t)),i&&(t=C(t,this,v(this,B,"f").getMiddleware(),!1)),t}[Kt](t={}){O(this,et,v(this,et,"f")||{},"f");const e={};e.local=v(this,et,"f").local||[],e.configObjects=v(this,et,"f").configObjects||[];const s={};e.local.forEach((e=>{s[e]=!0,(t[e]||[]).forEach((t=>{s[t]=!0}))})),Object.assign(v(this,at,"f"),Object.keys(v(this,Y,"f")).reduce(((t,e)=>{const i=v(this,Y,"f")[e].filter((t=>!(t in s)));return i.length>0&&(t[e]=i),t}),{})),O(this,Y,{},"f");return["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"].forEach((t=>{e[t]=(v(this,et,"f")[t]||[]).filter((t=>!s[t]))})),["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"].forEach((t=>{e[t]=g(v(this,et,"f")[t],(t=>!s[t]))})),e.envPrefix=v(this,et,"f").envPrefix,O(this,et,e,"f"),O(this,pt,v(this,pt,"f")?v(this,pt,"f").reset(s):P(this,v(this,ct,"f")),"f"),O(this,mt,v(this,mt,"f")?v(this,mt,"f").reset(s):function(t,e,s){const i=s.y18n.__,n=s.y18n.__n,r={nonOptionCount:function(s){const i=t.getDemandedCommands(),r=s._.length+(s["--"]?s["--"].length:0)-t.getInternalMethods().getContext().commands.length;i._&&(ri._.max)&&(ri._.max&&(void 0!==i._.maxMsg?e.fail(i._.maxMsg?i._.maxMsg.replace(/\$0/g,r.toString()).replace(/\$1/,i._.max.toString()):null):e.fail(n("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",r,r.toString(),i._.max.toString()))))},positionalCount:function(t,s){s{H.includes(e)||Object.prototype.hasOwnProperty.call(o,e)||Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),e)||r.isValidAndSomeAliasIsNotNew(e,i)||f.push(e)})),h&&(d.commands.length>0||c.length>0||a)&&s._.slice(d.commands.length).forEach((t=>{c.includes(""+t)||f.push(""+t)})),h){const e=(null===(l=t.getDemandedCommands()._)||void 0===l?void 0:l.max)||0,i=d.commands.length+e;i{t=String(t),d.commands.includes(t)||f.includes(t)||f.push(t)}))}f.length&&e.fail(n("Unknown argument: %s","Unknown arguments: %s",f.length,f.map((t=>t.trim()?t:`"${t}"`)).join(", ")))},unknownCommands:function(s){const i=t.getInternalMethods().getCommandInstance().getCommands(),r=[],o=t.getInternalMethods().getContext();return(o.commands.length>0||i.length>0)&&s._.slice(o.commands.length).forEach((t=>{i.includes(""+t)||r.push(""+t)})),r.length>0&&(e.fail(n("Unknown command: %s","Unknown commands: %s",r.length,r.join(", "))),!0)},isValidAndSomeAliasIsNotNew:function(e,s){if(!Object.prototype.hasOwnProperty.call(s,e))return!1;const i=t.parsed.newAliases;return[e,...s[e]].some((t=>!Object.prototype.hasOwnProperty.call(i,t)||!i[e]))},limitedChoices:function(s){const n=t.getOptions(),r={};if(!Object.keys(n.choices).length)return;Object.keys(s).forEach((t=>{-1===H.indexOf(t)&&Object.prototype.hasOwnProperty.call(n.choices,t)&&[].concat(s[t]).forEach((e=>{-1===n.choices[t].indexOf(e)&&void 0!==e&&(r[t]=(r[t]||[]).concat(e))}))}));const o=Object.keys(r);if(!o.length)return;let a=i("Invalid values:");o.forEach((t=>{a+=`\n ${i("Argument: %s, Given: %s, Choices: %s",t,e.stringifiedValues(r[t]),e.stringifiedValues(n.choices[t]))}`})),e.fail(a)}};let o={};function a(t,e){const s=Number(e);return"number"==typeof(e=isNaN(s)?e:s)?e=t._.length>=e:e.match(/^--no-.+/)?(e=e.match(/^--no-(.+)/)[1],e=!Object.prototype.hasOwnProperty.call(t,e)):e=Object.prototype.hasOwnProperty.call(t,e),e}r.implies=function(e,i){h(" [array|number|string]",[e,i],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.implies(t,e[t])})):(t.global(e),o[e]||(o[e]=[]),Array.isArray(i)?i.forEach((t=>r.implies(e,t))):(d(i,void 0,s),o[e].push(i)))},r.getImplied=function(){return o},r.implications=function(t){const s=[];if(Object.keys(o).forEach((e=>{const i=e;(o[e]||[]).forEach((e=>{let n=i;const r=e;n=a(t,n),e=a(t,e),n&&!e&&s.push(` ${i} -> ${r}`)}))})),s.length){let t=`${i("Implications failed:")}\n`;s.forEach((e=>{t+=e})),e.fail(t)}};let l={};r.conflicts=function(e,s){h(" [array|string]",[e,s],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.conflicts(t,e[t])})):(t.global(e),l[e]||(l[e]=[]),Array.isArray(s)?s.forEach((t=>r.conflicts(e,t))):l[e].push(s))},r.getConflicting=()=>l,r.conflicting=function(n){Object.keys(n).forEach((t=>{l[t]&&l[t].forEach((s=>{s&&void 0!==n[t]&&void 0!==n[s]&&e.fail(i("Arguments %s and %s are mutually exclusive",t,s))}))})),t.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(l).forEach((t=>{l[t].forEach((r=>{r&&void 0!==n[s.Parser.camelCase(t)]&&void 0!==n[s.Parser.camelCase(r)]&&e.fail(i("Arguments %s and %s are mutually exclusive",t,r))}))}))},r.recommendCommands=function(t,s){s=s.sort(((t,e)=>e.length-t.length));let n=null,r=1/0;for(let e,i=0;void 0!==(e=s[i]);i++){const s=N(t,e);s<=3&&s!t[e])),l=g(l,(e=>!t[e])),r};const c=[];return r.freeze=function(){c.push({implied:o,conflicting:l})},r.unfreeze=function(){const t=c.pop();d(t,void 0,s),({implied:o,conflicting:l}=t)},r}(this,v(this,pt,"f"),v(this,ct,"f")),"f"),O(this,z,v(this,z,"f")?v(this,z,"f").reset():function(t,e,s,i){return new M(t,e,s,i)}(v(this,pt,"f"),v(this,mt,"f"),v(this,B,"f"),v(this,ct,"f")),"f"),v(this,F,"f")||O(this,F,function(t,e,s,i){return new D(t,e,s,i)}(this,v(this,pt,"f"),v(this,z,"f"),v(this,ct,"f")),"f"),v(this,B,"f").reset(),O(this,U,null,"f"),O(this,tt,"","f"),O(this,V,null,"f"),O(this,J,!1,"f"),this.parsed=!1,this}[Tt](t,e){return v(this,ct,"f").path.relative(t,e)}[Bt](t,s,i,n=0,r=!1){let o=!!i||r;t=t||v(this,ht,"f"),v(this,et,"f").__=v(this,ct,"f").y18n.__,v(this,et,"f").configuration=this[jt]();const a=!!v(this,et,"f").configuration["populate--"],h=Object.assign({},v(this,et,"f").configuration,{"populate--":!0}),l=v(this,ct,"f").Parser.detailed(t,Object.assign({},v(this,et,"f"),{configuration:{"parse-positional-numbers":!1,...h}})),c=Object.assign(l.argv,v(this,rt,"f"));let d;const u=l.aliases;let p=!1,g=!1;Object.keys(c).forEach((t=>{t===v(this,Z,"f")&&c[t]?p=!0:t===v(this,gt,"f")&&c[t]&&(g=!0)})),c.$0=this.$0,this.parsed=l,0===n&&v(this,pt,"f").clearCachedHelpMessage();try{if(this[_t](),s)return this[Rt](c,a,!!i,!1);if(v(this,Z,"f")){[v(this,Z,"f")].concat(u[v(this,Z,"f")]||[]).filter((t=>t.length>1)).includes(""+c._[c._.length-1])&&(c._.pop(),p=!0)}O(this,X,!1,"f");const h=v(this,z,"f").getCommands(),m=v(this,F,"f").completionKey in c,y=p||m||r;if(c._.length){if(h.length){let t;for(let e,s=n||0;void 0!==c._[s];s++){if(e=String(c._[s]),h.includes(e)&&e!==v(this,U,"f")){const t=v(this,z,"f").runCommand(e,this,l,s+1,r,p||g||r);return this[Rt](t,a,!!i,!1)}if(!t&&e!==v(this,U,"f")){t=e;break}}!v(this,z,"f").hasDefaultCommand()&&v(this,lt,"f")&&t&&!y&&v(this,mt,"f").recommendCommands(t,h)}v(this,U,"f")&&c._.includes(v(this,U,"f"))&&!m&&(v(this,T,"f")&&E(!0),this.showCompletionScript(),this.exit(0))}if(v(this,z,"f").hasDefaultCommand()&&!y){const t=v(this,z,"f").runCommand(null,this,l,0,r,p||g||r);return this[Rt](t,a,!!i,!1)}if(m){v(this,T,"f")&&E(!0);const s=(t=[].concat(t)).slice(t.indexOf(`--${v(this,F,"f").completionKey}`)+1);return v(this,F,"f").getCompletion(s,((t,s)=>{if(t)throw new e(t.message);(s||[]).forEach((t=>{v(this,Q,"f").log(t)})),this.exit(0)})),this[Rt](c,!a,!!i,!1)}if(v(this,J,"f")||(p?(v(this,T,"f")&&E(!0),o=!0,this.showHelp("log"),this.exit(0)):g&&(v(this,T,"f")&&E(!0),o=!0,v(this,pt,"f").showVersion("log"),this.exit(0))),!o&&v(this,et,"f").skipValidation.length>0&&(o=Object.keys(c).some((t=>v(this,et,"f").skipValidation.indexOf(t)>=0&&!0===c[t]))),!o){if(l.error)throw new e(l.error.message);if(!m){const t=this[Yt](u,{},l.error);i||(d=C(c,this,v(this,B,"f").getMiddleware(),!0)),d=this[Nt](t,null!=d?d:c),f(d)&&!i&&(d=d.then((()=>C(c,this,v(this,B,"f").getMiddleware(),!1))))}}}catch(t){if(!(t instanceof e))throw t;v(this,pt,"f").fail(t.message,t)}return this[Rt](null!=d?d:c,a,!!i,!0)}[Yt](t,s,i,n){const r={...this.getDemandedOptions()};return o=>{if(i)throw new e(i.message);v(this,mt,"f").nonOptionCount(o),v(this,mt,"f").requiredArguments(o,r);let a=!1;v(this,dt,"f")&&(a=v(this,mt,"f").unknownCommands(o)),v(this,ft,"f")&&!a?v(this,mt,"f").unknownArguments(o,t,s,!!n):v(this,ut,"f")&&v(this,mt,"f").unknownArguments(o,t,{},!1,!1),v(this,mt,"f").limitedChoices(o),v(this,mt,"f").implications(o),v(this,mt,"f").conflicting(o)}}[Jt](){O(this,J,!0,"f")}[Zt](t){if("string"==typeof t)v(this,et,"f").key[t]=!0;else for(const e of t)v(this,et,"f").key[e]=!0}}var Qt,te;const{readFileSync:ee}=require("fs"),{inspect:se}=require("util"),{resolve:ie}=require("path"),ne=require("y18n"),re=require("yargs-parser");var oe,ae={assert:{notStrictEqual:t.notStrictEqual,strictEqual:t.strictEqual},cliui:require("cliui"),findUp:require("escalade/sync"),getEnv:t=>process.env[t],getCallerFile:require("get-caller-file"),getProcessArgvBin:y,inspect:se,mainFilename:null!==(te=null===(Qt=null===require||void 0===require?void 0:require.main)||void 0===Qt?void 0:Qt.filename)&&void 0!==te?te:process.cwd(),Parser:re,path:require("path"),process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,e)=>process.emitWarning(t,e),execPath:()=>process.execPath,exit:t=>{process.exit(t)},nextTick:process.nextTick,stdColumns:void 0!==process.stdout.columns?process.stdout.columns:null},readFileSync:ee,require:require,requireDirectory:require("require-directory"),stringWidth:require("string-width"),y18n:ne({directory:ie(__dirname,"../locales"),updateFiles:!1})};const he=(null===(oe=null===process||void 0===process?void 0:process.env)||void 0===oe?void 0:oe.YARGS_MIN_NODE_VERSION)?Number(process.env.YARGS_MIN_NODE_VERSION):12;if(process&&process.version){if(Number(process.version.match(/v([^.]+)/)[1]){const i=new Xt(t,e,s,ce);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}),argsert:h,isPromise:f,objFilter:g,parseCommand:o,Parser:le,processArgv:b,YError:e};module.exports=fe; +"use strict";var t=require("assert");class e extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}let s,i=[];function n(t,o,a,h){s=h;let l={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if("string"!=typeof t.extends)return l;const r=/\.json|\..*rc$/.test(t.extends);let h=null;if(r)h=function(t,e){return s.path.resolve(t,e)}(o,t.extends);else try{h=require.resolve(t.extends)}catch(e){return t}!function(t){if(i.indexOf(t)>-1)throw new e(`Circular extended configurations: '${t}'.`)}(h),i.push(h),l=r?JSON.parse(s.readFileSync(h,"utf8")):require(t.extends),delete t.extends,l=n(l,s.path.dirname(h),a,s)}return i=[],a?r(l,t):Object.assign({},l,t)}function r(t,e){const s={};function i(t){return t&&"object"==typeof t&&!Array.isArray(t)}Object.assign(s,t);for(const n of Object.keys(e))i(e[n])&&i(s[n])?s[n]=r(t[n],e[n]):s[n]=e[n];return s}function o(t){const e=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),s=/\.*[\][<>]/g,i=e.shift();if(!i)throw new Error(`No command found in: ${t}`);const n={cmd:i.replace(s,""),demanded:[],optional:[]};return e.forEach(((t,i)=>{let r=!1;t=t.replace(/\s/g,""),/\.+[\]>]/.test(t)&&i===e.length-1&&(r=!0),/^\[/.test(t)?n.optional.push({cmd:t.replace(s,"").split("|"),variadic:r}):n.demanded.push({cmd:t.replace(s,"").split("|"),variadic:r})})),n}const a=["first","second","third","fourth","fifth","sixth"];function h(t,s,i){try{let n=0;const[r,a,h]="object"==typeof t?[{demanded:[],optional:[]},t,s]:[o(`cmd ${t}`),s,i],f=[].slice.call(a);for(;f.length&&void 0===f[f.length-1];)f.pop();const d=h||f.length;if(du)throw new e(`Too many arguments provided. Expected max ${u} but received ${d}.`);r.demanded.forEach((t=>{const e=l(f.shift());0===t.cmd.filter((t=>t===e||"*"===t)).length&&c(e,t.cmd,n),n+=1})),r.optional.forEach((t=>{if(0===f.length)return;const e=l(f.shift());0===t.cmd.filter((t=>t===e||"*"===t)).length&&c(e,t.cmd,n),n+=1}))}catch(t){console.warn(t.stack)}}function l(t){return Array.isArray(t)?"array":null===t?"null":typeof t}function c(t,s,i){throw new e(`Invalid ${a[i]||"manyith"} argument. Expected ${s.join(" or ")} but received ${t}.`)}function f(t){return!!t&&!!t.then&&"function"==typeof t.then}function d(t,e,s,i){s.assert.notStrictEqual(t,e,i)}function u(t,e){e.assert.strictEqual(typeof t,"string")}function p(t){return Object.keys(t)}function g(t={},e=(()=>!0)){const s={};return p(t).forEach((i=>{e(i,t[i])&&(s[i]=t[i])})),s}function m(){return process.versions.electron&&!process.defaultApp?0:1}function y(){return process.argv[m()]}var b=Object.freeze({__proto__:null,hideBin:function(t){return t.slice(m()+1)},getProcessArgvBin:y});function v(t,e,s,i){if("a"===s&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function O(t,e,s,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,s):n?n.value=s:e.set(t,s),s}class w{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,s=!0,i=!1){if(h(" [boolean] [boolean] [boolean]",[t,e,s],arguments.length),Array.isArray(t)){for(let i=0;i{const i=[...s[e]||[],e];return!t.option||!i.includes(t.option)})),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const t=this.frozens.pop();void 0!==t&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter((t=>t.global))}}function C(t,e,s,i){return s.reduce(((t,s)=>{if(s.applyBeforeValidation!==i)return t;if(s.mutates){if(s.applied)return t;s.applied=!0}if(f(t))return t.then((t=>Promise.all([t,s(t,e)]))).then((([t,e])=>Object.assign(t,e)));{const i=s(t,e);return f(i)?i.then((e=>Object.assign(t,e))):Object.assign(t,i)}}),t)}function j(t,e,s=(t=>{throw t})){try{const s="function"==typeof t?t():t;return f(s)?s.then((t=>e(t))):e(s)}catch(t){return s(t)}}const _=/(^\*)|(^\$0)/;class M{constructor(t,e,s,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=t,this.globalMiddleware=s,this.validation=e}addDirectory(t,e,s,i){"boolean"!=typeof(i=i||{}).recurse&&(i.recurse=!1),Array.isArray(i.extensions)||(i.extensions=["js"]);const n="function"==typeof i.visit?i.visit:t=>t;i.visit=(t,e,s)=>{const i=n(t,e,s);if(i){if(this.requireCache.has(e))return i;this.requireCache.add(e),this.addHandler(i)}return i},this.shim.requireDirectory({require:e,filename:s},t,i)}addHandler(t,e,s,i,n,r){let a=[];const h=function(t){return t?t.map((t=>(t.applyBeforeValidation=!1,t))):[]}(n);if(i=i||(()=>{}),Array.isArray(t))if(function(t){return t.every((t=>"string"==typeof t))}(t))[t,...a]=t;else for(const e of t)this.addHandler(e);else{if(function(t){return"object"==typeof t&&!Array.isArray(t)}(t)){let e=Array.isArray(t.command)||"string"==typeof t.command?t.command:this.moduleName(t);return t.aliases&&(e=[].concat(e).concat(t.aliases)),void this.addHandler(e,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated)}if(k(s))return void this.addHandler([t].concat(a),e,s.builder,s.handler,s.middlewares,s.deprecated)}if("string"==typeof t){const n=o(t);a=a.map((t=>o(t).cmd));let l=!1;const c=[n.cmd].concat(a).filter((t=>!_.test(t)||(l=!0,!1)));0===c.length&&l&&c.push("$0"),l&&(n.cmd=c[0],a=c.slice(1),t=t.replace(_,n.cmd)),a.forEach((t=>{this.aliasMap[t]=n.cmd})),!1!==e&&this.usage.command(t,e,l,a,r),this.handlers[n.cmd]={original:t,description:e,handler:i,builder:s||{},middlewares:h,deprecated:r,demanded:n.demanded,optional:n.optional},l&&(this.defaultCommand=this.handlers[n.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,s,i,n,r){const o=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,a=e.getInternalMethods().getContext(),h=a.commands.slice(),l=!t;t&&(a.commands.push(t),a.fullCommands.push(o.original));const c=this.applyBuilderUpdateUsageAndParse(l,o,e,s.aliases,h,i,n,r);return f(c)?c.then((t=>this.applyMiddlewareAndGetResult(l,o,t.innerArgv,a,n,t.aliases,e))):this.applyMiddlewareAndGetResult(l,o,c.innerArgv,a,n,c.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,s,i,n,r,o,a){const h=e.builder;let l=s;if(x(h)){const c=h(s.getInternalMethods().reset(i),a);if(f(c))return c.then((i=>{var a;return l=(a=i)&&"function"==typeof a.getInternalMethods?i:s,this.parseAndUpdateUsage(t,e,l,n,r,o)}))}else(function(t){return"object"==typeof t})(h)&&(l=s.getInternalMethods().reset(i),Object.keys(e.builder).forEach((t=>{l.option(t,h[t])})));return this.parseAndUpdateUsage(t,e,l,n,r,o)}parseAndUpdateUsage(t,e,s,i,n,r){t&&s.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(s)&&s.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,e),e.description);const o=s.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,n,r);return f(o)?o.then((t=>({aliases:s.parsed.aliases,innerArgv:t}))):{aliases:s.parsed.aliases,innerArgv:o}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&0===t.getInternalMethods().getUsageInstance().getUsage().length}usageFromParentCommandsCommandHandler(t,e){const s=_.test(e.original)?e.original.replace(_,"").trim():e.original,i=t.filter((t=>!_.test(t)));return i.push(s),`$0 ${i.join(" ")}`}handleValidationAndGetResult(t,e,s,i,n,r,o,a){if(!r.getInternalMethods().getHasOutput()){const e=r.getInternalMethods().runValidation(n,a,r.parsed.error,t);s=j(s,(t=>(e(t),t)))}if(e.handler&&!r.getInternalMethods().getHasOutput()){r.getInternalMethods().setHasOutput();const i=!!r.getOptions().configuration["populate--"];r.getInternalMethods().postProcess(s,i,!1,!1),s=j(s=C(s,r,o,!1),(t=>{const s=e.handler(t);return f(s)?s.then((()=>t)):t})),t||r.getInternalMethods().getUsageInstance().cacheHelpMessage(),f(s)&&!r.getInternalMethods().hasParseCallback()&&s.catch((t=>{try{r.getInternalMethods().getUsageInstance().fail(null,t)}catch(t){}}))}return t||(i.commands.pop(),i.fullCommands.pop()),s}applyMiddlewareAndGetResult(t,e,s,i,n,r,o){let a={};if(n)return s;o.getInternalMethods().getHasOutput()||(a=this.populatePositionals(e,s,i,o));const h=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),l=C(s,o,h,!0);return f(l)?l.then((s=>this.handleValidationAndGetResult(t,e,s,i,r,o,h,a))):this.handleValidationAndGetResult(t,e,l,i,r,o,h,a)}populatePositionals(t,e,s,i){e._=e._.slice(s.commands.length);const n=t.demanded.slice(0),r=t.optional.slice(0),o={};for(this.validation.positionalCount(n.length,e._.length);n.length;){const t=n.shift();this.populatePositional(t,e,o)}for(;r.length;){const t=r.shift();this.populatePositional(t,e,o)}return e._=s.commands.concat(e._.map((t=>""+t))),this.postProcessPositionals(e,o,this.cmdToParseOptions(t.original),i),o}populatePositional(t,e,s){const i=t.cmd[0];t.variadic?s[i]=e._.splice(0).map(String):e._.length&&(s[i]=[String(e._.shift())])}cmdToParseOptions(t){const e={array:[],default:{},alias:{},demand:{}},s=o(t);return s.demanded.forEach((t=>{const[s,...i]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=i,e.demand[s]=!0})),s.optional.forEach((t=>{const[s,...i]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=i})),e}postProcessPositionals(t,e,s,i){const n=Object.assign({},i.getOptions());n.default=Object.assign(s.default,n.default);for(const t of Object.keys(s.alias))n.alias[t]=(n.alias[t]||[]).concat(s.alias[t]);n.array=n.array.concat(s.array),n.config={};const r=[];if(Object.keys(e).forEach((t=>{e[t].map((e=>{n.configuration["unknown-options-as-args"]&&(n.key[t]=!0),r.push(`--${t}`),r.push(e)}))})),!r.length)return;const o=Object.assign({},n.configuration,{"populate--":!1}),a=this.shim.Parser.detailed(r,Object.assign({},n,{configuration:o}));if(a.error)i.getInternalMethods().getUsageInstance().fail(a.error.message,a.error);else{const s=Object.keys(e);Object.keys(e).forEach((t=>{s.push(...a.aliases[t])})),Object.keys(a.argv).forEach((n=>{s.includes(n)&&(e[n]||(e[n]=a.argv[n]),!this.isInConfigs(i,n)&&!this.isDefaulted(i,n)&&Object.prototype.hasOwnProperty.call(t,n)&&Object.prototype.hasOwnProperty.call(a.argv,n)&&(Array.isArray(t[n])||Array.isArray(a.argv[n]))?t[n]=[].concat(t[n],a.argv[n]):t[n]=a.argv[n])}))}}isDefaulted(t,e){const{default:s}=t.getOptions();return Object.prototype.hasOwnProperty.call(s,e)||Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(e))}isInConfigs(t,e){const{configObjects:s}=t.getOptions();return s.some((t=>Object.prototype.hasOwnProperty.call(t,e)))||s.some((t=>Object.prototype.hasOwnProperty.call(t,this.shim.Parser.camelCase(e))))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){const e=_.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(e,this.defaultCommand.description)}const e=this.defaultCommand.builder;if(x(e))return e(t,!0);k(e)||Object.keys(e).forEach((s=>{t.option(s,e[s])}))}moduleName(t){const e=function(t){if("undefined"==typeof require)return null;for(let e,s=0,i=Object.keys(require.cache);s{const s=e;s._handle&&s.isTTY&&"function"==typeof s._handle.setBlocking&&s._handle.setBlocking(t)}))}function A(t){return"boolean"==typeof t}function P(t,s){const i=s.y18n.__,n={},r=[];n.failFn=function(t){r.push(t)};let o=null,a=null,h=!0;n.showHelpOnFail=function(e=!0,s){const[i,r]="string"==typeof e?[!0,e]:[e,s];return t.getInternalMethods().isGlobalContext()&&(a=r),o=r,h=i,n};let l=!1;n.fail=function(s,i){const c=t.getInternalMethods().getLoggerInstance();if(!r.length){if(t.getExitProcess()&&E(!0),!l){l=!0,h&&(t.showHelp("error"),c.error()),(s||i)&&c.error(s||i);const e=o||a;e&&((s||i)&&c.error(""),c.error(e))}if(i=i||new e(s),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,i);throw i}for(let t=r.length-1;t>=0;--t){const e=r[t];if(A(e)){if(i)throw i;if(s)throw Error(s)}else e(s,i,n)}};let c=[],f=!1;n.usage=(t,e)=>null===t?(f=!0,c=[],n):(f=!1,c.push([t,e||""]),n),n.getUsage=()=>c,n.getUsageDisabled=()=>f,n.getPositionalGroupName=()=>i("Positionals:");let d=[];n.example=(t,e)=>{d.push([t,e||""])};let u=[];n.command=function(t,e,s,i,n=!1){s&&(u=u.map((t=>(t[2]=!1,t)))),u.push([t,e||"",s,i,n])},n.getCommands=()=>u;let p={};n.describe=function(t,e){Array.isArray(t)?t.forEach((t=>{n.describe(t,e)})):"object"==typeof t?Object.keys(t).forEach((e=>{n.describe(e,t[e])})):p[t]=e},n.getDescriptions=()=>p;let m=[];n.epilog=t=>{m.push(t)};let y,b=!1;n.wrap=t=>{b=!0,y=t},n.getWrap=()=>s.getEnv("YARGS_DISABLE_WRAP")?null:(b||(y=function(){const t=80;return s.process.stdColumns?Math.min(t,s.process.stdColumns):t}(),b=!0),y);const v="__yargsString__:";function O(t,e,i){let n=0;return Array.isArray(t)||(t=Object.values(t).map((t=>[t]))),t.forEach((t=>{n=Math.max(s.stringWidth(i?`${i} ${I(t[0])}`:I(t[0]))+$(t[0]),n)})),e&&(n=Math.min(n,parseInt((.5*e).toString(),10))),n}let w;function C(e){return t.getOptions().hiddenOptions.indexOf(e)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}function j(t,e){let s=`[${i("default:")} `;if(void 0===t&&!e)return null;if(e)s+=e;else switch(typeof t){case"string":s+=`"${t}"`;break;case"object":s+=JSON.stringify(t);break;default:s+=t}return`${s}]`}n.deferY18nLookup=t=>v+t,n.help=function(){if(w)return w;!function(){const e=t.getDemandedOptions(),s=t.getOptions();(Object.keys(s.alias)||[]).forEach((i=>{s.alias[i].forEach((r=>{p[r]&&n.describe(i,p[r]),r in e&&t.demandOption(i,e[r]),s.boolean.includes(r)&&t.boolean(i),s.count.includes(r)&&t.count(i),s.string.includes(r)&&t.string(i),s.normalize.includes(r)&&t.normalize(i),s.array.includes(r)&&t.array(i),s.number.includes(r)&&t.number(i)}))}))}();const e=t.customScriptName?t.$0:s.path.basename(t.$0),r=t.getDemandedOptions(),o=t.getDemandedCommands(),a=t.getDeprecatedOptions(),h=t.getGroups(),l=t.getOptions();let g=[];g=g.concat(Object.keys(p)),g=g.concat(Object.keys(r)),g=g.concat(Object.keys(o)),g=g.concat(Object.keys(l.default)),g=g.filter(C),g=Object.keys(g.reduce(((t,e)=>("_"!==e&&(t[e]=!0),t)),{}));const y=n.getWrap(),b=s.cliui({width:y,wrap:!!y});if(!f)if(c.length)c.forEach((t=>{b.div({text:`${t[0].replace(/\$0/g,e)}`}),t[1]&&b.div({text:`${t[1]}`,padding:[1,0,0,0]})})),b.div();else if(u.length){let t=null;t=o._?`${e} <${i("command")}>\n`:`${e} [${i("command")}]\n`,b.div(`${t}`)}if(u.length>1||1===u.length&&!u[0][2]){b.div(i("Commands:"));const s=t.getInternalMethods().getContext(),n=s.commands.length?`${s.commands.join(" ")} `:"";!0===t.getInternalMethods().getParserConfiguration()["sort-commands"]&&(u=u.sort(((t,e)=>t[0].localeCompare(e[0]))));const r=e?`${e} `:"";u.forEach((t=>{const s=`${r}${n}${t[0].replace(/^\$0 ?/,"")}`;b.span({text:s,padding:[0,2,0,2],width:O(u,y,`${e}${n}`)+4},{text:t[1]});const o=[];t[2]&&o.push(`[${i("default")}]`),t[3]&&t[3].length&&o.push(`[${i("aliases:")} ${t[3].join(", ")}]`),t[4]&&("string"==typeof t[4]?o.push(`[${i("deprecated: %s",t[4])}]`):o.push(`[${i("deprecated")}]`)),o.length?b.div({text:o.join(" "),padding:[0,0,0,2],align:"right"}):b.div()})),b.div()}const _=(Object.keys(l.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);g=g.filter((e=>!t.parsed.newAliases[e]&&_.every((t=>-1===(l.alias[t]||[]).indexOf(e)))));const M=i("Options:");h[M]||(h[M]=[]),function(t,e,s,i){let n=[],r=null;Object.keys(s).forEach((t=>{n=n.concat(s[t])})),t.forEach((t=>{r=[t].concat(e[t]),r.some((t=>-1!==n.indexOf(t)))||s[i].push(t)}))}(g,l.alias,h,M);const k=t=>/^--/.test(I(t)),x=Object.keys(h).filter((t=>h[t].length>0)).map((t=>({groupName:t,normalizedKeys:h[t].filter(C).map((t=>{if(_.includes(t))return t;for(let e,s=0;void 0!==(e=_[s]);s++)if((l.alias[e]||[]).includes(t))return e;return t}))}))).filter((({normalizedKeys:t})=>t.length>0)).map((({groupName:t,normalizedKeys:e})=>{const s=e.reduce(((e,s)=>(e[s]=[s].concat(l.alias[s]||[]).map((e=>t===n.getPositionalGroupName()?e:(/^[0-9]$/.test(e)?l.boolean.includes(s)?"-":"--":e.length>1?"--":"-")+e)).sort(((t,e)=>k(t)===k(e)?0:k(t)?1:-1)).join(", "),e)),{});return{groupName:t,normalizedKeys:e,switches:s}}));if(x.filter((({groupName:t})=>t!==n.getPositionalGroupName())).some((({normalizedKeys:t,switches:e})=>!t.every((t=>k(e[t])))))&&x.filter((({groupName:t})=>t!==n.getPositionalGroupName())).forEach((({normalizedKeys:t,switches:e})=>{t.forEach((t=>{var s,i;k(e[t])&&(e[t]=(s=e[t],i="-x, ".length,S(s)?{text:s.text,indentation:s.indentation+i}:{text:s,indentation:i}))}))})),x.forEach((({groupName:t,normalizedKeys:e,switches:s})=>{b.div(t),e.forEach((t=>{const e=s[t];let o=p[t]||"",h=null;o.includes(v)&&(o=i(o.substring(v.length))),l.boolean.includes(t)&&(h=`[${i("boolean")}]`),l.count.includes(t)&&(h=`[${i("count")}]`),l.string.includes(t)&&(h=`[${i("string")}]`),l.normalize.includes(t)&&(h=`[${i("string")}]`),l.array.includes(t)&&(h=`[${i("array")}]`),l.number.includes(t)&&(h=`[${i("number")}]`);const c=[t in a?(f=a[t],"string"==typeof f?`[${i("deprecated: %s",f)}]`:`[${i("deprecated")}]`):null,h,t in r?`[${i("required")}]`:null,l.choices&&l.choices[t]?`[${i("choices:")} ${n.stringifiedValues(l.choices[t])}]`:null,j(l.default[t],l.defaultDescription[t])].filter(Boolean).join(" ");var f;b.span({text:I(e),padding:[0,2,0,2+$(e)],width:O(s,y)+4},o),c?b.div({text:c,padding:[0,0,0,2],align:"right"}):b.div()})),b.div()})),d.length&&(b.div(i("Examples:")),d.forEach((t=>{t[0]=t[0].replace(/\$0/g,e)})),d.forEach((t=>{""===t[1]?b.div({text:t[0],padding:[0,2,0,2]}):b.div({text:t[0],padding:[0,2,0,2],width:O(d,y)+4},{text:t[1]})})),b.div()),m.length>0){const t=m.map((t=>t.replace(/\$0/g,e))).join("\n");b.div(`${t}\n`)}return b.toString().replace(/\s*$/,"")},n.cacheHelpMessage=function(){w=this.help()},n.clearCachedHelpMessage=function(){w=void 0},n.hasCachedHelpMessage=function(){return!!w},n.showHelp=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(n.help())},n.functionDescription=t=>["(",t.name?s.Parser.decamelize(t.name,"-"):i("generated-value"),")"].join(""),n.stringifiedValues=function(t,e){let s="";const i=e||", ",n=[].concat(t);return t&&n.length?(n.forEach((t=>{s.length&&(s+=i),s+=JSON.stringify(t)})),s):s};let _=null;n.version=t=>{_=t},n.showVersion=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(_)},n.reset=function(t){return o=null,l=!1,c=[],f=!1,m=[],d=[],u=[],p=g(p,(e=>!t[e])),n};const M=[];return n.freeze=function(){M.push({failMessage:o,failureOutput:l,usages:c,usageDisabled:f,epilogs:m,examples:d,commands:u,descriptions:p})},n.unfreeze=function(t=!1){const e=M.pop();e&&(t?(p={...e.descriptions,...p},u=[...e.commands,...u],c=[...e.usages,...c],d=[...e.examples,...d],m=[...e.epilogs,...m]):({failMessage:o,failureOutput:l,usages:c,usageDisabled:f,epilogs:m,examples:d,commands:u,descriptions:p}=e))},n}function S(t){return"object"==typeof t}function $(t){return S(t)?t.indentation:0}function I(t){return S(t)?t.text:t}class D{constructor(t,e,s,i){var n,r,o;this.yargs=t,this.usage=e,this.command=s,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=null!==(o=(null===(n=this.shim.getEnv("SHELL"))||void 0===n?void 0:n.includes("zsh"))||(null===(r=this.shim.getEnv("ZSH_NAME"))||void 0===r?void 0:r.includes("zsh")))&&void 0!==o&&o}defaultCompletion(t,e,s,i){const n=this.command.getCommandHandlers();for(let e=0,s=t.length;e{const i=o(s[0]).cmd;if(-1===e.indexOf(i))if(this.zshShell){const e=s[1]||"";t.push(i.replace(/:/g,"\\:")+":"+e)}else t.push(i)}))}optionCompletions(t,e,s,i){if((i.match(/^-/)||""===i&&0===t.length)&&!this.previousArgHasChoices(e)){const s=this.yargs.getOptions(),n=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach((r=>{const o=!!s.configuration["boolean-negation"]&&s.boolean.includes(r);n.includes(r)||s.hiddenOptions.includes(r)||this.argsContainKey(e,r,o)||(this.completeOptionKey(r,t,i),o&&s.default[r]&&this.completeOptionKey(`no-${r}`,t,i))}))}}choicesFromOptionsCompletions(t,e,s,i){if(this.previousArgHasChoices(e)){const s=this.getPreviousArgChoices(e);s&&s.length>0&&t.push(...s.map((t=>t.replace(/:/g,"\\:"))))}}choicesFromPositionalsCompletions(t,e,s,i){if(""===i&&t.length>0&&this.previousArgHasChoices(e))return;const n=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],r=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),o=n[s._.length-r-1];if(!o)return;const a=this.yargs.getOptions().choices[o]||[];for(const e of a)e.startsWith(i)&&t.push(e.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],s="";if(!e.startsWith("-")&&t.length>1&&(s=e,e=t[t.length-2]),!e.startsWith("-"))return;const i=e.replace(/^-+/,""),n=this.yargs.getOptions(),r=[i,...this.yargs.getAliases()[i]||[]];let o;for(const t of r)if(Object.prototype.hasOwnProperty.call(n.key,t)&&Array.isArray(n.choices[t])){o=n.choices[t];break}return o?o.filter((t=>!s||t.startsWith(s))):void 0}previousArgHasChoices(t){const e=this.getPreviousArgChoices(t);return void 0!==e&&e.length>0}argsContainKey(t,e,s){const i=e=>-1!==t.indexOf((/^[^0-9]$/.test(e)?"-":"--")+e);if(i(e))return!0;if(s&&i(`no-${e}`))return!0;if(this.aliases)for(const t of this.aliases[e])if(i(t))return!0;return!1}completeOptionKey(t,e,s){const i=this.usage.getDescriptions(),n=!/^--/.test(s)&&(t=>/^[^0-9]$/.test(t))(t)?"-":"--";if(this.zshShell){const s=i[t]||"";e.push(n+`${t.replace(/:/g,"\\:")}:${s.replace("__yargsString__:","")}`)}else e.push(n+t)}customCompletion(t,e,s,i){if(d(this.customCompletionFunction,null,this.shim),this.customCompletionFunction.length<3){const t=this.customCompletionFunction(s,e);return f(t)?t.then((t=>{this.shim.process.nextTick((()=>{i(null,t)}))})).catch((t=>{this.shim.process.nextTick((()=>{i(t,void 0)}))})):i(null,t)}return function(t){return t.length>3}(this.customCompletionFunction)?this.customCompletionFunction(s,e,((n=i)=>this.defaultCompletion(t,e,s,n)),(t=>{i(null,t)})):this.customCompletionFunction(s,e,(t=>{i(null,t)}))}getCompletion(t,e){const s=t.length?t[t.length-1]:"",i=this.yargs.parse(t,!0),n=this.customCompletionFunction?i=>this.customCompletion(t,i,s,e):i=>this.defaultCompletion(t,i,s,e);return f(i)?i.then(n):n(i)}generateCompletionScript(t,e){let s=this.zshShell?'#compdef {{app_name}}\n###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$\'\n\' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "${words[@]}"))\n IFS=$si\n _describe \'values\' reply\n}\ncompdef _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n':'###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word="${COMP_WORDS[COMP_CWORD]}"\n args=("${COMP_WORDS[@]}")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions "${args[@]}")\n\n COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n';const i=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),s=s.replace(/{{app_name}}/g,i),s=s.replace(/{{completion_command}}/g,e),s.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}}function N(t,e){if(0===t.length)return e.length;if(0===e.length)return t.length;const s=[];let i,n;for(i=0;i<=e.length;i++)s[i]=[i];for(n=0;n<=t.length;n++)s[0][n]=n;for(i=1;i<=e.length;i++)for(n=1;n<=t.length;n++)e.charAt(i-1)===t.charAt(n-1)?s[i][n]=s[i-1][n-1]:i>1&&n>1&&e.charAt(i-2)===t.charAt(n-1)&&e.charAt(i-1)===t.charAt(n-2)?s[i][n]=s[i-2][n-2]+1:s[i][n]=Math.min(s[i-1][n-1]+1,Math.min(s[i][n-1]+1,s[i-1][n]+1));return s[e.length][t.length]}const H=["$0","--","_"];var W,z,q,F,U,L,V,G,R,T,B,K,Y,J,Z,X,Q,tt,et,st,it,nt,rt,ot,at,ht,lt,ct,ft,dt,ut,pt,gt,mt;const yt=Symbol("copyDoubleDash"),bt=Symbol("copyDoubleDash"),vt=Symbol("deleteFromParserHintObject"),Ot=Symbol("emitWarning"),wt=Symbol("freeze"),Ct=Symbol("getDollarZero"),jt=Symbol("getParserConfiguration"),_t=Symbol("guessLocale"),Mt=Symbol("guessVersion"),kt=Symbol("parsePositionalNumbers"),xt=Symbol("pkgUp"),Et=Symbol("populateParserHintArray"),At=Symbol("populateParserHintSingleValueDictionary"),Pt=Symbol("populateParserHintArrayDictionary"),St=Symbol("populateParserHintDictionary"),$t=Symbol("sanitizeKey"),It=Symbol("setKey"),Dt=Symbol("unfreeze"),Nt=Symbol("validateAsync"),Ht=Symbol("getCommandInstance"),Wt=Symbol("getContext"),zt=Symbol("getHasOutput"),qt=Symbol("getLoggerInstance"),Ft=Symbol("getParseContext"),Ut=Symbol("getUsageInstance"),Lt=Symbol("getValidationInstance"),Vt=Symbol("hasParseCallback"),Gt=Symbol("isGlobalContext"),Rt=Symbol("postProcess"),Tt=Symbol("rebase"),Bt=Symbol("reset"),Kt=Symbol("runYargsParserAndExecuteCommands"),Yt=Symbol("runValidation"),Jt=Symbol("setHasOutput"),Zt=Symbol("kTrackManuallySetKeys");class Xt{constructor(t=[],e,s,i){this.customScriptName=!1,this.parsed=!1,W.set(this,void 0),z.set(this,void 0),q.set(this,{commands:[],fullCommands:[]}),F.set(this,null),U.set(this,null),L.set(this,"show-hidden"),V.set(this,null),G.set(this,!0),R.set(this,{}),T.set(this,!0),B.set(this,[]),K.set(this,void 0),Y.set(this,{}),J.set(this,!1),Z.set(this,null),X.set(this,!0),Q.set(this,void 0),tt.set(this,""),et.set(this,void 0),st.set(this,void 0),it.set(this,{}),nt.set(this,null),rt.set(this,null),ot.set(this,{}),at.set(this,{}),ht.set(this,void 0),lt.set(this,!1),ct.set(this,void 0),ft.set(this,!1),dt.set(this,!1),ut.set(this,!1),pt.set(this,void 0),gt.set(this,null),mt.set(this,void 0),O(this,ct,i,"f"),O(this,ht,t,"f"),O(this,z,e,"f"),O(this,st,s,"f"),O(this,K,new w(this),"f"),this.$0=this[Ct](),this[Bt](),O(this,W,v(this,W,"f"),"f"),O(this,pt,v(this,pt,"f"),"f"),O(this,mt,v(this,mt,"f"),"f"),O(this,et,v(this,et,"f"),"f"),v(this,et,"f").showHiddenOpt=v(this,L,"f"),O(this,Q,this[bt](),"f")}addHelpOpt(t,e){return h("[string|boolean] [string]",[t,e],arguments.length),v(this,Z,"f")&&(this[vt](v(this,Z,"f")),O(this,Z,null,"f")),!1===t&&void 0===e||(O(this,Z,"string"==typeof t?t:"help","f"),this.boolean(v(this,Z,"f")),this.describe(v(this,Z,"f"),e||v(this,pt,"f").deferY18nLookup("Show help"))),this}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(h("[string|boolean] [string]",[t,e],arguments.length),!1===t&&void 0===e)return this;const s="string"==typeof t?t:v(this,L,"f");return this.boolean(s),this.describe(s,e||v(this,pt,"f").deferY18nLookup("Show hidden options")),v(this,et,"f").showHiddenOpt=s,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return h(" [string|array]",[t,e],arguments.length),this[Pt](this.alias.bind(this),"alias",t,e),this}array(t){return h("",[t],arguments.length),this[Et]("array",t),this[Zt](t),this}boolean(t){return h("",[t],arguments.length),this[Et]("boolean",t),this[Zt](t),this}check(t,e){return h(" [boolean]",[t,e],arguments.length),this.middleware(((e,s)=>j((()=>t(e,s.getOptions())),(s=>(s?("string"==typeof s||s instanceof Error)&&v(this,pt,"f").fail(s.toString(),s):v(this,pt,"f").fail(v(this,ct,"f").y18n.__("Argument check failed: %s",t.toString())),e)),(t=>(v(this,pt,"f").fail(t.message?t.message:t.toString(),t),e)))),!1,e),this}choices(t,e){return h(" [string|array]",[t,e],arguments.length),this[Pt](this.choices.bind(this),"choices",t,e),this}coerce(t,s){if(h(" [function]",[t,s],arguments.length),Array.isArray(t)){if(!s)throw new e("coerce callback must be provided");for(const e of t)this.coerce(e,s);return this}if("object"==typeof t){for(const e of Object.keys(t))this.coerce(e,t[e]);return this}if(!s)throw new e("coerce callback must be provided");return v(this,et,"f").key[t]=!0,v(this,K,"f").addCoerceMiddleware(((i,n)=>{let r;return Object.prototype.hasOwnProperty.call(i,t)?j((()=>(r=n.getAliases(),s(i[t]))),(e=>{i[t]=e;const s=n.getInternalMethods().getParserConfiguration()["strip-aliased"];if(r[t]&&!0!==s)for(const s of r[t])i[s]=e;return i}),(t=>{throw new e(t.message)})):i}),t),this}conflicts(t,e){return h(" [string|array]",[t,e],arguments.length),v(this,mt,"f").conflicts(t,e),this}config(t="config",e,s){return h("[object|string] [string|function] [function]",[t,e,s],arguments.length),"object"!=typeof t||Array.isArray(t)?("function"==typeof e&&(s=e,e=void 0),this.describe(t,e||v(this,pt,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach((t=>{v(this,et,"f").config[t]=s||!0})),this):(t=n(t,v(this,z,"f"),this[jt]()["deep-merge-config"]||!1,v(this,ct,"f")),v(this,et,"f").configObjects=(v(this,et,"f").configObjects||[]).concat(t),this)}completion(t,e,s){return h("[string] [string|boolean|function] [function]",[t,e,s],arguments.length),"function"==typeof e&&(s=e,e=void 0),O(this,U,t||v(this,U,"f")||"completion","f"),e||!1===e||(e="generate completion script"),this.command(v(this,U,"f"),e),s&&v(this,F,"f").registerFunction(s),this}command(t,e,s,i,n,r){return h(" [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,s,i,n,r],arguments.length),v(this,W,"f").addHandler(t,e,s,i,n,r),this}commands(t,e,s,i,n,r){return this.command(t,e,s,i,n,r)}commandDir(t,e){h(" [object]",[t,e],arguments.length);const s=v(this,st,"f")||v(this,ct,"f").require;return v(this,W,"f").addDirectory(t,s,v(this,ct,"f").getCallerFile(),e),this}count(t){return h("",[t],arguments.length),this[Et]("count",t),this[Zt](t),this}default(t,e,s){return h(" [*] [string]",[t,e,s],arguments.length),s&&(u(t,v(this,ct,"f")),v(this,et,"f").defaultDescription[t]=s),"function"==typeof e&&(u(t,v(this,ct,"f")),v(this,et,"f").defaultDescription[t]||(v(this,et,"f").defaultDescription[t]=v(this,pt,"f").functionDescription(e)),e=e.call()),this[At](this.default.bind(this),"default",t,e),this}defaults(t,e,s){return this.default(t,e,s)}demandCommand(t=1,e,s,i){return h("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,s,i],arguments.length),"number"!=typeof e&&(s=e,e=1/0),this.global("_",!1),v(this,et,"f").demandedCommands._={min:t,max:e,minMsg:s,maxMsg:i},this}demand(t,e,s){return Array.isArray(e)?(e.forEach((t=>{d(s,!0,v(this,ct,"f")),this.demandOption(t,s)})),e=1/0):"number"!=typeof e&&(s=e,e=1/0),"number"==typeof t?(d(s,!0,v(this,ct,"f")),this.demandCommand(t,e,s,s)):Array.isArray(t)?t.forEach((t=>{d(s,!0,v(this,ct,"f")),this.demandOption(t,s)})):"string"==typeof s?this.demandOption(t,s):!0!==s&&void 0!==s||this.demandOption(t),this}demandOption(t,e){return h(" [string]",[t,e],arguments.length),this[At](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return h(" [string|boolean]",[t,e],arguments.length),v(this,et,"f").deprecatedOptions[t]=e,this}describe(t,e){return h(" [string]",[t,e],arguments.length),this[It](t,!0),v(this,pt,"f").describe(t,e),this}detectLocale(t){return h("",[t],arguments.length),O(this,G,t,"f"),this}env(t){return h("[string|boolean]",[t],arguments.length),!1===t?delete v(this,et,"f").envPrefix:v(this,et,"f").envPrefix=t||"",this}epilogue(t){return h("",[t],arguments.length),v(this,pt,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return h(" [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach((t=>this.example(...t))):v(this,pt,"f").example(t,e),this}exit(t,e){O(this,J,!0,"f"),O(this,V,e,"f"),v(this,T,"f")&&v(this,ct,"f").process.exit(t)}exitProcess(t=!0){return h("[boolean]",[t],arguments.length),O(this,T,t,"f"),this}fail(t){if(h("",[t],arguments.length),"boolean"==typeof t&&!1!==t)throw new e("Invalid first argument. Expected function or boolean 'false'");return v(this,pt,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return h(" [function]",[t,e],arguments.length),e?v(this,F,"f").getCompletion(t,e):new Promise(((e,s)=>{v(this,F,"f").getCompletion(t,((t,i)=>{t?s(t):e(i)}))}))}getDemandedOptions(){return h([],0),v(this,et,"f").demandedOptions}getDemandedCommands(){return h([],0),v(this,et,"f").demandedCommands}getDeprecatedOptions(){return h([],0),v(this,et,"f").deprecatedOptions}getDetectLocale(){return v(this,G,"f")}getExitProcess(){return v(this,T,"f")}getGroups(){return Object.assign({},v(this,Y,"f"),v(this,at,"f"))}getHelp(){if(O(this,J,!0,"f"),!v(this,pt,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[Kt](v(this,ht,"f"),void 0,void 0,0,!0);if(f(t))return t.then((()=>v(this,pt,"f").help()))}const t=v(this,W,"f").runDefaultBuilderOn(this);if(f(t))return t.then((()=>v(this,pt,"f").help()))}return Promise.resolve(v(this,pt,"f").help())}getOptions(){return v(this,et,"f")}getStrict(){return v(this,ft,"f")}getStrictCommands(){return v(this,dt,"f")}getStrictOptions(){return v(this,ut,"f")}global(t,e){return h(" [boolean]",[t,e],arguments.length),t=[].concat(t),!1!==e?v(this,et,"f").local=v(this,et,"f").local.filter((e=>-1===t.indexOf(e))):t.forEach((t=>{v(this,et,"f").local.includes(t)||v(this,et,"f").local.push(t)})),this}group(t,e){h(" ",[t,e],arguments.length);const s=v(this,at,"f")[e]||v(this,Y,"f")[e];v(this,at,"f")[e]&&delete v(this,at,"f")[e];const i={};return v(this,Y,"f")[e]=(s||[]).concat(t).filter((t=>!i[t]&&(i[t]=!0))),this}hide(t){return h("",[t],arguments.length),v(this,et,"f").hiddenOptions.push(t),this}implies(t,e){return h(" [number|string|array]",[t,e],arguments.length),v(this,mt,"f").implies(t,e),this}locale(t){return h("[string]",[t],arguments.length),void 0===t?(this[_t](),v(this,ct,"f").y18n.getLocale()):(O(this,G,!1,"f"),v(this,ct,"f").y18n.setLocale(t),this)}middleware(t,e,s){return v(this,K,"f").addMiddleware(t,!!e,s)}nargs(t,e){return h(" [number]",[t,e],arguments.length),this[At](this.nargs.bind(this),"narg",t,e),this}normalize(t){return h("",[t],arguments.length),this[Et]("normalize",t),this}number(t){return h("",[t],arguments.length),this[Et]("number",t),this[Zt](t),this}option(t,e){if(h(" [object]",[t,e],arguments.length),"object"==typeof t)Object.keys(t).forEach((e=>{this.options(e,t[e])}));else{"object"!=typeof e&&(e={}),this[Zt](t),!v(this,gt,"f")||"version"!==t&&"version"!==(null==e?void 0:e.alias)||this[Ot](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join("\n"),void 0,"versionWarning"),v(this,et,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);const s=e.deprecate||e.deprecated;s&&this.deprecateOption(t,s);const i=e.demand||e.required||e.require;i&&this.demand(t,i),e.demandOption&&this.demandOption(t,"string"==typeof e.demandOption?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),void 0!==e.implies&&this.implies(t,e.implies),void 0!==e.nargs&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||"boolean"===e.type)&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||"array"===e.type)&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||"number"===e.type)&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||"string"===e.type)&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||"count"===e.type)&&this.count(t),"boolean"==typeof e.global&&this.global(t,e.global),e.defaultDescription&&(v(this,et,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);const n=e.describe||e.description||e.desc,r=v(this,pt,"f").getDescriptions();Object.prototype.hasOwnProperty.call(r,t)&&"string"!=typeof n||this.describe(t,n),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,s){h("[string|array] [function|boolean|object] [function]",[t,e,s],arguments.length),this[wt](),void 0===t&&(t=v(this,ht,"f")),"object"==typeof e&&(O(this,rt,e,"f"),e=s),"function"==typeof e&&(O(this,nt,e,"f"),e=!1),e||O(this,ht,t,"f"),v(this,nt,"f")&&O(this,T,!1,"f");const i=this[Kt](t,!!e),n=this.parsed;return v(this,F,"f").setParsed(this.parsed),f(i)?i.then((t=>(v(this,nt,"f")&&v(this,nt,"f").call(this,v(this,V,"f"),t,v(this,tt,"f")),t))).catch((t=>{throw v(this,nt,"f")&&v(this,nt,"f")(t,this.parsed.argv,v(this,tt,"f")),t})).finally((()=>{this[Dt](),this.parsed=n})):(v(this,nt,"f")&&v(this,nt,"f").call(this,v(this,V,"f"),i,v(this,tt,"f")),this[Dt](),this.parsed=n,i)}parseAsync(t,e,s){const i=this.parse(t,e,s);return f(i)?i:Promise.resolve(i)}parseSync(t,s,i){const n=this.parse(t,s,i);if(f(n))throw new e(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return n}parserConfiguration(t){return h("",[t],arguments.length),O(this,it,t,"f"),this}pkgConf(t,e){h(" [string]",[t,e],arguments.length);let s=null;const i=this[xt](e||v(this,z,"f"));return i[t]&&"object"==typeof i[t]&&(s=n(i[t],e||v(this,z,"f"),this[jt]()["deep-merge-config"]||!1,v(this,ct,"f")),v(this,et,"f").configObjects=(v(this,et,"f").configObjects||[]).concat(s)),this}positional(t,e){h(" ",[t,e],arguments.length);const s=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=g(e,((t,e)=>!("type"===t&&!["string","number","boolean"].includes(e))&&s.includes(t)));const i=v(this,q,"f").fullCommands[v(this,q,"f").fullCommands.length-1],n=i?v(this,W,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return p(n).forEach((s=>{const i=n[s];Array.isArray(i)?-1!==i.indexOf(t)&&(e[s]=!0):i[t]&&!(s in e)&&(e[s]=i[t])})),this.group(t,v(this,pt,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return h("[boolean]",[t],arguments.length),O(this,lt,t,"f"),this}required(t,e,s){return this.demand(t,e,s)}require(t,e,s){return this.demand(t,e,s)}requiresArg(t){return h(" [number]",[t],arguments.length),"string"==typeof t&&v(this,et,"f").narg[t]||this[At](this.requiresArg.bind(this),"narg",t,NaN),this}showCompletionScript(t,e){return h("[string] [string]",[t,e],arguments.length),t=t||this.$0,v(this,Q,"f").log(v(this,F,"f").generateCompletionScript(t,e||v(this,U,"f")||"completion")),this}showHelp(t){if(h("[string|function]",[t],arguments.length),O(this,J,!0,"f"),!v(this,pt,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[Kt](v(this,ht,"f"),void 0,void 0,0,!0);if(f(e))return e.then((()=>{v(this,pt,"f").showHelp(t)})),this}const e=v(this,W,"f").runDefaultBuilderOn(this);if(f(e))return e.then((()=>{v(this,pt,"f").showHelp(t)})),this}return v(this,pt,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return h("[boolean|string] [string]",[t,e],arguments.length),v(this,pt,"f").showHelpOnFail(t,e),this}showVersion(t){return h("[string|function]",[t],arguments.length),v(this,pt,"f").showVersion(t),this}skipValidation(t){return h("",[t],arguments.length),this[Et]("skipValidation",t),this}strict(t){return h("[boolean]",[t],arguments.length),O(this,ft,!1!==t,"f"),this}strictCommands(t){return h("[boolean]",[t],arguments.length),O(this,dt,!1!==t,"f"),this}strictOptions(t){return h("[boolean]",[t],arguments.length),O(this,ut,!1!==t,"f"),this}string(t){return h("",[t],arguments.length),this[Et]("string",t),this[Zt](t),this}terminalWidth(){return h([],0),v(this,ct,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return h("",[t],arguments.length),O(this,G,!1,"f"),v(this,ct,"f").y18n.updateLocale(t),this}usage(t,s,i,n){if(h(" [string|boolean] [function|object] [function]",[t,s,i,n],arguments.length),void 0!==s){if(d(t,null,v(this,ct,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,s,i,n);throw new e(".usage() description must start with $0 if being used as alias for .command()")}return v(this,pt,"f").usage(t),this}version(t,e,s){const i="version";if(h("[boolean|string] [string] [string]",[t,e,s],arguments.length),v(this,gt,"f")&&(this[vt](v(this,gt,"f")),v(this,pt,"f").version(void 0),O(this,gt,null,"f")),0===arguments.length)s=this[Mt](),t=i;else if(1===arguments.length){if(!1===t)return this;s=t,t=i}else 2===arguments.length&&(s=e,e=void 0);return O(this,gt,"string"==typeof t?t:i,"f"),e=e||v(this,pt,"f").deferY18nLookup("Show version number"),v(this,pt,"f").version(s||void 0),this.boolean(v(this,gt,"f")),this.describe(v(this,gt,"f"),e),this}wrap(t){return h("",[t],arguments.length),v(this,pt,"f").wrap(t),this}[(W=new WeakMap,z=new WeakMap,q=new WeakMap,F=new WeakMap,U=new WeakMap,L=new WeakMap,V=new WeakMap,G=new WeakMap,R=new WeakMap,T=new WeakMap,B=new WeakMap,K=new WeakMap,Y=new WeakMap,J=new WeakMap,Z=new WeakMap,X=new WeakMap,Q=new WeakMap,tt=new WeakMap,et=new WeakMap,st=new WeakMap,it=new WeakMap,nt=new WeakMap,rt=new WeakMap,ot=new WeakMap,at=new WeakMap,ht=new WeakMap,lt=new WeakMap,ct=new WeakMap,ft=new WeakMap,dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,gt=new WeakMap,mt=new WeakMap,yt)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch(t){}return t}[bt](){return{log:(...t)=>{this[Vt]()||console.log(...t),O(this,J,!0,"f"),v(this,tt,"f").length&&O(this,tt,v(this,tt,"f")+"\n","f"),O(this,tt,v(this,tt,"f")+t.join(" "),"f")},error:(...t)=>{this[Vt]()||console.error(...t),O(this,J,!0,"f"),v(this,tt,"f").length&&O(this,tt,v(this,tt,"f")+"\n","f"),O(this,tt,v(this,tt,"f")+t.join(" "),"f")}}}[vt](t){p(v(this,et,"f")).forEach((e=>{if("configObjects"===e)return;const s=v(this,et,"f")[e];Array.isArray(s)?s.includes(t)&&s.splice(s.indexOf(t),1):"object"==typeof s&&delete s[t]})),delete v(this,pt,"f").getDescriptions()[t]}[Ot](t,e,s){v(this,R,"f")[s]||(v(this,ct,"f").process.emitWarning(t,e),v(this,R,"f")[s]=!0)}[wt](){v(this,B,"f").push({options:v(this,et,"f"),configObjects:v(this,et,"f").configObjects.slice(0),exitProcess:v(this,T,"f"),groups:v(this,Y,"f"),strict:v(this,ft,"f"),strictCommands:v(this,dt,"f"),strictOptions:v(this,ut,"f"),completionCommand:v(this,U,"f"),output:v(this,tt,"f"),exitError:v(this,V,"f"),hasOutput:v(this,J,"f"),parsed:this.parsed,parseFn:v(this,nt,"f"),parseContext:v(this,rt,"f")}),v(this,pt,"f").freeze(),v(this,mt,"f").freeze(),v(this,W,"f").freeze(),v(this,K,"f").freeze()}[Ct](){let t,e="";return t=/\b(node|iojs|electron)(\.exe)?$/.test(v(this,ct,"f").process.argv()[0])?v(this,ct,"f").process.argv().slice(1,2):v(this,ct,"f").process.argv().slice(0,1),e=t.map((t=>{const e=this[Tt](v(this,z,"f"),t);return t.match(/^(\/|([a-zA-Z]:)?\\)/)&&e.lengthe.includes("package.json")?"package.json":void 0));d(i,void 0,v(this,ct,"f")),s=JSON.parse(v(this,ct,"f").readFileSync(i,"utf8"))}catch(t){}return v(this,ot,"f")[e]=s||{},v(this,ot,"f")[e]}[Et](t,e){(e=[].concat(e)).forEach((e=>{e=this[$t](e),v(this,et,"f")[t].push(e)}))}[At](t,e,s,i){this[St](t,e,s,i,((t,e,s)=>{v(this,et,"f")[t][e]=s}))}[Pt](t,e,s,i){this[St](t,e,s,i,((t,e,s)=>{v(this,et,"f")[t][e]=(v(this,et,"f")[t][e]||[]).concat(s)}))}[St](t,e,s,i,n){if(Array.isArray(s))s.forEach((e=>{t(e,i)}));else if((t=>"object"==typeof t)(s))for(const e of p(s))t(e,s[e]);else n(e,this[$t](s),i)}[$t](t){return"__proto__"===t?"___proto___":t}[It](t,e){return this[At](this[It].bind(this),"key",t,e),this}[Dt](){var t,e,s,i,n,r,o,a,h,l,c,f;const u=v(this,B,"f").pop();let p;d(u,void 0,v(this,ct,"f")),t=this,e=this,s=this,i=this,n=this,r=this,o=this,a=this,h=this,l=this,c=this,f=this,({options:{set value(e){O(t,et,e,"f")}}.value,configObjects:p,exitProcess:{set value(t){O(e,T,t,"f")}}.value,groups:{set value(t){O(s,Y,t,"f")}}.value,output:{set value(t){O(i,tt,t,"f")}}.value,exitError:{set value(t){O(n,V,t,"f")}}.value,hasOutput:{set value(t){O(r,J,t,"f")}}.value,parsed:this.parsed,strict:{set value(t){O(o,ft,t,"f")}}.value,strictCommands:{set value(t){O(a,dt,t,"f")}}.value,strictOptions:{set value(t){O(h,ut,t,"f")}}.value,completionCommand:{set value(t){O(l,U,t,"f")}}.value,parseFn:{set value(t){O(c,nt,t,"f")}}.value,parseContext:{set value(t){O(f,rt,t,"f")}}.value}=u),v(this,et,"f").configObjects=p,v(this,pt,"f").unfreeze(),v(this,mt,"f").unfreeze(),v(this,W,"f").unfreeze(),v(this,K,"f").unfreeze()}[Nt](t,e){return j(e,(e=>(t(e),e)))}getInternalMethods(){return{getCommandInstance:this[Ht].bind(this),getContext:this[Wt].bind(this),getHasOutput:this[zt].bind(this),getLoggerInstance:this[qt].bind(this),getParseContext:this[Ft].bind(this),getParserConfiguration:this[jt].bind(this),getUsageInstance:this[Ut].bind(this),getValidationInstance:this[Lt].bind(this),hasParseCallback:this[Vt].bind(this),isGlobalContext:this[Gt].bind(this),postProcess:this[Rt].bind(this),reset:this[Bt].bind(this),runValidation:this[Yt].bind(this),runYargsParserAndExecuteCommands:this[Kt].bind(this),setHasOutput:this[Jt].bind(this)}}[Ht](){return v(this,W,"f")}[Wt](){return v(this,q,"f")}[zt](){return v(this,J,"f")}[qt](){return v(this,Q,"f")}[Ft](){return v(this,rt,"f")||{}}[Ut](){return v(this,pt,"f")}[Lt](){return v(this,mt,"f")}[Vt](){return!!v(this,nt,"f")}[Gt](){return v(this,X,"f")}[Rt](t,e,s,i){if(s)return t;if(f(t))return t;e||(t=this[yt](t));return(this[jt]()["parse-positional-numbers"]||void 0===this[jt]()["parse-positional-numbers"])&&(t=this[kt](t)),i&&(t=C(t,this,v(this,K,"f").getMiddleware(),!1)),t}[Bt](t={}){O(this,et,v(this,et,"f")||{},"f");const e={};e.local=v(this,et,"f").local||[],e.configObjects=v(this,et,"f").configObjects||[];const s={};e.local.forEach((e=>{s[e]=!0,(t[e]||[]).forEach((t=>{s[t]=!0}))})),Object.assign(v(this,at,"f"),Object.keys(v(this,Y,"f")).reduce(((t,e)=>{const i=v(this,Y,"f")[e].filter((t=>!(t in s)));return i.length>0&&(t[e]=i),t}),{})),O(this,Y,{},"f");return["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"].forEach((t=>{e[t]=(v(this,et,"f")[t]||[]).filter((t=>!s[t]))})),["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"].forEach((t=>{e[t]=g(v(this,et,"f")[t],(t=>!s[t]))})),e.envPrefix=v(this,et,"f").envPrefix,O(this,et,e,"f"),O(this,pt,v(this,pt,"f")?v(this,pt,"f").reset(s):P(this,v(this,ct,"f")),"f"),O(this,mt,v(this,mt,"f")?v(this,mt,"f").reset(s):function(t,e,s){const i=s.y18n.__,n=s.y18n.__n,r={nonOptionCount:function(s){const i=t.getDemandedCommands(),r=s._.length+(s["--"]?s["--"].length:0)-t.getInternalMethods().getContext().commands.length;i._&&(ri._.max)&&(ri._.max&&(void 0!==i._.maxMsg?e.fail(i._.maxMsg?i._.maxMsg.replace(/\$0/g,r.toString()).replace(/\$1/,i._.max.toString()):null):e.fail(n("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",r,r.toString(),i._.max.toString()))))},positionalCount:function(t,s){s{H.includes(e)||Object.prototype.hasOwnProperty.call(o,e)||Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),e)||r.isValidAndSomeAliasIsNotNew(e,i)||f.push(e)})),h&&(d.commands.length>0||c.length>0||a)&&s._.slice(d.commands.length).forEach((t=>{c.includes(""+t)||f.push(""+t)})),h){const e=(null===(l=t.getDemandedCommands()._)||void 0===l?void 0:l.max)||0,i=d.commands.length+e;i{t=String(t),d.commands.includes(t)||f.includes(t)||f.push(t)}))}f.length&&e.fail(n("Unknown argument: %s","Unknown arguments: %s",f.length,f.map((t=>t.trim()?t:`"${t}"`)).join(", ")))},unknownCommands:function(s){const i=t.getInternalMethods().getCommandInstance().getCommands(),r=[],o=t.getInternalMethods().getContext();return(o.commands.length>0||i.length>0)&&s._.slice(o.commands.length).forEach((t=>{i.includes(""+t)||r.push(""+t)})),r.length>0&&(e.fail(n("Unknown command: %s","Unknown commands: %s",r.length,r.join(", "))),!0)},isValidAndSomeAliasIsNotNew:function(e,s){if(!Object.prototype.hasOwnProperty.call(s,e))return!1;const i=t.parsed.newAliases;return[e,...s[e]].some((t=>!Object.prototype.hasOwnProperty.call(i,t)||!i[e]))},limitedChoices:function(s){const n=t.getOptions(),r={};if(!Object.keys(n.choices).length)return;Object.keys(s).forEach((t=>{-1===H.indexOf(t)&&Object.prototype.hasOwnProperty.call(n.choices,t)&&[].concat(s[t]).forEach((e=>{-1===n.choices[t].indexOf(e)&&void 0!==e&&(r[t]=(r[t]||[]).concat(e))}))}));const o=Object.keys(r);if(!o.length)return;let a=i("Invalid values:");o.forEach((t=>{a+=`\n ${i("Argument: %s, Given: %s, Choices: %s",t,e.stringifiedValues(r[t]),e.stringifiedValues(n.choices[t]))}`})),e.fail(a)}};let o={};function a(t,e){const s=Number(e);return"number"==typeof(e=isNaN(s)?e:s)?e=t._.length>=e:e.match(/^--no-.+/)?(e=e.match(/^--no-(.+)/)[1],e=!Object.prototype.hasOwnProperty.call(t,e)):e=Object.prototype.hasOwnProperty.call(t,e),e}r.implies=function(e,i){h(" [array|number|string]",[e,i],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.implies(t,e[t])})):(t.global(e),o[e]||(o[e]=[]),Array.isArray(i)?i.forEach((t=>r.implies(e,t))):(d(i,void 0,s),o[e].push(i)))},r.getImplied=function(){return o},r.implications=function(t){const s=[];if(Object.keys(o).forEach((e=>{const i=e;(o[e]||[]).forEach((e=>{let n=i;const r=e;n=a(t,n),e=a(t,e),n&&!e&&s.push(` ${i} -> ${r}`)}))})),s.length){let t=`${i("Implications failed:")}\n`;s.forEach((e=>{t+=e})),e.fail(t)}};let l={};r.conflicts=function(e,s){h(" [array|string]",[e,s],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.conflicts(t,e[t])})):(t.global(e),l[e]||(l[e]=[]),Array.isArray(s)?s.forEach((t=>r.conflicts(e,t))):l[e].push(s))},r.getConflicting=()=>l,r.conflicting=function(n){Object.keys(n).forEach((t=>{l[t]&&l[t].forEach((s=>{s&&void 0!==n[t]&&void 0!==n[s]&&e.fail(i("Arguments %s and %s are mutually exclusive",t,s))}))})),t.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(l).forEach((t=>{l[t].forEach((r=>{r&&void 0!==n[s.Parser.camelCase(t)]&&void 0!==n[s.Parser.camelCase(r)]&&e.fail(i("Arguments %s and %s are mutually exclusive",t,r))}))}))},r.recommendCommands=function(t,s){s=s.sort(((t,e)=>e.length-t.length));let n=null,r=1/0;for(let e,i=0;void 0!==(e=s[i]);i++){const s=N(t,e);s<=3&&s!t[e])),l=g(l,(e=>!t[e])),r};const c=[];return r.freeze=function(){c.push({implied:o,conflicting:l})},r.unfreeze=function(){const t=c.pop();d(t,void 0,s),({implied:o,conflicting:l}=t)},r}(this,v(this,pt,"f"),v(this,ct,"f")),"f"),O(this,W,v(this,W,"f")?v(this,W,"f").reset():function(t,e,s,i){return new M(t,e,s,i)}(v(this,pt,"f"),v(this,mt,"f"),v(this,K,"f"),v(this,ct,"f")),"f"),v(this,F,"f")||O(this,F,function(t,e,s,i){return new D(t,e,s,i)}(this,v(this,pt,"f"),v(this,W,"f"),v(this,ct,"f")),"f"),v(this,K,"f").reset(),O(this,U,null,"f"),O(this,tt,"","f"),O(this,V,null,"f"),O(this,J,!1,"f"),this.parsed=!1,this}[Tt](t,e){return v(this,ct,"f").path.relative(t,e)}[Kt](t,s,i,n=0,r=!1){let o=!!i||r;t=t||v(this,ht,"f"),v(this,et,"f").__=v(this,ct,"f").y18n.__,v(this,et,"f").configuration=this[jt]();const a=!!v(this,et,"f").configuration["populate--"],h=Object.assign({},v(this,et,"f").configuration,{"populate--":!0}),l=v(this,ct,"f").Parser.detailed(t,Object.assign({},v(this,et,"f"),{configuration:{"parse-positional-numbers":!1,...h}})),c=Object.assign(l.argv,v(this,rt,"f"));let d;const u=l.aliases;let p=!1,g=!1;Object.keys(c).forEach((t=>{t===v(this,Z,"f")&&c[t]?p=!0:t===v(this,gt,"f")&&c[t]&&(g=!0)})),c.$0=this.$0,this.parsed=l,0===n&&v(this,pt,"f").clearCachedHelpMessage();try{if(this[_t](),s)return this[Rt](c,a,!!i,!1);if(v(this,Z,"f")){[v(this,Z,"f")].concat(u[v(this,Z,"f")]||[]).filter((t=>t.length>1)).includes(""+c._[c._.length-1])&&(c._.pop(),p=!0)}O(this,X,!1,"f");const h=v(this,W,"f").getCommands(),m=v(this,F,"f").completionKey in c,y=p||m||r;if(c._.length){if(h.length){let t;for(let e,s=n||0;void 0!==c._[s];s++){if(e=String(c._[s]),h.includes(e)&&e!==v(this,U,"f")){const t=v(this,W,"f").runCommand(e,this,l,s+1,r,p||g||r);return this[Rt](t,a,!!i,!1)}if(!t&&e!==v(this,U,"f")){t=e;break}}!v(this,W,"f").hasDefaultCommand()&&v(this,lt,"f")&&t&&!y&&v(this,mt,"f").recommendCommands(t,h)}v(this,U,"f")&&c._.includes(v(this,U,"f"))&&!m&&(v(this,T,"f")&&E(!0),this.showCompletionScript(),this.exit(0))}if(v(this,W,"f").hasDefaultCommand()&&!y){const t=v(this,W,"f").runCommand(null,this,l,0,r,p||g||r);return this[Rt](t,a,!!i,!1)}if(m){v(this,T,"f")&&E(!0);const s=(t=[].concat(t)).slice(t.indexOf(`--${v(this,F,"f").completionKey}`)+1);return v(this,F,"f").getCompletion(s,((t,s)=>{if(t)throw new e(t.message);(s||[]).forEach((t=>{v(this,Q,"f").log(t)})),this.exit(0)})),this[Rt](c,!a,!!i,!1)}if(v(this,J,"f")||(p?(v(this,T,"f")&&E(!0),o=!0,this.showHelp("log"),this.exit(0)):g&&(v(this,T,"f")&&E(!0),o=!0,v(this,pt,"f").showVersion("log"),this.exit(0))),!o&&v(this,et,"f").skipValidation.length>0&&(o=Object.keys(c).some((t=>v(this,et,"f").skipValidation.indexOf(t)>=0&&!0===c[t]))),!o){if(l.error)throw new e(l.error.message);if(!m){const t=this[Yt](u,{},l.error);i||(d=C(c,this,v(this,K,"f").getMiddleware(),!0)),d=this[Nt](t,null!=d?d:c),f(d)&&!i&&(d=d.then((()=>C(c,this,v(this,K,"f").getMiddleware(),!1))))}}}catch(t){if(!(t instanceof e))throw t;v(this,pt,"f").fail(t.message,t)}return this[Rt](null!=d?d:c,a,!!i,!0)}[Yt](t,s,i,n){const r={...this.getDemandedOptions()};return o=>{if(i)throw new e(i.message);v(this,mt,"f").nonOptionCount(o),v(this,mt,"f").requiredArguments(o,r);let a=!1;v(this,dt,"f")&&(a=v(this,mt,"f").unknownCommands(o)),v(this,ft,"f")&&!a?v(this,mt,"f").unknownArguments(o,t,s,!!n):v(this,ut,"f")&&v(this,mt,"f").unknownArguments(o,t,{},!1,!1),v(this,mt,"f").limitedChoices(o),v(this,mt,"f").implications(o),v(this,mt,"f").conflicting(o)}}[Jt](){O(this,J,!0,"f")}[Zt](t){if("string"==typeof t)v(this,et,"f").key[t]=!0;else for(const e of t)v(this,et,"f").key[e]=!0}}var Qt,te;const{readFileSync:ee}=require("fs"),{inspect:se}=require("util"),{resolve:ie}=require("path"),ne=require("y18n"),re=require("yargs-parser");var oe,ae={assert:{notStrictEqual:t.notStrictEqual,strictEqual:t.strictEqual},cliui:require("cliui"),findUp:require("escalade/sync"),getEnv:t=>process.env[t],getCallerFile:require("get-caller-file"),getProcessArgvBin:y,inspect:se,mainFilename:null!==(te=null===(Qt=null===require||void 0===require?void 0:require.main)||void 0===Qt?void 0:Qt.filename)&&void 0!==te?te:process.cwd(),Parser:re,path:require("path"),process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,e)=>process.emitWarning(t,e),execPath:()=>process.execPath,exit:t=>{process.exit(t)},nextTick:process.nextTick,stdColumns:void 0!==process.stdout.columns?process.stdout.columns:null},readFileSync:ee,require:require,requireDirectory:require("require-directory"),stringWidth:require("string-width"),y18n:ne({directory:ie(__dirname,"../locales"),updateFiles:!1})};const he=(null===(oe=null===process||void 0===process?void 0:process.env)||void 0===oe?void 0:oe.YARGS_MIN_NODE_VERSION)?Number(process.env.YARGS_MIN_NODE_VERSION):12;if(process&&process.version){if(Number(process.version.match(/v([^.]+)/)[1]){const i=new Xt(t,e,s,ce);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}),argsert:h,isPromise:f,objFilter:g,parseCommand:o,Parser:le,processArgv:b,YError:e};module.exports=fe; diff --git a/node_modules/yargs/build/lib/usage.js b/node_modules/yargs/build/lib/usage.js index f47256ddf6..2e1407379b 100644 --- a/node_modules/yargs/build/lib/usage.js +++ b/node_modules/yargs/build/lib/usage.js @@ -133,13 +133,16 @@ export function usage(yargs, shim) { wrapSet = true; wrap = cols; }; - function getWrap() { + self.getWrap = () => { + if (shim.getEnv('YARGS_DISABLE_WRAP')) { + return null; + } if (!wrapSet) { wrap = windowWidth(); wrapSet = true; } return wrap; - } + }; const deferY18nLookupPrefix = '__yargsString__:'; self.deferY18nLookup = str => deferY18nLookupPrefix + str; self.help = function help() { @@ -165,7 +168,7 @@ export function usage(yargs, shim) { acc[key] = true; return acc; }, {})); - const theWrap = getWrap(); + const theWrap = self.getWrap(); const ui = shim.cliui({ width: theWrap, wrap: !!theWrap, diff --git a/node_modules/yargs/build/lib/yargs-factory.js b/node_modules/yargs/build/lib/yargs-factory.js index 40a2921cc5..db8a96d0c9 100644 --- a/node_modules/yargs/build/lib/yargs-factory.js +++ b/node_modules/yargs/build/lib/yargs-factory.js @@ -667,7 +667,11 @@ export class YargsInstance { this.skipValidation(key); } const desc = opt.describe || opt.description || opt.desc; - this.describe(key, desc); + const descriptions = __classPrivateFieldGet(this, _YargsInstance_usage, "f").getDescriptions(); + if (!Object.prototype.hasOwnProperty.call(descriptions, key) || + typeof desc === 'string') { + this.describe(key, desc); + } if (opt.hidden) { this.hide(key); } diff --git a/node_modules/yargs/locales/cs.json b/node_modules/yargs/locales/cs.json new file mode 100644 index 0000000000..6394875647 --- /dev/null +++ b/node_modules/yargs/locales/cs.json @@ -0,0 +1,51 @@ +{ + "Commands:": "Příkazy:", + "Options:": "Možnosti:", + "Examples:": "Příklady:", + "boolean": "logická hodnota", + "count": "počet", + "string": "řetězec", + "number": "číslo", + "array": "pole", + "required": "povinné", + "default": "výchozí", + "default:": "výchozí:", + "choices:": "volby:", + "aliases:": "aliasy:", + "generated-value": "generovaná-hodnota", + "Not enough non-option arguments: got %s, need at least %s": { + "one": "Nedostatek argumentů: zadáno %s, je potřeba alespoň %s", + "other": "Nedostatek argumentů: zadáno %s, je potřeba alespoň %s" + }, + "Too many non-option arguments: got %s, maximum of %s": { + "one": "Příliš mnoho argumentů: zadáno %s, maximálně %s", + "other": "Příliš mnoho argumentů: zadáno %s, maximálně %s" + }, + "Missing argument value: %s": { + "one": "Chybí hodnota argumentu: %s", + "other": "Chybí hodnoty argumentů: %s" + }, + "Missing required argument: %s": { + "one": "Chybí požadovaný argument: %s", + "other": "Chybí požadované argumenty: %s" + }, + "Unknown argument: %s": { + "one": "Neznámý argument: %s", + "other": "Neznámé argumenty: %s" + }, + "Invalid values:": "Neplatné hodnoty:", + "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Zadáno: %s, Možnosti: %s", + "Argument check failed: %s": "Kontrola argumentů se nezdařila: %s", + "Implications failed:": "Chybí závislé argumenty:", + "Not enough arguments following: %s": "Následuje nedostatek argumentů: %s", + "Invalid JSON config file: %s": "Neplatný konfigurační soubor JSON: %s", + "Path to JSON config file": "Cesta ke konfiguračnímu souboru JSON", + "Show help": "Zobrazit nápovědu", + "Show version number": "Zobrazit číslo verze", + "Did you mean %s?": "Měl jste na mysli %s?", + "Arguments %s and %s are mutually exclusive" : "Argumenty %s a %s se vzájemně vylučují", + "Positionals:": "Poziční:", + "command": "příkaz", + "deprecated": "zastaralé", + "deprecated: %s": "zastaralé: %s" +} diff --git a/node_modules/yargs/locales/fi.json b/node_modules/yargs/locales/fi.json index 0728c57845..481feb710a 100644 --- a/node_modules/yargs/locales/fi.json +++ b/node_modules/yargs/locales/fi.json @@ -30,7 +30,7 @@ "other": "Pakollisia argumentteja puuttuu: %s" }, "Unknown argument: %s": { - "one": "Tuntematon argumenttn: %s", + "one": "Tuntematon argumentti: %s", "other": "Tuntemattomia argumentteja: %s" }, "Invalid values:": "Virheelliset arvot:", diff --git a/node_modules/yargs/package.json b/node_modules/yargs/package.json index 2d48e590ea..dfc4303e73 100644 --- a/node_modules/yargs/package.json +++ b/node_modules/yargs/package.json @@ -1,6 +1,6 @@ { "name": "yargs", - "version": "17.5.1", + "version": "17.6.2", "description": "yargs the modern, pirate-themed, successor to optimist.", "main": "./index.cjs", "exports": { @@ -53,18 +53,18 @@ "!**/*.d.ts" ], "dependencies": { - "cliui": "^7.0.2", + "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^21.0.0" + "yargs-parser": "^21.1.1" }, "devDependencies": { "@types/chai": "^4.2.11", "@types/mocha": "^9.0.0", - "@types/node": "^16.11.4", + "@types/node": "^18.0.0", "c8": "^7.7.0", "chai": "^4.2.0", "chalk": "^4.0.0", diff --git a/package-lock.json b/package-lock.json index 7df856c31d..6871593d40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,7 @@ "@types/semver": "^7.3.8", "@types/sinon": "^10.0.2", "@typescript-eslint/parser": "^5.0.0", - "ava": "^4.3.3", + "ava": "^5.1.1", "eslint": "^7.32.0", "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^4.2.0", @@ -1340,22 +1340,22 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/ava": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/ava/-/ava-4.3.3.tgz", - "integrity": "sha512-9Egq/d9R74ExrWohHeqUlexjDbgZJX5jA1Wq4KCTqc3wIfpGEK79zVy4rBtofJ9YKIxs4PzhJ8BgbW5PlAYe6w==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/ava/-/ava-5.1.1.tgz", + "integrity": "sha512-od1CWgWVIKZSdEc1dhQWhbsd6KBs0EYjek7eqZNGPvy+NyC9Q1bXixcadlgOXwDG9aM0zLMQZwRXfe9gMb1LQQ==", "dev": true, "dependencies": { - "acorn": "^8.7.1", + "acorn": "^8.8.1", "acorn-walk": "^8.2.0", - "ansi-styles": "^6.1.0", + "ansi-styles": "^6.2.1", "arrgv": "^1.0.2", "arrify": "^3.0.0", "callsites": "^4.0.0", "cbor": "^8.1.0", - "chalk": "^5.0.1", + "chalk": "^5.2.0", "chokidar": "^3.5.3", "chunkd": "^2.0.1", - "ci-info": "^3.3.1", + "ci-info": "^3.7.1", "ci-parallel-vars": "^1.0.1", "clean-yaml-object": "^0.1.0", "cli-truncate": "^3.1.0", @@ -1364,10 +1364,10 @@ "concordance": "^5.0.4", "currently-unhandled": "^0.4.1", "debug": "^4.3.4", - "del": "^6.1.1", - "emittery": "^0.11.0", - "figures": "^4.0.1", - "globby": "^13.1.1", + "del": "^7.0.0", + "emittery": "^1.0.1", + "figures": "^5.0.0", + "globby": "^13.1.3", "ignore-by-default": "^2.1.0", "indent-string": "^5.0.0", "is-error": "^2.2.2", @@ -1377,25 +1377,25 @@ "mem": "^9.0.2", "ms": "^2.1.3", "p-event": "^5.0.1", - "p-map": "^5.4.0", + "p-map": "^5.5.0", "picomatch": "^2.3.1", "pkg-conf": "^4.0.0", "plur": "^5.1.0", - "pretty-ms": "^7.0.1", + "pretty-ms": "^8.0.0", "resolve-cwd": "^3.0.0", "slash": "^3.0.0", - "stack-utils": "^2.0.5", + "stack-utils": "^2.0.6", "strip-ansi": "^7.0.1", "supertap": "^3.0.1", - "temp-dir": "^2.0.0", - "write-file-atomic": "^4.0.1", - "yargs": "^17.5.1" + "temp-dir": "^3.0.0", + "write-file-atomic": "^5.0.0", + "yargs": "^17.6.2" }, "bin": { "ava": "entrypoints/cli.mjs" }, "engines": { - "node": ">=12.22 <13 || >=14.17 <15 || >=16.4 <17 || >=18" + "node": ">=14.19 <15 || >=16.15 <17 || >=18" }, "peerDependencies": { "@ava/typescript": "*" @@ -1407,9 +1407,9 @@ } }, "node_modules/ava/node_modules/acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -1447,9 +1447,9 @@ } }, "node_modules/ava/node_modules/ansi-styles": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.1.0.tgz", - "integrity": "sha512-VbqNsoz55SYGczauuup0MFUyXNQviSpFTj1RQtFzmQLk18qbVSpTFFGMT293rmDaQuKCT6InmbuEyUne4mTuxQ==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", "dev": true, "engines": { "node": ">=12" @@ -1483,9 +1483,9 @@ } }, "node_modules/ava/node_modules/chalk": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz", - "integrity": "sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", "dev": true, "engines": { "node": "^12.17.0 || ^14.13 || >=16.0.0" @@ -1509,6 +1509,40 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/ava/node_modules/del": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-7.0.0.tgz", + "integrity": "sha512-tQbV/4u5WVB8HMJr08pgw0b6nG4RGt/tj+7Numvq+zqcvUFeMaIWWOUFltiU+6go8BSO2/ogsB4EasDaj0y68Q==", + "dev": true, + "dependencies": { + "globby": "^13.1.2", + "graceful-fs": "^4.2.10", + "is-glob": "^4.0.3", + "is-path-cwd": "^3.0.0", + "is-path-inside": "^4.0.0", + "p-map": "^5.5.0", + "rimraf": "^3.0.2", + "slash": "^4.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ava/node_modules/del/node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/ava/node_modules/escape-string-regexp": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", @@ -1522,9 +1556,9 @@ } }, "node_modules/ava/node_modules/globby": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.2.tgz", - "integrity": "sha512-LKSDZXToac40u8Q1PQtZihbNdTYSNMuWe+K5l+oa6KgDzSvVrHXlJy40hUP522RjAIoNLJYBJi7ow+rbFpIhHQ==", + "version": "13.1.3", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.3.tgz", + "integrity": "sha512-8krCNHXvlCgHDpegPzleMq07yMYTO2sXKASmZmquEYWEmCx6J5UTRbp5RwMJkTJGtcQ44YpiUYUiN0b9mzy8Bw==", "dev": true, "dependencies": { "dir-glob": "^3.0.1", @@ -1564,6 +1598,30 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/ava/node_modules/is-path-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-3.0.0.tgz", + "integrity": "sha512-kyiNFFLU0Ampr6SDZitD/DwUo4Zs1nSdnygUBqsu3LooL00Qvb5j+UnvApUn/TTj1J3OuE6BTdQ5rudKmU2ZaA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ava/node_modules/is-path-inside": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-4.0.0.tgz", + "integrity": "sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/ava/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -1730,10 +1788,19 @@ "dev": true }, "node_modules/ci-info": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.2.tgz", - "integrity": "sha512-xmDt/QIAdeZ9+nfdPsaBCpMvHNLFiLdjj59qjqn+6iPe6YmHGQ35sBnQ8uslRBXFmXkiZQOJRjvQeoGppoTjjg==", - "dev": true + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.7.1.tgz", + "integrity": "sha512-4jYS4MOAaCIStSRwiuxc4B8MYhIe676yO1sYGzARnjXkWpmzZMMYxY6zu8WYWDhSuth5zhrQ1rhNSibyyvv4/w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } }, "node_modules/ci-parallel-vars": { "version": "1.0.1", @@ -1823,14 +1890,17 @@ } }, "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", "dev": true, "dependencies": { "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", + "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" } }, "node_modules/code-excerpt": { @@ -2067,12 +2137,12 @@ "dev": true }, "node_modules/emittery": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.11.0.tgz", - "integrity": "sha512-S/7tzL6v5i+4iJd627Nhv9cLFIo5weAIlGccqJFpnBoDB8U1TF2k5tez4J/QNuxyyhWuFqHg1L84Kd3m7iXg6g==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-1.0.1.tgz", + "integrity": "sha512-2ID6FdrMD9KDLldGesP6317G78K7km/kMcwItRtVFva7I/cSEOIaLpewaUb+YLXVwdAp3Ctfxh/V5zIl1sj7dQ==", "dev": true, "engines": { - "node": ">=12" + "node": ">=14.16" }, "funding": { "url": "https://github.com/sindresorhus/emittery?sponsor=1" @@ -3038,16 +3108,16 @@ } }, "node_modules/figures": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/figures/-/figures-4.0.1.tgz", - "integrity": "sha512-rElJwkA/xS04Vfg+CaZodpso7VqBknOYbzi6I76hI4X80RUjkSxO2oAyPmGbuXUppywjqndOrQDl817hDnI++w==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", + "integrity": "sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==", "dev": true, "dependencies": { "escape-string-regexp": "^5.0.0", "is-unicode-supported": "^1.2.0" }, "engines": { - "node": ">=12" + "node": ">=14" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3299,9 +3369,9 @@ } }, "node_modules/graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, "node_modules/has": { "version": "1.0.3", @@ -3546,8 +3616,9 @@ } }, "node_modules/is-glob": { - "version": "4.0.1", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dependencies": { "is-extglob": "^2.1.1" }, @@ -3672,9 +3743,9 @@ } }, "node_modules/is-unicode-supported": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.2.0.tgz", - "integrity": "sha512-wH+U77omcRzevfIG8dDhTS0V9zZyweakfD01FULl97+0EHiJTTZtJqxPSkIIo/SDPv/i07k/C9jAPY+jwLLeUQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", "dev": true, "engines": { "node": ">=12" @@ -4333,12 +4404,15 @@ } }, "node_modules/parse-ms": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz", - "integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-3.0.0.tgz", + "integrity": "sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==", "dev": true, "engines": { - "node": ">=6" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/path": { @@ -4550,15 +4624,15 @@ } }, "node_modules/pretty-ms": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-7.0.1.tgz", - "integrity": "sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-8.0.0.tgz", + "integrity": "sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==", "dev": true, "dependencies": { - "parse-ms": "^2.1.0" + "parse-ms": "^3.0.0" }, "engines": { - "node": ">=10" + "node": ">=14.16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -5072,9 +5146,9 @@ "dev": true }, "node_modules/stack-utils": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz", - "integrity": "sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", "dev": true, "dependencies": { "escape-string-regexp": "^2.0.0" @@ -5347,11 +5421,12 @@ } }, "node_modules/temp-dir": { - "version": "2.0.0", - "integrity": "sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-3.0.0.tgz", + "integrity": "sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==", "dev": true, "engines": { - "node": ">=8" + "node": ">=14.16" } }, "node_modules/text-table": { @@ -5684,16 +5759,16 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "node_modules/write-file-atomic": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", - "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.0.tgz", + "integrity": "sha512-R7NYMnHSlV42K54lwY9lvW6MnSm1HSJqZL3xiSgi9E7//FYaI74r2G0rd+/X6VAMkHEdzxQaU5HUOXWUz5kA/w==", "dev": true, "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^3.0.7" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/xml2js": { @@ -5731,18 +5806,18 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/yargs": { - "version": "17.5.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz", - "integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==", + "version": "17.6.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", + "integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", "dev": true, "dependencies": { - "cliui": "^7.0.2", + "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^21.0.0" + "yargs-parser": "^21.1.1" }, "engines": { "node": ">=12" diff --git a/package.json b/package.json index fea2825828..6192d27210 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "@types/semver": "^7.3.8", "@types/sinon": "^10.0.2", "@typescript-eslint/parser": "^5.0.0", - "ava": "^4.3.3", + "ava": "^5.1.1", "eslint": "^7.32.0", "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-github": "^4.2.0",