@socketsecurity/cli-with-sentry 1.16.1 → 1.17.1
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 +18 -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,390 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
execBin,
|
|
5
|
-
resolveBinPathSync,
|
|
6
|
-
whichBin,
|
|
7
|
-
whichBinSync
|
|
8
|
-
} = /*@__PURE__*/ require('./bin')
|
|
9
|
-
const { isDebug } = /*@__PURE__*/ require('./debug')
|
|
10
|
-
const { findUpSync } = /*@__PURE__*/ require('./fs')
|
|
11
|
-
const { getOwn } = /*@__PURE__*/ require('./objects')
|
|
12
|
-
const { spawn } = /*@__PURE__*/ require('./spawn')
|
|
13
|
-
|
|
14
|
-
const npmAuditFlags = new Set(['--audit', '--no-audit'])
|
|
15
|
-
|
|
16
|
-
const npmFundFlags = new Set(['--fund', '--no-fund'])
|
|
17
|
-
|
|
18
|
-
const npmLogFlags = new Set([
|
|
19
|
-
// --loglevel has several aliases:
|
|
20
|
-
// https://docs.npmjs.com/cli/v11/using-npm/logging#aliases
|
|
21
|
-
'--loglevel',
|
|
22
|
-
'-d',
|
|
23
|
-
'--dd',
|
|
24
|
-
'--ddd',
|
|
25
|
-
'-q',
|
|
26
|
-
'--quiet',
|
|
27
|
-
'-s',
|
|
28
|
-
'--silent'
|
|
29
|
-
])
|
|
30
|
-
|
|
31
|
-
const npmProgressFlags = new Set(['--progress', '--no-progress'])
|
|
32
|
-
|
|
33
|
-
const pnpmIgnoreScriptsFlags = new Set([
|
|
34
|
-
'--ignore-scripts',
|
|
35
|
-
'--no-ignore-scripts'
|
|
36
|
-
])
|
|
37
|
-
|
|
38
|
-
const pnpmFrozenLockfileFlags = new Set([
|
|
39
|
-
'--frozen-lockfile',
|
|
40
|
-
'--no-frozen-lockfile'
|
|
41
|
-
])
|
|
42
|
-
|
|
43
|
-
const pnpmInstallCommands = new Set(['install', 'i'])
|
|
44
|
-
|
|
45
|
-
// Commands that support --ignore-scripts flag in pnpm:
|
|
46
|
-
// Installation-related: install, add, update, remove, link, unlink, import, rebuild.
|
|
47
|
-
const pnpmInstallLikeCommands = new Set([
|
|
48
|
-
'install',
|
|
49
|
-
'i',
|
|
50
|
-
'add',
|
|
51
|
-
'update',
|
|
52
|
-
'up',
|
|
53
|
-
'remove',
|
|
54
|
-
'rm',
|
|
55
|
-
'link',
|
|
56
|
-
'ln',
|
|
57
|
-
'unlink',
|
|
58
|
-
'import',
|
|
59
|
-
'rebuild',
|
|
60
|
-
'rb'
|
|
61
|
-
])
|
|
62
|
-
|
|
63
|
-
// Commands that support --ignore-scripts flag in yarn:
|
|
64
|
-
// Similar to npm/pnpm: installation-related commands.
|
|
65
|
-
const yarnInstallLikeCommands = new Set([
|
|
66
|
-
'install',
|
|
67
|
-
'add',
|
|
68
|
-
'upgrade',
|
|
69
|
-
'remove',
|
|
70
|
-
'link',
|
|
71
|
-
'unlink',
|
|
72
|
-
'import'
|
|
73
|
-
])
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Execute npm commands with optimized flags and settings.
|
|
77
|
-
* @param {string[] | readonly string[]} args - Command arguments to pass to npm.
|
|
78
|
-
* @param {import('./spawn').SpawnOptions} [options] - Spawn options.
|
|
79
|
-
* @returns {Promise<{ stdout: string; stderr: string }>} Command output.
|
|
80
|
-
*/
|
|
81
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
82
|
-
function execNpm(args, options) {
|
|
83
|
-
const useDebug = isDebug()
|
|
84
|
-
const terminatorPos = args.indexOf('--')
|
|
85
|
-
const npmArgs = (
|
|
86
|
-
terminatorPos === -1 ? args : args.slice(0, terminatorPos)
|
|
87
|
-
).filter(
|
|
88
|
-
a => !isNpmAuditFlag(a) && !isNpmFundFlag(a) && !isNpmProgressFlag(a)
|
|
89
|
-
)
|
|
90
|
-
const otherArgs = terminatorPos === -1 ? [] : args.slice(terminatorPos)
|
|
91
|
-
const logLevelArgs =
|
|
92
|
-
// The default value of loglevel is "notice". We default to "warn" which is
|
|
93
|
-
// one level quieter.
|
|
94
|
-
useDebug || npmArgs.some(isNpmLoglevelFlag) ? [] : ['--loglevel', 'warn']
|
|
95
|
-
return spawn(
|
|
96
|
-
/*@__PURE__*/ require('./constants/exec-path'),
|
|
97
|
-
[
|
|
98
|
-
.../*@__PURE__*/ require('./constants/node-harden-flags'),
|
|
99
|
-
.../*@__PURE__*/ require('./constants/node-no-warnings-flags'),
|
|
100
|
-
/*@__PURE__*/ require('./constants/npm-real-exec-path'),
|
|
101
|
-
// Even though '--loglevel=error' is passed npm will still run through
|
|
102
|
-
// code paths for 'audit' and 'fund' unless '--no-audit' and '--no-fund'
|
|
103
|
-
// flags are passed.
|
|
104
|
-
'--no-audit',
|
|
105
|
-
'--no-fund',
|
|
106
|
-
// Add `--no-progress` and `--silent` flags to fix input being swallowed
|
|
107
|
-
// by the spinner when running the command with recent versions of npm.
|
|
108
|
-
'--no-progress',
|
|
109
|
-
// Add '--loglevel=error' if a loglevel flag is not provided and the
|
|
110
|
-
// SOCKET_CLI_DEBUG environment variable is not truthy.
|
|
111
|
-
...logLevelArgs,
|
|
112
|
-
...npmArgs,
|
|
113
|
-
...otherArgs
|
|
114
|
-
],
|
|
115
|
-
{
|
|
116
|
-
__proto__: null,
|
|
117
|
-
...options
|
|
118
|
-
}
|
|
119
|
-
)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Execute pnpm commands with optimized flags and settings.
|
|
124
|
-
* @param {string[] | readonly string[]} args - Command arguments to pass to pnpm.
|
|
125
|
-
* @param {import('./spawn').SpawnOptions} [options] - Spawn options.
|
|
126
|
-
* @returns {Promise<{ stdout: string; stderr: string }>} Command output.
|
|
127
|
-
*/
|
|
128
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
129
|
-
function execPnpm(args, options) {
|
|
130
|
-
const { allowLockfileUpdate, ...extBinOpts } = { __proto__: null, ...options }
|
|
131
|
-
const useDebug = isDebug()
|
|
132
|
-
const terminatorPos = args.indexOf('--')
|
|
133
|
-
const pnpmArgs = (
|
|
134
|
-
terminatorPos === -1 ? args : args.slice(0, terminatorPos)
|
|
135
|
-
).filter(a => !isNpmProgressFlag(a))
|
|
136
|
-
const otherArgs = terminatorPos === -1 ? [] : args.slice(terminatorPos)
|
|
137
|
-
|
|
138
|
-
const firstArg = pnpmArgs[0]
|
|
139
|
-
const supportsIgnoreScripts = pnpmInstallLikeCommands.has(firstArg)
|
|
140
|
-
|
|
141
|
-
// pnpm uses --loglevel for all commands.
|
|
142
|
-
const logLevelArgs =
|
|
143
|
-
useDebug || pnpmArgs.some(isPnpmLoglevelFlag) ? [] : ['--loglevel', 'warn']
|
|
144
|
-
|
|
145
|
-
// Only add --ignore-scripts for commands that support it.
|
|
146
|
-
const hasIgnoreScriptsFlag = pnpmArgs.some(isPnpmIgnoreScriptsFlag)
|
|
147
|
-
const ignoreScriptsArgs =
|
|
148
|
-
!supportsIgnoreScripts || hasIgnoreScriptsFlag ? [] : ['--ignore-scripts']
|
|
149
|
-
|
|
150
|
-
// In CI environments, pnpm uses --frozen-lockfile by default which prevents lockfile updates.
|
|
151
|
-
// For commands that need to update the lockfile (like install with new packages/overrides),
|
|
152
|
-
// we need to explicitly add --no-frozen-lockfile in CI mode if not already present.
|
|
153
|
-
const ENV = /*@__PURE__*/ require('./constants/env')
|
|
154
|
-
const frozenLockfileArgs = []
|
|
155
|
-
if (
|
|
156
|
-
ENV.CI &&
|
|
157
|
-
allowLockfileUpdate &&
|
|
158
|
-
isPnpmInstallCommand(firstArg) &&
|
|
159
|
-
!pnpmArgs.some(isPnpmFrozenLockfileFlag)
|
|
160
|
-
) {
|
|
161
|
-
frozenLockfileArgs.push('--no-frozen-lockfile')
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// Note: pnpm doesn't have a --no-progress flag. It uses --reporter instead.
|
|
165
|
-
// We removed --no-progress as it causes "Unknown option" errors with pnpm.
|
|
166
|
-
|
|
167
|
-
return execBin(
|
|
168
|
-
'pnpm',
|
|
169
|
-
[
|
|
170
|
-
// Add '--loglevel=warn' if a loglevel flag is not provided and debug is off.
|
|
171
|
-
...logLevelArgs,
|
|
172
|
-
// Add '--ignore-scripts' by default for security (only for installation commands).
|
|
173
|
-
...ignoreScriptsArgs,
|
|
174
|
-
// Add '--no-frozen-lockfile' in CI when lockfile updates are needed.
|
|
175
|
-
...frozenLockfileArgs,
|
|
176
|
-
...pnpmArgs,
|
|
177
|
-
...otherArgs
|
|
178
|
-
],
|
|
179
|
-
extBinOpts
|
|
180
|
-
)
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
184
|
-
function execYarn(args, options) {
|
|
185
|
-
const useDebug = isDebug()
|
|
186
|
-
const terminatorPos = args.indexOf('--')
|
|
187
|
-
const yarnArgs = (
|
|
188
|
-
terminatorPos === -1 ? args : args.slice(0, terminatorPos)
|
|
189
|
-
).filter(a => !isNpmProgressFlag(a))
|
|
190
|
-
const otherArgs = terminatorPos === -1 ? [] : args.slice(terminatorPos)
|
|
191
|
-
|
|
192
|
-
const firstArg = yarnArgs[0]
|
|
193
|
-
const supportsIgnoreScripts = yarnInstallLikeCommands.has(firstArg)
|
|
194
|
-
|
|
195
|
-
// Yarn uses --silent flag for quieter output.
|
|
196
|
-
const logLevelArgs =
|
|
197
|
-
useDebug || yarnArgs.some(isNpmLoglevelFlag) ? [] : ['--silent']
|
|
198
|
-
|
|
199
|
-
// Only add --ignore-scripts for commands that support it.
|
|
200
|
-
const hasIgnoreScriptsFlag = yarnArgs.some(isPnpmIgnoreScriptsFlag)
|
|
201
|
-
const ignoreScriptsArgs =
|
|
202
|
-
!supportsIgnoreScripts || hasIgnoreScriptsFlag ? [] : ['--ignore-scripts']
|
|
203
|
-
|
|
204
|
-
return execBin(
|
|
205
|
-
'yarn',
|
|
206
|
-
[
|
|
207
|
-
// Add '--silent' if a loglevel flag is not provided and debug is off.
|
|
208
|
-
...logLevelArgs,
|
|
209
|
-
// Add '--ignore-scripts' by default for security (only for installation commands).
|
|
210
|
-
...ignoreScriptsArgs,
|
|
211
|
-
...yarnArgs,
|
|
212
|
-
...otherArgs
|
|
213
|
-
],
|
|
214
|
-
{
|
|
215
|
-
__proto__: null,
|
|
216
|
-
/**
|
|
217
|
-
* Check if a command argument is an npm audit flag.
|
|
218
|
-
* @param {string} cmdArg - The command argument to check.
|
|
219
|
-
* @returns {boolean} True if the argument is an audit flag.
|
|
220
|
-
*/
|
|
221
|
-
...options
|
|
222
|
-
}
|
|
223
|
-
)
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Check if a command argument is an npm fund flag.
|
|
228
|
-
* @param {string} cmdArg - The command argument to check.
|
|
229
|
-
* @returns {boolean} True if the argument is a fund flag.
|
|
230
|
-
*/
|
|
231
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
232
|
-
function isNpmAuditFlag(cmdArg) {
|
|
233
|
-
return npmAuditFlags.has(cmdArg)
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Check if a command argument is an npm loglevel flag.
|
|
238
|
-
* @param {string} cmdArg - The command argument to check.
|
|
239
|
-
* @returns {boolean} True if the argument is a loglevel flag.
|
|
240
|
-
*/
|
|
241
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
242
|
-
function isNpmFundFlag(cmdArg) {
|
|
243
|
-
return npmFundFlags.has(cmdArg)
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Check if a command argument is an npm loglevel flag.
|
|
248
|
-
* @param {string} cmdArg - The command argument to check.
|
|
249
|
-
* @returns {boolean} True if the argument is a loglevel flag.
|
|
250
|
-
*/
|
|
251
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
252
|
-
function isNpmLoglevelFlag(cmdArg) {
|
|
253
|
-
// https://docs.npmjs.com/cli/v11/using-npm/logging#setting-log-levels
|
|
254
|
-
return cmdArg.startsWith('--loglevel=') || npmLogFlags.has(cmdArg)
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Check if a command argument is an npm node-options flag.
|
|
259
|
-
* @param {string} cmdArg - The command argument to check.
|
|
260
|
-
* @returns {boolean} True if the argument is a node-options flag.
|
|
261
|
-
*/
|
|
262
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
263
|
-
function isNpmNodeOptionsFlag(cmdArg) {
|
|
264
|
-
// https://docs.npmjs.com/cli/v9/using-npm/config#node-options
|
|
265
|
-
return cmdArg.startsWith('--node-options=')
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Check if a command argument is an npm progress flag.
|
|
270
|
-
* @param {string} cmdArg - The command argument to check.
|
|
271
|
-
* @returns {boolean} True if the argument is a progress flag.
|
|
272
|
-
*/
|
|
273
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
274
|
-
function isNpmProgressFlag(cmdArg) {
|
|
275
|
-
return npmProgressFlags.has(cmdArg)
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Check if a command argument is a pnpm ignore-scripts flag.
|
|
280
|
-
* @param {string} cmdArg - The command argument to check.
|
|
281
|
-
* @returns {boolean} True if the argument is an ignore-scripts flag.
|
|
282
|
-
*/
|
|
283
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
284
|
-
function isPnpmIgnoreScriptsFlag(cmdArg) {
|
|
285
|
-
return pnpmIgnoreScriptsFlags.has(cmdArg)
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Check if a command argument is a pnpm frozen-lockfile flag.
|
|
290
|
-
* @param {string} cmdArg - The command argument to check.
|
|
291
|
-
* @returns {boolean} True if the argument is a frozen-lockfile flag.
|
|
292
|
-
*/
|
|
293
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
294
|
-
function isPnpmFrozenLockfileFlag(cmdArg) {
|
|
295
|
-
return pnpmFrozenLockfileFlags.has(cmdArg)
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Check if a command argument is a pnpm install command.
|
|
300
|
-
* @param {string} cmdArg - The command argument to check.
|
|
301
|
-
* @returns {boolean} True if the argument is an install command.
|
|
302
|
-
*/
|
|
303
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
304
|
-
function isPnpmInstallCommand(cmdArg) {
|
|
305
|
-
return pnpmInstallCommands.has(cmdArg)
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Alias for isNpmLoglevelFlag for pnpm usage.
|
|
310
|
-
* @param {string} cmdArg - The command argument to check.
|
|
311
|
-
* @returns {boolean} True if the argument is a loglevel flag.
|
|
312
|
-
*/
|
|
313
|
-
const isPnpmLoglevelFlag = isNpmLoglevelFlag
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Execute a package.json script using the appropriate package manager.
|
|
317
|
-
* Automatically detects pnpm, yarn, or npm based on lockfiles.
|
|
318
|
-
* @param {string} scriptName - The name of the script to run.
|
|
319
|
-
* @param {string[] | readonly string[]} args - Additional arguments to pass to the script.
|
|
320
|
-
* @param {ExecScriptOptions} [options] - Spawn options with optional prepost flag.
|
|
321
|
-
* @returns {Promise<{ stdout: string; stderr: string }>} Command output.
|
|
322
|
-
* @typedef {import('./objects').Remap<import('./spawn').SpawnOptions & {prepost?: boolean}>} ExecScriptOptions
|
|
323
|
-
*/
|
|
324
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
325
|
-
function execScript(scriptName, args, options) {
|
|
326
|
-
const { prepost, ...spawnOptions } = { __proto__: null, ...options }
|
|
327
|
-
const useNodeRun =
|
|
328
|
-
!prepost && /*@__PURE__*/ require('./constants/supports-node-run')
|
|
329
|
-
|
|
330
|
-
// Detect package manager based on lockfile by traversing up from current directory.
|
|
331
|
-
const cwd = getOwn(spawnOptions, 'cwd') ?? process.cwd()
|
|
332
|
-
|
|
333
|
-
// Check for pnpm-lock.yaml.
|
|
334
|
-
const PNPM_LOCK_YAML = /*@__PURE__*/ require('./constants/pnpm-lock-yaml')
|
|
335
|
-
const pnpmLockPath = findUpSync(PNPM_LOCK_YAML, { cwd })
|
|
336
|
-
if (pnpmLockPath) {
|
|
337
|
-
return execPnpm(['run', scriptName, ...args], spawnOptions)
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
// Check for package-lock.json.
|
|
341
|
-
// When in an npm workspace, use npm run to ensure workspace binaries are available.
|
|
342
|
-
const PACKAGE_LOCK = /*@__PURE__*/ require('./constants/package-lock-json')
|
|
343
|
-
const packageLockPath = findUpSync(PACKAGE_LOCK, { cwd })
|
|
344
|
-
if (packageLockPath) {
|
|
345
|
-
return execNpm(['run', scriptName, ...args], spawnOptions)
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// Check for yarn.lock.
|
|
349
|
-
const YARN_LOCK = /*@__PURE__*/ require('./constants/yarn-lock')
|
|
350
|
-
const yarnLockPath = findUpSync(YARN_LOCK, { cwd })
|
|
351
|
-
if (yarnLockPath) {
|
|
352
|
-
return execYarn(['run', scriptName, ...args], spawnOptions)
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
return spawn(
|
|
356
|
-
/*@__PURE__*/ require('./constants/exec-path'),
|
|
357
|
-
[
|
|
358
|
-
.../*@__PURE__*/ require('./constants/node-no-warnings-flags'),
|
|
359
|
-
...(useNodeRun
|
|
360
|
-
? ['--run']
|
|
361
|
-
: [/*@__PURE__*/ require('./constants/npm-real-exec-path'), 'run']),
|
|
362
|
-
scriptName,
|
|
363
|
-
...args
|
|
364
|
-
],
|
|
365
|
-
{
|
|
366
|
-
__proto__: null,
|
|
367
|
-
...spawnOptions
|
|
368
|
-
}
|
|
369
|
-
)
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
module.exports = {
|
|
373
|
-
execBin,
|
|
374
|
-
execNpm,
|
|
375
|
-
execPnpm,
|
|
376
|
-
execScript,
|
|
377
|
-
execYarn,
|
|
378
|
-
isNpmAuditFlag,
|
|
379
|
-
isNpmFundFlag,
|
|
380
|
-
isNpmLoglevelFlag,
|
|
381
|
-
isNpmNodeOptionsFlag,
|
|
382
|
-
isNpmProgressFlag,
|
|
383
|
-
isPnpmFrozenLockfileFlag,
|
|
384
|
-
isPnpmIgnoreScriptsFlag,
|
|
385
|
-
isPnpmInstallCommand,
|
|
386
|
-
isPnpmLoglevelFlag,
|
|
387
|
-
resolveBinPathSync,
|
|
388
|
-
whichBin,
|
|
389
|
-
whichBinSync
|
|
390
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
let _conjunctionFormatter
|
|
4
|
-
/**
|
|
5
|
-
* Get a cached Intl.ListFormat instance for conjunction (and) formatting.
|
|
6
|
-
* @returns {Intl.ListFormat} The conjunction formatter.
|
|
7
|
-
* @private
|
|
8
|
-
*/
|
|
9
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
10
|
-
function getConjunctionFormatter() {
|
|
11
|
-
if (_conjunctionFormatter === undefined) {
|
|
12
|
-
_conjunctionFormatter = new Intl.ListFormat('en', {
|
|
13
|
-
style: 'long',
|
|
14
|
-
type: 'conjunction' // "and" lists.
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
return _conjunctionFormatter
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
let _disjunctionFormatter
|
|
21
|
-
/**
|
|
22
|
-
* Get a cached Intl.ListFormat instance for disjunction (or) formatting.
|
|
23
|
-
* @returns {Intl.ListFormat} The disjunction formatter.
|
|
24
|
-
* @private
|
|
25
|
-
*/
|
|
26
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
27
|
-
function getDisjunctionFormatter() {
|
|
28
|
-
if (_disjunctionFormatter === undefined) {
|
|
29
|
-
_disjunctionFormatter = new Intl.ListFormat('en', {
|
|
30
|
-
style: 'long',
|
|
31
|
-
type: 'disjunction' // "or" lists.
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
return _disjunctionFormatter
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Split an array into chunks of a specified size.
|
|
39
|
-
* @param {any[]} arr - The array to chunk.
|
|
40
|
-
* @param {number} [size=2] - The size of each chunk.
|
|
41
|
-
* @returns {any[][]} Array of chunked arrays.
|
|
42
|
-
*/
|
|
43
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
44
|
-
function arrayChunk(arr, size = 2) {
|
|
45
|
-
const { length } = arr
|
|
46
|
-
const chunkSize = Math.min(length, size)
|
|
47
|
-
const chunks = []
|
|
48
|
-
for (let i = 0; i < length; i += chunkSize) {
|
|
49
|
-
chunks.push(arr.slice(i, i + chunkSize))
|
|
50
|
-
}
|
|
51
|
-
return chunks
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Get unique values from an array.
|
|
56
|
-
* @param {any[]} arr - The array to deduplicate.
|
|
57
|
-
* @returns {any[]} Array with unique values.
|
|
58
|
-
*/
|
|
59
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
60
|
-
function arrayUnique(arr) {
|
|
61
|
-
return [...new Set(arr)]
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Join array elements with proper "and" conjunction formatting.
|
|
66
|
-
* @param {string[]} arr - The array to join.
|
|
67
|
-
* @returns {string} The formatted string with "and" conjunction.
|
|
68
|
-
*/
|
|
69
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
70
|
-
function joinAnd(arr) {
|
|
71
|
-
return getConjunctionFormatter().format(arr)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Join array elements with proper "or" disjunction formatting.
|
|
76
|
-
* @param {string[]} arr - The array to join.
|
|
77
|
-
* @returns {string} The formatted string with "or" disjunction.
|
|
78
|
-
*/
|
|
79
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
80
|
-
function joinOr(arr) {
|
|
81
|
-
return getDisjunctionFormatter().format(arr)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
module.exports = {
|
|
85
|
-
arrayChunk,
|
|
86
|
-
arrayUnique,
|
|
87
|
-
joinAnd,
|
|
88
|
-
joinOr
|
|
89
|
-
}
|