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,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var jitter_factory_1 = require("../jitter/jitter.factory");
|
|
4
|
+
var Delay = /** @class */ (function () {
|
|
5
|
+
function Delay(options) {
|
|
6
|
+
this.options = options;
|
|
7
|
+
this.attempt = 0;
|
|
8
|
+
}
|
|
9
|
+
Delay.prototype.apply = function () {
|
|
10
|
+
var _this = this;
|
|
11
|
+
return new Promise(function (resolve) { return setTimeout(resolve, _this.jitteredDelay); });
|
|
12
|
+
};
|
|
13
|
+
Delay.prototype.setAttemptNumber = function (attempt) {
|
|
14
|
+
this.attempt = attempt;
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(Delay.prototype, "jitteredDelay", {
|
|
17
|
+
get: function () {
|
|
18
|
+
var jitter = jitter_factory_1.JitterFactory(this.options);
|
|
19
|
+
return jitter(this.delay);
|
|
20
|
+
},
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(Delay.prototype, "delay", {
|
|
25
|
+
get: function () {
|
|
26
|
+
var constant = this.options.startingDelay;
|
|
27
|
+
var base = this.options.timeMultiple;
|
|
28
|
+
var power = this.numOfDelayedAttempts;
|
|
29
|
+
var delay = constant * Math.pow(base, power);
|
|
30
|
+
return Math.min(delay, this.options.maxDelay);
|
|
31
|
+
},
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(Delay.prototype, "numOfDelayedAttempts", {
|
|
36
|
+
get: function () {
|
|
37
|
+
return this.attempt;
|
|
38
|
+
},
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true
|
|
41
|
+
});
|
|
42
|
+
return Delay;
|
|
43
|
+
}());
|
|
44
|
+
exports.Delay = Delay;
|
|
45
|
+
//# sourceMappingURL=delay.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delay.base.js","sourceRoot":"","sources":["../../src/delay/delay.base.ts"],"names":[],"mappings":";;AAEA,2DAAyD;AAEzD;IAEE,eAAoB,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;QADlC,YAAO,GAAG,CAAC,CAAC;IACyB,CAAC;IAEzC,qBAAK,GAAZ;QAAA,iBAEC;QADC,OAAO,IAAI,OAAO,CAAC,UAAA,OAAO,IAAI,OAAA,UAAU,CAAC,OAAO,EAAE,KAAI,CAAC,aAAa,CAAC,EAAvC,CAAuC,CAAC,CAAC;IACzE,CAAC;IAEM,gCAAgB,GAAvB,UAAwB,OAAe;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,sBAAY,gCAAa;aAAzB;YACE,IAAM,MAAM,GAAG,8BAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;;;OAAA;IAED,sBAAY,wBAAK;aAAjB;YACE,IAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;YAC5C,IAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;YACvC,IAAM,KAAK,GAAG,IAAI,CAAC,oBAAoB,CAAC;YACxC,IAAM,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAE/C,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAChD,CAAC;;;OAAA;IAED,sBAAc,uCAAoB;aAAlC;YACE,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;;;OAAA;IACH,YAAC;AAAD,CAAC,AA7BD,IA6BC;AA7BqB,sBAAK"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var skip_first_delay_1 = require("./skip-first/skip-first.delay");
|
|
4
|
+
var always_delay_1 = require("./always/always.delay");
|
|
5
|
+
function DelayFactory(options, attempt) {
|
|
6
|
+
var delay = initDelayClass(options);
|
|
7
|
+
delay.setAttemptNumber(attempt);
|
|
8
|
+
return delay;
|
|
9
|
+
}
|
|
10
|
+
exports.DelayFactory = DelayFactory;
|
|
11
|
+
function initDelayClass(options) {
|
|
12
|
+
if (!options.delayFirstAttempt) {
|
|
13
|
+
return new skip_first_delay_1.SkipFirstDelay(options);
|
|
14
|
+
}
|
|
15
|
+
return new always_delay_1.AlwaysDelay(options);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=delay.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delay.factory.js","sourceRoot":"","sources":["../../src/delay/delay.factory.ts"],"names":[],"mappings":";;AACA,kEAA+D;AAC/D,sDAAoD;AAGpD,SAAgB,YAAY,CAAC,OAAwB,EAAE,OAAe;IAClE,IAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACtC,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAChC,OAAO,KAAK,CAAC;AACjB,CAAC;AAJD,oCAIC;AAED,SAAS,cAAc,CAAC,OAAwB;IAC5C,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE;QAC5B,OAAO,IAAI,iCAAc,CAAC,OAAO,CAAC,CAAC;KACtC;IAED,OAAO,IAAI,0BAAW,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delay.interface.js","sourceRoot":"","sources":["../../src/delay/delay.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
17
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
19
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
20
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
21
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
25
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
26
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
27
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
28
|
+
function step(op) {
|
|
29
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
30
|
+
while (_) try {
|
|
31
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
32
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
33
|
+
switch (op[0]) {
|
|
34
|
+
case 0: case 1: t = op; break;
|
|
35
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
36
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
37
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
38
|
+
default:
|
|
39
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
40
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
41
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
42
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
43
|
+
if (t[2]) _.ops.pop();
|
|
44
|
+
_.trys.pop(); continue;
|
|
45
|
+
}
|
|
46
|
+
op = body.call(thisArg, _);
|
|
47
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
48
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
|
+
var delay_base_1 = require("../delay.base");
|
|
53
|
+
var SkipFirstDelay = /** @class */ (function (_super) {
|
|
54
|
+
__extends(SkipFirstDelay, _super);
|
|
55
|
+
function SkipFirstDelay() {
|
|
56
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
57
|
+
}
|
|
58
|
+
SkipFirstDelay.prototype.apply = function () {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
+
return __generator(this, function (_a) {
|
|
61
|
+
return [2 /*return*/, this.isFirstAttempt ? true : _super.prototype.apply.call(this)];
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
Object.defineProperty(SkipFirstDelay.prototype, "isFirstAttempt", {
|
|
66
|
+
get: function () {
|
|
67
|
+
return this.attempt === 0;
|
|
68
|
+
},
|
|
69
|
+
enumerable: true,
|
|
70
|
+
configurable: true
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(SkipFirstDelay.prototype, "numOfDelayedAttempts", {
|
|
73
|
+
get: function () {
|
|
74
|
+
return this.attempt - 1;
|
|
75
|
+
},
|
|
76
|
+
enumerable: true,
|
|
77
|
+
configurable: true
|
|
78
|
+
});
|
|
79
|
+
return SkipFirstDelay;
|
|
80
|
+
}(delay_base_1.Delay));
|
|
81
|
+
exports.SkipFirstDelay = SkipFirstDelay;
|
|
82
|
+
//# sourceMappingURL=skip-first.delay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skip-first.delay.js","sourceRoot":"","sources":["../../../src/delay/skip-first/skip-first.delay.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAsC;AAEtC;IAAoC,kCAAK;IAAzC;;IAYA,CAAC;IAXgB,8BAAK,GAAlB;;;gBACI,sBAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAM,KAAK,WAAE,EAAC;;;KACrD;IAED,sBAAY,0CAAc;aAA1B;YACI,OAAO,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC;QAC9B,CAAC;;;OAAA;IAED,sBAAc,gDAAoB;aAAlC;YACI,OAAO,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;QAC5B,CAAC;;;OAAA;IACL,qBAAC;AAAD,CAAC,AAZD,CAAoC,kBAAK,GAYxC;AAZY,wCAAc"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function fullJitter(delay) {
|
|
4
|
+
var jitteredDelay = Math.random() * delay;
|
|
5
|
+
return Math.round(jitteredDelay);
|
|
6
|
+
}
|
|
7
|
+
exports.fullJitter = fullJitter;
|
|
8
|
+
//# sourceMappingURL=full.jitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"full.jitter.js","sourceRoot":"","sources":["../../../src/jitter/full/full.jitter.ts"],"names":[],"mappings":";;AAAA,SAAgB,UAAU,CAAC,KAAa;IACpC,IAAM,aAAa,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC;IAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;AACrC,CAAC;AAHD,gCAGC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var full_jitter_1 = require("./full/full.jitter");
|
|
4
|
+
var no_jitter_1 = require("./no/no.jitter");
|
|
5
|
+
function JitterFactory(options) {
|
|
6
|
+
switch (options.jitter) {
|
|
7
|
+
case "full":
|
|
8
|
+
return full_jitter_1.fullJitter;
|
|
9
|
+
case "none":
|
|
10
|
+
default:
|
|
11
|
+
return no_jitter_1.noJitter;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.JitterFactory = JitterFactory;
|
|
15
|
+
//# sourceMappingURL=jitter.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jitter.factory.js","sourceRoot":"","sources":["../../src/jitter/jitter.factory.ts"],"names":[],"mappings":";;AACA,kDAAgD;AAChD,4CAA0C;AAI1C,SAAgB,aAAa,CAAC,OAAwB;IACpD,QAAQ,OAAO,CAAC,MAAM,EAAE;QACtB,KAAK,MAAM;YACT,OAAO,wBAAU,CAAC;QAEpB,KAAK,MAAM,CAAC;QACZ;YACE,OAAO,oBAAQ,CAAC;KACnB;AACH,CAAC;AATD,sCASC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no.jitter.js","sourceRoot":"","sources":["../../../src/jitter/no/no.jitter.ts"],"names":[],"mappings":";;AAAA,SAAgB,QAAQ,CAAC,KAAa;IAClC,OAAO,KAAK,CAAC;AACjB,CAAC;AAFD,4BAEC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
var defaultOptions = {
|
|
15
|
+
delayFirstAttempt: false,
|
|
16
|
+
jitter: "none",
|
|
17
|
+
maxDelay: Infinity,
|
|
18
|
+
numOfAttempts: 10,
|
|
19
|
+
retry: function () { return true; },
|
|
20
|
+
startingDelay: 100,
|
|
21
|
+
timeMultiple: 2
|
|
22
|
+
};
|
|
23
|
+
function getSanitizedOptions(options) {
|
|
24
|
+
var sanitized = __assign(__assign({}, defaultOptions), options);
|
|
25
|
+
if (sanitized.numOfAttempts < 1) {
|
|
26
|
+
sanitized.numOfAttempts = 1;
|
|
27
|
+
}
|
|
28
|
+
return sanitized;
|
|
29
|
+
}
|
|
30
|
+
exports.getSanitizedOptions = getSanitizedOptions;
|
|
31
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAcA,IAAM,cAAc,GAAoB;IACtC,iBAAiB,EAAE,KAAK;IACxB,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,QAAQ;IAClB,aAAa,EAAE,EAAE;IACjB,KAAK,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;IACjB,aAAa,EAAE,GAAG;IAClB,YAAY,EAAE,CAAC;CAChB,CAAC;AAEF,SAAgB,mBAAmB,CAAC,OAAuB;IACzD,IAAM,SAAS,yBAAyB,cAAc,GAAK,OAAO,CAAE,CAAC;IAErE,IAAI,SAAS,CAAC,aAAa,GAAG,CAAC,EAAE;QAC/B,SAAS,CAAC,aAAa,GAAG,CAAC,CAAC;KAC7B;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AARD,kDAQC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "exponential-backoff",
|
|
3
|
+
"version": "3.1.1",
|
|
4
|
+
"description": "A utility that allows retrying a function with an exponential delay between attempts.",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist/"
|
|
7
|
+
],
|
|
8
|
+
"main": "dist/backoff.js",
|
|
9
|
+
"types": "dist/backoff.d.ts",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"test": "jest",
|
|
13
|
+
"test:watch": "jest --watch"
|
|
14
|
+
},
|
|
15
|
+
"husky": {
|
|
16
|
+
"hooks": {
|
|
17
|
+
"pre-commit": "lint-staged"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"lint-staged": {
|
|
21
|
+
"*.{ts,json,md}": [
|
|
22
|
+
"prettier --write",
|
|
23
|
+
"git add"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"jest": {
|
|
27
|
+
"transform": {
|
|
28
|
+
"^.+\\.ts$": "ts-jest"
|
|
29
|
+
},
|
|
30
|
+
"testRegex": "\\.spec\\.ts$",
|
|
31
|
+
"moduleFileExtensions": [
|
|
32
|
+
"ts",
|
|
33
|
+
"js"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/coveo/exponential-backoff.git"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"exponential",
|
|
42
|
+
"backoff",
|
|
43
|
+
"retry"
|
|
44
|
+
],
|
|
45
|
+
"author": "Sami Sayegh",
|
|
46
|
+
"license": "Apache-2.0",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/coveo/exponential-backoff/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/coveo/exponential-backoff#readme",
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/jest": "^24.0.18",
|
|
53
|
+
"@types/node": "^10.14.21",
|
|
54
|
+
"husky": "^3.0.9",
|
|
55
|
+
"jest": "^24.9.0",
|
|
56
|
+
"lint-staged": "^9.4.2",
|
|
57
|
+
"prettier": "^1.18.2",
|
|
58
|
+
"ts-jest": "^24.1.0",
|
|
59
|
+
"typescript": "^3.6.4"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
The ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-2023 Isaac Z. Schlueter and Contributors
|
|
2
4
|
|
|
3
5
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
6
|
purpose with or without fee is hereby granted, provided that the above
|
|
@@ -9,6 +11,5 @@ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
9
11
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
10
12
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
11
13
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
12
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
15
|
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all-signals.d.ts","sourceRoot":"","sources":["../../src/all-signals.ts"],"names":[],"mappings":";AACA,eAAO,MAAM,UAAU,kBASA,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.allSignals = void 0;
|
|
7
|
+
const node_constants_1 = __importDefault(require("node:constants"));
|
|
8
|
+
exports.allSignals =
|
|
9
|
+
// this is the full list of signals that Node will let us do anything with
|
|
10
|
+
Object.keys(node_constants_1.default).filter(k => k.startsWith('SIG') &&
|
|
11
|
+
// https://github.com/tapjs/signal-exit/issues/21
|
|
12
|
+
k !== 'SIGPROF' &&
|
|
13
|
+
// no sense trying to listen for SIGKILL, it's impossible
|
|
14
|
+
k !== 'SIGKILL');
|
|
15
|
+
// These are some obscure signals that are reported by kill -l
|
|
16
|
+
// on macOS, Linux, or Windows, but which don't have any mapping
|
|
17
|
+
// in Node.js. No sense trying if they're just going to throw
|
|
18
|
+
// every time on every platform.
|
|
19
|
+
//
|
|
20
|
+
// 'SIGEMT',
|
|
21
|
+
// 'SIGLOST',
|
|
22
|
+
// 'SIGPOLL',
|
|
23
|
+
// 'SIGRTMAX',
|
|
24
|
+
// 'SIGRTMAX-1',
|
|
25
|
+
// 'SIGRTMAX-10',
|
|
26
|
+
// 'SIGRTMAX-11',
|
|
27
|
+
// 'SIGRTMAX-12',
|
|
28
|
+
// 'SIGRTMAX-13',
|
|
29
|
+
// 'SIGRTMAX-14',
|
|
30
|
+
// 'SIGRTMAX-15',
|
|
31
|
+
// 'SIGRTMAX-2',
|
|
32
|
+
// 'SIGRTMAX-3',
|
|
33
|
+
// 'SIGRTMAX-4',
|
|
34
|
+
// 'SIGRTMAX-5',
|
|
35
|
+
// 'SIGRTMAX-6',
|
|
36
|
+
// 'SIGRTMAX-7',
|
|
37
|
+
// 'SIGRTMAX-8',
|
|
38
|
+
// 'SIGRTMAX-9',
|
|
39
|
+
// 'SIGRTMIN',
|
|
40
|
+
// 'SIGRTMIN+1',
|
|
41
|
+
// 'SIGRTMIN+10',
|
|
42
|
+
// 'SIGRTMIN+11',
|
|
43
|
+
// 'SIGRTMIN+12',
|
|
44
|
+
// 'SIGRTMIN+13',
|
|
45
|
+
// 'SIGRTMIN+14',
|
|
46
|
+
// 'SIGRTMIN+15',
|
|
47
|
+
// 'SIGRTMIN+16',
|
|
48
|
+
// 'SIGRTMIN+2',
|
|
49
|
+
// 'SIGRTMIN+3',
|
|
50
|
+
// 'SIGRTMIN+4',
|
|
51
|
+
// 'SIGRTMIN+5',
|
|
52
|
+
// 'SIGRTMIN+6',
|
|
53
|
+
// 'SIGRTMIN+7',
|
|
54
|
+
// 'SIGRTMIN+8',
|
|
55
|
+
// 'SIGRTMIN+9',
|
|
56
|
+
// 'SIGSTKFLT',
|
|
57
|
+
// 'SIGUNUSED',
|
|
58
|
+
//# sourceMappingURL=all-signals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all-signals.js","sourceRoot":"","sources":["../../src/all-signals.ts"],"names":[],"mappings":";;;;;;AAAA,oEAAsC;AACzB,QAAA,UAAU;AACrB,0EAA0E;AAC1E,MAAM,CAAC,IAAI,CAAC,wBAAS,CAAC,CAAC,MAAM,CAC3B,CAAC,CAAC,EAAE,CACF,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;IACnB,iDAAiD;IACjD,CAAC,KAAK,SAAS;IACf,yDAAyD;IACzD,CAAC,KAAK,SAAS,CACE,CAAA;AAEvB,8DAA8D;AAC9D,gEAAgE;AAChE,6DAA6D;AAC7D,gCAAgC;AAChC,EAAE;AACF,YAAY;AACZ,aAAa;AACb,aAAa;AACb,cAAc;AACd,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,cAAc;AACd,gBAAgB;AAChB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,gBAAgB;AAChB,eAAe;AACf,eAAe","sourcesContent":["import constants from 'node:constants'\nexport const allSignals =\n // this is the full list of signals that Node will let us do anything with\n Object.keys(constants).filter(\n k =>\n k.startsWith('SIG') &&\n // https://github.com/tapjs/signal-exit/issues/21\n k !== 'SIGPROF' &&\n // no sense trying to listen for SIGKILL, it's impossible\n k !== 'SIGKILL'\n ) as NodeJS.Signals[]\n\n// These are some obscure signals that are reported by kill -l\n// on macOS, Linux, or Windows, but which don't have any mapping\n// in Node.js. No sense trying if they're just going to throw\n// every time on every platform.\n//\n// 'SIGEMT',\n// 'SIGLOST',\n// 'SIGPOLL',\n// 'SIGRTMAX',\n// 'SIGRTMAX-1',\n// 'SIGRTMAX-10',\n// 'SIGRTMAX-11',\n// 'SIGRTMAX-12',\n// 'SIGRTMAX-13',\n// 'SIGRTMAX-14',\n// 'SIGRTMAX-15',\n// 'SIGRTMAX-2',\n// 'SIGRTMAX-3',\n// 'SIGRTMAX-4',\n// 'SIGRTMAX-5',\n// 'SIGRTMAX-6',\n// 'SIGRTMAX-7',\n// 'SIGRTMAX-8',\n// 'SIGRTMAX-9',\n// 'SIGRTMIN',\n// 'SIGRTMIN+1',\n// 'SIGRTMIN+10',\n// 'SIGRTMIN+11',\n// 'SIGRTMIN+12',\n// 'SIGRTMIN+13',\n// 'SIGRTMIN+14',\n// 'SIGRTMIN+15',\n// 'SIGRTMIN+16',\n// 'SIGRTMIN+2',\n// 'SIGRTMIN+3',\n// 'SIGRTMIN+4',\n// 'SIGRTMIN+5',\n// 'SIGRTMIN+6',\n// 'SIGRTMIN+7',\n// 'SIGRTMIN+8',\n// 'SIGRTMIN+9',\n// 'SIGSTKFLT',\n// 'SIGUNUSED',\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,YAAY,EAIZ,YAAY,EACb,MAAM,eAAe,CAAA;AAUtB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC,OAAO,KAE3B,IAAI,GACJ,SAAS,GACT,MAAM,GACN,MAAM,CAAC,OAAO,GACd,KAAK,GACL,OAAO,CAAC,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,CAAA;AAE/D,MAAM,MAAM,MAAM,GACd,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GAC/C,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GAC3D,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GACpC,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GACzD,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,GACrD;IACE,OAAO,EAAE,MAAM;IACf,IAAI,CAAC,EAAE,MAAM,EAAE;IACf,IAAI,CAAC,EAAE,YAAY;IACnB,OAAO,CAAC,EAAE,OAAO;CAClB,CAAA;AAEL;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,WAClB,MAAM,iFA0Bf,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EACtB,OAAO,CAAC,EAAE,OAAO,GAChB,YAAY,CAAA;AACf,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,OAAO,CAAC,EAAE,OAAO,GAChB,YAAY,CAAA;AACf,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,YAAY,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,YAAY,CAAA;AACf,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,SAAS,CAAC,EAAE,YAAY,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,YAAY,CAAA"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.foregroundChild = exports.normalizeFgArgs = void 0;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
|
9
|
+
const signal_exit_1 = require("signal-exit");
|
|
10
|
+
const all_signals_js_1 = require("./all-signals.js");
|
|
11
|
+
const watchdog_js_1 = require("./watchdog.js");
|
|
12
|
+
/* c8 ignore start */
|
|
13
|
+
const spawn = process?.platform === 'win32' ? cross_spawn_1.default : child_process_1.spawn;
|
|
14
|
+
/**
|
|
15
|
+
* Normalizes the arguments passed to `foregroundChild`.
|
|
16
|
+
*
|
|
17
|
+
* Exposed for testing.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
const normalizeFgArgs = (fgArgs) => {
|
|
22
|
+
let [program, args = [], spawnOpts = {}, cleanup = () => { }] = fgArgs;
|
|
23
|
+
if (typeof args === 'function') {
|
|
24
|
+
cleanup = args;
|
|
25
|
+
spawnOpts = {};
|
|
26
|
+
args = [];
|
|
27
|
+
}
|
|
28
|
+
else if (!!args && typeof args === 'object' && !Array.isArray(args)) {
|
|
29
|
+
if (typeof spawnOpts === 'function')
|
|
30
|
+
cleanup = spawnOpts;
|
|
31
|
+
spawnOpts = args;
|
|
32
|
+
args = [];
|
|
33
|
+
}
|
|
34
|
+
else if (typeof spawnOpts === 'function') {
|
|
35
|
+
cleanup = spawnOpts;
|
|
36
|
+
spawnOpts = {};
|
|
37
|
+
}
|
|
38
|
+
if (Array.isArray(program)) {
|
|
39
|
+
const [pp, ...pa] = program;
|
|
40
|
+
program = pp;
|
|
41
|
+
args = pa;
|
|
42
|
+
}
|
|
43
|
+
return [program, args, { ...spawnOpts }, cleanup];
|
|
44
|
+
};
|
|
45
|
+
exports.normalizeFgArgs = normalizeFgArgs;
|
|
46
|
+
function foregroundChild(...fgArgs) {
|
|
47
|
+
const [program, args, spawnOpts, cleanup] = (0, exports.normalizeFgArgs)(fgArgs);
|
|
48
|
+
spawnOpts.stdio = [0, 1, 2];
|
|
49
|
+
if (process.send) {
|
|
50
|
+
spawnOpts.stdio.push('ipc');
|
|
51
|
+
}
|
|
52
|
+
const child = spawn(program, args, spawnOpts);
|
|
53
|
+
const unproxySignals = proxySignals(child);
|
|
54
|
+
const childHangup = () => {
|
|
55
|
+
try {
|
|
56
|
+
child.kill('SIGHUP');
|
|
57
|
+
/* c8 ignore start */
|
|
58
|
+
}
|
|
59
|
+
catch (_) {
|
|
60
|
+
// SIGHUP is weird on windows
|
|
61
|
+
child.kill('SIGTERM');
|
|
62
|
+
}
|
|
63
|
+
/* c8 ignore stop */
|
|
64
|
+
};
|
|
65
|
+
const removeOnExit = (0, signal_exit_1.onExit)(childHangup);
|
|
66
|
+
const dog = (0, watchdog_js_1.watchdog)(child);
|
|
67
|
+
let done = false;
|
|
68
|
+
child.on('close', async (code, signal) => {
|
|
69
|
+
dog.kill('SIGKILL');
|
|
70
|
+
/* c8 ignore start */
|
|
71
|
+
if (done) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
/* c8 ignore stop */
|
|
75
|
+
done = true;
|
|
76
|
+
const result = cleanup(code, signal);
|
|
77
|
+
const res = isPromise(result) ? await result : result;
|
|
78
|
+
removeOnExit();
|
|
79
|
+
unproxySignals();
|
|
80
|
+
if (res === false)
|
|
81
|
+
return;
|
|
82
|
+
else if (typeof res === 'string') {
|
|
83
|
+
signal = res;
|
|
84
|
+
code = null;
|
|
85
|
+
}
|
|
86
|
+
else if (typeof res === 'number') {
|
|
87
|
+
code = res;
|
|
88
|
+
signal = null;
|
|
89
|
+
}
|
|
90
|
+
if (signal) {
|
|
91
|
+
// If there is nothing else keeping the event loop alive,
|
|
92
|
+
// then there's a race between a graceful exit and getting
|
|
93
|
+
// the signal to this process. Put this timeout here to
|
|
94
|
+
// make sure we're still alive to get the signal, and thus
|
|
95
|
+
// exit with the intended signal code.
|
|
96
|
+
/* istanbul ignore next */
|
|
97
|
+
setTimeout(() => { }, 2000);
|
|
98
|
+
try {
|
|
99
|
+
process.kill(process.pid, signal);
|
|
100
|
+
/* c8 ignore start */
|
|
101
|
+
}
|
|
102
|
+
catch (_) {
|
|
103
|
+
process.kill(process.pid, 'SIGTERM');
|
|
104
|
+
}
|
|
105
|
+
/* c8 ignore stop */
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
process.exit(code || 0);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
if (process.send) {
|
|
112
|
+
process.removeAllListeners('message');
|
|
113
|
+
child.on('message', (message, sendHandle) => {
|
|
114
|
+
process.send?.(message, sendHandle);
|
|
115
|
+
});
|
|
116
|
+
process.on('message', (message, sendHandle) => {
|
|
117
|
+
child.send(message, sendHandle);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return child;
|
|
121
|
+
}
|
|
122
|
+
exports.foregroundChild = foregroundChild;
|
|
123
|
+
/**
|
|
124
|
+
* Starts forwarding signals to `child` through `parent`.
|
|
125
|
+
*/
|
|
126
|
+
const proxySignals = (child) => {
|
|
127
|
+
const listeners = new Map();
|
|
128
|
+
for (const sig of all_signals_js_1.allSignals) {
|
|
129
|
+
const listener = () => {
|
|
130
|
+
// some signals can only be received, not sent
|
|
131
|
+
try {
|
|
132
|
+
child.kill(sig);
|
|
133
|
+
/* c8 ignore start */
|
|
134
|
+
}
|
|
135
|
+
catch (_) { }
|
|
136
|
+
/* c8 ignore stop */
|
|
137
|
+
};
|
|
138
|
+
try {
|
|
139
|
+
// if it's a signal this system doesn't recognize, skip it
|
|
140
|
+
process.on(sig, listener);
|
|
141
|
+
listeners.set(sig, listener);
|
|
142
|
+
/* c8 ignore start */
|
|
143
|
+
}
|
|
144
|
+
catch (_) { }
|
|
145
|
+
/* c8 ignore stop */
|
|
146
|
+
}
|
|
147
|
+
return () => {
|
|
148
|
+
for (const [sig, listener] of listeners) {
|
|
149
|
+
process.removeListener(sig, listener);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
const isPromise = (o) => !!o && typeof o === 'object' && typeof o.then === 'function';
|
|
154
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n ChildProcess,\n SendHandle,\n Serializable,\n spawn as nodeSpawn,\n SpawnOptions,\n} from 'child_process'\nimport crossSpawn from 'cross-spawn'\nimport { onExit } from 'signal-exit'\nimport { allSignals } from './all-signals.js'\nimport { watchdog } from './watchdog.js'\n\n/* c8 ignore start */\nconst spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn\n/* c8 ignore stop */\n\n/**\n * The signature for the cleanup method.\n *\n * Arguments indicate the exit status of the child process.\n *\n * If a Promise is returned, then the process is not terminated\n * until it resolves, and the resolution value is treated as the\n * exit status (if a number) or signal exit (if a signal string).\n *\n * If `undefined` is returned, then no change is made, and the parent\n * exits in the same way that the child exited.\n *\n * If boolean `false` is returned, then the parent's exit is canceled.\n *\n * If a number is returned, then the parent process exits with the number\n * as its exitCode.\n *\n * If a signal string is returned, then the parent process is killed with\n * the same signal that caused the child to exit.\n */\nexport type Cleanup = (\n code: number | null,\n signal: null | NodeJS.Signals\n) =>\n | void\n | undefined\n | number\n | NodeJS.Signals\n | false\n | Promise<void | undefined | number | NodeJS.Signals | false>\n\nexport type FgArgs =\n | [program: string | string[], cleanup?: Cleanup]\n | [program: string[], opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, cleanup?: Cleanup]\n | [program: string, opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, args?: string[], cleanup?: Cleanup]\n | [\n program: string,\n args?: string[],\n opts?: SpawnOptions,\n cleanup?: Cleanup\n ]\n\n/**\n * Normalizes the arguments passed to `foregroundChild`.\n *\n * Exposed for testing.\n *\n * @internal\n */\nexport const normalizeFgArgs = (\n fgArgs: FgArgs\n): [\n program: string,\n args: string[],\n spawnOpts: SpawnOptions,\n cleanup: Cleanup\n] => {\n let [program, args = [], spawnOpts = {}, cleanup = () => {}] = fgArgs\n if (typeof args === 'function') {\n cleanup = args\n spawnOpts = {}\n args = []\n } else if (!!args && typeof args === 'object' && !Array.isArray(args)) {\n if (typeof spawnOpts === 'function') cleanup = spawnOpts\n spawnOpts = args\n args = []\n } else if (typeof spawnOpts === 'function') {\n cleanup = spawnOpts\n spawnOpts = {}\n }\n if (Array.isArray(program)) {\n const [pp, ...pa] = program\n program = pp\n args = pa\n }\n return [program, args, { ...spawnOpts }, cleanup]\n}\n\n/**\n * Spawn the specified program as a \"foreground\" process, or at least as\n * close as is possible given node's lack of exec-without-fork.\n *\n * Cleanup method may be used to modify or ignore the result of the child's\n * exit code or signal. If cleanup returns undefined (or a Promise that\n * resolves to undefined), then the parent will exit in the same way that\n * the child did.\n *\n * Return boolean `false` to prevent the parent's exit entirely.\n */\nexport function foregroundChild(\n cmd: string | string[],\n cleanup?: Cleanup\n): ChildProcess\nexport function foregroundChild(\n program: string,\n args?: string[],\n cleanup?: Cleanup\n): ChildProcess\nexport function foregroundChild(\n program: string,\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup\n): ChildProcess\nexport function foregroundChild(\n program: string,\n args?: string[],\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup\n): ChildProcess\nexport function foregroundChild(...fgArgs: FgArgs): ChildProcess {\n const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs)\n\n spawnOpts.stdio = [0, 1, 2]\n if (process.send) {\n spawnOpts.stdio.push('ipc')\n }\n\n const child = spawn(program, args, spawnOpts)\n\n const unproxySignals = proxySignals(child)\n const childHangup = () => {\n try {\n child.kill('SIGHUP')\n\n /* c8 ignore start */\n } catch (_) {\n // SIGHUP is weird on windows\n child.kill('SIGTERM')\n }\n /* c8 ignore stop */\n }\n const removeOnExit = onExit(childHangup)\n\n const dog = watchdog(child)\n\n let done = false\n child.on('close', async (code, signal) => {\n dog.kill('SIGKILL')\n /* c8 ignore start */\n if (done) {\n return\n }\n /* c8 ignore stop */\n done = true\n const result = cleanup(code, signal)\n const res = isPromise(result) ? await result : result\n removeOnExit()\n unproxySignals()\n\n if (res === false) return\n else if (typeof res === 'string') {\n signal = res\n code = null\n } else if (typeof res === 'number') {\n code = res\n signal = null\n }\n\n if (signal) {\n // If there is nothing else keeping the event loop alive,\n // then there's a race between a graceful exit and getting\n // the signal to this process. Put this timeout here to\n // make sure we're still alive to get the signal, and thus\n // exit with the intended signal code.\n /* istanbul ignore next */\n setTimeout(() => {}, 2000)\n try {\n process.kill(process.pid, signal)\n /* c8 ignore start */\n } catch (_) {\n process.kill(process.pid, 'SIGTERM')\n }\n /* c8 ignore stop */\n } else {\n process.exit(code || 0)\n }\n })\n\n if (process.send) {\n process.removeAllListeners('message')\n\n child.on('message', (message, sendHandle) => {\n process.send?.(message, sendHandle)\n })\n\n process.on('message', (message, sendHandle) => {\n child.send(\n message as Serializable,\n sendHandle as SendHandle | undefined\n )\n })\n }\n\n return child\n}\n\n/**\n * Starts forwarding signals to `child` through `parent`.\n */\nconst proxySignals = (child: ChildProcess) => {\n const listeners = new Map()\n\n for (const sig of allSignals) {\n const listener = () => {\n // some signals can only be received, not sent\n try {\n child.kill(sig)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n try {\n // if it's a signal this system doesn't recognize, skip it\n process.on(sig, listener)\n listeners.set(sig, listener)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n }\n\n return () => {\n for (const [sig, listener] of listeners) {\n process.removeListener(sig, listener)\n }\n }\n}\n\nconst isPromise = (o: any): o is Promise<any> =>\n !!o && typeof o === 'object' && typeof o.then === 'function'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watchdog.d.ts","sourceRoot":"","sources":["../../src/watchdog.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAS,MAAM,eAAe,CAAA;AAyBnD,eAAO,MAAM,QAAQ,UAAW,YAAY,iBAc3C,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// this spawns a child process that listens for SIGHUP when the
|
|
3
|
+
// parent process exits, and after 200ms, sends a SIGKILL to the
|
|
4
|
+
// child, in case it did not terminate.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.watchdog = void 0;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const watchdogCode = String.raw `
|
|
9
|
+
const pid = parseInt(process.argv[1], 10)
|
|
10
|
+
process.title = 'node (foreground-child watchdog pid=' + pid + ')'
|
|
11
|
+
if (!isNaN(pid)) {
|
|
12
|
+
let barked = false
|
|
13
|
+
// keepalive
|
|
14
|
+
const interval = setInterval(() => {}, 60000)
|
|
15
|
+
const bark = () => {
|
|
16
|
+
clearInterval(interval)
|
|
17
|
+
if (barked) return
|
|
18
|
+
barked = true
|
|
19
|
+
process.removeListener('SIGHUP', bark)
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
try {
|
|
22
|
+
process.kill(pid, 'SIGKILL')
|
|
23
|
+
setTimeout(() => process.exit(), 200)
|
|
24
|
+
} catch (_) {}
|
|
25
|
+
}, 500)
|
|
26
|
+
})
|
|
27
|
+
process.on('SIGHUP', bark)
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
const watchdog = (child) => {
|
|
31
|
+
let dogExited = false;
|
|
32
|
+
const dog = (0, child_process_1.spawn)(process.execPath, ['-e', watchdogCode, String(child.pid)], {
|
|
33
|
+
stdio: 'ignore',
|
|
34
|
+
});
|
|
35
|
+
dog.on('exit', () => (dogExited = true));
|
|
36
|
+
child.on('exit', () => {
|
|
37
|
+
if (!dogExited)
|
|
38
|
+
dog.kill('SIGTERM');
|
|
39
|
+
});
|
|
40
|
+
return dog;
|
|
41
|
+
};
|
|
42
|
+
exports.watchdog = watchdog;
|
|
43
|
+
//# sourceMappingURL=watchdog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watchdog.js","sourceRoot":"","sources":["../../src/watchdog.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,gEAAgE;AAChE,uCAAuC;;;AAEvC,iDAAmD;AAEnD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;CAqB9B,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC9C,IAAI,SAAS,GAAG,KAAK,CAAA;IACrB,MAAM,GAAG,GAAG,IAAA,qBAAK,EACf,OAAO,CAAC,QAAQ,EAChB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EACvC;QACE,KAAK,EAAE,QAAQ;KAChB,CACF,CAAA;IACD,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAA;IACxC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,IAAI,CAAC,SAAS;YAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAdY,QAAA,QAAQ,YAcpB","sourcesContent":["// this spawns a child process that listens for SIGHUP when the\n// parent process exits, and after 200ms, sends a SIGKILL to the\n// child, in case it did not terminate.\n\nimport { ChildProcess, spawn } from 'child_process'\n\nconst watchdogCode = String.raw`\nconst pid = parseInt(process.argv[1], 10)\nprocess.title = 'node (foreground-child watchdog pid=' + pid + ')'\nif (!isNaN(pid)) {\n let barked = false\n // keepalive\n const interval = setInterval(() => {}, 60000)\n const bark = () => {\n clearInterval(interval)\n if (barked) return\n barked = true\n process.removeListener('SIGHUP', bark)\n setTimeout(() => {\n try {\n process.kill(pid, 'SIGKILL')\n setTimeout(() => process.exit(), 200)\n } catch (_) {}\n }, 500)\n })\n process.on('SIGHUP', bark)\n}\n`\n\nexport const watchdog = (child: ChildProcess) => {\n let dogExited = false\n const dog = spawn(\n process.execPath,\n ['-e', watchdogCode, String(child.pid)],\n {\n stdio: 'ignore',\n }\n )\n dog.on('exit', () => (dogExited = true))\n child.on('exit', () => {\n if (!dogExited) dog.kill('SIGTERM')\n })\n return dog\n}\n"]}
|