pnpm 8.6.2 → 8.6.4
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/dist/node_modules/.modules.yaml +81 -24
- package/dist/node_modules/.pnpm/lock.yaml +235 -91
- package/dist/node_modules/@isaacs/cliui/LICENSE.txt +14 -0
- package/dist/node_modules/@isaacs/cliui/build/index.cjs +317 -0
- package/dist/node_modules/@isaacs/cliui/build/index.d.cts +43 -0
- package/dist/node_modules/@isaacs/cliui/build/lib/index.js +302 -0
- package/dist/node_modules/@isaacs/cliui/index.mjs +14 -0
- package/dist/node_modules/@isaacs/cliui/node_modules/string-width/index.js +54 -0
- package/dist/node_modules/@isaacs/cliui/node_modules/string-width/license +9 -0
- package/dist/node_modules/@isaacs/cliui/node_modules/string-width/package.json +59 -0
- package/dist/node_modules/@isaacs/cliui/package.json +86 -0
- package/dist/node_modules/@npmcli/fs/lib/cp/index.js +1 -1
- package/dist/node_modules/@npmcli/fs/lib/cp/polyfill.js +2 -2
- package/dist/node_modules/@npmcli/fs/lib/index.js +11 -10
- package/dist/node_modules/@npmcli/fs/lib/move-file.js +78 -0
- package/dist/node_modules/@npmcli/fs/lib/readdir-scoped.js +20 -0
- package/dist/node_modules/@npmcli/fs/lib/with-temp-dir.js +4 -6
- package/dist/node_modules/@npmcli/fs/package.json +11 -9
- package/dist/node_modules/@pkgjs/parseargs/LICENSE +201 -0
- package/dist/node_modules/@pkgjs/parseargs/index.js +396 -0
- package/dist/node_modules/@pkgjs/parseargs/internal/errors.js +47 -0
- package/dist/node_modules/@pkgjs/parseargs/internal/primordials.js +393 -0
- package/dist/node_modules/@pkgjs/parseargs/internal/util.js +14 -0
- package/dist/node_modules/@pkgjs/parseargs/internal/validators.js +89 -0
- package/dist/node_modules/@pkgjs/parseargs/package.json +36 -0
- package/dist/node_modules/@pkgjs/parseargs/utils.js +198 -0
- package/dist/node_modules/ansi-regex/index.js +3 -5
- package/dist/node_modules/ansi-regex/license +1 -1
- package/dist/node_modules/ansi-regex/package.json +9 -6
- package/dist/node_modules/ansi-styles/index.js +223 -0
- package/dist/node_modules/ansi-styles/license +9 -0
- package/dist/node_modules/ansi-styles/package.json +54 -0
- package/dist/node_modules/cacache/lib/content/read.js +1 -76
- package/dist/node_modules/cacache/lib/content/rm.js +2 -4
- package/dist/node_modules/cacache/lib/content/write.js +40 -24
- package/dist/node_modules/cacache/lib/entry-index.js +25 -99
- package/dist/node_modules/cacache/lib/get.js +1 -56
- package/dist/node_modules/cacache/lib/index.js +0 -3
- package/dist/node_modules/cacache/lib/rm.js +5 -5
- package/dist/node_modules/cacache/lib/util/glob.js +7 -0
- package/dist/node_modules/cacache/lib/util/tmp.js +3 -10
- package/dist/node_modules/cacache/lib/verify.js +28 -28
- package/dist/node_modules/cacache/node_modules/glob/LICENSE +1 -1
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/package.json +4 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/bin.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/bin.js +270 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/bin.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/glob.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/glob.js +234 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/glob.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/has-magic.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/has-magic.js +27 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/has-magic.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/ignore.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/ignore.js +103 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/ignore.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/index.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/index.js +68 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/index.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/pattern.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/pattern.js +219 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/pattern.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/processor.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/processor.js +309 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/processor.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/walker.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/walker.js +358 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/cjs/src/walker.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/glob.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/glob.js +230 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/glob.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/has-magic.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/has-magic.js +23 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/has-magic.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/ignore.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/ignore.js +99 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/ignore.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/index.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/index.js +56 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/index.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/package.json +4 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/pattern.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/pattern.js +215 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/pattern.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/processor.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/processor.js +302 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/processor.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/walker.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/walker.js +352 -0
- package/dist/node_modules/cacache/node_modules/glob/dist/mjs/walker.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/glob/package.json +78 -35
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/assert-valid-pattern.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/assert-valid-pattern.js +14 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/assert-valid-pattern.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/ast.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/ast.js +589 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/ast.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/brace-expressions.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/brace-expressions.js +152 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/brace-expressions.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/escape.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/escape.js +22 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/escape.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/index.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/index.js +1011 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/index.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/package.json +3 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/unescape.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/unescape.js +24 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/cjs/unescape.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/assert-valid-pattern.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/assert-valid-pattern.js +10 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/assert-valid-pattern.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/ast.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/ast.js +585 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/ast.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/brace-expressions.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/brace-expressions.js +148 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/brace-expressions.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/escape.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/escape.js +18 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/escape.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/index.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/index.js +995 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/index.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/package.json +3 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/unescape.d.ts.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/unescape.js +20 -0
- package/dist/node_modules/cacache/node_modules/minimatch/dist/mjs/unescape.js.map +1 -0
- package/dist/node_modules/cacache/node_modules/minimatch/package.json +66 -15
- package/dist/node_modules/cacache/package.json +19 -21
- package/dist/node_modules/color-convert/LICENSE +21 -0
- package/dist/node_modules/color-convert/conversions.js +839 -0
- package/dist/node_modules/color-convert/index.js +81 -0
- package/dist/node_modules/color-convert/package.json +48 -0
- package/dist/node_modules/color-convert/route.js +97 -0
- package/dist/node_modules/color-name/LICENSE +8 -0
- package/dist/node_modules/color-name/index.js +152 -0
- package/dist/node_modules/color-name/package.json +28 -0
- package/dist/node_modules/cross-spawn/LICENSE +21 -0
- package/dist/node_modules/cross-spawn/index.js +39 -0
- package/dist/node_modules/cross-spawn/lib/enoent.js +59 -0
- package/dist/node_modules/cross-spawn/lib/parse.js +91 -0
- package/dist/node_modules/cross-spawn/lib/util/escape.js +45 -0
- package/dist/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
- package/dist/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
- package/dist/node_modules/cross-spawn/package.json +73 -0
- package/dist/node_modules/eastasianwidth/eastasianwidth.js +311 -0
- package/dist/node_modules/eastasianwidth/package.json +18 -0
- package/dist/node_modules/emoji-regex/RGI_Emoji.js +6 -0
- package/dist/node_modules/emoji-regex/es2015/RGI_Emoji.js +6 -0
- package/dist/node_modules/emoji-regex/es2015/index.js +1 -1
- package/dist/node_modules/emoji-regex/es2015/text.js +1 -1
- package/dist/node_modules/emoji-regex/index.js +1 -1
- package/dist/node_modules/emoji-regex/package.json +13 -11
- package/dist/node_modules/emoji-regex/text.js +1 -1
- package/dist/node_modules/exponential-backoff/LICENSE +202 -0
- package/dist/node_modules/exponential-backoff/dist/backoff.js +118 -0
- package/dist/node_modules/exponential-backoff/dist/backoff.js.map +1 -0
- package/dist/node_modules/exponential-backoff/dist/delay/always/always.delay.js +25 -0
- package/dist/node_modules/exponential-backoff/dist/delay/always/always.delay.js.map +1 -0
- package/dist/node_modules/exponential-backoff/dist/delay/delay.base.js +45 -0
- package/dist/node_modules/exponential-backoff/dist/delay/delay.base.js.map +1 -0
- package/dist/node_modules/exponential-backoff/dist/delay/delay.factory.js +17 -0
- package/dist/node_modules/exponential-backoff/dist/delay/delay.factory.js.map +1 -0
- package/dist/node_modules/exponential-backoff/dist/delay/delay.interface.js +3 -0
- package/dist/node_modules/exponential-backoff/dist/delay/delay.interface.js.map +1 -0
- package/dist/node_modules/exponential-backoff/dist/delay/skip-first/skip-first.delay.js +82 -0
- package/dist/node_modules/exponential-backoff/dist/delay/skip-first/skip-first.delay.js.map +1 -0
- package/dist/node_modules/exponential-backoff/dist/jitter/full/full.jitter.js +8 -0
- package/dist/node_modules/exponential-backoff/dist/jitter/full/full.jitter.js.map +1 -0
- package/dist/node_modules/exponential-backoff/dist/jitter/jitter.factory.js +15 -0
- package/dist/node_modules/exponential-backoff/dist/jitter/jitter.factory.js.map +1 -0
- package/dist/node_modules/exponential-backoff/dist/jitter/no/no.jitter.js +7 -0
- package/dist/node_modules/exponential-backoff/dist/jitter/no/no.jitter.js.map +1 -0
- package/dist/node_modules/exponential-backoff/dist/options.js +31 -0
- package/dist/node_modules/exponential-backoff/dist/options.js.map +1 -0
- package/dist/node_modules/exponential-backoff/package.json +61 -0
- package/dist/node_modules/{promise-inflight → foreground-child}/LICENSE +5 -4
- package/dist/node_modules/foreground-child/dist/cjs/all-signals.d.ts.map +1 -0
- package/dist/node_modules/foreground-child/dist/cjs/all-signals.js +58 -0
- package/dist/node_modules/foreground-child/dist/cjs/all-signals.js.map +1 -0
- package/dist/node_modules/foreground-child/dist/cjs/index.d.ts.map +1 -0
- package/dist/node_modules/foreground-child/dist/cjs/index.js +154 -0
- package/dist/node_modules/foreground-child/dist/cjs/index.js.map +1 -0
- package/dist/node_modules/foreground-child/dist/cjs/package.json +3 -0
- package/dist/node_modules/foreground-child/dist/cjs/watchdog.d.ts.map +1 -0
- package/dist/node_modules/foreground-child/dist/cjs/watchdog.js +43 -0
- package/dist/node_modules/foreground-child/dist/cjs/watchdog.js.map +1 -0
- package/dist/node_modules/foreground-child/dist/mjs/all-signals.d.ts.map +1 -0
- package/dist/node_modules/foreground-child/dist/mjs/all-signals.js +52 -0
- package/dist/node_modules/foreground-child/dist/mjs/all-signals.js.map +1 -0
- package/dist/node_modules/foreground-child/dist/mjs/index.d.ts.map +1 -0
- package/dist/node_modules/foreground-child/dist/mjs/index.js +146 -0
- package/dist/node_modules/foreground-child/dist/mjs/index.js.map +1 -0
- package/dist/node_modules/foreground-child/dist/mjs/package.json +3 -0
- package/dist/node_modules/foreground-child/dist/mjs/watchdog.d.ts.map +1 -0
- package/dist/node_modules/foreground-child/dist/mjs/watchdog.js +39 -0
- package/dist/node_modules/foreground-child/dist/mjs/watchdog.js.map +1 -0
- package/dist/node_modules/foreground-child/package.json +83 -0
- package/dist/node_modules/fs-minipass/lib/index.js +443 -0
- package/dist/node_modules/fs-minipass/package.json +28 -13
- package/dist/node_modules/gauge/node_modules/ansi-regex/index.js +10 -0
- package/dist/node_modules/gauge/node_modules/ansi-regex/license +9 -0
- package/dist/node_modules/gauge/node_modules/ansi-regex/package.json +55 -0
- package/dist/node_modules/gauge/node_modules/signal-exit/LICENSE.txt +16 -0
- package/dist/node_modules/gauge/node_modules/signal-exit/package.json +38 -0
- package/dist/node_modules/gauge/node_modules/strip-ansi/index.js +4 -0
- package/dist/node_modules/gauge/node_modules/strip-ansi/license +9 -0
- package/dist/node_modules/gauge/node_modules/strip-ansi/package.json +54 -0
- package/dist/node_modules/jackspeak/dist/cjs/index.d.ts.map +1 -0
- package/dist/node_modules/jackspeak/dist/cjs/index.js +723 -0
- package/dist/node_modules/jackspeak/dist/cjs/index.js.map +1 -0
- package/dist/node_modules/jackspeak/dist/cjs/package.json +3 -0
- package/dist/node_modules/jackspeak/dist/cjs/parse-args-cjs.d.ts.map +1 -0
- package/dist/node_modules/jackspeak/dist/cjs/parse-args-cjs.js.map +1 -0
- package/dist/node_modules/jackspeak/dist/cjs/parse-args.js +42 -0
- package/dist/node_modules/jackspeak/dist/mjs/index.d.ts.map +1 -0
- package/dist/node_modules/jackspeak/dist/mjs/index.js +713 -0
- package/dist/node_modules/jackspeak/dist/mjs/index.js.map +1 -0
- package/dist/node_modules/jackspeak/dist/mjs/package.json +3 -0
- package/dist/node_modules/jackspeak/dist/mjs/parse-args-esm.d.ts.map +1 -0
- package/dist/node_modules/jackspeak/dist/mjs/parse-args-esm.js.map +1 -0
- package/dist/node_modules/jackspeak/dist/mjs/parse-args.js +19 -0
- package/dist/node_modules/jackspeak/package.json +98 -0
- package/dist/node_modules/make-fetch-happen/lib/cache/entry.js +26 -1
- package/dist/node_modules/make-fetch-happen/lib/options.js +2 -0
- package/dist/node_modules/make-fetch-happen/lib/remote.js +1 -1
- package/dist/node_modules/make-fetch-happen/package.json +16 -17
- package/dist/node_modules/minipass/LICENSE +1 -1
- package/dist/node_modules/minipass/index.js +299 -246
- package/dist/node_modules/minipass/package.json +27 -7
- package/dist/node_modules/{tar → minipass-collect}/node_modules/minipass/LICENSE +1 -1
- package/dist/node_modules/minipass-collect/node_modules/minipass/index.js +649 -0
- package/dist/node_modules/{tar → minipass-collect}/node_modules/minipass/package.json +7 -27
- package/dist/node_modules/minipass-fetch/lib/blob.js +1 -1
- package/dist/node_modules/minipass-fetch/lib/body.js +1 -1
- package/dist/node_modules/minipass-fetch/lib/index.js +15 -3
- package/dist/node_modules/minipass-fetch/lib/request.js +2 -1
- package/dist/node_modules/minipass-fetch/package.json +13 -11
- package/dist/node_modules/minipass-flush/node_modules/minipass/LICENSE +15 -0
- package/dist/node_modules/minipass-flush/node_modules/minipass/index.js +649 -0
- package/dist/node_modules/minipass-flush/node_modules/minipass/package.json +56 -0
- package/dist/node_modules/minipass-pipeline/node_modules/minipass/LICENSE +15 -0
- package/dist/node_modules/minipass-pipeline/node_modules/minipass/index.js +649 -0
- package/dist/node_modules/minipass-pipeline/node_modules/minipass/package.json +56 -0
- package/dist/node_modules/minipass-sized/node_modules/minipass/LICENSE +15 -0
- package/dist/node_modules/minipass-sized/node_modules/minipass/index.js +649 -0
- package/dist/node_modules/minipass-sized/node_modules/minipass/package.json +56 -0
- package/dist/node_modules/minizlib/node_modules/minipass/LICENSE +15 -0
- package/dist/node_modules/minizlib/node_modules/minipass/index.js +649 -0
- package/dist/node_modules/minizlib/node_modules/minipass/package.json +56 -0
- package/dist/node_modules/node-gyp/.github/workflows/tests.yml +9 -6
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +1 -1
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +1 -1
- package/dist/node_modules/node-gyp/lib/find-visualstudio.js +13 -2
- package/dist/node_modules/node-gyp/lib/install.js +174 -92
- package/dist/node_modules/node-gyp/package.json +7 -6
- package/dist/node_modules/node-gyp/update-gyp.py +1 -1
- package/dist/node_modules/path-key/index.js +16 -0
- package/dist/node_modules/path-key/license +9 -0
- package/dist/node_modules/path-key/package.json +39 -0
- package/dist/node_modules/path-scurry/dist/cjs/index.d.ts.map +1 -0
- package/dist/node_modules/path-scurry/dist/cjs/index.js +1995 -0
- package/dist/node_modules/path-scurry/dist/cjs/index.js.map +1 -0
- package/dist/node_modules/path-scurry/dist/cjs/package.json +3 -0
- package/dist/node_modules/path-scurry/dist/mjs/index.d.ts.map +1 -0
- package/dist/node_modules/path-scurry/dist/mjs/index.js +1960 -0
- package/dist/node_modules/path-scurry/dist/mjs/index.js.map +1 -0
- package/dist/node_modules/path-scurry/dist/mjs/package.json +3 -0
- package/dist/node_modules/path-scurry/node_modules/lru-cache/LICENSE +15 -0
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.d.ts.map +1 -0
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js +1395 -0
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js.map +1 -0
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.min.js +2 -0
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.min.js.map +7 -0
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/cjs/package.json +3 -0
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/mjs/index.d.ts.map +1 -0
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/mjs/index.js +1391 -0
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/mjs/index.js.map +1 -0
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/mjs/index.min.js +2 -0
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/mjs/index.min.js.map +7 -0
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/mjs/package.json +3 -0
- package/dist/node_modules/path-scurry/node_modules/lru-cache/package.json +108 -0
- package/dist/node_modules/path-scurry/package.json +87 -0
- package/dist/node_modules/semver/classes/comparator.js +2 -1
- package/dist/node_modules/semver/classes/range.js +40 -27
- package/dist/node_modules/semver/classes/semver.js +5 -3
- package/dist/node_modules/semver/functions/coerce.js +1 -1
- package/dist/node_modules/semver/functions/diff.js +31 -20
- package/dist/node_modules/semver/internal/constants.js +5 -0
- package/dist/node_modules/semver/internal/re.js +30 -4
- package/dist/node_modules/semver/package.json +4 -4
- package/dist/node_modules/shebang-command/index.js +19 -0
- package/dist/node_modules/shebang-command/license +9 -0
- package/dist/node_modules/shebang-command/package.json +34 -0
- package/dist/node_modules/shebang-regex/index.js +2 -0
- package/dist/node_modules/shebang-regex/license +9 -0
- package/dist/node_modules/shebang-regex/package.json +35 -0
- package/dist/node_modules/signal-exit/LICENSE.txt +1 -1
- package/dist/node_modules/signal-exit/dist/cjs/browser.d.ts.map +1 -0
- package/dist/node_modules/signal-exit/dist/cjs/browser.js +10 -0
- package/dist/node_modules/signal-exit/dist/cjs/browser.js.map +1 -0
- package/dist/node_modules/signal-exit/dist/cjs/index.d.ts.map +1 -0
- package/dist/node_modules/signal-exit/dist/cjs/index.js +272 -0
- package/dist/node_modules/signal-exit/dist/cjs/index.js.map +1 -0
- package/dist/node_modules/signal-exit/dist/cjs/package.json +3 -0
- package/dist/node_modules/signal-exit/dist/cjs/signals.d.ts.map +1 -0
- package/dist/node_modules/signal-exit/dist/cjs/signals.js +42 -0
- package/dist/node_modules/signal-exit/dist/cjs/signals.js.map +1 -0
- package/dist/node_modules/signal-exit/dist/mjs/browser.d.ts.map +1 -0
- package/dist/node_modules/signal-exit/dist/mjs/browser.js +4 -0
- package/dist/node_modules/signal-exit/dist/mjs/browser.js.map +1 -0
- package/dist/node_modules/signal-exit/dist/mjs/index.d.ts.map +1 -0
- package/dist/node_modules/signal-exit/dist/mjs/index.js +268 -0
- package/dist/node_modules/signal-exit/dist/mjs/index.js.map +1 -0
- package/dist/node_modules/signal-exit/dist/mjs/package.json +3 -0
- package/dist/node_modules/signal-exit/dist/mjs/signals.d.ts.map +1 -0
- package/dist/node_modules/signal-exit/dist/mjs/signals.js +39 -0
- package/dist/node_modules/signal-exit/dist/mjs/signals.js.map +1 -0
- package/dist/node_modules/signal-exit/package.json +87 -19
- package/dist/node_modules/ssri/lib/index.js +157 -101
- package/dist/node_modules/ssri/package.json +12 -10
- package/dist/node_modules/string-width/node_modules/ansi-regex/index.js +10 -0
- package/dist/node_modules/string-width/node_modules/ansi-regex/license +9 -0
- package/dist/node_modules/string-width/node_modules/ansi-regex/package.json +55 -0
- package/dist/node_modules/string-width/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/dist/node_modules/string-width/node_modules/emoji-regex/es2015/index.js +6 -0
- package/dist/node_modules/string-width/node_modules/emoji-regex/es2015/text.js +6 -0
- package/dist/node_modules/string-width/node_modules/emoji-regex/index.js +6 -0
- package/dist/node_modules/string-width/node_modules/emoji-regex/package.json +50 -0
- package/dist/node_modules/string-width/node_modules/emoji-regex/text.js +6 -0
- package/dist/node_modules/string-width/node_modules/strip-ansi/index.js +4 -0
- package/dist/node_modules/string-width/node_modules/strip-ansi/license +9 -0
- package/dist/node_modules/string-width/node_modules/strip-ansi/package.json +54 -0
- package/dist/node_modules/string-width-cjs/index.js +47 -0
- package/dist/node_modules/string-width-cjs/license +9 -0
- package/dist/node_modules/string-width-cjs/node_modules/ansi-regex/index.js +10 -0
- package/dist/node_modules/string-width-cjs/node_modules/ansi-regex/license +9 -0
- package/dist/node_modules/string-width-cjs/node_modules/ansi-regex/package.json +55 -0
- package/dist/node_modules/string-width-cjs/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/dist/node_modules/string-width-cjs/node_modules/emoji-regex/es2015/index.js +6 -0
- package/dist/node_modules/string-width-cjs/node_modules/emoji-regex/es2015/text.js +6 -0
- package/dist/node_modules/string-width-cjs/node_modules/emoji-regex/index.js +6 -0
- package/dist/node_modules/string-width-cjs/node_modules/emoji-regex/package.json +50 -0
- package/dist/node_modules/string-width-cjs/node_modules/emoji-regex/text.js +6 -0
- package/dist/node_modules/string-width-cjs/node_modules/strip-ansi/index.js +4 -0
- package/dist/node_modules/string-width-cjs/node_modules/strip-ansi/license +9 -0
- package/dist/node_modules/string-width-cjs/node_modules/strip-ansi/package.json +54 -0
- package/dist/node_modules/string-width-cjs/package.json +56 -0
- package/dist/node_modules/strip-ansi/index.js +13 -3
- package/dist/node_modules/strip-ansi/license +1 -1
- package/dist/node_modules/strip-ansi/package.json +10 -7
- package/dist/node_modules/strip-ansi-cjs/index.js +4 -0
- package/dist/node_modules/strip-ansi-cjs/license +9 -0
- package/dist/node_modules/strip-ansi-cjs/node_modules/ansi-regex/index.js +10 -0
- package/dist/node_modules/strip-ansi-cjs/node_modules/ansi-regex/license +9 -0
- package/dist/node_modules/strip-ansi-cjs/node_modules/ansi-regex/package.json +55 -0
- package/dist/node_modules/strip-ansi-cjs/package.json +54 -0
- package/dist/node_modules/{infer-owner → tar/node_modules/fs-minipass}/LICENSE +1 -1
- package/dist/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/LICENSE +15 -0
- package/dist/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/index.js +649 -0
- package/dist/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/package.json +56 -0
- package/dist/node_modules/tar/node_modules/fs-minipass/package.json +39 -0
- package/dist/node_modules/unique-filename/package.json +12 -9
- package/dist/node_modules/unique-slug/package.json +10 -7
- package/dist/node_modules/wrap-ansi/index.js +214 -0
- package/dist/node_modules/wrap-ansi/license +9 -0
- package/dist/node_modules/wrap-ansi/node_modules/string-width/index.js +54 -0
- package/dist/node_modules/wrap-ansi/node_modules/string-width/license +9 -0
- package/dist/node_modules/wrap-ansi/node_modules/string-width/package.json +59 -0
- package/dist/node_modules/wrap-ansi/package.json +69 -0
- package/dist/node_modules/wrap-ansi-cjs/index.js +216 -0
- package/dist/node_modules/wrap-ansi-cjs/license +9 -0
- package/dist/node_modules/wrap-ansi-cjs/node_modules/ansi-regex/index.js +10 -0
- package/dist/node_modules/wrap-ansi-cjs/node_modules/ansi-regex/license +9 -0
- package/dist/node_modules/wrap-ansi-cjs/node_modules/ansi-regex/package.json +55 -0
- package/dist/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/index.js +163 -0
- package/dist/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/license +9 -0
- package/dist/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/package.json +56 -0
- package/dist/node_modules/wrap-ansi-cjs/node_modules/strip-ansi/index.js +4 -0
- package/dist/node_modules/wrap-ansi-cjs/node_modules/strip-ansi/license +9 -0
- package/dist/node_modules/wrap-ansi-cjs/node_modules/strip-ansi/package.json +54 -0
- package/dist/node_modules/wrap-ansi-cjs/package.json +62 -0
- package/dist/pnpm.cjs +30877 -17543
- package/package.json +3 -3
- package/dist/node_modules/@gar/promisify/index.js +0 -36
- package/dist/node_modules/@gar/promisify/package.json +0 -32
- package/dist/node_modules/@npmcli/fs/lib/common/owner-sync.js +0 -96
- package/dist/node_modules/@npmcli/fs/lib/common/owner.js +0 -96
- package/dist/node_modules/@npmcli/fs/lib/copy-file.js +0 -16
- package/dist/node_modules/@npmcli/fs/lib/fs.js +0 -14
- package/dist/node_modules/@npmcli/fs/lib/mkdir.js +0 -19
- package/dist/node_modules/@npmcli/fs/lib/mkdtemp.js +0 -23
- package/dist/node_modules/@npmcli/fs/lib/rm/index.js +0 -22
- package/dist/node_modules/@npmcli/fs/lib/rm/polyfill.js +0 -239
- package/dist/node_modules/@npmcli/fs/lib/with-owner-sync.js +0 -21
- package/dist/node_modules/@npmcli/fs/lib/with-owner.js +0 -21
- package/dist/node_modules/@npmcli/fs/lib/write-file.js +0 -14
- package/dist/node_modules/@npmcli/move-file/lib/index.js +0 -185
- package/dist/node_modules/@npmcli/move-file/package.json +0 -47
- package/dist/node_modules/cacache/lib/util/fix-owner.js +0 -145
- package/dist/node_modules/cacache/lib/util/move-file.js +0 -56
- package/dist/node_modules/cacache/node_modules/glob/common.js +0 -244
- package/dist/node_modules/cacache/node_modules/glob/glob.js +0 -790
- package/dist/node_modules/cacache/node_modules/glob/sync.js +0 -486
- package/dist/node_modules/cacache/node_modules/minimatch/lib/path.js +0 -4
- package/dist/node_modules/cacache/node_modules/minimatch/minimatch.js +0 -944
- package/dist/node_modules/infer-owner/index.js +0 -71
- package/dist/node_modules/infer-owner/package.json +0 -26
- package/dist/node_modules/promise-inflight/inflight.js +0 -36
- package/dist/node_modules/promise-inflight/package.json +0 -24
- package/dist/node_modules/tar/node_modules/minipass/index.js +0 -702
- /package/dist/node_modules/@npmcli/fs/lib/{errors.js → cp/errors.js} +0 -0
- /package/dist/node_modules/{signal-exit → gauge/node_modules/signal-exit}/index.js +0 -0
- /package/dist/node_modules/{signal-exit → gauge/node_modules/signal-exit}/signals.js +0 -0
- /package/dist/node_modules/{tar/node_modules/minipass → minipass}/index.mjs +0 -0
- /package/dist/node_modules/{fs-minipass → tar/node_modules/fs-minipass}/index.js +0 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
ArrayPrototypeForEach,
|
|
5
|
+
ArrayPrototypeIncludes,
|
|
6
|
+
ArrayPrototypeMap,
|
|
7
|
+
ArrayPrototypePush,
|
|
8
|
+
ArrayPrototypePushApply,
|
|
9
|
+
ArrayPrototypeShift,
|
|
10
|
+
ArrayPrototypeSlice,
|
|
11
|
+
ArrayPrototypeUnshiftApply,
|
|
12
|
+
ObjectEntries,
|
|
13
|
+
ObjectPrototypeHasOwnProperty: ObjectHasOwn,
|
|
14
|
+
StringPrototypeCharAt,
|
|
15
|
+
StringPrototypeIndexOf,
|
|
16
|
+
StringPrototypeSlice,
|
|
17
|
+
StringPrototypeStartsWith,
|
|
18
|
+
} = require('./internal/primordials');
|
|
19
|
+
|
|
20
|
+
const {
|
|
21
|
+
validateArray,
|
|
22
|
+
validateBoolean,
|
|
23
|
+
validateBooleanArray,
|
|
24
|
+
validateObject,
|
|
25
|
+
validateString,
|
|
26
|
+
validateStringArray,
|
|
27
|
+
validateUnion,
|
|
28
|
+
} = require('./internal/validators');
|
|
29
|
+
|
|
30
|
+
const {
|
|
31
|
+
kEmptyObject,
|
|
32
|
+
} = require('./internal/util');
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
findLongOptionForShort,
|
|
36
|
+
isLoneLongOption,
|
|
37
|
+
isLoneShortOption,
|
|
38
|
+
isLongOptionAndValue,
|
|
39
|
+
isOptionValue,
|
|
40
|
+
isOptionLikeValue,
|
|
41
|
+
isShortOptionAndValue,
|
|
42
|
+
isShortOptionGroup,
|
|
43
|
+
useDefaultValueOption,
|
|
44
|
+
objectGetOwn,
|
|
45
|
+
optionsGetOwn,
|
|
46
|
+
} = require('./utils');
|
|
47
|
+
|
|
48
|
+
const {
|
|
49
|
+
codes: {
|
|
50
|
+
ERR_INVALID_ARG_VALUE,
|
|
51
|
+
ERR_PARSE_ARGS_INVALID_OPTION_VALUE,
|
|
52
|
+
ERR_PARSE_ARGS_UNKNOWN_OPTION,
|
|
53
|
+
ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL,
|
|
54
|
+
},
|
|
55
|
+
} = require('./internal/errors');
|
|
56
|
+
|
|
57
|
+
function getMainArgs() {
|
|
58
|
+
// Work out where to slice process.argv for user supplied arguments.
|
|
59
|
+
|
|
60
|
+
// Check node options for scenarios where user CLI args follow executable.
|
|
61
|
+
const execArgv = process.execArgv;
|
|
62
|
+
if (ArrayPrototypeIncludes(execArgv, '-e') ||
|
|
63
|
+
ArrayPrototypeIncludes(execArgv, '--eval') ||
|
|
64
|
+
ArrayPrototypeIncludes(execArgv, '-p') ||
|
|
65
|
+
ArrayPrototypeIncludes(execArgv, '--print')) {
|
|
66
|
+
return ArrayPrototypeSlice(process.argv, 1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Normally first two arguments are executable and script, then CLI arguments
|
|
70
|
+
return ArrayPrototypeSlice(process.argv, 2);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* In strict mode, throw for possible usage errors like --foo --bar
|
|
75
|
+
*
|
|
76
|
+
* @param {object} token - from tokens as available from parseArgs
|
|
77
|
+
*/
|
|
78
|
+
function checkOptionLikeValue(token) {
|
|
79
|
+
if (!token.inlineValue && isOptionLikeValue(token.value)) {
|
|
80
|
+
// Only show short example if user used short option.
|
|
81
|
+
const example = StringPrototypeStartsWith(token.rawName, '--') ?
|
|
82
|
+
`'${token.rawName}=-XYZ'` :
|
|
83
|
+
`'--${token.name}=-XYZ' or '${token.rawName}-XYZ'`;
|
|
84
|
+
const errorMessage = `Option '${token.rawName}' argument is ambiguous.
|
|
85
|
+
Did you forget to specify the option argument for '${token.rawName}'?
|
|
86
|
+
To specify an option argument starting with a dash use ${example}.`;
|
|
87
|
+
throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(errorMessage);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* In strict mode, throw for usage errors.
|
|
93
|
+
*
|
|
94
|
+
* @param {object} config - from config passed to parseArgs
|
|
95
|
+
* @param {object} token - from tokens as available from parseArgs
|
|
96
|
+
*/
|
|
97
|
+
function checkOptionUsage(config, token) {
|
|
98
|
+
if (!ObjectHasOwn(config.options, token.name)) {
|
|
99
|
+
throw new ERR_PARSE_ARGS_UNKNOWN_OPTION(
|
|
100
|
+
token.rawName, config.allowPositionals);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const short = optionsGetOwn(config.options, token.name, 'short');
|
|
104
|
+
const shortAndLong = `${short ? `-${short}, ` : ''}--${token.name}`;
|
|
105
|
+
const type = optionsGetOwn(config.options, token.name, 'type');
|
|
106
|
+
if (type === 'string' && typeof token.value !== 'string') {
|
|
107
|
+
throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(`Option '${shortAndLong} <value>' argument missing`);
|
|
108
|
+
}
|
|
109
|
+
// (Idiomatic test for undefined||null, expecting undefined.)
|
|
110
|
+
if (type === 'boolean' && token.value != null) {
|
|
111
|
+
throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(`Option '${shortAndLong}' does not take an argument`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Store the option value in `values`.
|
|
118
|
+
*
|
|
119
|
+
* @param {string} longOption - long option name e.g. 'foo'
|
|
120
|
+
* @param {string|undefined} optionValue - value from user args
|
|
121
|
+
* @param {object} options - option configs, from parseArgs({ options })
|
|
122
|
+
* @param {object} values - option values returned in `values` by parseArgs
|
|
123
|
+
*/
|
|
124
|
+
function storeOption(longOption, optionValue, options, values) {
|
|
125
|
+
if (longOption === '__proto__') {
|
|
126
|
+
return; // No. Just no.
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// We store based on the option value rather than option type,
|
|
130
|
+
// preserving the users intent for author to deal with.
|
|
131
|
+
const newValue = optionValue ?? true;
|
|
132
|
+
if (optionsGetOwn(options, longOption, 'multiple')) {
|
|
133
|
+
// Always store value in array, including for boolean.
|
|
134
|
+
// values[longOption] starts out not present,
|
|
135
|
+
// first value is added as new array [newValue],
|
|
136
|
+
// subsequent values are pushed to existing array.
|
|
137
|
+
// (note: values has null prototype, so simpler usage)
|
|
138
|
+
if (values[longOption]) {
|
|
139
|
+
ArrayPrototypePush(values[longOption], newValue);
|
|
140
|
+
} else {
|
|
141
|
+
values[longOption] = [newValue];
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
values[longOption] = newValue;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Store the default option value in `values`.
|
|
150
|
+
*
|
|
151
|
+
* @param {string} longOption - long option name e.g. 'foo'
|
|
152
|
+
* @param {string
|
|
153
|
+
* | boolean
|
|
154
|
+
* | string[]
|
|
155
|
+
* | boolean[]} optionValue - default value from option config
|
|
156
|
+
* @param {object} values - option values returned in `values` by parseArgs
|
|
157
|
+
*/
|
|
158
|
+
function storeDefaultOption(longOption, optionValue, values) {
|
|
159
|
+
if (longOption === '__proto__') {
|
|
160
|
+
return; // No. Just no.
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
values[longOption] = optionValue;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Process args and turn into identified tokens:
|
|
168
|
+
* - option (along with value, if any)
|
|
169
|
+
* - positional
|
|
170
|
+
* - option-terminator
|
|
171
|
+
*
|
|
172
|
+
* @param {string[]} args - from parseArgs({ args }) or mainArgs
|
|
173
|
+
* @param {object} options - option configs, from parseArgs({ options })
|
|
174
|
+
*/
|
|
175
|
+
function argsToTokens(args, options) {
|
|
176
|
+
const tokens = [];
|
|
177
|
+
let index = -1;
|
|
178
|
+
let groupCount = 0;
|
|
179
|
+
|
|
180
|
+
const remainingArgs = ArrayPrototypeSlice(args);
|
|
181
|
+
while (remainingArgs.length > 0) {
|
|
182
|
+
const arg = ArrayPrototypeShift(remainingArgs);
|
|
183
|
+
const nextArg = remainingArgs[0];
|
|
184
|
+
if (groupCount > 0)
|
|
185
|
+
groupCount--;
|
|
186
|
+
else
|
|
187
|
+
index++;
|
|
188
|
+
|
|
189
|
+
// Check if `arg` is an options terminator.
|
|
190
|
+
// Guideline 10 in https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
|
|
191
|
+
if (arg === '--') {
|
|
192
|
+
// Everything after a bare '--' is considered a positional argument.
|
|
193
|
+
ArrayPrototypePush(tokens, { kind: 'option-terminator', index });
|
|
194
|
+
ArrayPrototypePushApply(
|
|
195
|
+
tokens, ArrayPrototypeMap(remainingArgs, (arg) => {
|
|
196
|
+
return { kind: 'positional', index: ++index, value: arg };
|
|
197
|
+
})
|
|
198
|
+
);
|
|
199
|
+
break; // Finished processing args, leave while loop.
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (isLoneShortOption(arg)) {
|
|
203
|
+
// e.g. '-f'
|
|
204
|
+
const shortOption = StringPrototypeCharAt(arg, 1);
|
|
205
|
+
const longOption = findLongOptionForShort(shortOption, options);
|
|
206
|
+
let value;
|
|
207
|
+
let inlineValue;
|
|
208
|
+
if (optionsGetOwn(options, longOption, 'type') === 'string' &&
|
|
209
|
+
isOptionValue(nextArg)) {
|
|
210
|
+
// e.g. '-f', 'bar'
|
|
211
|
+
value = ArrayPrototypeShift(remainingArgs);
|
|
212
|
+
inlineValue = false;
|
|
213
|
+
}
|
|
214
|
+
ArrayPrototypePush(
|
|
215
|
+
tokens,
|
|
216
|
+
{ kind: 'option', name: longOption, rawName: arg,
|
|
217
|
+
index, value, inlineValue });
|
|
218
|
+
if (value != null) ++index;
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (isShortOptionGroup(arg, options)) {
|
|
223
|
+
// Expand -fXzy to -f -X -z -y
|
|
224
|
+
const expanded = [];
|
|
225
|
+
for (let index = 1; index < arg.length; index++) {
|
|
226
|
+
const shortOption = StringPrototypeCharAt(arg, index);
|
|
227
|
+
const longOption = findLongOptionForShort(shortOption, options);
|
|
228
|
+
if (optionsGetOwn(options, longOption, 'type') !== 'string' ||
|
|
229
|
+
index === arg.length - 1) {
|
|
230
|
+
// Boolean option, or last short in group. Well formed.
|
|
231
|
+
ArrayPrototypePush(expanded, `-${shortOption}`);
|
|
232
|
+
} else {
|
|
233
|
+
// String option in middle. Yuck.
|
|
234
|
+
// Expand -abfFILE to -a -b -fFILE
|
|
235
|
+
ArrayPrototypePush(expanded, `-${StringPrototypeSlice(arg, index)}`);
|
|
236
|
+
break; // finished short group
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
ArrayPrototypeUnshiftApply(remainingArgs, expanded);
|
|
240
|
+
groupCount = expanded.length;
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (isShortOptionAndValue(arg, options)) {
|
|
245
|
+
// e.g. -fFILE
|
|
246
|
+
const shortOption = StringPrototypeCharAt(arg, 1);
|
|
247
|
+
const longOption = findLongOptionForShort(shortOption, options);
|
|
248
|
+
const value = StringPrototypeSlice(arg, 2);
|
|
249
|
+
ArrayPrototypePush(
|
|
250
|
+
tokens,
|
|
251
|
+
{ kind: 'option', name: longOption, rawName: `-${shortOption}`,
|
|
252
|
+
index, value, inlineValue: true });
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (isLoneLongOption(arg)) {
|
|
257
|
+
// e.g. '--foo'
|
|
258
|
+
const longOption = StringPrototypeSlice(arg, 2);
|
|
259
|
+
let value;
|
|
260
|
+
let inlineValue;
|
|
261
|
+
if (optionsGetOwn(options, longOption, 'type') === 'string' &&
|
|
262
|
+
isOptionValue(nextArg)) {
|
|
263
|
+
// e.g. '--foo', 'bar'
|
|
264
|
+
value = ArrayPrototypeShift(remainingArgs);
|
|
265
|
+
inlineValue = false;
|
|
266
|
+
}
|
|
267
|
+
ArrayPrototypePush(
|
|
268
|
+
tokens,
|
|
269
|
+
{ kind: 'option', name: longOption, rawName: arg,
|
|
270
|
+
index, value, inlineValue });
|
|
271
|
+
if (value != null) ++index;
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (isLongOptionAndValue(arg)) {
|
|
276
|
+
// e.g. --foo=bar
|
|
277
|
+
const equalIndex = StringPrototypeIndexOf(arg, '=');
|
|
278
|
+
const longOption = StringPrototypeSlice(arg, 2, equalIndex);
|
|
279
|
+
const value = StringPrototypeSlice(arg, equalIndex + 1);
|
|
280
|
+
ArrayPrototypePush(
|
|
281
|
+
tokens,
|
|
282
|
+
{ kind: 'option', name: longOption, rawName: `--${longOption}`,
|
|
283
|
+
index, value, inlineValue: true });
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
ArrayPrototypePush(tokens, { kind: 'positional', index, value: arg });
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return tokens;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const parseArgs = (config = kEmptyObject) => {
|
|
294
|
+
const args = objectGetOwn(config, 'args') ?? getMainArgs();
|
|
295
|
+
const strict = objectGetOwn(config, 'strict') ?? true;
|
|
296
|
+
const allowPositionals = objectGetOwn(config, 'allowPositionals') ?? !strict;
|
|
297
|
+
const returnTokens = objectGetOwn(config, 'tokens') ?? false;
|
|
298
|
+
const options = objectGetOwn(config, 'options') ?? { __proto__: null };
|
|
299
|
+
// Bundle these up for passing to strict-mode checks.
|
|
300
|
+
const parseConfig = { args, strict, options, allowPositionals };
|
|
301
|
+
|
|
302
|
+
// Validate input configuration.
|
|
303
|
+
validateArray(args, 'args');
|
|
304
|
+
validateBoolean(strict, 'strict');
|
|
305
|
+
validateBoolean(allowPositionals, 'allowPositionals');
|
|
306
|
+
validateBoolean(returnTokens, 'tokens');
|
|
307
|
+
validateObject(options, 'options');
|
|
308
|
+
ArrayPrototypeForEach(
|
|
309
|
+
ObjectEntries(options),
|
|
310
|
+
({ 0: longOption, 1: optionConfig }) => {
|
|
311
|
+
validateObject(optionConfig, `options.${longOption}`);
|
|
312
|
+
|
|
313
|
+
// type is required
|
|
314
|
+
const optionType = objectGetOwn(optionConfig, 'type');
|
|
315
|
+
validateUnion(optionType, `options.${longOption}.type`, ['string', 'boolean']);
|
|
316
|
+
|
|
317
|
+
if (ObjectHasOwn(optionConfig, 'short')) {
|
|
318
|
+
const shortOption = optionConfig.short;
|
|
319
|
+
validateString(shortOption, `options.${longOption}.short`);
|
|
320
|
+
if (shortOption.length !== 1) {
|
|
321
|
+
throw new ERR_INVALID_ARG_VALUE(
|
|
322
|
+
`options.${longOption}.short`,
|
|
323
|
+
shortOption,
|
|
324
|
+
'must be a single character'
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const multipleOption = objectGetOwn(optionConfig, 'multiple');
|
|
330
|
+
if (ObjectHasOwn(optionConfig, 'multiple')) {
|
|
331
|
+
validateBoolean(multipleOption, `options.${longOption}.multiple`);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const defaultValue = objectGetOwn(optionConfig, 'default');
|
|
335
|
+
if (defaultValue !== undefined) {
|
|
336
|
+
let validator;
|
|
337
|
+
switch (optionType) {
|
|
338
|
+
case 'string':
|
|
339
|
+
validator = multipleOption ? validateStringArray : validateString;
|
|
340
|
+
break;
|
|
341
|
+
|
|
342
|
+
case 'boolean':
|
|
343
|
+
validator = multipleOption ? validateBooleanArray : validateBoolean;
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
validator(defaultValue, `options.${longOption}.default`);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
|
|
351
|
+
// Phase 1: identify tokens
|
|
352
|
+
const tokens = argsToTokens(args, options);
|
|
353
|
+
|
|
354
|
+
// Phase 2: process tokens into parsed option values and positionals
|
|
355
|
+
const result = {
|
|
356
|
+
values: { __proto__: null },
|
|
357
|
+
positionals: [],
|
|
358
|
+
};
|
|
359
|
+
if (returnTokens) {
|
|
360
|
+
result.tokens = tokens;
|
|
361
|
+
}
|
|
362
|
+
ArrayPrototypeForEach(tokens, (token) => {
|
|
363
|
+
if (token.kind === 'option') {
|
|
364
|
+
if (strict) {
|
|
365
|
+
checkOptionUsage(parseConfig, token);
|
|
366
|
+
checkOptionLikeValue(token);
|
|
367
|
+
}
|
|
368
|
+
storeOption(token.name, token.value, options, result.values);
|
|
369
|
+
} else if (token.kind === 'positional') {
|
|
370
|
+
if (!allowPositionals) {
|
|
371
|
+
throw new ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL(token.value);
|
|
372
|
+
}
|
|
373
|
+
ArrayPrototypePush(result.positionals, token.value);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
// Phase 3: fill in default values for missing args
|
|
378
|
+
ArrayPrototypeForEach(ObjectEntries(options), ({ 0: longOption,
|
|
379
|
+
1: optionConfig }) => {
|
|
380
|
+
const mustSetDefault = useDefaultValueOption(longOption,
|
|
381
|
+
optionConfig,
|
|
382
|
+
result.values);
|
|
383
|
+
if (mustSetDefault) {
|
|
384
|
+
storeDefaultOption(longOption,
|
|
385
|
+
objectGetOwn(optionConfig, 'default'),
|
|
386
|
+
result.values);
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
return result;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
module.exports = {
|
|
395
|
+
parseArgs,
|
|
396
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class ERR_INVALID_ARG_TYPE extends TypeError {
|
|
4
|
+
constructor(name, expected, actual) {
|
|
5
|
+
super(`${name} must be ${expected} got ${actual}`);
|
|
6
|
+
this.code = 'ERR_INVALID_ARG_TYPE';
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
class ERR_INVALID_ARG_VALUE extends TypeError {
|
|
11
|
+
constructor(arg1, arg2, expected) {
|
|
12
|
+
super(`The property ${arg1} ${expected}. Received '${arg2}'`);
|
|
13
|
+
this.code = 'ERR_INVALID_ARG_VALUE';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
class ERR_PARSE_ARGS_INVALID_OPTION_VALUE extends Error {
|
|
18
|
+
constructor(message) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.code = 'ERR_PARSE_ARGS_INVALID_OPTION_VALUE';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
class ERR_PARSE_ARGS_UNKNOWN_OPTION extends Error {
|
|
25
|
+
constructor(option, allowPositionals) {
|
|
26
|
+
const suggestDashDash = allowPositionals ? `. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- ${JSON.stringify(option)}` : '';
|
|
27
|
+
super(`Unknown option '${option}'${suggestDashDash}`);
|
|
28
|
+
this.code = 'ERR_PARSE_ARGS_UNKNOWN_OPTION';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
class ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL extends Error {
|
|
33
|
+
constructor(positional) {
|
|
34
|
+
super(`Unexpected argument '${positional}'. This command does not take positional arguments`);
|
|
35
|
+
this.code = 'ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = {
|
|
40
|
+
codes: {
|
|
41
|
+
ERR_INVALID_ARG_TYPE,
|
|
42
|
+
ERR_INVALID_ARG_VALUE,
|
|
43
|
+
ERR_PARSE_ARGS_INVALID_OPTION_VALUE,
|
|
44
|
+
ERR_PARSE_ARGS_UNKNOWN_OPTION,
|
|
45
|
+
ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL,
|
|
46
|
+
}
|
|
47
|
+
};
|