@socketsecurity/lib 6.0.6 → 6.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -1
- package/dist/ai/discover.d.mts +2 -2
- package/dist/ai/discover.js +3 -2
- package/dist/ai/spawn.js +2 -1
- package/dist/ai/types.d.mts +18 -6
- package/dist/ai/worktree.d.mts +6 -6
- package/dist/ai/worktree.js +1 -1
- package/dist/ansi/strip.d.ts +1 -1
- package/dist/ansi/strip.js +0 -2
- package/dist/archives/_internal.js +7 -9
- package/dist/archives/extract.js +1 -1
- package/dist/archives/tar.js +6 -6
- package/dist/archives/zip.js +3 -5
- package/dist/argv/flag-predicates.d.ts +12 -12
- package/dist/argv/flag-predicates.js +17 -17
- package/dist/argv/flag-types.d.ts +18 -18
- package/dist/argv/flag-types.js +4 -4
- package/dist/argv/parse.d.ts +1 -1
- package/dist/arrays/_internal.js +11 -12
- package/dist/arrays/chunk.js +0 -1
- package/dist/arrays/join.d.ts +37 -3
- package/dist/arrays/join.js +43 -7
- package/dist/arrays/unique.js +0 -1
- package/dist/bin/_internal.d.ts +1 -1
- package/dist/bin/_internal.js +1 -1
- package/dist/bin/exec.js +2 -3
- package/dist/bin/find.js +13 -13
- package/dist/bin/prim.cjs +22736 -22556
- package/dist/bin/resolve.js +12 -13
- package/dist/bin/which.js +8 -8
- package/dist/cache/ttl/store.js +5 -5
- package/dist/checks/primordials-defaults.d.ts +3 -3
- package/dist/checks/primordials-defaults.js +3 -3
- package/dist/checks/primordials.js +4 -3
- package/dist/{bin → cli}/check-primordials.d.ts +11 -11
- package/dist/{bin → cli}/check-primordials.js +55 -52
- package/dist/{bin → cli}/check.js +3 -3
- package/dist/{bin → cli}/socket-lib.d.ts +1 -1
- package/dist/{bin → cli}/socket-lib.js +4 -4
- package/dist/colors/socket-palette.js +7 -9
- package/dist/compression/_internal.d.ts +12 -12
- package/dist/compression/_internal.js +17 -17
- package/dist/compression/brotli.d.ts +25 -25
- package/dist/compression/brotli.js +33 -33
- package/dist/compression/gzip.d.ts +23 -23
- package/dist/compression/gzip.js +40 -40
- package/dist/constants/agents.d.ts +3 -1
- package/dist/constants/agents.js +15 -11
- package/dist/constants/licenses.js +3 -3
- package/dist/constants/node.d.ts +23 -0
- package/dist/constants/node.js +47 -15
- package/dist/constants/packages.js +22 -28
- package/dist/constants/platform.d.ts +30 -3
- package/dist/constants/platform.js +72 -12
- package/dist/constants/runtime.d.ts +22 -0
- package/dist/constants/runtime.js +32 -0
- package/dist/constants/socket.js +1 -1
- package/dist/cover/code.js +8 -8
- package/dist/cover/formatters.js +5 -5
- package/dist/crypto/hash.d.ts +26 -1
- package/dist/crypto/hash.js +43 -12
- package/dist/debug/_internal.js +4 -6
- package/dist/debug/caller-info.js +2 -3
- package/dist/debug/namespace.d.ts +7 -0
- package/dist/debug/namespace.js +21 -12
- package/dist/debug/output.js +21 -24
- package/dist/debug/types.d.ts +4 -4
- package/dist/dlx/arborist.js +6 -6
- package/dist/dlx/binary-cache.js +14 -14
- package/dist/dlx/binary-download.d.ts +1 -1
- package/dist/dlx/binary-download.js +11 -11
- package/dist/dlx/binary-resolution.js +16 -14
- package/dist/dlx/binary-types.d.ts +5 -5
- package/dist/dlx/binary.js +5 -5
- package/dist/dlx/cache.js +1 -1
- package/dist/dlx/detect.d.ts +34 -25
- package/dist/dlx/detect.js +86 -77
- package/dist/dlx/dir.js +2 -2
- package/dist/dlx/firewall.d.ts +1 -1
- package/dist/dlx/lockfile.d.ts +19 -18
- package/dist/dlx/lockfile.js +16 -16
- package/dist/dlx/manifest.d.ts +6 -6
- package/dist/dlx/manifest.js +5 -5
- package/dist/dlx/package.d.ts +10 -10
- package/dist/dlx/package.js +16 -16
- package/dist/dlx/packages.js +4 -4
- package/dist/dlx/paths.js +7 -7
- package/dist/dlx/spec.js +1 -1
- package/dist/dlx/types.d.ts +28 -27
- package/dist/eco/cargo/parse-lockfile.d.ts +1 -1
- package/dist/eco/cargo/parse-lockfile.js +2 -2
- package/dist/eco/manifest/analyze-lockfile.js +2 -2
- package/dist/eco/manifest/detect-format.js +4 -4
- package/dist/eco/manifest/find-packages.js +2 -2
- package/dist/eco/manifest/get-package-versions.js +2 -2
- package/dist/eco/manifest/get-package.js +2 -2
- package/dist/eco/manifest/parse-lockfile.js +2 -2
- package/dist/eco/manifest/parse-manifest.js +2 -2
- package/dist/eco/manifest/parse.js +2 -2
- package/dist/eco/npm/npm/exec.js +2 -2
- package/dist/eco/npm/npm/flags.js +7 -12
- package/dist/eco/npm/npm/parse-lockfile.d.ts +14 -14
- package/dist/eco/npm/npm/parse-lockfile.js +3 -3
- package/dist/eco/npm/parse-package-json.js +3 -3
- package/dist/eco/npm/pnpm/exec.d.ts +1 -1
- package/dist/eco/npm/pnpm/exec.js +5 -5
- package/dist/eco/npm/pnpm/flags.js +0 -3
- package/dist/eco/npm/pnpm/parse-lockfile.d.ts +1 -1
- package/dist/eco/npm/pnpm/parse-lockfile.js +4 -4
- package/dist/eco/npm/script.js +9 -6
- package/dist/eco/npm/yarnpkg/yarn/exec.js +3 -3
- package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.d.ts +2 -2
- package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.js +8 -8
- package/dist/effects/pulse-frames.d.ts +3 -1
- package/dist/effects/shimmer-keyframes.d.ts +1 -1
- package/dist/effects/shimmer-terminal.d.ts +1 -1
- package/dist/env/boolean.js +0 -1
- package/dist/env/ci.js +0 -1
- package/dist/env/debug.js +0 -1
- package/dist/env/github-status.d.ts +51 -0
- package/dist/env/github-status.js +90 -0
- package/dist/env/github.js +0 -8
- package/dist/env/home.js +0 -1
- package/dist/env/locale.js +0 -3
- package/dist/env/node-auth-token.js +0 -1
- package/dist/env/node-env.js +0 -1
- package/dist/env/node-version-managers.d.ts +53 -0
- package/dist/env/node-version-managers.js +90 -0
- package/dist/env/npm.js +0 -5
- package/dist/env/number.js +0 -1
- package/dist/env/package-manager.js +3 -6
- package/dist/env/path.js +0 -1
- package/dist/env/pre-commit.js +1 -2
- package/dist/env/rewire.d.ts +7 -6
- package/dist/env/rewire.js +15 -16
- package/dist/env/shell.js +0 -1
- package/dist/env/socket-cli.js +5 -18
- package/dist/env/socket-mcp.d.ts +114 -0
- package/dist/env/socket-mcp.js +146 -0
- package/dist/env/socket.d.ts +1 -109
- package/dist/env/socket.js +12 -167
- package/dist/env/string.js +0 -1
- package/dist/env/temp-dir.js +0 -3
- package/dist/env/term.js +0 -1
- package/dist/env/test.js +3 -6
- package/dist/env/windows.js +0 -4
- package/dist/env/xdg.js +0 -3
- package/dist/events/exit/_internal.d.ts +11 -9
- package/dist/events/exit/_internal.js +31 -35
- package/dist/events/exit/handler.js +3 -4
- package/dist/events/exit/intercept.js +4 -6
- package/dist/events/exit/lifecycle.js +16 -18
- package/dist/events/exit/signals.js +1 -2
- package/dist/events/exit/types.d.ts +6 -5
- package/dist/external/@npmcli/package-json.js +2 -2
- package/dist/external/npm-pack.js +2 -2
- package/dist/external-tools/bazel/read-bazel-version-file.js +1 -1
- package/dist/external-tools/bazel/types.d.ts +1 -1
- package/dist/external-tools/cdxgen/from-vfs.js +1 -1
- package/dist/external-tools/cdxgen/types.d.ts +1 -1
- package/dist/external-tools/from-download.d.ts +1 -1
- package/dist/external-tools/from-download.js +1 -1
- package/dist/external-tools/janus/from-vfs.js +1 -1
- package/dist/external-tools/janus/types.d.ts +1 -1
- package/dist/external-tools/jre/detect-platform-arch.d.ts +10 -6
- package/dist/external-tools/jre/detect-platform-arch.js +29 -14
- package/dist/external-tools/jre/from-vfs.js +1 -1
- package/dist/external-tools/jre/types.d.ts +1 -1
- package/dist/external-tools/manifest.d.ts +7 -7
- package/dist/external-tools/manifest.js +12 -12
- package/dist/external-tools/opengrep/from-vfs.js +1 -1
- package/dist/external-tools/opengrep/types.d.ts +1 -1
- package/dist/external-tools/python/asset-names.d.ts +76 -0
- package/dist/external-tools/python/asset-names.js +104 -0
- package/dist/external-tools/python/dlx.d.ts +80 -0
- package/dist/external-tools/python/dlx.js +87 -0
- package/dist/external-tools/python/from-download.d.ts +53 -0
- package/dist/external-tools/python/from-download.js +68 -0
- package/dist/external-tools/python/from-path.d.ts +7 -0
- package/dist/external-tools/python/from-path.js +23 -0
- package/dist/external-tools/python/pin.d.ts +121 -0
- package/dist/external-tools/python/pin.js +173 -0
- package/dist/external-tools/python/pip-install.d.ts +75 -0
- package/dist/external-tools/python/pip-install.js +139 -0
- package/dist/external-tools/python/resolve.d.ts +42 -0
- package/dist/external-tools/python/resolve.js +58 -0
- package/dist/external-tools/python/types.d.ts +49 -0
- package/dist/external-tools/sbt/from-vfs.js +1 -1
- package/dist/external-tools/sbt/types.d.ts +1 -1
- package/dist/external-tools/skillspector/from-path.js +3 -5
- package/dist/external-tools/skillspector/from-vfs.js +1 -1
- package/dist/external-tools/synp/from-download.js +2 -2
- package/dist/external-tools/synp/from-vfs.js +1 -1
- package/dist/external-tools/trivy/from-vfs.js +1 -1
- package/dist/external-tools/trivy/types.d.ts +1 -1
- package/dist/external-tools/trufflehog/from-vfs.js +1 -1
- package/dist/external-tools/trufflehog/types.d.ts +1 -1
- package/dist/fs/_internal.d.ts +1 -1
- package/dist/fs/_internal.js +7 -7
- package/dist/fs/access.js +5 -9
- package/dist/fs/{path-cache.js → allowed-dirs-cache.js} +1 -1
- package/dist/fs/encoding.js +5 -7
- package/dist/fs/{find-up.js → find.js} +11 -13
- package/dist/fs/inspect.js +7 -13
- package/dist/fs/read-dir.js +7 -10
- package/dist/fs/read-file.js +8 -14
- package/dist/fs/read-json-cache.d.ts +6 -4
- package/dist/fs/read-json-cache.js +9 -6
- package/dist/fs/read-json.js +4 -6
- package/dist/fs/resolve-module.js +1 -1
- package/dist/fs/safe.d.ts +1 -1
- package/dist/fs/safe.js +12 -13
- package/dist/fs/unique.js +4 -5
- package/dist/fs/validate.js +1 -2
- package/dist/fs/write-json.js +4 -5
- package/dist/git/_internal.js +10 -10
- package/dist/git/changed.js +4 -4
- package/dist/git/repo.js +3 -3
- package/dist/git/staged.js +4 -4
- package/dist/git/unstaged.js +4 -4
- package/dist/github/ghsa.js +2 -2
- package/dist/github/refs-cache.d.ts +1 -1
- package/dist/github/refs-cache.js +5 -5
- package/dist/github/refs-rest.js +5 -5
- package/dist/github/{fetch.js → request.js} +13 -2
- package/dist/github/token.js +1 -1
- package/dist/github/types.d.ts +1 -1
- package/dist/globs/_internal.js +7 -9
- package/dist/globs/match.js +4 -6
- package/dist/globs/matcher.d.ts +3 -3
- package/dist/globs/matcher.js +12 -14
- package/dist/globs/stream.js +1 -2
- package/dist/globs/types.d.ts +24 -24
- package/dist/http-request/_internal.d.ts +1 -1
- package/dist/http-request/browser.js +4 -2
- package/dist/http-request/checksum-file.d.ts +55 -0
- package/dist/http-request/checksum-file.js +95 -0
- package/dist/http-request/download-types.d.ts +15 -23
- package/dist/http-request/download.js +3 -3
- package/dist/http-request/headers.js +0 -1
- package/dist/http-request/request-attempt.js +37 -33
- package/dist/http-request/request-types.d.ts +2 -2
- package/dist/http-request/request.js +1 -1
- package/dist/http-request/user-agent.js +3 -4
- package/dist/integrity.d.ts +86 -18
- package/dist/integrity.js +119 -30
- package/dist/ipc/directory.js +2 -2
- package/dist/ipc/paths.js +1 -1
- package/dist/ipc/write.js +1 -1
- package/dist/ipc-cli/get.js +12 -12
- package/dist/json/edit.js +13 -14
- package/dist/json/format.js +2 -2
- package/dist/json/parse.d.ts +1 -1
- package/dist/json/parse.js +3 -7
- package/dist/logger/_internal.d.ts +4 -4
- package/dist/logger/_internal.js +3 -3
- package/dist/logger/colors.js +4 -3
- package/dist/logger/console-methods.d.ts +132 -0
- package/dist/logger/console-methods.js +169 -0
- package/dist/logger/console.d.ts +12 -0
- package/dist/logger/console.js +42 -11
- package/dist/logger/indentation-methods.d.ts +81 -0
- package/dist/logger/indentation-methods.js +121 -0
- package/dist/logger/node.d.ts +16 -338
- package/dist/logger/node.js +75 -608
- package/dist/logger/options.d.ts +39 -0
- package/dist/logger/options.js +47 -0
- package/dist/logger/semantic-methods.d.ts +63 -0
- package/dist/logger/semantic-methods.js +108 -0
- package/dist/logger/stream-methods.d.ts +63 -0
- package/dist/logger/stream-methods.js +101 -0
- package/dist/logger/stream.d.ts +37 -0
- package/dist/logger/stream.js +42 -0
- package/dist/logger/symbols-builder.js +9 -9
- package/dist/logger/symbols.d.ts +2 -25
- package/dist/logger/symbols.js +53 -74
- package/dist/logger/types.d.ts +1 -1
- package/dist/memo/types.d.ts +6 -6
- package/dist/native-messaging/host.d.ts +20 -0
- package/dist/native-messaging/host.js +120 -0
- package/dist/native-messaging/index.d.ts +5 -0
- package/dist/native-messaging/index.js +22 -0
- package/dist/native-messaging/install.d.ts +60 -0
- package/dist/native-messaging/install.js +141 -0
- package/dist/native-messaging/rate-limit.d.ts +62 -0
- package/dist/native-messaging/rate-limit.js +115 -0
- package/dist/native-messaging/run.d.ts +10 -0
- package/dist/native-messaging/run.js +17 -0
- package/dist/node/async-hooks.js +4 -3
- package/dist/node/child-process.js +4 -3
- package/dist/node/crypto.js +4 -3
- package/dist/node/events.js +4 -3
- package/dist/node/fs-promises.js +4 -3
- package/dist/node/fs.js +4 -3
- package/dist/node/http.js +4 -3
- package/dist/node/https.js +4 -3
- package/dist/node/module.js +10 -6
- package/dist/node/os.js +4 -3
- package/dist/node/path.js +4 -3
- package/dist/node/timers-promises.js +4 -3
- package/dist/node/url.js +4 -3
- package/dist/node/util.js +4 -3
- package/dist/objects/getters.js +5 -7
- package/dist/objects/inspect.js +1 -4
- package/dist/objects/mutate.js +2 -3
- package/dist/objects/predicates.js +0 -4
- package/dist/objects/sort.js +3 -7
- package/dist/packages/edit-class.js +15 -16
- package/dist/packages/edit.js +12 -14
- package/dist/packages/exports.js +11 -17
- package/dist/packages/fetch.d.ts +16 -0
- package/dist/packages/fetch.js +81 -0
- package/dist/packages/find.d.ts +55 -0
- package/dist/packages/find.js +65 -0
- package/dist/packages/isolation.js +14 -14
- package/dist/packages/licenses.js +16 -16
- package/dist/packages/manifest.js +12 -15
- package/dist/packages/metadata-extensions.d.ts +14 -0
- package/dist/packages/metadata-extensions.js +43 -0
- package/dist/packages/normalize.js +5 -9
- package/dist/packages/provenance.js +16 -18
- package/dist/packages/read.d.ts +29 -0
- package/dist/packages/read.js +66 -0
- package/dist/packages/specs.d.ts +48 -1
- package/dist/packages/specs.js +74 -11
- package/dist/packages/tarball.d.ts +24 -0
- package/dist/packages/tarball.js +79 -0
- package/dist/packages/types.d.ts +21 -20
- package/dist/packages/validation.js +0 -3
- package/dist/paths/_internal.d.ts +2 -1
- package/dist/paths/_internal.js +7 -19
- package/dist/paths/conversion.js +5 -9
- package/dist/paths/filenames.d.ts +0 -1
- package/dist/paths/filenames.js +0 -2
- package/dist/paths/normalize.js +4 -5
- package/dist/paths/packages.js +4 -7
- package/dist/paths/predicates.js +9 -16
- package/dist/paths/resolve.js +11 -14
- package/dist/paths/rewire.js +3 -3
- package/dist/paths/socket.js +16 -16
- package/dist/paths/walk.d.ts +1 -1
- package/dist/paths/walk.js +4 -4
- package/dist/perf/report.js +2 -2
- package/dist/perf/types.d.ts +1 -1
- package/dist/pkg-ext/data.js +1 -1
- package/dist/primordials/array.js +9 -9
- package/dist/primordials/date.js +2 -2
- package/dist/primordials/error.js +3 -3
- package/dist/primordials/headers.d.ts +10 -0
- package/dist/primordials/headers.js +23 -0
- package/dist/primordials/intl.d.ts +13 -0
- package/dist/primordials/intl.js +26 -0
- package/dist/primordials/math.js +33 -33
- package/dist/primordials/number.js +9 -9
- package/dist/primordials/object.js +5 -5
- package/dist/primordials/string.d.ts +2 -2
- package/dist/primordials/string.js +6 -6
- package/dist/primordials/symbol.js +3 -3
- package/dist/primordials/uncurry.js +9 -9
- package/dist/process/abort.js +3 -3
- package/dist/process/lock-manager.js +8 -8
- package/dist/process/spawn/_internal.js +6 -8
- package/dist/process/spawn/child.js +14 -14
- package/dist/process/spawn/errors.js +2 -4
- package/dist/process/spawn/kill-tree.d.ts +53 -0
- package/dist/process/spawn/kill-tree.js +85 -0
- package/dist/process/spawn/stdio.js +0 -1
- package/dist/process/spawn/types.d.ts +5 -5
- package/dist/process/transient.js +2 -2
- package/dist/promises/_internal.d.ts +2 -1
- package/dist/promises/_internal.js +2 -6
- package/dist/promises/iterate.js +11 -15
- package/dist/promises/options.js +3 -6
- package/dist/promises/retry.js +4 -5
- package/dist/promises/timers.d.ts +30 -0
- package/dist/promises/timers.js +48 -0
- package/dist/releases/github-archives.d.ts +6 -6
- package/dist/releases/github-archives.js +2 -2
- package/dist/releases/github-asset-url.d.ts +1 -1
- package/dist/releases/github-asset-url.js +5 -5
- package/dist/releases/github-downloads.d.ts +1 -1
- package/dist/releases/github-downloads.js +3 -3
- package/dist/releases/github-listing.d.ts +11 -2
- package/dist/releases/github-listing.js +20 -7
- package/dist/releases/github-retry-config.js +1 -1
- package/dist/releases/github-types.d.ts +6 -6
- package/dist/releases/socket-btm-binary-naming.d.ts +107 -0
- package/dist/releases/socket-btm-binary-naming.js +155 -0
- package/dist/releases/socket-btm.d.ts +8 -115
- package/dist/releases/socket-btm.js +16 -159
- package/dist/schema/types.d.ts +1 -1
- package/dist/sea/detect.js +6 -6
- package/dist/secrets/_internal.d.ts +2 -2
- package/dist/secrets/_internal.js +2 -2
- package/dist/secrets/compare.d.ts +45 -0
- package/dist/secrets/compare.js +61 -0
- package/dist/secrets/keychain.js +6 -4
- package/dist/secrets/linux.js +19 -19
- package/dist/secrets/macos.d.ts +1 -1
- package/dist/secrets/macos.js +13 -13
- package/dist/secrets/rc.d.ts +2 -2
- package/dist/secrets/rc.js +6 -4
- package/dist/secrets/socket-api-token.d.ts +4 -4
- package/dist/secrets/socket-api-token.js +18 -9
- package/dist/secrets/windows.js +14 -13
- package/dist/shadow/skip.js +2 -2
- package/dist/smol/detect.js +9 -10
- package/dist/smol/http.js +6 -7
- package/dist/smol/https.js +6 -7
- package/dist/smol/manifest.d.ts +1 -1
- package/dist/smol/manifest.js +6 -7
- package/dist/smol/path.d.ts +1 -1
- package/dist/smol/path.js +7 -8
- package/dist/smol/primordial.d.ts +4 -0
- package/dist/smol/primordial.js +6 -7
- package/dist/smol/purl.d.ts +1 -1
- package/dist/smol/purl.js +7 -8
- package/dist/smol/versions.js +6 -7
- package/dist/smol/vfs.js +6 -7
- package/dist/sorts/_internal.js +6 -8
- package/dist/sorts/natural.js +10 -12
- package/dist/sorts/semver.js +1 -2
- package/dist/sorts/strings.js +0 -1
- package/dist/sorts/types.d.ts +1 -1
- package/dist/spinner/create-spinner-class.d.ts +38 -0
- package/dist/spinner/create-spinner-class.js +302 -0
- package/dist/spinner/default.js +8 -9
- package/dist/spinner/spinner-internals.d.ts +36 -0
- package/dist/spinner/spinner-internals.js +101 -0
- package/dist/spinner/spinner-shimmer-methods.d.ts +54 -0
- package/dist/spinner/spinner-shimmer-methods.js +143 -0
- package/dist/spinner/spinner-status-methods.d.ts +40 -0
- package/dist/spinner/spinner-status-methods.js +133 -0
- package/dist/spinner/spinner.d.ts +4 -5
- package/dist/spinner/spinner.js +18 -705
- package/dist/spinner/types.d.ts +3 -1
- package/dist/spinner/with.d.ts +10 -0
- package/dist/spinner/with.js +16 -2
- package/dist/stdio/divider.js +1 -1
- package/dist/stdio/footer.js +3 -3
- package/dist/stdio/header.js +4 -4
- package/dist/stdio/progress.js +5 -5
- package/dist/stdio/prompts.d.ts +5 -3
- package/dist/stdio/prompts.js +6 -7
- package/dist/stdio/stdout.js +3 -3
- package/dist/streams/parallel.js +3 -5
- package/dist/streams/transform.js +2 -3
- package/dist/strings/format.js +2 -6
- package/dist/strings/predicates.js +0 -2
- package/dist/strings/search.js +1 -2
- package/dist/strings/transform.js +0 -3
- package/dist/strings/width.js +9 -10
- package/dist/tables/bordered.js +4 -3
- package/dist/tables/padding.js +1 -1
- package/dist/tables/simple.js +8 -5
- package/dist/temporal/instant.js +1 -1
- package/dist/temporal/slots.js +6 -6
- package/dist/temporal/system.js +9 -9
- package/dist/themes/context.d.ts +3 -2
- package/dist/themes/context.js +4 -5
- package/dist/themes/themes.js +15 -15
- package/dist/themes/types.d.ts +3 -3
- package/dist/url/parse.js +0 -2
- package/dist/url/predicates.js +1 -2
- package/dist/url/search-params.js +3 -9
- package/dist/url/types.d.ts +5 -5
- package/dist/versions/_internal.js +3 -3
- package/dist/words/article.js +0 -1
- package/dist/words/capitalize.js +0 -1
- package/dist/words/pluralize.js +15 -5
- package/package.json +247 -106
- package/dist/external-tools/uv/asset-names.d.ts +0 -36
- package/dist/external-tools/uv/asset-names.js +0 -70
- package/dist/external-tools/uv/from-download.d.ts +0 -17
- package/dist/external-tools/uv/from-download.js +0 -47
- package/dist/external-tools/uv/from-path.d.ts +0 -5
- package/dist/external-tools/uv/from-path.js +0 -22
- package/dist/external-tools/uv/from-vfs.d.ts +0 -7
- package/dist/external-tools/uv/from-vfs.js +0 -26
- package/dist/external-tools/uv/resolve.d.ts +0 -25
- package/dist/external-tools/uv/resolve.js +0 -53
- package/dist/external-tools/uv/types.d.ts +0 -24
- package/dist/http-request/checksums.d.ts +0 -69
- package/dist/http-request/checksums.js +0 -108
- package/dist/http-request/http-request.d.ts +0 -12
- package/dist/http-request/http-request.js +0 -11
- package/dist/packages/operations.d.ts +0 -113
- package/dist/packages/operations.js +0 -304
- package/dist/ssri/convert.d.ts +0 -48
- package/dist/ssri/convert.js +0 -69
- package/dist/ssri/parse.d.ts +0 -27
- package/dist/ssri/parse.js +0 -41
- package/dist/ssri/validate.d.ts +0 -41
- package/dist/ssri/validate.js +0 -56
- /package/dist/{bin → cli}/check.d.ts +0 -0
- /package/dist/external-tools/{uv → python}/types.js +0 -0
- /package/dist/fs/{path-cache.d.ts → allowed-dirs-cache.d.ts} +0 -0
- /package/dist/fs/{find-up.d.ts → find.d.ts} +0 -0
- /package/dist/github/{fetch.d.ts → request.d.ts} +0 -0
|
@@ -33,7 +33,6 @@ const fileReferenceRegExp = /^SEE LICEN[CS]E IN (.+)$/;
|
|
|
33
33
|
* // incompatible contains only the GPL-3.0 node
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
37
36
|
function collectIncompatibleLicenses(licenseNodes) {
|
|
38
37
|
const result = [];
|
|
39
38
|
for (let i = 0, { length } = licenseNodes; i < length; i += 1) {
|
|
@@ -51,7 +50,6 @@ function collectIncompatibleLicenses(licenseNodes) {
|
|
|
51
50
|
* collectLicenseWarnings(nodes) // ['Package is unlicensed']
|
|
52
51
|
* ```
|
|
53
52
|
*/
|
|
54
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
55
53
|
function collectLicenseWarnings(licenseNodes) {
|
|
56
54
|
const warnings = new require_primordials_map_set.MapCtor();
|
|
57
55
|
for (let i = 0, { length } = licenseNodes; i < length; i += 1) {
|
|
@@ -73,9 +71,8 @@ function collectLicenseWarnings(licenseNodes) {
|
|
|
73
71
|
* // node.type === 'License'
|
|
74
72
|
* ```
|
|
75
73
|
*/
|
|
76
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
77
74
|
function createAstNode(rawNode) {
|
|
78
|
-
return
|
|
75
|
+
return require_objects_predicates.hasOwn(rawNode, "license") ? createLicenseNode(rawNode) : createBinaryOperationNode(rawNode);
|
|
79
76
|
}
|
|
80
77
|
/**
|
|
81
78
|
* Create a binary operation AST node.
|
|
@@ -91,7 +88,6 @@ function createAstNode(rawNode) {
|
|
|
91
88
|
* // node.type === 'BinaryOperation'
|
|
92
89
|
* ```
|
|
93
90
|
*/
|
|
94
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
95
91
|
function createBinaryOperationNode(rawNodeParam) {
|
|
96
92
|
let left;
|
|
97
93
|
let right;
|
|
@@ -103,7 +99,7 @@ function createBinaryOperationNode(rawNodeParam) {
|
|
|
103
99
|
type: BINARY_OPERATION_NODE_TYPE,
|
|
104
100
|
get left() {
|
|
105
101
|
if (left === void 0) {
|
|
106
|
-
left =
|
|
102
|
+
left = createAstNode(rawLeft);
|
|
107
103
|
rawLeft = void 0;
|
|
108
104
|
}
|
|
109
105
|
return left;
|
|
@@ -111,7 +107,7 @@ function createBinaryOperationNode(rawNodeParam) {
|
|
|
111
107
|
conjunction,
|
|
112
108
|
get right() {
|
|
113
109
|
if (right === void 0) {
|
|
114
|
-
right =
|
|
110
|
+
right = createAstNode(rawRight);
|
|
115
111
|
rawRight = void 0;
|
|
116
112
|
}
|
|
117
113
|
return right;
|
|
@@ -127,7 +123,6 @@ function createBinaryOperationNode(rawNodeParam) {
|
|
|
127
123
|
* // node.type === 'License' && node.license === 'MIT'
|
|
128
124
|
* ```
|
|
129
125
|
*/
|
|
130
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
131
126
|
function createLicenseNode(rawNode) {
|
|
132
127
|
return {
|
|
133
128
|
__proto__: null,
|
|
@@ -144,7 +139,6 @@ function createLicenseNode(rawNode) {
|
|
|
144
139
|
* // ast is a BinaryOperation node with MIT and Apache-2.0 leaves
|
|
145
140
|
* ```
|
|
146
141
|
*/
|
|
147
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
148
142
|
function parseSpdxExp(spdxExp) {
|
|
149
143
|
try {
|
|
150
144
|
return (0, src_external_spdx_expression_parse.default)(spdxExp);
|
|
@@ -161,16 +155,23 @@ function parseSpdxExp(spdxExp) {
|
|
|
161
155
|
* // [{ license: 'MIT' }]
|
|
162
156
|
* ```
|
|
163
157
|
*/
|
|
164
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
165
158
|
function resolvePackageLicenses(licenseFieldValue, where) {
|
|
166
|
-
if (licenseFieldValue === "
|
|
159
|
+
if (licenseFieldValue === "UNLICENCED" || licenseFieldValue === "UNLICENSED") return [{ license: "UNLICENSED" }];
|
|
167
160
|
const match = require_primordials_regexp.RegExpPrototypeExec(fileReferenceRegExp, licenseFieldValue);
|
|
168
161
|
if (match) return [{
|
|
169
162
|
license: licenseFieldValue,
|
|
170
|
-
inFile:
|
|
163
|
+
inFile: require_paths_normalize.normalizePath(require_node_path.getNodePath().relative(where, match[1] || ""))
|
|
171
164
|
}];
|
|
172
165
|
const licenseNodes = [];
|
|
173
|
-
|
|
166
|
+
const ast = parseSpdxExp(licenseFieldValue);
|
|
167
|
+
if (ast) visitLicenses(ast, { License(node) {
|
|
168
|
+
const { license } = node;
|
|
169
|
+
if (license.startsWith("LicenseRef") || license.startsWith("DocumentRef")) {
|
|
170
|
+
licenseNodes.length = 0;
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
licenseNodes.push(node);
|
|
174
|
+
} });
|
|
174
175
|
return licenseNodes;
|
|
175
176
|
}
|
|
176
177
|
/**
|
|
@@ -190,9 +191,8 @@ function resolvePackageLicenses(licenseFieldValue, where) {
|
|
|
190
191
|
* // licenses === ['MIT', 'Apache-2.0']
|
|
191
192
|
* ```
|
|
192
193
|
*/
|
|
193
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
194
194
|
function visitLicenses(ast, visitor) {
|
|
195
|
-
const queue = [[
|
|
195
|
+
const queue = [[createAstNode(ast), void 0]];
|
|
196
196
|
let pos = 0;
|
|
197
197
|
let { length: queueLength } = queue;
|
|
198
198
|
while (pos < queueLength) {
|
|
@@ -200,7 +200,7 @@ function visitLicenses(ast, visitor) {
|
|
|
200
200
|
const { 0: node, 1: parent } = queue[pos++];
|
|
201
201
|
const { type } = node;
|
|
202
202
|
const visitorRecord = visitor;
|
|
203
|
-
if (typeof visitorRecord[type] === "function" &&
|
|
203
|
+
if (typeof visitorRecord[type] === "function" && require_objects_predicates.hasOwn(visitor, type)) {
|
|
204
204
|
if (type === LICENSE_NODE_TYPE) {
|
|
205
205
|
const licenseVisitor = visitorRecord["License"];
|
|
206
206
|
if (typeof licenseVisitor === "function" && licenseVisitor(node, parent) === false) break;
|
|
@@ -23,9 +23,9 @@ src_external_npm_package_arg = require_runtime.__toESM(src_external_npm_package_
|
|
|
23
23
|
* @file Package manifest and packument fetching utilities.
|
|
24
24
|
*/
|
|
25
25
|
const abortSignal = require_process_abort.getAbortSignal();
|
|
26
|
-
const packageDefaultNodeRange =
|
|
27
|
-
const PACKAGE_DEFAULT_SOCKET_CATEGORIES =
|
|
28
|
-
const packumentCache =
|
|
26
|
+
const packageDefaultNodeRange = require_constants_packages.getPackageDefaultNodeRange();
|
|
27
|
+
const PACKAGE_DEFAULT_SOCKET_CATEGORIES = require_constants_packages.getPackageDefaultSocketCategories();
|
|
28
|
+
const packumentCache = require_constants_packages.getPackumentCache();
|
|
29
29
|
const pkgScopePrefixRegExp = /^@socketregistry\//;
|
|
30
30
|
/**
|
|
31
31
|
* Create a package.json object for a Socket registry package.
|
|
@@ -38,14 +38,13 @@ const pkgScopePrefixRegExp = /^@socketregistry\//;
|
|
|
38
38
|
* })
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
42
41
|
function createPackageJson(sockRegPkgName, directory, options) {
|
|
43
42
|
const { dependencies, description, engines, exports: entryExportsRaw, files, keywords, main, overrides, resolutions, sideEffects, socket, type, version } = {
|
|
44
43
|
__proto__: null,
|
|
45
44
|
...options
|
|
46
45
|
};
|
|
47
46
|
const name = `@socketregistry/${sockRegPkgName.replace(pkgScopePrefixRegExp, "")}`;
|
|
48
|
-
const entryExports =
|
|
47
|
+
const entryExports = require_packages_exports.resolvePackageJsonEntryExports(entryExportsRaw);
|
|
49
48
|
const githubUrl = `https://github.com/${require_constants_socket.SOCKET_GITHUB_ORG}/${require_constants_socket.SOCKET_REGISTRY_REPO_NAME}`;
|
|
50
49
|
return {
|
|
51
50
|
__proto__: null,
|
|
@@ -61,13 +60,13 @@ function createPackageJson(sockRegPkgName, directory, options) {
|
|
|
61
60
|
directory
|
|
62
61
|
},
|
|
63
62
|
...type ? { type } : {},
|
|
64
|
-
|
|
63
|
+
...require_objects_predicates.isPlainObject(entryExports) ? { exports: { ...entryExports } } : {},
|
|
65
64
|
...entryExports ? {} : { main: `${main ?? "./index.js"}` },
|
|
66
65
|
sideEffects: sideEffects !== void 0 && !!sideEffects,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
...require_objects_predicates.isPlainObject(dependencies) ? { dependencies: { ...dependencies } } : {},
|
|
67
|
+
...require_objects_predicates.isPlainObject(overrides) ? { overrides: { ...overrides } } : {},
|
|
68
|
+
...require_objects_predicates.isPlainObject(resolutions) ? { resolutions: { ...resolutions } } : {},
|
|
69
|
+
...require_objects_predicates.isPlainObject(engines) ? { engines: require_primordials_object.ObjectFromEntries(require_objects_sort.objectEntries(engines).map((pair) => {
|
|
71
70
|
const strKey = String(pair[0]);
|
|
72
71
|
const result = [strKey, pair[1]];
|
|
73
72
|
if (strKey === "node") {
|
|
@@ -80,7 +79,7 @@ function createPackageJson(sockRegPkgName, directory, options) {
|
|
|
80
79
|
return result;
|
|
81
80
|
})) } : { engines: { node: packageDefaultNodeRange } },
|
|
82
81
|
files: require_arrays_predicates.isArray(files) ? files.slice() : ["*.d.ts", "*.js"],
|
|
83
|
-
|
|
82
|
+
...require_objects_predicates.isPlainObject(socket) ? { socket: { ...socket } } : { socket: { categories: PACKAGE_DEFAULT_SOCKET_CATEGORIES } }
|
|
84
83
|
};
|
|
85
84
|
}
|
|
86
85
|
/**
|
|
@@ -91,7 +90,6 @@ function createPackageJson(sockRegPkgName, directory, options) {
|
|
|
91
90
|
* const manifest = await fetchPackageManifest('lodash@4.17.21')
|
|
92
91
|
* ```
|
|
93
92
|
*/
|
|
94
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
95
93
|
async function fetchPackageManifest(pkgNameOrId, options) {
|
|
96
94
|
const pacoteOptions = {
|
|
97
95
|
__proto__: null,
|
|
@@ -108,11 +106,11 @@ async function fetchPackageManifest(pkgNameOrId, options) {
|
|
|
108
106
|
} catch {}
|
|
109
107
|
if (signal?.aborted) return;
|
|
110
108
|
if (result) {
|
|
111
|
-
if (
|
|
109
|
+
if (require_packages_validation.isRegistryFetcherType((0, src_external_npm_package_arg.default)(pkgNameOrId, pacoteOptions.where).type)) return result;
|
|
112
110
|
}
|
|
113
111
|
if (result) {
|
|
114
112
|
const typedResult = result;
|
|
115
|
-
return await
|
|
113
|
+
return await fetchPackageManifest(`${typedResult.name}@${typedResult.version}`, pacoteOptions);
|
|
116
114
|
}
|
|
117
115
|
}
|
|
118
116
|
/**
|
|
@@ -123,7 +121,6 @@ async function fetchPackageManifest(pkgNameOrId, options) {
|
|
|
123
121
|
* const packument = await fetchPackagePackument('lodash')
|
|
124
122
|
* ```
|
|
125
123
|
*/
|
|
126
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
127
124
|
async function fetchPackagePackument(pkgNameOrId, options) {
|
|
128
125
|
try {
|
|
129
126
|
return await src_external_pacote.default.packument(pkgNameOrId, {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Package-extension lookup: match a package name + version against the
|
|
3
|
+
* `packageExtensions` overrides table (the same data pnpm/yarn use to patch
|
|
4
|
+
* missing dependency metadata) and merge the matching entries.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Find package extensions for a given package.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ;```typescript
|
|
11
|
+
* const extensions = findPackageExtensions('my-pkg', '1.0.0')
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function findPackageExtensions(pkgName: string, pkgVer: string): unknown;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with rolldown */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
|
+
const require_objects_mutate = require('../objects/mutate.js');
|
|
6
|
+
const require_constants_packages = require('../constants/packages.js');
|
|
7
|
+
let src_external_semver = require("../external/semver");
|
|
8
|
+
src_external_semver = require_runtime.__toESM(src_external_semver);
|
|
9
|
+
|
|
10
|
+
//#region src/packages/metadata-extensions.ts
|
|
11
|
+
/**
|
|
12
|
+
* @file Package-extension lookup: match a package name + version against the
|
|
13
|
+
* `packageExtensions` overrides table (the same data pnpm/yarn use to patch
|
|
14
|
+
* missing dependency metadata) and merge the matching entries.
|
|
15
|
+
*/
|
|
16
|
+
const packageExtensions = require_constants_packages.getPackageExtensions();
|
|
17
|
+
/**
|
|
18
|
+
* Find package extensions for a given package.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ;```typescript
|
|
22
|
+
* const extensions = findPackageExtensions('my-pkg', '1.0.0')
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
function findPackageExtensions(pkgName, pkgVer) {
|
|
26
|
+
let result;
|
|
27
|
+
for (const entry of packageExtensions) {
|
|
28
|
+
const selector = String(entry[0]);
|
|
29
|
+
const ext = entry[1];
|
|
30
|
+
const lastAtSignIndex = selector.lastIndexOf("@");
|
|
31
|
+
if (pkgName === selector.slice(0, lastAtSignIndex)) {
|
|
32
|
+
const range = selector.slice(lastAtSignIndex + 1);
|
|
33
|
+
if (src_external_semver.satisfies(pkgVer, range)) {
|
|
34
|
+
if (result === void 0) result = {};
|
|
35
|
+
if (typeof ext === "object" && ext !== null) require_objects_mutate.merge(result, ext);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
exports.findPackageExtensions = findPackageExtensions;
|
|
@@ -9,7 +9,7 @@ const require_primordials_object = require('../primordials/object.js');
|
|
|
9
9
|
const require_objects_mutate = require('../objects/mutate.js');
|
|
10
10
|
const require_constants_socket = require('../constants/socket.js');
|
|
11
11
|
const require_regexps_escape = require('../regexps/escape.js');
|
|
12
|
-
const
|
|
12
|
+
const require_packages_metadata_extensions = require('./metadata-extensions.js');
|
|
13
13
|
let src_external_normalize_package_data = require("../external/normalize-package-data");
|
|
14
14
|
src_external_normalize_package_data = require_runtime.__toESM(src_external_normalize_package_data);
|
|
15
15
|
|
|
@@ -30,7 +30,6 @@ function getEscapedScopeRegExp() {
|
|
|
30
30
|
* const normalized = normalizePackageJson(pkgJson)
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
34
33
|
function normalizePackageJson(pkgJson, options) {
|
|
35
34
|
const { preserve } = {
|
|
36
35
|
__proto__: null,
|
|
@@ -47,8 +46,8 @@ function normalizePackageJson(pkgJson, options) {
|
|
|
47
46
|
];
|
|
48
47
|
(0, src_external_normalize_package_data.default)(pkgJson);
|
|
49
48
|
if (pkgJson.name && pkgJson.version) {
|
|
50
|
-
const extensions =
|
|
51
|
-
if (extensions && typeof extensions === "object")
|
|
49
|
+
const extensions = require_packages_metadata_extensions.findPackageExtensions(pkgJson.name, pkgJson.version);
|
|
50
|
+
if (extensions && typeof extensions === "object") require_objects_mutate.merge(pkgJson, extensions);
|
|
52
51
|
}
|
|
53
52
|
for (const { 0: key, 1: value } of preserved) pkgJson[key] = value;
|
|
54
53
|
return pkgJson;
|
|
@@ -62,7 +61,6 @@ function normalizePackageJson(pkgJson, options) {
|
|
|
62
61
|
* resolveEscapedScope('lodash') // undefined
|
|
63
62
|
* ```
|
|
64
63
|
*/
|
|
65
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
66
64
|
function resolveEscapedScope(sockRegPkgName) {
|
|
67
65
|
return require_primordials_regexp.RegExpPrototypeExec(getEscapedScopeRegExp(), sockRegPkgName)?.[0] || void 0;
|
|
68
66
|
}
|
|
@@ -74,11 +72,10 @@ function resolveEscapedScope(sockRegPkgName) {
|
|
|
74
72
|
* resolveOriginalPackageName('@socketregistry/is-number') // 'is-number'
|
|
75
73
|
* ```
|
|
76
74
|
*/
|
|
77
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
78
75
|
function resolveOriginalPackageName(sockRegPkgName) {
|
|
79
76
|
const name = require_primordials_string.StringPrototypeStartsWith(sockRegPkgName, `${"@socketregistry"}/`) ? sockRegPkgName.slice(require_constants_socket.SOCKET_REGISTRY_SCOPE.length + 1) : sockRegPkgName;
|
|
80
|
-
const escapedScope =
|
|
81
|
-
return escapedScope ? `${
|
|
77
|
+
const escapedScope = resolveEscapedScope(name);
|
|
78
|
+
return escapedScope ? `${unescapeScope(escapedScope)}/${require_primordials_string.StringPrototypeSlice(name, escapedScope.length)}` : name;
|
|
82
79
|
}
|
|
83
80
|
/**
|
|
84
81
|
* Convert escaped scope to standard npm scope format.
|
|
@@ -88,7 +85,6 @@ function resolveOriginalPackageName(sockRegPkgName) {
|
|
|
88
85
|
* unescapeScope('babel__') // '@babel'
|
|
89
86
|
* ```
|
|
90
87
|
*/
|
|
91
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
92
88
|
function unescapeScope(escapedScope) {
|
|
93
89
|
if (escapedScope.length < "__".length) return `@${escapedScope}`;
|
|
94
90
|
return `@${escapedScope.slice(0, -"__".length)}`;
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
5
|
const require_primordials_buffer = require('../primordials/buffer.js');
|
|
6
|
-
const require_primordials_string = require('../primordials/string.js');
|
|
7
6
|
const require_abort_signal = require('../abort/signal.js');
|
|
7
|
+
const require_primordials_string = require('../primordials/string.js');
|
|
8
8
|
const require_primordials_array = require('../primordials/array.js');
|
|
9
|
-
const require_primordials_object = require('../primordials/object.js');
|
|
10
9
|
const require_primordials_json = require('../primordials/json.js');
|
|
10
|
+
const require_primordials_object = require('../primordials/object.js');
|
|
11
11
|
const require_objects_predicates = require('../objects/predicates.js');
|
|
12
12
|
const require_constants_agents = require('../constants/agents.js');
|
|
13
13
|
const require_constants_packages = require('../constants/packages.js');
|
|
@@ -21,7 +21,7 @@ src_external_make_fetch_happen = require_runtime.__toESM(src_external_make_fetch
|
|
|
21
21
|
*/
|
|
22
22
|
const SLSA_PROVENANCE_V0_2 = "https://slsa.dev/provenance/v0.2";
|
|
23
23
|
const SLSA_PROVENANCE_V1_0 = "https://slsa.dev/provenance/v1";
|
|
24
|
-
let
|
|
24
|
+
let cachedFetcher;
|
|
25
25
|
/**
|
|
26
26
|
* Comparator ordering two trust statuses by ascending trust level. Sorts an
|
|
27
27
|
* array of statuses lowest-trust-first; negate for highest-first.
|
|
@@ -50,7 +50,6 @@ function didTrustDecrease(prev, next) {
|
|
|
50
50
|
* const provenance = await fetchPackageProvenance('lodash', '4.17.21')
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
54
53
|
async function fetchPackageProvenance(pkgName, pkgVersion, options) {
|
|
55
54
|
const { signal, timeout = 1e4 } = {
|
|
56
55
|
__proto__: null,
|
|
@@ -58,7 +57,7 @@ async function fetchPackageProvenance(pkgName, pkgVersion, options) {
|
|
|
58
57
|
};
|
|
59
58
|
if (signal?.aborted) return;
|
|
60
59
|
const compositeSignal = require_abort_signal.createCompositeAbortSignal(signal, require_abort_signal.createTimeoutSignal(timeout));
|
|
61
|
-
const fetcher =
|
|
60
|
+
const fetcher = getFetcher();
|
|
62
61
|
try {
|
|
63
62
|
const response = await fetcher(`${require_constants_agents.NPM_REGISTRY_URL}/-/npm/v1/attestations/${encodeURIComponent(pkgName)}@${encodeURIComponent(pkgVersion)}`, {
|
|
64
63
|
method: "GET",
|
|
@@ -72,8 +71,8 @@ async function fetchPackageProvenance(pkgName, pkgVersion, options) {
|
|
|
72
71
|
* Find the first attestation with valid provenance data.
|
|
73
72
|
*/
|
|
74
73
|
function findProvenance(attestations) {
|
|
75
|
-
for (
|
|
76
|
-
const att =
|
|
74
|
+
for (let i = 0, { length } = attestations; i < length; i += 1) {
|
|
75
|
+
const att = attestations[i];
|
|
77
76
|
try {
|
|
78
77
|
let predicate = att.predicate;
|
|
79
78
|
if (!predicate && att.bundle?.dsseEnvelope?.payload) try {
|
|
@@ -100,13 +99,12 @@ function getAttestations(attestationData) {
|
|
|
100
99
|
return att.predicateType === SLSA_PROVENANCE_V0_2 || att.predicateType === SLSA_PROVENANCE_V1_0;
|
|
101
100
|
});
|
|
102
101
|
}
|
|
103
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
104
102
|
function getFetcher() {
|
|
105
|
-
if (
|
|
106
|
-
cachePath:
|
|
103
|
+
if (cachedFetcher === void 0) cachedFetcher = src_external_make_fetch_happen.default.defaults({
|
|
104
|
+
cachePath: require_constants_packages.getPacoteCachePath(),
|
|
107
105
|
cache: "force-cache"
|
|
108
106
|
});
|
|
109
|
-
return
|
|
107
|
+
return cachedFetcher;
|
|
110
108
|
}
|
|
111
109
|
/**
|
|
112
110
|
* Convert raw attestation data to user-friendly provenance details.
|
|
@@ -174,15 +172,15 @@ function getTrustStatus(meta) {
|
|
|
174
172
|
trustedPublisher: false,
|
|
175
173
|
stagedPublish: false
|
|
176
174
|
};
|
|
177
|
-
if (
|
|
175
|
+
if (!require_objects_predicates.isObject(meta)) return status;
|
|
178
176
|
const npmUser = require_primordials_object.ObjectHasOwn(meta, "_npmUser") ? meta["_npmUser"] : void 0;
|
|
179
|
-
if (
|
|
177
|
+
if (require_objects_predicates.isObject(npmUser)) {
|
|
180
178
|
if (require_primordials_object.ObjectHasOwn(npmUser, "approver") && npmUser["approver"]) status.stagedPublish = true;
|
|
181
179
|
if (require_primordials_object.ObjectHasOwn(npmUser, "trustedPublisher") && npmUser["trustedPublisher"]) status.trustedPublisher = true;
|
|
182
180
|
}
|
|
183
181
|
const dist = require_primordials_object.ObjectHasOwn(meta, "dist") ? meta["dist"] : void 0;
|
|
184
|
-
const attestations =
|
|
185
|
-
if (
|
|
182
|
+
const attestations = require_objects_predicates.isObject(dist) && require_primordials_object.ObjectHasOwn(dist, "attestations") ? dist["attestations"] : void 0;
|
|
183
|
+
if (require_objects_predicates.isObject(attestations) && require_primordials_object.ObjectHasOwn(attestations, "provenance") && attestations["provenance"]) status.provenance = true;
|
|
186
184
|
return status;
|
|
187
185
|
}
|
|
188
186
|
/**
|
|
@@ -190,15 +188,15 @@ function getTrustStatus(meta) {
|
|
|
190
188
|
*/
|
|
191
189
|
function isTrustedPublisher(value) {
|
|
192
190
|
if (typeof value !== "string" || !value) return false;
|
|
193
|
-
let url =
|
|
191
|
+
let url = require_url_parse.parseUrl(value);
|
|
194
192
|
let hostname = url?.hostname;
|
|
195
193
|
if (!url && require_primordials_string.StringPrototypeIncludes(value, "@")) {
|
|
196
194
|
const firstPart = require_primordials_string.StringPrototypeSplit(value, "@")[0];
|
|
197
|
-
if (firstPart) url =
|
|
195
|
+
if (firstPart) url = require_url_parse.parseUrl(firstPart);
|
|
198
196
|
if (url) hostname = url.hostname;
|
|
199
197
|
}
|
|
200
198
|
if (!url) {
|
|
201
|
-
const httpsUrl =
|
|
199
|
+
const httpsUrl = require_url_parse.parseUrl(`https://${value}`);
|
|
202
200
|
if (httpsUrl) hostname = httpsUrl.hostname;
|
|
203
201
|
}
|
|
204
202
|
if (hostname) return hostname === "github.com" || require_primordials_string.StringPrototypeEndsWith(hostname, ".github.com") || hostname === "gitlab.com" || require_primordials_string.StringPrototypeEndsWith(hostname, ".gitlab.com");
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Read + parse a package.json. The package-aware layer over
|
|
3
|
+
* `fs/read-json`: resolves a dir-or-file path to its package.json, parses,
|
|
4
|
+
* and optionally normalizes or returns an editable instance.
|
|
5
|
+
*/
|
|
6
|
+
import type { NormalizeOptions, PackageJson, ReadPackageJsonOptions } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* Read and parse a package.json file asynchronously.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ;```typescript
|
|
12
|
+
* const pkgJson = await readPackageJson('/tmp/my-project')
|
|
13
|
+
* console.log(pkgJson?.name)
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function readPackageJson(filepath: string, options?: ReadPackageJsonOptions): Promise<PackageJson | undefined>;
|
|
17
|
+
/**
|
|
18
|
+
* Read and parse package.json from a file path synchronously.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ;```typescript
|
|
22
|
+
* const pkgJson = readPackageJsonSync('/tmp/my-project')
|
|
23
|
+
* console.log(pkgJson?.name)
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function readPackageJsonSync(filepath: string, options?: NormalizeOptions & {
|
|
27
|
+
editable?: boolean | undefined;
|
|
28
|
+
throws?: boolean | undefined;
|
|
29
|
+
}): PackageJson | undefined;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with rolldown */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_fs_read_json = require('../fs/read-json.js');
|
|
5
|
+
const require_paths_packages = require('../paths/packages.js');
|
|
6
|
+
const require_packages_normalize = require('./normalize.js');
|
|
7
|
+
const require_packages_edit = require('./edit.js');
|
|
8
|
+
|
|
9
|
+
//#region src/packages/read.ts
|
|
10
|
+
/**
|
|
11
|
+
* @file Read + parse a package.json. The package-aware layer over
|
|
12
|
+
* `fs/read-json`: resolves a dir-or-file path to its package.json, parses,
|
|
13
|
+
* and optionally normalizes or returns an editable instance.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Read and parse a package.json file asynchronously.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ;```typescript
|
|
20
|
+
* const pkgJson = await readPackageJson('/tmp/my-project')
|
|
21
|
+
* console.log(pkgJson?.name)
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
async function readPackageJson(filepath, options) {
|
|
25
|
+
const { editable, normalize, throws, ...normalizeOptions } = {
|
|
26
|
+
__proto__: null,
|
|
27
|
+
...options
|
|
28
|
+
};
|
|
29
|
+
const pkgJson = await require_fs_read_json.readJson(require_paths_packages.resolvePackageJsonPath(filepath), { throws });
|
|
30
|
+
if (pkgJson) {
|
|
31
|
+
if (editable) return await require_packages_edit.toEditablePackageJson(pkgJson, {
|
|
32
|
+
path: filepath,
|
|
33
|
+
normalize,
|
|
34
|
+
...normalizeOptions
|
|
35
|
+
});
|
|
36
|
+
return normalize ? require_packages_normalize.normalizePackageJson(pkgJson, normalizeOptions) : pkgJson;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Read and parse package.json from a file path synchronously.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ;```typescript
|
|
44
|
+
* const pkgJson = readPackageJsonSync('/tmp/my-project')
|
|
45
|
+
* console.log(pkgJson?.name)
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
function readPackageJsonSync(filepath, options) {
|
|
49
|
+
const { editable, normalize, throws, ...normalizeOptions } = {
|
|
50
|
+
__proto__: null,
|
|
51
|
+
...options
|
|
52
|
+
};
|
|
53
|
+
const pkgJson = require_fs_read_json.readJsonSync(require_paths_packages.resolvePackageJsonPath(filepath), { throws });
|
|
54
|
+
if (pkgJson) {
|
|
55
|
+
if (editable) return require_packages_edit.toEditablePackageJsonSync(pkgJson, {
|
|
56
|
+
path: filepath,
|
|
57
|
+
normalize,
|
|
58
|
+
...normalizeOptions
|
|
59
|
+
});
|
|
60
|
+
return normalize ? require_packages_normalize.normalizePackageJson(pkgJson, normalizeOptions) : pkgJson;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
exports.readPackageJson = readPackageJson;
|
|
66
|
+
exports.readPackageJsonSync = readPackageJsonSync;
|
package/dist/packages/specs.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file Package spec parsing and GitHub URL utilities.
|
|
2
|
+
* @file Package spec parsing, name resolution, and GitHub URL utilities.
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Get the release tag for a version.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ;```typescript
|
|
9
|
+
* getReleaseTag('lodash@latest') // 'latest'
|
|
10
|
+
* getReleaseTag('@scope/pkg@beta') // 'beta'
|
|
11
|
+
* getReleaseTag('lodash') // ''
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function getReleaseTag(spec: string): string;
|
|
4
15
|
/**
|
|
5
16
|
* Extract user and project from GitHub repository URL.
|
|
6
17
|
*
|
|
@@ -54,3 +65,39 @@ export declare function isGitHubTgzSpec(spec: unknown, where?: string): boolean;
|
|
|
54
65
|
* ```
|
|
55
66
|
*/
|
|
56
67
|
export declare function isGitHubUrlSpec(spec: unknown, where?: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Slugify an npm package name into a hyphenated identifier suitable for
|
|
70
|
+
* User-Agent tokens, log namespaces, file paths, and other contexts where `@`
|
|
71
|
+
* and `/` are not welcome.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ;```typescript
|
|
75
|
+
* pkgNameToSlug('@socketsecurity/lib') // 'socketsecurity-lib'
|
|
76
|
+
* pkgNameToSlug('@cyclonedx/cdxgen') // 'cyclonedx-cdxgen'
|
|
77
|
+
* pkgNameToSlug('lodash') // 'lodash'
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function pkgNameToSlug(pkgName: string): string;
|
|
81
|
+
/**
|
|
82
|
+
* Resolve full package name from a PURL object with custom delimiter.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ;```typescript
|
|
86
|
+
* resolvePackageName({ name: 'core', namespace: '@babel' }) // '@babel/core'
|
|
87
|
+
* resolvePackageName({ name: 'lodash' }) // 'lodash'
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export declare function resolvePackageName(purlObj: {
|
|
91
|
+
name: string;
|
|
92
|
+
namespace?: string | undefined;
|
|
93
|
+
}, delimiter?: string): string;
|
|
94
|
+
/**
|
|
95
|
+
* Convert npm package name to Socket registry format with delimiter.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ;```typescript
|
|
99
|
+
* resolveRegistryPackageName('@babel/core') // 'babel__core'
|
|
100
|
+
* resolveRegistryPackageName('lodash') // 'lodash'
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare function resolveRegistryPackageName(pkgName: string): string;
|