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
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
-
const proc =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
const proc =
|
|
3
|
+
typeof process === 'object' && process
|
|
4
|
+
? process
|
|
5
|
+
: {
|
|
6
|
+
stdout: null,
|
|
7
|
+
stderr: null,
|
|
8
|
+
}
|
|
6
9
|
const EE = require('events')
|
|
7
10
|
const Stream = require('stream')
|
|
8
|
-
const
|
|
11
|
+
const stringdecoder = require('string_decoder')
|
|
12
|
+
const SD = stringdecoder.StringDecoder
|
|
9
13
|
|
|
10
14
|
const EOF = Symbol('EOF')
|
|
11
15
|
const MAYBE_EMIT_END = Symbol('maybeEmitEnd')
|
|
@@ -21,89 +25,91 @@ const DECODER = Symbol('decoder')
|
|
|
21
25
|
const FLOWING = Symbol('flowing')
|
|
22
26
|
const PAUSED = Symbol('paused')
|
|
23
27
|
const RESUME = Symbol('resume')
|
|
28
|
+
const BUFFER = Symbol('buffer')
|
|
29
|
+
const PIPES = Symbol('pipes')
|
|
24
30
|
const BUFFERLENGTH = Symbol('bufferLength')
|
|
25
31
|
const BUFFERPUSH = Symbol('bufferPush')
|
|
26
32
|
const BUFFERSHIFT = Symbol('bufferShift')
|
|
27
33
|
const OBJECTMODE = Symbol('objectMode')
|
|
34
|
+
// internal event when stream is destroyed
|
|
28
35
|
const DESTROYED = Symbol('destroyed')
|
|
36
|
+
// internal event when stream has an error
|
|
37
|
+
const ERROR = Symbol('error')
|
|
29
38
|
const EMITDATA = Symbol('emitData')
|
|
30
39
|
const EMITEND = Symbol('emitEnd')
|
|
31
40
|
const EMITEND2 = Symbol('emitEnd2')
|
|
32
41
|
const ASYNC = Symbol('async')
|
|
42
|
+
const ABORT = Symbol('abort')
|
|
43
|
+
const ABORTED = Symbol('aborted')
|
|
44
|
+
const SIGNAL = Symbol('signal')
|
|
33
45
|
|
|
34
46
|
const defer = fn => Promise.resolve().then(fn)
|
|
35
47
|
|
|
36
48
|
// TODO remove when Node v8 support drops
|
|
37
|
-
const doIter = global._MP_NO_ITERATOR_SYMBOLS_
|
|
38
|
-
const ASYNCITERATOR =
|
|
39
|
-
|| Symbol('asyncIterator not implemented')
|
|
40
|
-
const ITERATOR =
|
|
41
|
-
|| Symbol('iterator not implemented')
|
|
49
|
+
const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1'
|
|
50
|
+
const ASYNCITERATOR =
|
|
51
|
+
(doIter && Symbol.asyncIterator) || Symbol('asyncIterator not implemented')
|
|
52
|
+
const ITERATOR =
|
|
53
|
+
(doIter && Symbol.iterator) || Symbol('iterator not implemented')
|
|
42
54
|
|
|
43
55
|
// events that mean 'the stream is over'
|
|
44
56
|
// these are treated specially, and re-emitted
|
|
45
57
|
// if they are listened for after emitting.
|
|
46
|
-
const isEndish = ev =>
|
|
47
|
-
ev === 'end' ||
|
|
48
|
-
ev === 'finish' ||
|
|
49
|
-
ev === 'prefinish'
|
|
58
|
+
const isEndish = ev => ev === 'end' || ev === 'finish' || ev === 'prefinish'
|
|
50
59
|
|
|
51
|
-
const isArrayBuffer = b =>
|
|
52
|
-
|
|
53
|
-
b
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
const isArrayBuffer = b =>
|
|
61
|
+
b instanceof ArrayBuffer ||
|
|
62
|
+
(typeof b === 'object' &&
|
|
63
|
+
b.constructor &&
|
|
64
|
+
b.constructor.name === 'ArrayBuffer' &&
|
|
65
|
+
b.byteLength >= 0)
|
|
56
66
|
|
|
57
67
|
const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b)
|
|
58
68
|
|
|
59
69
|
class Pipe {
|
|
60
|
-
constructor
|
|
70
|
+
constructor(src, dest, opts) {
|
|
61
71
|
this.src = src
|
|
62
72
|
this.dest = dest
|
|
63
73
|
this.opts = opts
|
|
64
74
|
this.ondrain = () => src[RESUME]()
|
|
65
75
|
dest.on('drain', this.ondrain)
|
|
66
76
|
}
|
|
67
|
-
unpipe
|
|
77
|
+
unpipe() {
|
|
68
78
|
this.dest.removeListener('drain', this.ondrain)
|
|
69
79
|
}
|
|
70
80
|
// istanbul ignore next - only here for the prototype
|
|
71
|
-
proxyErrors
|
|
72
|
-
end
|
|
81
|
+
proxyErrors() {}
|
|
82
|
+
end() {
|
|
73
83
|
this.unpipe()
|
|
74
|
-
if (this.opts.end)
|
|
75
|
-
this.dest.end()
|
|
84
|
+
if (this.opts.end) this.dest.end()
|
|
76
85
|
}
|
|
77
86
|
}
|
|
78
87
|
|
|
79
88
|
class PipeProxyErrors extends Pipe {
|
|
80
|
-
unpipe
|
|
89
|
+
unpipe() {
|
|
81
90
|
this.src.removeListener('error', this.proxyErrors)
|
|
82
91
|
super.unpipe()
|
|
83
92
|
}
|
|
84
|
-
constructor
|
|
93
|
+
constructor(src, dest, opts) {
|
|
85
94
|
super(src, dest, opts)
|
|
86
95
|
this.proxyErrors = er => dest.emit('error', er)
|
|
87
96
|
src.on('error', this.proxyErrors)
|
|
88
97
|
}
|
|
89
98
|
}
|
|
90
99
|
|
|
91
|
-
|
|
92
|
-
constructor
|
|
100
|
+
class Minipass extends Stream {
|
|
101
|
+
constructor(options) {
|
|
93
102
|
super()
|
|
94
103
|
this[FLOWING] = false
|
|
95
104
|
// whether we're explicitly paused
|
|
96
105
|
this[PAUSED] = false
|
|
97
|
-
this
|
|
98
|
-
this
|
|
99
|
-
this[OBJECTMODE] = options && options.objectMode || false
|
|
100
|
-
if (this[OBJECTMODE])
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (this[ENCODING] === 'buffer')
|
|
105
|
-
this[ENCODING] = null
|
|
106
|
-
this[ASYNC] = options && !!options.async || false
|
|
106
|
+
this[PIPES] = []
|
|
107
|
+
this[BUFFER] = []
|
|
108
|
+
this[OBJECTMODE] = (options && options.objectMode) || false
|
|
109
|
+
if (this[OBJECTMODE]) this[ENCODING] = null
|
|
110
|
+
else this[ENCODING] = (options && options.encoding) || null
|
|
111
|
+
if (this[ENCODING] === 'buffer') this[ENCODING] = null
|
|
112
|
+
this[ASYNC] = (options && !!options.async) || false
|
|
107
113
|
this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null
|
|
108
114
|
this[EOF] = false
|
|
109
115
|
this[EMITTED_END] = false
|
|
@@ -114,55 +120,96 @@ module.exports = class Minipass extends Stream {
|
|
|
114
120
|
this.readable = true
|
|
115
121
|
this[BUFFERLENGTH] = 0
|
|
116
122
|
this[DESTROYED] = false
|
|
123
|
+
if (options && options.debugExposeBuffer === true) {
|
|
124
|
+
Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })
|
|
125
|
+
}
|
|
126
|
+
if (options && options.debugExposePipes === true) {
|
|
127
|
+
Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })
|
|
128
|
+
}
|
|
129
|
+
this[SIGNAL] = options && options.signal
|
|
130
|
+
this[ABORTED] = false
|
|
131
|
+
if (this[SIGNAL]) {
|
|
132
|
+
this[SIGNAL].addEventListener('abort', () => this[ABORT]())
|
|
133
|
+
if (this[SIGNAL].aborted) {
|
|
134
|
+
this[ABORT]()
|
|
135
|
+
}
|
|
136
|
+
}
|
|
117
137
|
}
|
|
118
138
|
|
|
119
|
-
get bufferLength
|
|
139
|
+
get bufferLength() {
|
|
140
|
+
return this[BUFFERLENGTH]
|
|
141
|
+
}
|
|
120
142
|
|
|
121
|
-
get encoding
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
143
|
+
get encoding() {
|
|
144
|
+
return this[ENCODING]
|
|
145
|
+
}
|
|
146
|
+
set encoding(enc) {
|
|
147
|
+
if (this[OBJECTMODE]) throw new Error('cannot set encoding in objectMode')
|
|
125
148
|
|
|
126
|
-
if (
|
|
127
|
-
|
|
149
|
+
if (
|
|
150
|
+
this[ENCODING] &&
|
|
151
|
+
enc !== this[ENCODING] &&
|
|
152
|
+
((this[DECODER] && this[DECODER].lastNeed) || this[BUFFERLENGTH])
|
|
153
|
+
)
|
|
128
154
|
throw new Error('cannot change encoding')
|
|
129
155
|
|
|
130
156
|
if (this[ENCODING] !== enc) {
|
|
131
157
|
this[DECODER] = enc ? new SD(enc) : null
|
|
132
|
-
if (this.
|
|
133
|
-
this
|
|
158
|
+
if (this[BUFFER].length)
|
|
159
|
+
this[BUFFER] = this[BUFFER].map(chunk => this[DECODER].write(chunk))
|
|
134
160
|
}
|
|
135
161
|
|
|
136
162
|
this[ENCODING] = enc
|
|
137
163
|
}
|
|
138
164
|
|
|
139
|
-
setEncoding
|
|
165
|
+
setEncoding(enc) {
|
|
140
166
|
this.encoding = enc
|
|
141
167
|
}
|
|
142
168
|
|
|
143
|
-
get objectMode
|
|
144
|
-
|
|
169
|
+
get objectMode() {
|
|
170
|
+
return this[OBJECTMODE]
|
|
171
|
+
}
|
|
172
|
+
set objectMode(om) {
|
|
173
|
+
this[OBJECTMODE] = this[OBJECTMODE] || !!om
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
get ['async']() {
|
|
177
|
+
return this[ASYNC]
|
|
178
|
+
}
|
|
179
|
+
set ['async'](a) {
|
|
180
|
+
this[ASYNC] = this[ASYNC] || !!a
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// drop everything and get out of the flow completely
|
|
184
|
+
[ABORT]() {
|
|
185
|
+
this[ABORTED] = true
|
|
186
|
+
this.emit('abort', this[SIGNAL].reason)
|
|
187
|
+
this.destroy(this[SIGNAL].reason)
|
|
188
|
+
}
|
|
145
189
|
|
|
146
|
-
get
|
|
147
|
-
|
|
190
|
+
get aborted() {
|
|
191
|
+
return this[ABORTED]
|
|
192
|
+
}
|
|
193
|
+
set aborted(_) {}
|
|
148
194
|
|
|
149
|
-
write
|
|
150
|
-
if (this[
|
|
151
|
-
|
|
195
|
+
write(chunk, encoding, cb) {
|
|
196
|
+
if (this[ABORTED]) return false
|
|
197
|
+
if (this[EOF]) throw new Error('write after end')
|
|
152
198
|
|
|
153
199
|
if (this[DESTROYED]) {
|
|
154
|
-
this.emit(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
200
|
+
this.emit(
|
|
201
|
+
'error',
|
|
202
|
+
Object.assign(
|
|
203
|
+
new Error('Cannot call write after a stream was destroyed'),
|
|
204
|
+
{ code: 'ERR_STREAM_DESTROYED' }
|
|
205
|
+
)
|
|
206
|
+
)
|
|
158
207
|
return true
|
|
159
208
|
}
|
|
160
209
|
|
|
161
|
-
if (typeof encoding === 'function')
|
|
162
|
-
cb = encoding, encoding = 'utf8'
|
|
210
|
+
if (typeof encoding === 'function') (cb = encoding), (encoding = 'utf8')
|
|
163
211
|
|
|
164
|
-
if (!encoding)
|
|
165
|
-
encoding = 'utf8'
|
|
212
|
+
if (!encoding) encoding = 'utf8'
|
|
166
213
|
|
|
167
214
|
const fn = this[ASYNC] ? defer : f => f()
|
|
168
215
|
|
|
@@ -173,8 +220,7 @@ module.exports = class Minipass extends Stream {
|
|
|
173
220
|
if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {
|
|
174
221
|
if (isArrayBufferView(chunk))
|
|
175
222
|
chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)
|
|
176
|
-
else if (isArrayBuffer(chunk))
|
|
177
|
-
chunk = Buffer.from(chunk)
|
|
223
|
+
else if (isArrayBuffer(chunk)) chunk = Buffer.from(chunk)
|
|
178
224
|
else if (typeof chunk !== 'string')
|
|
179
225
|
// use the setter so we throw if we have encoding set
|
|
180
226
|
this.objectMode = true
|
|
@@ -184,19 +230,14 @@ module.exports = class Minipass extends Stream {
|
|
|
184
230
|
// this yields better performance, fewer checks later.
|
|
185
231
|
if (this[OBJECTMODE]) {
|
|
186
232
|
/* istanbul ignore if - maybe impossible? */
|
|
187
|
-
if (this.flowing && this[BUFFERLENGTH] !== 0)
|
|
188
|
-
this[FLUSH](true)
|
|
233
|
+
if (this.flowing && this[BUFFERLENGTH] !== 0) this[FLUSH](true)
|
|
189
234
|
|
|
190
|
-
if (this.flowing)
|
|
191
|
-
|
|
192
|
-
else
|
|
193
|
-
this[BUFFERPUSH](chunk)
|
|
235
|
+
if (this.flowing) this.emit('data', chunk)
|
|
236
|
+
else this[BUFFERPUSH](chunk)
|
|
194
237
|
|
|
195
|
-
if (this[BUFFERLENGTH] !== 0)
|
|
196
|
-
this.emit('readable')
|
|
238
|
+
if (this[BUFFERLENGTH] !== 0) this.emit('readable')
|
|
197
239
|
|
|
198
|
-
if (cb)
|
|
199
|
-
fn(cb)
|
|
240
|
+
if (cb) fn(cb)
|
|
200
241
|
|
|
201
242
|
return this.flowing
|
|
202
243
|
}
|
|
@@ -204,18 +245,18 @@ module.exports = class Minipass extends Stream {
|
|
|
204
245
|
// at this point the chunk is a buffer or string
|
|
205
246
|
// don't buffer it up or send it to the decoder
|
|
206
247
|
if (!chunk.length) {
|
|
207
|
-
if (this[BUFFERLENGTH] !== 0)
|
|
208
|
-
|
|
209
|
-
if (cb)
|
|
210
|
-
fn(cb)
|
|
248
|
+
if (this[BUFFERLENGTH] !== 0) this.emit('readable')
|
|
249
|
+
if (cb) fn(cb)
|
|
211
250
|
return this.flowing
|
|
212
251
|
}
|
|
213
252
|
|
|
214
253
|
// fast-path writing strings of same encoding to a stream with
|
|
215
254
|
// an empty buffer, skipping the buffer/decoder dance
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
|
|
255
|
+
if (
|
|
256
|
+
typeof chunk === 'string' &&
|
|
257
|
+
// unless it is a string already ready for us to use
|
|
258
|
+
!(encoding === this[ENCODING] && !this[DECODER].lastNeed)
|
|
259
|
+
) {
|
|
219
260
|
chunk = Buffer.from(chunk, encoding)
|
|
220
261
|
}
|
|
221
262
|
|
|
@@ -223,73 +264,58 @@ module.exports = class Minipass extends Stream {
|
|
|
223
264
|
chunk = this[DECODER].write(chunk)
|
|
224
265
|
|
|
225
266
|
// Note: flushing CAN potentially switch us into not-flowing mode
|
|
226
|
-
if (this.flowing && this[BUFFERLENGTH] !== 0)
|
|
227
|
-
this[FLUSH](true)
|
|
267
|
+
if (this.flowing && this[BUFFERLENGTH] !== 0) this[FLUSH](true)
|
|
228
268
|
|
|
229
|
-
if (this.flowing)
|
|
230
|
-
|
|
231
|
-
else
|
|
232
|
-
this[BUFFERPUSH](chunk)
|
|
269
|
+
if (this.flowing) this.emit('data', chunk)
|
|
270
|
+
else this[BUFFERPUSH](chunk)
|
|
233
271
|
|
|
234
|
-
if (this[BUFFERLENGTH] !== 0)
|
|
235
|
-
this.emit('readable')
|
|
272
|
+
if (this[BUFFERLENGTH] !== 0) this.emit('readable')
|
|
236
273
|
|
|
237
|
-
if (cb)
|
|
238
|
-
fn(cb)
|
|
274
|
+
if (cb) fn(cb)
|
|
239
275
|
|
|
240
276
|
return this.flowing
|
|
241
277
|
}
|
|
242
278
|
|
|
243
|
-
read
|
|
244
|
-
if (this[DESTROYED])
|
|
245
|
-
return null
|
|
279
|
+
read(n) {
|
|
280
|
+
if (this[DESTROYED]) return null
|
|
246
281
|
|
|
247
282
|
if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) {
|
|
248
283
|
this[MAYBE_EMIT_END]()
|
|
249
284
|
return null
|
|
250
285
|
}
|
|
251
286
|
|
|
252
|
-
if (this[OBJECTMODE])
|
|
253
|
-
n = null
|
|
287
|
+
if (this[OBJECTMODE]) n = null
|
|
254
288
|
|
|
255
|
-
if (this.
|
|
256
|
-
if (this.encoding)
|
|
257
|
-
|
|
258
|
-
else
|
|
259
|
-
this.buffer = [Buffer.concat(this.buffer, this[BUFFERLENGTH])]
|
|
289
|
+
if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {
|
|
290
|
+
if (this.encoding) this[BUFFER] = [this[BUFFER].join('')]
|
|
291
|
+
else this[BUFFER] = [Buffer.concat(this[BUFFER], this[BUFFERLENGTH])]
|
|
260
292
|
}
|
|
261
293
|
|
|
262
|
-
const ret = this[READ](n || null, this
|
|
294
|
+
const ret = this[READ](n || null, this[BUFFER][0])
|
|
263
295
|
this[MAYBE_EMIT_END]()
|
|
264
296
|
return ret
|
|
265
297
|
}
|
|
266
298
|
|
|
267
|
-
[READ]
|
|
268
|
-
if (n === chunk.length || n === null)
|
|
269
|
-
this[BUFFERSHIFT]()
|
|
299
|
+
[READ](n, chunk) {
|
|
300
|
+
if (n === chunk.length || n === null) this[BUFFERSHIFT]()
|
|
270
301
|
else {
|
|
271
|
-
this
|
|
302
|
+
this[BUFFER][0] = chunk.slice(n)
|
|
272
303
|
chunk = chunk.slice(0, n)
|
|
273
304
|
this[BUFFERLENGTH] -= n
|
|
274
305
|
}
|
|
275
306
|
|
|
276
307
|
this.emit('data', chunk)
|
|
277
308
|
|
|
278
|
-
if (!this.
|
|
279
|
-
this.emit('drain')
|
|
309
|
+
if (!this[BUFFER].length && !this[EOF]) this.emit('drain')
|
|
280
310
|
|
|
281
311
|
return chunk
|
|
282
312
|
}
|
|
283
313
|
|
|
284
|
-
end
|
|
285
|
-
if (typeof chunk === 'function')
|
|
286
|
-
|
|
287
|
-
if (
|
|
288
|
-
|
|
289
|
-
if (chunk)
|
|
290
|
-
this.write(chunk, encoding)
|
|
291
|
-
if (cb)
|
|
292
|
-
this.once('end', cb)
|
|
314
|
+
end(chunk, encoding, cb) {
|
|
315
|
+
if (typeof chunk === 'function') (cb = chunk), (chunk = null)
|
|
316
|
+
if (typeof encoding === 'function') (cb = encoding), (encoding = 'utf8')
|
|
317
|
+
if (chunk) this.write(chunk, encoding)
|
|
318
|
+
if (cb) this.once('end', cb)
|
|
293
319
|
this[EOF] = true
|
|
294
320
|
this.writable = false
|
|
295
321
|
|
|
@@ -297,176 +323,165 @@ module.exports = class Minipass extends Stream {
|
|
|
297
323
|
// even if we're not reading.
|
|
298
324
|
// we'll re-emit if a new 'end' listener is added anyway.
|
|
299
325
|
// This makes MP more suitable to write-only use cases.
|
|
300
|
-
if (this.flowing || !this[PAUSED])
|
|
301
|
-
this[MAYBE_EMIT_END]()
|
|
326
|
+
if (this.flowing || !this[PAUSED]) this[MAYBE_EMIT_END]()
|
|
302
327
|
return this
|
|
303
328
|
}
|
|
304
329
|
|
|
305
330
|
// don't let the internal resume be overwritten
|
|
306
|
-
[RESUME]
|
|
307
|
-
if (this[DESTROYED])
|
|
308
|
-
return
|
|
331
|
+
[RESUME]() {
|
|
332
|
+
if (this[DESTROYED]) return
|
|
309
333
|
|
|
310
334
|
this[PAUSED] = false
|
|
311
335
|
this[FLOWING] = true
|
|
312
336
|
this.emit('resume')
|
|
313
|
-
if (this.
|
|
314
|
-
|
|
315
|
-
else
|
|
316
|
-
this[MAYBE_EMIT_END]()
|
|
317
|
-
else
|
|
318
|
-
this.emit('drain')
|
|
337
|
+
if (this[BUFFER].length) this[FLUSH]()
|
|
338
|
+
else if (this[EOF]) this[MAYBE_EMIT_END]()
|
|
339
|
+
else this.emit('drain')
|
|
319
340
|
}
|
|
320
341
|
|
|
321
|
-
resume
|
|
342
|
+
resume() {
|
|
322
343
|
return this[RESUME]()
|
|
323
344
|
}
|
|
324
345
|
|
|
325
|
-
pause
|
|
346
|
+
pause() {
|
|
326
347
|
this[FLOWING] = false
|
|
327
348
|
this[PAUSED] = true
|
|
328
349
|
}
|
|
329
350
|
|
|
330
|
-
get destroyed
|
|
351
|
+
get destroyed() {
|
|
331
352
|
return this[DESTROYED]
|
|
332
353
|
}
|
|
333
354
|
|
|
334
|
-
get flowing
|
|
355
|
+
get flowing() {
|
|
335
356
|
return this[FLOWING]
|
|
336
357
|
}
|
|
337
358
|
|
|
338
|
-
get paused
|
|
359
|
+
get paused() {
|
|
339
360
|
return this[PAUSED]
|
|
340
361
|
}
|
|
341
362
|
|
|
342
|
-
[BUFFERPUSH]
|
|
343
|
-
if (this[OBJECTMODE])
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
this[BUFFERLENGTH] += chunk.length
|
|
347
|
-
this.buffer.push(chunk)
|
|
363
|
+
[BUFFERPUSH](chunk) {
|
|
364
|
+
if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1
|
|
365
|
+
else this[BUFFERLENGTH] += chunk.length
|
|
366
|
+
this[BUFFER].push(chunk)
|
|
348
367
|
}
|
|
349
368
|
|
|
350
|
-
[BUFFERSHIFT]
|
|
351
|
-
if (this
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
else
|
|
355
|
-
this[BUFFERLENGTH] -= this.buffer[0].length
|
|
356
|
-
}
|
|
357
|
-
return this.buffer.shift()
|
|
369
|
+
[BUFFERSHIFT]() {
|
|
370
|
+
if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1
|
|
371
|
+
else this[BUFFERLENGTH] -= this[BUFFER][0].length
|
|
372
|
+
return this[BUFFER].shift()
|
|
358
373
|
}
|
|
359
374
|
|
|
360
|
-
[FLUSH]
|
|
361
|
-
do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]()))
|
|
375
|
+
[FLUSH](noDrain) {
|
|
376
|
+
do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length)
|
|
362
377
|
|
|
363
|
-
if (!noDrain && !this.
|
|
364
|
-
this.emit('drain')
|
|
378
|
+
if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')
|
|
365
379
|
}
|
|
366
380
|
|
|
367
|
-
[FLUSHCHUNK]
|
|
368
|
-
|
|
381
|
+
[FLUSHCHUNK](chunk) {
|
|
382
|
+
this.emit('data', chunk)
|
|
383
|
+
return this.flowing
|
|
369
384
|
}
|
|
370
385
|
|
|
371
|
-
pipe
|
|
372
|
-
if (this[DESTROYED])
|
|
373
|
-
return
|
|
386
|
+
pipe(dest, opts) {
|
|
387
|
+
if (this[DESTROYED]) return
|
|
374
388
|
|
|
375
389
|
const ended = this[EMITTED_END]
|
|
376
390
|
opts = opts || {}
|
|
377
|
-
if (dest === proc.stdout || dest === proc.stderr)
|
|
378
|
-
|
|
379
|
-
else
|
|
380
|
-
opts.end = opts.end !== false
|
|
391
|
+
if (dest === proc.stdout || dest === proc.stderr) opts.end = false
|
|
392
|
+
else opts.end = opts.end !== false
|
|
381
393
|
opts.proxyErrors = !!opts.proxyErrors
|
|
382
394
|
|
|
383
395
|
// piping an ended stream ends immediately
|
|
384
396
|
if (ended) {
|
|
385
|
-
if (opts.end)
|
|
386
|
-
dest.end()
|
|
397
|
+
if (opts.end) dest.end()
|
|
387
398
|
} else {
|
|
388
|
-
this.
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
399
|
+
this[PIPES].push(
|
|
400
|
+
!opts.proxyErrors
|
|
401
|
+
? new Pipe(this, dest, opts)
|
|
402
|
+
: new PipeProxyErrors(this, dest, opts)
|
|
403
|
+
)
|
|
404
|
+
if (this[ASYNC]) defer(() => this[RESUME]())
|
|
405
|
+
else this[RESUME]()
|
|
394
406
|
}
|
|
395
407
|
|
|
396
408
|
return dest
|
|
397
409
|
}
|
|
398
410
|
|
|
399
|
-
unpipe
|
|
400
|
-
const p = this.
|
|
411
|
+
unpipe(dest) {
|
|
412
|
+
const p = this[PIPES].find(p => p.dest === dest)
|
|
401
413
|
if (p) {
|
|
402
|
-
this.
|
|
414
|
+
this[PIPES].splice(this[PIPES].indexOf(p), 1)
|
|
403
415
|
p.unpipe()
|
|
404
416
|
}
|
|
405
417
|
}
|
|
406
418
|
|
|
407
|
-
addListener
|
|
419
|
+
addListener(ev, fn) {
|
|
408
420
|
return this.on(ev, fn)
|
|
409
421
|
}
|
|
410
422
|
|
|
411
|
-
on
|
|
423
|
+
on(ev, fn) {
|
|
412
424
|
const ret = super.on(ev, fn)
|
|
413
|
-
if (ev === 'data' && !this.
|
|
414
|
-
this[RESUME]()
|
|
425
|
+
if (ev === 'data' && !this[PIPES].length && !this.flowing) this[RESUME]()
|
|
415
426
|
else if (ev === 'readable' && this[BUFFERLENGTH] !== 0)
|
|
416
427
|
super.emit('readable')
|
|
417
428
|
else if (isEndish(ev) && this[EMITTED_END]) {
|
|
418
429
|
super.emit(ev)
|
|
419
430
|
this.removeAllListeners(ev)
|
|
420
431
|
} else if (ev === 'error' && this[EMITTED_ERROR]) {
|
|
421
|
-
if (this[ASYNC])
|
|
422
|
-
|
|
423
|
-
else
|
|
424
|
-
fn.call(this, this[EMITTED_ERROR])
|
|
432
|
+
if (this[ASYNC]) defer(() => fn.call(this, this[EMITTED_ERROR]))
|
|
433
|
+
else fn.call(this, this[EMITTED_ERROR])
|
|
425
434
|
}
|
|
426
435
|
return ret
|
|
427
436
|
}
|
|
428
437
|
|
|
429
|
-
get emittedEnd
|
|
438
|
+
get emittedEnd() {
|
|
430
439
|
return this[EMITTED_END]
|
|
431
440
|
}
|
|
432
441
|
|
|
433
|
-
[MAYBE_EMIT_END]
|
|
434
|
-
if (
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
442
|
+
[MAYBE_EMIT_END]() {
|
|
443
|
+
if (
|
|
444
|
+
!this[EMITTING_END] &&
|
|
445
|
+
!this[EMITTED_END] &&
|
|
446
|
+
!this[DESTROYED] &&
|
|
447
|
+
this[BUFFER].length === 0 &&
|
|
448
|
+
this[EOF]
|
|
449
|
+
) {
|
|
439
450
|
this[EMITTING_END] = true
|
|
440
451
|
this.emit('end')
|
|
441
452
|
this.emit('prefinish')
|
|
442
453
|
this.emit('finish')
|
|
443
|
-
if (this[CLOSED])
|
|
444
|
-
this.emit('close')
|
|
454
|
+
if (this[CLOSED]) this.emit('close')
|
|
445
455
|
this[EMITTING_END] = false
|
|
446
456
|
}
|
|
447
457
|
}
|
|
448
458
|
|
|
449
|
-
emit
|
|
459
|
+
emit(ev, data, ...extra) {
|
|
450
460
|
// error and close are only events allowed after calling destroy()
|
|
451
461
|
if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED])
|
|
452
462
|
return
|
|
453
463
|
else if (ev === 'data') {
|
|
454
|
-
return !
|
|
455
|
-
|
|
464
|
+
return !this[OBJECTMODE] && !data
|
|
465
|
+
? false
|
|
466
|
+
: this[ASYNC]
|
|
467
|
+
? defer(() => this[EMITDATA](data))
|
|
456
468
|
: this[EMITDATA](data)
|
|
457
469
|
} else if (ev === 'end') {
|
|
458
470
|
return this[EMITEND]()
|
|
459
471
|
} else if (ev === 'close') {
|
|
460
472
|
this[CLOSED] = true
|
|
461
473
|
// don't emit close before 'end' and 'finish'
|
|
462
|
-
if (!this[EMITTED_END] && !this[DESTROYED])
|
|
463
|
-
return
|
|
474
|
+
if (!this[EMITTED_END] && !this[DESTROYED]) return
|
|
464
475
|
const ret = super.emit('close')
|
|
465
476
|
this.removeAllListeners('close')
|
|
466
477
|
return ret
|
|
467
478
|
} else if (ev === 'error') {
|
|
468
479
|
this[EMITTED_ERROR] = data
|
|
469
|
-
|
|
480
|
+
super.emit(ERROR, data)
|
|
481
|
+
const ret =
|
|
482
|
+
!this[SIGNAL] || this.listeners('error').length
|
|
483
|
+
? super.emit('error', data)
|
|
484
|
+
: false
|
|
470
485
|
this[MAYBE_EMIT_END]()
|
|
471
486
|
return ret
|
|
472
487
|
} else if (ev === 'resume') {
|
|
@@ -485,40 +500,36 @@ module.exports = class Minipass extends Stream {
|
|
|
485
500
|
return ret
|
|
486
501
|
}
|
|
487
502
|
|
|
488
|
-
[EMITDATA]
|
|
489
|
-
for (const p of this
|
|
490
|
-
if (p.dest.write(data) === false)
|
|
491
|
-
this.pause()
|
|
503
|
+
[EMITDATA](data) {
|
|
504
|
+
for (const p of this[PIPES]) {
|
|
505
|
+
if (p.dest.write(data) === false) this.pause()
|
|
492
506
|
}
|
|
493
507
|
const ret = super.emit('data', data)
|
|
494
508
|
this[MAYBE_EMIT_END]()
|
|
495
509
|
return ret
|
|
496
510
|
}
|
|
497
511
|
|
|
498
|
-
[EMITEND]
|
|
499
|
-
if (this[EMITTED_END])
|
|
500
|
-
return
|
|
512
|
+
[EMITEND]() {
|
|
513
|
+
if (this[EMITTED_END]) return
|
|
501
514
|
|
|
502
515
|
this[EMITTED_END] = true
|
|
503
516
|
this.readable = false
|
|
504
|
-
if (this[ASYNC])
|
|
505
|
-
|
|
506
|
-
else
|
|
507
|
-
this[EMITEND2]()
|
|
517
|
+
if (this[ASYNC]) defer(() => this[EMITEND2]())
|
|
518
|
+
else this[EMITEND2]()
|
|
508
519
|
}
|
|
509
520
|
|
|
510
|
-
[EMITEND2]
|
|
521
|
+
[EMITEND2]() {
|
|
511
522
|
if (this[DECODER]) {
|
|
512
523
|
const data = this[DECODER].end()
|
|
513
524
|
if (data) {
|
|
514
|
-
for (const p of this
|
|
525
|
+
for (const p of this[PIPES]) {
|
|
515
526
|
p.dest.write(data)
|
|
516
527
|
}
|
|
517
528
|
super.emit('data', data)
|
|
518
529
|
}
|
|
519
530
|
}
|
|
520
531
|
|
|
521
|
-
for (const p of this
|
|
532
|
+
for (const p of this[PIPES]) {
|
|
522
533
|
p.end()
|
|
523
534
|
}
|
|
524
535
|
const ret = super.emit('end')
|
|
@@ -527,33 +538,34 @@ module.exports = class Minipass extends Stream {
|
|
|
527
538
|
}
|
|
528
539
|
|
|
529
540
|
// const all = await stream.collect()
|
|
530
|
-
collect
|
|
541
|
+
collect() {
|
|
531
542
|
const buf = []
|
|
532
|
-
if (!this[OBJECTMODE])
|
|
533
|
-
buf.dataLength = 0
|
|
543
|
+
if (!this[OBJECTMODE]) buf.dataLength = 0
|
|
534
544
|
// set the promise first, in case an error is raised
|
|
535
545
|
// by triggering the flow here.
|
|
536
546
|
const p = this.promise()
|
|
537
547
|
this.on('data', c => {
|
|
538
548
|
buf.push(c)
|
|
539
|
-
if (!this[OBJECTMODE])
|
|
540
|
-
buf.dataLength += c.length
|
|
549
|
+
if (!this[OBJECTMODE]) buf.dataLength += c.length
|
|
541
550
|
})
|
|
542
551
|
return p.then(() => buf)
|
|
543
552
|
}
|
|
544
553
|
|
|
545
554
|
// const data = await stream.concat()
|
|
546
|
-
concat
|
|
555
|
+
concat() {
|
|
547
556
|
return this[OBJECTMODE]
|
|
548
557
|
? Promise.reject(new Error('cannot concat in objectMode'))
|
|
549
558
|
: this.collect().then(buf =>
|
|
550
559
|
this[OBJECTMODE]
|
|
551
560
|
? Promise.reject(new Error('cannot concat in objectMode'))
|
|
552
|
-
: this[ENCODING]
|
|
561
|
+
: this[ENCODING]
|
|
562
|
+
? buf.join('')
|
|
563
|
+
: Buffer.concat(buf, buf.dataLength)
|
|
564
|
+
)
|
|
553
565
|
}
|
|
554
566
|
|
|
555
567
|
// stream.promise().then(() => done, er => emitted error)
|
|
556
|
-
promise
|
|
568
|
+
promise() {
|
|
557
569
|
return new Promise((resolve, reject) => {
|
|
558
570
|
this.on(DESTROYED, () => reject(new Error('stream destroyed')))
|
|
559
571
|
this.on('error', er => reject(er))
|
|
@@ -562,31 +574,41 @@ module.exports = class Minipass extends Stream {
|
|
|
562
574
|
}
|
|
563
575
|
|
|
564
576
|
// for await (let chunk of stream)
|
|
565
|
-
[ASYNCITERATOR]
|
|
577
|
+
[ASYNCITERATOR]() {
|
|
578
|
+
let stopped = false
|
|
579
|
+
const stop = () => {
|
|
580
|
+
this.pause()
|
|
581
|
+
stopped = true
|
|
582
|
+
return Promise.resolve({ done: true })
|
|
583
|
+
}
|
|
566
584
|
const next = () => {
|
|
585
|
+
if (stopped) return stop()
|
|
567
586
|
const res = this.read()
|
|
568
|
-
if (res !== null)
|
|
569
|
-
return Promise.resolve({ done: false, value: res })
|
|
587
|
+
if (res !== null) return Promise.resolve({ done: false, value: res })
|
|
570
588
|
|
|
571
|
-
if (this[EOF])
|
|
572
|
-
return Promise.resolve({ done: true })
|
|
589
|
+
if (this[EOF]) return stop()
|
|
573
590
|
|
|
574
591
|
let resolve = null
|
|
575
592
|
let reject = null
|
|
576
593
|
const onerr = er => {
|
|
577
594
|
this.removeListener('data', ondata)
|
|
578
595
|
this.removeListener('end', onend)
|
|
596
|
+
this.removeListener(DESTROYED, ondestroy)
|
|
597
|
+
stop()
|
|
579
598
|
reject(er)
|
|
580
599
|
}
|
|
581
600
|
const ondata = value => {
|
|
582
601
|
this.removeListener('error', onerr)
|
|
583
602
|
this.removeListener('end', onend)
|
|
603
|
+
this.removeListener(DESTROYED, ondestroy)
|
|
584
604
|
this.pause()
|
|
585
605
|
resolve({ value: value, done: !!this[EOF] })
|
|
586
606
|
}
|
|
587
607
|
const onend = () => {
|
|
588
608
|
this.removeListener('error', onerr)
|
|
589
609
|
this.removeListener('data', ondata)
|
|
610
|
+
this.removeListener(DESTROYED, ondestroy)
|
|
611
|
+
stop()
|
|
590
612
|
resolve({ done: true })
|
|
591
613
|
}
|
|
592
614
|
const ondestroy = () => onerr(new Error('stream destroyed'))
|
|
@@ -600,50 +622,81 @@ module.exports = class Minipass extends Stream {
|
|
|
600
622
|
})
|
|
601
623
|
}
|
|
602
624
|
|
|
603
|
-
return {
|
|
625
|
+
return {
|
|
626
|
+
next,
|
|
627
|
+
throw: stop,
|
|
628
|
+
return: stop,
|
|
629
|
+
[ASYNCITERATOR]() {
|
|
630
|
+
return this
|
|
631
|
+
},
|
|
632
|
+
}
|
|
604
633
|
}
|
|
605
634
|
|
|
606
635
|
// for (let chunk of stream)
|
|
607
|
-
[ITERATOR]
|
|
636
|
+
[ITERATOR]() {
|
|
637
|
+
let stopped = false
|
|
638
|
+
const stop = () => {
|
|
639
|
+
this.pause()
|
|
640
|
+
this.removeListener(ERROR, stop)
|
|
641
|
+
this.removeListener(DESTROYED, stop)
|
|
642
|
+
this.removeListener('end', stop)
|
|
643
|
+
stopped = true
|
|
644
|
+
return { done: true }
|
|
645
|
+
}
|
|
646
|
+
|
|
608
647
|
const next = () => {
|
|
648
|
+
if (stopped) return stop()
|
|
609
649
|
const value = this.read()
|
|
610
|
-
|
|
611
|
-
|
|
650
|
+
return value === null ? stop() : { value }
|
|
651
|
+
}
|
|
652
|
+
this.once('end', stop)
|
|
653
|
+
this.once(ERROR, stop)
|
|
654
|
+
this.once(DESTROYED, stop)
|
|
655
|
+
|
|
656
|
+
return {
|
|
657
|
+
next,
|
|
658
|
+
throw: stop,
|
|
659
|
+
return: stop,
|
|
660
|
+
[ITERATOR]() {
|
|
661
|
+
return this
|
|
662
|
+
},
|
|
612
663
|
}
|
|
613
|
-
return { next }
|
|
614
664
|
}
|
|
615
665
|
|
|
616
|
-
destroy
|
|
666
|
+
destroy(er) {
|
|
617
667
|
if (this[DESTROYED]) {
|
|
618
|
-
if (er)
|
|
619
|
-
|
|
620
|
-
else
|
|
621
|
-
this.emit(DESTROYED)
|
|
668
|
+
if (er) this.emit('error', er)
|
|
669
|
+
else this.emit(DESTROYED)
|
|
622
670
|
return this
|
|
623
671
|
}
|
|
624
672
|
|
|
625
673
|
this[DESTROYED] = true
|
|
626
674
|
|
|
627
675
|
// throw away all buffered data, it's never coming out
|
|
628
|
-
this.
|
|
676
|
+
this[BUFFER].length = 0
|
|
629
677
|
this[BUFFERLENGTH] = 0
|
|
630
678
|
|
|
631
|
-
if (typeof this.close === 'function' && !this[CLOSED])
|
|
632
|
-
this.close()
|
|
679
|
+
if (typeof this.close === 'function' && !this[CLOSED]) this.close()
|
|
633
680
|
|
|
634
|
-
if (er)
|
|
635
|
-
|
|
636
|
-
else
|
|
637
|
-
this.emit(DESTROYED)
|
|
681
|
+
if (er) this.emit('error', er)
|
|
682
|
+
// if no error to emit, still reject pending promises
|
|
683
|
+
else this.emit(DESTROYED)
|
|
638
684
|
|
|
639
685
|
return this
|
|
640
686
|
}
|
|
641
687
|
|
|
642
|
-
static isStream
|
|
643
|
-
return
|
|
644
|
-
s
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
688
|
+
static isStream(s) {
|
|
689
|
+
return (
|
|
690
|
+
!!s &&
|
|
691
|
+
(s instanceof Minipass ||
|
|
692
|
+
s instanceof Stream ||
|
|
693
|
+
(s instanceof EE &&
|
|
694
|
+
// readable
|
|
695
|
+
(typeof s.pipe === 'function' ||
|
|
696
|
+
// writable
|
|
697
|
+
(typeof s.write === 'function' && typeof s.end === 'function'))))
|
|
698
|
+
)
|
|
648
699
|
}
|
|
649
700
|
}
|
|
701
|
+
|
|
702
|
+
exports.Minipass = Minipass
|