@socketsecurity/lib 6.0.5 → 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 +43 -0
- package/dist/ai/discover.d.mts +2 -2
- package/dist/ai/discover.js +6 -4
- package/dist/ai/spawn.js +10 -6
- package/dist/ai/types.d.mts +18 -6
- package/dist/ai/worktree.d.mts +6 -6
- package/dist/ai/worktree.js +12 -7
- 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 +4 -6
- 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/acorn-bindgen.cjs +769 -0
- package/dist/bin/acorn.wasm +0 -0
- package/dist/bin/exec.js +2 -3
- package/dist/bin/find.js +13 -13
- package/dist/bin/prim.cjs +39244 -0
- 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 +56 -52
- package/dist/{bin → cli}/check.js +6 -5
- 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 +20 -19
- package/dist/compression/brotli.d.ts +25 -25
- package/dist/compression/brotli.js +37 -44
- package/dist/compression/gzip.d.ts +23 -23
- package/dist/compression/gzip.js +44 -52
- 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 +14 -13
- 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 -166
- 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/@sinclair/typebox/value.js +5 -1
- package/dist/external/@sinclair/typebox.js +5 -1
- package/dist/external/@socketregistry/packageurl-js.js +27 -0
- 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/resolve.js +2 -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/resolve.js +2 -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/from-pip-venv.d.ts +73 -0
- package/dist/external-tools/from-pip-venv.js +98 -0
- package/dist/external-tools/janus/asset-names.js +1 -1
- package/dist/external-tools/janus/from-download.js +3 -5
- package/dist/external-tools/janus/from-vfs.js +1 -1
- package/dist/external-tools/janus/resolve.js +2 -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-download.js +2 -1
- package/dist/external-tools/jre/from-vfs.js +1 -1
- package/dist/external-tools/jre/resolve.js +2 -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 +18 -16
- package/dist/external-tools/opengrep/from-vfs.js +1 -1
- package/dist/external-tools/opengrep/resolve.js +2 -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/resolve.js +2 -1
- package/dist/external-tools/sbt/types.d.ts +1 -1
- package/dist/external-tools/skillspector/from-dlx.d.ts +24 -0
- package/dist/external-tools/skillspector/from-dlx.js +41 -0
- package/dist/external-tools/skillspector/from-path.d.ts +8 -0
- package/dist/external-tools/skillspector/from-path.js +30 -0
- package/dist/external-tools/skillspector/from-vfs.d.ts +8 -0
- package/dist/external-tools/skillspector/from-vfs.js +27 -0
- package/dist/external-tools/skillspector/resolve.d.ts +34 -0
- package/dist/external-tools/skillspector/resolve.js +53 -0
- package/dist/external-tools/skillspector/types.d.ts +24 -0
- package/dist/external-tools/skillspector/types.js +2 -0
- package/dist/external-tools/synp/from-download.js +2 -2
- package/dist/external-tools/synp/from-vfs.js +1 -1
- package/dist/external-tools/synp/resolve.js +2 -1
- package/dist/external-tools/trivy/from-vfs.js +1 -1
- package/dist/external-tools/trivy/resolve.js +2 -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/resolve.js +2 -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 +12 -11
- 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 +6 -7
- 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 +21 -13
- 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 +4 -4
- package/dist/http-request/headers.d.ts +32 -3
- package/dist/http-request/headers.js +41 -13
- package/dist/http-request/request-attempt.js +38 -33
- package/dist/http-request/request-types.d.ts +7 -2
- package/dist/http-request/request.js +33 -16
- package/dist/http-request/response-reader.d.ts +12 -1
- package/dist/http-request/response-reader.js +22 -2
- 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.d.ts +6 -0
- package/dist/packages/provenance.js +25 -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 +6 -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 +12 -16
- 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 +5 -4
- package/dist/secrets/compare.d.ts +45 -0
- package/dist/secrets/compare.js +61 -0
- package/dist/secrets/keychain.js +9 -6
- package/dist/secrets/linux.js +25 -23
- package/dist/secrets/macos.d.ts +1 -1
- package/dist/secrets/macos.js +18 -16
- package/dist/secrets/rc.d.ts +2 -2
- package/dist/secrets/rc.js +15 -10
- package/dist/secrets/socket-api-token.d.ts +4 -4
- package/dist/secrets/socket-api-token.js +18 -9
- package/dist/secrets/windows.js +21 -17
- package/dist/shadow/skip.js +2 -2
- package/dist/shell/parse.d.ts +108 -1
- package/dist/shell/parse.js +168 -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 +4 -2
- package/dist/temporal/slots.js +7 -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.d.ts +24 -2
- package/dist/words/pluralize.js +47 -2
- package/dist/words/types.d.ts +25 -2
- package/package.json +289 -108
- 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 -52
- 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
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Upstream uv release asset-name mapping per `platform-arch`. uv
|
|
3
|
-
* publishes per-platform archives under
|
|
4
|
-
* https://github.com/astral-sh/uv/releases/download/<X.Y.Z>/. The release tag
|
|
5
|
-
* is the bare semver (no `v` prefix), unlike most upstream projects. Each
|
|
6
|
-
* archive wraps the binary one directory deep (`uv-<triple>/uv[.exe]`), so
|
|
7
|
-
* callers should pass `strip: 1` to the extractor — or, equivalently, look up
|
|
8
|
-
* the binary inside the archive's stem directory.
|
|
9
|
-
*/
|
|
10
|
-
export interface UvAssetEntry {
|
|
11
|
-
/**
|
|
12
|
-
* Full asset filename (no version interpolation — uv asset names are
|
|
13
|
-
* version-free).
|
|
14
|
-
*/
|
|
15
|
-
readonly asset: string;
|
|
16
|
-
}
|
|
17
|
-
export declare const UV_ASSET_MAP: Readonly<Record<string, UvAssetEntry>>;
|
|
18
|
-
export declare function getUvAssetEntry(platformArch: string): UvAssetEntry | undefined;
|
|
19
|
-
export interface UvDownloadOptions {
|
|
20
|
-
/**
|
|
21
|
-
* Uv release version, e.g. `'0.10.11'` (no `v` prefix — astral-sh/uv tags
|
|
22
|
-
* releases as bare semver).
|
|
23
|
-
*/
|
|
24
|
-
version: string;
|
|
25
|
-
/**
|
|
26
|
-
* Fleet platform-arch token — looked up in `UV_ASSET_MAP`.
|
|
27
|
-
*/
|
|
28
|
-
platformArch: string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Build the GitHub release-asset download URL for an upstream uv binary.
|
|
32
|
-
* Returns `undefined` when no entry exists for the requested platform-arch.
|
|
33
|
-
*
|
|
34
|
-
* Reference: https://github.com/astral-sh/uv/releases.
|
|
35
|
-
*/
|
|
36
|
-
export declare function getUvDownloadUrl(opts: UvDownloadOptions): string | undefined;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* Socket Lib - Built with rolldown */
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_primordials_object = require('../../primordials/object.js');
|
|
5
|
-
|
|
6
|
-
//#region src/external-tools/uv/asset-names.ts
|
|
7
|
-
/**
|
|
8
|
-
* @file Upstream uv release asset-name mapping per `platform-arch`. uv
|
|
9
|
-
* publishes per-platform archives under
|
|
10
|
-
* https://github.com/astral-sh/uv/releases/download/<X.Y.Z>/. The release tag
|
|
11
|
-
* is the bare semver (no `v` prefix), unlike most upstream projects. Each
|
|
12
|
-
* archive wraps the binary one directory deep (`uv-<triple>/uv[.exe]`), so
|
|
13
|
-
* callers should pass `strip: 1` to the extractor — or, equivalently, look up
|
|
14
|
-
* the binary inside the archive's stem directory.
|
|
15
|
-
*/
|
|
16
|
-
const UV_ASSET_MAP = require_primordials_object.ObjectFreeze({
|
|
17
|
-
__proto__: null,
|
|
18
|
-
"darwin-arm64": require_primordials_object.ObjectFreeze({
|
|
19
|
-
__proto__: null,
|
|
20
|
-
asset: "uv-aarch64-apple-darwin.tar.gz"
|
|
21
|
-
}),
|
|
22
|
-
"darwin-x64": require_primordials_object.ObjectFreeze({
|
|
23
|
-
__proto__: null,
|
|
24
|
-
asset: "uv-x86_64-apple-darwin.tar.gz"
|
|
25
|
-
}),
|
|
26
|
-
"linux-arm64": require_primordials_object.ObjectFreeze({
|
|
27
|
-
__proto__: null,
|
|
28
|
-
asset: "uv-aarch64-unknown-linux-gnu.tar.gz"
|
|
29
|
-
}),
|
|
30
|
-
"linux-arm64-musl": require_primordials_object.ObjectFreeze({
|
|
31
|
-
__proto__: null,
|
|
32
|
-
asset: "uv-aarch64-unknown-linux-musl.tar.gz"
|
|
33
|
-
}),
|
|
34
|
-
"linux-x64": require_primordials_object.ObjectFreeze({
|
|
35
|
-
__proto__: null,
|
|
36
|
-
asset: "uv-x86_64-unknown-linux-gnu.tar.gz"
|
|
37
|
-
}),
|
|
38
|
-
"linux-x64-musl": require_primordials_object.ObjectFreeze({
|
|
39
|
-
__proto__: null,
|
|
40
|
-
asset: "uv-x86_64-unknown-linux-musl.tar.gz"
|
|
41
|
-
}),
|
|
42
|
-
"win-arm64": require_primordials_object.ObjectFreeze({
|
|
43
|
-
__proto__: null,
|
|
44
|
-
asset: "uv-aarch64-pc-windows-msvc.zip"
|
|
45
|
-
}),
|
|
46
|
-
"win-x64": require_primordials_object.ObjectFreeze({
|
|
47
|
-
__proto__: null,
|
|
48
|
-
asset: "uv-x86_64-pc-windows-msvc.zip"
|
|
49
|
-
})
|
|
50
|
-
});
|
|
51
|
-
function getUvAssetEntry(platformArch) {
|
|
52
|
-
return UV_ASSET_MAP[platformArch];
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Build the GitHub release-asset download URL for an upstream uv binary.
|
|
56
|
-
* Returns `undefined` when no entry exists for the requested platform-arch.
|
|
57
|
-
*
|
|
58
|
-
* Reference: https://github.com/astral-sh/uv/releases.
|
|
59
|
-
*/
|
|
60
|
-
function getUvDownloadUrl(opts) {
|
|
61
|
-
const { platformArch, version } = opts;
|
|
62
|
-
const entry = UV_ASSET_MAP[platformArch];
|
|
63
|
-
if (!entry) return;
|
|
64
|
-
return `https://github.com/astral-sh/uv/releases/download/${version}/` + entry.asset;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
//#endregion
|
|
68
|
-
exports.UV_ASSET_MAP = UV_ASSET_MAP;
|
|
69
|
-
exports.getUvAssetEntry = getUvAssetEntry;
|
|
70
|
-
exports.getUvDownloadUrl = getUvDownloadUrl;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file `uvFromDownload()` — fetches upstream uv and returns a `ResolvedUv`
|
|
3
|
-
* pointing at the extracted binary. uv tarballs wrap the binary in a
|
|
4
|
-
* `<asset-stem>/` directory; the extractor strips that level so the binary
|
|
5
|
-
* sits at the cache-dir root.
|
|
6
|
-
*/
|
|
7
|
-
import type { BinaryDownloader } from '../from-download';
|
|
8
|
-
import type { HashSpec } from '../../integrity';
|
|
9
|
-
import type { ResolvedUv } from './types';
|
|
10
|
-
export interface UvFromDownloadOptions {
|
|
11
|
-
version: string;
|
|
12
|
-
platformArch: string;
|
|
13
|
-
integrity?: HashSpec | undefined;
|
|
14
|
-
cacheDir?: string | undefined;
|
|
15
|
-
downloader?: BinaryDownloader | undefined;
|
|
16
|
-
}
|
|
17
|
-
export declare function uvFromDownload(opts: UvFromDownloadOptions): Promise<ResolvedUv | undefined>;
|
|
@@ -1,47 +0,0 @@
|
|
|
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_paths_socket = require('../../paths/socket.js');
|
|
6
|
-
const require_external_tools_from_download = require('../from-download.js');
|
|
7
|
-
const require_external_tools_uv_asset_names = require('./asset-names.js');
|
|
8
|
-
let node_path = require("node:path");
|
|
9
|
-
node_path = require_runtime.__toESM(node_path);
|
|
10
|
-
let node_process = require("node:process");
|
|
11
|
-
node_process = require_runtime.__toESM(node_process);
|
|
12
|
-
|
|
13
|
-
//#region src/external-tools/uv/from-download.ts
|
|
14
|
-
/**
|
|
15
|
-
* @file `uvFromDownload()` — fetches upstream uv and returns a `ResolvedUv`
|
|
16
|
-
* pointing at the extracted binary. uv tarballs wrap the binary in a
|
|
17
|
-
* `<asset-stem>/` directory; the extractor strips that level so the binary
|
|
18
|
-
* sits at the cache-dir root.
|
|
19
|
-
*/
|
|
20
|
-
async function uvFromDownload(opts) {
|
|
21
|
-
const { cacheDir, downloader, integrity, platformArch, version } = opts;
|
|
22
|
-
const url = require_external_tools_uv_asset_names.getUvDownloadUrl({
|
|
23
|
-
version,
|
|
24
|
-
platformArch
|
|
25
|
-
});
|
|
26
|
-
const entry = require_external_tools_uv_asset_names.getUvAssetEntry(platformArch);
|
|
27
|
-
if (!url || !entry) return;
|
|
28
|
-
const archiveExt = entry.asset.endsWith(".zip") ? ".zip" : ".tar.gz";
|
|
29
|
-
const extractedDir = cacheDir ?? node_path.default.join(require_paths_socket.getSocketDlxDir(), "uv", version, platformArch);
|
|
30
|
-
const archive = await require_external_tools_from_download.downloadAndExtractTool({
|
|
31
|
-
url,
|
|
32
|
-
name: `uv-${version}-${platformArch}${archiveExt}`,
|
|
33
|
-
integrity,
|
|
34
|
-
extractedDir,
|
|
35
|
-
extractOptions: { strip: 1 },
|
|
36
|
-
downloader
|
|
37
|
-
});
|
|
38
|
-
const binary = node_process.default.platform === "win32" ? "uv.exe" : "uv";
|
|
39
|
-
return {
|
|
40
|
-
path: node_path.default.join(extractedDir, binary),
|
|
41
|
-
source: "download",
|
|
42
|
-
integrity: archive.integrity
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
exports.uvFromDownload = uvFromDownload;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* Socket Lib - Built with rolldown */
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_bin_which = require('../../bin/which.js');
|
|
5
|
-
|
|
6
|
-
//#region src/external-tools/uv/from-path.ts
|
|
7
|
-
/**
|
|
8
|
-
* @file `uvFromPath()` — looks for `uv` on the system PATH.
|
|
9
|
-
*/
|
|
10
|
-
async function uvFromPath() {
|
|
11
|
-
const onPath = await require_bin_which.which("uv", { nothrow: true });
|
|
12
|
-
/* c8 ignore start - reached only when uv is NOT on PATH. */
|
|
13
|
-
if (typeof onPath !== "string") return;
|
|
14
|
-
/* c8 ignore stop */
|
|
15
|
-
return {
|
|
16
|
-
path: onPath,
|
|
17
|
-
source: "path"
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
exports.uvFromPath = uvFromPath;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file `uvFromVfs()` — extracts the uv binary from the smol binary's VFS.
|
|
3
|
-
* Returns `undefined` when the binary doesn't have uv bundled.
|
|
4
|
-
*/
|
|
5
|
-
import type { ResolvedUv } from './types';
|
|
6
|
-
export declare const UV_VFS_KEY = "uv";
|
|
7
|
-
export declare function uvFromVfs(): Promise<ResolvedUv | undefined>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* Socket Lib - Built with rolldown */
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_smol_vfs = require('../../smol/vfs.js');
|
|
5
|
-
|
|
6
|
-
//#region src/external-tools/uv/from-vfs.ts
|
|
7
|
-
/**
|
|
8
|
-
* @file `uvFromVfs()` — extracts the uv binary from the smol binary's VFS.
|
|
9
|
-
* Returns `undefined` when the binary doesn't have uv bundled.
|
|
10
|
-
*/
|
|
11
|
-
const UV_VFS_KEY = "uv";
|
|
12
|
-
async function uvFromVfs() {
|
|
13
|
-
const vfs = /* @__PURE__ */ require_smol_vfs.getSmolVfs();
|
|
14
|
-
if (!vfs) return;
|
|
15
|
-
/* c8 ignore start - smol Node binary only. */
|
|
16
|
-
if (!vfs.has("uv")) return;
|
|
17
|
-
return {
|
|
18
|
-
path: await vfs.extract("uv"),
|
|
19
|
-
source: "vfs"
|
|
20
|
-
};
|
|
21
|
-
/* c8 ignore stop */
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
exports.UV_VFS_KEY = UV_VFS_KEY;
|
|
26
|
-
exports.uvFromVfs = uvFromVfs;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file `resolveUv()` — uv resolution entry point. Tries each source in order:
|
|
3
|
-
*
|
|
4
|
-
* 1. VFS — smol binary's embedded uv (if packed)
|
|
5
|
-
* 2. PATH — `uv` on the system PATH
|
|
6
|
-
* 3. download — upstream GitHub release archive (only when `downloadIfMissing`
|
|
7
|
-
* is passed) Returns `undefined` if all of the enabled sources miss.
|
|
8
|
-
* Memoized per option-shape.
|
|
9
|
-
*/
|
|
10
|
-
import type { BinaryDownloader } from '../from-download';
|
|
11
|
-
import type { HashSpec } from '../../integrity';
|
|
12
|
-
import type { ResolvedUv } from './types';
|
|
13
|
-
export interface ResolveUvOptions {
|
|
14
|
-
downloadIfMissing?: {
|
|
15
|
-
version: string;
|
|
16
|
-
platformArch: string;
|
|
17
|
-
integrity?: HashSpec | undefined;
|
|
18
|
-
cacheDir?: string | undefined;
|
|
19
|
-
downloader?: BinaryDownloader | undefined;
|
|
20
|
-
} | undefined;
|
|
21
|
-
}
|
|
22
|
-
export declare function cacheKey(opts: ResolveUvOptions | undefined): string;
|
|
23
|
-
export declare function doResolveUv(opts?: ResolveUvOptions | undefined): Promise<ResolvedUv | undefined>;
|
|
24
|
-
export declare function resetUvResolution(): void;
|
|
25
|
-
export declare function resolveUv(opts?: ResolveUvOptions | undefined): Promise<ResolvedUv | undefined>;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* Socket Lib - Built with rolldown */
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_external_tools_uv_from_download = require('./from-download.js');
|
|
5
|
-
const require_external_tools_uv_from_path = require('./from-path.js');
|
|
6
|
-
const require_external_tools_uv_from_vfs = require('./from-vfs.js');
|
|
7
|
-
|
|
8
|
-
//#region src/external-tools/uv/resolve.ts
|
|
9
|
-
/**
|
|
10
|
-
* @file `resolveUv()` — uv resolution entry point. Tries each source in order:
|
|
11
|
-
*
|
|
12
|
-
* 1. VFS — smol binary's embedded uv (if packed)
|
|
13
|
-
* 2. PATH — `uv` on the system PATH
|
|
14
|
-
* 3. download — upstream GitHub release archive (only when `downloadIfMissing`
|
|
15
|
-
* is passed) Returns `undefined` if all of the enabled sources miss.
|
|
16
|
-
* Memoized per option-shape.
|
|
17
|
-
*/
|
|
18
|
-
const resolutionCache = /* @__PURE__ */ new Map();
|
|
19
|
-
function cacheKey(opts) {
|
|
20
|
-
if (!opts?.downloadIfMissing) return "local-only";
|
|
21
|
-
const { cacheDir, integrity, platformArch, version } = opts.downloadIfMissing;
|
|
22
|
-
return `dl:${version}:${platformArch}:${typeof integrity === "string" ? integrity : integrity ? `${integrity.type}:${integrity.value}` : ""}:${cacheDir ?? ""}`;
|
|
23
|
-
}
|
|
24
|
-
async function doResolveUv(opts) {
|
|
25
|
-
const fromVfs = await require_external_tools_uv_from_vfs.uvFromVfs();
|
|
26
|
-
/* c8 ignore start - smol Node binary only. */
|
|
27
|
-
if (fromVfs) return fromVfs;
|
|
28
|
-
/* c8 ignore stop */
|
|
29
|
-
const fromPath = await require_external_tools_uv_from_path.uvFromPath();
|
|
30
|
-
if (fromPath) return fromPath;
|
|
31
|
-
if (opts?.downloadIfMissing) return require_external_tools_uv_from_download.uvFromDownload(opts.downloadIfMissing);
|
|
32
|
-
}
|
|
33
|
-
/* c8 ignore start - test-only escape hatch. */
|
|
34
|
-
function resetUvResolution() {
|
|
35
|
-
resolutionCache.clear();
|
|
36
|
-
}
|
|
37
|
-
/* c8 ignore stop */
|
|
38
|
-
function resolveUv(opts) {
|
|
39
|
-
const key = cacheKey(opts);
|
|
40
|
-
let cached = resolutionCache.get(key);
|
|
41
|
-
if (!cached) {
|
|
42
|
-
cached = doResolveUv(opts);
|
|
43
|
-
resolutionCache.set(key, cached);
|
|
44
|
-
}
|
|
45
|
-
return cached;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
//#endregion
|
|
49
|
-
exports.cacheKey = cacheKey;
|
|
50
|
-
exports.doResolveUv = doResolveUv;
|
|
51
|
-
exports.resetUvResolution = resetUvResolution;
|
|
52
|
-
exports.resolveUv = resolveUv;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Shared types for uv resolution. uv is Astral's Python package manager
|
|
3
|
-
* used by socket-basics for Python project bootstrap. Ships per-platform
|
|
4
|
-
* archives that wrap the `uv` binary one level deep.
|
|
5
|
-
*/
|
|
6
|
-
import type { ResolvedToolIntegrity } from '../from-download';
|
|
7
|
-
export type UvSource = 'download' | 'path' | 'vfs';
|
|
8
|
-
/**
|
|
9
|
-
* A resolved uv installation.
|
|
10
|
-
*/
|
|
11
|
-
export interface ResolvedUv {
|
|
12
|
-
/**
|
|
13
|
-
* Absolute path to the `uv` executable.
|
|
14
|
-
*/
|
|
15
|
-
readonly path: string;
|
|
16
|
-
/**
|
|
17
|
-
* Which resolver tier found this.
|
|
18
|
-
*/
|
|
19
|
-
readonly source: UvSource;
|
|
20
|
-
/**
|
|
21
|
-
* See {@link ResolvedToolIntegrity}.
|
|
22
|
-
*/
|
|
23
|
-
readonly integrity?: ResolvedToolIntegrity;
|
|
24
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Checksum file fetching + parsing for download verification.
|
|
3
|
-
* `parseChecksums` understands the three common file shapes:
|
|
4
|
-
*
|
|
5
|
-
* - BSD style: `SHA256 (filename) = hash`
|
|
6
|
-
* - GNU style: `hash filename` (two spaces)
|
|
7
|
-
* - Simple: `hash filename` (single space) Comment lines (`#…`) and blank lines
|
|
8
|
-
* are skipped. Hashes are lowercased. `fetchChecksums` is the URL helper —
|
|
9
|
-
* it fetches a checksums file via `httpRequest` and runs the body through
|
|
10
|
-
* `parseChecksums`. The pair lets `httpDownload({ sha256:
|
|
11
|
-
* checksums['file.zip'] })` keep the verification logic close to the
|
|
12
|
-
* manifest source.
|
|
13
|
-
*/
|
|
14
|
-
import type { Checksums, FetchChecksumsOptions } from './download-types';
|
|
15
|
-
/**
|
|
16
|
-
* Fetch and parse a checksums file from a URL.
|
|
17
|
-
*
|
|
18
|
-
* This is useful for verifying downloads from GitHub releases which typically
|
|
19
|
-
* publish a checksums.txt file alongside release assets.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ;```ts
|
|
23
|
-
* // Fetch checksums from GitHub release
|
|
24
|
-
* const checksums = await fetchChecksums(
|
|
25
|
-
* 'https://github.com/org/repo/releases/download/v1.0.0/checksums.txt',
|
|
26
|
-
* )
|
|
27
|
-
*
|
|
28
|
-
* // Use with httpDownload
|
|
29
|
-
* await httpDownload(
|
|
30
|
-
* 'https://github.com/org/repo/releases/download/v1.0.0/tool_linux.tar.gz',
|
|
31
|
-
* '/tmp/tool.tar.gz',
|
|
32
|
-
* { sha256: checksums['tool_linux.tar.gz'] },
|
|
33
|
-
* )
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @param url - URL to the checksums file.
|
|
37
|
-
* @param options - Request options.
|
|
38
|
-
*
|
|
39
|
-
* @returns Map of filenames to lowercase SHA256 hashes
|
|
40
|
-
*
|
|
41
|
-
* @throws {Error} When the checksums file cannot be fetched
|
|
42
|
-
*/
|
|
43
|
-
export declare function fetchChecksums(url: string, options?: FetchChecksumsOptions | undefined): Promise<Checksums>;
|
|
44
|
-
/**
|
|
45
|
-
* Parse a checksums file text into a filename-to-hash map.
|
|
46
|
-
*
|
|
47
|
-
* Supports standard checksums file formats: - BSD style: "SHA256 (filename) =
|
|
48
|
-
* hash" - GNU style: "hash filename" (two spaces) - Simple style: "hash
|
|
49
|
-
* filename" (single space)
|
|
50
|
-
*
|
|
51
|
-
* Lines starting with '#' are treated as comments and ignored. Empty lines are
|
|
52
|
-
* ignored.
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```ts
|
|
56
|
-
* const text = `
|
|
57
|
-
* # SHA256 checksums
|
|
58
|
-
* e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 file.zip
|
|
59
|
-
* abc123def456... other.tar.gz
|
|
60
|
-
* `
|
|
61
|
-
* const checksums = parseChecksums(text)
|
|
62
|
-
* console.log(checksums['file.zip']) // 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* @param text - Raw text content of a checksums file.
|
|
66
|
-
*
|
|
67
|
-
* @returns Map of filenames to lowercase SHA256 hashes
|
|
68
|
-
*/
|
|
69
|
-
export declare function parseChecksums(text: string): Checksums;
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* Socket Lib - Built with rolldown */
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_primordials_error = require('../primordials/error.js');
|
|
5
|
-
const require_primordials_string = require('../primordials/string.js');
|
|
6
|
-
const require_http_request_request = require('./request.js');
|
|
7
|
-
|
|
8
|
-
//#region src/http-request/checksums.ts
|
|
9
|
-
/**
|
|
10
|
-
* @file Checksum file fetching + parsing for download verification.
|
|
11
|
-
* `parseChecksums` understands the three common file shapes:
|
|
12
|
-
*
|
|
13
|
-
* - BSD style: `SHA256 (filename) = hash`
|
|
14
|
-
* - GNU style: `hash filename` (two spaces)
|
|
15
|
-
* - Simple: `hash filename` (single space) Comment lines (`#…`) and blank lines
|
|
16
|
-
* are skipped. Hashes are lowercased. `fetchChecksums` is the URL helper —
|
|
17
|
-
* it fetches a checksums file via `httpRequest` and runs the body through
|
|
18
|
-
* `parseChecksums`. The pair lets `httpDownload({ sha256:
|
|
19
|
-
* checksums['file.zip'] })` keep the verification logic close to the
|
|
20
|
-
* manifest source.
|
|
21
|
-
*/
|
|
22
|
-
const CHECKSUM_BSD_RE = /^SHA256\s+\((.+)\)\s+=\s+([a-fA-F0-9]{64})$/;
|
|
23
|
-
const CHECKSUM_GNU_RE = /^([a-fA-F0-9]{64})\s+(.+)$/;
|
|
24
|
-
/**
|
|
25
|
-
* Fetch and parse a checksums file from a URL.
|
|
26
|
-
*
|
|
27
|
-
* This is useful for verifying downloads from GitHub releases which typically
|
|
28
|
-
* publish a checksums.txt file alongside release assets.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ;```ts
|
|
32
|
-
* // Fetch checksums from GitHub release
|
|
33
|
-
* const checksums = await fetchChecksums(
|
|
34
|
-
* 'https://github.com/org/repo/releases/download/v1.0.0/checksums.txt',
|
|
35
|
-
* )
|
|
36
|
-
*
|
|
37
|
-
* // Use with httpDownload
|
|
38
|
-
* await httpDownload(
|
|
39
|
-
* 'https://github.com/org/repo/releases/download/v1.0.0/tool_linux.tar.gz',
|
|
40
|
-
* '/tmp/tool.tar.gz',
|
|
41
|
-
* { sha256: checksums['tool_linux.tar.gz'] },
|
|
42
|
-
* )
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* @param url - URL to the checksums file.
|
|
46
|
-
* @param options - Request options.
|
|
47
|
-
*
|
|
48
|
-
* @returns Map of filenames to lowercase SHA256 hashes
|
|
49
|
-
*
|
|
50
|
-
* @throws {Error} When the checksums file cannot be fetched
|
|
51
|
-
*/
|
|
52
|
-
async function fetchChecksums(url, options) {
|
|
53
|
-
const { ca, headers = {}, timeout = 3e4 } = {
|
|
54
|
-
__proto__: null,
|
|
55
|
-
...options
|
|
56
|
-
};
|
|
57
|
-
const response = await require_http_request_request.httpRequest(url, {
|
|
58
|
-
ca,
|
|
59
|
-
headers,
|
|
60
|
-
timeout
|
|
61
|
-
});
|
|
62
|
-
if (!response.ok) throw new require_primordials_error.ErrorCtor(`Failed to fetch checksums from ${url}: ${response.status} ${response.statusText}`);
|
|
63
|
-
return parseChecksums(response.body.toString("utf8"));
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Parse a checksums file text into a filename-to-hash map.
|
|
67
|
-
*
|
|
68
|
-
* Supports standard checksums file formats: - BSD style: "SHA256 (filename) =
|
|
69
|
-
* hash" - GNU style: "hash filename" (two spaces) - Simple style: "hash
|
|
70
|
-
* filename" (single space)
|
|
71
|
-
*
|
|
72
|
-
* Lines starting with '#' are treated as comments and ignored. Empty lines are
|
|
73
|
-
* ignored.
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```ts
|
|
77
|
-
* const text = `
|
|
78
|
-
* # SHA256 checksums
|
|
79
|
-
* e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 file.zip
|
|
80
|
-
* abc123def456... other.tar.gz
|
|
81
|
-
* `
|
|
82
|
-
* const checksums = parseChecksums(text)
|
|
83
|
-
* console.log(checksums['file.zip']) // 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
|
84
|
-
* ```
|
|
85
|
-
*
|
|
86
|
-
* @param text - Raw text content of a checksums file.
|
|
87
|
-
*
|
|
88
|
-
* @returns Map of filenames to lowercase SHA256 hashes
|
|
89
|
-
*/
|
|
90
|
-
function parseChecksums(text) {
|
|
91
|
-
const checksums = { __proto__: null };
|
|
92
|
-
for (const line of require_primordials_string.StringPrototypeSplit(text, "\n")) {
|
|
93
|
-
const trimmed = line.trim();
|
|
94
|
-
if (!trimmed || require_primordials_string.StringPrototypeStartsWith(trimmed, "#")) continue;
|
|
95
|
-
const bsdMatch = CHECKSUM_BSD_RE.exec(trimmed);
|
|
96
|
-
if (bsdMatch) {
|
|
97
|
-
checksums[bsdMatch[1]] = bsdMatch[2].toLowerCase();
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
const gnuMatch = CHECKSUM_GNU_RE.exec(trimmed);
|
|
101
|
-
if (gnuMatch) checksums[gnuMatch[2]] = gnuMatch[1].toLowerCase();
|
|
102
|
-
}
|
|
103
|
-
return checksums;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
//#endregion
|
|
107
|
-
exports.fetchChecksums = fetchChecksums;
|
|
108
|
-
exports.parseChecksums = parseChecksums;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Public HTTP-request entry — re-exports the platform-correct
|
|
3
|
-
* implementation. Bundlers that honor the package.json `'browser'` condition
|
|
4
|
-
* (rolldown, vite, esbuild on browser platform) swap this entry to
|
|
5
|
-
* `./browser`; Node consumers get `./node`. Same named exports (`httpJson`,
|
|
6
|
-
* `httpText`, `httpRequest`, `HttpResponseError`) on both platforms so
|
|
7
|
-
* callers can write `import { httpJson } from
|
|
8
|
-
* '@socketsecurity/lib/http-request/http-request'` without caring about
|
|
9
|
-
* platform.
|
|
10
|
-
*/
|
|
11
|
-
export { httpJson, httpRequest, httpText, HttpResponseError } from './node';
|
|
12
|
-
export type { HttpResponse, HttpRequestOptions } from './node';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* Socket Lib - Built with rolldown */
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_http_request_response_types = require('./response-types.js');
|
|
5
|
-
const require_http_request_request = require('./request.js');
|
|
6
|
-
const require_http_request_node = require('./node.js');
|
|
7
|
-
|
|
8
|
-
exports.HttpResponseError = require_http_request_response_types.HttpResponseError;
|
|
9
|
-
exports.httpJson = require_http_request_node.httpJson;
|
|
10
|
-
exports.httpRequest = require_http_request_request.httpRequest;
|
|
11
|
-
exports.httpText = require_http_request_node.httpText;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Package operations including extraction, packing, and I/O.
|
|
3
|
-
*/
|
|
4
|
-
import makeFetchHappen from '../external/make-fetch-happen';
|
|
5
|
-
import type { ExtractOptions, NormalizeOptions, PackageJson, PacoteOptions, ReadPackageJsonOptions } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Extract a package to a destination directory.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ;```typescript
|
|
11
|
-
* await extractPackage('lodash@4.17.21', { dest: '/tmp/lodash' })
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export declare function extractPackage(pkgNameOrId: string, options?: ExtractOptions, callback?: (destPath: string) => Promise<unknown>): Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* Find package extensions for a given package.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ;```typescript
|
|
20
|
-
* const extensions = findPackageExtensions('my-pkg', '1.0.0')
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare function findPackageExtensions(pkgName: string, pkgVer: string): unknown;
|
|
24
|
-
export declare function getFetcher(): ReturnType<typeof makeFetchHappen.defaults>;
|
|
25
|
-
/**
|
|
26
|
-
* Get the release tag for a version.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ;```typescript
|
|
30
|
-
* getReleaseTag('lodash@latest') // 'latest'
|
|
31
|
-
* getReleaseTag('@scope/pkg@beta') // 'beta'
|
|
32
|
-
* getReleaseTag('lodash') // ''
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare function getReleaseTag(spec: string): string;
|
|
36
|
-
/**
|
|
37
|
-
* Pack a package tarball using pacote.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ;```typescript
|
|
41
|
-
* const tarball = await packPackage('lodash@4.17.21')
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export declare function packPackage(spec: string, options?: PacoteOptions): Promise<unknown>;
|
|
45
|
-
/**
|
|
46
|
-
* Slugify an npm package name into a hyphenated identifier suitable for
|
|
47
|
-
* User-Agent tokens, log namespaces, file paths, and other contexts where `@`
|
|
48
|
-
* and `/` are not welcome.
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ;```typescript
|
|
52
|
-
* pkgNameToSlug('@socketsecurity/lib') // 'socketsecurity-lib'
|
|
53
|
-
* pkgNameToSlug('@cyclonedx/cdxgen') // 'cyclonedx-cdxgen'
|
|
54
|
-
* pkgNameToSlug('lodash') // 'lodash'
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
export declare function pkgNameToSlug(pkgName: string): string;
|
|
58
|
-
/**
|
|
59
|
-
* Read and parse a package.json file asynchronously.
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ;```typescript
|
|
63
|
-
* const pkgJson = await readPackageJson('/tmp/my-project')
|
|
64
|
-
* console.log(pkgJson?.name)
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
export declare function readPackageJson(filepath: string, options?: ReadPackageJsonOptions): Promise<PackageJson | undefined>;
|
|
68
|
-
/**
|
|
69
|
-
* Read and parse package.json from a file path synchronously.
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* ;```typescript
|
|
73
|
-
* const pkgJson = readPackageJsonSync('/tmp/my-project')
|
|
74
|
-
* console.log(pkgJson?.name)
|
|
75
|
-
* ```
|
|
76
|
-
*/
|
|
77
|
-
export declare function readPackageJsonSync(filepath: string, options?: NormalizeOptions & {
|
|
78
|
-
editable?: boolean;
|
|
79
|
-
throws?: boolean;
|
|
80
|
-
}): PackageJson | undefined;
|
|
81
|
-
/**
|
|
82
|
-
* Resolve GitHub tarball URL for a package specifier.
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ;```typescript
|
|
86
|
-
* const url = await resolveGitHubTgzUrl('my-pkg@1.0.0', '/tmp/my-project')
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
export declare function resolveGitHubTgzUrl(pkgNameOrId: string, where?: unknown): Promise<string>;
|
|
90
|
-
/**
|
|
91
|
-
* Resolve full package name from a PURL object with custom delimiter.
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* ;```typescript
|
|
95
|
-
* resolvePackageName({ name: 'core', namespace: '@babel' }) // '@babel/core'
|
|
96
|
-
* resolvePackageName({ name: 'lodash' }) // 'lodash'
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
export declare function resolvePackageName(purlObj: {
|
|
100
|
-
name: string;
|
|
101
|
-
namespace?: string;
|
|
102
|
-
}, delimiter?: string): string;
|
|
103
|
-
/**
|
|
104
|
-
* Convert npm package name to Socket registry format with delimiter.
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ;```typescript
|
|
108
|
-
* resolveRegistryPackageName('@babel/core') // 'babel__core'
|
|
109
|
-
* resolveRegistryPackageName('lodash') // 'lodash'
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
export declare function resolveRegistryPackageName(pkgName: string): string;
|
|
113
|
-
export type { PackageJson } from './types';
|