@socketsecurity/cli-with-sentry 1.16.1 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/LICENSE +87 -0
- package/README.md +13 -13
- package/bin/cli.js +9 -9
- package/dist/.config/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/cli.js +2114 -4292
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +71 -87
- package/dist/constants.js.map +1 -1
- package/dist/env-helpers.js +63 -0
- package/dist/env-helpers.js.map +1 -0
- package/dist/instrument-with-sentry.js +7 -7
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/manifest-scripts/dotnet-tool/Microsoft.Build.Locator.dll +0 -0
- package/dist/manifest-scripts/dotnet-tool/socket-facts-dotnet.deps.json +2 -2
- package/dist/manifest-scripts/dotnet-tool/socket-facts-dotnet.dll +0 -0
- package/dist/manifest-scripts/maven-extension/coana-maven-extension.jar +0 -0
- package/dist/runtime-constants.js +345 -0
- package/dist/runtime-constants.js.map +1 -0
- package/dist/shadow-npm-bin2.js +9 -13
- package/dist/shadow-npm-bin2.js.map +1 -1
- package/dist/shadow-npm-inject.js +10 -15
- package/dist/shadow-npm-inject.js.map +1 -1
- package/dist/shadow-npx-bin.js.map +1 -1
- package/dist/shadow-pnpm-bin2.js +21 -25
- package/dist/shadow-pnpm-bin2.js.map +1 -1
- package/dist/shadow-yarn-bin.js +4 -6
- package/dist/shadow-yarn-bin.js.map +1 -1
- package/dist/socket-completion.bash +0 -0
- package/dist/spawn-sync.js +47 -0
- package/dist/spawn-sync.js.map +1 -0
- package/dist/spinner.js +182 -0
- package/dist/spinner.js.map +1 -0
- package/dist/types/commands/fix/generated-socket-facts.d.mts +5 -2
- package/dist/types/commands/fix/handle-fix.d.mts +1 -1
- package/dist/types/commands/fix/types.d.mts +1 -1
- package/dist/types/commands/manifest/bazel/process.d.mts +2 -2
- package/dist/types/commands/manifest/convert-dotnet-to-facts.d.mts +3 -6
- package/dist/types/commands/manifest/discover-manifest-roots.d.mts +10 -11
- package/dist/types/commands/manifest/generate-recursive-manifests.d.mts +16 -30
- package/dist/types/commands/manifest/generate_auto_manifest.d.mts +6 -11
- package/dist/types/commands/manifest/load-build.d.mts +3 -11
- package/dist/types/commands/manifest/run-manifest-facts.d.mts +88 -29
- package/dist/types/commands/manifest/scripts/build-tool.d.mts +2 -0
- package/dist/types/commands/optimize/add-overrides.d.mts +2 -2
- package/dist/types/commands/optimize/get-dependency-entries.d.mts +1 -1
- package/dist/types/commands/optimize/get-overrides-by-agent.d.mts +16 -7
- package/dist/types/commands/optimize/update-lockfile.d.mts +2 -2
- package/dist/types/commands/optimize/update-manifest-by-agent.d.mts +4 -2
- package/dist/types/commands/package/fetch-purls-shallow-score.d.mts +2 -2
- package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts +1 -1
- package/dist/types/commands/scan/generate-report.d.mts +1 -1
- package/dist/types/commands/scan/handle-create-new-scan.d.mts +5 -1
- package/dist/types/commands/scan/output-create-new-scan.d.mts +1 -1
- package/dist/types/commands/scan/output-diff-scan.d.mts +4 -2
- package/dist/types/commands/scan/perform-reachability-analysis.d.mts +4 -5
- package/dist/types/commands/scan/run-dynamic-sbom-inference.d.mts +7 -15
- package/dist/types/constants/runtime.d.mts +417 -0
- package/dist/types/constants.d.mts +9 -10
- package/dist/types/paths/coana.d.mts +5 -0
- package/dist/types/paths/uv.d.mts +2 -0
- package/dist/types/sea/adapters/cdxgen-worker.d.mts +1 -0
- package/dist/types/sea/adapters/synp-worker.d.mts +1 -0
- package/dist/types/sea/build/cdxgen-fixture.d.mts +4 -0
- package/dist/types/sea/build/smoke-test.d.mts +2 -0
- package/dist/types/sea/build-sea.d.mts +4 -2
- package/dist/types/sea/download-bytes.d.mts +0 -1
- package/dist/types/sea/paths/archive.d.mts +3 -0
- package/dist/types/sea/paths/coana-cache.d.mts +1 -0
- package/dist/types/sea/paths/native-tools.d.mts +13 -0
- package/dist/types/sea/pnpm-lock.d.mts +22 -0
- package/dist/types/sea/rollup-workers.d.mts +1 -0
- package/dist/types/sea/runtime.d.mts +4 -3
- package/dist/types/sea/vfs-digest.d.mts +2 -0
- package/dist/types/shadow/common.d.mts +1 -1
- package/dist/types/shadow/npm/arborist-helpers.d.mts +1 -1
- package/dist/types/shadow/npm/bin.d.mts +1 -1
- package/dist/types/shadow/npm/install.d.mts +3 -3
- package/dist/types/shadow/npm-base.d.mts +1 -1
- package/dist/types/shadow/npx/bin.d.mts +1 -1
- package/dist/types/shadow/pnpm/bin.d.mts +1 -1
- package/dist/types/shadow/yarn/bin.d.mts +1 -1
- package/dist/types/test/mocks/socket-auth.d.mts +40 -39
- package/dist/types/utils/agent.d.mts +6 -1
- package/dist/types/utils/alert/artifact.d.mts +1 -1
- package/dist/types/utils/alerts-map.d.mts +1 -1
- package/dist/types/utils/api.d.mts +1 -1
- package/dist/types/utils/arrays.d.mts +6 -0
- package/dist/types/utils/bin.d.mts +26 -0
- package/dist/types/utils/{coana-release.d.mts → coana/release.d.mts} +5 -3
- package/dist/types/utils/debug.d.mts +23 -49
- package/dist/types/utils/dlx.d.mts +1 -1
- package/dist/types/utils/ecosystem.d.mts +1 -9
- package/dist/types/utils/env.d.mts +24 -0
- package/dist/types/utils/errors.d.mts +2 -2
- package/dist/types/utils/escape-regexp.d.mts +6 -0
- package/dist/types/utils/fs.d.mts +33 -0
- package/dist/types/utils/github.d.mts +1 -1
- package/dist/types/utils/globs.d.mts +1 -0
- package/dist/types/utils/logger.d.mts +51 -0
- package/dist/types/utils/objects.d.mts +11 -0
- package/dist/types/utils/package-environment.d.mts +3 -3
- package/dist/types/utils/packages.d.mts +65 -0
- package/dist/types/utils/path.d.mts +3 -0
- package/dist/types/utils/promises.d.mts +23 -0
- package/dist/types/utils/prompts.d.mts +25 -0
- package/dist/types/utils/purl.d.mts +4 -1
- package/dist/types/utils/socket-package-alert.d.mts +1 -1
- package/dist/types/utils/socket-url.d.mts +1 -1
- package/dist/types/utils/sorts.d.mts +1 -0
- package/dist/types/utils/spawn-sync.d.mts +3 -0
- package/dist/types/utils/spawn.d.mts +67 -0
- package/dist/types/utils/spec.d.mts +1 -1
- package/dist/types/utils/spinner.d.mts +46 -0
- package/dist/types/utils/streams.d.mts +3 -0
- package/dist/types/utils/strings.d.mts +6 -0
- package/dist/types/utils/url.d.mts +2 -0
- package/dist/types/utils/words.d.mts +1 -0
- package/dist/utils.js +4475 -803
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +39737 -41318
- package/external/blessed-contrib/lib/widget/charts/line.js +172 -149
- package/package.json +41 -37
- package/shadow-bin/npm +0 -0
- package/shadow-bin/npx +0 -0
- package/shadow-bin/pnpm +0 -0
- package/shadow-bin/yarn +0 -0
- package/dist/types/commands/manifest/convert-gradle-to-facts.d.mts +0 -19
- package/dist/types/commands/manifest/convert-maven-to-facts.d.mts +0 -19
- package/dist/types/commands/manifest/convert-sbt-to-facts.d.mts +0 -22
- package/dist/types/commands/manifest/enumerate-workspaces.d.mts +0 -22
- package/dist/types/commands/manifest/expand-env-var-refs.d.mts +0 -9
- package/dist/types/sea/archive-paths.d.mts +0 -6
- package/external/@socketsecurity/registry/LICENSE +0 -21
- package/external/@socketsecurity/registry/README.md +0 -9
- package/external/@socketsecurity/registry/extensions.json +0 -28
- package/external/@socketsecurity/registry/external/@inquirer/confirm.js +0 -3165
- package/external/@socketsecurity/registry/external/@inquirer/input.js +0 -3202
- package/external/@socketsecurity/registry/external/@inquirer/password.js +0 -3307
- package/external/@socketsecurity/registry/external/@inquirer/search.js +0 -3519
- package/external/@socketsecurity/registry/external/@inquirer/select.js +0 -3655
- package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +0 -21406
- package/external/@socketsecurity/registry/external/@npmcli/package-json/lib/read-package.js +0 -183
- package/external/@socketsecurity/registry/external/@npmcli/package-json/lib/sort.js +0 -274
- package/external/@socketsecurity/registry/external/@npmcli/promise-spawn.js +0 -704
- package/external/@socketsecurity/registry/external/@socketregistry/is-unicode-supported.js +0 -54
- package/external/@socketsecurity/registry/external/@socketregistry/packageurl-js.js +0 -4516
- package/external/@socketsecurity/registry/external/@socketregistry/yocto-spinner.js +0 -453
- package/external/@socketsecurity/registry/external/@yarnpkg/extensions.js +0 -1406
- package/external/@socketsecurity/registry/external/browserslist.js +0 -20496
- package/external/@socketsecurity/registry/external/cacache.js +0 -16208
- package/external/@socketsecurity/registry/external/debug.js +0 -1163
- package/external/@socketsecurity/registry/external/fast-glob.js +0 -7994
- package/external/@socketsecurity/registry/external/fast-sort.js +0 -181
- package/external/@socketsecurity/registry/external/libnpmpack.js +0 -106271
- package/external/@socketsecurity/registry/external/make-fetch-happen.js +0 -38997
- package/external/@socketsecurity/registry/external/normalize-package-data.js +0 -5343
- package/external/@socketsecurity/registry/external/npm-package-arg.js +0 -5773
- package/external/@socketsecurity/registry/external/pacote.js +0 -74109
- package/external/@socketsecurity/registry/external/picomatch.js +0 -2307
- package/external/@socketsecurity/registry/external/semver.js +0 -2618
- package/external/@socketsecurity/registry/external/signal-exit.js +0 -336
- package/external/@socketsecurity/registry/external/spdx-correct.js +0 -1457
- package/external/@socketsecurity/registry/external/spdx-expression-parse.js +0 -1043
- package/external/@socketsecurity/registry/external/streaming-iterables.js +0 -326
- package/external/@socketsecurity/registry/external/validate-npm-package-name.js +0 -108
- package/external/@socketsecurity/registry/external/which.js +0 -405
- package/external/@socketsecurity/registry/external/yoctocolors-cjs.js +0 -101
- package/external/@socketsecurity/registry/index.js +0 -31
- package/external/@socketsecurity/registry/lib/agent.js +0 -390
- package/external/@socketsecurity/registry/lib/arrays.js +0 -89
- package/external/@socketsecurity/registry/lib/bin.js +0 -650
- package/external/@socketsecurity/registry/lib/constants/abort-controller.js +0 -15
- package/external/@socketsecurity/registry/lib/constants/abort-signal.js +0 -27
- package/external/@socketsecurity/registry/lib/constants/at-latest.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/biome-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/bun-lock.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/bun-lockb.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/bun.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ci.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/column-limit.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/copy-left-licenses.js +0 -27
- package/external/@socketsecurity/registry/lib/constants/darwin.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/dot-git-dir.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/dot-package-lock-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/dot-socket-dir.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/empty-file.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/empty-value.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/env.js +0 -59
- package/external/@socketsecurity/registry/lib/constants/eslint-config-js.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/esnext.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/exec-path.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-cjs.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-cmd.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-cts.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-dts.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-js.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-lock.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-lockb.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-md.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-mjs.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-mts.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-ps1.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-yaml.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-yml.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/extensions-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/extensions.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/get-ipc.js +0 -10
- package/external/@socketsecurity/registry/lib/constants/gitignore.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/index.js +0 -139
- package/external/@socketsecurity/registry/lib/constants/ipc-handler.js +0 -19
- package/external/@socketsecurity/registry/lib/constants/ipc-object.js +0 -6
- package/external/@socketsecurity/registry/lib/constants/ipc-promise.js +0 -47
- package/external/@socketsecurity/registry/lib/constants/ipc-target.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/k-internals-symbol.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/latest.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-glob-recursive.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-glob.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-original-glob-recursive.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-original-glob.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-original.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/lifecycle-script-names.js +0 -18
- package/external/@socketsecurity/registry/lib/constants/loop-sentinel.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/maintained-node-versions.js +0 -47
- package/external/@socketsecurity/registry/lib/constants/manifest-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/mit.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-auth-token.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-debug-flags.js +0 -9
- package/external/@socketsecurity/registry/lib/constants/node-env.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-harden-flags.js +0 -29
- package/external/@socketsecurity/registry/lib/constants/node-modules-glob-recursive.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-modules.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-no-warnings-flags.js +0 -16
- package/external/@socketsecurity/registry/lib/constants/node-version.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/npm-exec-path.js +0 -5
- package/external/@socketsecurity/registry/lib/constants/npm-real-exec-path.js +0 -6
- package/external/@socketsecurity/registry/lib/constants/npm-shrinkwrap-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/npm.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/npx.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/overrides.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/package-default-node-range.js +0 -6
- package/external/@socketsecurity/registry/lib/constants/package-default-socket-categories.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/package-default-version.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/package-extensions.js +0 -47
- package/external/@socketsecurity/registry/lib/constants/package-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/package-lock-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/packument-cache.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/pacote-cache-path.js +0 -9
- package/external/@socketsecurity/registry/lib/constants/pnpm-exec-path.js +0 -5
- package/external/@socketsecurity/registry/lib/constants/pnpm-lock-yaml.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/pnpm.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/pre-commit.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/readme-glob-recursive.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/readme-glob.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/readme-md.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/registry-scope-delimiter.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/registry.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/resolutions.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-github-org.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-ipc-handshake.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-override-scope.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-public-api-token.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-registry-npm-org.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-registry-package-name.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-registry-repo-name.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-registry-scope.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-security-scope.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/spinner.js +0 -4
- package/external/@socketsecurity/registry/lib/constants/supports-node-compile-cache-api.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-node-compile-cache-env-var.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-node-disable-warning-flag.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-node-permission-flag.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-node-require-module.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/supports-node-run.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-process-send.js +0 -5
- package/external/@socketsecurity/registry/lib/constants/ts-libs-available.js +0 -22
- package/external/@socketsecurity/registry/lib/constants/ts-types-available.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/tsconfig-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/undefined-token.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/unknown-error.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/unknown-value.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/unlicenced.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/unlicensed.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/utf8.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/vitest.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/vlt-lock-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/vlt.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/win32.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/yarn-berry.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/yarn-classic.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/yarn-exec-path.js +0 -5
- package/external/@socketsecurity/registry/lib/constants/yarn-lock.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/yarn.js +0 -3
- package/external/@socketsecurity/registry/lib/debug.js +0 -264
- package/external/@socketsecurity/registry/lib/env.js +0 -62
- package/external/@socketsecurity/registry/lib/fs.js +0 -556
- package/external/@socketsecurity/registry/lib/functions.js +0 -20
- package/external/@socketsecurity/registry/lib/globs.js +0 -145
- package/external/@socketsecurity/registry/lib/json.js +0 -69
- package/external/@socketsecurity/registry/lib/logger.js +0 -534
- package/external/@socketsecurity/registry/lib/objects.js +0 -422
- package/external/@socketsecurity/registry/lib/packages.js +0 -1379
- package/external/@socketsecurity/registry/lib/path.js +0 -231
- package/external/@socketsecurity/registry/lib/promises.js +0 -286
- package/external/@socketsecurity/registry/lib/prompts.js +0 -63
- package/external/@socketsecurity/registry/lib/regexps.js +0 -23
- package/external/@socketsecurity/registry/lib/sorts.js +0 -70
- package/external/@socketsecurity/registry/lib/spawn.js +0 -252
- package/external/@socketsecurity/registry/lib/spinner.js +0 -205
- package/external/@socketsecurity/registry/lib/streams.js +0 -84
- package/external/@socketsecurity/registry/lib/strings.js +0 -235
- package/external/@socketsecurity/registry/lib/url.js +0 -68
- package/external/@socketsecurity/registry/lib/words.js +0 -45
- package/external/@socketsecurity/registry/manifest.json +0 -1875
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { search } = /*@__PURE__*/ require('./strings')
|
|
4
|
-
|
|
5
|
-
const leadingDotSlashRegExp = /^\.\.?[/\\]/
|
|
6
|
-
const slashRegExp = /[/\\]/
|
|
7
|
-
const nodeModulesPathRegExp = /(?:^|[/\\])node_modules(?:[/\\]|$)/
|
|
8
|
-
|
|
9
|
-
let _buffer
|
|
10
|
-
/**
|
|
11
|
-
* Lazily load the buffer module.
|
|
12
|
-
* @returns {import('buffer')} The Node.js buffer module.
|
|
13
|
-
* @private
|
|
14
|
-
*/
|
|
15
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
16
|
-
function getBuffer() {
|
|
17
|
-
if (_buffer === undefined) {
|
|
18
|
-
// Use non-'node:' prefixed require to avoid Webpack errors.
|
|
19
|
-
// eslint-disable-next-line n/prefer-node-protocol
|
|
20
|
-
_buffer = /*@__PURE__*/ require('buffer')
|
|
21
|
-
}
|
|
22
|
-
return _buffer
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
let _path
|
|
26
|
-
/**
|
|
27
|
-
* Lazily load the path module.
|
|
28
|
-
* @returns {import('path')} The Node.js path module.
|
|
29
|
-
* @private
|
|
30
|
-
*/
|
|
31
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
32
|
-
function getPath() {
|
|
33
|
-
if (_path === undefined) {
|
|
34
|
-
// Use non-'node:' prefixed require to avoid Webpack errors.
|
|
35
|
-
// eslint-disable-next-line n/prefer-node-protocol
|
|
36
|
-
_path = /*@__PURE__*/ require('path')
|
|
37
|
-
}
|
|
38
|
-
return _path
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
let _url
|
|
42
|
-
/**
|
|
43
|
-
* Lazily load the url module.
|
|
44
|
-
* @returns {import('url')} The Node.js url module.
|
|
45
|
-
* @private
|
|
46
|
-
*/
|
|
47
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
48
|
-
function getUrl() {
|
|
49
|
-
if (_url === undefined) {
|
|
50
|
-
// Use non-'node:' prefixed require to avoid Webpack errors.
|
|
51
|
-
// eslint-disable-next-line n/prefer-node-protocol
|
|
52
|
-
_url = /*@__PURE__*/ require('url')
|
|
53
|
-
}
|
|
54
|
-
return _url
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Check if a path contains node_modules directory.
|
|
59
|
-
* @param {string | Buffer | URL} pathLike - The path to check.
|
|
60
|
-
* @returns {boolean} True if the path contains node_modules.
|
|
61
|
-
*/
|
|
62
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
63
|
-
function isNodeModules(pathLike) {
|
|
64
|
-
const filepath = pathLikeToString(pathLike)
|
|
65
|
-
return nodeModulesPathRegExp.test(filepath)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Check if a value is a valid file path (absolute or relative).
|
|
70
|
-
* @param {any} pathLike - The value to check.
|
|
71
|
-
* @returns {boolean} True if the value is a valid path.
|
|
72
|
-
*/
|
|
73
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
74
|
-
function isPath(pathLike) {
|
|
75
|
-
return isRelative(pathLike) || getPath().isAbsolute(pathLike)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Check if a path is relative (starts with . or ..).
|
|
80
|
-
* @param {any} pathLike - The path to check.
|
|
81
|
-
* @returns {boolean} True if the path is relative.
|
|
82
|
-
*/
|
|
83
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
84
|
-
function isRelative(pathLike) {
|
|
85
|
-
const filepath = pathLikeToString(pathLike)
|
|
86
|
-
if (typeof filepath !== 'string') {
|
|
87
|
-
return false
|
|
88
|
-
}
|
|
89
|
-
const { length } = filepath
|
|
90
|
-
if (length === 0) {
|
|
91
|
-
return false
|
|
92
|
-
}
|
|
93
|
-
if (filepath.charCodeAt(0) === 46 /*'.'*/) {
|
|
94
|
-
if (length === 1) {
|
|
95
|
-
return true
|
|
96
|
-
}
|
|
97
|
-
let code = filepath.charCodeAt(1)
|
|
98
|
-
if (code === 46 /*'.'*/) {
|
|
99
|
-
code = filepath.charCodeAt(2)
|
|
100
|
-
}
|
|
101
|
-
return code === 47 /*'/'*/ || code === 92 /*'\\'*/
|
|
102
|
-
}
|
|
103
|
-
return false
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Normalize a path by converting backslashes to forward slashes and collapsing segments.
|
|
108
|
-
* @param {string | Buffer | URL} pathLike - The path to normalize.
|
|
109
|
-
* @returns {string} The normalized path.
|
|
110
|
-
*/
|
|
111
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
112
|
-
function normalizePath(pathLike) {
|
|
113
|
-
const filepath = pathLikeToString(pathLike)
|
|
114
|
-
const { length } = filepath
|
|
115
|
-
if (length < 2) {
|
|
116
|
-
return length === 1 && filepath.charCodeAt(0) === 92 /*'\\'*/
|
|
117
|
-
? '/'
|
|
118
|
-
: filepath
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
let code = 0
|
|
122
|
-
let collapsed = ''
|
|
123
|
-
let start = 0
|
|
124
|
-
|
|
125
|
-
// Ensure win32 namespaces have two leading slashes so they are handled properly
|
|
126
|
-
// by path.win32.parse() after being normalized.
|
|
127
|
-
// https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#namespaces
|
|
128
|
-
// UNC paths, paths starting with double slashes, e.g. "\\\\wsl.localhost\\Ubuntu\home\\",
|
|
129
|
-
// are okay to convert to forward slashes.
|
|
130
|
-
// https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
|
|
131
|
-
let prefix = ''
|
|
132
|
-
if (length > 4 && filepath.charCodeAt(3) === 92 /*'\\'*/) {
|
|
133
|
-
const code2 = filepath.charCodeAt(2)
|
|
134
|
-
// Look for \\?\ or \\.\
|
|
135
|
-
if (
|
|
136
|
-
(code2 === 63 /*'?'*/ || code2 === 46) /*'.'*/ &&
|
|
137
|
-
filepath.charCodeAt(0) === 92 /*'\\'*/ &&
|
|
138
|
-
filepath.charCodeAt(1) === 92 /*'\\'*/
|
|
139
|
-
) {
|
|
140
|
-
start = 2
|
|
141
|
-
prefix = '//'
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
if (start === 0) {
|
|
145
|
-
// Trim leading slashes
|
|
146
|
-
while (
|
|
147
|
-
((code = filepath.charCodeAt(start)),
|
|
148
|
-
code === 47 /*'/'*/ || code === 92) /*'\\'*/
|
|
149
|
-
) {
|
|
150
|
-
start += 1
|
|
151
|
-
}
|
|
152
|
-
if (start) {
|
|
153
|
-
prefix = '/'
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
let nextIndex = search(filepath, slashRegExp, start)
|
|
157
|
-
if (nextIndex === -1) {
|
|
158
|
-
return prefix + filepath.slice(start)
|
|
159
|
-
}
|
|
160
|
-
// Discard any empty string segments by collapsing repeated segment separator slashes.
|
|
161
|
-
while (nextIndex !== -1) {
|
|
162
|
-
const segment = filepath.slice(start, nextIndex)
|
|
163
|
-
collapsed = collapsed + (collapsed.length === 0 ? '' : '/') + segment
|
|
164
|
-
start = nextIndex + 1
|
|
165
|
-
while (
|
|
166
|
-
((code = filepath.charCodeAt(start)),
|
|
167
|
-
code === 47 /*'/'*/ || code === 92) /*'\\'*/
|
|
168
|
-
) {
|
|
169
|
-
start += 1
|
|
170
|
-
}
|
|
171
|
-
nextIndex = search(filepath, slashRegExp, start)
|
|
172
|
-
}
|
|
173
|
-
const lastSegment = filepath.slice(start)
|
|
174
|
-
if (lastSegment.length !== 0) {
|
|
175
|
-
collapsed = collapsed + '/' + lastSegment
|
|
176
|
-
}
|
|
177
|
-
return prefix + collapsed
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Convert a path-like value to a string.
|
|
182
|
-
* @param {string | Buffer | URL | any} pathLike - The path-like value to convert.
|
|
183
|
-
* @returns {string} The path as a string.
|
|
184
|
-
*/
|
|
185
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
186
|
-
function pathLikeToString(pathLike) {
|
|
187
|
-
if (typeof pathLike === 'string') {
|
|
188
|
-
return pathLike
|
|
189
|
-
}
|
|
190
|
-
const { Buffer } = getBuffer()
|
|
191
|
-
if (Buffer.isBuffer(pathLike)) {
|
|
192
|
-
return pathLike.toString('utf8')
|
|
193
|
-
}
|
|
194
|
-
const url = getUrl()
|
|
195
|
-
if (pathLike instanceof URL) {
|
|
196
|
-
return url.fileURLToPath(pathLike)
|
|
197
|
-
}
|
|
198
|
-
return String(pathLike)
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Split a path into an array of segments.
|
|
203
|
-
* @param {string | Buffer | URL} pathLike - The path to split.
|
|
204
|
-
* @returns {string[]} Array of path segments.
|
|
205
|
-
*/
|
|
206
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
207
|
-
function splitPath(pathLike) {
|
|
208
|
-
const filepath = pathLikeToString(pathLike)
|
|
209
|
-
return filepath.split(slashRegExp)
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Remove leading ./ or ../ from a path.
|
|
214
|
-
* @param {string | Buffer | URL} pathLike - The path to trim.
|
|
215
|
-
* @returns {string} The path without leading dot-slash.
|
|
216
|
-
*/
|
|
217
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
218
|
-
function trimLeadingDotSlash(pathLike) {
|
|
219
|
-
const filepath = pathLikeToString(pathLike)
|
|
220
|
-
return filepath.replace(leadingDotSlashRegExp, '')
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
module.exports = {
|
|
224
|
-
isNodeModules,
|
|
225
|
-
isPath,
|
|
226
|
-
isRelative,
|
|
227
|
-
normalizePath,
|
|
228
|
-
pathLikeToString,
|
|
229
|
-
splitPath,
|
|
230
|
-
trimLeadingDotSlash
|
|
231
|
-
}
|
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { arrayChunk } = /*@__PURE__*/ require('./arrays')
|
|
4
|
-
|
|
5
|
-
let _timers
|
|
6
|
-
/**
|
|
7
|
-
* Get the timers/promises module.
|
|
8
|
-
* @returns {Object} The timers/promises module.
|
|
9
|
-
* @private
|
|
10
|
-
*/
|
|
11
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
12
|
-
function getTimers() {
|
|
13
|
-
if (_timers === undefined) {
|
|
14
|
-
// Use non-'node:' prefixed require to avoid Webpack errors.
|
|
15
|
-
// eslint-disable-next-line n/prefer-node-protocol
|
|
16
|
-
_timers = /*@__PURE__*/ require('timers/promises')
|
|
17
|
-
}
|
|
18
|
-
return _timers
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Normalize options for iteration functions.
|
|
23
|
-
* @param {Object} [options] - Iteration options.
|
|
24
|
-
* @returns {Object} Normalized iteration options.
|
|
25
|
-
*/
|
|
26
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
27
|
-
function normalizeIterationOptions(options) {
|
|
28
|
-
const {
|
|
29
|
-
// The number of concurrent executions performed at one time.
|
|
30
|
-
concurrency = 1,
|
|
31
|
-
// Retries as a number or options object.
|
|
32
|
-
retries,
|
|
33
|
-
// AbortSignal used to support cancellation.
|
|
34
|
-
signal = /*@__PURE__*/ require('./constants/abort-signal')
|
|
35
|
-
} = { __proto__: null, ...options }
|
|
36
|
-
const retryOpts = resolveRetryOptions(retries)
|
|
37
|
-
return {
|
|
38
|
-
__proto__: null,
|
|
39
|
-
concurrency,
|
|
40
|
-
retries: normalizeRetryOptions({ signal, ...retryOpts }),
|
|
41
|
-
signal
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Normalize options for retry functionality.
|
|
47
|
-
* @param {Object|number} [options] - Retry options or number of retries.
|
|
48
|
-
* @returns {Object} Normalized retry options.
|
|
49
|
-
*/
|
|
50
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
51
|
-
function normalizeRetryOptions(options) {
|
|
52
|
-
const {
|
|
53
|
-
// Arguments to pass to the callback function.
|
|
54
|
-
args = [],
|
|
55
|
-
// Multiplier for exponential backoff (e.g., 2 doubles delay each retry).
|
|
56
|
-
backoffFactor = 2,
|
|
57
|
-
// Initial delay before the first retry (in milliseconds).
|
|
58
|
-
baseDelayMs = 200,
|
|
59
|
-
// Whether to apply randomness to spread out retries.
|
|
60
|
-
jitter = true,
|
|
61
|
-
// Upper limit for any backoff delay (in milliseconds).
|
|
62
|
-
maxDelayMs = 10000,
|
|
63
|
-
// Optional callback invoked on each retry attempt:
|
|
64
|
-
// (attempt: number, error: unknown, delay: number) => void
|
|
65
|
-
onRetry,
|
|
66
|
-
// Whether onRetry can cancel retries by returning `false`.
|
|
67
|
-
onRetryCancelOnFalse = false,
|
|
68
|
-
// Whether onRetry will rethrow errors.
|
|
69
|
-
onRetryRethrow = false,
|
|
70
|
-
// Number of retry attempts (0 = no retries, only initial attempt).
|
|
71
|
-
retries = 0,
|
|
72
|
-
// AbortSignal used to support cancellation.
|
|
73
|
-
signal = /*@__PURE__*/ require('./constants/abort-signal')
|
|
74
|
-
} = resolveRetryOptions(options)
|
|
75
|
-
return {
|
|
76
|
-
__proto__: null,
|
|
77
|
-
args,
|
|
78
|
-
backoffFactor,
|
|
79
|
-
baseDelayMs,
|
|
80
|
-
jitter,
|
|
81
|
-
maxDelayMs,
|
|
82
|
-
onRetry,
|
|
83
|
-
onRetryCancelOnFalse,
|
|
84
|
-
onRetryRethrow,
|
|
85
|
-
retries,
|
|
86
|
-
signal
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Resolve retry options from various input formats.
|
|
92
|
-
* @param {Object|number} [options] - Options object or number of retries.
|
|
93
|
-
* @returns {Object} Resolved retry options object.
|
|
94
|
-
*/
|
|
95
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
96
|
-
function resolveRetryOptions(options) {
|
|
97
|
-
return {
|
|
98
|
-
__proto__: null,
|
|
99
|
-
...(typeof options === 'number' ? { retries: options } : options)
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Execute an async function for each array element with concurrency control.
|
|
105
|
-
* @param {any[]} array - Array to iterate over.
|
|
106
|
-
* @param {Function} callbackFn - Async function to execute for each element.
|
|
107
|
-
* @param {Object} [options] - Iteration options including concurrency and retries.
|
|
108
|
-
* @returns {Promise<void>} Resolves when all iterations complete.
|
|
109
|
-
*/
|
|
110
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
111
|
-
async function pEach(array, callbackFn, options) {
|
|
112
|
-
const iterOpts = normalizeIterationOptions(options)
|
|
113
|
-
await pEachChunk(
|
|
114
|
-
arrayChunk(array, iterOpts.concurrency),
|
|
115
|
-
callbackFn,
|
|
116
|
-
iterOpts.retries
|
|
117
|
-
)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Filter an array asynchronously with concurrency control.
|
|
122
|
-
* @param {any[]} array - Array to filter.
|
|
123
|
-
* @param {Function} callbackFn - Async predicate function.
|
|
124
|
-
* @param {Object} [options] - Iteration options including concurrency and retries.
|
|
125
|
-
* @returns {Promise<any[]>} Filtered array.
|
|
126
|
-
*/
|
|
127
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
128
|
-
async function pFilter(array, callbackFn, options) {
|
|
129
|
-
const iterOpts = normalizeIterationOptions(options)
|
|
130
|
-
return (
|
|
131
|
-
await pFilterChunk(
|
|
132
|
-
arrayChunk(array, iterOpts.concurrency),
|
|
133
|
-
callbackFn,
|
|
134
|
-
iterOpts.retries
|
|
135
|
-
)
|
|
136
|
-
).flat()
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Process chunked arrays with an async callback.
|
|
141
|
-
* @param {any[][]} chunks - Array of array chunks.
|
|
142
|
-
* @param {Function} callbackFn - Async function to execute for each element.
|
|
143
|
-
* @param {Object} [options] - Retry options.
|
|
144
|
-
* @returns {Promise<void>} Resolves when all chunks are processed.
|
|
145
|
-
*/
|
|
146
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
147
|
-
async function pEachChunk(chunks, callbackFn, options) {
|
|
148
|
-
const retryOpts = normalizeRetryOptions(options)
|
|
149
|
-
const { signal } = retryOpts
|
|
150
|
-
for (const chunk of chunks) {
|
|
151
|
-
if (signal?.aborted) {
|
|
152
|
-
return
|
|
153
|
-
}
|
|
154
|
-
// eslint-disable-next-line no-await-in-loop
|
|
155
|
-
await Promise.all(
|
|
156
|
-
chunk.map(value =>
|
|
157
|
-
pRetry(callbackFn, {
|
|
158
|
-
...retryOpts,
|
|
159
|
-
args: [value]
|
|
160
|
-
})
|
|
161
|
-
)
|
|
162
|
-
)
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Filter chunked arrays with an async predicate.
|
|
168
|
-
* @param {any[][]} chunks - Array of array chunks.
|
|
169
|
-
* @param {Function} callbackFn - Async predicate function.
|
|
170
|
-
* @param {Object} [options] - Retry options.
|
|
171
|
-
* @returns {Promise<any[][]>} Filtered chunks.
|
|
172
|
-
*/
|
|
173
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
174
|
-
async function pFilterChunk(chunks, callbackFn, options) {
|
|
175
|
-
const retryOpts = normalizeRetryOptions(options)
|
|
176
|
-
const { signal } = retryOpts
|
|
177
|
-
const { length } = chunks
|
|
178
|
-
const filteredChunks = Array(length)
|
|
179
|
-
for (let i = 0; i < length; i += 1) {
|
|
180
|
-
// Process each chunk, filtering based on the callback function.
|
|
181
|
-
if (signal?.aborted) {
|
|
182
|
-
filteredChunks[i] = []
|
|
183
|
-
} else {
|
|
184
|
-
const chunk = chunks[i]
|
|
185
|
-
// eslint-disable-next-line no-await-in-loop
|
|
186
|
-
const predicateResults = await Promise.all(
|
|
187
|
-
chunk.map(value =>
|
|
188
|
-
pRetry(callbackFn, {
|
|
189
|
-
...retryOpts,
|
|
190
|
-
args: [value]
|
|
191
|
-
})
|
|
192
|
-
)
|
|
193
|
-
)
|
|
194
|
-
filteredChunks[i] = chunk.filter((_v, i) => predicateResults[i])
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return filteredChunks
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Retry an async function with exponential backoff.
|
|
202
|
-
* @param {Function} callbackFn - Async function to retry.
|
|
203
|
-
* @param {Object} [options] - Retry options including retries, backoff, and delays.
|
|
204
|
-
* @returns {Promise<any>} Result of the successful function call.
|
|
205
|
-
* @throws {Error} The last error if all retries fail.
|
|
206
|
-
*/
|
|
207
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
208
|
-
async function pRetry(callbackFn, options) {
|
|
209
|
-
const {
|
|
210
|
-
args,
|
|
211
|
-
backoffFactor,
|
|
212
|
-
baseDelayMs,
|
|
213
|
-
jitter,
|
|
214
|
-
maxDelayMs,
|
|
215
|
-
onRetry,
|
|
216
|
-
onRetryCancelOnFalse,
|
|
217
|
-
onRetryRethrow,
|
|
218
|
-
retries,
|
|
219
|
-
signal
|
|
220
|
-
} = normalizeRetryOptions(options)
|
|
221
|
-
if (signal?.aborted) {
|
|
222
|
-
return undefined
|
|
223
|
-
}
|
|
224
|
-
if (retries === 0) {
|
|
225
|
-
return await callbackFn(...args, { signal })
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
const UNDEFINED_TOKEN = /*@__PURE__*/ require('./constants/undefined-token')
|
|
229
|
-
const timers = getTimers()
|
|
230
|
-
|
|
231
|
-
let attempts = retries
|
|
232
|
-
let delay = baseDelayMs
|
|
233
|
-
let error = UNDEFINED_TOKEN
|
|
234
|
-
|
|
235
|
-
while (attempts-- >= 0 && !signal?.aborted) {
|
|
236
|
-
try {
|
|
237
|
-
// eslint-disable-next-line no-await-in-loop
|
|
238
|
-
return await callbackFn(...args, { signal })
|
|
239
|
-
} catch (e) {
|
|
240
|
-
if (error === UNDEFINED_TOKEN) {
|
|
241
|
-
error = e
|
|
242
|
-
}
|
|
243
|
-
if (attempts < 0) {
|
|
244
|
-
break
|
|
245
|
-
}
|
|
246
|
-
let waitTime = delay
|
|
247
|
-
if (jitter) {
|
|
248
|
-
// Add randomness: Pick a value between 0 and `delay`.
|
|
249
|
-
waitTime += Math.floor(Math.random() * delay)
|
|
250
|
-
}
|
|
251
|
-
// Clamp wait time to max delay.
|
|
252
|
-
waitTime = Math.min(waitTime, maxDelayMs)
|
|
253
|
-
if (typeof onRetry === 'function') {
|
|
254
|
-
try {
|
|
255
|
-
const result = onRetry(retries - attempts, e, waitTime)
|
|
256
|
-
if (result === false && onRetryCancelOnFalse) {
|
|
257
|
-
break
|
|
258
|
-
}
|
|
259
|
-
} catch (e) {
|
|
260
|
-
if (onRetryRethrow) {
|
|
261
|
-
throw e
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
// eslint-disable-next-line no-await-in-loop
|
|
266
|
-
await timers.setTimeout(waitTime, undefined, { signal })
|
|
267
|
-
// Exponentially increase the delay for the next attempt, capping at maxDelayMs.
|
|
268
|
-
delay = Math.min(delay * backoffFactor, maxDelayMs)
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
if (error !== UNDEFINED_TOKEN) {
|
|
272
|
-
throw error
|
|
273
|
-
}
|
|
274
|
-
return undefined
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
module.exports = {
|
|
278
|
-
normalizeIterationOptions,
|
|
279
|
-
normalizeRetryOptions,
|
|
280
|
-
pEach,
|
|
281
|
-
pEachChunk,
|
|
282
|
-
pFilter,
|
|
283
|
-
pFilterChunk,
|
|
284
|
-
pRetry,
|
|
285
|
-
resolveRetryOptions
|
|
286
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
4
|
-
function wrapPrompt(inquirerPrompt) {
|
|
5
|
-
return async (...args) => {
|
|
6
|
-
const origContext = args.length > 1 ? args[1] : undefined
|
|
7
|
-
const {
|
|
8
|
-
spinner = /*@__PURE__*/ require('./constants/spinner'),
|
|
9
|
-
...contextWithoutSpinner
|
|
10
|
-
} = origContext ?? {}
|
|
11
|
-
const abortSignal = /*@__PURE__*/ require('./constants/abort-signal')
|
|
12
|
-
if (origContext) {
|
|
13
|
-
args[1] = {
|
|
14
|
-
signal: abortSignal,
|
|
15
|
-
...contextWithoutSpinner
|
|
16
|
-
}
|
|
17
|
-
} else {
|
|
18
|
-
args[1] = { signal: abortSignal }
|
|
19
|
-
}
|
|
20
|
-
const wasSpinning = !!spinner?.isSpinning
|
|
21
|
-
spinner?.stop()
|
|
22
|
-
let result
|
|
23
|
-
try {
|
|
24
|
-
result = await inquirerPrompt(...args)
|
|
25
|
-
} catch (e) {
|
|
26
|
-
if (e instanceof TypeError) {
|
|
27
|
-
throw e
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (wasSpinning) {
|
|
31
|
-
spinner.start()
|
|
32
|
-
}
|
|
33
|
-
return typeof result === 'string' ? result.trim() : result
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const selectExport = /*@__PURE__*/ require('../external/@inquirer/select')
|
|
38
|
-
const selectRaw = selectExport.default
|
|
39
|
-
const Separator = selectExport.Separator
|
|
40
|
-
|
|
41
|
-
const confirmRaw = /*@__PURE__*/ require('../external/@inquirer/confirm')
|
|
42
|
-
const confirm = /*@__PURE__*/ wrapPrompt(confirmRaw)
|
|
43
|
-
|
|
44
|
-
const inputRaw = /*@__PURE__*/ require('../external/@inquirer/input')
|
|
45
|
-
const input = /*@__PURE__*/ wrapPrompt(inputRaw)
|
|
46
|
-
|
|
47
|
-
const passwordRaw = /*@__PURE__*/ require('../external/@inquirer/password')
|
|
48
|
-
const password = /*@__PURE__*/ wrapPrompt(passwordRaw)
|
|
49
|
-
|
|
50
|
-
const searchExport = /*@__PURE__*/ require('../external/@inquirer/search')
|
|
51
|
-
const searchRaw = searchExport.default
|
|
52
|
-
|
|
53
|
-
const search = /*@__PURE__*/ wrapPrompt(searchRaw)
|
|
54
|
-
const select = /*@__PURE__*/ wrapPrompt(selectRaw)
|
|
55
|
-
|
|
56
|
-
module.exports = {
|
|
57
|
-
Separator,
|
|
58
|
-
confirm,
|
|
59
|
-
input,
|
|
60
|
-
password,
|
|
61
|
-
search,
|
|
62
|
-
select
|
|
63
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
// Inlined escape-string-regexp:
|
|
4
|
-
// https://socket.dev/npm/package/escape-string-regexp/overview/5.0.0
|
|
5
|
-
// MIT License
|
|
6
|
-
// Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Escape special characters in a string for use in a regular expression.
|
|
10
|
-
* @param {string} str - The string to escape.
|
|
11
|
-
* @returns {string} The escaped string safe for use in a RegExp.
|
|
12
|
-
*/
|
|
13
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
14
|
-
function escapeRegExp(str) {
|
|
15
|
-
// Escape characters with special meaning either inside or outside character sets.
|
|
16
|
-
// Use a simple backslash escape when it’s always valid, and a `\xnn` escape when
|
|
17
|
-
// the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
|
18
|
-
return str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d')
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = {
|
|
22
|
-
escapeRegExp
|
|
23
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
let _localeCompare
|
|
4
|
-
/**
|
|
5
|
-
* Compare two strings using locale-aware comparison.
|
|
6
|
-
* @param {string} x - First string to compare.
|
|
7
|
-
* @param {string} y - Second string to compare.
|
|
8
|
-
* @returns {number} Negative if x < y, positive if x > y, 0 if equal.
|
|
9
|
-
*/
|
|
10
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
11
|
-
function localeCompare(x, y) {
|
|
12
|
-
if (_localeCompare === undefined) {
|
|
13
|
-
// Lazily call new Intl.Collator() because in Node it can take 10-14ms.
|
|
14
|
-
_localeCompare = new Intl.Collator().compare
|
|
15
|
-
}
|
|
16
|
-
return _localeCompare(x, y)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
let _naturalCompare
|
|
20
|
-
/**
|
|
21
|
-
* Compare two strings using natural sorting (numeric-aware, case-insensitive).
|
|
22
|
-
* @param {string} x - First string to compare.
|
|
23
|
-
* @param {string} y - Second string to compare.
|
|
24
|
-
* @returns {number} Negative if x < y, positive if x > y, 0 if equal.
|
|
25
|
-
*/
|
|
26
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
27
|
-
function naturalCompare(x, y) {
|
|
28
|
-
if (_naturalCompare === undefined) {
|
|
29
|
-
// Lazily call new Intl.Collator() because in Node it can take 10-14ms.
|
|
30
|
-
_naturalCompare = new Intl.Collator(
|
|
31
|
-
// The `undefined` locale means it uses the default locale of the user's
|
|
32
|
-
// environment.
|
|
33
|
-
undefined,
|
|
34
|
-
{
|
|
35
|
-
// Enables numeric sorting: numbers in strings are compared by value,
|
|
36
|
-
// e.g. 'file2' comes before 'file10' as numbers and not 'file10' before
|
|
37
|
-
// 'file2' as plain text.
|
|
38
|
-
numeric: true,
|
|
39
|
-
// Makes the comparison case-insensitive and ignores diacritics, e.g.
|
|
40
|
-
// 'a', 'A', and 'á' are treated as equivalent.
|
|
41
|
-
sensitivity: 'base'
|
|
42
|
-
}
|
|
43
|
-
).compare
|
|
44
|
-
}
|
|
45
|
-
return _naturalCompare(x, y)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
let _naturalSorter
|
|
49
|
-
/**
|
|
50
|
-
* Sort an array using natural comparison.
|
|
51
|
-
* @param {any[]} arrayToSort - The array to sort.
|
|
52
|
-
* @returns {any} The fast-sort instance with natural comparison.
|
|
53
|
-
*/
|
|
54
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
55
|
-
function naturalSorter(arrayToSort) {
|
|
56
|
-
if (_naturalSorter === undefined) {
|
|
57
|
-
// The 'fast-sort' package is browser safe.
|
|
58
|
-
const fastSort = /*@__PURE__*/ require('../external/fast-sort')
|
|
59
|
-
_naturalSorter = fastSort.createNewSortInstance({
|
|
60
|
-
comparer: naturalCompare
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
return _naturalSorter(arrayToSort)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
module.exports = {
|
|
67
|
-
localeCompare,
|
|
68
|
-
naturalCompare,
|
|
69
|
-
naturalSorter
|
|
70
|
-
}
|