@socketsecurity/cli-with-sentry 1.16.0 → 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 +19 -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 +2120 -4305
- 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 -6
- 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 +4481 -806
- 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 +43 -36
- 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
package/dist/spinner.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var process = require('node:process');
|
|
4
|
+
|
|
5
|
+
const ciSpinner = {
|
|
6
|
+
frames: [''],
|
|
7
|
+
interval: 2_147_483_647
|
|
8
|
+
};
|
|
9
|
+
const defaultStyle = {
|
|
10
|
+
frames: process.env['TERM'] === 'linux' ? ['-', '\\', '|', '/'] : ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],
|
|
11
|
+
interval: 80
|
|
12
|
+
};
|
|
13
|
+
const cliSpinners = {
|
|
14
|
+
default: defaultStyle,
|
|
15
|
+
ci: ciSpinner
|
|
16
|
+
};
|
|
17
|
+
function getCliSpinners(styleName) {
|
|
18
|
+
return styleName === undefined ? cliSpinners : Object.hasOwn(cliSpinners, styleName) ? cliSpinners[styleName] : undefined;
|
|
19
|
+
}
|
|
20
|
+
class Spinner {
|
|
21
|
+
color = 'cyan';
|
|
22
|
+
#stream;
|
|
23
|
+
#timer;
|
|
24
|
+
#frame = 0;
|
|
25
|
+
#indent = 0;
|
|
26
|
+
#spinning = false;
|
|
27
|
+
#interactive;
|
|
28
|
+
constructor(options = {}) {
|
|
29
|
+
this.text = options.text?.trimStart() ?? '';
|
|
30
|
+
this.spinner = options.spinner ?? (process.env['CI'] ? ciSpinner : defaultStyle);
|
|
31
|
+
this.#stream = options.stream ?? process.stderr;
|
|
32
|
+
this.color = options.color ?? 'cyan';
|
|
33
|
+
this.#interactive = !!this.#stream.isTTY && process.env['TERM'] !== 'dumb' && !('CI' in process.env);
|
|
34
|
+
if (options.signal?.aborted) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
options.signal?.addEventListener('abort', () => this.stop(), {
|
|
38
|
+
once: true
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
get isSpinning() {
|
|
42
|
+
return this.#spinning;
|
|
43
|
+
}
|
|
44
|
+
getText() {
|
|
45
|
+
return this.text;
|
|
46
|
+
}
|
|
47
|
+
setText(text = '') {
|
|
48
|
+
this.text = text.trimStart();
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
clear() {
|
|
52
|
+
if (this.isSpinning) {
|
|
53
|
+
this.#stream.write('\r\u001b[K');
|
|
54
|
+
}
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
indent(spaces = 2) {
|
|
58
|
+
this.#indent += spaces;
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
dedent(spaces = 2) {
|
|
62
|
+
this.#indent = Math.max(0, this.#indent - spaces);
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
resetIndent() {
|
|
66
|
+
this.#indent = 0;
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
start(text) {
|
|
70
|
+
if (text !== undefined) {
|
|
71
|
+
this.setText(text);
|
|
72
|
+
}
|
|
73
|
+
if (this.isSpinning) {
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
this.#spinning = true;
|
|
77
|
+
this.#render();
|
|
78
|
+
if (this.#interactive) {
|
|
79
|
+
this.#timer = setInterval(() => this.#render(), this.spinner.interval ?? 80);
|
|
80
|
+
}
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
stop(finalText) {
|
|
84
|
+
if (!this.isSpinning) {
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
if (this.#timer) {
|
|
88
|
+
clearInterval(this.#timer);
|
|
89
|
+
}
|
|
90
|
+
this.#timer = undefined;
|
|
91
|
+
this.#spinning = false;
|
|
92
|
+
if (this.#interactive) {
|
|
93
|
+
this.#stream.write('\r\u001b[K\u001b[?25h');
|
|
94
|
+
}
|
|
95
|
+
if (finalText) {
|
|
96
|
+
this.#stream.write(`${' '.repeat(this.#indent)}${finalText.trimStart()}\n`);
|
|
97
|
+
}
|
|
98
|
+
this.text = '';
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
info(text = '') {
|
|
102
|
+
const spinning = this.isSpinning;
|
|
103
|
+
this.stop(text);
|
|
104
|
+
if (spinning) {
|
|
105
|
+
this.start();
|
|
106
|
+
}
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
infoAndStop(text = '') {
|
|
110
|
+
return this.stop(text);
|
|
111
|
+
}
|
|
112
|
+
success(text = '') {
|
|
113
|
+
return this.#symbol('✔', text, true);
|
|
114
|
+
}
|
|
115
|
+
successAndStop(text = '') {
|
|
116
|
+
return this.#symbol('✔', text, false);
|
|
117
|
+
}
|
|
118
|
+
fail(text = '') {
|
|
119
|
+
return this.#symbol('✖', text, true);
|
|
120
|
+
}
|
|
121
|
+
failAndStop(text = '') {
|
|
122
|
+
return this.#symbol('✖', text, false);
|
|
123
|
+
}
|
|
124
|
+
error(text = '') {
|
|
125
|
+
return this.fail(text);
|
|
126
|
+
}
|
|
127
|
+
errorAndStop(text = '') {
|
|
128
|
+
return this.failAndStop(text);
|
|
129
|
+
}
|
|
130
|
+
warn(text = '') {
|
|
131
|
+
return this.#symbol('⚠', text, true);
|
|
132
|
+
}
|
|
133
|
+
warnAndStop(text = '') {
|
|
134
|
+
return this.#symbol('⚠', text, false);
|
|
135
|
+
}
|
|
136
|
+
warning(text = '') {
|
|
137
|
+
return this.warn(text);
|
|
138
|
+
}
|
|
139
|
+
warningAndStop(text = '') {
|
|
140
|
+
return this.warnAndStop(text);
|
|
141
|
+
}
|
|
142
|
+
log(text = '') {
|
|
143
|
+
const spinning = this.isSpinning;
|
|
144
|
+
this.stop(text);
|
|
145
|
+
if (spinning) {
|
|
146
|
+
this.start();
|
|
147
|
+
}
|
|
148
|
+
return this;
|
|
149
|
+
}
|
|
150
|
+
logAndStop(text = '') {
|
|
151
|
+
return this.stop(text);
|
|
152
|
+
}
|
|
153
|
+
debug(text = '') {
|
|
154
|
+
return this.info(text);
|
|
155
|
+
}
|
|
156
|
+
debugAndStop(text = '') {
|
|
157
|
+
return this.infoAndStop(text);
|
|
158
|
+
}
|
|
159
|
+
#symbol(symbol, text, keepSpinning) {
|
|
160
|
+
const spinning = this.isSpinning;
|
|
161
|
+
this.stop(`${symbol} ${text}`);
|
|
162
|
+
if (keepSpinning && spinning) {
|
|
163
|
+
this.start();
|
|
164
|
+
}
|
|
165
|
+
return this;
|
|
166
|
+
}
|
|
167
|
+
#render() {
|
|
168
|
+
const frames = this.spinner.frames;
|
|
169
|
+
const frame = frames[this.#frame++ % frames.length] ?? '';
|
|
170
|
+
const value = `${' '.repeat(this.#indent)}${frame ? `${frame} ` : ''}${this.text}`;
|
|
171
|
+
if (!value) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
this.#stream.write(this.#interactive ? `\r\u001b[K${value}` : `${value}\n`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const defaultSpinner = new Spinner();
|
|
178
|
+
|
|
179
|
+
exports.defaultSpinner = defaultSpinner;
|
|
180
|
+
exports.getCliSpinners = getCliSpinners;
|
|
181
|
+
//# debugId=f116a66a-090c-462c-b6a1-146b3467398b
|
|
182
|
+
//# sourceMappingURL=spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.js","sources":["../src/utils/spinner.mts"],"sourcesContent":["import process from 'node:process'\n\nexport type SpinnerStyle = { frames: string[]; interval?: number | undefined }\nexport type SpinnerOptions = {\n color?: string | undefined\n spinner?: SpinnerStyle | undefined\n signal?: AbortSignal | undefined\n stream?: NodeJS.WriteStream | undefined\n text?: string | undefined\n}\n\nconst ciSpinner: SpinnerStyle = { frames: [''], interval: 2_147_483_647 }\nconst defaultStyle: SpinnerStyle = {\n frames:\n process.env['TERM'] === 'linux'\n ? ['-', '\\\\', '|', '/']\n : ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],\n interval: 80,\n}\nconst cliSpinners: Record<string, SpinnerStyle> = {\n default: defaultStyle,\n ci: ciSpinner,\n}\n\nexport function getCliSpinners(styleName?: string): SpinnerStyle | undefined\nexport function getCliSpinners(\n styleName?: string,\n): SpinnerStyle | Record<string, SpinnerStyle> | undefined {\n return styleName === undefined\n ? cliSpinners\n : Object.hasOwn(cliSpinners, styleName)\n ? cliSpinners[styleName]\n : undefined\n}\n\nexport class Spinner {\n color = 'cyan'\n text: string\n spinner: SpinnerStyle\n #stream: NodeJS.WriteStream\n #timer: NodeJS.Timeout | undefined\n #frame = 0\n #indent = 0\n #spinning = false\n #interactive: boolean\n\n constructor(options: SpinnerOptions = {}) {\n this.text = options.text?.trimStart() ?? ''\n this.spinner =\n options.spinner ?? (process.env['CI'] ? ciSpinner : defaultStyle)\n this.#stream = options.stream ?? process.stderr\n this.color = options.color ?? 'cyan'\n this.#interactive =\n !!this.#stream.isTTY &&\n process.env['TERM'] !== 'dumb' &&\n !('CI' in process.env)\n if (options.signal?.aborted) {\n return\n }\n options.signal?.addEventListener('abort', () => this.stop(), { once: true })\n }\n\n get isSpinning(): boolean {\n return this.#spinning\n }\n getText(): string {\n return this.text\n }\n setText(text = ''): this {\n this.text = text.trimStart()\n return this\n }\n clear(): this {\n if (this.isSpinning) {\n this.#stream.write('\\r\\u001b[K')\n }\n return this\n }\n indent(spaces = 2): this {\n this.#indent += spaces\n return this\n }\n dedent(spaces = 2): this {\n this.#indent = Math.max(0, this.#indent - spaces)\n return this\n }\n resetIndent(): this {\n this.#indent = 0\n return this\n }\n\n start(text?: string): this {\n if (text !== undefined) {\n this.setText(text)\n }\n if (this.isSpinning) {\n return this\n }\n this.#spinning = true\n this.#render()\n if (this.#interactive) {\n this.#timer = setInterval(\n () => this.#render(),\n this.spinner.interval ?? 80,\n )\n }\n return this\n }\n\n stop(finalText?: string): this {\n if (!this.isSpinning) {\n return this\n }\n if (this.#timer) {\n clearInterval(this.#timer)\n }\n this.#timer = undefined\n this.#spinning = false\n if (this.#interactive) {\n this.#stream.write('\\r\\u001b[K\\u001b[?25h')\n }\n if (finalText) {\n this.#stream.write(\n `${' '.repeat(this.#indent)}${finalText.trimStart()}\\n`,\n )\n }\n this.text = ''\n return this\n }\n\n info(text = ''): this {\n const spinning = this.isSpinning\n this.stop(text)\n if (spinning) {\n this.start()\n }\n return this\n }\n infoAndStop(text = ''): this {\n return this.stop(text)\n }\n success(text = ''): this {\n return this.#symbol('✔', text, true)\n }\n successAndStop(text = ''): this {\n return this.#symbol('✔', text, false)\n }\n fail(text = ''): this {\n return this.#symbol('✖', text, true)\n }\n failAndStop(text = ''): this {\n return this.#symbol('✖', text, false)\n }\n error(text = ''): this {\n return this.fail(text)\n }\n errorAndStop(text = ''): this {\n return this.failAndStop(text)\n }\n warn(text = ''): this {\n return this.#symbol('⚠', text, true)\n }\n warnAndStop(text = ''): this {\n return this.#symbol('⚠', text, false)\n }\n warning(text = ''): this {\n return this.warn(text)\n }\n warningAndStop(text = ''): this {\n return this.warnAndStop(text)\n }\n log(text = ''): this {\n const spinning = this.isSpinning\n this.stop(text)\n if (spinning) {\n this.start()\n }\n return this\n }\n logAndStop(text = ''): this {\n return this.stop(text)\n }\n debug(text = ''): this {\n return this.info(text)\n }\n debugAndStop(text = ''): this {\n return this.infoAndStop(text)\n }\n\n #symbol(symbol: string, text: string, keepSpinning: boolean): this {\n const spinning = this.isSpinning\n this.stop(`${symbol} ${text}`)\n if (keepSpinning && spinning) {\n this.start()\n }\n return this\n }\n\n #render(): void {\n const frames = this.spinner.frames\n const frame = frames[this.#frame++ % frames.length] ?? ''\n const value = `${' '.repeat(this.#indent)}${frame ? `${frame} ` : ''}${this.text}`\n if (!value) {\n return\n }\n this.#stream.write(this.#interactive ? `\\r\\u001b[K${value}` : `${value}\\n`)\n }\n}\n\nconst defaultSpinner = new Spinner()\nexport default defaultSpinner\n"],"names":["interval","frames","default","ci","color","constructor","options","once","getText","setText","clear","indent","dedent","resetIndent","clearInterval","info","infoAndStop","success","successAndStop","fail","failAndStop","error","errorAndStop","warn","warnAndStop","warning","warningAndStop","log","logAndStop","debug","debugAndStop"],"mappings":";;;;AAWA;;AAAgDA;AAAwB;AACxE;AACEC;AAIAD;AACF;AACA;AACEE;AACAC;AACF;AAGO;;AAQP;AAEO;AACLC;AAGA;AACA;;;;AAIA;AAEAC;;AAEE;;AAGA;AACA;AAIA;AACE;AACF;AACAC;AAA+DC;AAAW;AAC5E;;;AAIA;AACAC;;AAEA;AACAC;AACE;AACA;AACF;AACAC;;AAEI;AACF;AACA;AACF;AACAC;AACE;AACA;AACF;AACAC;AACE;AACA;AACF;AACAC;AACE;AACA;AACF;;;AAII;AACF;;AAEE;AACF;AACA;AACA;AACA;;AAKA;AACA;AACF;;AAGE;AACE;AACF;AACA;AACEC;AACF;AACA;AACA;AACA;AACE;AACF;AACA;;AAIA;;AAEA;AACF;AAEAC;AACE;AACA;AACA;;AAEA;AACA;AACF;AACAC;AACE;AACF;AACAC;;AAEA;AACAC;;AAEA;AACAC;;AAEA;AACAC;;AAEA;AACAC;AACE;AACF;AACAC;AACE;AACF;AACAC;;AAEA;AACAC;;AAEA;AACAC;AACE;AACF;AACAC;AACE;AACF;AACAC;AACE;AACA;AACA;;AAEA;AACA;AACF;AACAC;AACE;AACF;AACAC;AACE;AACF;AACAC;AACE;AACF;AAEA;AACE;;;;AAIA;AACA;AACF;;AAGE;AACA;;;AAGE;AACF;AACA;AACF;AACF;AAEA;;;","debugId":"f116a66a-090c-462c-b6a1-146b3467398b"}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import type { PURL_Type } from '../../utils/ecosystem.mts';
|
|
2
|
+
import type { SocketFactsContext } from '../manifest/run-manifest-facts.mts';
|
|
2
3
|
export type GeneratedSocketFacts = {
|
|
3
4
|
// Coana's flags selecting what the facts files resolve.
|
|
4
5
|
artifactsFlags: string[];
|
|
5
6
|
// Facts files of dropped runs, which Coana must not read.
|
|
6
7
|
discardedPaths: string[];
|
|
7
8
|
paths: string[];
|
|
8
|
-
//
|
|
9
|
+
// Records each build root's saved state for `--socket-facts-sidecar`.
|
|
10
|
+
// The file lives outside the repository.
|
|
9
11
|
sidecarFile: string;
|
|
10
12
|
remove: () => Promise<void>;
|
|
11
13
|
restore: () => Promise<void>;
|
|
12
14
|
};
|
|
13
15
|
// Backed up so each fix attempt sees the pre-fix build after `git clean`, and
|
|
14
16
|
// facts files already present are left as they were found.
|
|
15
|
-
export declare function generateSocketFactsForFix({ cwd, excludePaths, findFactsPaths, purlTypes, tmpDir }: {
|
|
17
|
+
export declare function generateSocketFactsForFix({ context, cwd, excludePaths, findFactsPaths, purlTypes, tmpDir }: {
|
|
18
|
+
context: Omit<SocketFactsContext, 'workDir'>;
|
|
16
19
|
cwd: string;
|
|
17
20
|
excludePaths: string[];
|
|
18
21
|
findFactsPaths: () => Promise<string[]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FixConfig } from './types.mts';
|
|
2
2
|
import type { OutputKind } from '../../types.mts';
|
|
3
|
-
import type { Remap } from '
|
|
3
|
+
import type { Remap } from '../../utils/objects.mts';
|
|
4
4
|
export type HandleFixConfig = Remap<FixConfig & {
|
|
5
5
|
applyFixes: boolean;
|
|
6
6
|
coanaVersion?: string | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FactsOnlyTypes } from '../../utils/coana.mts';
|
|
2
2
|
import type { PURL_Type } from '../../utils/ecosystem.mts';
|
|
3
3
|
import type { RangeStyle } from '../../utils/semver.mts';
|
|
4
|
-
import type { Spinner } from '
|
|
4
|
+
import type { Spinner } from '../../utils/spinner.mts';
|
|
5
5
|
export type FixConfig = {
|
|
6
6
|
all: boolean;
|
|
7
7
|
allowOverrides: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SpawnOptions } from '
|
|
1
|
+
import type { SpawnOptions } from '../../../utils/spawn.mts';
|
|
2
2
|
export declare function getBazelEnvironment(overrides?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): NodeJS.ProcessEnv;
|
|
3
3
|
export declare function getBazelEnvironmentValue(env: NodeJS.ProcessEnv, name: string): string | undefined;
|
|
4
4
|
export declare function prependBazelPath(env: NodeJS.ProcessEnv, dir: string): NodeJS.ProcessEnv;
|
|
@@ -17,7 +17,7 @@ export declare function spawnBazel(bin: string, args: string[], { signal, timeou
|
|
|
17
17
|
signal: AbortSignal | null;
|
|
18
18
|
stdout: string;
|
|
19
19
|
stderr: string;
|
|
20
|
-
} & import("
|
|
20
|
+
} & import("../../../utils/spawn.mts").SpawnExtra>;
|
|
21
21
|
export declare function buildBazelStartupFlags(opts: {
|
|
22
22
|
bazelRc?: string;
|
|
23
23
|
bazelOutputBase?: string;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import type { EcosystemBuildConfig } from './generate-recursive-manifests.mts';
|
|
2
|
-
import type { RunManifestFactsOutcome } from './run-manifest-facts.mts';
|
|
3
|
-
import type { BuildOptionHints } from './scripts/resolution-report-render.mts';
|
|
4
|
-
import type { SidecarAccumulator } from './scripts/sidecar.mts';
|
|
2
|
+
import type { BuildOptionHints, RunManifestFactsOutcome, SocketFactsContext } from './run-manifest-facts.mts';
|
|
5
3
|
// Generates `<entry>.socket.facts.json` for the given solution or project
|
|
6
4
|
// file, or for every solution and project at the top of `cwd`. A project a
|
|
7
5
|
// solution there already covers is not built again.
|
|
8
|
-
export declare function convertDotnetToFacts({ config, cwd, entryFile, excludePaths, hints
|
|
6
|
+
export declare function convertDotnetToFacts({ config, context, cwd, entryFile, excludePaths, hints }: {
|
|
9
7
|
config: EcosystemBuildConfig;
|
|
8
|
+
context?: SocketFactsContext | undefined;
|
|
10
9
|
cwd: string;
|
|
11
10
|
// Builds only this file (relative to cwd) when set.
|
|
12
11
|
entryFile?: string | undefined;
|
|
13
12
|
excludePaths?: string[] | undefined;
|
|
14
13
|
hints?: BuildOptionHints | undefined;
|
|
15
|
-
sidecarAcc?: SidecarAccumulator | undefined;
|
|
16
|
-
withFiles?: boolean | undefined;
|
|
17
14
|
}): Promise<RunManifestFactsOutcome>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { listDotnetSolutionMembers } from './run-manifest-facts.mts';
|
|
2
|
+
import type { SocketFactsContext, SocketFactsProject, SocketFactsRequestOptions } from './run-manifest-facts.mts';
|
|
3
3
|
import type { BuildTool } from './scripts/build-tool.mts';
|
|
4
|
-
import type { SocketFactsSbomProject } from './scripts/facts.mts';
|
|
5
|
-
import type { ManifestScriptOptions } from './scripts/run.mts';
|
|
6
4
|
import type { PURL_Type } from '../../utils/ecosystem.mts';
|
|
7
5
|
import type { SocketJson } from '../../utils/socket-json.mts';
|
|
8
6
|
import type { SocketYml } from '@socketsecurity/config';
|
|
@@ -12,7 +10,6 @@ export type BuildRoot = {
|
|
|
12
10
|
dir: string;
|
|
13
11
|
entryFile?: string | undefined;
|
|
14
12
|
};
|
|
15
|
-
export declare function buildRootPath(root: BuildRoot): string;
|
|
16
13
|
export declare function isBuildFile(tool: BuildTool, basename: string): boolean;
|
|
17
14
|
export declare function compareEntryFiles(tool: BuildTool, a: string, b: string): number;
|
|
18
15
|
// A disabled ecosystem is skipped entirely by the glob scan below, so a
|
|
@@ -21,7 +18,6 @@ export declare function compareEntryFiles(tool: BuildTool, a: string, b: string)
|
|
|
21
18
|
// must strip `disabled` here first, and let their own per-directory cascade
|
|
22
19
|
// check apply it instead.
|
|
23
20
|
export declare function withoutDisabledFlags(sockJson: SocketJson): SocketJson;
|
|
24
|
-
export { realpathOrResolved };
|
|
25
21
|
// What a build loaded: its projects' directories and build files,
|
|
26
22
|
// realpath-resolved. Gradle reports a project's build file even when absent,
|
|
27
23
|
// which names nothing.
|
|
@@ -33,20 +29,23 @@ export declare function emptyMembership(): Membership;
|
|
|
33
29
|
export declare function addMembership(into: Membership, from: Membership): void;
|
|
34
30
|
export declare function unionMemberships(memberships: Iterable<Membership>): Membership;
|
|
35
31
|
export declare function isPathInside(dir: string, file: string): boolean;
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
export declare function membershipOf(
|
|
32
|
+
// Only what lies inside `scanRoot` (when given) counts, as only that can be a
|
|
33
|
+
// candidate.
|
|
34
|
+
export declare function membershipOf(projects: readonly SocketFactsProject[], scanRoot?: string | undefined): Promise<Membership>;
|
|
39
35
|
export declare function hasRootMarker(tool: BuildTool, root: BuildRoot): boolean;
|
|
40
36
|
// Whether a build loaded `root`'s project; a build of its own (see
|
|
41
37
|
// hasRootMarker) is more than that project. `root.dir` must be
|
|
42
38
|
// realpath-resolved, as findBuildToolCandidates returns it.
|
|
43
39
|
export declare function isBuildRootCovered(covered: Membership, tool: BuildTool, root: BuildRoot): boolean;
|
|
40
|
+
export type RootBuildOptions = Pick<SocketFactsRequestOptions, 'bin' | 'buildOpts' | 'excludeBase' | 'excludePaths'> & {
|
|
41
|
+
context?: SocketFactsContext | undefined;
|
|
42
|
+
};
|
|
44
43
|
// Whether earlier builds cover `root`: its own build files, or every project
|
|
45
44
|
// a solution builds. isBuildRootCovered alone is the cheap first half.
|
|
46
|
-
export declare function isRootCovered(covered: Membership, tool: BuildTool, root: BuildRoot, opts:
|
|
45
|
+
export declare function isRootCovered(covered: Membership, tool: BuildTool, root: BuildRoot, opts: RootBuildOptions, listMembers?: typeof listDotnetSolutionMembers): Promise<boolean>;
|
|
47
46
|
// A build of its own (see hasRootMarker) is covered only by builds that load
|
|
48
47
|
// all of `own`, what it loads itself.
|
|
49
|
-
export declare function isBuildCovered(covered: Membership, tool: BuildTool, root: BuildRoot, opts:
|
|
48
|
+
export declare function isBuildCovered(covered: Membership, tool: BuildTool, root: BuildRoot, opts: RootBuildOptions, own?: Membership | undefined): Promise<boolean>;
|
|
50
49
|
// `tool` orders the entry files of one tool's builds in the same directory.
|
|
51
50
|
export declare function sortByDepthThenPath<T extends BuildRoot>(roots: readonly T[], cwd: string, tool?: BuildTool | undefined): T[];
|
|
52
51
|
// Depth-sorted (root-most first) so the caller visits a reactor root before
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { BuildRoot, Membership } from './discover-manifest-roots.mts';
|
|
2
|
-
import type { RunManifestFactsOutcome } from './run-manifest-facts.mts';
|
|
2
|
+
import type { BuildOptionHints, CommandHints, RunManifestFactsOutcome, SocketFactsContext, SocketFactsRunOptions } from './run-manifest-facts.mts';
|
|
3
3
|
import type { BuildTool } from './scripts/build-tool.mts';
|
|
4
|
-
import type { BuildOption, BuildOptionHints } from './scripts/resolution-report-render.mts';
|
|
5
|
-
import type { SidecarAccumulator } from './scripts/sidecar.mts';
|
|
6
4
|
import type { PURL_Type } from '../../utils/ecosystem.mts';
|
|
7
5
|
import type { SocketJson } from '../../utils/socket-json.mts';
|
|
8
6
|
export type RecursiveManifestOutcomeStatus = 'aborted' | 'empty' | 'failed' | 'generated' | 'skippedCovered' | 'skippedDisabled';
|
|
@@ -25,17 +23,20 @@ export type EcosystemBuildConfig = {
|
|
|
25
23
|
skipReason: string | undefined;
|
|
26
24
|
verbose: boolean;
|
|
27
25
|
};
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
// A failure's remedy is the build root's socket.json, which the dynamic SBOM
|
|
27
|
+
// inference wizard writes.
|
|
28
|
+
export declare function dsiHints(hints: CommandHints, dir: string): BuildOptionHints;
|
|
29
|
+
export declare function socketFactsRunOptions(ecosystem: BuildTool, root: BuildRoot, config: EcosystemBuildConfig, { context, excludeBase, excludePaths, hints }: {
|
|
30
|
+
context?: SocketFactsContext | undefined;
|
|
31
31
|
excludeBase: string | undefined;
|
|
32
32
|
excludePaths: string[] | undefined;
|
|
33
|
-
|
|
34
|
-
};
|
|
33
|
+
hints?: BuildOptionHints | undefined;
|
|
34
|
+
}): SocketFactsRunOptions;
|
|
35
35
|
// Builds `root` unless earlier builds cover it, then adds what it loaded to
|
|
36
36
|
// `covered`.
|
|
37
|
-
export declare function buildUncoveredRoot({ config, covered, cwd, ecosystem, excludeBase, excludePaths, hints, root
|
|
37
|
+
export declare function buildUncoveredRoot({ config, context, covered, cwd, ecosystem, excludeBase, excludePaths, hints, root }: {
|
|
38
38
|
config: EcosystemBuildConfig;
|
|
39
|
+
context?: SocketFactsContext | undefined;
|
|
39
40
|
covered: Membership;
|
|
40
41
|
// Where the build runs, as the user named it; `root.dir` by default.
|
|
41
42
|
cwd?: string | undefined;
|
|
@@ -44,35 +45,20 @@ export declare function buildUncoveredRoot({ config, covered, cwd, ecosystem, ex
|
|
|
44
45
|
excludePaths?: string[] | undefined;
|
|
45
46
|
hints?: BuildOptionHints | undefined;
|
|
46
47
|
root: BuildRoot;
|
|
47
|
-
sidecarAcc?: SidecarAccumulator | undefined;
|
|
48
|
-
tmpDir?: string | undefined;
|
|
49
|
-
withFiles?: boolean | undefined;
|
|
50
48
|
}): Promise<RunManifestFactsOutcome | 'covered'>;
|
|
51
49
|
// A failure fails the walk only when no kept or skipped build loads it.
|
|
52
|
-
export declare function generateRecursiveManifests({ cwd, excludePaths,
|
|
50
|
+
export declare function generateRecursiveManifests({ context, cwd, excludePaths, hints, ignoreUnresolved, purlTypes, verbose }: {
|
|
51
|
+
// Without a work dir, the walk writes into one of its own.
|
|
52
|
+
context?: SocketFactsContext | undefined;
|
|
53
53
|
cwd: string;
|
|
54
54
|
excludePaths?: string[] | undefined;
|
|
55
|
+
// Hints send the options the command takes no flag for to each build root's
|
|
56
|
+
// socket.json.
|
|
57
|
+
hints: CommandHints;
|
|
55
58
|
// When set, overrides every build root's own socket.json setting.
|
|
56
59
|
ignoreUnresolved?: boolean | undefined;
|
|
57
|
-
// Options the invoking command takes as flags; hints send the rest to each
|
|
58
|
-
// build root's socket.json.
|
|
59
|
-
optionFlags?: ReadonlySet<BuildOption> | undefined;
|
|
60
60
|
purlTypes?: readonly PURL_Type[] | undefined;
|
|
61
|
-
// Reachability path only: caller-supplied directory to use as sbt's shared
|
|
62
|
-
// global base across every sbt root in this run. sbt provisions the Scala
|
|
63
|
-
// toolchain under `<base>/boot`, which withFiles' artifactPaths point into,
|
|
64
|
-
// so when the caller intends to consume those paths after this call
|
|
65
|
-
// returns (e.g. reachability analysis), it must supply a directory that
|
|
66
|
-
// outlives this call and delete it once it's done - mirrors
|
|
67
|
-
// ManifestScriptOptions.tmpDir one level up. Unset ⇒ an ephemeral shared
|
|
68
|
-
// dir is allocated and cleaned up before this call returns, matching
|
|
69
|
-
// runManifestFacts' own withFiles-less default.
|
|
70
|
-
sbtTmpDir?: string | undefined;
|
|
71
|
-
// Reachability path only: run build tools with files and fold resolved
|
|
72
|
-
// artifact paths into sidecarAcc, keyed by each root's own factsPath.
|
|
73
|
-
sidecarAcc?: SidecarAccumulator | undefined;
|
|
74
61
|
verbose: boolean;
|
|
75
|
-
withFiles?: boolean | undefined;
|
|
76
62
|
}): Promise<RecursiveManifestOutcome[]>;
|
|
77
63
|
// A wrapper-preferred `bin` default is resolved per-root (`dir`, not `cwd`)
|
|
78
64
|
// since a wrapper script only exists at the actual build root. Exported for
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
import type { GeneratableManifests } from './detect-manifest-actions.mts';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CommandHints, SocketFactsContext } from './run-manifest-facts.mts';
|
|
3
3
|
import type { OutputKind } from '../../types.mts';
|
|
4
4
|
export type GenerateAutoManifestResult = {
|
|
5
5
|
generatedFiles: string[];
|
|
6
|
-
// Reachability path only: resolved on-disk paths from the build-tool run.
|
|
7
|
-
resolvedPathsSidecar?: ResolvedPathsSidecar | undefined;
|
|
8
6
|
};
|
|
9
|
-
export declare function generateAutoManifest({
|
|
10
|
-
|
|
11
|
-
computeArtifactsSidecar?: boolean | undefined;
|
|
7
|
+
export declare function generateAutoManifest({ context, cwd, detected, excludePaths, hints: commandHints, outputKind, verbose }: {
|
|
8
|
+
context?: SocketFactsContext | undefined;
|
|
12
9
|
detected: GeneratableManifests;
|
|
13
10
|
cwd: string;
|
|
14
|
-
// Scan-root-relative `--exclude-paths`: skip excluded subprojects
|
|
15
|
-
// excluded source roots from the resolved-paths sidecar.
|
|
11
|
+
// Scan-root-relative `--exclude-paths`: skip excluded subprojects.
|
|
16
12
|
excludePaths?: string[] | undefined;
|
|
13
|
+
// A failure message must name an option the invoking command accepts.
|
|
14
|
+
hints: CommandHints;
|
|
17
15
|
outputKind: OutputKind;
|
|
18
|
-
// Caller-owned; see ManifestScriptOptions.tmpDir. Only sbt reads it, but
|
|
19
|
-
// required here so every caller allocates one via withTmpDir uniformly.
|
|
20
|
-
tmpDir: string;
|
|
21
16
|
verbose: boolean;
|
|
22
17
|
}): Promise<GenerateAutoManifestResult>;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { BuildTool } from './scripts/build-tool.mts';
|
|
1
|
+
import type { Membership } from './discover-manifest-roots.mts';
|
|
2
|
+
import type { SocketFactsRunOptions } from './run-manifest-facts.mts';
|
|
4
3
|
export type LoadedBuild = {
|
|
5
4
|
membership: Membership;
|
|
6
5
|
// The projects it loads besides its own.
|
|
7
6
|
modules: number;
|
|
8
7
|
};
|
|
9
8
|
// Lets the build tool load a build, resolving nothing, for what it includes.
|
|
10
|
-
export declare function loadBuild(
|
|
11
|
-
config: EcosystemBuildConfig;
|
|
12
|
-
ecosystem: BuildTool;
|
|
13
|
-
excludePaths: string[] | undefined;
|
|
14
|
-
root: BuildRoot;
|
|
15
|
-
scanRoot: string;
|
|
16
|
-
verbose: boolean;
|
|
17
|
-
}): Promise<LoadedBuild | undefined>;
|
|
9
|
+
export declare function loadBuild(options: SocketFactsRunOptions): Promise<LoadedBuild | undefined>;
|
|
18
10
|
// `label`, followed by how many modules it has, when any.
|
|
19
11
|
export declare function withModules(label: string, modules: number): string;
|
|
@@ -1,45 +1,104 @@
|
|
|
1
1
|
import type { BuildTool } from './scripts/build-tool.mts';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export type BuildOption = 'excludeConfigs' | 'ignoreUnresolved' | 'verbose';
|
|
3
|
+
// Where the invoking command lets the user set each build option, so a remedy
|
|
4
|
+
// in Coana's failure report names something they can actually set.
|
|
5
|
+
export type BuildOptionHints = {
|
|
6
|
+
excludePathsFlag?: string | undefined;
|
|
7
|
+
// The invoking command accepts these options as flags. Users set the rest in
|
|
8
|
+
// `socketJson`.
|
|
9
|
+
flags: ReadonlySet<BuildOption>;
|
|
10
|
+
// Wizard that writes `socketJson`.
|
|
11
|
+
setupCommand: string;
|
|
12
|
+
socketJson: string;
|
|
13
|
+
};
|
|
14
|
+
// What the invoking command takes as flags, for every build it generates.
|
|
15
|
+
export type CommandHints = Pick<BuildOptionHints, 'excludePathsFlag' | 'flags'>;
|
|
16
|
+
export declare const DSI_SETUP_COMMAND = "socket manifest setup --dynamic-sbom-inference";
|
|
17
|
+
export declare const EXCLUDE_PATHS_FLAG = "--exclude-paths";
|
|
18
|
+
// For a command that takes `--exclude-paths` and reads its other build options
|
|
19
|
+
// from socket.json.
|
|
20
|
+
export declare const EXCLUDE_PATHS_HINTS: CommandHints;
|
|
21
|
+
// The CLI passes this build root's entry back to Coana unchanged.
|
|
22
|
+
export type SocketFactsSidecarEntry = {
|
|
23
|
+
factsFile: string;
|
|
24
|
+
stateDir: string;
|
|
25
|
+
};
|
|
26
|
+
// A directory socket-cli owns until the Coana run that reads it is done, and
|
|
27
|
+
// the entries of the build roots whose facts were kept.
|
|
28
|
+
export type SocketFactsWorkDir = {
|
|
29
|
+
dir: string;
|
|
30
|
+
// By the facts file Coana places a root's facts at.
|
|
31
|
+
entries: Map<string, SocketFactsSidecarEntry>;
|
|
32
|
+
// What the facts are for, as Coana's `--purpose` takes it: a fix or reachability resolution keeps the state its
|
|
33
|
+
// Coana run reads.
|
|
34
|
+
purpose: SocketFactsPurpose;
|
|
35
|
+
};
|
|
36
|
+
type SocketFactsPurpose = 'upload' | 'fix' | 'reachability';
|
|
37
|
+
export type SocketFactsContext = {
|
|
38
|
+
// The Coana that reads `workDir` must be the one that wrote it.
|
|
39
|
+
coanaVersion?: string | undefined;
|
|
40
|
+
orgSlug?: string | undefined;
|
|
41
|
+
workDir?: SocketFactsWorkDir | undefined;
|
|
42
|
+
};
|
|
43
|
+
// A project the build loaded, with absolute paths. Gradle reports a project's
|
|
44
|
+
// build file even when absent.
|
|
45
|
+
export type SocketFactsProject = {
|
|
46
|
+
buildFiles: string[];
|
|
47
|
+
dir: string;
|
|
48
|
+
};
|
|
5
49
|
export type RunManifestFactsResult = {
|
|
50
|
+
// Where Coana wrote the facts: in the work dir with one, else `targetPath`.
|
|
6
51
|
factsPath: string;
|
|
7
|
-
projects:
|
|
52
|
+
projects: SocketFactsProject[];
|
|
53
|
+
sidecarEntry?: SocketFactsSidecarEntry | undefined;
|
|
54
|
+
targetPath: string;
|
|
8
55
|
};
|
|
9
|
-
// Last N non-empty lines of the captured build output, for diagnosing a crash
|
|
10
|
-
// without forcing a --verbose rebuild.
|
|
11
|
-
export declare function tailBuildOutput(stdout: string, stderr: string): string;
|
|
12
56
|
// `null` = a real failure (crash, missing config, blocking unresolved
|
|
13
57
|
// dependency); `undefined` = genuinely nothing to resolve, not a failure.
|
|
14
|
-
// Distinguishing the two here means callers never have to infer it from
|
|
15
|
-
// `process.exitCode`, which can already be non-zero for an unrelated reason.
|
|
16
58
|
export type RunManifestFactsOutcome = RunManifestFactsResult | null | undefined;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// `sidecarAcc`. A blocking resolution failure sets
|
|
21
|
-
// a non-zero exit code and returns (matching the `--pom` generator) unless
|
|
22
|
-
// `ignoreUnresolved`; a crashed build — a process failure, not an unresolved
|
|
23
|
-
// dependency — always fails.
|
|
24
|
-
export declare function runManifestFacts({ bin, buildOpts, cwd, ecosystem, entryFile, excludeBase, excludeConfigs, excludePaths, hints, ignoreUnresolved, includeConfigs, javaHome, sidecarAcc, tmpDir, verbose, withFiles }: {
|
|
25
|
-
bin: string;
|
|
59
|
+
export declare function coanaReadsFacts(context: SocketFactsContext): boolean;
|
|
60
|
+
export type SocketFactsRequestOptions = {
|
|
61
|
+
bin?: string | undefined;
|
|
26
62
|
buildOpts: string[];
|
|
27
63
|
cwd: string;
|
|
28
64
|
ecosystem: BuildTool;
|
|
29
|
-
//
|
|
65
|
+
// The file in `cwd` to build: Maven's POM (unset leaves Maven's default),
|
|
66
|
+
// dotnet's solution or project (required).
|
|
30
67
|
entryFile?: string | undefined;
|
|
31
|
-
//
|
|
68
|
+
// A build can include modules outside its directory, so exclusions are
|
|
69
|
+
// relative to this base. Defaults to `cwd`.
|
|
32
70
|
excludeBase?: string | undefined;
|
|
33
|
-
excludeConfigs
|
|
71
|
+
excludeConfigs?: string | undefined;
|
|
34
72
|
excludePaths?: string[] | undefined;
|
|
35
|
-
// Where the user sets build options, for remedy hints.
|
|
36
73
|
hints?: BuildOptionHints | undefined;
|
|
37
|
-
ignoreUnresolved
|
|
38
|
-
includeConfigs
|
|
74
|
+
ignoreUnresolved?: boolean | undefined;
|
|
75
|
+
includeConfigs?: string | undefined;
|
|
76
|
+
// As written: Coana expands `$VAR` references itself.
|
|
39
77
|
javaHome?: string | undefined;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
78
|
+
verbose?: boolean | undefined;
|
|
79
|
+
};
|
|
80
|
+
export type SocketFactsRunOptions = SocketFactsRequestOptions & {
|
|
81
|
+
context?: SocketFactsContext | undefined;
|
|
82
|
+
};
|
|
83
|
+
// The work directory must outlive the Coana run that reads it.
|
|
84
|
+
export declare function createSocketFactsWorkDir(dir: string, purpose: SocketFactsPurpose): Promise<SocketFactsWorkDir>;
|
|
85
|
+
// Puts a kept build root's facts where they belong, and keeps its sidecar
|
|
86
|
+
// entry for the Coana run that reads `workDir`.
|
|
87
|
+
export declare function keepFacts(workDir: SocketFactsWorkDir | undefined, { factsPath, sidecarEntry, targetPath }: RunManifestFactsResult): Promise<void>;
|
|
88
|
+
// The projects a dotnet solution builds. Undefined when the SDK cannot read
|
|
89
|
+
// it, so a readable twin may stand in; empty when the listing fails, which the
|
|
90
|
+
// build itself then reports.
|
|
91
|
+
export declare function listDotnetSolutionMembers({ context, ...options }: Omit<SocketFactsRequestOptions, 'ecosystem'> & {
|
|
92
|
+
context?: SocketFactsContext | undefined;
|
|
93
|
+
}): Promise<string[] | undefined>;
|
|
94
|
+
// Lists projects without resolving dependencies.
|
|
95
|
+
// A failed listing reports the reason and returns undefined.
|
|
96
|
+
export declare function listBuildProjects({ context, ...options }: SocketFactsRunOptions): Promise<SocketFactsProject[] | undefined>;
|
|
97
|
+
// Failures set a nonzero exit code. Coana reports build failures.
|
|
98
|
+
// A staged run leaves its facts in the work directory for keepFacts to place.
|
|
99
|
+
export declare function runManifestFacts({ context, staged, ...options }: SocketFactsRunOptions & {
|
|
100
|
+
staged?: boolean | undefined;
|
|
45
101
|
}): Promise<RunManifestFactsOutcome>;
|
|
102
|
+
// What `--socket-facts-sidecar` reads for the kept build roots.
|
|
103
|
+
export declare function socketFactsSidecar(workDir: SocketFactsWorkDir): SocketFactsSidecarEntry[];
|
|
104
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FactsOnlyTypes } from '../../../utils/coana.mts';
|
|
2
2
|
import type { PURL_Type } from '../../../utils/ecosystem.mts';
|
|
3
|
+
import type { BuildRoot } from '../discover-manifest-roots.mts';
|
|
3
4
|
export type BuildTool = 'dotnet' | 'gradle' | 'maven' | 'sbt';
|
|
4
5
|
// The purl type of the packages each tool resolves; exhaustive, so a new tool
|
|
5
6
|
// cannot silently produce another ecosystem's purls.
|
|
@@ -7,6 +8,7 @@ export declare const PURL_TYPE_BY_TOOL: Record<BuildTool, PURL_Type>;
|
|
|
7
8
|
export declare const BUILD_TOOLS: BuildTool[];
|
|
8
9
|
export declare const ECOSYSTEM_LABELS: Record<BuildTool, string>;
|
|
9
10
|
export declare const FACTS_PURL_TYPES: FactsOnlyTypes;
|
|
11
|
+
export declare function buildRootPath(root: BuildRoot): string;
|
|
10
12
|
export declare function buildToolsFor(purlTypes: readonly PURL_Type[]): BuildTool[];
|
|
11
13
|
export declare function buildToolLabelsFor(purlTypes: readonly PURL_Type[]): string[];
|
|
12
14
|
// Purl types whose packages have no namespace (NuGet ids are flat).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Spinner } from '
|
|
1
|
+
import { Spinner } from '../../utils/spinner.mts';
|
|
2
|
+
import type { Logger } from '../../utils/logger.mts';
|
|
2
3
|
import type { EnvDetails } from '../../utils/package-environment.mts';
|
|
3
|
-
import type { Logger } from '@socketsecurity/registry/lib/logger';
|
|
4
4
|
type AddOverridesOptions = {
|
|
5
5
|
logger?: Logger | undefined;
|
|
6
6
|
pin?: boolean | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { EnvDetails } from '../../utils/package-environment.mts';
|
|
2
|
-
export declare function getDependencyEntries(pkgEnvDetails: EnvDetails): [string,
|
|
2
|
+
export declare function getDependencyEntries(pkgEnvDetails: EnvDetails): [string, Record<string, string>][];
|