@socketsecurity/cli-with-sentry 0.15.11 → 0.15.12
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/bin/cli.js +6 -6
- package/dist/.config/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/cli.js +5731 -6607
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +274 -305
- package/dist/constants.js.map +1 -1
- package/dist/instrument-with-sentry.js +28 -34
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/shadow-bin.js +96 -123
- package/dist/shadow-bin.js.map +1 -1
- package/dist/shadow-inject.js +470 -580
- package/dist/shadow-inject.js.map +1 -1
- package/dist/socket-completion.bash +221 -0
- package/dist/types/cli.d.mts +2 -2
- package/dist/types/commands/analytics/cmd-analytics.d.mts +9 -15
- package/dist/types/commands/analytics/fetch-org-analytics.d.mts +4 -6
- package/dist/types/commands/analytics/fetch-repo-analytics.d.mts +4 -7
- package/dist/types/commands/analytics/handle-analytics.d.mts +9 -15
- package/dist/types/commands/analytics/handle-analytics.d.mts.map +1 -1
- package/dist/types/commands/analytics/output-analytics.d.mts +26 -46
- package/dist/types/commands/analytics/output-analytics.d.mts.map +1 -1
- package/dist/types/commands/audit-log/cmd-audit-log.d.mts +9 -15
- package/dist/types/commands/audit-log/fetch-audit-log.d.mts +10 -16
- package/dist/types/commands/audit-log/fetch-audit-log.d.mts.map +1 -1
- package/dist/types/commands/audit-log/handle-audit-log.d.mts +9 -15
- package/dist/types/commands/audit-log/handle-audit-log.d.mts.map +1 -1
- package/dist/types/commands/audit-log/output-audit-log.d.mts +22 -47
- package/dist/types/commands/audit-log/output-audit-log.d.mts.map +1 -1
- package/dist/types/commands/cdxgen/cmd-cdxgen.d.mts +9 -15
- package/dist/types/commands/cdxgen/cmd-cdxgen.d.mts.map +1 -1
- package/dist/types/commands/cdxgen/handle-cdxgen.d.mts +4 -0
- package/dist/types/commands/cdxgen/handle-cdxgen.d.mts.map +1 -0
- package/dist/types/commands/ci/cmd-ci.d.mts +9 -15
- package/dist/types/commands/ci/fetch-default-org-slug.d.mts +3 -3
- package/dist/types/commands/ci/handle-ci.d.mts +2 -2
- package/dist/types/commands/config/cmd-config-auto.d.mts +9 -15
- package/dist/types/commands/config/cmd-config-get.d.mts +9 -15
- package/dist/types/commands/config/cmd-config-list.d.mts +9 -15
- package/dist/types/commands/config/cmd-config-set.d.mts +9 -15
- package/dist/types/commands/config/cmd-config-unset.d.mts +9 -15
- package/dist/types/commands/config/cmd-config.d.mts +3 -3
- package/dist/types/commands/config/discover-config-value.d.mts +3 -5
- package/dist/types/commands/config/discover-config-value.d.mts.map +1 -1
- package/dist/types/commands/config/handle-config-auto.d.mts +7 -10
- package/dist/types/commands/config/handle-config-auto.d.mts.map +1 -1
- package/dist/types/commands/config/handle-config-get.d.mts +7 -10
- package/dist/types/commands/config/handle-config-get.d.mts.map +1 -1
- package/dist/types/commands/config/handle-config-set.d.mts +8 -12
- package/dist/types/commands/config/handle-config-set.d.mts.map +1 -1
- package/dist/types/commands/config/handle-config-unset.d.mts +7 -10
- package/dist/types/commands/config/handle-config-unset.d.mts.map +1 -1
- package/dist/types/commands/config/output-config-auto.d.mts +4 -8
- package/dist/types/commands/config/output-config-get.d.mts +4 -8
- package/dist/types/commands/config/output-config-list.d.mts +6 -9
- package/dist/types/commands/config/output-config-list.d.mts.map +1 -1
- package/dist/types/commands/config/output-config-set.d.mts +3 -6
- package/dist/types/commands/config/output-config-unset.d.mts +3 -6
- package/dist/types/commands/dependencies/cmd-dependencies.d.mts +9 -15
- package/dist/types/commands/dependencies/fetch-dependencies.d.mts +7 -10
- package/dist/types/commands/dependencies/fetch-dependencies.d.mts.map +1 -1
- package/dist/types/commands/dependencies/handle-dependencies.d.mts +7 -11
- package/dist/types/commands/dependencies/handle-dependencies.d.mts.map +1 -1
- package/dist/types/commands/dependencies/output-dependencies.d.mts +8 -15
- package/dist/types/commands/dependencies/output-dependencies.d.mts.map +1 -1
- package/dist/types/commands/diff-scan/cmd-diff-scan-get.d.mts +9 -15
- package/dist/types/commands/diff-scan/cmd-diff-scan.d.mts +3 -3
- package/dist/types/commands/diff-scan/fetch-diff-scan.d.mts +8 -12
- package/dist/types/commands/diff-scan/fetch-diff-scan.d.mts.map +1 -1
- package/dist/types/commands/diff-scan/handle-diff-scan.d.mts +10 -17
- package/dist/types/commands/diff-scan/handle-diff-scan.d.mts.map +1 -1
- package/dist/types/commands/diff-scan/output-diff-scan.d.mts +8 -15
- package/dist/types/commands/diff-scan/output-diff-scan.d.mts.map +1 -1
- package/dist/types/commands/fix/cmd-fix.d.mts +9 -15
- package/dist/types/commands/fix/git.d.mts +14 -49
- package/dist/types/commands/fix/npm-fix.d.mts +4 -16
- package/dist/types/commands/fix/npm-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/open-pr.d.mts +20 -46
- package/dist/types/commands/fix/open-pr.d.mts.map +1 -1
- package/dist/types/commands/fix/pnpm-fix.d.mts +4 -16
- package/dist/types/commands/fix/pnpm-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/run-fix.d.mts +3 -3
- package/dist/types/commands/fix/shared.d.mts +9 -15
- package/dist/types/commands/fix/types.d.mts +16 -16
- package/dist/types/commands/info/cmd-info.d.mts +9 -15
- package/dist/types/commands/info/fetch-package-info.d.mts +3 -7
- package/dist/types/commands/info/handle-package-info.d.mts +15 -22
- package/dist/types/commands/info/handle-package-info.d.mts.map +1 -1
- package/dist/types/commands/info/output-package-info.d.mts +10 -18
- package/dist/types/commands/info/output-package-info.d.mts.map +1 -1
- package/dist/types/commands/install/cmd-install-completion.d.mts +10 -0
- package/dist/types/commands/install/cmd-install-completion.d.mts.map +1 -0
- package/dist/types/commands/install/cmd-install.d.mts +3 -0
- package/dist/types/commands/install/cmd-install.d.mts.map +1 -0
- package/dist/types/commands/install/handle-install-completion.d.mts +2 -0
- package/dist/types/commands/install/handle-install-completion.d.mts.map +1 -0
- package/dist/types/commands/install/output-install-completion.d.mts +12 -0
- package/dist/types/commands/install/output-install-completion.d.mts.map +1 -0
- package/dist/types/commands/install/setup-tab-completion.d.mts +13 -0
- package/dist/types/commands/install/setup-tab-completion.d.mts.map +1 -0
- package/dist/types/commands/login/apply-login.d.mts +2 -7
- package/dist/types/commands/login/attempt-login.d.mts +2 -5
- package/dist/types/commands/login/attempt-login.d.mts.map +1 -1
- package/dist/types/commands/login/cmd-login.d.mts +9 -15
- package/dist/types/commands/logout/apply-logout.d.mts +2 -2
- package/dist/types/commands/logout/attempt-logout.d.mts +2 -2
- package/dist/types/commands/logout/cmd-logout.d.mts +9 -15
- package/dist/types/commands/manifest/cmd-manifest-auto.d.mts +9 -15
- package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts +10 -0
- package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts.map +1 -0
- package/dist/types/commands/manifest/cmd-manifest-conda.d.mts +9 -15
- package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts +9 -15
- package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts +9 -15
- package/dist/types/commands/manifest/cmd-manifest-scala.d.mts +9 -15
- package/dist/types/commands/manifest/cmd-manifest.d.mts +9 -15
- package/dist/types/commands/manifest/cmd-manifest.d.mts.map +1 -1
- package/dist/types/commands/manifest/convert-conda-to-requirements.d.mts +7 -15
- package/dist/types/commands/manifest/convert_gradle_to_maven.d.mts +2 -8
- package/dist/types/commands/manifest/convert_sbt_to_maven.d.mts +2 -8
- package/dist/types/commands/manifest/handle-manifest-conda.d.mts +3 -9
- package/dist/types/commands/manifest/output-requirements.d.mts +6 -10
- package/dist/types/commands/{cdxgen → manifest}/run-cdxgen.d.mts +2 -2
- package/dist/types/commands/manifest/run-cdxgen.d.mts.map +1 -0
- package/dist/types/commands/npm/cmd-npm.d.mts +9 -15
- package/dist/types/commands/npx/cmd-npx.d.mts +9 -15
- package/dist/types/commands/oops/cmd-oops.d.mts +9 -15
- package/dist/types/commands/optimize/add-overrides.d.mts +18 -22
- package/dist/types/commands/optimize/apply-optimization.d.mts +2 -6
- package/dist/types/commands/optimize/cmd-optimize.d.mts +9 -15
- package/dist/types/commands/optimize/deps-includes-by-agent.d.mts +4 -7
- package/dist/types/commands/optimize/get-dependency-entries.d.mts +3 -5
- package/dist/types/commands/optimize/get-overrides-by-agent.d.mts +8 -11
- package/dist/types/commands/optimize/lockfile-includes-by-agent.d.mts +3 -10
- package/dist/types/commands/optimize/ls-by-agent.d.mts +6 -13
- package/dist/types/commands/optimize/shared.d.mts +2 -2
- package/dist/types/commands/optimize/types.d.mts +7 -7
- package/dist/types/commands/optimize/update-lockfile.d.mts +9 -12
- package/dist/types/commands/optimize/update-manifest-by-agent.d.mts +5 -11
- package/dist/types/commands/organization/cmd-organization-list.d.mts +9 -15
- package/dist/types/commands/organization/cmd-organization-policy-license.d.mts +9 -15
- package/dist/types/commands/organization/cmd-organization-policy-security.d.mts +9 -15
- package/dist/types/commands/organization/cmd-organization-policy.d.mts +3 -3
- package/dist/types/commands/organization/cmd-organization-quota.d.mts +9 -15
- package/dist/types/commands/organization/cmd-organization.d.mts +3 -3
- package/dist/types/commands/organization/fetch-license-policy.d.mts +4 -6
- package/dist/types/commands/organization/fetch-organization-list.d.mts +4 -6
- package/dist/types/commands/organization/fetch-quota.d.mts +4 -6
- package/dist/types/commands/organization/fetch-security-policy.d.mts +4 -6
- package/dist/types/commands/organization/handle-license-policy.d.mts +3 -6
- package/dist/types/commands/organization/handle-organization-list.d.mts +3 -5
- package/dist/types/commands/organization/handle-quota.d.mts +3 -3
- package/dist/types/commands/organization/handle-security-policy.d.mts +3 -6
- package/dist/types/commands/organization/output-license-policy.d.mts +4 -7
- package/dist/types/commands/organization/output-organization-list.d.mts +4 -7
- package/dist/types/commands/organization/output-quota.d.mts +4 -7
- package/dist/types/commands/organization/output-security-policy.d.mts +4 -7
- package/dist/types/commands/package/cmd-package-score.d.mts +9 -15
- package/dist/types/commands/package/cmd-package-shallow.d.mts +16 -22
- package/dist/types/commands/package/cmd-package.d.mts +3 -3
- package/dist/types/commands/package/fetch-purl-deep-score.d.mts +49 -51
- package/dist/types/commands/package/fetch-purls-shallow-score.d.mts +4 -6
- package/dist/types/commands/package/handle-purl-deep-score.d.mts +3 -6
- package/dist/types/commands/package/handle-purls-shallow-score.d.mts +6 -9
- package/dist/types/commands/package/handle-purls-shallow-score.d.mts.map +1 -1
- package/dist/types/commands/package/output-purl-score.d.mts +4 -8
- package/dist/types/commands/package/output-purls-shallow-score.d.mts +4 -8
- package/dist/types/commands/package/parse-package-specifiers.d.mts +5 -8
- package/dist/types/commands/raw-npm/cmd-raw-npm.d.mts +9 -15
- package/dist/types/commands/raw-npm/run-raw-npm.d.mts +2 -4
- package/dist/types/commands/raw-npx/cmd-raw-npx.d.mts +9 -15
- package/dist/types/commands/raw-npx/run-raw-npx.d.mts +2 -4
- package/dist/types/commands/report/cmd-report-create.d.mts +9 -15
- package/dist/types/commands/report/cmd-report-view.d.mts +9 -15
- package/dist/types/commands/report/cmd-report.d.mts +3 -3
- package/dist/types/commands/repos/cmd-repos-create.d.mts +9 -15
- package/dist/types/commands/repos/cmd-repos-del.d.mts +9 -15
- package/dist/types/commands/repos/cmd-repos-list.d.mts +9 -15
- package/dist/types/commands/repos/cmd-repos-update.d.mts +9 -15
- package/dist/types/commands/repos/cmd-repos-view.d.mts +9 -15
- package/dist/types/commands/repos/cmd-repos.d.mts +3 -3
- package/dist/types/commands/repos/fetch-create-repo.d.mts +11 -18
- package/dist/types/commands/repos/fetch-create-repo.d.mts.map +1 -1
- package/dist/types/commands/repos/fetch-delete-repo.d.mts +4 -7
- package/dist/types/commands/repos/fetch-list-repos.d.mts +10 -16
- package/dist/types/commands/repos/fetch-list-repos.d.mts.map +1 -1
- package/dist/types/commands/repos/fetch-update-repo.d.mts +11 -18
- package/dist/types/commands/repos/fetch-update-repo.d.mts.map +1 -1
- package/dist/types/commands/repos/fetch-view-repo.d.mts +4 -7
- package/dist/types/commands/repos/handle-create-repo.d.mts +10 -20
- package/dist/types/commands/repos/handle-create-repo.d.mts.map +1 -1
- package/dist/types/commands/repos/handle-delete-repo.d.mts +3 -7
- package/dist/types/commands/repos/handle-list-repos.d.mts +10 -17
- package/dist/types/commands/repos/handle-list-repos.d.mts.map +1 -1
- package/dist/types/commands/repos/handle-update-repo.d.mts +10 -20
- package/dist/types/commands/repos/handle-update-repo.d.mts.map +1 -1
- package/dist/types/commands/repos/handle-view-repo.d.mts +3 -7
- package/dist/types/commands/repos/output-create-repo.d.mts +4 -8
- package/dist/types/commands/repos/output-delete-repo.d.mts +4 -8
- package/dist/types/commands/repos/output-list-repos.d.mts +4 -7
- package/dist/types/commands/repos/output-update-repo.d.mts +4 -8
- package/dist/types/commands/repos/output-view-repo.d.mts +4 -7
- package/dist/types/commands/scan/cmd-scan-create.d.mts +9 -15
- package/dist/types/commands/scan/cmd-scan-del.d.mts +9 -15
- package/dist/types/commands/scan/cmd-scan-diff.d.mts +9 -15
- package/dist/types/commands/scan/cmd-scan-list.d.mts +3 -3
- package/dist/types/commands/scan/cmd-scan-metadata.d.mts +3 -3
- package/dist/types/commands/scan/cmd-scan-report.d.mts +3 -3
- package/dist/types/commands/scan/cmd-scan-view.d.mts +3 -3
- package/dist/types/commands/scan/cmd-scan.d.mts +3 -3
- package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts +11 -26
- package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts.map +1 -1
- package/dist/types/commands/scan/fetch-delete-org-full-scan.d.mts +4 -7
- package/dist/types/commands/scan/fetch-diff-scan.d.mts +8 -12
- package/dist/types/commands/scan/fetch-diff-scan.d.mts.map +1 -1
- package/dist/types/commands/scan/fetch-list-scans.d.mts +13 -22
- package/dist/types/commands/scan/fetch-list-scans.d.mts.map +1 -1
- package/dist/types/commands/scan/fetch-report-data.d.mts +8 -14
- package/dist/types/commands/scan/fetch-scan-metadata.d.mts +4 -7
- package/dist/types/commands/scan/fetch-scan.d.mts +4 -7
- package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts +4 -6
- package/dist/types/commands/scan/generate-report.d.mts +36 -50
- package/dist/types/commands/scan/generate-report.d.mts.map +1 -1
- package/dist/types/commands/scan/handle-create-new-scan.d.mts +20 -37
- package/dist/types/commands/scan/handle-create-new-scan.d.mts.map +1 -1
- package/dist/types/commands/scan/handle-delete-scan.d.mts +3 -7
- package/dist/types/commands/scan/handle-diff-scan.d.mts +10 -17
- package/dist/types/commands/scan/handle-diff-scan.d.mts.map +1 -1
- package/dist/types/commands/scan/handle-list-scans.d.mts +13 -23
- package/dist/types/commands/scan/handle-list-scans.d.mts.map +1 -1
- package/dist/types/commands/scan/handle-scan-metadata.d.mts +3 -7
- package/dist/types/commands/scan/handle-scan-report.d.mts +12 -21
- package/dist/types/commands/scan/handle-scan-report.d.mts.map +1 -1
- package/dist/types/commands/scan/handle-scan-view.d.mts +3 -8
- package/dist/types/commands/scan/output-create-new-scan.d.mts +4 -8
- package/dist/types/commands/scan/output-delete-scan.d.mts +4 -7
- package/dist/types/commands/scan/output-diff-scan.d.mts +8 -15
- package/dist/types/commands/scan/output-diff-scan.d.mts.map +1 -1
- package/dist/types/commands/scan/output-list-scans.d.mts +4 -7
- package/dist/types/commands/scan/output-scan-metadata.d.mts +4 -8
- package/dist/types/commands/scan/output-scan-report.d.mts +20 -38
- package/dist/types/commands/scan/output-scan-report.d.mts.map +1 -1
- package/dist/types/commands/scan/output-scan-view.d.mts +4 -10
- package/dist/types/commands/scan/stream-scan.d.mts +2 -6
- package/dist/types/commands/scan/suggest-org-slug.d.mts +2 -2
- package/dist/types/commands/scan/suggest-repo-slug.d.mts +4 -4
- package/dist/types/commands/scan/suggest_branch_slug.d.mts +2 -4
- package/dist/types/commands/scan/suggest_target.d.mts +2 -2
- package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts +9 -15
- package/dist/types/commands/threat-feed/fetch-threat-feed.d.mts +10 -16
- package/dist/types/commands/threat-feed/fetch-threat-feed.d.mts.map +1 -1
- package/dist/types/commands/threat-feed/handle-threat-feed.d.mts +10 -17
- package/dist/types/commands/threat-feed/handle-threat-feed.d.mts.map +1 -1
- package/dist/types/commands/threat-feed/output-threat-feed.d.mts +4 -7
- package/dist/types/commands/threat-feed/types.d.mts +12 -12
- package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts +9 -0
- package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts.map +1 -0
- package/dist/types/commands/uninstall/cmd-uninstall.d.mts +3 -0
- package/dist/types/commands/uninstall/cmd-uninstall.d.mts.map +1 -0
- package/dist/types/commands/uninstall/handle-uninstall-completion.d.mts +2 -0
- package/dist/types/commands/uninstall/handle-uninstall-completion.d.mts.map +1 -0
- package/dist/types/commands/uninstall/output-uninstall-completion.d.mts +6 -0
- package/dist/types/commands/uninstall/output-uninstall-completion.d.mts.map +1 -0
- package/dist/types/commands/uninstall/teardown-tab-completion.d.mts +6 -0
- package/dist/types/commands/uninstall/teardown-tab-completion.d.mts.map +1 -0
- package/dist/types/commands/wrapper/add-socket-wrapper.d.mts +2 -2
- package/dist/types/commands/wrapper/check-socket-wrapper-setup.d.mts +2 -2
- package/dist/types/commands/wrapper/cmd-wrapper.d.mts +9 -15
- package/dist/types/commands/wrapper/postinstall-wrapper.d.mts +2 -2
- package/dist/types/commands/wrapper/postinstall-wrapper.d.mts.map +1 -1
- package/dist/types/commands/wrapper/remove-socket-wrapper.d.mts +2 -2
- package/dist/types/constants.d.mts +125 -135
- package/dist/types/constants.d.mts.map +1 -1
- package/dist/types/flags.d.mts +14 -17
- package/dist/types/flags.d.mts.map +1 -1
- package/dist/types/instrument-with-sentry.d.mts +2 -2
- package/dist/types/shadow/npm/arborist/index.d.mts +2 -2
- package/dist/types/shadow/npm/arborist/lib/arborist/index.d.mts +19 -24
- package/dist/types/shadow/npm/arborist/lib/arborist/types.d.mts +43 -71
- package/dist/types/shadow/npm/arborist/lib/dep-valid.d.mts +3 -8
- package/dist/types/shadow/npm/arborist/lib/edge.d.mts +58 -71
- package/dist/types/shadow/npm/arborist/lib/node.d.mts +55 -91
- package/dist/types/shadow/npm/arborist/lib/override-set.d.mts +26 -32
- package/dist/types/shadow/npm/arborist-helpers.d.mts +33 -66
- package/dist/types/shadow/npm/arborist-helpers.d.mts.map +1 -1
- package/dist/types/shadow/npm/bin.d.mts +2 -5
- package/dist/types/shadow/npm/inject.d.mts +2 -2
- package/dist/types/shadow/npm/install.d.mts +11 -16
- package/dist/types/shadow/npm/link.d.mts +2 -5
- package/dist/types/shadow/npm/paths.d.mts +7 -7
- package/dist/types/shadow/npm/proc-log/index.d.mts +3 -6
- package/dist/types/types.d.mts +15 -17
- package/dist/types/utils/agent.d.mts +11 -14
- package/dist/types/utils/alert/artifact.d.mts +32 -50
- package/dist/types/utils/alert/fix.d.mts +5 -5
- package/dist/types/utils/alert/severity.d.mts +12 -24
- package/dist/types/utils/alerts-map.d.mts +23 -36
- package/dist/types/utils/api.d.mts +11 -34
- package/dist/types/utils/check-input.d.mts +9 -12
- package/dist/types/utils/cmd.d.mts +4 -4
- package/dist/types/utils/color-or-markdown.d.mts +14 -23
- package/dist/types/utils/color-or-markdown.d.mts.map +1 -1
- package/dist/types/utils/completion.d.mts +11 -0
- package/dist/types/utils/completion.d.mts.map +1 -0
- package/dist/types/utils/config.d.mts +22 -31
- package/dist/types/utils/config.d.mts.map +1 -1
- package/dist/types/utils/determine-org-slug.d.mts +2 -7
- package/dist/types/utils/errors.d.mts +12 -21
- package/dist/types/utils/fail-msg-with-badge.d.mts +2 -5
- package/dist/types/utils/fs.d.mts +21 -52
- package/dist/types/utils/get-output-kind.d.mts +3 -6
- package/dist/types/utils/glob.d.mts +13 -24
- package/dist/types/utils/map-to-object.d.mts +4 -6
- package/dist/types/utils/markdown.d.mts +4 -15
- package/dist/types/utils/meow-with-subcommands.d.mts +34 -46
- package/dist/types/utils/meow-with-subcommands.d.mts.map +1 -1
- package/dist/types/utils/npm-paths.d.mts +7 -7
- package/dist/types/utils/npm-paths.d.mts.map +1 -1
- package/dist/types/utils/objects.d.mts +3 -8
- package/dist/types/utils/output-formatting.d.mts +14 -24
- package/dist/types/utils/package-environment.d.mts +51 -72
- package/dist/types/utils/package-environment.d.mts.map +1 -1
- package/dist/types/utils/path-resolve.d.mts +9 -14
- package/dist/types/utils/pnpm.d.mts +9 -7
- package/dist/types/utils/pnpm.d.mts.map +1 -1
- package/dist/types/utils/sdk.d.mts +8 -12
- package/dist/types/utils/semver.d.mts +5 -17
- package/dist/types/utils/serialize-result-json.d.mts +3 -3
- package/dist/types/utils/socket-package-alert.d.mts +62 -81
- package/dist/types/utils/socket-url.d.mts +9 -15
- package/dist/types/utils/spec.d.mts +4 -7
- package/dist/types/utils/spec.d.mts.map +1 -1
- package/dist/types/utils/strings.d.mts +2 -5
- package/dist/types/utils/translations.d.mts +592 -592
- package/dist/types/utils/walk-nested-map.d.mts +7 -10
- package/dist/utils.js +1531 -1833
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +38333 -51605
- package/dist/vendor.js.map +1 -1
- package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +5 -8
- package/external/@socketsecurity/registry/external/@npmcli/promise-spawn.js +2 -4
- package/external/@socketsecurity/registry/external/cacache.js +1 -2
- package/external/@socketsecurity/registry/external/libnpmpack.js +36 -76
- package/external/@socketsecurity/registry/external/make-fetch-happen.js +31 -67
- package/external/@socketsecurity/registry/external/pacote.js +36 -76
- package/external/@socketsecurity/registry/external/tinyglobby.js +3 -6
- package/external/@socketsecurity/registry/external/which.js +2 -4
- package/external/@socketsecurity/registry/lib/logger.d.ts +3 -1
- package/external/@socketsecurity/registry/lib/logger.js +149 -69
- package/external/@socketsecurity/registry/package.json +2 -2
- package/external/blessed/lib/alias.js +475 -468
- package/external/blessed/lib/blessed.js +12 -12
- package/external/blessed/lib/colors.js +234 -194
- package/external/blessed/lib/events.js +64 -70
- package/external/blessed/lib/gpmclient.js +117 -141
- package/external/blessed/lib/helpers.js +89 -94
- package/external/blessed/lib/keys.js +169 -342
- package/external/blessed/lib/program.js +2130 -2365
- package/external/blessed/lib/tput.js +1183 -1276
- package/external/blessed/lib/unicode.js +400 -522
- package/external/blessed/lib/widget.js +14 -14
- package/external/blessed/lib/widgets/ansiimage.js +90 -96
- package/external/blessed/lib/widgets/bigtext.js +91 -102
- package/external/blessed/lib/widgets/box.js +8 -8
- package/external/blessed/lib/widgets/button.js +23 -23
- package/external/blessed/lib/widgets/checkbox.js +50 -54
- package/external/blessed/lib/widgets/element.js +1415 -1716
- package/external/blessed/lib/widgets/filemanager.js +107 -118
- package/external/blessed/lib/widgets/form.js +144 -178
- package/external/blessed/lib/widgets/image.js +26 -36
- package/external/blessed/lib/widgets/input.js +8 -8
- package/external/blessed/lib/widgets/layout.js +103 -119
- package/external/blessed/lib/widgets/line.js +17 -20
- package/external/blessed/lib/widgets/list.js +349 -402
- package/external/blessed/lib/widgets/listbar.js +265 -306
- package/external/blessed/lib/widgets/listtable.js +133 -146
- package/external/blessed/lib/widgets/loading.js +31 -31
- package/external/blessed/lib/widgets/log.js +41 -40
- package/external/blessed/lib/widgets/message.js +64 -86
- package/external/blessed/lib/widgets/node.js +175 -207
- package/external/blessed/lib/widgets/overlayimage.js +360 -437
- package/external/blessed/lib/widgets/progressbar.js +79 -88
- package/external/blessed/lib/widgets/prompt.js +54 -61
- package/external/blessed/lib/widgets/question.js +48 -61
- package/external/blessed/lib/widgets/radiobutton.js +26 -27
- package/external/blessed/lib/widgets/radioset.js +8 -8
- package/external/blessed/lib/widgets/screen.js +1186 -1375
- package/external/blessed/lib/widgets/scrollablebox.js +202 -228
- package/external/blessed/lib/widgets/scrollabletext.js +9 -9
- package/external/blessed/lib/widgets/table.js +187 -216
- package/external/blessed/lib/widgets/terminal.js +258 -298
- package/external/blessed/lib/widgets/text.js +9 -9
- package/external/blessed/lib/widgets/textarea.js +188 -222
- package/external/blessed/lib/widgets/textbox.js +34 -36
- package/external/blessed/lib/widgets/video.js +55 -59
- package/external/blessed/usr/fonts/ter-u14b.json +1 -1
- package/external/blessed/usr/fonts/ter-u14n.json +1 -1
- package/external/blessed/vendor/tng.js +1016 -1144
- package/external/blessed-contrib/lib/layout/grid.js +345 -377
- package/external/blessed-contrib/lib/widget/charts/bar.js +6612 -7139
- package/external/blessed-contrib/lib/widget/charts/line.js +16224 -23941
- package/external/blessed-contrib/lib/widget/table.js +78 -96
- package/package.json +8 -8
- package/dist/types/commands/cdxgen/run-cdxgen.d.mts.map +0 -1
package/dist/shadow-inject.js
CHANGED
|
@@ -1,141 +1,116 @@
|
|
|
1
|
-
'use strict'
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
var Module = require('node:module');
|
|
4
|
+
var path = require('node:path');
|
|
5
|
+
var path$1 = require('../external/@socketsecurity/registry/lib/path');
|
|
6
|
+
var constants = require('./constants.js');
|
|
7
|
+
var utils = require('./utils.js');
|
|
8
|
+
var logger = require('../external/@socketsecurity/registry/lib/logger');
|
|
9
|
+
var vendor = require('./vendor.js');
|
|
10
|
+
var registry = require('../external/@socketsecurity/registry');
|
|
11
|
+
var objects = require('../external/@socketsecurity/registry/lib/objects');
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
typeof document !== 'undefined' ? document.currentScript : null
|
|
13
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
15
14
|
const DiffAction = utils.createEnum({
|
|
16
15
|
add: 'ADD',
|
|
17
16
|
change: 'CHANGE',
|
|
18
17
|
remove: 'REMOVE'
|
|
19
|
-
})
|
|
18
|
+
});
|
|
20
19
|
|
|
21
|
-
let _arboristPkgPath
|
|
20
|
+
let _arboristPkgPath;
|
|
22
21
|
function getArboristPackagePath() {
|
|
23
22
|
if (_arboristPkgPath === undefined) {
|
|
24
|
-
const pkgName = '@npmcli/arborist'
|
|
25
|
-
const mainPathWithForwardSlashes = path$1.normalizePath(
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
const arboristPkgPathWithForwardSlashes = mainPathWithForwardSlashes.slice(
|
|
29
|
-
0,
|
|
30
|
-
mainPathWithForwardSlashes.lastIndexOf(pkgName) + pkgName.length
|
|
31
|
-
)
|
|
23
|
+
const pkgName = '@npmcli/arborist';
|
|
24
|
+
const mainPathWithForwardSlashes = path$1.normalizePath(utils.getNpmRequire().resolve(pkgName));
|
|
25
|
+
const arboristPkgPathWithForwardSlashes = mainPathWithForwardSlashes.slice(0, mainPathWithForwardSlashes.lastIndexOf(pkgName) + pkgName.length);
|
|
32
26
|
// Lazily access constants.WIN32.
|
|
33
|
-
_arboristPkgPath = constants.WIN32
|
|
34
|
-
? path.normalize(arboristPkgPathWithForwardSlashes)
|
|
35
|
-
: arboristPkgPathWithForwardSlashes
|
|
27
|
+
_arboristPkgPath = constants.WIN32 ? path.normalize(arboristPkgPathWithForwardSlashes) : arboristPkgPathWithForwardSlashes;
|
|
36
28
|
}
|
|
37
|
-
return _arboristPkgPath
|
|
29
|
+
return _arboristPkgPath;
|
|
38
30
|
}
|
|
39
|
-
let _arboristClassPath
|
|
31
|
+
let _arboristClassPath;
|
|
40
32
|
function getArboristClassPath() {
|
|
41
33
|
if (_arboristClassPath === undefined) {
|
|
42
|
-
_arboristClassPath = path.join(
|
|
43
|
-
getArboristPackagePath(),
|
|
44
|
-
'lib/arborist/index.js'
|
|
45
|
-
)
|
|
34
|
+
_arboristClassPath = path.join(getArboristPackagePath(), 'lib/arborist/index.js');
|
|
46
35
|
}
|
|
47
|
-
return _arboristClassPath
|
|
36
|
+
return _arboristClassPath;
|
|
48
37
|
}
|
|
49
|
-
let _arboristDepValidPath
|
|
38
|
+
let _arboristDepValidPath;
|
|
50
39
|
function getArboristDepValidPath() {
|
|
51
40
|
if (_arboristDepValidPath === undefined) {
|
|
52
|
-
_arboristDepValidPath = path.join(
|
|
53
|
-
getArboristPackagePath(),
|
|
54
|
-
'lib/dep-valid.js'
|
|
55
|
-
)
|
|
41
|
+
_arboristDepValidPath = path.join(getArboristPackagePath(), 'lib/dep-valid.js');
|
|
56
42
|
}
|
|
57
|
-
return _arboristDepValidPath
|
|
43
|
+
return _arboristDepValidPath;
|
|
58
44
|
}
|
|
59
|
-
let _arboristEdgeClassPath
|
|
45
|
+
let _arboristEdgeClassPath;
|
|
60
46
|
function getArboristEdgeClassPath() {
|
|
61
47
|
if (_arboristEdgeClassPath === undefined) {
|
|
62
|
-
_arboristEdgeClassPath = path.join(getArboristPackagePath(), 'lib/edge.js')
|
|
48
|
+
_arboristEdgeClassPath = path.join(getArboristPackagePath(), 'lib/edge.js');
|
|
63
49
|
}
|
|
64
|
-
return _arboristEdgeClassPath
|
|
50
|
+
return _arboristEdgeClassPath;
|
|
65
51
|
}
|
|
66
|
-
let _arboristNodeClassPath
|
|
52
|
+
let _arboristNodeClassPath;
|
|
67
53
|
function getArboristNodeClassPath() {
|
|
68
54
|
if (_arboristNodeClassPath === undefined) {
|
|
69
|
-
_arboristNodeClassPath = path.join(getArboristPackagePath(), 'lib/node.js')
|
|
55
|
+
_arboristNodeClassPath = path.join(getArboristPackagePath(), 'lib/node.js');
|
|
70
56
|
}
|
|
71
|
-
return _arboristNodeClassPath
|
|
57
|
+
return _arboristNodeClassPath;
|
|
72
58
|
}
|
|
73
|
-
let _arboristOverrideSetClassPath
|
|
59
|
+
let _arboristOverrideSetClassPath;
|
|
74
60
|
function getArboristOverrideSetClassPath() {
|
|
75
61
|
if (_arboristOverrideSetClassPath === undefined) {
|
|
76
|
-
_arboristOverrideSetClassPath = path.join(
|
|
77
|
-
getArboristPackagePath(),
|
|
78
|
-
'lib/override-set.js'
|
|
79
|
-
)
|
|
62
|
+
_arboristOverrideSetClassPath = path.join(getArboristPackagePath(), 'lib/override-set.js');
|
|
80
63
|
}
|
|
81
|
-
return _arboristOverrideSetClassPath
|
|
64
|
+
return _arboristOverrideSetClassPath;
|
|
82
65
|
}
|
|
83
66
|
|
|
84
|
-
const require$6 =
|
|
85
|
-
|
|
86
|
-
)
|
|
87
|
-
let _depValid
|
|
67
|
+
const require$6 =Module.createRequire(require('u' + 'rl').pathToFileURL(__filename).href)
|
|
68
|
+
let _depValid;
|
|
88
69
|
function depValid(child, requested, accept, requester) {
|
|
89
70
|
if (_depValid === undefined) {
|
|
90
|
-
_depValid = require$6(getArboristDepValidPath())
|
|
71
|
+
_depValid = require$6(getArboristDepValidPath());
|
|
91
72
|
}
|
|
92
|
-
return _depValid(child, requested, accept, requester)
|
|
73
|
+
return _depValid(child, requested, accept, requester);
|
|
93
74
|
}
|
|
94
75
|
|
|
95
|
-
const {
|
|
76
|
+
const {
|
|
77
|
+
UNDEFINED_TOKEN
|
|
78
|
+
} = constants;
|
|
96
79
|
function tryRequire(req, ...ids) {
|
|
97
80
|
for (const data of ids) {
|
|
98
|
-
let id
|
|
99
|
-
let transformer
|
|
81
|
+
let id;
|
|
82
|
+
let transformer;
|
|
100
83
|
if (Array.isArray(data)) {
|
|
101
|
-
id = data[0]
|
|
102
|
-
transformer = data[1]
|
|
84
|
+
id = data[0];
|
|
85
|
+
transformer = data[1];
|
|
103
86
|
} else {
|
|
104
|
-
id = data
|
|
105
|
-
transformer = mod => mod
|
|
87
|
+
id = data;
|
|
88
|
+
transformer = mod => mod;
|
|
106
89
|
}
|
|
107
90
|
try {
|
|
108
91
|
// Check that the transformed value isn't `undefined` because older
|
|
109
92
|
// versions of packages like 'proc-log' may not export a `log` method.
|
|
110
|
-
const exported = transformer(req(id))
|
|
93
|
+
const exported = transformer(req(id));
|
|
111
94
|
if (exported !== undefined) {
|
|
112
|
-
return exported
|
|
95
|
+
return exported;
|
|
113
96
|
}
|
|
114
97
|
} catch {}
|
|
115
98
|
}
|
|
116
|
-
return undefined
|
|
99
|
+
return undefined;
|
|
117
100
|
}
|
|
118
|
-
let _log = UNDEFINED_TOKEN
|
|
101
|
+
let _log = UNDEFINED_TOKEN;
|
|
119
102
|
function getLogger() {
|
|
120
103
|
if (_log === UNDEFINED_TOKEN) {
|
|
121
|
-
_log = tryRequire(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
// The proc-log DefinitelyTyped definition is incorrect. The type definition
|
|
126
|
-
// is really that of its export log.
|
|
127
|
-
mod => mod.log
|
|
128
|
-
],
|
|
129
|
-
'npmlog/lib/log.js'
|
|
130
|
-
)
|
|
104
|
+
_log = tryRequire(utils.getNpmRequire(), ['proc-log/lib/index.js',
|
|
105
|
+
// The proc-log DefinitelyTyped definition is incorrect. The type definition
|
|
106
|
+
// is really that of its export log.
|
|
107
|
+
mod => mod.log], 'npmlog/lib/log.js');
|
|
131
108
|
}
|
|
132
|
-
return _log
|
|
109
|
+
return _log;
|
|
133
110
|
}
|
|
134
111
|
|
|
135
|
-
const require$5 =
|
|
136
|
-
|
|
137
|
-
)
|
|
138
|
-
const OverrideSet = require$5(getArboristOverrideSetClassPath())
|
|
112
|
+
const require$5 =Module.createRequire(require('u' + 'rl').pathToFileURL(__filename).href)
|
|
113
|
+
const OverrideSet = require$5(getArboristOverrideSetClassPath());
|
|
139
114
|
|
|
140
115
|
// Implementation code not related to patch https://github.com/npm/cli/pull/8089
|
|
141
116
|
// is based on https://github.com/npm/cli/blob/v11.0.0/workspaces/arborist/lib/override-set.js:
|
|
@@ -146,64 +121,59 @@ class SafeOverrideSet extends OverrideSet {
|
|
|
146
121
|
// If override sets contain one another then we can try to use the more
|
|
147
122
|
// specific one. If neither one is more specific, then we consider them to
|
|
148
123
|
// be in conflict.
|
|
149
|
-
return this.findSpecificOverrideSet(first, second) === undefined
|
|
124
|
+
return this.findSpecificOverrideSet(first, second) === undefined;
|
|
150
125
|
}
|
|
151
126
|
|
|
152
127
|
// Patch adding findSpecificOverrideSet is based on
|
|
153
128
|
// https://github.com/npm/cli/pull/8089.
|
|
154
129
|
static findSpecificOverrideSet(first, second) {
|
|
155
|
-
for (
|
|
156
|
-
let overrideSet = second;
|
|
157
|
-
overrideSet;
|
|
158
|
-
overrideSet = overrideSet.parent
|
|
159
|
-
) {
|
|
130
|
+
for (let overrideSet = second; overrideSet; overrideSet = overrideSet.parent) {
|
|
160
131
|
if (overrideSet.isEqual(first)) {
|
|
161
|
-
return second
|
|
132
|
+
return second;
|
|
162
133
|
}
|
|
163
134
|
}
|
|
164
|
-
for (
|
|
165
|
-
let overrideSet = first;
|
|
166
|
-
overrideSet;
|
|
167
|
-
overrideSet = overrideSet.parent
|
|
168
|
-
) {
|
|
135
|
+
for (let overrideSet = first; overrideSet; overrideSet = overrideSet.parent) {
|
|
169
136
|
if (overrideSet.isEqual(second)) {
|
|
170
|
-
return first
|
|
137
|
+
return first;
|
|
171
138
|
}
|
|
172
139
|
}
|
|
173
140
|
// The override sets are incomparable. Neither one contains the other.
|
|
174
|
-
const log = getLogger()
|
|
175
|
-
log?.silly('Conflicting override sets', first, second)
|
|
176
|
-
return undefined
|
|
141
|
+
const log = getLogger();
|
|
142
|
+
log?.silly('Conflicting override sets', first, second);
|
|
143
|
+
return undefined;
|
|
177
144
|
}
|
|
178
145
|
|
|
179
146
|
// Patch adding childrenAreEqual is based on
|
|
180
147
|
// https://github.com/npm/cli/pull/8089.
|
|
181
148
|
childrenAreEqual(otherOverrideSet) {
|
|
182
149
|
if (this.children.size !== otherOverrideSet.children.size) {
|
|
183
|
-
return false
|
|
150
|
+
return false;
|
|
184
151
|
}
|
|
185
|
-
for (const {
|
|
186
|
-
|
|
152
|
+
for (const {
|
|
153
|
+
0: key,
|
|
154
|
+
1: childOverrideSet
|
|
155
|
+
} of this.children) {
|
|
156
|
+
const otherChildOverrideSet = otherOverrideSet.children.get(key);
|
|
187
157
|
if (!otherChildOverrideSet) {
|
|
188
|
-
return false
|
|
158
|
+
return false;
|
|
189
159
|
}
|
|
190
160
|
if (childOverrideSet.value !== otherChildOverrideSet.value) {
|
|
191
|
-
return false
|
|
161
|
+
return false;
|
|
192
162
|
}
|
|
193
163
|
if (!childOverrideSet.childrenAreEqual(otherChildOverrideSet)) {
|
|
194
|
-
return false
|
|
164
|
+
return false;
|
|
195
165
|
}
|
|
196
166
|
}
|
|
197
|
-
return true
|
|
167
|
+
return true;
|
|
198
168
|
}
|
|
199
169
|
getEdgeRule(edge) {
|
|
200
170
|
for (const rule of this.ruleset.values()) {
|
|
201
171
|
if (rule.name !== edge.name) {
|
|
202
|
-
continue
|
|
172
|
+
continue;
|
|
203
173
|
}
|
|
204
174
|
// If keySpec is * we found our override.
|
|
205
175
|
if (rule.keySpec === '*') {
|
|
206
|
-
return rule
|
|
176
|
+
return rule;
|
|
207
177
|
}
|
|
208
178
|
// Patch replacing
|
|
209
179
|
// let spec = npa(`${edge.name}@${edge.spec}`)
|
|
@@ -212,62 +182,54 @@ class SafeOverrideSet extends OverrideSet {
|
|
|
212
182
|
// We need to use the rawSpec here, because the spec has the overrides
|
|
213
183
|
// applied to it already. The rawSpec can be undefined, so we need to use
|
|
214
184
|
// the fallback value of spec if it is.
|
|
215
|
-
let spec = vendor.npaExports(`${edge.name}@${edge.rawSpec || edge.spec}`)
|
|
185
|
+
let spec = vendor.npaExports(`${edge.name}@${edge.rawSpec || edge.spec}`);
|
|
216
186
|
if (spec.type === 'alias') {
|
|
217
|
-
spec = spec.subSpec
|
|
187
|
+
spec = spec.subSpec;
|
|
218
188
|
}
|
|
219
189
|
if (spec.type === 'git') {
|
|
220
|
-
if (
|
|
221
|
-
|
|
222
|
-
vendor.semverExports.intersects(spec.gitRange, rule.keySpec)
|
|
223
|
-
) {
|
|
224
|
-
return rule
|
|
190
|
+
if (spec.gitRange && vendor.semverExports.intersects(spec.gitRange, rule.keySpec)) {
|
|
191
|
+
return rule;
|
|
225
192
|
}
|
|
226
|
-
continue
|
|
193
|
+
continue;
|
|
227
194
|
}
|
|
228
195
|
if (spec.type === 'range' || spec.type === 'version') {
|
|
229
196
|
if (vendor.semverExports.intersects(spec.fetchSpec, rule.keySpec)) {
|
|
230
|
-
return rule
|
|
197
|
+
return rule;
|
|
231
198
|
}
|
|
232
|
-
continue
|
|
199
|
+
continue;
|
|
233
200
|
}
|
|
234
201
|
// If we got this far, the spec type is one of tag, directory or file
|
|
235
202
|
// which means we have no real way to make version comparisons, so we
|
|
236
203
|
// just accept the override.
|
|
237
|
-
return rule
|
|
204
|
+
return rule;
|
|
238
205
|
}
|
|
239
|
-
return this
|
|
206
|
+
return this;
|
|
240
207
|
}
|
|
241
208
|
|
|
242
209
|
// Patch adding isEqual is based on
|
|
243
210
|
// https://github.com/npm/cli/pull/8089.
|
|
244
211
|
isEqual(otherOverrideSet) {
|
|
245
212
|
if (this === otherOverrideSet) {
|
|
246
|
-
return true
|
|
213
|
+
return true;
|
|
247
214
|
}
|
|
248
215
|
if (!otherOverrideSet) {
|
|
249
|
-
return false
|
|
216
|
+
return false;
|
|
250
217
|
}
|
|
251
|
-
if (
|
|
252
|
-
|
|
253
|
-
this.value !== otherOverrideSet.value
|
|
254
|
-
) {
|
|
255
|
-
return false
|
|
218
|
+
if (this.key !== otherOverrideSet.key || this.value !== otherOverrideSet.value) {
|
|
219
|
+
return false;
|
|
256
220
|
}
|
|
257
221
|
if (!this.childrenAreEqual(otherOverrideSet)) {
|
|
258
|
-
return false
|
|
222
|
+
return false;
|
|
259
223
|
}
|
|
260
224
|
if (!this.parent) {
|
|
261
|
-
return !otherOverrideSet.parent
|
|
225
|
+
return !otherOverrideSet.parent;
|
|
262
226
|
}
|
|
263
|
-
return this.parent.isEqual(otherOverrideSet.parent)
|
|
227
|
+
return this.parent.isEqual(otherOverrideSet.parent);
|
|
264
228
|
}
|
|
265
229
|
}
|
|
266
230
|
|
|
267
|
-
const require$4 =
|
|
268
|
-
|
|
269
|
-
)
|
|
270
|
-
const Node = require$4(getArboristNodeClassPath())
|
|
231
|
+
const require$4 =Module.createRequire(require('u' + 'rl').pathToFileURL(__filename).href)
|
|
232
|
+
const Node = require$4(getArboristNodeClassPath());
|
|
271
233
|
|
|
272
234
|
// Implementation code not related to patch https://github.com/npm/cli/pull/8089
|
|
273
235
|
// is based on https://github.com/npm/cli/blob/v11.0.0/workspaces/arborist/lib/node.js:
|
|
@@ -278,28 +240,28 @@ class SafeNode extends Node {
|
|
|
278
240
|
canDedupe(preferDedupe = false) {
|
|
279
241
|
// Not allowed to mess with shrinkwraps or bundles.
|
|
280
242
|
if (this.inDepBundle || this.inShrinkwrap) {
|
|
281
|
-
return false
|
|
243
|
+
return false;
|
|
282
244
|
}
|
|
283
245
|
// It's a top level pkg, or a dep of one.
|
|
284
246
|
if (!this.resolveParent?.resolveParent) {
|
|
285
|
-
return false
|
|
247
|
+
return false;
|
|
286
248
|
}
|
|
287
249
|
// No one wants it, remove it.
|
|
288
250
|
if (this.edgesIn.size === 0) {
|
|
289
|
-
return true
|
|
251
|
+
return true;
|
|
290
252
|
}
|
|
291
|
-
const other = this.resolveParent.resolveParent.resolve(this.name)
|
|
253
|
+
const other = this.resolveParent.resolveParent.resolve(this.name);
|
|
292
254
|
// Nothing else, need this one.
|
|
293
255
|
if (!other) {
|
|
294
|
-
return false
|
|
256
|
+
return false;
|
|
295
257
|
}
|
|
296
258
|
// If it's the same thing, then always fine to remove.
|
|
297
259
|
if (other.matches(this)) {
|
|
298
|
-
return true
|
|
260
|
+
return true;
|
|
299
261
|
}
|
|
300
262
|
// If the other thing can't replace this, then skip it.
|
|
301
263
|
if (!other.canReplace(this)) {
|
|
302
|
-
return false
|
|
264
|
+
return false;
|
|
303
265
|
}
|
|
304
266
|
// Patch replacing
|
|
305
267
|
// if (preferDedupe || semver.gte(other.version, this.version)) {
|
|
@@ -309,17 +271,14 @@ class SafeNode extends Node {
|
|
|
309
271
|
//
|
|
310
272
|
// If we prefer dedupe, or if the version is equal, take the other.
|
|
311
273
|
if (preferDedupe || vendor.semverExports.eq(other.version, this.version)) {
|
|
312
|
-
return true
|
|
274
|
+
return true;
|
|
313
275
|
}
|
|
314
276
|
// If our current version isn't the result of an override, then prefer to
|
|
315
277
|
// take the greater version.
|
|
316
|
-
if (
|
|
317
|
-
|
|
318
|
-
vendor.semverExports.gt(other.version, this.version)
|
|
319
|
-
) {
|
|
320
|
-
return true
|
|
278
|
+
if (!this.overridden && vendor.semverExports.gt(other.version, this.version)) {
|
|
279
|
+
return true;
|
|
321
280
|
}
|
|
322
|
-
return false
|
|
281
|
+
return false;
|
|
323
282
|
}
|
|
324
283
|
|
|
325
284
|
// Is it safe to replace one node with another? check the edges to
|
|
@@ -333,7 +292,7 @@ class SafeNode extends Node {
|
|
|
333
292
|
// it with more tree construction, because it's a user request.
|
|
334
293
|
canReplaceWith(node, ignorePeers) {
|
|
335
294
|
if (this.name !== node.name || this.packageName !== node.packageName) {
|
|
336
|
-
return false
|
|
295
|
+
return false;
|
|
337
296
|
}
|
|
338
297
|
// Patch replacing
|
|
339
298
|
// if (node.overrides !== this.overrides) {
|
|
@@ -347,11 +306,11 @@ class SafeNode extends Node {
|
|
|
347
306
|
// XXX need to check for two root nodes?
|
|
348
307
|
if (node.overrides) {
|
|
349
308
|
if (!node.overrides.isEqual(this.overrides)) {
|
|
350
|
-
return false
|
|
309
|
+
return false;
|
|
351
310
|
}
|
|
352
311
|
} else {
|
|
353
312
|
if (this.overrides) {
|
|
354
|
-
return false
|
|
313
|
+
return false;
|
|
355
314
|
}
|
|
356
315
|
}
|
|
357
316
|
}
|
|
@@ -359,27 +318,29 @@ class SafeNode extends Node {
|
|
|
359
318
|
// so that the condition we want to replace,
|
|
360
319
|
// if (this.overrides !== node.overrides) {
|
|
361
320
|
// , is not hit.`
|
|
362
|
-
const oldOverrideSet = this.overrides
|
|
363
|
-
let result = true
|
|
321
|
+
const oldOverrideSet = this.overrides;
|
|
322
|
+
let result = true;
|
|
364
323
|
if (oldOverrideSet !== node.overrides) {
|
|
365
|
-
this.overrides = node.overrides
|
|
324
|
+
this.overrides = node.overrides;
|
|
366
325
|
}
|
|
367
326
|
try {
|
|
368
|
-
result = super.canReplaceWith(node, ignorePeers)
|
|
369
|
-
this.overrides = oldOverrideSet
|
|
327
|
+
result = super.canReplaceWith(node, ignorePeers);
|
|
328
|
+
this.overrides = oldOverrideSet;
|
|
370
329
|
} catch (e) {
|
|
371
|
-
this.overrides = oldOverrideSet
|
|
372
|
-
throw e
|
|
330
|
+
this.overrides = oldOverrideSet;
|
|
331
|
+
throw e;
|
|
373
332
|
}
|
|
374
|
-
return result
|
|
333
|
+
return result;
|
|
375
334
|
}
|
|
376
335
|
|
|
377
336
|
// Patch adding deleteEdgeIn is based on https://github.com/npm/cli/pull/8089.
|
|
378
337
|
deleteEdgeIn(edge) {
|
|
379
|
-
this.edgesIn.delete(edge)
|
|
380
|
-
const {
|
|
338
|
+
this.edgesIn.delete(edge);
|
|
339
|
+
const {
|
|
340
|
+
overrides
|
|
341
|
+
} = edge;
|
|
381
342
|
if (overrides) {
|
|
382
|
-
this.updateOverridesEdgeInRemoved(overrides)
|
|
343
|
+
this.updateOverridesEdgeInRemoved(overrides);
|
|
383
344
|
}
|
|
384
345
|
}
|
|
385
346
|
addEdgeIn(edge) {
|
|
@@ -392,11 +353,11 @@ class SafeNode extends Node {
|
|
|
392
353
|
// We need to handle the case where the new edge in has an overrides field
|
|
393
354
|
// which is different from the current value.
|
|
394
355
|
if (!this.overrides || !this.overrides.isEqual(edge.overrides)) {
|
|
395
|
-
this.updateOverridesEdgeInAdded(edge.overrides)
|
|
356
|
+
this.updateOverridesEdgeInAdded(edge.overrides);
|
|
396
357
|
}
|
|
397
|
-
this.edgesIn.add(edge)
|
|
358
|
+
this.edgesIn.add(edge);
|
|
398
359
|
// Try to get metadata from the yarn.lock file.
|
|
399
|
-
this.root.meta?.addEdge(edge)
|
|
360
|
+
this.root.meta?.addEdge(edge);
|
|
400
361
|
}
|
|
401
362
|
|
|
402
363
|
// @ts-ignore: Incorrectly typed as a property instead of an accessor.
|
|
@@ -404,12 +365,8 @@ class SafeNode extends Node {
|
|
|
404
365
|
// Patch replacing
|
|
405
366
|
// return !!(this.overrides && this.overrides.value && this.overrides.name === this.name)
|
|
406
367
|
// is based on https://github.com/npm/cli/pull/8089.
|
|
407
|
-
if (
|
|
408
|
-
|
|
409
|
-
!this.overrides.value ||
|
|
410
|
-
this.overrides.name !== this.name
|
|
411
|
-
) {
|
|
412
|
-
return false
|
|
368
|
+
if (!this.overrides || !this.overrides.value || this.overrides.name !== this.name) {
|
|
369
|
+
return false;
|
|
413
370
|
}
|
|
414
371
|
// The overrides rule is for a package with this name, but some override
|
|
415
372
|
// rules only apply to specific versions. To make sure this package was
|
|
@@ -417,17 +374,13 @@ class SafeNode extends Node {
|
|
|
417
374
|
// applied to it, in which case its overrides set is different than its
|
|
418
375
|
// source node.
|
|
419
376
|
for (const edge of this.edgesIn) {
|
|
420
|
-
if (
|
|
421
|
-
edge.overrides &&
|
|
422
|
-
edge.overrides.name === this.name &&
|
|
423
|
-
edge.overrides.value === this.version
|
|
424
|
-
) {
|
|
377
|
+
if (edge.overrides && edge.overrides.name === this.name && edge.overrides.value === this.version) {
|
|
425
378
|
if (!edge.overrides.isEqual(edge.from?.overrides)) {
|
|
426
|
-
return true
|
|
379
|
+
return true;
|
|
427
380
|
}
|
|
428
381
|
}
|
|
429
382
|
}
|
|
430
|
-
return false
|
|
383
|
+
return false;
|
|
431
384
|
}
|
|
432
385
|
set parent(newParent) {
|
|
433
386
|
// Patch removing
|
|
@@ -439,16 +392,18 @@ class SafeNode extends Node {
|
|
|
439
392
|
// The "parent" setter is a really large and complex function. To satisfy
|
|
440
393
|
// the patch we hold on to the old overrides value and set `this.overrides`
|
|
441
394
|
// to `undefined` so that the condition we want to remove is not hit.
|
|
442
|
-
const {
|
|
395
|
+
const {
|
|
396
|
+
overrides
|
|
397
|
+
} = this;
|
|
443
398
|
if (overrides) {
|
|
444
|
-
this.overrides = undefined
|
|
399
|
+
this.overrides = undefined;
|
|
445
400
|
}
|
|
446
401
|
try {
|
|
447
|
-
super.parent = newParent
|
|
448
|
-
this.overrides = overrides
|
|
402
|
+
super.parent = newParent;
|
|
403
|
+
this.overrides = overrides;
|
|
449
404
|
} catch (e) {
|
|
450
|
-
this.overrides = overrides
|
|
451
|
-
throw e
|
|
405
|
+
this.overrides = overrides;
|
|
406
|
+
throw e;
|
|
452
407
|
}
|
|
453
408
|
}
|
|
454
409
|
|
|
@@ -457,9 +412,9 @@ class SafeNode extends Node {
|
|
|
457
412
|
recalculateOutEdgesOverrides() {
|
|
458
413
|
// For each edge out propagate the new overrides through.
|
|
459
414
|
for (const edge of this.edgesOut.values()) {
|
|
460
|
-
edge.reload(true)
|
|
415
|
+
edge.reload(true);
|
|
461
416
|
if (edge.to) {
|
|
462
|
-
edge.to.updateOverridesEdgeInAdded(edge.overrides)
|
|
417
|
+
edge.to.updateOverridesEdgeInAdded(edge.overrides);
|
|
463
418
|
}
|
|
464
419
|
}
|
|
465
420
|
}
|
|
@@ -478,14 +433,14 @@ class SafeNode extends Node {
|
|
|
478
433
|
if (!this.overrides) {
|
|
479
434
|
this.overrides = new SafeOverrideSet({
|
|
480
435
|
overrides: ''
|
|
481
|
-
})
|
|
436
|
+
});
|
|
482
437
|
}
|
|
483
438
|
try {
|
|
484
|
-
super.root = newRoot
|
|
485
|
-
this.overrides = undefined
|
|
439
|
+
super.root = newRoot;
|
|
440
|
+
this.overrides = undefined;
|
|
486
441
|
} catch (e) {
|
|
487
|
-
this.overrides = undefined
|
|
488
|
-
throw e
|
|
442
|
+
this.overrides = undefined;
|
|
443
|
+
throw e;
|
|
489
444
|
}
|
|
490
445
|
}
|
|
491
446
|
|
|
@@ -509,33 +464,30 @@ class SafeNode extends Node {
|
|
|
509
464
|
// undefined for any node at the end state of the tree. So if the new edge's
|
|
510
465
|
// overrides is undefined it will be updated later. So we can wait with
|
|
511
466
|
// updating the node's overrides field.
|
|
512
|
-
return false
|
|
467
|
+
return false;
|
|
513
468
|
}
|
|
514
469
|
if (!this.overrides) {
|
|
515
|
-
this.overrides = otherOverrideSet
|
|
516
|
-
this.recalculateOutEdgesOverrides()
|
|
517
|
-
return true
|
|
470
|
+
this.overrides = otherOverrideSet;
|
|
471
|
+
this.recalculateOutEdgesOverrides();
|
|
472
|
+
return true;
|
|
518
473
|
}
|
|
519
474
|
if (this.overrides.isEqual(otherOverrideSet)) {
|
|
520
|
-
return false
|
|
475
|
+
return false;
|
|
521
476
|
}
|
|
522
|
-
const newOverrideSet = SafeOverrideSet.findSpecificOverrideSet(
|
|
523
|
-
this.overrides,
|
|
524
|
-
otherOverrideSet
|
|
525
|
-
)
|
|
477
|
+
const newOverrideSet = SafeOverrideSet.findSpecificOverrideSet(this.overrides, otherOverrideSet);
|
|
526
478
|
if (newOverrideSet) {
|
|
527
479
|
if (this.overrides.isEqual(newOverrideSet)) {
|
|
528
|
-
return false
|
|
480
|
+
return false;
|
|
529
481
|
}
|
|
530
|
-
this.overrides = newOverrideSet
|
|
531
|
-
this.recalculateOutEdgesOverrides()
|
|
532
|
-
return true
|
|
482
|
+
this.overrides = newOverrideSet;
|
|
483
|
+
this.recalculateOutEdgesOverrides();
|
|
484
|
+
return true;
|
|
533
485
|
}
|
|
534
486
|
// This is an error condition. We can only get here if the new override set
|
|
535
487
|
// is in conflict with the existing.
|
|
536
|
-
const log = getLogger()
|
|
537
|
-
log?.silly('Conflicting override sets', this.name)
|
|
538
|
-
return false
|
|
488
|
+
const log = getLogger();
|
|
489
|
+
log?.silly('Conflicting override sets', this.name);
|
|
490
|
+
return false;
|
|
539
491
|
}
|
|
540
492
|
|
|
541
493
|
// Patch adding updateOverridesEdgeInRemoved is based on
|
|
@@ -544,40 +496,37 @@ class SafeNode extends Node {
|
|
|
544
496
|
// If this edge's overrides isn't equal to this node's overrides,
|
|
545
497
|
// then removing it won't change newOverrideSet later.
|
|
546
498
|
if (!this.overrides || !this.overrides.isEqual(otherOverrideSet)) {
|
|
547
|
-
return false
|
|
499
|
+
return false;
|
|
548
500
|
}
|
|
549
|
-
let newOverrideSet
|
|
501
|
+
let newOverrideSet;
|
|
550
502
|
for (const edge of this.edgesIn) {
|
|
551
|
-
const {
|
|
503
|
+
const {
|
|
504
|
+
overrides: edgeOverrides
|
|
505
|
+
} = edge;
|
|
552
506
|
if (newOverrideSet && edgeOverrides) {
|
|
553
|
-
newOverrideSet = SafeOverrideSet.findSpecificOverrideSet(
|
|
554
|
-
edgeOverrides,
|
|
555
|
-
newOverrideSet
|
|
556
|
-
)
|
|
507
|
+
newOverrideSet = SafeOverrideSet.findSpecificOverrideSet(edgeOverrides, newOverrideSet);
|
|
557
508
|
} else {
|
|
558
|
-
newOverrideSet = edgeOverrides
|
|
509
|
+
newOverrideSet = edgeOverrides;
|
|
559
510
|
}
|
|
560
511
|
}
|
|
561
512
|
if (this.overrides.isEqual(newOverrideSet)) {
|
|
562
|
-
return false
|
|
513
|
+
return false;
|
|
563
514
|
}
|
|
564
|
-
this.overrides = newOverrideSet
|
|
515
|
+
this.overrides = newOverrideSet;
|
|
565
516
|
if (newOverrideSet) {
|
|
566
517
|
// Optimization: If there's any override set at all, then no non-extraneous
|
|
567
518
|
// node has an empty override set. So if we temporarily have no override set
|
|
568
519
|
// (for example, we removed all the edges in), there's no use updating all
|
|
569
520
|
// the edges out right now. Let's just wait until we have an actual override
|
|
570
521
|
// set later.
|
|
571
|
-
this.recalculateOutEdgesOverrides()
|
|
522
|
+
this.recalculateOutEdgesOverrides();
|
|
572
523
|
}
|
|
573
|
-
return true
|
|
524
|
+
return true;
|
|
574
525
|
}
|
|
575
526
|
}
|
|
576
527
|
|
|
577
|
-
const require$3 =
|
|
578
|
-
|
|
579
|
-
)
|
|
580
|
-
const Edge = require$3(getArboristEdgeClassPath())
|
|
528
|
+
const require$3 =Module.createRequire(require('u' + 'rl').pathToFileURL(__filename).href)
|
|
529
|
+
const Edge = require$3(getArboristEdgeClassPath());
|
|
581
530
|
|
|
582
531
|
// The Edge class makes heavy use of private properties which subclasses do NOT
|
|
583
532
|
// have access to. So we have to recreate any functionality that relies on those
|
|
@@ -592,129 +541,115 @@ const Edge = require$3(getArboristEdgeClassPath())
|
|
|
592
541
|
// An edge in the dependency graph.
|
|
593
542
|
// Represents a dependency relationship of some kind.
|
|
594
543
|
class SafeEdge extends Edge {
|
|
595
|
-
#safeError
|
|
596
|
-
#safeExplanation
|
|
597
|
-
#safeFrom
|
|
598
|
-
#safeTo
|
|
544
|
+
#safeError;
|
|
545
|
+
#safeExplanation;
|
|
546
|
+
#safeFrom;
|
|
547
|
+
#safeTo;
|
|
599
548
|
constructor(options) {
|
|
600
|
-
const {
|
|
549
|
+
const {
|
|
550
|
+
from
|
|
551
|
+
} = options;
|
|
601
552
|
// Defer to supper to validate options and assign non-private values.
|
|
602
|
-
super(options)
|
|
553
|
+
super(options);
|
|
603
554
|
if (from.constructor !== SafeNode) {
|
|
604
|
-
Reflect.setPrototypeOf(from, SafeNode.prototype)
|
|
555
|
+
Reflect.setPrototypeOf(from, SafeNode.prototype);
|
|
605
556
|
}
|
|
606
|
-
this.#safeError = null
|
|
607
|
-
this.#safeExplanation = null
|
|
608
|
-
this.#safeFrom = from
|
|
609
|
-
this.#safeTo = null
|
|
610
|
-
this.reload(true)
|
|
557
|
+
this.#safeError = null;
|
|
558
|
+
this.#safeExplanation = null;
|
|
559
|
+
this.#safeFrom = from;
|
|
560
|
+
this.#safeTo = null;
|
|
561
|
+
this.reload(true);
|
|
611
562
|
}
|
|
612
563
|
get bundled() {
|
|
613
|
-
return !!this.#safeFrom?.package?.bundleDependencies?.includes(this.name)
|
|
564
|
+
return !!this.#safeFrom?.package?.bundleDependencies?.includes(this.name);
|
|
614
565
|
}
|
|
615
566
|
get error() {
|
|
616
567
|
if (!this.#safeError) {
|
|
617
568
|
if (!this.#safeTo) {
|
|
618
569
|
if (this.optional) {
|
|
619
|
-
this.#safeError = null
|
|
570
|
+
this.#safeError = null;
|
|
620
571
|
} else {
|
|
621
|
-
this.#safeError = 'MISSING'
|
|
572
|
+
this.#safeError = 'MISSING';
|
|
622
573
|
}
|
|
623
|
-
} else if (
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
!this.#safeFrom?.isTop
|
|
629
|
-
) {
|
|
630
|
-
this.#safeError = 'PEER LOCAL'
|
|
574
|
+
} else if (this.peer && this.#safeFrom === this.#safeTo.parent &&
|
|
575
|
+
// Patch adding "?." use based on
|
|
576
|
+
// https://github.com/npm/cli/pull/8089.
|
|
577
|
+
!this.#safeFrom?.isTop) {
|
|
578
|
+
this.#safeError = 'PEER LOCAL';
|
|
631
579
|
} else if (!this.satisfiedBy(this.#safeTo)) {
|
|
632
|
-
this.#safeError = 'INVALID'
|
|
580
|
+
this.#safeError = 'INVALID';
|
|
633
581
|
}
|
|
634
582
|
// Patch adding "else if" condition is based on
|
|
635
583
|
// https://github.com/npm/cli/pull/8089.
|
|
636
|
-
else if (
|
|
637
|
-
this.overrides &&
|
|
638
|
-
this.#safeTo.edgesOut.size &&
|
|
639
|
-
SafeOverrideSet.doOverrideSetsConflict(
|
|
640
|
-
this.overrides,
|
|
641
|
-
this.#safeTo.overrides
|
|
642
|
-
)
|
|
643
|
-
) {
|
|
584
|
+
else if (this.overrides && this.#safeTo.edgesOut.size && SafeOverrideSet.doOverrideSetsConflict(this.overrides, this.#safeTo.overrides)) {
|
|
644
585
|
// Any inconsistency between the edge's override set and the target's
|
|
645
586
|
// override set is potentially problematic. But we only say the edge is
|
|
646
587
|
// in error if the override sets are plainly conflicting. Note that if
|
|
647
588
|
// the target doesn't have any dependencies of their own, then this
|
|
648
589
|
// inconsistency is irrelevant.
|
|
649
|
-
this.#safeError = 'INVALID'
|
|
590
|
+
this.#safeError = 'INVALID';
|
|
650
591
|
} else {
|
|
651
|
-
this.#safeError = 'OK'
|
|
592
|
+
this.#safeError = 'OK';
|
|
652
593
|
}
|
|
653
594
|
}
|
|
654
595
|
if (this.#safeError === 'OK') {
|
|
655
|
-
return null
|
|
596
|
+
return null;
|
|
656
597
|
}
|
|
657
|
-
return this.#safeError
|
|
598
|
+
return this.#safeError;
|
|
658
599
|
}
|
|
659
600
|
|
|
660
601
|
// @ts-ignore: Incorrectly typed as a property instead of an accessor.
|
|
661
602
|
get from() {
|
|
662
|
-
return this.#safeFrom
|
|
603
|
+
return this.#safeFrom;
|
|
663
604
|
}
|
|
664
605
|
|
|
665
606
|
// @ts-ignore: Incorrectly typed as a property instead of an accessor.
|
|
666
607
|
get spec() {
|
|
667
|
-
if (
|
|
668
|
-
this.overrides?.value &&
|
|
669
|
-
this.overrides.value !== '*' &&
|
|
670
|
-
this.overrides.name === this.name
|
|
671
|
-
) {
|
|
608
|
+
if (this.overrides?.value && this.overrides.value !== '*' && this.overrides.name === this.name) {
|
|
672
609
|
if (this.overrides.value.startsWith('$')) {
|
|
673
|
-
const ref = this.overrides.value.slice(1)
|
|
610
|
+
const ref = this.overrides.value.slice(1);
|
|
674
611
|
// We may be a virtual root, if we are we want to resolve reference
|
|
675
612
|
// overrides from the real root, not the virtual one.
|
|
676
613
|
//
|
|
677
614
|
// Patch adding "?." use based on
|
|
678
615
|
// https://github.com/npm/cli/pull/8089.
|
|
679
|
-
const pkg = this.#safeFrom?.sourceReference
|
|
680
|
-
? this.#safeFrom?.sourceReference.root.package
|
|
681
|
-
: this.#safeFrom?.root?.package
|
|
616
|
+
const pkg = this.#safeFrom?.sourceReference ? this.#safeFrom?.sourceReference.root.package : this.#safeFrom?.root?.package;
|
|
682
617
|
if (pkg?.devDependencies?.[ref]) {
|
|
683
|
-
return pkg.devDependencies[ref]
|
|
618
|
+
return pkg.devDependencies[ref];
|
|
684
619
|
}
|
|
685
620
|
if (pkg?.optionalDependencies?.[ref]) {
|
|
686
|
-
return pkg.optionalDependencies[ref]
|
|
621
|
+
return pkg.optionalDependencies[ref];
|
|
687
622
|
}
|
|
688
623
|
if (pkg?.dependencies?.[ref]) {
|
|
689
|
-
return pkg.dependencies[ref]
|
|
624
|
+
return pkg.dependencies[ref];
|
|
690
625
|
}
|
|
691
626
|
if (pkg?.peerDependencies?.[ref]) {
|
|
692
|
-
return pkg.peerDependencies[ref]
|
|
627
|
+
return pkg.peerDependencies[ref];
|
|
693
628
|
}
|
|
694
|
-
throw new Error(`Unable to resolve reference ${this.overrides.value}`)
|
|
629
|
+
throw new Error(`Unable to resolve reference ${this.overrides.value}`);
|
|
695
630
|
}
|
|
696
|
-
return this.overrides.value
|
|
631
|
+
return this.overrides.value;
|
|
697
632
|
}
|
|
698
|
-
return this.rawSpec
|
|
633
|
+
return this.rawSpec;
|
|
699
634
|
}
|
|
700
635
|
|
|
701
636
|
// @ts-ignore: Incorrectly typed as a property instead of an accessor.
|
|
702
637
|
get to() {
|
|
703
|
-
return this.#safeTo
|
|
638
|
+
return this.#safeTo;
|
|
704
639
|
}
|
|
705
640
|
detach() {
|
|
706
|
-
this.#safeExplanation = null
|
|
641
|
+
this.#safeExplanation = null;
|
|
707
642
|
// Patch replacing
|
|
708
643
|
// if (this.#to) {
|
|
709
644
|
// this.#to.edgesIn.delete(this)
|
|
710
645
|
// }
|
|
711
646
|
// this.#from.edgesOut.delete(this.#name)
|
|
712
647
|
// is based on https://github.com/npm/cli/pull/8089.
|
|
713
|
-
this.#safeTo?.deleteEdgeIn(this)
|
|
714
|
-
this.#safeFrom?.edgesOut.delete(this.name)
|
|
715
|
-
this.#safeTo = null
|
|
716
|
-
this.#safeError = 'DETACHED'
|
|
717
|
-
this.#safeFrom = null
|
|
648
|
+
this.#safeTo?.deleteEdgeIn(this);
|
|
649
|
+
this.#safeFrom?.edgesOut.delete(this.name);
|
|
650
|
+
this.#safeTo = null;
|
|
651
|
+
this.#safeError = 'DETACHED';
|
|
652
|
+
this.#safeFrom = null;
|
|
718
653
|
}
|
|
719
654
|
|
|
720
655
|
// Return the edge data, and an explanation of how that edge came to be here.
|
|
@@ -730,66 +665,66 @@ class SafeEdge extends Edge {
|
|
|
730
665
|
error: undefined,
|
|
731
666
|
from: undefined,
|
|
732
667
|
rawSpec: undefined
|
|
733
|
-
}
|
|
668
|
+
};
|
|
734
669
|
if (this.rawSpec !== this.spec) {
|
|
735
|
-
explanation.rawSpec = this.rawSpec
|
|
736
|
-
explanation.overridden = true
|
|
670
|
+
explanation.rawSpec = this.rawSpec;
|
|
671
|
+
explanation.overridden = true;
|
|
737
672
|
}
|
|
738
673
|
if (this.bundled) {
|
|
739
|
-
explanation.bundled = this.bundled
|
|
674
|
+
explanation.bundled = this.bundled;
|
|
740
675
|
}
|
|
741
676
|
if (this.error) {
|
|
742
|
-
explanation.error = this.error
|
|
677
|
+
explanation.error = this.error;
|
|
743
678
|
}
|
|
744
679
|
if (this.#safeFrom) {
|
|
745
|
-
explanation.from = this.#safeFrom.explain()
|
|
680
|
+
explanation.from = this.#safeFrom.explain();
|
|
746
681
|
}
|
|
747
|
-
this.#safeExplanation = explanation
|
|
682
|
+
this.#safeExplanation = explanation;
|
|
748
683
|
}
|
|
749
|
-
return this.#safeExplanation
|
|
684
|
+
return this.#safeExplanation;
|
|
750
685
|
}
|
|
751
686
|
reload(hard = false) {
|
|
752
|
-
this.#safeExplanation = null
|
|
687
|
+
this.#safeExplanation = null;
|
|
753
688
|
// Patch replacing
|
|
754
689
|
// if (this.#from.overrides) {
|
|
755
690
|
// is based on https://github.com/npm/cli/pull/8089.
|
|
756
|
-
let needToUpdateOverrideSet = false
|
|
757
|
-
let newOverrideSet
|
|
758
|
-
let oldOverrideSet
|
|
691
|
+
let needToUpdateOverrideSet = false;
|
|
692
|
+
let newOverrideSet;
|
|
693
|
+
let oldOverrideSet;
|
|
759
694
|
if (this.#safeFrom?.overrides) {
|
|
760
|
-
newOverrideSet = this.#safeFrom.overrides.getEdgeRule(this)
|
|
695
|
+
newOverrideSet = this.#safeFrom.overrides.getEdgeRule(this);
|
|
761
696
|
if (newOverrideSet && !newOverrideSet.isEqual(this.overrides)) {
|
|
762
697
|
// If there's a new different override set we need to propagate it to
|
|
763
698
|
// the nodes. If we're deleting the override set then there's no point
|
|
764
699
|
// propagating it right now since it will be filled with another value
|
|
765
700
|
// later.
|
|
766
|
-
needToUpdateOverrideSet = true
|
|
767
|
-
oldOverrideSet = this.overrides
|
|
768
|
-
this.overrides = newOverrideSet
|
|
701
|
+
needToUpdateOverrideSet = true;
|
|
702
|
+
oldOverrideSet = this.overrides;
|
|
703
|
+
this.overrides = newOverrideSet;
|
|
769
704
|
}
|
|
770
705
|
} else {
|
|
771
|
-
this.overrides = undefined
|
|
706
|
+
this.overrides = undefined;
|
|
772
707
|
}
|
|
773
708
|
// Patch adding "?." use based on
|
|
774
709
|
// https://github.com/npm/cli/pull/8089.
|
|
775
|
-
const newTo = this.#safeFrom?.resolve(this.name)
|
|
710
|
+
const newTo = this.#safeFrom?.resolve(this.name);
|
|
776
711
|
if (newTo !== this.#safeTo) {
|
|
777
712
|
// Patch replacing
|
|
778
713
|
// this.#to.edgesIn.delete(this)
|
|
779
714
|
// is based on https://github.com/npm/cli/pull/8089.
|
|
780
|
-
this.#safeTo?.deleteEdgeIn(this)
|
|
781
|
-
this.#safeTo = newTo ?? null
|
|
782
|
-
this.#safeError = null
|
|
783
|
-
this.#safeTo?.addEdgeIn(this)
|
|
715
|
+
this.#safeTo?.deleteEdgeIn(this);
|
|
716
|
+
this.#safeTo = newTo ?? null;
|
|
717
|
+
this.#safeError = null;
|
|
718
|
+
this.#safeTo?.addEdgeIn(this);
|
|
784
719
|
} else if (hard) {
|
|
785
|
-
this.#safeError = null
|
|
720
|
+
this.#safeError = null;
|
|
786
721
|
}
|
|
787
722
|
// Patch adding "else if" condition based on
|
|
788
723
|
// https://github.com/npm/cli/pull/8089.
|
|
789
724
|
else if (needToUpdateOverrideSet && this.#safeTo) {
|
|
790
725
|
// Propagate the new override set to the target node.
|
|
791
|
-
this.#safeTo.updateOverridesEdgeInRemoved(oldOverrideSet)
|
|
792
|
-
this.#safeTo.updateOverridesEdgeInAdded(newOverrideSet)
|
|
726
|
+
this.#safeTo.updateOverridesEdgeInRemoved(oldOverrideSet);
|
|
727
|
+
this.#safeTo.updateOverridesEdgeInAdded(newOverrideSet);
|
|
793
728
|
}
|
|
794
729
|
}
|
|
795
730
|
satisfiedBy(node) {
|
|
@@ -799,12 +734,12 @@ class SafeEdge extends Edge {
|
|
|
799
734
|
// }
|
|
800
735
|
// is based on https://github.com/npm/cli/pull/8089.
|
|
801
736
|
if (node.name !== this.name || !this.#safeFrom) {
|
|
802
|
-
return false
|
|
737
|
+
return false;
|
|
803
738
|
}
|
|
804
739
|
// NOTE: this condition means we explicitly do not support overriding
|
|
805
740
|
// bundled or shrinkwrapped dependencies
|
|
806
741
|
if (node.hasShrinkwrap || node.inShrinkwrap || node.inBundle) {
|
|
807
|
-
return depValid(node, this.rawSpec, this.accept, this.#safeFrom)
|
|
742
|
+
return depValid(node, this.rawSpec, this.accept, this.#safeFrom);
|
|
808
743
|
}
|
|
809
744
|
// Patch replacing
|
|
810
745
|
// return depValid(node, this.spec, this.#accept, this.#from)
|
|
@@ -812,16 +747,16 @@ class SafeEdge extends Edge {
|
|
|
812
747
|
//
|
|
813
748
|
// If there's no override we just use the spec.
|
|
814
749
|
if (!this.overrides?.keySpec) {
|
|
815
|
-
return depValid(node, this.spec, this.accept, this.#safeFrom)
|
|
750
|
+
return depValid(node, this.spec, this.accept, this.#safeFrom);
|
|
816
751
|
}
|
|
817
752
|
// There's some override. If the target node satisfies the overriding spec
|
|
818
753
|
// then it's okay.
|
|
819
754
|
if (depValid(node, this.spec, this.accept, this.#safeFrom)) {
|
|
820
|
-
return true
|
|
755
|
+
return true;
|
|
821
756
|
}
|
|
822
757
|
// If it doesn't, then it should at least satisfy the original spec.
|
|
823
758
|
if (!depValid(node, this.rawSpec, this.accept, this.#safeFrom)) {
|
|
824
|
-
return false
|
|
759
|
+
return false;
|
|
825
760
|
}
|
|
826
761
|
// It satisfies the original spec, not the overriding spec. We need to make
|
|
827
762
|
// sure it doesn't use the overridden spec.
|
|
@@ -833,115 +768,107 @@ class SafeEdge extends Edge {
|
|
|
833
768
|
// If the node is 8.23.0, then it's not okay because even though it's consistent
|
|
834
769
|
// with the rawSpec, it's also consistent with the keySpec.
|
|
835
770
|
// So we're looking for ^8.0.0 or 9.0.0 and not 8.23.0.
|
|
836
|
-
return !depValid(node, this.overrides.keySpec, this.accept, this.#safeFrom)
|
|
771
|
+
return !depValid(node, this.overrides.keySpec, this.accept, this.#safeFrom);
|
|
837
772
|
}
|
|
838
773
|
}
|
|
839
774
|
|
|
840
|
-
const {
|
|
775
|
+
const {
|
|
776
|
+
LOOP_SENTINEL,
|
|
777
|
+
NPM: NPM$1,
|
|
778
|
+
NPM_REGISTRY_URL
|
|
779
|
+
} = constants;
|
|
841
780
|
function getUrlOrigin(input) {
|
|
842
781
|
try {
|
|
843
782
|
// TODO: URL.parse is available in Node 22.1.0. We can use it when we drop Node 18.
|
|
844
783
|
// https://nodejs.org/docs/latest-v22.x/api/url.html#urlparseinput-base
|
|
845
784
|
// return URL.parse(input)?.origin ?? ''
|
|
846
|
-
return new URL(input).origin ?? ''
|
|
785
|
+
return new URL(input).origin ?? '';
|
|
847
786
|
} catch {}
|
|
848
|
-
return ''
|
|
787
|
+
return '';
|
|
849
788
|
}
|
|
850
|
-
function findBestPatchVersion(
|
|
851
|
-
node
|
|
852
|
-
|
|
853
|
-
vulnerableVersionRange,
|
|
854
|
-
_firstPatchedVersionIdentifier
|
|
855
|
-
) {
|
|
856
|
-
const manifestData = registry.getManifestData(NPM$1, node.name)
|
|
857
|
-
let eligibleVersions
|
|
789
|
+
function findBestPatchVersion(node, availableVersions, vulnerableVersionRange, _firstPatchedVersionIdentifier) {
|
|
790
|
+
const manifestData = registry.getManifestData(NPM$1, node.name);
|
|
791
|
+
let eligibleVersions;
|
|
858
792
|
if (manifestData && manifestData.name === manifestData.package) {
|
|
859
|
-
const major = utils.getMajor(manifestData.version)
|
|
793
|
+
const major = utils.getMajor(manifestData.version);
|
|
860
794
|
if (typeof major !== 'number') {
|
|
861
|
-
return null
|
|
795
|
+
return null;
|
|
862
796
|
}
|
|
863
|
-
eligibleVersions = availableVersions.filter(
|
|
864
|
-
v => utils.getMajor(v) === major
|
|
865
|
-
)
|
|
797
|
+
eligibleVersions = availableVersions.filter(v => utils.getMajor(v) === major);
|
|
866
798
|
} else {
|
|
867
|
-
const major = utils.getMajor(node.version)
|
|
799
|
+
const major = utils.getMajor(node.version);
|
|
868
800
|
if (typeof major !== 'number') {
|
|
869
|
-
return null
|
|
870
|
-
}
|
|
871
|
-
eligibleVersions = availableVersions.filter(
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
utils.getMajor(v) === major &&
|
|
876
|
-
(!vulnerableVersionRange ||
|
|
877
|
-
!vendor.semverExports.satisfies(v, vulnerableVersionRange))
|
|
878
|
-
)
|
|
801
|
+
return null;
|
|
802
|
+
}
|
|
803
|
+
eligibleVersions = availableVersions.filter(v =>
|
|
804
|
+
// Filter for versions that are within the current major version and
|
|
805
|
+
// are NOT in the vulnerable range.
|
|
806
|
+
utils.getMajor(v) === major && (!vulnerableVersionRange || !vendor.semverExports.satisfies(v, vulnerableVersionRange)));
|
|
879
807
|
}
|
|
880
|
-
return eligibleVersions
|
|
881
|
-
? vendor.semverExports.maxSatisfying(eligibleVersions, '*')
|
|
882
|
-
: null
|
|
808
|
+
return eligibleVersions ? vendor.semverExports.maxSatisfying(eligibleVersions, '*') : null;
|
|
883
809
|
}
|
|
884
810
|
function findPackageNode(tree, name, version) {
|
|
885
|
-
const queue = [tree]
|
|
886
|
-
const visited = new Set()
|
|
887
|
-
let sentinel = 0
|
|
811
|
+
const queue = [tree];
|
|
812
|
+
const visited = new Set();
|
|
813
|
+
let sentinel = 0;
|
|
888
814
|
while (queue.length) {
|
|
889
815
|
if (sentinel++ === LOOP_SENTINEL) {
|
|
890
|
-
throw new Error('Detected infinite loop in findPackageNode')
|
|
816
|
+
throw new Error('Detected infinite loop in findPackageNode');
|
|
891
817
|
}
|
|
892
|
-
const nodeOrLink = queue.pop()
|
|
893
|
-
const node = nodeOrLink
|
|
818
|
+
const nodeOrLink = queue.pop();
|
|
819
|
+
const node = getTargetNode(nodeOrLink);
|
|
894
820
|
if (visited.has(node)) {
|
|
895
|
-
continue
|
|
821
|
+
continue;
|
|
896
822
|
}
|
|
897
|
-
visited.add(node)
|
|
898
|
-
if (
|
|
899
|
-
node
|
|
900
|
-
(typeof version !== 'string' || node.version === version)
|
|
901
|
-
) {
|
|
902
|
-
return node
|
|
823
|
+
visited.add(node);
|
|
824
|
+
if (node.name === name && (typeof version !== 'string' || node.version === version)) {
|
|
825
|
+
return node;
|
|
903
826
|
}
|
|
904
827
|
for (const child of node.children.values()) {
|
|
905
|
-
queue.push(child)
|
|
828
|
+
queue.push(child);
|
|
906
829
|
}
|
|
907
830
|
for (const edge of node.edgesOut.values()) {
|
|
908
|
-
const {
|
|
831
|
+
const {
|
|
832
|
+
to
|
|
833
|
+
} = edge;
|
|
909
834
|
if (to) {
|
|
910
|
-
queue.push(to)
|
|
835
|
+
queue.push(to);
|
|
911
836
|
}
|
|
912
837
|
}
|
|
913
838
|
}
|
|
914
|
-
return undefined
|
|
839
|
+
return undefined;
|
|
915
840
|
}
|
|
916
841
|
function findPackageNodes(tree, name, version) {
|
|
917
|
-
const matches = []
|
|
918
|
-
const queue = [tree]
|
|
919
|
-
const visited = new Set()
|
|
920
|
-
let sentinel = 0
|
|
842
|
+
const matches = [];
|
|
843
|
+
const queue = [tree];
|
|
844
|
+
const visited = new Set();
|
|
845
|
+
let sentinel = 0;
|
|
921
846
|
while (queue.length) {
|
|
922
847
|
if (sentinel++ === LOOP_SENTINEL) {
|
|
923
|
-
throw new Error('Detected infinite loop in findPackageNodes')
|
|
848
|
+
throw new Error('Detected infinite loop in findPackageNodes');
|
|
924
849
|
}
|
|
925
|
-
const nodeOrLink = queue.pop()
|
|
926
|
-
const node = nodeOrLink
|
|
850
|
+
const nodeOrLink = queue.pop();
|
|
851
|
+
const node = getTargetNode(nodeOrLink);
|
|
927
852
|
if (visited.has(node)) {
|
|
928
|
-
continue
|
|
853
|
+
continue;
|
|
929
854
|
}
|
|
930
|
-
visited.add(node)
|
|
931
|
-
if (node.name === name &&
|
|
932
|
-
matches.push(node)
|
|
855
|
+
visited.add(node);
|
|
856
|
+
if (node.name === name && ("undefined" !== 'string')) {
|
|
857
|
+
matches.push(node);
|
|
933
858
|
}
|
|
934
859
|
for (const child of node.children.values()) {
|
|
935
|
-
queue.push(child)
|
|
860
|
+
queue.push(child);
|
|
936
861
|
}
|
|
937
862
|
for (const edge of node.edgesOut.values()) {
|
|
938
|
-
const {
|
|
863
|
+
const {
|
|
864
|
+
to
|
|
865
|
+
} = edge;
|
|
939
866
|
if (to) {
|
|
940
|
-
queue.push(to)
|
|
867
|
+
queue.push(to);
|
|
941
868
|
}
|
|
942
869
|
}
|
|
943
870
|
}
|
|
944
|
-
return matches
|
|
871
|
+
return matches;
|
|
945
872
|
}
|
|
946
873
|
async function getAlertsMapFromArborist(arb, options_) {
|
|
947
874
|
const options = {
|
|
@@ -950,41 +877,35 @@ async function getAlertsMapFromArborist(arb, options_) {
|
|
|
950
877
|
limit: Infinity,
|
|
951
878
|
nothrow: false,
|
|
952
879
|
...options_
|
|
953
|
-
}
|
|
880
|
+
};
|
|
954
881
|
const include = {
|
|
955
882
|
__proto__: null,
|
|
956
883
|
existing: false,
|
|
957
884
|
...options.include
|
|
958
|
-
}
|
|
885
|
+
};
|
|
959
886
|
const needInfoOn = getDetailsFromDiff(arb.diff, {
|
|
960
887
|
include: {
|
|
961
888
|
unchanged: include.existing
|
|
962
889
|
}
|
|
963
|
-
})
|
|
964
|
-
const purls = needInfoOn.map(d => utils.idToPurl(d.node.pkgid))
|
|
965
|
-
let overrides
|
|
966
|
-
const overridesMap = (
|
|
967
|
-
arb.actualTree ??
|
|
968
|
-
arb.idealTree ??
|
|
969
|
-
(await arb.loadActual())
|
|
970
|
-
)?.overrides?.children
|
|
890
|
+
});
|
|
891
|
+
const purls = needInfoOn.map(d => utils.idToPurl(d.node.pkgid));
|
|
892
|
+
let overrides;
|
|
893
|
+
const overridesMap = (arb.actualTree ?? arb.idealTree ?? (await arb.loadActual()))?.overrides?.children;
|
|
971
894
|
if (overridesMap) {
|
|
972
|
-
overrides = Object.fromEntries(
|
|
973
|
-
[
|
|
974
|
-
|
|
975
|
-
})
|
|
976
|
-
)
|
|
895
|
+
overrides = Object.fromEntries([...overridesMap.entries()].map(([key, overrideSet]) => {
|
|
896
|
+
return [key, overrideSet.value];
|
|
897
|
+
}));
|
|
977
898
|
}
|
|
978
899
|
return await utils.getAlertsMapFromPurls(purls, {
|
|
979
900
|
overrides,
|
|
980
901
|
...options
|
|
981
|
-
})
|
|
902
|
+
});
|
|
982
903
|
}
|
|
983
904
|
function getDetailsFromDiff(diff_, options) {
|
|
984
|
-
const details = []
|
|
905
|
+
const details = [];
|
|
985
906
|
// `diff_` is `null` when `npm install --package-lock-only` is passed.
|
|
986
907
|
if (!diff_) {
|
|
987
|
-
return details
|
|
908
|
+
return details;
|
|
988
909
|
}
|
|
989
910
|
const include = {
|
|
990
911
|
__proto__: null,
|
|
@@ -994,76 +915,77 @@ function getDetailsFromDiff(diff_, options) {
|
|
|
994
915
|
__proto__: null,
|
|
995
916
|
...options
|
|
996
917
|
}.include
|
|
997
|
-
}
|
|
998
|
-
const queue = [...diff_.children]
|
|
999
|
-
let pos = 0
|
|
1000
|
-
let {
|
|
918
|
+
};
|
|
919
|
+
const queue = [...diff_.children];
|
|
920
|
+
let pos = 0;
|
|
921
|
+
let {
|
|
922
|
+
length: queueLength
|
|
923
|
+
} = queue;
|
|
1001
924
|
while (pos < queueLength) {
|
|
1002
925
|
if (pos === LOOP_SENTINEL) {
|
|
1003
|
-
throw new Error('Detected infinite loop while walking Arborist diff')
|
|
926
|
+
throw new Error('Detected infinite loop while walking Arborist diff');
|
|
1004
927
|
}
|
|
1005
|
-
const diff = queue[pos++]
|
|
1006
|
-
const {
|
|
928
|
+
const diff = queue[pos++];
|
|
929
|
+
const {
|
|
930
|
+
action
|
|
931
|
+
} = diff;
|
|
1007
932
|
if (action) {
|
|
1008
933
|
// The `pkgNode`, i.e. the `ideal` node, will be `undefined` if the diff
|
|
1009
934
|
// action is 'REMOVE'
|
|
1010
935
|
// The `oldNode`, i.e. the `actual` node, will be `undefined` if the diff
|
|
1011
936
|
// action is 'ADD'.
|
|
1012
|
-
const {
|
|
1013
|
-
|
|
1014
|
-
|
|
937
|
+
const {
|
|
938
|
+
actual: oldNode,
|
|
939
|
+
ideal: pkgNode
|
|
940
|
+
} = diff;
|
|
941
|
+
let existing;
|
|
942
|
+
let keep = false;
|
|
1015
943
|
if (action === DiffAction.change) {
|
|
1016
944
|
if (pkgNode?.package.version !== oldNode?.package.version) {
|
|
1017
|
-
keep = true
|
|
1018
|
-
if (
|
|
1019
|
-
oldNode
|
|
1020
|
-
oldNode.package.name === pkgNode?.package.name
|
|
1021
|
-
) {
|
|
1022
|
-
existing = oldNode
|
|
945
|
+
keep = true;
|
|
946
|
+
if (oldNode?.package.name && oldNode.package.name === pkgNode?.package.name) {
|
|
947
|
+
existing = oldNode;
|
|
1023
948
|
}
|
|
1024
949
|
}
|
|
1025
950
|
} else {
|
|
1026
|
-
keep = action !== DiffAction.remove
|
|
951
|
+
keep = action !== DiffAction.remove;
|
|
1027
952
|
}
|
|
1028
953
|
if (keep && pkgNode?.resolved && (!oldNode || oldNode.resolved)) {
|
|
1029
|
-
if (
|
|
1030
|
-
include.unknownOrigin ||
|
|
1031
|
-
getUrlOrigin(pkgNode.resolved) === NPM_REGISTRY_URL
|
|
1032
|
-
) {
|
|
954
|
+
if (include.unknownOrigin || getUrlOrigin(pkgNode.resolved) === NPM_REGISTRY_URL) {
|
|
1033
955
|
details.push({
|
|
1034
956
|
node: pkgNode,
|
|
1035
957
|
existing
|
|
1036
|
-
})
|
|
958
|
+
});
|
|
1037
959
|
}
|
|
1038
960
|
}
|
|
1039
961
|
}
|
|
1040
962
|
for (const child of diff.children) {
|
|
1041
|
-
queue[queueLength++] = child
|
|
963
|
+
queue[queueLength++] = child;
|
|
1042
964
|
}
|
|
1043
965
|
}
|
|
1044
966
|
if (include.unchanged) {
|
|
1045
|
-
const {
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
967
|
+
const {
|
|
968
|
+
unchanged
|
|
969
|
+
} = diff_;
|
|
970
|
+
for (let i = 0, {
|
|
971
|
+
length
|
|
972
|
+
} = unchanged; i < length; i += 1) {
|
|
973
|
+
const pkgNode = unchanged[i];
|
|
974
|
+
if (include.unknownOrigin || getUrlOrigin(pkgNode.resolved) === NPM_REGISTRY_URL) {
|
|
1052
975
|
details.push({
|
|
1053
976
|
node: pkgNode,
|
|
1054
977
|
existing: pkgNode
|
|
1055
|
-
})
|
|
978
|
+
});
|
|
1056
979
|
}
|
|
1057
980
|
}
|
|
1058
981
|
}
|
|
1059
|
-
return details
|
|
982
|
+
return details;
|
|
983
|
+
}
|
|
984
|
+
function getTargetNode(nodeOrLink) {
|
|
985
|
+
return nodeOrLink?.isLink ? nodeOrLink.target : nodeOrLink ?? null;
|
|
1060
986
|
}
|
|
1061
987
|
function isTopLevel(tree, node) {
|
|
1062
|
-
|
|
1063
|
-
const childNode = childNodeOrLink?.isLink
|
|
1064
|
-
? childNodeOrLink.target
|
|
1065
|
-
: childNodeOrLink
|
|
1066
|
-
return childNode === node
|
|
988
|
+
return getTargetNode(tree.children.get(node.name)) === node;
|
|
1067
989
|
}
|
|
1068
990
|
function updateNode(node, newVersion, newVersionPackument) {
|
|
1069
991
|
// Object.defineProperty is needed to set the version property and replace
|
|
@@ -1072,40 +994,42 @@ function updateNode(node, newVersion, newVersionPackument) {
|
|
|
1072
994
|
configurable: true,
|
|
1073
995
|
enumerable: true,
|
|
1074
996
|
get: () => newVersion
|
|
1075
|
-
})
|
|
997
|
+
});
|
|
1076
998
|
// Update package.version associated with the node.
|
|
1077
|
-
node.package.version = newVersion
|
|
999
|
+
node.package.version = newVersion;
|
|
1078
1000
|
// Update node.resolved.
|
|
1079
|
-
const purlObj = vendor.packageurlJsExports.PackageURL.fromString(
|
|
1080
|
-
|
|
1081
|
-
)
|
|
1082
|
-
node.resolved = `${NPM_REGISTRY_URL}/${node.name}/-/${purlObj.name}-${newVersion}.tgz`
|
|
1001
|
+
const purlObj = vendor.packageurlJsExports.PackageURL.fromString(utils.idToPurl(node.name));
|
|
1002
|
+
node.resolved = `${NPM_REGISTRY_URL}/${node.name}/-/${purlObj.name}-${newVersion}.tgz`;
|
|
1083
1003
|
// Update node.integrity with the targetPackument.dist.integrity value if available
|
|
1084
1004
|
// else delete node.integrity so a new value is resolved for the target version.
|
|
1085
|
-
const {
|
|
1005
|
+
const {
|
|
1006
|
+
integrity
|
|
1007
|
+
} = newVersionPackument.dist;
|
|
1086
1008
|
if (integrity) {
|
|
1087
|
-
node.integrity = integrity
|
|
1009
|
+
node.integrity = integrity;
|
|
1088
1010
|
} else {
|
|
1089
|
-
delete node.integrity
|
|
1011
|
+
delete node.integrity;
|
|
1090
1012
|
}
|
|
1091
1013
|
// Update node.package.deprecated based on targetPackument.deprecated.
|
|
1092
1014
|
if (objects.hasOwn(newVersionPackument, 'deprecated')) {
|
|
1093
|
-
node.package['deprecated'] = newVersionPackument.deprecated
|
|
1015
|
+
node.package['deprecated'] = newVersionPackument.deprecated;
|
|
1094
1016
|
} else {
|
|
1095
|
-
delete node.package['deprecated']
|
|
1017
|
+
delete node.package['deprecated'];
|
|
1096
1018
|
}
|
|
1097
1019
|
// Update node.package.dependencies.
|
|
1098
1020
|
const newDeps = {
|
|
1099
1021
|
...newVersionPackument.dependencies
|
|
1100
|
-
}
|
|
1101
|
-
const {
|
|
1102
|
-
|
|
1022
|
+
};
|
|
1023
|
+
const {
|
|
1024
|
+
dependencies: oldDeps
|
|
1025
|
+
} = node.package;
|
|
1026
|
+
node.package.dependencies = newDeps;
|
|
1103
1027
|
if (oldDeps) {
|
|
1104
1028
|
for (const oldDepName of Object.keys(oldDeps)) {
|
|
1105
1029
|
if (!objects.hasOwn(newDeps, oldDepName)) {
|
|
1106
1030
|
// Detach old edges for dependencies that don't exist on the updated
|
|
1107
1031
|
// node.package.dependencies.
|
|
1108
|
-
node.edgesOut.get(oldDepName)?.detach()
|
|
1032
|
+
node.edgesOut.get(oldDepName)?.detach();
|
|
1109
1033
|
}
|
|
1110
1034
|
}
|
|
1111
1035
|
}
|
|
@@ -1113,57 +1037,45 @@ function updateNode(node, newVersion, newVersionPackument) {
|
|
|
1113
1037
|
if (!objects.hasOwn(oldDeps, newDepName)) {
|
|
1114
1038
|
// Add new edges for dependencies that don't exist on the old
|
|
1115
1039
|
// node.package.dependencies.
|
|
1116
|
-
node.addEdgeOut(
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
})
|
|
1123
|
-
)
|
|
1040
|
+
node.addEdgeOut(new Edge({
|
|
1041
|
+
from: node,
|
|
1042
|
+
name: newDepName,
|
|
1043
|
+
spec: newDeps[newDepName],
|
|
1044
|
+
type: 'prod'
|
|
1045
|
+
}));
|
|
1124
1046
|
}
|
|
1125
1047
|
}
|
|
1126
1048
|
}
|
|
1127
|
-
function updatePackageJsonFromNode(
|
|
1128
|
-
|
|
1129
|
-
tree,
|
|
1130
|
-
node,
|
|
1131
|
-
newVersion,
|
|
1132
|
-
rangeStyle
|
|
1133
|
-
) {
|
|
1134
|
-
let result = false
|
|
1049
|
+
function updatePackageJsonFromNode(editablePkgJson, tree, node, newVersion, rangeStyle) {
|
|
1050
|
+
let result = false;
|
|
1135
1051
|
if (!isTopLevel(tree, node)) {
|
|
1136
|
-
return result
|
|
1052
|
+
return result;
|
|
1137
1053
|
}
|
|
1138
|
-
const {
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
]) {
|
|
1144
|
-
const depObject = editablePkgJson.content[depField]
|
|
1054
|
+
const {
|
|
1055
|
+
name
|
|
1056
|
+
} = node;
|
|
1057
|
+
for (const depField of ['dependencies', 'optionalDependencies', 'peerDependencies']) {
|
|
1058
|
+
const depObject = editablePkgJson.content[depField];
|
|
1145
1059
|
if (depObject) {
|
|
1146
|
-
const oldRange = depObject[name]
|
|
1060
|
+
const oldRange = depObject[name];
|
|
1147
1061
|
if (oldRange) {
|
|
1148
|
-
const newRange = utils.applyRange(oldRange, newVersion, rangeStyle)
|
|
1062
|
+
const newRange = utils.applyRange(oldRange, newVersion, rangeStyle);
|
|
1149
1063
|
if (oldRange !== newRange) {
|
|
1150
|
-
result = true
|
|
1064
|
+
result = true;
|
|
1151
1065
|
editablePkgJson.update({
|
|
1152
1066
|
[depField]: {
|
|
1153
1067
|
...depObject,
|
|
1154
1068
|
[name]: newRange
|
|
1155
1069
|
}
|
|
1156
|
-
})
|
|
1070
|
+
});
|
|
1157
1071
|
}
|
|
1158
1072
|
}
|
|
1159
1073
|
}
|
|
1160
1074
|
}
|
|
1161
|
-
return result
|
|
1075
|
+
return result;
|
|
1162
1076
|
}
|
|
1163
1077
|
|
|
1164
|
-
const require$2 =
|
|
1165
|
-
require('u' + 'rl').pathToFileURL(__filename).href
|
|
1166
|
-
)
|
|
1078
|
+
const require$2 =Module.createRequire(require('u' + 'rl').pathToFileURL(__filename).href)
|
|
1167
1079
|
const {
|
|
1168
1080
|
NPM,
|
|
1169
1081
|
NPX,
|
|
@@ -1172,8 +1084,10 @@ const {
|
|
|
1172
1084
|
SOCKET_CLI_SAFE_PROGRESS,
|
|
1173
1085
|
SOCKET_CLI_VIEW_ALL_RISKS,
|
|
1174
1086
|
kInternalsSymbol,
|
|
1175
|
-
[kInternalsSymbol]: {
|
|
1176
|
-
|
|
1087
|
+
[kInternalsSymbol]: {
|
|
1088
|
+
getIpc
|
|
1089
|
+
}
|
|
1090
|
+
} = constants;
|
|
1177
1091
|
const SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES = {
|
|
1178
1092
|
__proto__: null,
|
|
1179
1093
|
audit: false,
|
|
@@ -1184,44 +1098,34 @@ const SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES = {
|
|
|
1184
1098
|
save: false,
|
|
1185
1099
|
saveBundle: false,
|
|
1186
1100
|
silent: true
|
|
1187
|
-
}
|
|
1188
|
-
const kCtorArgs = Symbol('ctorArgs')
|
|
1189
|
-
const kRiskyReify = Symbol('riskyReify')
|
|
1190
|
-
const Arborist = require$2(getArboristClassPath())
|
|
1101
|
+
};
|
|
1102
|
+
const kCtorArgs = Symbol('ctorArgs');
|
|
1103
|
+
const kRiskyReify = Symbol('riskyReify');
|
|
1104
|
+
const Arborist = require$2(getArboristClassPath());
|
|
1191
1105
|
|
|
1192
1106
|
// Implementation code not related to our custom behavior is based on
|
|
1193
1107
|
// https://github.com/npm/cli/blob/v11.0.0/workspaces/arborist/lib/arborist/index.js:
|
|
1194
1108
|
class SafeArborist extends Arborist {
|
|
1195
1109
|
constructor(...ctorArgs) {
|
|
1196
|
-
super(
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
},
|
|
1203
|
-
...ctorArgs.slice(1)
|
|
1204
|
-
)
|
|
1205
|
-
this[kCtorArgs] = ctorArgs
|
|
1110
|
+
super({
|
|
1111
|
+
path: (ctorArgs.length ? ctorArgs[0]?.path : undefined) ?? process.cwd(),
|
|
1112
|
+
...(ctorArgs.length ? ctorArgs[0] : undefined),
|
|
1113
|
+
...SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES
|
|
1114
|
+
}, ...ctorArgs.slice(1));
|
|
1115
|
+
this[kCtorArgs] = ctorArgs;
|
|
1206
1116
|
}
|
|
1207
1117
|
async [kRiskyReify](...args) {
|
|
1208
|
-
const ctorArgs = this[kCtorArgs]
|
|
1209
|
-
const arb = new Arborist(
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
...
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
progress: false
|
|
1220
|
-
},
|
|
1221
|
-
...args.slice(1)
|
|
1222
|
-
)
|
|
1223
|
-
Object.assign(this, arb)
|
|
1224
|
-
return ret
|
|
1118
|
+
const ctorArgs = this[kCtorArgs];
|
|
1119
|
+
const arb = new Arborist({
|
|
1120
|
+
...(ctorArgs.length ? ctorArgs[0] : undefined),
|
|
1121
|
+
progress: false
|
|
1122
|
+
}, ...ctorArgs.slice(1));
|
|
1123
|
+
const ret = await arb.reify({
|
|
1124
|
+
...(args.length ? args[0] : undefined),
|
|
1125
|
+
progress: false
|
|
1126
|
+
}, ...args.slice(1));
|
|
1127
|
+
Object.assign(this, arb);
|
|
1128
|
+
return ret;
|
|
1225
1129
|
}
|
|
1226
1130
|
|
|
1227
1131
|
// @ts-ignore Incorrectly typed.
|
|
@@ -1229,105 +1133,91 @@ class SafeArborist extends Arborist {
|
|
|
1229
1133
|
const options = {
|
|
1230
1134
|
__proto__: null,
|
|
1231
1135
|
...(args.length ? args[0] : undefined)
|
|
1232
|
-
}
|
|
1233
|
-
const ipc = await getIpc()
|
|
1234
|
-
const binName = ipc[SOCKET_CLI_SAFE_BIN]
|
|
1136
|
+
};
|
|
1137
|
+
const ipc = await getIpc();
|
|
1138
|
+
const binName = ipc[SOCKET_CLI_SAFE_BIN];
|
|
1235
1139
|
if (!binName) {
|
|
1236
|
-
return await this[kRiskyReify](...args)
|
|
1237
|
-
}
|
|
1238
|
-
await super.reify(
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
...args.slice(1)
|
|
1246
|
-
)
|
|
1140
|
+
return await this[kRiskyReify](...args);
|
|
1141
|
+
}
|
|
1142
|
+
await super.reify({
|
|
1143
|
+
...options,
|
|
1144
|
+
...SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES,
|
|
1145
|
+
progress: false
|
|
1146
|
+
},
|
|
1147
|
+
// @ts-ignore: TypeScript gets grumpy about rest parameters.
|
|
1148
|
+
...args.slice(1));
|
|
1247
1149
|
// Lazily access constants.ENV.SOCKET_CLI_ACCEPT_RISKS.
|
|
1248
|
-
const acceptRisks = constants.ENV.SOCKET_CLI_ACCEPT_RISKS
|
|
1249
|
-
const progress = ipc[SOCKET_CLI_SAFE_PROGRESS]
|
|
1250
|
-
const spinner =
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
const isSafeNpm = binName === NPM
|
|
1256
|
-
const isSafeNpx = binName === NPX
|
|
1150
|
+
const acceptRisks = constants.ENV.SOCKET_CLI_ACCEPT_RISKS;
|
|
1151
|
+
const progress = ipc[SOCKET_CLI_SAFE_PROGRESS];
|
|
1152
|
+
const spinner = options['silent'] || !progress ? undefined :
|
|
1153
|
+
// Lazily access constants.spinner.
|
|
1154
|
+
constants.spinner;
|
|
1155
|
+
const isSafeNpm = binName === NPM;
|
|
1156
|
+
const isSafeNpx = binName === NPX;
|
|
1257
1157
|
const alertsMap = await getAlertsMapFromArborist(this, {
|
|
1258
1158
|
spinner,
|
|
1259
|
-
include:
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
unfixable: isSafeNpm
|
|
1272
|
-
}
|
|
1273
|
-
})
|
|
1159
|
+
include: acceptRisks || options.dryRun || options['yes'] ? {
|
|
1160
|
+
actions: ['error'],
|
|
1161
|
+
blocked: true,
|
|
1162
|
+
critical: false,
|
|
1163
|
+
cve: false,
|
|
1164
|
+
existing: true,
|
|
1165
|
+
unfixable: false
|
|
1166
|
+
} : {
|
|
1167
|
+
existing: isSafeNpx,
|
|
1168
|
+
unfixable: isSafeNpm
|
|
1169
|
+
}
|
|
1170
|
+
});
|
|
1274
1171
|
if (alertsMap.size) {
|
|
1275
|
-
process.exitCode = 1
|
|
1172
|
+
process.exitCode = 1;
|
|
1276
1173
|
// Lazily access constants.ENV.SOCKET_CLI_VIEW_ALL_RISKS.
|
|
1277
|
-
const viewAllRisks = constants.ENV.SOCKET_CLI_VIEW_ALL_RISKS
|
|
1174
|
+
const viewAllRisks = constants.ENV.SOCKET_CLI_VIEW_ALL_RISKS;
|
|
1278
1175
|
utils.logAlertsMap(alertsMap, {
|
|
1279
1176
|
hideAt: viewAllRisks ? 'none' : 'middle',
|
|
1280
1177
|
output: process.stderr
|
|
1281
|
-
})
|
|
1282
|
-
throw new Error(
|
|
1283
|
-
`
|
|
1178
|
+
});
|
|
1179
|
+
throw new Error(`
|
|
1284
1180
|
Socket ${binName} exiting due to risks.${viewAllRisks ? '' : `\nView all risks - Rerun with environment variable ${SOCKET_CLI_VIEW_ALL_RISKS}=1.`}${acceptRisks ? '' : `\nAccept risks - Rerun with environment variable ${SOCKET_CLI_ACCEPT_RISKS}=1.`}
|
|
1285
|
-
`.trim()
|
|
1286
|
-
)
|
|
1181
|
+
`.trim());
|
|
1287
1182
|
} else if (!options['silent']) {
|
|
1288
|
-
logger.logger.success(
|
|
1289
|
-
`Socket ${binName} ${acceptRisks ? 'accepted' : 'found no'} risks`
|
|
1290
|
-
)
|
|
1183
|
+
logger.logger.success(`Socket ${binName} ${acceptRisks ? 'accepted' : 'found no'} risks`);
|
|
1291
1184
|
if (binName === NPX) {
|
|
1292
|
-
logger.logger.log(`Running ${options.add[0]}`)
|
|
1185
|
+
logger.logger.log(`Running ${options.add[0]}`);
|
|
1293
1186
|
}
|
|
1294
1187
|
}
|
|
1295
|
-
return await this[kRiskyReify](...args)
|
|
1188
|
+
return await this[kRiskyReify](...args);
|
|
1296
1189
|
}
|
|
1297
1190
|
}
|
|
1298
1191
|
|
|
1299
|
-
const require$1 =
|
|
1300
|
-
require('u' + 'rl').pathToFileURL(__filename).href
|
|
1301
|
-
)
|
|
1192
|
+
const require$1 =Module.createRequire(require('u' + 'rl').pathToFileURL(__filename).href)
|
|
1302
1193
|
function installSafeArborist() {
|
|
1303
1194
|
// Override '@npmcli/arborist' module exports with patched variants based on
|
|
1304
1195
|
// https://github.com/npm/cli/pull/8089.
|
|
1305
|
-
const cache = require$1.cache
|
|
1196
|
+
const cache = require$1.cache;
|
|
1306
1197
|
cache[getArboristClassPath()] = {
|
|
1307
1198
|
exports: SafeArborist
|
|
1308
|
-
}
|
|
1199
|
+
};
|
|
1309
1200
|
cache[getArboristEdgeClassPath()] = {
|
|
1310
1201
|
exports: SafeEdge
|
|
1311
|
-
}
|
|
1202
|
+
};
|
|
1312
1203
|
cache[getArboristNodeClassPath()] = {
|
|
1313
1204
|
exports: SafeNode
|
|
1314
|
-
}
|
|
1205
|
+
};
|
|
1315
1206
|
cache[getArboristOverrideSetClassPath()] = {
|
|
1316
1207
|
exports: SafeOverrideSet
|
|
1317
|
-
}
|
|
1208
|
+
};
|
|
1318
1209
|
}
|
|
1319
1210
|
|
|
1320
|
-
installSafeArborist()
|
|
1211
|
+
installSafeArborist();
|
|
1321
1212
|
|
|
1322
|
-
exports.Arborist = Arborist
|
|
1323
|
-
exports.SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES =
|
|
1324
|
-
|
|
1325
|
-
exports.
|
|
1326
|
-
exports.
|
|
1327
|
-
exports.
|
|
1328
|
-
exports.
|
|
1329
|
-
exports.
|
|
1330
|
-
exports.
|
|
1331
|
-
|
|
1332
|
-
//# debugId=4d43be43-e3e8-4e13-b9a6-432f79e6face
|
|
1213
|
+
exports.Arborist = Arborist;
|
|
1214
|
+
exports.SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES = SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES;
|
|
1215
|
+
exports.SafeArborist = SafeArborist;
|
|
1216
|
+
exports.findBestPatchVersion = findBestPatchVersion;
|
|
1217
|
+
exports.findPackageNode = findPackageNode;
|
|
1218
|
+
exports.findPackageNodes = findPackageNodes;
|
|
1219
|
+
exports.getAlertsMapFromArborist = getAlertsMapFromArborist;
|
|
1220
|
+
exports.updateNode = updateNode;
|
|
1221
|
+
exports.updatePackageJsonFromNode = updatePackageJsonFromNode;
|
|
1222
|
+
//# debugId=aa475dcb-56c6-4bc2-8b36-54e92a6963a9
|
|
1333
1223
|
//# sourceMappingURL=shadow-inject.js.map
|