@bleedingdev/modern-js-utils 3.2.0-ultramodern.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/cjs/cli/alias.js +82 -0
- package/dist/cjs/cli/applyOptionsChain.js +50 -0
- package/dist/cjs/cli/commands.js +69 -0
- package/dist/cjs/cli/common.js +59 -0
- package/dist/cjs/cli/config.js +39 -0
- package/dist/cjs/cli/constants.js +136 -0
- package/dist/cjs/cli/ensure.js +56 -0
- package/dist/cjs/cli/fs.js +46 -0
- package/dist/cjs/cli/get/config.js +48 -0
- package/dist/cjs/cli/get/data.js +106 -0
- package/dist/cjs/cli/get/index.js +112 -0
- package/dist/cjs/cli/index.js +212 -0
- package/dist/cjs/cli/is/config.js +86 -0
- package/dist/cjs/cli/is/env.js +52 -0
- package/dist/cjs/cli/is/index.js +79 -0
- package/dist/cjs/cli/is/project.js +147 -0
- package/dist/cjs/cli/is/type.js +84 -0
- package/dist/cjs/cli/logger.js +39 -0
- package/dist/cjs/cli/modulePath.js +87 -0
- package/dist/cjs/cli/monorepo.js +110 -0
- package/dist/cjs/cli/package.js +97 -0
- package/dist/cjs/cli/path.js +111 -0
- package/dist/cjs/cli/port.js +79 -0
- package/dist/cjs/cli/prettyInstructions.js +117 -0
- package/dist/cjs/cli/require.js +127 -0
- package/dist/cjs/cli/route.js +76 -0
- package/dist/cjs/cli/runtimeExports.js +86 -0
- package/dist/cjs/cli/tsconfig.js +51 -0
- package/dist/cjs/cli/version.js +67 -0
- package/dist/cjs/cli/watch.js +87 -0
- package/dist/cjs/compiled.js +209 -0
- package/dist/cjs/import.js +56 -0
- package/dist/cjs/index.js +72 -0
- package/dist/cjs/universal/constants.js +84 -0
- package/dist/cjs/universal/index.js +36 -0
- package/dist/cjs/universal/path.js +36 -0
- package/dist/cjs/universal/pluginDagSort.js +75 -0
- package/dist/compiled/address/index.js +171 -0
- package/dist/compiled/address/lib/address.d.ts +28 -0
- package/dist/compiled/address/package.json +1 -0
- package/dist/compiled/browserslist/index.d.ts +178 -0
- package/dist/compiled/browserslist/index.js +1329 -0
- package/dist/compiled/browserslist/license +20 -0
- package/dist/compiled/browserslist/package.json +1 -0
- package/dist/compiled/chalk/index.d.ts +415 -0
- package/dist/compiled/chalk/index.js +2368 -0
- package/dist/compiled/chalk/license +9 -0
- package/dist/compiled/chalk/package.json +1 -0
- package/dist/compiled/chokidar/anymatch/index.d.ts +19 -0
- package/dist/compiled/chokidar/fsevents.node +0 -0
- package/dist/compiled/chokidar/index.js +4162 -0
- package/dist/compiled/chokidar/index.js.LICENSE.txt +41 -0
- package/dist/compiled/chokidar/license +21 -0
- package/dist/compiled/chokidar/package.json +1 -0
- package/dist/compiled/chokidar/types/index.d.ts +188 -0
- package/dist/compiled/commander/index.js +1540 -0
- package/dist/compiled/commander/index.mjs +2 -0
- package/dist/compiled/commander/license +22 -0
- package/dist/compiled/commander/package.json +1 -0
- package/dist/compiled/commander/typings/index.d.ts +890 -0
- package/dist/compiled/debug/index.d.ts +54 -0
- package/dist/compiled/debug/index.js +621 -0
- package/dist/compiled/debug/license +20 -0
- package/dist/compiled/debug/ms/index.d.ts +25 -0
- package/dist/compiled/debug/package.json +1 -0
- package/dist/compiled/dotenv/index.js +101 -0
- package/dist/compiled/dotenv/license +23 -0
- package/dist/compiled/dotenv/package.json +1 -0
- package/dist/compiled/dotenv/types/index.d.ts +59 -0
- package/dist/compiled/dotenv-expand/index.d.ts +15 -0
- package/dist/compiled/dotenv-expand/index.js +54 -0
- package/dist/compiled/dotenv-expand/license +24 -0
- package/dist/compiled/dotenv-expand/package.json +1 -0
- package/dist/compiled/execa/index.d.ts +564 -0
- package/dist/compiled/execa/index.js +1738 -0
- package/dist/compiled/execa/license +9 -0
- package/dist/compiled/execa/package.json +1 -0
- package/dist/compiled/fast-glob/@nodelib/fs.scandir/out/adapters/fs.d.ts +20 -0
- package/dist/compiled/fast-glob/@nodelib/fs.scandir/out/index.d.ts +12 -0
- package/dist/compiled/fast-glob/@nodelib/fs.scandir/out/providers/async.d.ts +7 -0
- package/dist/compiled/fast-glob/@nodelib/fs.scandir/out/settings.d.ts +20 -0
- package/dist/compiled/fast-glob/@nodelib/fs.scandir/out/types/index.d.ts +20 -0
- package/dist/compiled/fast-glob/@nodelib/fs.stat/out/adapters/fs.d.ts +13 -0
- package/dist/compiled/fast-glob/@nodelib/fs.stat/out/index.d.ts +12 -0
- package/dist/compiled/fast-glob/@nodelib/fs.stat/out/providers/async.d.ts +4 -0
- package/dist/compiled/fast-glob/@nodelib/fs.stat/out/settings.d.ts +16 -0
- package/dist/compiled/fast-glob/@nodelib/fs.stat/out/types/index.d.ts +4 -0
- package/dist/compiled/fast-glob/@nodelib/fs.walk/out/index.d.ts +14 -0
- package/dist/compiled/fast-glob/@nodelib/fs.walk/out/providers/async.d.ts +12 -0
- package/dist/compiled/fast-glob/@nodelib/fs.walk/out/readers/async.d.ts +30 -0
- package/dist/compiled/fast-glob/@nodelib/fs.walk/out/readers/reader.d.ts +6 -0
- package/dist/compiled/fast-glob/@nodelib/fs.walk/out/settings.d.ts +30 -0
- package/dist/compiled/fast-glob/@nodelib/fs.walk/out/types/index.d.ts +8 -0
- package/dist/compiled/fast-glob/index.js +4665 -0
- package/dist/compiled/fast-glob/index.js.LICENSE.txt +38 -0
- package/dist/compiled/fast-glob/license +21 -0
- package/dist/compiled/fast-glob/out/index.d.ts +27 -0
- package/dist/compiled/fast-glob/out/managers/tasks.d.ts +22 -0
- package/dist/compiled/fast-glob/out/settings.d.ts +164 -0
- package/dist/compiled/fast-glob/out/types/index.d.ts +31 -0
- package/dist/compiled/fast-glob/package.json +1 -0
- package/dist/compiled/filesize/filesize.d.ts +131 -0
- package/dist/compiled/filesize/index.js +198 -0
- package/dist/compiled/filesize/index.js.LICENSE.txt +7 -0
- package/dist/compiled/filesize/license +28 -0
- package/dist/compiled/filesize/package.json +1 -0
- package/dist/compiled/fs-extra/index.d.ts +563 -0
- package/dist/compiled/fs-extra/index.js +2222 -0
- package/dist/compiled/fs-extra/license +15 -0
- package/dist/compiled/fs-extra/package.json +1 -0
- package/dist/compiled/glob/index.d.ts +91 -0
- package/dist/compiled/glob/index.js +2011 -0
- package/dist/compiled/glob/license +21 -0
- package/dist/compiled/glob/minimatch/index.d.ts +204 -0
- package/dist/compiled/glob/package.json +1 -0
- package/dist/compiled/globby/index.d.ts +186 -0
- package/dist/compiled/globby/index.js +690 -0
- package/dist/compiled/globby/license +9 -0
- package/dist/compiled/globby/package.json +1 -0
- package/dist/compiled/gzip-size/index.d.ts +96 -0
- package/dist/compiled/gzip-size/index.js +157 -0
- package/dist/compiled/gzip-size/license +9 -0
- package/dist/compiled/gzip-size/package.json +1 -0
- package/dist/compiled/import-lazy/index.d.ts +26 -0
- package/dist/compiled/import-lazy/index.js +45 -0
- package/dist/compiled/import-lazy/license +9 -0
- package/dist/compiled/import-lazy/package.json +1 -0
- package/dist/compiled/inquirer/index.d.ts +997 -0
- package/dist/compiled/inquirer/index.js +20167 -0
- package/dist/compiled/inquirer/index.js.LICENSE.txt +7 -0
- package/dist/compiled/inquirer/lib/objects/choice.d.ts +65 -0
- package/dist/compiled/inquirer/lib/objects/choices.d.ts +206 -0
- package/dist/compiled/inquirer/lib/objects/separator.d.ts +37 -0
- package/dist/compiled/inquirer/lib/ui/baseUI.d.ts +37 -0
- package/dist/compiled/inquirer/lib/ui/bottom-bar.d.ts +65 -0
- package/dist/compiled/inquirer/lib/ui/prompt.d.ts +104 -0
- package/dist/compiled/inquirer/license +22 -0
- package/dist/compiled/inquirer/package.json +1 -0
- package/dist/compiled/inquirer/through/index.d.ts +25 -0
- package/dist/compiled/js-yaml/index.d.ts +154 -0
- package/dist/compiled/js-yaml/index.js +2191 -0
- package/dist/compiled/js-yaml/index.mjs +2167 -0
- package/dist/compiled/js-yaml/index.mjs.LICENSE.txt +1 -0
- package/dist/compiled/js-yaml/license +21 -0
- package/dist/compiled/js-yaml/package.json +1 -0
- package/dist/compiled/json5/index.js +983 -0
- package/dist/compiled/json5/lib/index.d.ts +4 -0
- package/dist/compiled/json5/lib/parse.d.ts +15 -0
- package/dist/compiled/json5/lib/stringify.d.ts +89 -0
- package/dist/compiled/json5/package.json +1 -0
- package/dist/compiled/lodash/common/array.d.ts +2126 -0
- package/dist/compiled/lodash/common/collection.d.ts +1930 -0
- package/dist/compiled/lodash/common/common.d.ts +280 -0
- package/dist/compiled/lodash/common/date.d.ts +23 -0
- package/dist/compiled/lodash/common/function.d.ts +1446 -0
- package/dist/compiled/lodash/common/lang.d.ts +1693 -0
- package/dist/compiled/lodash/common/math.d.ts +405 -0
- package/dist/compiled/lodash/common/number.d.ts +131 -0
- package/dist/compiled/lodash/common/object.d.ts +2519 -0
- package/dist/compiled/lodash/common/seq.d.ts +210 -0
- package/dist/compiled/lodash/common/string.d.ts +788 -0
- package/dist/compiled/lodash/common/util.d.ts +1220 -0
- package/dist/compiled/lodash/index.d.ts +46 -0
- package/dist/compiled/lodash/index.js +1 -0
- package/dist/compiled/lodash/index.mjs +1 -0
- package/dist/compiled/lodash/license +47 -0
- package/dist/compiled/lodash/package.json +1 -0
- package/dist/compiled/mime-types/index.d.ts +14 -0
- package/dist/compiled/mime-types/index.js +116 -0
- package/dist/compiled/mime-types/index.js.LICENSE.txt +13 -0
- package/dist/compiled/mime-types/license +23 -0
- package/dist/compiled/mime-types/package.json +1 -0
- package/dist/compiled/minimist/index.d.ts +95 -0
- package/dist/compiled/minimist/index.js +202 -0
- package/dist/compiled/minimist/license +18 -0
- package/dist/compiled/minimist/package.json +1 -0
- package/dist/compiled/nanoid/index.d.ts +91 -0
- package/dist/compiled/nanoid/index.js +83 -0
- package/dist/compiled/nanoid/index.mjs +69 -0
- package/dist/compiled/nanoid/license +20 -0
- package/dist/compiled/nanoid/package.json +1 -0
- package/dist/compiled/ora/cli-spinners/index.d.ts +125 -0
- package/dist/compiled/ora/index.d.ts +277 -0
- package/dist/compiled/ora/index.js +3936 -0
- package/dist/compiled/ora/index.js.LICENSE.txt +1 -0
- package/dist/compiled/ora/license +9 -0
- package/dist/compiled/ora/package.json +1 -0
- package/dist/compiled/pkg-up/index.d.ts +48 -0
- package/dist/compiled/pkg-up/index.js +15 -0
- package/dist/compiled/pkg-up/license +9 -0
- package/dist/compiled/pkg-up/package.json +1 -0
- package/dist/compiled/semver/classes/comparator.d.ts +17 -0
- package/dist/compiled/semver/classes/range.d.ts +21 -0
- package/dist/compiled/semver/classes/semver.d.ts +62 -0
- package/dist/compiled/semver/functions/clean.d.ts +8 -0
- package/dist/compiled/semver/functions/cmp.d.ts +16 -0
- package/dist/compiled/semver/functions/coerce.d.ts +12 -0
- package/dist/compiled/semver/functions/compare-build.d.ts +16 -0
- package/dist/compiled/semver/functions/compare-loose.d.ts +5 -0
- package/dist/compiled/semver/functions/compare.d.ts +20 -0
- package/dist/compiled/semver/functions/diff.d.ts +13 -0
- package/dist/compiled/semver/functions/eq.d.ts +9 -0
- package/dist/compiled/semver/functions/gt.d.ts +9 -0
- package/dist/compiled/semver/functions/gte.d.ts +9 -0
- package/dist/compiled/semver/functions/inc.d.ts +15 -0
- package/dist/compiled/semver/functions/lt.d.ts +9 -0
- package/dist/compiled/semver/functions/lte.d.ts +8 -0
- package/dist/compiled/semver/functions/major.d.ts +9 -0
- package/dist/compiled/semver/functions/minor.d.ts +9 -0
- package/dist/compiled/semver/functions/neq.d.ts +9 -0
- package/dist/compiled/semver/functions/parse.d.ts +12 -0
- package/dist/compiled/semver/functions/patch.d.ts +9 -0
- package/dist/compiled/semver/functions/prerelease.d.ts +12 -0
- package/dist/compiled/semver/functions/rcompare.d.ts +15 -0
- package/dist/compiled/semver/functions/rsort.d.ts +9 -0
- package/dist/compiled/semver/functions/satisfies.d.ts +14 -0
- package/dist/compiled/semver/functions/sort.d.ts +9 -0
- package/dist/compiled/semver/functions/valid.d.ts +11 -0
- package/dist/compiled/semver/index.d.ts +133 -0
- package/dist/compiled/semver/index.js +1779 -0
- package/dist/compiled/semver/internals/identifiers.d.ts +13 -0
- package/dist/compiled/semver/license +15 -0
- package/dist/compiled/semver/package.json +1 -0
- package/dist/compiled/semver/ranges/gtr.d.ts +14 -0
- package/dist/compiled/semver/ranges/intersects.d.ts +13 -0
- package/dist/compiled/semver/ranges/ltr.d.ts +14 -0
- package/dist/compiled/semver/ranges/max-satisfying.d.ts +14 -0
- package/dist/compiled/semver/ranges/min-satisfying.d.ts +14 -0
- package/dist/compiled/semver/ranges/min-version.d.ts +10 -0
- package/dist/compiled/semver/ranges/outside.d.ts +15 -0
- package/dist/compiled/semver/ranges/simplify.d.ts +14 -0
- package/dist/compiled/semver/ranges/subset.d.ts +13 -0
- package/dist/compiled/semver/ranges/to-comparators.d.ts +9 -0
- package/dist/compiled/semver/ranges/valid.d.ts +12 -0
- package/dist/compiled/signale/index.d.ts +162 -0
- package/dist/compiled/signale/index.js +1704 -0
- package/dist/compiled/signale/package.json +1 -0
- package/dist/compiled/slash/index.d.ts +25 -0
- package/dist/compiled/slash/index.js +32 -0
- package/dist/compiled/slash/license +9 -0
- package/dist/compiled/slash/package.json +1 -0
- package/dist/compiled/strip-ansi/index.d.ts +17 -0
- package/dist/compiled/strip-ansi/index.js +34 -0
- package/dist/compiled/strip-ansi/license +9 -0
- package/dist/compiled/strip-ansi/package.json +1 -0
- package/dist/compiled/tsconfig-paths/index.js +629 -0
- package/dist/compiled/tsconfig-paths/index.mjs +2 -0
- package/dist/compiled/tsconfig-paths/lib/config-loader.d.ts +33 -0
- package/dist/compiled/tsconfig-paths/lib/filesystem.d.ts +34 -0
- package/dist/compiled/tsconfig-paths/lib/index.d.ts +5 -0
- package/dist/compiled/tsconfig-paths/lib/mapping-entry.d.ts +18 -0
- package/dist/compiled/tsconfig-paths/lib/match-path-async.d.ts +21 -0
- package/dist/compiled/tsconfig-paths/lib/match-path-sync.d.ts +32 -0
- package/dist/compiled/tsconfig-paths/lib/register.d.ts +12 -0
- package/dist/compiled/tsconfig-paths/lib/try-path.d.ts +15 -0
- package/dist/compiled/tsconfig-paths/lib/tsconfig-loader.d.ts +28 -0
- package/dist/compiled/tsconfig-paths/license +21 -0
- package/dist/compiled/tsconfig-paths/package.json +1 -0
- package/dist/compiled/upath/index.js +135 -0
- package/dist/compiled/upath/license +22 -0
- package/dist/compiled/upath/package.json +1 -0
- package/dist/compiled/upath/upath.d.ts +241 -0
- package/dist/compiled/url-join/index.d.ts +17 -0
- package/dist/compiled/url-join/index.js +61 -0
- package/dist/compiled/url-join/license +21 -0
- package/dist/compiled/url-join/package.json +1 -0
- package/dist/compiled/webpack-chain/index.js +1475 -0
- package/dist/compiled/webpack-chain/license +373 -0
- package/dist/compiled/webpack-chain/package.json +1 -0
- package/dist/compiled/webpack-chain/types/index.d.ts +599 -0
- package/dist/esm/cli/alias.mjs +31 -0
- package/dist/esm/cli/applyOptionsChain.mjs +16 -0
- package/dist/esm/cli/commands.mjs +23 -0
- package/dist/esm/cli/common.mjs +9 -0
- package/dist/esm/cli/config.mjs +5 -0
- package/dist/esm/cli/constants.mjs +30 -0
- package/dist/esm/cli/ensure.mjs +9 -0
- package/dist/esm/cli/fs.mjs +9 -0
- package/dist/esm/cli/get/config.mjs +14 -0
- package/dist/esm/cli/get/data.mjs +49 -0
- package/dist/esm/cli/get/index.mjs +18 -0
- package/dist/esm/cli/index.mjs +23 -0
- package/dist/esm/cli/is/config.mjs +37 -0
- package/dist/esm/cli/is/env.mjs +6 -0
- package/dist/esm/cli/is/index.mjs +4 -0
- package/dist/esm/cli/is/project.mjs +75 -0
- package/dist/esm/cli/is/type.mjs +26 -0
- package/dist/esm/cli/logger.mjs +1 -0
- package/dist/esm/cli/modulePath.mjs +33 -0
- package/dist/esm/cli/monorepo.mjs +50 -0
- package/dist/esm/cli/package.mjs +51 -0
- package/dist/esm/cli/path.mjs +35 -0
- package/dist/esm/cli/port.mjs +35 -0
- package/dist/esm/cli/prettyInstructions.mjs +70 -0
- package/dist/esm/cli/require.mjs +79 -0
- package/dist/esm/cli/route.mjs +36 -0
- package/dist/esm/cli/runtimeExports.mjs +42 -0
- package/dist/esm/cli/tsconfig.mjs +7 -0
- package/dist/esm/cli/version.mjs +24 -0
- package/dist/esm/cli/watch.mjs +40 -0
- package/dist/esm/compiled.mjs +45 -0
- package/dist/esm/import.mjs +9 -0
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/rslib-runtime.mjs +12 -0
- package/dist/esm/universal/constants.mjs +14 -0
- package/dist/esm/universal/index.mjs +1 -0
- package/dist/esm/universal/path.mjs +2 -0
- package/dist/esm/universal/pluginDagSort.mjs +41 -0
- package/dist/esm-node/cli/alias.mjs +32 -0
- package/dist/esm-node/cli/applyOptionsChain.mjs +17 -0
- package/dist/esm-node/cli/commands.mjs +24 -0
- package/dist/esm-node/cli/common.mjs +10 -0
- package/dist/esm-node/cli/config.mjs +6 -0
- package/dist/esm-node/cli/constants.mjs +31 -0
- package/dist/esm-node/cli/ensure.mjs +10 -0
- package/dist/esm-node/cli/fs.mjs +10 -0
- package/dist/esm-node/cli/get/config.mjs +15 -0
- package/dist/esm-node/cli/get/data.mjs +50 -0
- package/dist/esm-node/cli/get/index.mjs +19 -0
- package/dist/esm-node/cli/index.mjs +24 -0
- package/dist/esm-node/cli/is/config.mjs +38 -0
- package/dist/esm-node/cli/is/env.mjs +7 -0
- package/dist/esm-node/cli/is/index.mjs +5 -0
- package/dist/esm-node/cli/is/project.mjs +76 -0
- package/dist/esm-node/cli/is/type.mjs +27 -0
- package/dist/esm-node/cli/logger.mjs +2 -0
- package/dist/esm-node/cli/modulePath.mjs +34 -0
- package/dist/esm-node/cli/monorepo.mjs +51 -0
- package/dist/esm-node/cli/package.mjs +52 -0
- package/dist/esm-node/cli/path.mjs +36 -0
- package/dist/esm-node/cli/port.mjs +36 -0
- package/dist/esm-node/cli/prettyInstructions.mjs +71 -0
- package/dist/esm-node/cli/require.mjs +80 -0
- package/dist/esm-node/cli/route.mjs +37 -0
- package/dist/esm-node/cli/runtimeExports.mjs +43 -0
- package/dist/esm-node/cli/tsconfig.mjs +8 -0
- package/dist/esm-node/cli/version.mjs +25 -0
- package/dist/esm-node/cli/watch.mjs +41 -0
- package/dist/esm-node/compiled.mjs +45 -0
- package/dist/esm-node/import.mjs +10 -0
- package/dist/esm-node/index.mjs +4 -0
- package/dist/esm-node/universal/constants.mjs +15 -0
- package/dist/esm-node/universal/index.mjs +2 -0
- package/dist/esm-node/universal/path.mjs +3 -0
- package/dist/esm-node/universal/pluginDagSort.mjs +42 -0
- package/dist/types/cli/alias.d.ts +20 -0
- package/dist/types/cli/applyOptionsChain.d.ts +3 -0
- package/dist/types/cli/commands.d.ts +8 -0
- package/dist/types/cli/common.d.ts +9 -0
- package/dist/types/cli/config.d.ts +4 -0
- package/dist/types/cli/constants.d.ts +55 -0
- package/dist/types/cli/ensure.d.ts +8 -0
- package/dist/types/cli/fs.d.ts +7 -0
- package/dist/types/cli/get/config.d.ts +1 -0
- package/dist/types/cli/get/data.d.ts +6 -0
- package/dist/types/cli/get/index.d.ts +11 -0
- package/dist/types/cli/index.d.ts +23 -0
- package/dist/types/cli/is/config.d.ts +22 -0
- package/dist/types/cli/is/env.d.ts +8 -0
- package/dist/types/cli/is/index.d.ts +4 -0
- package/dist/types/cli/is/project.d.ts +39 -0
- package/dist/types/cli/is/type.d.ts +15 -0
- package/dist/types/cli/logger.d.ts +1 -0
- package/dist/types/cli/modulePath.d.ts +5 -0
- package/dist/types/cli/monorepo.d.ts +9 -0
- package/dist/types/cli/package.d.ts +5 -0
- package/dist/types/cli/path.d.ts +11 -0
- package/dist/types/cli/port.d.ts +12 -0
- package/dist/types/cli/prettyInstructions.d.ts +9 -0
- package/dist/types/cli/require.d.ts +9 -0
- package/dist/types/cli/route.d.ts +4 -0
- package/dist/types/cli/runtimeExports.d.ts +5 -0
- package/dist/types/cli/tsconfig.d.ts +1 -0
- package/dist/types/cli/version.d.ts +4 -0
- package/dist/types/cli/watch.d.ts +8 -0
- package/dist/types/compiled.d.ts +37 -0
- package/dist/types/import.d.ts +5 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/universal/constants.d.ts +47 -0
- package/dist/types/universal/index.d.ts +1 -0
- package/dist/types/universal/path.d.ts +1 -0
- package/dist/types/universal/pluginDagSort.d.ts +1 -0
- package/package.json +174 -0
- package/rslib.config.mts +162 -0
- package/rstest.config.mts +8 -0
|
@@ -0,0 +1,1540 @@
|
|
|
1
|
+
(()=>{
|
|
2
|
+
var t = {
|
|
3
|
+
81: (t)=>{
|
|
4
|
+
"use strict";
|
|
5
|
+
t.exports = require("child_process");
|
|
6
|
+
},
|
|
7
|
+
361: (t)=>{
|
|
8
|
+
"use strict";
|
|
9
|
+
t.exports = require("events");
|
|
10
|
+
},
|
|
11
|
+
147: (t)=>{
|
|
12
|
+
"use strict";
|
|
13
|
+
t.exports = require("fs");
|
|
14
|
+
},
|
|
15
|
+
17: (t)=>{
|
|
16
|
+
"use strict";
|
|
17
|
+
t.exports = require("path");
|
|
18
|
+
},
|
|
19
|
+
282: (t)=>{
|
|
20
|
+
"use strict";
|
|
21
|
+
t.exports = require("process");
|
|
22
|
+
},
|
|
23
|
+
632: (t, e, i)=>{
|
|
24
|
+
const { Argument: n } = i(535);
|
|
25
|
+
const { Command: s } = i(302);
|
|
26
|
+
const { CommanderError: r, InvalidArgumentError: o } = i(796);
|
|
27
|
+
const { Help: a } = i(519);
|
|
28
|
+
const { Option: l } = i(437);
|
|
29
|
+
e = t.exports = new s;
|
|
30
|
+
e.program = e;
|
|
31
|
+
e.Argument = n;
|
|
32
|
+
e.Command = s;
|
|
33
|
+
e.CommanderError = r;
|
|
34
|
+
e.Help = a;
|
|
35
|
+
e.InvalidArgumentError = o;
|
|
36
|
+
e.InvalidOptionArgumentError = o;
|
|
37
|
+
e.Option = l;
|
|
38
|
+
},
|
|
39
|
+
535: (t, e, i)=>{
|
|
40
|
+
const { InvalidArgumentError: n } = i(796);
|
|
41
|
+
class Argument {
|
|
42
|
+
constructor(t, e){
|
|
43
|
+
this.description = e || "";
|
|
44
|
+
this.variadic = false;
|
|
45
|
+
this.parseArg = void 0;
|
|
46
|
+
this.defaultValue = void 0;
|
|
47
|
+
this.defaultValueDescription = void 0;
|
|
48
|
+
this.argChoices = void 0;
|
|
49
|
+
switch(t[0]){
|
|
50
|
+
case "<":
|
|
51
|
+
this.required = true;
|
|
52
|
+
this._name = t.slice(1, -1);
|
|
53
|
+
break;
|
|
54
|
+
case "[":
|
|
55
|
+
this.required = false;
|
|
56
|
+
this._name = t.slice(1, -1);
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
this.required = true;
|
|
60
|
+
this._name = t;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
if (this._name.length > 3 && "..." === this._name.slice(-3)) {
|
|
64
|
+
this.variadic = true;
|
|
65
|
+
this._name = this._name.slice(0, -3);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
name() {
|
|
69
|
+
return this._name;
|
|
70
|
+
}
|
|
71
|
+
_concatValue(t, e) {
|
|
72
|
+
if (e === this.defaultValue || !Array.isArray(e)) return [
|
|
73
|
+
t
|
|
74
|
+
];
|
|
75
|
+
return e.concat(t);
|
|
76
|
+
}
|
|
77
|
+
default(t, e) {
|
|
78
|
+
this.defaultValue = t;
|
|
79
|
+
this.defaultValueDescription = e;
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
argParser(t) {
|
|
83
|
+
this.parseArg = t;
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
choices(t) {
|
|
87
|
+
this.argChoices = t.slice();
|
|
88
|
+
this.parseArg = (t, e)=>{
|
|
89
|
+
if (!this.argChoices.includes(t)) throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);
|
|
90
|
+
if (this.variadic) return this._concatValue(t, e);
|
|
91
|
+
return t;
|
|
92
|
+
};
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
argRequired() {
|
|
96
|
+
this.required = true;
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
argOptional() {
|
|
100
|
+
this.required = false;
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function humanReadableArgName(t) {
|
|
105
|
+
const e = t.name() + (true === t.variadic ? "..." : "");
|
|
106
|
+
return t.required ? "<" + e + ">" : "[" + e + "]";
|
|
107
|
+
}
|
|
108
|
+
e.Argument = Argument;
|
|
109
|
+
e.humanReadableArgName = humanReadableArgName;
|
|
110
|
+
},
|
|
111
|
+
302: (t, e, i)=>{
|
|
112
|
+
const n = i(361).EventEmitter;
|
|
113
|
+
const s = i(81);
|
|
114
|
+
const r = i(17);
|
|
115
|
+
const o = i(147);
|
|
116
|
+
const a = i(282);
|
|
117
|
+
const { Argument: l, humanReadableArgName: h } = i(535);
|
|
118
|
+
const { CommanderError: u } = i(796);
|
|
119
|
+
const { Help: c } = i(519);
|
|
120
|
+
const { Option: p, splitOptionFlags: m, DualOptions: d } = i(437);
|
|
121
|
+
const { suggestSimilar: f } = i(860);
|
|
122
|
+
class Command extends n {
|
|
123
|
+
constructor(t){
|
|
124
|
+
super();
|
|
125
|
+
this.commands = [];
|
|
126
|
+
this.options = [];
|
|
127
|
+
this.parent = null;
|
|
128
|
+
this._allowUnknownOption = false;
|
|
129
|
+
this._allowExcessArguments = true;
|
|
130
|
+
this._args = [];
|
|
131
|
+
this.args = [];
|
|
132
|
+
this.rawArgs = [];
|
|
133
|
+
this.processedArgs = [];
|
|
134
|
+
this._scriptPath = null;
|
|
135
|
+
this._name = t || "";
|
|
136
|
+
this._optionValues = {};
|
|
137
|
+
this._optionValueSources = {};
|
|
138
|
+
this._storeOptionsAsProperties = false;
|
|
139
|
+
this._actionHandler = null;
|
|
140
|
+
this._executableHandler = false;
|
|
141
|
+
this._executableFile = null;
|
|
142
|
+
this._executableDir = null;
|
|
143
|
+
this._defaultCommandName = null;
|
|
144
|
+
this._exitCallback = null;
|
|
145
|
+
this._aliases = [];
|
|
146
|
+
this._combineFlagAndOptionalValue = true;
|
|
147
|
+
this._description = "";
|
|
148
|
+
this._summary = "";
|
|
149
|
+
this._argsDescription = void 0;
|
|
150
|
+
this._enablePositionalOptions = false;
|
|
151
|
+
this._passThroughOptions = false;
|
|
152
|
+
this._lifeCycleHooks = {};
|
|
153
|
+
this._showHelpAfterError = false;
|
|
154
|
+
this._showSuggestionAfterError = true;
|
|
155
|
+
this._outputConfiguration = {
|
|
156
|
+
writeOut: (t)=>a.stdout.write(t),
|
|
157
|
+
writeErr: (t)=>a.stderr.write(t),
|
|
158
|
+
getOutHelpWidth: ()=>a.stdout.isTTY ? a.stdout.columns : void 0,
|
|
159
|
+
getErrHelpWidth: ()=>a.stderr.isTTY ? a.stderr.columns : void 0,
|
|
160
|
+
outputError: (t, e)=>e(t)
|
|
161
|
+
};
|
|
162
|
+
this._hidden = false;
|
|
163
|
+
this._hasHelpOption = true;
|
|
164
|
+
this._helpFlags = "-h, --help";
|
|
165
|
+
this._helpDescription = "display help for command";
|
|
166
|
+
this._helpShortFlag = "-h";
|
|
167
|
+
this._helpLongFlag = "--help";
|
|
168
|
+
this._addImplicitHelpCommand = void 0;
|
|
169
|
+
this._helpCommandName = "help";
|
|
170
|
+
this._helpCommandnameAndArgs = "help [command]";
|
|
171
|
+
this._helpCommandDescription = "display help for command";
|
|
172
|
+
this._helpConfiguration = {};
|
|
173
|
+
}
|
|
174
|
+
copyInheritedSettings(t) {
|
|
175
|
+
this._outputConfiguration = t._outputConfiguration;
|
|
176
|
+
this._hasHelpOption = t._hasHelpOption;
|
|
177
|
+
this._helpFlags = t._helpFlags;
|
|
178
|
+
this._helpDescription = t._helpDescription;
|
|
179
|
+
this._helpShortFlag = t._helpShortFlag;
|
|
180
|
+
this._helpLongFlag = t._helpLongFlag;
|
|
181
|
+
this._helpCommandName = t._helpCommandName;
|
|
182
|
+
this._helpCommandnameAndArgs = t._helpCommandnameAndArgs;
|
|
183
|
+
this._helpCommandDescription = t._helpCommandDescription;
|
|
184
|
+
this._helpConfiguration = t._helpConfiguration;
|
|
185
|
+
this._exitCallback = t._exitCallback;
|
|
186
|
+
this._storeOptionsAsProperties = t._storeOptionsAsProperties;
|
|
187
|
+
this._combineFlagAndOptionalValue = t._combineFlagAndOptionalValue;
|
|
188
|
+
this._allowExcessArguments = t._allowExcessArguments;
|
|
189
|
+
this._enablePositionalOptions = t._enablePositionalOptions;
|
|
190
|
+
this._showHelpAfterError = t._showHelpAfterError;
|
|
191
|
+
this._showSuggestionAfterError = t._showSuggestionAfterError;
|
|
192
|
+
return this;
|
|
193
|
+
}
|
|
194
|
+
command(t, e, i) {
|
|
195
|
+
let n = e;
|
|
196
|
+
let s = i;
|
|
197
|
+
if ("object" == typeof n && null !== n) {
|
|
198
|
+
s = n;
|
|
199
|
+
n = null;
|
|
200
|
+
}
|
|
201
|
+
s = s || {};
|
|
202
|
+
const [, r, o] = t.match(/([^ ]+) *(.*)/);
|
|
203
|
+
const a = this.createCommand(r);
|
|
204
|
+
if (n) {
|
|
205
|
+
a.description(n);
|
|
206
|
+
a._executableHandler = true;
|
|
207
|
+
}
|
|
208
|
+
if (s.isDefault) this._defaultCommandName = a._name;
|
|
209
|
+
a._hidden = !!(s.noHelp || s.hidden);
|
|
210
|
+
a._executableFile = s.executableFile || null;
|
|
211
|
+
if (o) a.arguments(o);
|
|
212
|
+
this.commands.push(a);
|
|
213
|
+
a.parent = this;
|
|
214
|
+
a.copyInheritedSettings(this);
|
|
215
|
+
if (n) return this;
|
|
216
|
+
return a;
|
|
217
|
+
}
|
|
218
|
+
createCommand(t) {
|
|
219
|
+
return new Command(t);
|
|
220
|
+
}
|
|
221
|
+
createHelp() {
|
|
222
|
+
return Object.assign(new c, this.configureHelp());
|
|
223
|
+
}
|
|
224
|
+
configureHelp(t) {
|
|
225
|
+
if (void 0 === t) return this._helpConfiguration;
|
|
226
|
+
this._helpConfiguration = t;
|
|
227
|
+
return this;
|
|
228
|
+
}
|
|
229
|
+
configureOutput(t) {
|
|
230
|
+
if (void 0 === t) return this._outputConfiguration;
|
|
231
|
+
Object.assign(this._outputConfiguration, t);
|
|
232
|
+
return this;
|
|
233
|
+
}
|
|
234
|
+
showHelpAfterError(t = true) {
|
|
235
|
+
if ("string" != typeof t) t = !!t;
|
|
236
|
+
this._showHelpAfterError = t;
|
|
237
|
+
return this;
|
|
238
|
+
}
|
|
239
|
+
showSuggestionAfterError(t = true) {
|
|
240
|
+
this._showSuggestionAfterError = !!t;
|
|
241
|
+
return this;
|
|
242
|
+
}
|
|
243
|
+
addCommand(t, e) {
|
|
244
|
+
if (!t._name) throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`);
|
|
245
|
+
e = e || {};
|
|
246
|
+
if (e.isDefault) this._defaultCommandName = t._name;
|
|
247
|
+
if (e.noHelp || e.hidden) t._hidden = true;
|
|
248
|
+
this.commands.push(t);
|
|
249
|
+
t.parent = this;
|
|
250
|
+
return this;
|
|
251
|
+
}
|
|
252
|
+
createArgument(t, e) {
|
|
253
|
+
return new l(t, e);
|
|
254
|
+
}
|
|
255
|
+
argument(t, e, i, n) {
|
|
256
|
+
const s = this.createArgument(t, e);
|
|
257
|
+
if ("function" == typeof i) s.default(n).argParser(i);
|
|
258
|
+
else s.default(i);
|
|
259
|
+
this.addArgument(s);
|
|
260
|
+
return this;
|
|
261
|
+
}
|
|
262
|
+
arguments(t) {
|
|
263
|
+
t.split(/ +/).forEach((t)=>{
|
|
264
|
+
this.argument(t);
|
|
265
|
+
});
|
|
266
|
+
return this;
|
|
267
|
+
}
|
|
268
|
+
addArgument(t) {
|
|
269
|
+
const e = this._args.slice(-1)[0];
|
|
270
|
+
if (e && e.variadic) throw new Error(`only the last argument can be variadic '${e.name()}'`);
|
|
271
|
+
if (t.required && void 0 !== t.defaultValue && void 0 === t.parseArg) throw new Error(`a default value for a required argument is never used: '${t.name()}'`);
|
|
272
|
+
this._args.push(t);
|
|
273
|
+
return this;
|
|
274
|
+
}
|
|
275
|
+
addHelpCommand(t, e) {
|
|
276
|
+
if (false === t) this._addImplicitHelpCommand = false;
|
|
277
|
+
else {
|
|
278
|
+
this._addImplicitHelpCommand = true;
|
|
279
|
+
if ("string" == typeof t) {
|
|
280
|
+
this._helpCommandName = t.split(" ")[0];
|
|
281
|
+
this._helpCommandnameAndArgs = t;
|
|
282
|
+
}
|
|
283
|
+
this._helpCommandDescription = e || this._helpCommandDescription;
|
|
284
|
+
}
|
|
285
|
+
return this;
|
|
286
|
+
}
|
|
287
|
+
_hasImplicitHelpCommand() {
|
|
288
|
+
if (void 0 === this._addImplicitHelpCommand) return this.commands.length && !this._actionHandler && !this._findCommand("help");
|
|
289
|
+
return this._addImplicitHelpCommand;
|
|
290
|
+
}
|
|
291
|
+
hook(t, e) {
|
|
292
|
+
const i = [
|
|
293
|
+
"preSubcommand",
|
|
294
|
+
"preAction",
|
|
295
|
+
"postAction"
|
|
296
|
+
];
|
|
297
|
+
if (!i.includes(t)) throw new Error(`Unexpected value for event passed to hook : '${t}'.\nExpecting one of '${i.join("', '")}'`);
|
|
298
|
+
if (this._lifeCycleHooks[t]) this._lifeCycleHooks[t].push(e);
|
|
299
|
+
else this._lifeCycleHooks[t] = [
|
|
300
|
+
e
|
|
301
|
+
];
|
|
302
|
+
return this;
|
|
303
|
+
}
|
|
304
|
+
exitOverride(t) {
|
|
305
|
+
if (t) this._exitCallback = t;
|
|
306
|
+
else this._exitCallback = (t)=>{
|
|
307
|
+
if ("commander.executeSubCommandAsync" !== t.code) throw t;
|
|
308
|
+
};
|
|
309
|
+
return this;
|
|
310
|
+
}
|
|
311
|
+
_exit(t, e, i) {
|
|
312
|
+
if (this._exitCallback) this._exitCallback(new u(t, e, i));
|
|
313
|
+
a.exit(t);
|
|
314
|
+
}
|
|
315
|
+
action(t) {
|
|
316
|
+
const listener = (e)=>{
|
|
317
|
+
const i = this._args.length;
|
|
318
|
+
const n = e.slice(0, i);
|
|
319
|
+
if (this._storeOptionsAsProperties) n[i] = this;
|
|
320
|
+
else n[i] = this.opts();
|
|
321
|
+
n.push(this);
|
|
322
|
+
return t.apply(this, n);
|
|
323
|
+
};
|
|
324
|
+
this._actionHandler = listener;
|
|
325
|
+
return this;
|
|
326
|
+
}
|
|
327
|
+
createOption(t, e) {
|
|
328
|
+
return new p(t, e);
|
|
329
|
+
}
|
|
330
|
+
addOption(t) {
|
|
331
|
+
const e = t.name();
|
|
332
|
+
const i = t.attributeName();
|
|
333
|
+
if (t.negate) {
|
|
334
|
+
const e = t.long.replace(/^--no-/, "--");
|
|
335
|
+
if (!this._findOption(e)) this.setOptionValueWithSource(i, void 0 === t.defaultValue ? true : t.defaultValue, "default");
|
|
336
|
+
} else if (void 0 !== t.defaultValue) this.setOptionValueWithSource(i, t.defaultValue, "default");
|
|
337
|
+
this.options.push(t);
|
|
338
|
+
const handleOptionValue = (e, n, s)=>{
|
|
339
|
+
if (null == e && void 0 !== t.presetArg) e = t.presetArg;
|
|
340
|
+
const r = this.getOptionValue(i);
|
|
341
|
+
if (null !== e && t.parseArg) try {
|
|
342
|
+
e = t.parseArg(e, r);
|
|
343
|
+
} catch (t) {
|
|
344
|
+
if ("commander.invalidArgument" === t.code) {
|
|
345
|
+
const e = `${n} ${t.message}`;
|
|
346
|
+
this.error(e, {
|
|
347
|
+
exitCode: t.exitCode,
|
|
348
|
+
code: t.code
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
throw t;
|
|
352
|
+
}
|
|
353
|
+
else if (null !== e && t.variadic) e = t._concatValue(e, r);
|
|
354
|
+
if (null == e) e = t.negate ? false : t.isBoolean() || t.optional ? true : "";
|
|
355
|
+
this.setOptionValueWithSource(i, e, s);
|
|
356
|
+
};
|
|
357
|
+
this.on("option:" + e, (e)=>{
|
|
358
|
+
const i = `error: option '${t.flags}' argument '${e}' is invalid.`;
|
|
359
|
+
handleOptionValue(e, i, "cli");
|
|
360
|
+
});
|
|
361
|
+
if (t.envVar) this.on("optionEnv:" + e, (e)=>{
|
|
362
|
+
const i = `error: option '${t.flags}' value '${e}' from env '${t.envVar}' is invalid.`;
|
|
363
|
+
handleOptionValue(e, i, "env");
|
|
364
|
+
});
|
|
365
|
+
return this;
|
|
366
|
+
}
|
|
367
|
+
_optionEx(t, e, i, n, s) {
|
|
368
|
+
if ("object" == typeof e && e instanceof p) throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");
|
|
369
|
+
const r = this.createOption(e, i);
|
|
370
|
+
r.makeOptionMandatory(!!t.mandatory);
|
|
371
|
+
if ("function" == typeof n) r.default(s).argParser(n);
|
|
372
|
+
else if (n instanceof RegExp) {
|
|
373
|
+
const t = n;
|
|
374
|
+
n = (e, i)=>{
|
|
375
|
+
const n = t.exec(e);
|
|
376
|
+
return n ? n[0] : i;
|
|
377
|
+
};
|
|
378
|
+
r.default(s).argParser(n);
|
|
379
|
+
} else r.default(n);
|
|
380
|
+
return this.addOption(r);
|
|
381
|
+
}
|
|
382
|
+
option(t, e, i, n) {
|
|
383
|
+
return this._optionEx({}, t, e, i, n);
|
|
384
|
+
}
|
|
385
|
+
requiredOption(t, e, i, n) {
|
|
386
|
+
return this._optionEx({
|
|
387
|
+
mandatory: true
|
|
388
|
+
}, t, e, i, n);
|
|
389
|
+
}
|
|
390
|
+
combineFlagAndOptionalValue(t = true) {
|
|
391
|
+
this._combineFlagAndOptionalValue = !!t;
|
|
392
|
+
return this;
|
|
393
|
+
}
|
|
394
|
+
allowUnknownOption(t = true) {
|
|
395
|
+
this._allowUnknownOption = !!t;
|
|
396
|
+
return this;
|
|
397
|
+
}
|
|
398
|
+
allowExcessArguments(t = true) {
|
|
399
|
+
this._allowExcessArguments = !!t;
|
|
400
|
+
return this;
|
|
401
|
+
}
|
|
402
|
+
enablePositionalOptions(t = true) {
|
|
403
|
+
this._enablePositionalOptions = !!t;
|
|
404
|
+
return this;
|
|
405
|
+
}
|
|
406
|
+
passThroughOptions(t = true) {
|
|
407
|
+
this._passThroughOptions = !!t;
|
|
408
|
+
if (!!this.parent && t && !this.parent._enablePositionalOptions) throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");
|
|
409
|
+
return this;
|
|
410
|
+
}
|
|
411
|
+
storeOptionsAsProperties(t = true) {
|
|
412
|
+
this._storeOptionsAsProperties = !!t;
|
|
413
|
+
if (this.options.length) throw new Error("call .storeOptionsAsProperties() before adding options");
|
|
414
|
+
return this;
|
|
415
|
+
}
|
|
416
|
+
getOptionValue(t) {
|
|
417
|
+
if (this._storeOptionsAsProperties) return this[t];
|
|
418
|
+
return this._optionValues[t];
|
|
419
|
+
}
|
|
420
|
+
setOptionValue(t, e) {
|
|
421
|
+
return this.setOptionValueWithSource(t, e, void 0);
|
|
422
|
+
}
|
|
423
|
+
setOptionValueWithSource(t, e, i) {
|
|
424
|
+
if (this._storeOptionsAsProperties) this[t] = e;
|
|
425
|
+
else this._optionValues[t] = e;
|
|
426
|
+
this._optionValueSources[t] = i;
|
|
427
|
+
return this;
|
|
428
|
+
}
|
|
429
|
+
getOptionValueSource(t) {
|
|
430
|
+
return this._optionValueSources[t];
|
|
431
|
+
}
|
|
432
|
+
getOptionValueSourceWithGlobals(t) {
|
|
433
|
+
let e;
|
|
434
|
+
getCommandAndParents(this).forEach((i)=>{
|
|
435
|
+
if (void 0 !== i.getOptionValueSource(t)) e = i.getOptionValueSource(t);
|
|
436
|
+
});
|
|
437
|
+
return e;
|
|
438
|
+
}
|
|
439
|
+
_prepareUserArgs(t, e) {
|
|
440
|
+
if (void 0 !== t && !Array.isArray(t)) throw new Error("first parameter to parse must be array or undefined");
|
|
441
|
+
e = e || {};
|
|
442
|
+
if (void 0 === t) {
|
|
443
|
+
t = a.argv;
|
|
444
|
+
if (a.versions && a.versions.electron) e.from = "electron";
|
|
445
|
+
}
|
|
446
|
+
this.rawArgs = t.slice();
|
|
447
|
+
let i;
|
|
448
|
+
switch(e.from){
|
|
449
|
+
case void 0:
|
|
450
|
+
case "node":
|
|
451
|
+
this._scriptPath = t[1];
|
|
452
|
+
i = t.slice(2);
|
|
453
|
+
break;
|
|
454
|
+
case "electron":
|
|
455
|
+
if (a.defaultApp) {
|
|
456
|
+
this._scriptPath = t[1];
|
|
457
|
+
i = t.slice(2);
|
|
458
|
+
} else i = t.slice(1);
|
|
459
|
+
break;
|
|
460
|
+
case "user":
|
|
461
|
+
i = t.slice(0);
|
|
462
|
+
break;
|
|
463
|
+
default:
|
|
464
|
+
throw new Error(`unexpected parse option { from: '${e.from}' }`);
|
|
465
|
+
}
|
|
466
|
+
if (!this._name && this._scriptPath) this.nameFromFilename(this._scriptPath);
|
|
467
|
+
this._name = this._name || "program";
|
|
468
|
+
return i;
|
|
469
|
+
}
|
|
470
|
+
parse(t, e) {
|
|
471
|
+
const i = this._prepareUserArgs(t, e);
|
|
472
|
+
this._parseCommand([], i);
|
|
473
|
+
return this;
|
|
474
|
+
}
|
|
475
|
+
async parseAsync(t, e) {
|
|
476
|
+
const i = this._prepareUserArgs(t, e);
|
|
477
|
+
await this._parseCommand([], i);
|
|
478
|
+
return this;
|
|
479
|
+
}
|
|
480
|
+
_executeSubCommand(t, e) {
|
|
481
|
+
e = e.slice();
|
|
482
|
+
let i = false;
|
|
483
|
+
const n = [
|
|
484
|
+
".js",
|
|
485
|
+
".ts",
|
|
486
|
+
".tsx",
|
|
487
|
+
".mjs",
|
|
488
|
+
".cjs"
|
|
489
|
+
];
|
|
490
|
+
function findFile(t, e) {
|
|
491
|
+
const i = r.resolve(t, e);
|
|
492
|
+
if (o.existsSync(i)) return i;
|
|
493
|
+
if (n.includes(r.extname(e))) return;
|
|
494
|
+
const s = n.find((t)=>o.existsSync(`${i}${t}`));
|
|
495
|
+
if (s) return `${i}${s}`;
|
|
496
|
+
}
|
|
497
|
+
this._checkForMissingMandatoryOptions();
|
|
498
|
+
this._checkForConflictingOptions();
|
|
499
|
+
let l = t._executableFile || `${this._name}-${t._name}`;
|
|
500
|
+
let h = this._executableDir || "";
|
|
501
|
+
if (this._scriptPath) {
|
|
502
|
+
let t;
|
|
503
|
+
try {
|
|
504
|
+
t = o.realpathSync(this._scriptPath);
|
|
505
|
+
} catch (e) {
|
|
506
|
+
t = this._scriptPath;
|
|
507
|
+
}
|
|
508
|
+
h = r.resolve(r.dirname(t), h);
|
|
509
|
+
}
|
|
510
|
+
if (h) {
|
|
511
|
+
let e = findFile(h, l);
|
|
512
|
+
if (!e && !t._executableFile && this._scriptPath) {
|
|
513
|
+
const i = r.basename(this._scriptPath, r.extname(this._scriptPath));
|
|
514
|
+
if (i !== this._name) e = findFile(h, `${i}-${t._name}`);
|
|
515
|
+
}
|
|
516
|
+
l = e || l;
|
|
517
|
+
}
|
|
518
|
+
i = n.includes(r.extname(l));
|
|
519
|
+
let c;
|
|
520
|
+
if ("win32" !== a.platform) if (i) {
|
|
521
|
+
e.unshift(l);
|
|
522
|
+
e = incrementNodeInspectorPort(a.execArgv).concat(e);
|
|
523
|
+
c = s.spawn(a.argv[0], e, {
|
|
524
|
+
stdio: "inherit"
|
|
525
|
+
});
|
|
526
|
+
} else c = s.spawn(l, e, {
|
|
527
|
+
stdio: "inherit"
|
|
528
|
+
});
|
|
529
|
+
else {
|
|
530
|
+
e.unshift(l);
|
|
531
|
+
e = incrementNodeInspectorPort(a.execArgv).concat(e);
|
|
532
|
+
c = s.spawn(a.execPath, e, {
|
|
533
|
+
stdio: "inherit"
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
if (!c.killed) {
|
|
537
|
+
const t = [
|
|
538
|
+
"SIGUSR1",
|
|
539
|
+
"SIGUSR2",
|
|
540
|
+
"SIGTERM",
|
|
541
|
+
"SIGINT",
|
|
542
|
+
"SIGHUP"
|
|
543
|
+
];
|
|
544
|
+
t.forEach((t)=>{
|
|
545
|
+
a.on(t, ()=>{
|
|
546
|
+
if (false === c.killed && null === c.exitCode) c.kill(t);
|
|
547
|
+
});
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
const p = this._exitCallback;
|
|
551
|
+
if (p) c.on("close", ()=>{
|
|
552
|
+
p(new u(a.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
|
|
553
|
+
});
|
|
554
|
+
else c.on("close", a.exit.bind(a));
|
|
555
|
+
c.on("error", (e)=>{
|
|
556
|
+
if ("ENOENT" === e.code) {
|
|
557
|
+
const e = h ? `searched for local subcommand relative to directory '${h}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
558
|
+
const i = `'${l}' does not exist\n - if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${e}`;
|
|
559
|
+
throw new Error(i);
|
|
560
|
+
}
|
|
561
|
+
if ("EACCES" === e.code) throw new Error(`'${l}' not executable`);
|
|
562
|
+
if (p) {
|
|
563
|
+
const t = new u(1, "commander.executeSubCommandAsync", "(error)");
|
|
564
|
+
t.nestedError = e;
|
|
565
|
+
p(t);
|
|
566
|
+
} else a.exit(1);
|
|
567
|
+
});
|
|
568
|
+
this.runningCommand = c;
|
|
569
|
+
}
|
|
570
|
+
_dispatchSubcommand(t, e, i) {
|
|
571
|
+
const n = this._findCommand(t);
|
|
572
|
+
if (!n) this.help({
|
|
573
|
+
error: true
|
|
574
|
+
});
|
|
575
|
+
let s;
|
|
576
|
+
s = this._chainOrCallSubCommandHook(s, n, "preSubcommand");
|
|
577
|
+
s = this._chainOrCall(s, ()=>{
|
|
578
|
+
if (!n._executableHandler) return n._parseCommand(e, i);
|
|
579
|
+
this._executeSubCommand(n, e.concat(i));
|
|
580
|
+
});
|
|
581
|
+
return s;
|
|
582
|
+
}
|
|
583
|
+
_checkNumberOfArguments() {
|
|
584
|
+
this._args.forEach((t, e)=>{
|
|
585
|
+
if (t.required && null == this.args[e]) this.missingArgument(t.name());
|
|
586
|
+
});
|
|
587
|
+
if (this._args.length > 0 && this._args[this._args.length - 1].variadic) return;
|
|
588
|
+
if (this.args.length > this._args.length) this._excessArguments(this.args);
|
|
589
|
+
}
|
|
590
|
+
_processArguments() {
|
|
591
|
+
const myParseArg = (t, e, i)=>{
|
|
592
|
+
let n = e;
|
|
593
|
+
if (null !== e && t.parseArg) try {
|
|
594
|
+
n = t.parseArg(e, i);
|
|
595
|
+
} catch (i) {
|
|
596
|
+
if ("commander.invalidArgument" === i.code) {
|
|
597
|
+
const n = `error: command-argument value '${e}' is invalid for argument '${t.name()}'. ${i.message}`;
|
|
598
|
+
this.error(n, {
|
|
599
|
+
exitCode: i.exitCode,
|
|
600
|
+
code: i.code
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
throw i;
|
|
604
|
+
}
|
|
605
|
+
return n;
|
|
606
|
+
};
|
|
607
|
+
this._checkNumberOfArguments();
|
|
608
|
+
const t = [];
|
|
609
|
+
this._args.forEach((e, i)=>{
|
|
610
|
+
let n = e.defaultValue;
|
|
611
|
+
if (e.variadic) {
|
|
612
|
+
if (i < this.args.length) {
|
|
613
|
+
n = this.args.slice(i);
|
|
614
|
+
if (e.parseArg) n = n.reduce((t, i)=>myParseArg(e, i, t), e.defaultValue);
|
|
615
|
+
} else if (void 0 === n) n = [];
|
|
616
|
+
} else if (i < this.args.length) {
|
|
617
|
+
n = this.args[i];
|
|
618
|
+
if (e.parseArg) n = myParseArg(e, n, e.defaultValue);
|
|
619
|
+
}
|
|
620
|
+
t[i] = n;
|
|
621
|
+
});
|
|
622
|
+
this.processedArgs = t;
|
|
623
|
+
}
|
|
624
|
+
_chainOrCall(t, e) {
|
|
625
|
+
if (t && t.then && "function" == typeof t.then) return t.then(()=>e());
|
|
626
|
+
return e();
|
|
627
|
+
}
|
|
628
|
+
_chainOrCallHooks(t, e) {
|
|
629
|
+
let i = t;
|
|
630
|
+
const n = [];
|
|
631
|
+
getCommandAndParents(this).reverse().filter((t)=>void 0 !== t._lifeCycleHooks[e]).forEach((t)=>{
|
|
632
|
+
t._lifeCycleHooks[e].forEach((e)=>{
|
|
633
|
+
n.push({
|
|
634
|
+
hookedCommand: t,
|
|
635
|
+
callback: e
|
|
636
|
+
});
|
|
637
|
+
});
|
|
638
|
+
});
|
|
639
|
+
if ("postAction" === e) n.reverse();
|
|
640
|
+
n.forEach((t)=>{
|
|
641
|
+
i = this._chainOrCall(i, ()=>t.callback(t.hookedCommand, this));
|
|
642
|
+
});
|
|
643
|
+
return i;
|
|
644
|
+
}
|
|
645
|
+
_chainOrCallSubCommandHook(t, e, i) {
|
|
646
|
+
let n = t;
|
|
647
|
+
if (void 0 !== this._lifeCycleHooks[i]) this._lifeCycleHooks[i].forEach((t)=>{
|
|
648
|
+
n = this._chainOrCall(n, ()=>t(this, e));
|
|
649
|
+
});
|
|
650
|
+
return n;
|
|
651
|
+
}
|
|
652
|
+
_parseCommand(t, e) {
|
|
653
|
+
const i = this.parseOptions(e);
|
|
654
|
+
this._parseOptionsEnv();
|
|
655
|
+
this._parseOptionsImplied();
|
|
656
|
+
t = t.concat(i.operands);
|
|
657
|
+
e = i.unknown;
|
|
658
|
+
this.args = t.concat(e);
|
|
659
|
+
if (t && this._findCommand(t[0])) return this._dispatchSubcommand(t[0], t.slice(1), e);
|
|
660
|
+
if (this._hasImplicitHelpCommand() && t[0] === this._helpCommandName) {
|
|
661
|
+
if (1 === t.length) this.help();
|
|
662
|
+
return this._dispatchSubcommand(t[1], [], [
|
|
663
|
+
this._helpLongFlag
|
|
664
|
+
]);
|
|
665
|
+
}
|
|
666
|
+
if (this._defaultCommandName) {
|
|
667
|
+
outputHelpIfRequested(this, e);
|
|
668
|
+
return this._dispatchSubcommand(this._defaultCommandName, t, e);
|
|
669
|
+
}
|
|
670
|
+
if (this.commands.length && 0 === this.args.length && !this._actionHandler && !this._defaultCommandName) this.help({
|
|
671
|
+
error: true
|
|
672
|
+
});
|
|
673
|
+
outputHelpIfRequested(this, i.unknown);
|
|
674
|
+
this._checkForMissingMandatoryOptions();
|
|
675
|
+
this._checkForConflictingOptions();
|
|
676
|
+
const checkForUnknownOptions = ()=>{
|
|
677
|
+
if (i.unknown.length > 0) this.unknownOption(i.unknown[0]);
|
|
678
|
+
};
|
|
679
|
+
const n = `command:${this.name()}`;
|
|
680
|
+
if (this._actionHandler) {
|
|
681
|
+
checkForUnknownOptions();
|
|
682
|
+
this._processArguments();
|
|
683
|
+
let i;
|
|
684
|
+
i = this._chainOrCallHooks(i, "preAction");
|
|
685
|
+
i = this._chainOrCall(i, ()=>this._actionHandler(this.processedArgs));
|
|
686
|
+
if (this.parent) i = this._chainOrCall(i, ()=>{
|
|
687
|
+
this.parent.emit(n, t, e);
|
|
688
|
+
});
|
|
689
|
+
i = this._chainOrCallHooks(i, "postAction");
|
|
690
|
+
return i;
|
|
691
|
+
}
|
|
692
|
+
if (this.parent && this.parent.listenerCount(n)) {
|
|
693
|
+
checkForUnknownOptions();
|
|
694
|
+
this._processArguments();
|
|
695
|
+
this.parent.emit(n, t, e);
|
|
696
|
+
} else if (t.length) {
|
|
697
|
+
if (this._findCommand("*")) return this._dispatchSubcommand("*", t, e);
|
|
698
|
+
if (this.listenerCount("command:*")) this.emit("command:*", t, e);
|
|
699
|
+
else if (this.commands.length) this.unknownCommand();
|
|
700
|
+
else {
|
|
701
|
+
checkForUnknownOptions();
|
|
702
|
+
this._processArguments();
|
|
703
|
+
}
|
|
704
|
+
} else if (this.commands.length) {
|
|
705
|
+
checkForUnknownOptions();
|
|
706
|
+
this.help({
|
|
707
|
+
error: true
|
|
708
|
+
});
|
|
709
|
+
} else {
|
|
710
|
+
checkForUnknownOptions();
|
|
711
|
+
this._processArguments();
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
_findCommand(t) {
|
|
715
|
+
if (!t) return;
|
|
716
|
+
return this.commands.find((e)=>e._name === t || e._aliases.includes(t));
|
|
717
|
+
}
|
|
718
|
+
_findOption(t) {
|
|
719
|
+
return this.options.find((e)=>e.is(t));
|
|
720
|
+
}
|
|
721
|
+
_checkForMissingMandatoryOptions() {
|
|
722
|
+
for(let t = this; t; t = t.parent)t.options.forEach((e)=>{
|
|
723
|
+
if (e.mandatory && void 0 === t.getOptionValue(e.attributeName())) t.missingMandatoryOptionValue(e);
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
_checkForConflictingLocalOptions() {
|
|
727
|
+
const t = this.options.filter((t)=>{
|
|
728
|
+
const e = t.attributeName();
|
|
729
|
+
if (void 0 === this.getOptionValue(e)) return false;
|
|
730
|
+
return "default" !== this.getOptionValueSource(e);
|
|
731
|
+
});
|
|
732
|
+
const e = t.filter((t)=>t.conflictsWith.length > 0);
|
|
733
|
+
e.forEach((e)=>{
|
|
734
|
+
const i = t.find((t)=>e.conflictsWith.includes(t.attributeName()));
|
|
735
|
+
if (i) this._conflictingOption(e, i);
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
_checkForConflictingOptions() {
|
|
739
|
+
for(let t = this; t; t = t.parent)t._checkForConflictingLocalOptions();
|
|
740
|
+
}
|
|
741
|
+
parseOptions(t) {
|
|
742
|
+
const e = [];
|
|
743
|
+
const i = [];
|
|
744
|
+
let n = e;
|
|
745
|
+
const s = t.slice();
|
|
746
|
+
function maybeOption(t) {
|
|
747
|
+
return t.length > 1 && "-" === t[0];
|
|
748
|
+
}
|
|
749
|
+
let r = null;
|
|
750
|
+
while(s.length){
|
|
751
|
+
const t = s.shift();
|
|
752
|
+
if ("--" === t) {
|
|
753
|
+
if (n === i) n.push(t);
|
|
754
|
+
n.push(...s);
|
|
755
|
+
break;
|
|
756
|
+
}
|
|
757
|
+
if (r && !maybeOption(t)) {
|
|
758
|
+
this.emit(`option:${r.name()}`, t);
|
|
759
|
+
continue;
|
|
760
|
+
}
|
|
761
|
+
r = null;
|
|
762
|
+
if (maybeOption(t)) {
|
|
763
|
+
const e = this._findOption(t);
|
|
764
|
+
if (e) {
|
|
765
|
+
if (e.required) {
|
|
766
|
+
const t = s.shift();
|
|
767
|
+
if (void 0 === t) this.optionMissingArgument(e);
|
|
768
|
+
this.emit(`option:${e.name()}`, t);
|
|
769
|
+
} else if (e.optional) {
|
|
770
|
+
let t = null;
|
|
771
|
+
if (s.length > 0 && !maybeOption(s[0])) t = s.shift();
|
|
772
|
+
this.emit(`option:${e.name()}`, t);
|
|
773
|
+
} else this.emit(`option:${e.name()}`);
|
|
774
|
+
r = e.variadic ? e : null;
|
|
775
|
+
continue;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
if (t.length > 2 && "-" === t[0] && "-" !== t[1]) {
|
|
779
|
+
const e = this._findOption(`-${t[1]}`);
|
|
780
|
+
if (e) {
|
|
781
|
+
if (e.required || e.optional && this._combineFlagAndOptionalValue) this.emit(`option:${e.name()}`, t.slice(2));
|
|
782
|
+
else {
|
|
783
|
+
this.emit(`option:${e.name()}`);
|
|
784
|
+
s.unshift(`-${t.slice(2)}`);
|
|
785
|
+
}
|
|
786
|
+
continue;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
if (/^--[^=]+=/.test(t)) {
|
|
790
|
+
const e = t.indexOf("=");
|
|
791
|
+
const i = this._findOption(t.slice(0, e));
|
|
792
|
+
if (i && (i.required || i.optional)) {
|
|
793
|
+
this.emit(`option:${i.name()}`, t.slice(e + 1));
|
|
794
|
+
continue;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
if (maybeOption(t)) n = i;
|
|
798
|
+
if ((this._enablePositionalOptions || this._passThroughOptions) && 0 === e.length && 0 === i.length) {
|
|
799
|
+
if (this._findCommand(t)) {
|
|
800
|
+
e.push(t);
|
|
801
|
+
if (s.length > 0) i.push(...s);
|
|
802
|
+
break;
|
|
803
|
+
} else if (t === this._helpCommandName && this._hasImplicitHelpCommand()) {
|
|
804
|
+
e.push(t);
|
|
805
|
+
if (s.length > 0) e.push(...s);
|
|
806
|
+
break;
|
|
807
|
+
} else if (this._defaultCommandName) {
|
|
808
|
+
i.push(t);
|
|
809
|
+
if (s.length > 0) i.push(...s);
|
|
810
|
+
break;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
if (this._passThroughOptions) {
|
|
814
|
+
n.push(t);
|
|
815
|
+
if (s.length > 0) n.push(...s);
|
|
816
|
+
break;
|
|
817
|
+
}
|
|
818
|
+
n.push(t);
|
|
819
|
+
}
|
|
820
|
+
return {
|
|
821
|
+
operands: e,
|
|
822
|
+
unknown: i
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
opts() {
|
|
826
|
+
if (this._storeOptionsAsProperties) {
|
|
827
|
+
const t = {};
|
|
828
|
+
const e = this.options.length;
|
|
829
|
+
for(let i = 0; i < e; i++){
|
|
830
|
+
const e = this.options[i].attributeName();
|
|
831
|
+
t[e] = e === this._versionOptionName ? this._version : this[e];
|
|
832
|
+
}
|
|
833
|
+
return t;
|
|
834
|
+
}
|
|
835
|
+
return this._optionValues;
|
|
836
|
+
}
|
|
837
|
+
optsWithGlobals() {
|
|
838
|
+
return getCommandAndParents(this).reduce((t, e)=>Object.assign(t, e.opts()), {});
|
|
839
|
+
}
|
|
840
|
+
error(t, e) {
|
|
841
|
+
this._outputConfiguration.outputError(`${t}\n`, this._outputConfiguration.writeErr);
|
|
842
|
+
if ("string" == typeof this._showHelpAfterError) this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`);
|
|
843
|
+
else if (this._showHelpAfterError) {
|
|
844
|
+
this._outputConfiguration.writeErr("\n");
|
|
845
|
+
this.outputHelp({
|
|
846
|
+
error: true
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
const i = e || {};
|
|
850
|
+
const n = i.exitCode || 1;
|
|
851
|
+
const s = i.code || "commander.error";
|
|
852
|
+
this._exit(n, s, t);
|
|
853
|
+
}
|
|
854
|
+
_parseOptionsEnv() {
|
|
855
|
+
this.options.forEach((t)=>{
|
|
856
|
+
if (t.envVar && t.envVar in a.env) {
|
|
857
|
+
const e = t.attributeName();
|
|
858
|
+
if (void 0 === this.getOptionValue(e) || [
|
|
859
|
+
"default",
|
|
860
|
+
"config",
|
|
861
|
+
"env"
|
|
862
|
+
].includes(this.getOptionValueSource(e))) if (t.required || t.optional) this.emit(`optionEnv:${t.name()}`, a.env[t.envVar]);
|
|
863
|
+
else this.emit(`optionEnv:${t.name()}`);
|
|
864
|
+
}
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
_parseOptionsImplied() {
|
|
868
|
+
const t = new d(this.options);
|
|
869
|
+
const hasCustomOptionValue = (t)=>void 0 !== this.getOptionValue(t) && ![
|
|
870
|
+
"default",
|
|
871
|
+
"implied"
|
|
872
|
+
].includes(this.getOptionValueSource(t));
|
|
873
|
+
this.options.filter((e)=>void 0 !== e.implied && hasCustomOptionValue(e.attributeName()) && t.valueFromOption(this.getOptionValue(e.attributeName()), e)).forEach((t)=>{
|
|
874
|
+
Object.keys(t.implied).filter((t)=>!hasCustomOptionValue(t)).forEach((e)=>{
|
|
875
|
+
this.setOptionValueWithSource(e, t.implied[e], "implied");
|
|
876
|
+
});
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
missingArgument(t) {
|
|
880
|
+
const e = `error: missing required argument '${t}'`;
|
|
881
|
+
this.error(e, {
|
|
882
|
+
code: "commander.missingArgument"
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
optionMissingArgument(t) {
|
|
886
|
+
const e = `error: option '${t.flags}' argument missing`;
|
|
887
|
+
this.error(e, {
|
|
888
|
+
code: "commander.optionMissingArgument"
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
missingMandatoryOptionValue(t) {
|
|
892
|
+
const e = `error: required option '${t.flags}' not specified`;
|
|
893
|
+
this.error(e, {
|
|
894
|
+
code: "commander.missingMandatoryOptionValue"
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
_conflictingOption(t, e) {
|
|
898
|
+
const findBestOptionFromValue = (t)=>{
|
|
899
|
+
const e = t.attributeName();
|
|
900
|
+
const i = this.getOptionValue(e);
|
|
901
|
+
const n = this.options.find((t)=>t.negate && e === t.attributeName());
|
|
902
|
+
const s = this.options.find((t)=>!t.negate && e === t.attributeName());
|
|
903
|
+
if (n && (void 0 === n.presetArg && false === i || void 0 !== n.presetArg && i === n.presetArg)) return n;
|
|
904
|
+
return s || t;
|
|
905
|
+
};
|
|
906
|
+
const getErrorMessage = (t)=>{
|
|
907
|
+
const e = findBestOptionFromValue(t);
|
|
908
|
+
const i = e.attributeName();
|
|
909
|
+
const n = this.getOptionValueSource(i);
|
|
910
|
+
if ("env" === n) return `environment variable '${e.envVar}'`;
|
|
911
|
+
return `option '${e.flags}'`;
|
|
912
|
+
};
|
|
913
|
+
const i = `error: ${getErrorMessage(t)} cannot be used with ${getErrorMessage(e)}`;
|
|
914
|
+
this.error(i, {
|
|
915
|
+
code: "commander.conflictingOption"
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
unknownOption(t) {
|
|
919
|
+
if (this._allowUnknownOption) return;
|
|
920
|
+
let e = "";
|
|
921
|
+
if (t.startsWith("--") && this._showSuggestionAfterError) {
|
|
922
|
+
let i = [];
|
|
923
|
+
let n = this;
|
|
924
|
+
do {
|
|
925
|
+
const t = n.createHelp().visibleOptions(n).filter((t)=>t.long).map((t)=>t.long);
|
|
926
|
+
i = i.concat(t);
|
|
927
|
+
n = n.parent;
|
|
928
|
+
}while (n && !n._enablePositionalOptions);
|
|
929
|
+
e = f(t, i);
|
|
930
|
+
}
|
|
931
|
+
const i = `error: unknown option '${t}'${e}`;
|
|
932
|
+
this.error(i, {
|
|
933
|
+
code: "commander.unknownOption"
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
_excessArguments(t) {
|
|
937
|
+
if (this._allowExcessArguments) return;
|
|
938
|
+
const e = this._args.length;
|
|
939
|
+
const i = 1 === e ? "" : "s";
|
|
940
|
+
const n = this.parent ? ` for '${this.name()}'` : "";
|
|
941
|
+
const s = `error: too many arguments${n}. Expected ${e} argument${i} but got ${t.length}.`;
|
|
942
|
+
this.error(s, {
|
|
943
|
+
code: "commander.excessArguments"
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
unknownCommand() {
|
|
947
|
+
const t = this.args[0];
|
|
948
|
+
let e = "";
|
|
949
|
+
if (this._showSuggestionAfterError) {
|
|
950
|
+
const i = [];
|
|
951
|
+
this.createHelp().visibleCommands(this).forEach((t)=>{
|
|
952
|
+
i.push(t.name());
|
|
953
|
+
if (t.alias()) i.push(t.alias());
|
|
954
|
+
});
|
|
955
|
+
e = f(t, i);
|
|
956
|
+
}
|
|
957
|
+
const i = `error: unknown command '${t}'${e}`;
|
|
958
|
+
this.error(i, {
|
|
959
|
+
code: "commander.unknownCommand"
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
version(t, e, i) {
|
|
963
|
+
if (void 0 === t) return this._version;
|
|
964
|
+
this._version = t;
|
|
965
|
+
e = e || "-V, --version";
|
|
966
|
+
i = i || "output the version number";
|
|
967
|
+
const n = this.createOption(e, i);
|
|
968
|
+
this._versionOptionName = n.attributeName();
|
|
969
|
+
this.options.push(n);
|
|
970
|
+
this.on("option:" + n.name(), ()=>{
|
|
971
|
+
this._outputConfiguration.writeOut(`${t}\n`);
|
|
972
|
+
this._exit(0, "commander.version", t);
|
|
973
|
+
});
|
|
974
|
+
return this;
|
|
975
|
+
}
|
|
976
|
+
description(t, e) {
|
|
977
|
+
if (void 0 === t && void 0 === e) return this._description;
|
|
978
|
+
this._description = t;
|
|
979
|
+
if (e) this._argsDescription = e;
|
|
980
|
+
return this;
|
|
981
|
+
}
|
|
982
|
+
summary(t) {
|
|
983
|
+
if (void 0 === t) return this._summary;
|
|
984
|
+
this._summary = t;
|
|
985
|
+
return this;
|
|
986
|
+
}
|
|
987
|
+
alias(t) {
|
|
988
|
+
if (void 0 === t) return this._aliases[0];
|
|
989
|
+
let e = this;
|
|
990
|
+
if (0 !== this.commands.length && this.commands[this.commands.length - 1]._executableHandler) e = this.commands[this.commands.length - 1];
|
|
991
|
+
if (t === e._name) throw new Error("Command alias can't be the same as its name");
|
|
992
|
+
e._aliases.push(t);
|
|
993
|
+
return this;
|
|
994
|
+
}
|
|
995
|
+
aliases(t) {
|
|
996
|
+
if (void 0 === t) return this._aliases;
|
|
997
|
+
t.forEach((t)=>this.alias(t));
|
|
998
|
+
return this;
|
|
999
|
+
}
|
|
1000
|
+
usage(t) {
|
|
1001
|
+
if (void 0 === t) {
|
|
1002
|
+
if (this._usage) return this._usage;
|
|
1003
|
+
const t = this._args.map((t)=>h(t));
|
|
1004
|
+
return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this._args.length ? t : []).join(" ");
|
|
1005
|
+
}
|
|
1006
|
+
this._usage = t;
|
|
1007
|
+
return this;
|
|
1008
|
+
}
|
|
1009
|
+
name(t) {
|
|
1010
|
+
if (void 0 === t) return this._name;
|
|
1011
|
+
this._name = t;
|
|
1012
|
+
return this;
|
|
1013
|
+
}
|
|
1014
|
+
nameFromFilename(t) {
|
|
1015
|
+
this._name = r.basename(t, r.extname(t));
|
|
1016
|
+
return this;
|
|
1017
|
+
}
|
|
1018
|
+
executableDir(t) {
|
|
1019
|
+
if (void 0 === t) return this._executableDir;
|
|
1020
|
+
this._executableDir = t;
|
|
1021
|
+
return this;
|
|
1022
|
+
}
|
|
1023
|
+
helpInformation(t) {
|
|
1024
|
+
const e = this.createHelp();
|
|
1025
|
+
if (void 0 === e.helpWidth) e.helpWidth = t && t.error ? this._outputConfiguration.getErrHelpWidth() : this._outputConfiguration.getOutHelpWidth();
|
|
1026
|
+
return e.formatHelp(this, e);
|
|
1027
|
+
}
|
|
1028
|
+
_getHelpContext(t) {
|
|
1029
|
+
t = t || {};
|
|
1030
|
+
const e = {
|
|
1031
|
+
error: !!t.error
|
|
1032
|
+
};
|
|
1033
|
+
let i;
|
|
1034
|
+
i = e.error ? (t)=>this._outputConfiguration.writeErr(t) : (t)=>this._outputConfiguration.writeOut(t);
|
|
1035
|
+
e.write = t.write || i;
|
|
1036
|
+
e.command = this;
|
|
1037
|
+
return e;
|
|
1038
|
+
}
|
|
1039
|
+
outputHelp(t) {
|
|
1040
|
+
let e;
|
|
1041
|
+
if ("function" == typeof t) {
|
|
1042
|
+
e = t;
|
|
1043
|
+
t = void 0;
|
|
1044
|
+
}
|
|
1045
|
+
const i = this._getHelpContext(t);
|
|
1046
|
+
getCommandAndParents(this).reverse().forEach((t)=>t.emit("beforeAllHelp", i));
|
|
1047
|
+
this.emit("beforeHelp", i);
|
|
1048
|
+
let n = this.helpInformation(i);
|
|
1049
|
+
if (e) {
|
|
1050
|
+
n = e(n);
|
|
1051
|
+
if ("string" != typeof n && !Buffer.isBuffer(n)) throw new Error("outputHelp callback must return a string or a Buffer");
|
|
1052
|
+
}
|
|
1053
|
+
i.write(n);
|
|
1054
|
+
this.emit(this._helpLongFlag);
|
|
1055
|
+
this.emit("afterHelp", i);
|
|
1056
|
+
getCommandAndParents(this).forEach((t)=>t.emit("afterAllHelp", i));
|
|
1057
|
+
}
|
|
1058
|
+
helpOption(t, e) {
|
|
1059
|
+
if ("boolean" == typeof t) {
|
|
1060
|
+
this._hasHelpOption = t;
|
|
1061
|
+
return this;
|
|
1062
|
+
}
|
|
1063
|
+
this._helpFlags = t || this._helpFlags;
|
|
1064
|
+
this._helpDescription = e || this._helpDescription;
|
|
1065
|
+
const i = m(this._helpFlags);
|
|
1066
|
+
this._helpShortFlag = i.shortFlag;
|
|
1067
|
+
this._helpLongFlag = i.longFlag;
|
|
1068
|
+
return this;
|
|
1069
|
+
}
|
|
1070
|
+
help(t) {
|
|
1071
|
+
this.outputHelp(t);
|
|
1072
|
+
let e = a.exitCode || 0;
|
|
1073
|
+
if (0 === e && t && "function" != typeof t && t.error) e = 1;
|
|
1074
|
+
this._exit(e, "commander.help", "(outputHelp)");
|
|
1075
|
+
}
|
|
1076
|
+
addHelpText(t, e) {
|
|
1077
|
+
const i = [
|
|
1078
|
+
"beforeAll",
|
|
1079
|
+
"before",
|
|
1080
|
+
"after",
|
|
1081
|
+
"afterAll"
|
|
1082
|
+
];
|
|
1083
|
+
if (!i.includes(t)) throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${i.join("', '")}'`);
|
|
1084
|
+
const n = `${t}Help`;
|
|
1085
|
+
this.on(n, (t)=>{
|
|
1086
|
+
let i;
|
|
1087
|
+
i = "function" == typeof e ? e({
|
|
1088
|
+
error: t.error,
|
|
1089
|
+
command: t.command
|
|
1090
|
+
}) : e;
|
|
1091
|
+
if (i) t.write(`${i}\n`);
|
|
1092
|
+
});
|
|
1093
|
+
return this;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
function outputHelpIfRequested(t, e) {
|
|
1097
|
+
const i = t._hasHelpOption && e.find((e)=>e === t._helpLongFlag || e === t._helpShortFlag);
|
|
1098
|
+
if (i) {
|
|
1099
|
+
t.outputHelp();
|
|
1100
|
+
t._exit(0, "commander.helpDisplayed", "(outputHelp)");
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
function incrementNodeInspectorPort(t) {
|
|
1104
|
+
return t.map((t)=>{
|
|
1105
|
+
if (!t.startsWith("--inspect")) return t;
|
|
1106
|
+
let e;
|
|
1107
|
+
let i = "127.0.0.1";
|
|
1108
|
+
let n = "9229";
|
|
1109
|
+
let s;
|
|
1110
|
+
if (null !== (s = t.match(/^(--inspect(-brk)?)$/))) e = s[1];
|
|
1111
|
+
else if (null !== (s = t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))) {
|
|
1112
|
+
e = s[1];
|
|
1113
|
+
if (/^\d+$/.test(s[3])) n = s[3];
|
|
1114
|
+
else i = s[3];
|
|
1115
|
+
} else if (null !== (s = t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))) {
|
|
1116
|
+
e = s[1];
|
|
1117
|
+
i = s[3];
|
|
1118
|
+
n = s[4];
|
|
1119
|
+
}
|
|
1120
|
+
if (e && "0" !== n) return `${e}=${i}:${parseInt(n) + 1}`;
|
|
1121
|
+
return t;
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
function getCommandAndParents(t) {
|
|
1125
|
+
const e = [];
|
|
1126
|
+
for(let i = t; i; i = i.parent)e.push(i);
|
|
1127
|
+
return e;
|
|
1128
|
+
}
|
|
1129
|
+
e.Command = Command;
|
|
1130
|
+
},
|
|
1131
|
+
796: (t, e)=>{
|
|
1132
|
+
class CommanderError extends Error {
|
|
1133
|
+
constructor(t, e, i){
|
|
1134
|
+
super(i);
|
|
1135
|
+
Error.captureStackTrace(this, this.constructor);
|
|
1136
|
+
this.name = this.constructor.name;
|
|
1137
|
+
this.code = e;
|
|
1138
|
+
this.exitCode = t;
|
|
1139
|
+
this.nestedError = void 0;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
class InvalidArgumentError extends CommanderError {
|
|
1143
|
+
constructor(t){
|
|
1144
|
+
super(1, "commander.invalidArgument", t);
|
|
1145
|
+
Error.captureStackTrace(this, this.constructor);
|
|
1146
|
+
this.name = this.constructor.name;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
e.CommanderError = CommanderError;
|
|
1150
|
+
e.InvalidArgumentError = InvalidArgumentError;
|
|
1151
|
+
},
|
|
1152
|
+
519: (t, e, i)=>{
|
|
1153
|
+
const { humanReadableArgName: n } = i(535);
|
|
1154
|
+
class Help {
|
|
1155
|
+
constructor(){
|
|
1156
|
+
this.helpWidth = void 0;
|
|
1157
|
+
this.sortSubcommands = false;
|
|
1158
|
+
this.sortOptions = false;
|
|
1159
|
+
this.showGlobalOptions = false;
|
|
1160
|
+
}
|
|
1161
|
+
visibleCommands(t) {
|
|
1162
|
+
const e = t.commands.filter((t)=>!t._hidden);
|
|
1163
|
+
if (t._hasImplicitHelpCommand()) {
|
|
1164
|
+
const [, i, n] = t._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);
|
|
1165
|
+
const s = t.createCommand(i).helpOption(false);
|
|
1166
|
+
s.description(t._helpCommandDescription);
|
|
1167
|
+
if (n) s.arguments(n);
|
|
1168
|
+
e.push(s);
|
|
1169
|
+
}
|
|
1170
|
+
if (this.sortSubcommands) e.sort((t, e)=>t.name().localeCompare(e.name()));
|
|
1171
|
+
return e;
|
|
1172
|
+
}
|
|
1173
|
+
compareOptions(t, e) {
|
|
1174
|
+
const getSortKey = (t)=>t.short ? t.short.replace(/^-/, "") : t.long.replace(/^--/, "");
|
|
1175
|
+
return getSortKey(t).localeCompare(getSortKey(e));
|
|
1176
|
+
}
|
|
1177
|
+
visibleOptions(t) {
|
|
1178
|
+
const e = t.options.filter((t)=>!t.hidden);
|
|
1179
|
+
const i = t._hasHelpOption && t._helpShortFlag && !t._findOption(t._helpShortFlag);
|
|
1180
|
+
const n = t._hasHelpOption && !t._findOption(t._helpLongFlag);
|
|
1181
|
+
if (i || n) {
|
|
1182
|
+
let s;
|
|
1183
|
+
s = i ? n ? t.createOption(t._helpFlags, t._helpDescription) : t.createOption(t._helpShortFlag, t._helpDescription) : t.createOption(t._helpLongFlag, t._helpDescription);
|
|
1184
|
+
e.push(s);
|
|
1185
|
+
}
|
|
1186
|
+
if (this.sortOptions) e.sort(this.compareOptions);
|
|
1187
|
+
return e;
|
|
1188
|
+
}
|
|
1189
|
+
visibleGlobalOptions(t) {
|
|
1190
|
+
if (!this.showGlobalOptions) return [];
|
|
1191
|
+
const e = [];
|
|
1192
|
+
for(let i = t.parent; i; i = i.parent){
|
|
1193
|
+
const t = i.options.filter((t)=>!t.hidden);
|
|
1194
|
+
e.push(...t);
|
|
1195
|
+
}
|
|
1196
|
+
if (this.sortOptions) e.sort(this.compareOptions);
|
|
1197
|
+
return e;
|
|
1198
|
+
}
|
|
1199
|
+
visibleArguments(t) {
|
|
1200
|
+
if (t._argsDescription) t._args.forEach((e)=>{
|
|
1201
|
+
e.description = e.description || t._argsDescription[e.name()] || "";
|
|
1202
|
+
});
|
|
1203
|
+
if (t._args.find((t)=>t.description)) return t._args;
|
|
1204
|
+
return [];
|
|
1205
|
+
}
|
|
1206
|
+
subcommandTerm(t) {
|
|
1207
|
+
const e = t._args.map((t)=>n(t)).join(" ");
|
|
1208
|
+
return t._name + (t._aliases[0] ? "|" + t._aliases[0] : "") + (t.options.length ? " [options]" : "") + (e ? " " + e : "");
|
|
1209
|
+
}
|
|
1210
|
+
optionTerm(t) {
|
|
1211
|
+
return t.flags;
|
|
1212
|
+
}
|
|
1213
|
+
argumentTerm(t) {
|
|
1214
|
+
return t.name();
|
|
1215
|
+
}
|
|
1216
|
+
longestSubcommandTermLength(t, e) {
|
|
1217
|
+
return e.visibleCommands(t).reduce((t, i)=>Math.max(t, e.subcommandTerm(i).length), 0);
|
|
1218
|
+
}
|
|
1219
|
+
longestOptionTermLength(t, e) {
|
|
1220
|
+
return e.visibleOptions(t).reduce((t, i)=>Math.max(t, e.optionTerm(i).length), 0);
|
|
1221
|
+
}
|
|
1222
|
+
longestGlobalOptionTermLength(t, e) {
|
|
1223
|
+
return e.visibleGlobalOptions(t).reduce((t, i)=>Math.max(t, e.optionTerm(i).length), 0);
|
|
1224
|
+
}
|
|
1225
|
+
longestArgumentTermLength(t, e) {
|
|
1226
|
+
return e.visibleArguments(t).reduce((t, i)=>Math.max(t, e.argumentTerm(i).length), 0);
|
|
1227
|
+
}
|
|
1228
|
+
commandUsage(t) {
|
|
1229
|
+
let e = t._name;
|
|
1230
|
+
if (t._aliases[0]) e = e + "|" + t._aliases[0];
|
|
1231
|
+
let i = "";
|
|
1232
|
+
for(let e = t.parent; e; e = e.parent)i = e.name() + " " + i;
|
|
1233
|
+
return i + e + " " + t.usage();
|
|
1234
|
+
}
|
|
1235
|
+
commandDescription(t) {
|
|
1236
|
+
return t.description();
|
|
1237
|
+
}
|
|
1238
|
+
subcommandDescription(t) {
|
|
1239
|
+
return t.summary() || t.description();
|
|
1240
|
+
}
|
|
1241
|
+
optionDescription(t) {
|
|
1242
|
+
const e = [];
|
|
1243
|
+
if (t.argChoices) e.push(`choices: ${t.argChoices.map((t)=>JSON.stringify(t)).join(", ")}`);
|
|
1244
|
+
if (void 0 !== t.defaultValue) {
|
|
1245
|
+
const i = t.required || t.optional || t.isBoolean() && "boolean" == typeof t.defaultValue;
|
|
1246
|
+
if (i) e.push(`default: ${t.defaultValueDescription || JSON.stringify(t.defaultValue)}`);
|
|
1247
|
+
}
|
|
1248
|
+
if (void 0 !== t.presetArg && t.optional) e.push(`preset: ${JSON.stringify(t.presetArg)}`);
|
|
1249
|
+
if (void 0 !== t.envVar) e.push(`env: ${t.envVar}`);
|
|
1250
|
+
if (e.length > 0) return `${t.description} (${e.join(", ")})`;
|
|
1251
|
+
return t.description;
|
|
1252
|
+
}
|
|
1253
|
+
argumentDescription(t) {
|
|
1254
|
+
const e = [];
|
|
1255
|
+
if (t.argChoices) e.push(`choices: ${t.argChoices.map((t)=>JSON.stringify(t)).join(", ")}`);
|
|
1256
|
+
if (void 0 !== t.defaultValue) e.push(`default: ${t.defaultValueDescription || JSON.stringify(t.defaultValue)}`);
|
|
1257
|
+
if (e.length > 0) {
|
|
1258
|
+
const i = `(${e.join(", ")})`;
|
|
1259
|
+
if (t.description) return `${t.description} ${i}`;
|
|
1260
|
+
return i;
|
|
1261
|
+
}
|
|
1262
|
+
return t.description;
|
|
1263
|
+
}
|
|
1264
|
+
formatHelp(t, e) {
|
|
1265
|
+
const i = e.padWidth(t, e);
|
|
1266
|
+
const n = e.helpWidth || 80;
|
|
1267
|
+
const s = 2;
|
|
1268
|
+
const r = 2;
|
|
1269
|
+
function formatItem(t, o) {
|
|
1270
|
+
if (o) {
|
|
1271
|
+
const a = `${t.padEnd(i + r)}${o}`;
|
|
1272
|
+
return e.wrap(a, n - s, i + r);
|
|
1273
|
+
}
|
|
1274
|
+
return t;
|
|
1275
|
+
}
|
|
1276
|
+
function formatList(t) {
|
|
1277
|
+
return t.join("\n").replace(/^/gm, " ".repeat(s));
|
|
1278
|
+
}
|
|
1279
|
+
let o = [
|
|
1280
|
+
`Usage: ${e.commandUsage(t)}`,
|
|
1281
|
+
""
|
|
1282
|
+
];
|
|
1283
|
+
const a = e.commandDescription(t);
|
|
1284
|
+
if (a.length > 0) o = o.concat([
|
|
1285
|
+
e.wrap(a, n, 0),
|
|
1286
|
+
""
|
|
1287
|
+
]);
|
|
1288
|
+
const l = e.visibleArguments(t).map((t)=>formatItem(e.argumentTerm(t), e.argumentDescription(t)));
|
|
1289
|
+
if (l.length > 0) o = o.concat([
|
|
1290
|
+
"Arguments:",
|
|
1291
|
+
formatList(l),
|
|
1292
|
+
""
|
|
1293
|
+
]);
|
|
1294
|
+
const h = e.visibleOptions(t).map((t)=>formatItem(e.optionTerm(t), e.optionDescription(t)));
|
|
1295
|
+
if (h.length > 0) o = o.concat([
|
|
1296
|
+
"Options:",
|
|
1297
|
+
formatList(h),
|
|
1298
|
+
""
|
|
1299
|
+
]);
|
|
1300
|
+
if (this.showGlobalOptions) {
|
|
1301
|
+
const i = e.visibleGlobalOptions(t).map((t)=>formatItem(e.optionTerm(t), e.optionDescription(t)));
|
|
1302
|
+
if (i.length > 0) o = o.concat([
|
|
1303
|
+
"Global Options:",
|
|
1304
|
+
formatList(i),
|
|
1305
|
+
""
|
|
1306
|
+
]);
|
|
1307
|
+
}
|
|
1308
|
+
const u = e.visibleCommands(t).map((t)=>formatItem(e.subcommandTerm(t), e.subcommandDescription(t)));
|
|
1309
|
+
if (u.length > 0) o = o.concat([
|
|
1310
|
+
"Commands:",
|
|
1311
|
+
formatList(u),
|
|
1312
|
+
""
|
|
1313
|
+
]);
|
|
1314
|
+
return o.join("\n");
|
|
1315
|
+
}
|
|
1316
|
+
padWidth(t, e) {
|
|
1317
|
+
return Math.max(e.longestOptionTermLength(t, e), e.longestGlobalOptionTermLength(t, e), e.longestSubcommandTermLength(t, e), e.longestArgumentTermLength(t, e));
|
|
1318
|
+
}
|
|
1319
|
+
wrap(t, e, i, n = 40) {
|
|
1320
|
+
const s = " \\f\\t\\v - \ufeff";
|
|
1321
|
+
const r = new RegExp(`[\\n][${s}]+`);
|
|
1322
|
+
if (t.match(r)) return t;
|
|
1323
|
+
const o = e - i;
|
|
1324
|
+
if (o < n) return t;
|
|
1325
|
+
const a = t.slice(0, i);
|
|
1326
|
+
const l = t.slice(i).replace("\r\n", "\n");
|
|
1327
|
+
const h = " ".repeat(i);
|
|
1328
|
+
const u = "";
|
|
1329
|
+
const c = `\\s${u}`;
|
|
1330
|
+
const p = new RegExp(`\n|.{1,${o - 1}}([${c}]|$)|[^${c}]+?([${c}]|$)`, "g");
|
|
1331
|
+
const m = l.match(p) || [];
|
|
1332
|
+
return a + m.map((t, e)=>{
|
|
1333
|
+
if ("\n" === t) return "";
|
|
1334
|
+
return (e > 0 ? h : "") + t.trimEnd();
|
|
1335
|
+
}).join("\n");
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
e.Help = Help;
|
|
1339
|
+
},
|
|
1340
|
+
437: (t, e, i)=>{
|
|
1341
|
+
const { InvalidArgumentError: n } = i(796);
|
|
1342
|
+
class Option {
|
|
1343
|
+
constructor(t, e){
|
|
1344
|
+
this.flags = t;
|
|
1345
|
+
this.description = e || "";
|
|
1346
|
+
this.required = t.includes("<");
|
|
1347
|
+
this.optional = t.includes("[");
|
|
1348
|
+
this.variadic = /\w\.\.\.[>\]]$/.test(t);
|
|
1349
|
+
this.mandatory = false;
|
|
1350
|
+
const i = splitOptionFlags(t);
|
|
1351
|
+
this.short = i.shortFlag;
|
|
1352
|
+
this.long = i.longFlag;
|
|
1353
|
+
this.negate = false;
|
|
1354
|
+
if (this.long) this.negate = this.long.startsWith("--no-");
|
|
1355
|
+
this.defaultValue = void 0;
|
|
1356
|
+
this.defaultValueDescription = void 0;
|
|
1357
|
+
this.presetArg = void 0;
|
|
1358
|
+
this.envVar = void 0;
|
|
1359
|
+
this.parseArg = void 0;
|
|
1360
|
+
this.hidden = false;
|
|
1361
|
+
this.argChoices = void 0;
|
|
1362
|
+
this.conflictsWith = [];
|
|
1363
|
+
this.implied = void 0;
|
|
1364
|
+
}
|
|
1365
|
+
default(t, e) {
|
|
1366
|
+
this.defaultValue = t;
|
|
1367
|
+
this.defaultValueDescription = e;
|
|
1368
|
+
return this;
|
|
1369
|
+
}
|
|
1370
|
+
preset(t) {
|
|
1371
|
+
this.presetArg = t;
|
|
1372
|
+
return this;
|
|
1373
|
+
}
|
|
1374
|
+
conflicts(t) {
|
|
1375
|
+
this.conflictsWith = this.conflictsWith.concat(t);
|
|
1376
|
+
return this;
|
|
1377
|
+
}
|
|
1378
|
+
implies(t) {
|
|
1379
|
+
this.implied = Object.assign(this.implied || {}, t);
|
|
1380
|
+
return this;
|
|
1381
|
+
}
|
|
1382
|
+
env(t) {
|
|
1383
|
+
this.envVar = t;
|
|
1384
|
+
return this;
|
|
1385
|
+
}
|
|
1386
|
+
argParser(t) {
|
|
1387
|
+
this.parseArg = t;
|
|
1388
|
+
return this;
|
|
1389
|
+
}
|
|
1390
|
+
makeOptionMandatory(t = true) {
|
|
1391
|
+
this.mandatory = !!t;
|
|
1392
|
+
return this;
|
|
1393
|
+
}
|
|
1394
|
+
hideHelp(t = true) {
|
|
1395
|
+
this.hidden = !!t;
|
|
1396
|
+
return this;
|
|
1397
|
+
}
|
|
1398
|
+
_concatValue(t, e) {
|
|
1399
|
+
if (e === this.defaultValue || !Array.isArray(e)) return [
|
|
1400
|
+
t
|
|
1401
|
+
];
|
|
1402
|
+
return e.concat(t);
|
|
1403
|
+
}
|
|
1404
|
+
choices(t) {
|
|
1405
|
+
this.argChoices = t.slice();
|
|
1406
|
+
this.parseArg = (t, e)=>{
|
|
1407
|
+
if (!this.argChoices.includes(t)) throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);
|
|
1408
|
+
if (this.variadic) return this._concatValue(t, e);
|
|
1409
|
+
return t;
|
|
1410
|
+
};
|
|
1411
|
+
return this;
|
|
1412
|
+
}
|
|
1413
|
+
name() {
|
|
1414
|
+
if (this.long) return this.long.replace(/^--/, "");
|
|
1415
|
+
return this.short.replace(/^-/, "");
|
|
1416
|
+
}
|
|
1417
|
+
attributeName() {
|
|
1418
|
+
return camelcase(this.name().replace(/^no-/, ""));
|
|
1419
|
+
}
|
|
1420
|
+
is(t) {
|
|
1421
|
+
return this.short === t || this.long === t;
|
|
1422
|
+
}
|
|
1423
|
+
isBoolean() {
|
|
1424
|
+
return !this.required && !this.optional && !this.negate;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
class DualOptions {
|
|
1428
|
+
constructor(t){
|
|
1429
|
+
this.positiveOptions = new Map;
|
|
1430
|
+
this.negativeOptions = new Map;
|
|
1431
|
+
this.dualOptions = new Set;
|
|
1432
|
+
t.forEach((t)=>{
|
|
1433
|
+
if (t.negate) this.negativeOptions.set(t.attributeName(), t);
|
|
1434
|
+
else this.positiveOptions.set(t.attributeName(), t);
|
|
1435
|
+
});
|
|
1436
|
+
this.negativeOptions.forEach((t, e)=>{
|
|
1437
|
+
if (this.positiveOptions.has(e)) this.dualOptions.add(e);
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
valueFromOption(t, e) {
|
|
1441
|
+
const i = e.attributeName();
|
|
1442
|
+
if (!this.dualOptions.has(i)) return true;
|
|
1443
|
+
const n = this.negativeOptions.get(i).presetArg;
|
|
1444
|
+
const s = void 0 !== n ? n : false;
|
|
1445
|
+
return e.negate === (s === t);
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
function camelcase(t) {
|
|
1449
|
+
return t.split("-").reduce((t, e)=>t + e[0].toUpperCase() + e.slice(1));
|
|
1450
|
+
}
|
|
1451
|
+
function splitOptionFlags(t) {
|
|
1452
|
+
let e;
|
|
1453
|
+
let i;
|
|
1454
|
+
const n = t.split(/[ |,]+/);
|
|
1455
|
+
if (n.length > 1 && !/^[[<]/.test(n[1])) e = n.shift();
|
|
1456
|
+
i = n.shift();
|
|
1457
|
+
if (!e && /^-[^-]$/.test(i)) {
|
|
1458
|
+
e = i;
|
|
1459
|
+
i = void 0;
|
|
1460
|
+
}
|
|
1461
|
+
return {
|
|
1462
|
+
shortFlag: e,
|
|
1463
|
+
longFlag: i
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
e.Option = Option;
|
|
1467
|
+
e.splitOptionFlags = splitOptionFlags;
|
|
1468
|
+
e.DualOptions = DualOptions;
|
|
1469
|
+
},
|
|
1470
|
+
860: (t, e)=>{
|
|
1471
|
+
const i = 3;
|
|
1472
|
+
function editDistance(t, e) {
|
|
1473
|
+
if (Math.abs(t.length - e.length) > i) return Math.max(t.length, e.length);
|
|
1474
|
+
const n = [];
|
|
1475
|
+
for(let e = 0; e <= t.length; e++)n[e] = [
|
|
1476
|
+
e
|
|
1477
|
+
];
|
|
1478
|
+
for(let t = 0; t <= e.length; t++)n[0][t] = t;
|
|
1479
|
+
for(let i = 1; i <= e.length; i++)for(let s = 1; s <= t.length; s++){
|
|
1480
|
+
let r = 1;
|
|
1481
|
+
r = t[s - 1] === e[i - 1] ? 0 : 1;
|
|
1482
|
+
n[s][i] = Math.min(n[s - 1][i] + 1, n[s][i - 1] + 1, n[s - 1][i - 1] + r);
|
|
1483
|
+
if (s > 1 && i > 1 && t[s - 1] === e[i - 2] && t[s - 2] === e[i - 1]) n[s][i] = Math.min(n[s][i], n[s - 2][i - 2] + 1);
|
|
1484
|
+
}
|
|
1485
|
+
return n[t.length][e.length];
|
|
1486
|
+
}
|
|
1487
|
+
function suggestSimilar(t, e) {
|
|
1488
|
+
if (!e || 0 === e.length) return "";
|
|
1489
|
+
e = Array.from(new Set(e));
|
|
1490
|
+
const n = t.startsWith("--");
|
|
1491
|
+
if (n) {
|
|
1492
|
+
t = t.slice(2);
|
|
1493
|
+
e = e.map((t)=>t.slice(2));
|
|
1494
|
+
}
|
|
1495
|
+
let s = [];
|
|
1496
|
+
let r = i;
|
|
1497
|
+
const o = .4;
|
|
1498
|
+
e.forEach((e)=>{
|
|
1499
|
+
if (e.length <= 1) return;
|
|
1500
|
+
const i = editDistance(t, e);
|
|
1501
|
+
const n = Math.max(t.length, e.length);
|
|
1502
|
+
const a = (n - i) / n;
|
|
1503
|
+
if (a > o) {
|
|
1504
|
+
if (i < r) {
|
|
1505
|
+
r = i;
|
|
1506
|
+
s = [
|
|
1507
|
+
e
|
|
1508
|
+
];
|
|
1509
|
+
} else if (i === r) s.push(e);
|
|
1510
|
+
}
|
|
1511
|
+
});
|
|
1512
|
+
s.sort((t, e)=>t.localeCompare(e));
|
|
1513
|
+
if (n) s = s.map((t)=>`--${t}`);
|
|
1514
|
+
if (s.length > 1) return `\n(Did you mean one of ${s.join(", ")}?)`;
|
|
1515
|
+
if (1 === s.length) return `\n(Did you mean ${s[0]}?)`;
|
|
1516
|
+
return "";
|
|
1517
|
+
}
|
|
1518
|
+
e.suggestSimilar = suggestSimilar;
|
|
1519
|
+
}
|
|
1520
|
+
};
|
|
1521
|
+
var e = {};
|
|
1522
|
+
function __nccwpck_require__(i) {
|
|
1523
|
+
var n = e[i];
|
|
1524
|
+
if (void 0 !== n) return n.exports;
|
|
1525
|
+
var s = e[i] = {
|
|
1526
|
+
exports: {}
|
|
1527
|
+
};
|
|
1528
|
+
var r = true;
|
|
1529
|
+
try {
|
|
1530
|
+
t[i](s, s.exports, __nccwpck_require__);
|
|
1531
|
+
r = false;
|
|
1532
|
+
} finally{
|
|
1533
|
+
if (r) delete e[i];
|
|
1534
|
+
}
|
|
1535
|
+
return s.exports;
|
|
1536
|
+
}
|
|
1537
|
+
if (void 0 !== __nccwpck_require__) __nccwpck_require__.ab = __dirname + "/";
|
|
1538
|
+
var i = __nccwpck_require__(632);
|
|
1539
|
+
module.exports = i;
|
|
1540
|
+
})();
|