@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
package/CHANGELOG.md
CHANGED
|
@@ -5,11 +5,36 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [6.0.7](https://github.com/SocketDev/socket-lib/releases/tag/v6.0.7) - 2026-06-03
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`external-tools/python` — zero-host-dependency Python.** `resolvePython` (PATH → python-build-standalone download), `downloadPipPackage` (bundle-safe `pip install --target`), `resolvePipPackagePin` (hash-pinned closure), and the `dlxPipInstall` / `dlxPipPin` one-call wrappers. Removes the unused `external-tools/uv`.
|
|
13
|
+
- **`constants/platform` — `getOs`, `getLibc`, `getTarget`.** OS, libc (`glibc`/`musl`/`undefined`), and the pnpm `pack-app` host token `<os>-<arch>[-<libc>]`.
|
|
14
|
+
- **`http-request` decompresses `gzip` / `br` response bodies.** Buffered requests advertise `Accept-Encoding: gzip, br` and now decode the body by its `Content-Encoding` before resolving. 6.0.6 sent the header but never decompressed, so a compressed response reached callers as raw deflated bytes. Streamed requests (`stream: true`, e.g. `httpDownload`) skip the header so piped-to-disk payloads stay raw and checksum cleanly. Callers can override with `'identity'`.
|
|
15
|
+
- **`crypto/hash` blob content-address helpers.** `blobHashOf(bytes)` returns Socket's content-addressed blob hash (`Q` + base64url(sha256)), and `verifyBlobHash(hash, bytes)` throws when bytes don't hash to the expected address. Both build on the fast one-shot `hash()`; the `S` file-stream discriminator verifies against the same digest body. Lets blob consumers (the SDK, MCP server) verify integrity against one canonical implementation instead of re-deriving the scheme.
|
|
16
|
+
- **`integrity` — unified checksum/integrity surface.** `checksumToIntegrity(hex, algorithm?)` and `integrityToChecksum(sri)` convert between the two named hash flavors and are idempotent on the destination format (pass an SRI to `checksumToIntegrity`, get it back unchanged). `isIntegrity(s)` and `isChecksum(s)` are the predicates. `parseIntegrity(s)` returns `{ algorithm, body }` for the SRI structure. Replaces the `src/ssri/` directory (`hexToSsri`, `ssriToHex`, `isValidHex`, `isValidSsri`, `parseSsri`) — SSRI is just another name for Subresource Integrity, so the duplication confused readers. `isIntegrity` now accepts the full W3C SRI set (`sha256` / `sha384` / `sha512`) — the previous predicate hardcoded `sha512` only, which mismatched the contract `external-tools/manifest.ts` already promised and rejected the fleet's `sha256-<base64>` integrity strings.
|
|
17
|
+
- **`process/spawn/kill-tree` — cross-platform process-tree termination.** `killProcessTree(target, { detached?, signal? })` walks and signals the whole descendant tree of a `pid` or `ChildProcess`: POSIX uses `process.kill(-pid, signal)` against the detached child's process group; Windows shells out to `taskkill /T /F /pid <pid>`. `isProcessAlive(pid)` probes liveness with `process.kill(pid, 0)`. Both helpers are best-effort and never throw — `ESRCH` (process gone) or `EPERM` (not ours) returns `false` so cleanup kills can't mask the caller's control flow.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- **dlx + pin API renamed (breaking).** `downloadPackage` → `downloadNpmPackage`, `generatePackagePin` → `resolveNpmPackagePin`, the `package` option → `spec`. `downloadNpmPackage` gains an optional `hash` for tarball integrity.
|
|
22
|
+
- **`packages/operations` split by concern (breaking).** The grab-bag `@socketsecurity/lib/packages/operations` export is gone; its members move to focused subpaths: `readPackageJson`/`readPackageJsonSync` → `packages/read`, the fetcher + GitHub tarball resolver → `packages/fetch`, `extractPackage`/`packPackage` → `packages/tarball`, the dependency-metadata override lookup → `packages/metadata-extensions`, and the name/spec helpers → `packages/specs`. `findUpPackageJson` now lives at `packages/find` (the `packages/find-up` subpath is removed). The `fs/find-up` subpath is renamed `fs/find`, and `fs/path-cache` is renamed `fs/allowed-dirs-cache` (it caches the safe-delete allowed-directories set, not arbitrary paths).
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- **Python downloads now work on Windows and Alpine.** python-build-standalone resolution previously returned no asset on `win32` and musl hosts; both now resolve.
|
|
27
|
+
- **`debug` — namespace `SOCKET_DEBUG` values enable debug output.** `envAsBoolean(getSocketDebug())` returned false for `SOCKET_DEBUG=*` or `SOCKET_DEBUG=socket:foo` — those aren't boolean literals, so debug output was silently suppressed for the common namespace-selection shape. The new `isSocketDebugEnabled()` helper treats any non-empty value other than `0`/`false`/`no` (case-insensitive) as enabled.
|
|
28
|
+
- **`external-tools/skillspector` pipx detection on Windows.** The PATH-tier resolver normalizes the resolved binary path with `normalizePath` and matches a forward-slash-only `pipx/venvs/` pattern, instead of `path.normalize` plus a dual-separator regex. On Windows the old form left backslashes in the path and missed pipx-installed binaries, tagging them `source: 'path'` rather than `source: 'pipx'`.
|
|
29
|
+
|
|
30
|
+
### Removed
|
|
31
|
+
|
|
32
|
+
- **`@socketsecurity/lib/ssri/{convert,parse,validate}` package exports.** Folded into `@socketsecurity/lib/integrity` (see Added). No fleet consumers were using the `ssri` subpath imports — verified by grep across socket-\* fleet repos.
|
|
33
|
+
|
|
8
34
|
## [6.0.6](https://github.com/SocketDev/socket-lib/releases/tag/v6.0.6) - 2026-06-01
|
|
9
35
|
|
|
10
36
|
### Added
|
|
11
37
|
|
|
12
|
-
- **`http-request` now negotiates and decompresses `gzip` / `br` response bodies.** Buffered requests advertise `Accept-Encoding: gzip, br` and transparently decompress responses by `Content-Encoding`. Node's HTTP client does neither, so a compressed Socket API response previously reached callers as raw deflated bytes. Streamed requests (`stream: true`, e.g. `httpDownload`) intentionally skip the `Accept-Encoding` header so piped-to-disk payloads stay raw and checksum cleanly. Callers can override (e.g. `'identity'`).
|
|
13
38
|
- **`http-request/headers` — `basicAuthHeader(token)`.** Builds the Socket API Basic-auth shape (token-as-username, empty password) so call sites stop hand-rolling `Basic ${base64(token + ':')}`.
|
|
14
39
|
- **`http-request` retry instrumentation.** Adds `Retry-Attempt`, `Retry-Max`, and `Retry-After` request headers on retried attempts so server-side logs can correlate a retry chain.
|
|
15
40
|
- **`prim` CLI bin.** `prim` is now published as a `bin` entry (`dist/bin/prim.cjs`); installs from `@socketsecurity/lib` make `npx prim` work. Also new in this release: `prim --diff` for unified line-diffs in dry-run mode, multi-hop cycle detection in `validateRewrites`, and a two-phase apply with cross-batch validation.
|
package/dist/ai/discover.d.mts
CHANGED
|
@@ -28,8 +28,8 @@ export declare function cachePathFor(repoRoot: string): string;
|
|
|
28
28
|
* `'claude' in agents` for the existence check.
|
|
29
29
|
*/
|
|
30
30
|
export declare function discoverAiAgents(options?: {
|
|
31
|
-
readonly refresh?: boolean;
|
|
32
|
-
readonly repoRoot?: string;
|
|
31
|
+
readonly refresh?: boolean | undefined;
|
|
32
|
+
readonly repoRoot?: string | undefined;
|
|
33
33
|
}): Promise<DiscoveredAgents>;
|
|
34
34
|
export declare function discoverFresh(): DiscoveredAgents;
|
|
35
35
|
/**
|
package/dist/ai/discover.js
CHANGED
|
@@ -41,7 +41,7 @@ const KNOWN_AGENTS = [
|
|
|
41
41
|
const CACHE_TTL_MS = 3600 * 1e3;
|
|
42
42
|
let inProcessCache;
|
|
43
43
|
function cachePathFor(repoRoot) {
|
|
44
|
-
return node_path.default.join(repoRoot, ".cache", "agent-discovery.json");
|
|
44
|
+
return node_path.default.join(repoRoot, "node_modules", ".cache", "agent-discovery.json");
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Discover which AI agent CLIs are installed.
|
|
@@ -73,7 +73,8 @@ async function discoverAiAgents(options = {}) {
|
|
|
73
73
|
}
|
|
74
74
|
function discoverFresh() {
|
|
75
75
|
const out = {};
|
|
76
|
-
for (
|
|
76
|
+
for (let i = 0, { length } = KNOWN_AGENTS; i < length; i += 1) {
|
|
77
|
+
const name = KNOWN_AGENTS[i];
|
|
77
78
|
const found = require_bin_which.whichSync(name);
|
|
78
79
|
if (typeof found === "string" && found) out[name] = found;
|
|
79
80
|
}
|
package/dist/ai/spawn.js
CHANGED
|
@@ -52,6 +52,7 @@ function buildArgs(agent, opts) {
|
|
|
52
52
|
];
|
|
53
53
|
for (const dir of opts.addDirs ?? []) args.push("--add-dir", dir);
|
|
54
54
|
if (opts.model) args.push("--model", opts.model);
|
|
55
|
+
if (opts.effort) args.push("--effort", opts.effort);
|
|
55
56
|
if (allAllowed.length > 0) args.push("--allowedTools", ...allAllowed);
|
|
56
57
|
if (opts.disallow.length > 0) args.push("--disallowedTools", ...opts.disallow);
|
|
57
58
|
if (opts.extraArgs) args.push(...opts.extraArgs);
|
|
@@ -159,7 +160,7 @@ async function spawnAiAgent(opts) {
|
|
|
159
160
|
stderr = String(result.stderr ?? "");
|
|
160
161
|
exitCode = result.code ?? 0;
|
|
161
162
|
} catch (e) {
|
|
162
|
-
if (
|
|
163
|
+
if (require_process_spawn_errors.isSpawnError(e)) {
|
|
163
164
|
stdout = String(e.stdout ?? "");
|
|
164
165
|
stderr = String(e.stderr ?? "");
|
|
165
166
|
exitCode = e.code ?? 1;
|
package/dist/ai/types.d.mts
CHANGED
|
@@ -25,6 +25,13 @@ export type AiAgentName = 'claude' | 'codex' | 'gemini' | 'opencode';
|
|
|
25
25
|
* tools that mutate state.
|
|
26
26
|
*/
|
|
27
27
|
export type PermissionMode = 'acceptEdits' | 'dontAsk' | 'plan';
|
|
28
|
+
/**
|
|
29
|
+
* Reasoning-effort level for the agent session. Maps to the claude CLI
|
|
30
|
+
* `--effort <level>` flag (claude-specific; other agents ignore it). Pair a
|
|
31
|
+
* cheap model with low effort for mechanical work and reserve high/max for
|
|
32
|
+
* tasks that genuinely need deeper reasoning.
|
|
33
|
+
*/
|
|
34
|
+
export type AiEffort = 'high' | 'low' | 'max' | 'medium' | 'xhigh';
|
|
28
35
|
/**
|
|
29
36
|
* Result of an agent spawn. Consumers should inspect `exitCode` before using
|
|
30
37
|
* `stdout` — non-zero usually means the agent's CLI itself rejected, not just
|
|
@@ -55,27 +62,32 @@ export interface SpawnAiAgentOptions {
|
|
|
55
62
|
/**
|
|
56
63
|
* Optional explicit agent. Defaults to claude when discovered.
|
|
57
64
|
*/
|
|
58
|
-
readonly agent?: AiAgentName;
|
|
65
|
+
readonly agent?: AiAgentName | undefined;
|
|
59
66
|
/**
|
|
60
67
|
* Allow-list extras (Bash glob patterns, MCP tools, etc.).
|
|
61
68
|
*/
|
|
62
|
-
readonly allow?: readonly string[];
|
|
69
|
+
readonly allow?: readonly string[] | undefined;
|
|
63
70
|
/**
|
|
64
71
|
* Extra dirs the agent can read (e.g. parent of cwd for monorepo).
|
|
65
72
|
*/
|
|
66
|
-
readonly addDirs?: readonly string[];
|
|
73
|
+
readonly addDirs?: readonly string[] | undefined;
|
|
67
74
|
/**
|
|
68
75
|
* Tool denylist — required to enforce the lockdown.
|
|
69
76
|
*/
|
|
70
77
|
readonly disallow: readonly string[];
|
|
78
|
+
/**
|
|
79
|
+
* Reasoning-effort level (claude `--effort`); agent default if absent.
|
|
80
|
+
* claude-specific — other agents ignore it.
|
|
81
|
+
*/
|
|
82
|
+
readonly effort?: AiEffort | undefined;
|
|
71
83
|
/**
|
|
72
84
|
* Override the agent's flag list (rare; for one-off advanced cases).
|
|
73
85
|
*/
|
|
74
|
-
readonly extraArgs?: readonly string[];
|
|
86
|
+
readonly extraArgs?: readonly string[] | undefined;
|
|
75
87
|
/**
|
|
76
88
|
* Model name override; agent default if absent.
|
|
77
89
|
*/
|
|
78
|
-
readonly model?: string;
|
|
90
|
+
readonly model?: string | undefined;
|
|
79
91
|
/**
|
|
80
92
|
* Permission mode — see PermissionMode docstring.
|
|
81
93
|
*/
|
|
@@ -91,7 +103,7 @@ export interface SpawnAiAgentOptions {
|
|
|
91
103
|
/**
|
|
92
104
|
* Per-call timeout (ms). Caller should set for predictable bounds.
|
|
93
105
|
*/
|
|
94
|
-
readonly timeoutMs?: number;
|
|
106
|
+
readonly timeoutMs?: number | undefined;
|
|
95
107
|
/**
|
|
96
108
|
* Tool allowlist. Required to enforce the lockdown.
|
|
97
109
|
*/
|
package/dist/ai/worktree.d.mts
CHANGED
|
@@ -22,23 +22,23 @@ export interface WorktreeRunOptions {
|
|
|
22
22
|
/**
|
|
23
23
|
* Branch to merge results into. Default: current branch of baseRepo.
|
|
24
24
|
*/
|
|
25
|
-
readonly branch?: string;
|
|
25
|
+
readonly branch?: string | undefined;
|
|
26
26
|
/**
|
|
27
27
|
* Cleanup policy. Default 'always'.
|
|
28
28
|
*/
|
|
29
|
-
readonly cleanup?: WorktreeCleanup;
|
|
29
|
+
readonly cleanup?: WorktreeCleanup | undefined;
|
|
30
30
|
/**
|
|
31
31
|
* Parallel cap. Default 4, max 8.
|
|
32
32
|
*/
|
|
33
|
-
readonly concurrency?: number;
|
|
33
|
+
readonly concurrency?: number | undefined;
|
|
34
34
|
/**
|
|
35
35
|
* Prefix for worktree branch + dir names. Default 'agent-task'.
|
|
36
36
|
*/
|
|
37
|
-
readonly namePrefix?: string;
|
|
37
|
+
readonly namePrefix?: string | undefined;
|
|
38
38
|
/**
|
|
39
39
|
* Where worktrees live on disk. Default: `${tmpdir}/${prefix}-<n>`.
|
|
40
40
|
*/
|
|
41
|
-
readonly worktreeRoot?: string;
|
|
41
|
+
readonly worktreeRoot?: string | undefined;
|
|
42
42
|
}
|
|
43
43
|
export interface WorktreeRunContext {
|
|
44
44
|
/**
|
|
@@ -56,7 +56,7 @@ export interface WorktreeRunContext {
|
|
|
56
56
|
}
|
|
57
57
|
export interface WorktreeRunSettled<T> {
|
|
58
58
|
readonly cleanup: 'removed' | 'kept';
|
|
59
|
-
readonly error?: unknown;
|
|
59
|
+
readonly error?: unknown | undefined;
|
|
60
60
|
readonly merged: boolean;
|
|
61
61
|
readonly status: 'fulfilled' | 'rejected';
|
|
62
62
|
readonly value?: T | undefined;
|
package/dist/ai/worktree.js
CHANGED
|
@@ -161,7 +161,7 @@ function tryGit(cwd, ...args) {
|
|
|
161
161
|
output: git(cwd, ...args)
|
|
162
162
|
};
|
|
163
163
|
} catch (e) {
|
|
164
|
-
if (
|
|
164
|
+
if (require_process_spawn_errors.isSpawnError(e)) return {
|
|
165
165
|
ok: false,
|
|
166
166
|
output: String(e.stderr ?? e.stdout ?? "")
|
|
167
167
|
};
|
package/dist/ansi/strip.d.ts
CHANGED
package/dist/ansi/strip.js
CHANGED
|
@@ -26,7 +26,6 @@ const ANSI_REGEX = /\x1b\[[0-9;]*m/g;
|
|
|
26
26
|
* ansiRegex({ onlyFirst: true }) // matches only the first code
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
30
29
|
function ansiRegex(options) {
|
|
31
30
|
const { onlyFirst } = options ?? {};
|
|
32
31
|
return new require_primordials_regexp.RegExpCtor(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`, onlyFirst ? void 0 : "g");
|
|
@@ -40,7 +39,6 @@ function ansiRegex(options) {
|
|
|
40
39
|
* stripAnsi('\u001b[1mBold\u001b[0m') // 'Bold'
|
|
41
40
|
* ```
|
|
42
41
|
*/
|
|
43
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
44
42
|
function stripAnsi(text) {
|
|
45
43
|
return require_primordials_string.StringPrototypeReplace(text, ANSI_REGEX, "");
|
|
46
44
|
}
|
|
@@ -15,8 +15,8 @@ let node_fs = require("node:fs");
|
|
|
15
15
|
const DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024;
|
|
16
16
|
const DEFAULT_MAX_TOTAL_SIZE = 1024 * 1024 * 1024;
|
|
17
17
|
const DEFAULT_MAX_ENTRIES = 1e5;
|
|
18
|
-
let
|
|
19
|
-
let
|
|
18
|
+
let admZip;
|
|
19
|
+
let tarFs;
|
|
20
20
|
/**
|
|
21
21
|
* Assert that an archive file exists on disk before handing it to the
|
|
22
22
|
* underlying extractor. Normalizes the "missing archive" surface across all
|
|
@@ -38,15 +38,13 @@ function assertArchiveExists(archivePath) {
|
|
|
38
38
|
throw err;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
42
41
|
function getAdmZip() {
|
|
43
|
-
if (
|
|
44
|
-
return
|
|
42
|
+
if (admZip === void 0) admZip = /*@__PURE__*/ require("../external/adm-zip.js");
|
|
43
|
+
return admZip;
|
|
45
44
|
}
|
|
46
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
47
45
|
function getTarFs() {
|
|
48
|
-
if (
|
|
49
|
-
return
|
|
46
|
+
if (tarFs === void 0) tarFs = /*@__PURE__*/ require("../external/tar-fs.js");
|
|
47
|
+
return tarFs;
|
|
50
48
|
}
|
|
51
49
|
/**
|
|
52
50
|
* Validate that a resolved path is within the target directory. Prevents path
|
|
@@ -61,7 +59,7 @@ function getTarFs() {
|
|
|
61
59
|
* @throws Error if path is outside the base directory
|
|
62
60
|
*/
|
|
63
61
|
function validatePathWithinBase(targetPath, baseDir, entryName) {
|
|
64
|
-
const path =
|
|
62
|
+
const path = require_node_path.getNodePath();
|
|
65
63
|
const resolvedTarget = path.resolve(targetPath);
|
|
66
64
|
const resolvedBase = path.resolve(baseDir);
|
|
67
65
|
if (!require_primordials_string.StringPrototypeStartsWith(resolvedTarget, resolvedBase + path.sep) && resolvedTarget !== resolvedBase) throw new require_primordials_error.ErrorCtor(`Path traversal attempt detected: entry "${entryName}" would extract to "${resolvedTarget}" outside target directory "${resolvedBase}"`);
|
package/dist/archives/extract.js
CHANGED
|
@@ -31,7 +31,7 @@ const require_archives_zip = require('./zip.js');
|
|
|
31
31
|
async function extractArchive(archivePath, outputDir, options = {}) {
|
|
32
32
|
const format = require_archives_detect.detectArchiveFormat(archivePath);
|
|
33
33
|
if (!format) {
|
|
34
|
-
const ext =
|
|
34
|
+
const ext = require_node_path.getNodePath().extname(archivePath).toLowerCase();
|
|
35
35
|
throw new require_primordials_error.ErrorCtor(`Unsupported archive format${ext ? ` (extension: ${ext})` : ""}: ${archivePath}. Supported formats: .zip, .tar, .tar.gz, .tgz`);
|
|
36
36
|
}
|
|
37
37
|
switch (format) {
|
package/dist/archives/tar.js
CHANGED
|
@@ -42,12 +42,12 @@ let node_zlib = require("node:zlib");
|
|
|
42
42
|
async function extractTar(archivePath, outputDir, options = {}) {
|
|
43
43
|
require_archives__internal.assertArchiveExists(archivePath);
|
|
44
44
|
const { maxEntries = require_archives__internal.DEFAULT_MAX_ENTRIES, maxFileSize = require_archives__internal.DEFAULT_MAX_FILE_SIZE, maxTotalSize = require_archives__internal.DEFAULT_MAX_TOTAL_SIZE, strip = 0 } = options;
|
|
45
|
-
const normalizedOutputDir =
|
|
45
|
+
const normalizedOutputDir = require_paths_normalize.normalizePath(outputDir);
|
|
46
46
|
await require_fs_safe.safeMkdir(normalizedOutputDir);
|
|
47
47
|
let totalExtractedSize = 0;
|
|
48
48
|
let entryCount = 0;
|
|
49
49
|
let destroyScheduled = false;
|
|
50
|
-
const extractStream =
|
|
50
|
+
const extractStream = require_archives__internal.getTarFs().extract(normalizedOutputDir, {
|
|
51
51
|
map: (header) => {
|
|
52
52
|
/* c8 ignore start - destroyScheduled is set by the same map() when a
|
|
53
53
|
security limit trips; only fires after the schedule. */
|
|
@@ -73,7 +73,7 @@ async function extractTar(archivePath, outputDir, options = {}) {
|
|
|
73
73
|
});
|
|
74
74
|
return header;
|
|
75
75
|
}
|
|
76
|
-
if (header.type === "
|
|
76
|
+
if (header.type === "link" || header.type === "symlink") {
|
|
77
77
|
destroyScheduled = true;
|
|
78
78
|
node_process.default.nextTick(() => {
|
|
79
79
|
extractStream.destroy(new require_primordials_error.ErrorCtor(`Symlink detected in archive: ${header.name}. Symlinks are not supported for security reasons.`));
|
|
@@ -127,12 +127,12 @@ async function extractTar(archivePath, outputDir, options = {}) {
|
|
|
127
127
|
async function extractTarGz(archivePath, outputDir, options = {}) {
|
|
128
128
|
require_archives__internal.assertArchiveExists(archivePath);
|
|
129
129
|
const { maxEntries = require_archives__internal.DEFAULT_MAX_ENTRIES, maxFileSize = require_archives__internal.DEFAULT_MAX_FILE_SIZE, maxTotalSize = require_archives__internal.DEFAULT_MAX_TOTAL_SIZE, strip = 0 } = options;
|
|
130
|
-
const normalizedOutputDir =
|
|
130
|
+
const normalizedOutputDir = require_paths_normalize.normalizePath(outputDir);
|
|
131
131
|
await require_fs_safe.safeMkdir(normalizedOutputDir);
|
|
132
132
|
let totalExtractedSize = 0;
|
|
133
133
|
let entryCount = 0;
|
|
134
134
|
let destroyScheduled = false;
|
|
135
|
-
const extractStream =
|
|
135
|
+
const extractStream = require_archives__internal.getTarFs().extract(normalizedOutputDir, {
|
|
136
136
|
map: (header) => {
|
|
137
137
|
/* c8 ignore start - destroyScheduled is set by the same map() when a
|
|
138
138
|
security limit trips; only fires after the schedule. */
|
|
@@ -158,7 +158,7 @@ async function extractTarGz(archivePath, outputDir, options = {}) {
|
|
|
158
158
|
});
|
|
159
159
|
return header;
|
|
160
160
|
}
|
|
161
|
-
if (header.type === "
|
|
161
|
+
if (header.type === "link" || header.type === "symlink") {
|
|
162
162
|
destroyScheduled = true;
|
|
163
163
|
node_process.default.nextTick(() => {
|
|
164
164
|
extractStream.destroy(new require_primordials_error.ErrorCtor(`Symlink detected in archive: ${header.name}. Symlinks are not supported for security reasons.`));
|
package/dist/archives/zip.js
CHANGED
|
@@ -32,10 +32,10 @@ const require_fs_safe = require('../fs/safe.js');
|
|
|
32
32
|
async function extractZip(archivePath, outputDir, options = {}) {
|
|
33
33
|
require_archives__internal.assertArchiveExists(archivePath);
|
|
34
34
|
const { maxEntries = require_archives__internal.DEFAULT_MAX_ENTRIES, maxFileSize = require_archives__internal.DEFAULT_MAX_FILE_SIZE, maxTotalSize = require_archives__internal.DEFAULT_MAX_TOTAL_SIZE, strip = 0 } = options;
|
|
35
|
-
const normalizedOutputDir =
|
|
35
|
+
const normalizedOutputDir = require_paths_normalize.normalizePath(outputDir);
|
|
36
36
|
await require_fs_safe.safeMkdir(normalizedOutputDir);
|
|
37
|
-
const zip = new (
|
|
38
|
-
const path =
|
|
37
|
+
const zip = new (require_archives__internal.getAdmZip())(archivePath);
|
|
38
|
+
const path = require_node_path.getNodePath();
|
|
39
39
|
const entries = zip.getEntries();
|
|
40
40
|
/* c8 ignore start */
|
|
41
41
|
if (entries.length > maxEntries) throw new require_primordials_error.ErrorCtor(`Archive has too many entries: ${entries.length} (limit: ${maxEntries})`);
|
|
@@ -60,8 +60,6 @@ async function extractZip(archivePath, outputDir, options = {}) {
|
|
|
60
60
|
for (const entry of entries) if (!entry.isDirectory) require_archives__internal.validatePathWithinBase(path.join(normalizedOutputDir, entry.entryName), normalizedOutputDir, entry.entryName);
|
|
61
61
|
zip.extractAllTo(normalizedOutputDir, true);
|
|
62
62
|
} else {
|
|
63
|
-
const path = /* @__PURE__ */ require_node_path.getNodePath();
|
|
64
|
-
const entries = zip.getEntries();
|
|
65
63
|
const dirsToCreate = new require_primordials_map_set.SetCtor();
|
|
66
64
|
for (const entry of entries) {
|
|
67
65
|
if (entry.isDirectory) continue;
|
|
@@ -11,6 +11,18 @@
|
|
|
11
11
|
* accepts both `--quiet` and `--silent`).
|
|
12
12
|
*/
|
|
13
13
|
import type { FlagInput } from './flag-types';
|
|
14
|
+
/**
|
|
15
|
+
* Get the appropriate log level based on flags. Returns 'silent', 'error',
|
|
16
|
+
* 'warn', 'info', 'verbose', or 'debug'.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ;```typescript
|
|
20
|
+
* getLogLevel() // 'info' (default)
|
|
21
|
+
* getLogLevel({ quiet: true }) // 'silent'
|
|
22
|
+
* getLogLevel(['--debug']) // 'debug'
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function getLogLevel(input?: FlagInput): string;
|
|
14
26
|
/**
|
|
15
27
|
* Build a flag predicate that accepts `FlagValues`, `string[]`, or `undefined`
|
|
16
28
|
* (in which case it consults the frozen `processArg`).
|
|
@@ -165,15 +177,3 @@ export declare const isVerbose: (input?: FlagInput) => boolean;
|
|
|
165
177
|
* ```
|
|
166
178
|
*/
|
|
167
179
|
export declare const isWatch: (input?: FlagInput) => boolean;
|
|
168
|
-
/**
|
|
169
|
-
* Get the appropriate log level based on flags. Returns 'silent', 'error',
|
|
170
|
-
* 'warn', 'info', 'verbose', or 'debug'.
|
|
171
|
-
*
|
|
172
|
-
* @example
|
|
173
|
-
* ;```typescript
|
|
174
|
-
* getLogLevel() // 'info' (default)
|
|
175
|
-
* getLogLevel({ quiet: true }) // 'silent'
|
|
176
|
-
* getLogLevel(['--debug']) // 'debug'
|
|
177
|
-
* ```
|
|
178
|
-
*/
|
|
179
|
-
export declare function getLogLevel(input?: FlagInput): string;
|
|
@@ -21,6 +21,23 @@ node_process = require_runtime.__toESM(node_process);
|
|
|
21
21
|
*/
|
|
22
22
|
const processArg = [...node_process.default.argv];
|
|
23
23
|
/**
|
|
24
|
+
* Get the appropriate log level based on flags. Returns 'silent', 'error',
|
|
25
|
+
* 'warn', 'info', 'verbose', or 'debug'.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ;```typescript
|
|
29
|
+
* getLogLevel() // 'info' (default)
|
|
30
|
+
* getLogLevel({ quiet: true }) // 'silent'
|
|
31
|
+
* getLogLevel(['--debug']) // 'debug'
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
function getLogLevel(input) {
|
|
35
|
+
if (isQuiet(input)) return "silent";
|
|
36
|
+
if (isDebug(input)) return "debug";
|
|
37
|
+
if (isVerbose(input)) return "verbose";
|
|
38
|
+
return "info";
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
24
41
|
* Build a flag predicate that accepts `FlagValues`, `string[]`, or `undefined`
|
|
25
42
|
* (in which case it consults the frozen `processArg`).
|
|
26
43
|
*
|
|
@@ -183,23 +200,6 @@ const isVerbose = makeFlagPredicate(["--verbose"]);
|
|
|
183
200
|
* ```
|
|
184
201
|
*/
|
|
185
202
|
const isWatch = makeFlagPredicate(["--watch"], ["-w"]);
|
|
186
|
-
/**
|
|
187
|
-
* Get the appropriate log level based on flags. Returns 'silent', 'error',
|
|
188
|
-
* 'warn', 'info', 'verbose', or 'debug'.
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* ;```typescript
|
|
192
|
-
* getLogLevel() // 'info' (default)
|
|
193
|
-
* getLogLevel({ quiet: true }) // 'silent'
|
|
194
|
-
* getLogLevel(['--debug']) // 'debug'
|
|
195
|
-
* ```
|
|
196
|
-
*/
|
|
197
|
-
function getLogLevel(input) {
|
|
198
|
-
if (isQuiet(input)) return "silent";
|
|
199
|
-
if (isDebug(input)) return "debug";
|
|
200
|
-
if (isVerbose(input)) return "verbose";
|
|
201
|
-
return "info";
|
|
202
|
-
}
|
|
203
203
|
|
|
204
204
|
//#endregion
|
|
205
205
|
exports.getLogLevel = getLogLevel;
|
|
@@ -8,22 +8,22 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export interface FlagValues {
|
|
10
10
|
[key: string]: unknown;
|
|
11
|
-
quiet?: boolean;
|
|
12
|
-
silent?: boolean;
|
|
13
|
-
verbose?: boolean;
|
|
14
|
-
help?: boolean;
|
|
15
|
-
all?: boolean;
|
|
16
|
-
fix?: boolean;
|
|
17
|
-
force?: boolean;
|
|
18
|
-
'dry-run'?: boolean;
|
|
19
|
-
json?: boolean;
|
|
20
|
-
debug?: boolean;
|
|
21
|
-
watch?: boolean;
|
|
22
|
-
coverage?: boolean;
|
|
23
|
-
cover?: boolean;
|
|
24
|
-
update?: boolean;
|
|
25
|
-
staged?: boolean;
|
|
26
|
-
changed?: boolean;
|
|
11
|
+
quiet?: boolean | undefined;
|
|
12
|
+
silent?: boolean | undefined;
|
|
13
|
+
verbose?: boolean | undefined;
|
|
14
|
+
help?: boolean | undefined;
|
|
15
|
+
all?: boolean | undefined;
|
|
16
|
+
fix?: boolean | undefined;
|
|
17
|
+
force?: boolean | undefined;
|
|
18
|
+
'dry-run'?: boolean | undefined;
|
|
19
|
+
json?: boolean | undefined;
|
|
20
|
+
debug?: boolean | undefined;
|
|
21
|
+
watch?: boolean | undefined;
|
|
22
|
+
coverage?: boolean | undefined;
|
|
23
|
+
cover?: boolean | undefined;
|
|
24
|
+
update?: boolean | undefined;
|
|
25
|
+
staged?: boolean | undefined;
|
|
26
|
+
changed?: boolean | undefined;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Accepted input types for flag checking functions. Can be parsed flag values,
|
|
@@ -45,12 +45,12 @@ export declare const COMMON_FLAGS: {
|
|
|
45
45
|
default: boolean;
|
|
46
46
|
description: string;
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
cover: {
|
|
49
49
|
type: 'boolean';
|
|
50
50
|
default: boolean;
|
|
51
51
|
description: string;
|
|
52
52
|
};
|
|
53
|
-
|
|
53
|
+
coverage: {
|
|
54
54
|
type: 'boolean';
|
|
55
55
|
default: boolean;
|
|
56
56
|
description: string;
|
package/dist/argv/flag-types.js
CHANGED
|
@@ -18,15 +18,15 @@ const COMMON_FLAGS = {
|
|
|
18
18
|
default: false,
|
|
19
19
|
description: "Target changed files"
|
|
20
20
|
},
|
|
21
|
-
|
|
21
|
+
cover: {
|
|
22
22
|
type: "boolean",
|
|
23
23
|
default: false,
|
|
24
|
-
description: "Run with coverage"
|
|
24
|
+
description: "Run with coverage (alias)"
|
|
25
25
|
},
|
|
26
|
-
|
|
26
|
+
coverage: {
|
|
27
27
|
type: "boolean",
|
|
28
28
|
default: false,
|
|
29
|
-
description: "Run with coverage
|
|
29
|
+
description: "Run with coverage"
|
|
30
30
|
},
|
|
31
31
|
debug: {
|
|
32
32
|
type: "boolean",
|
package/dist/argv/parse.d.ts
CHANGED
package/dist/arrays/_internal.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_primordials_intl = require('../primordials/intl.js');
|
|
4
5
|
|
|
5
6
|
//#region src/arrays/_internal.ts
|
|
6
7
|
/**
|
|
@@ -8,8 +9,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
8
9
|
* instances for conjunction (and) and disjunction (or) joins. Constructed
|
|
9
10
|
* lazily because `new Intl.ListFormat(...)` is a measurable startup cost.
|
|
10
11
|
*/
|
|
11
|
-
let
|
|
12
|
-
let
|
|
12
|
+
let conjunctionFormatter;
|
|
13
|
+
let disjunctionFormatter;
|
|
13
14
|
/**
|
|
14
15
|
* Get a cached Intl.ListFormat instance for conjunction (and) formatting.
|
|
15
16
|
*
|
|
@@ -28,15 +29,14 @@ let _disjunctionFormatter;
|
|
|
28
29
|
* @returns Cached Intl.ListFormat instance configured for conjunction
|
|
29
30
|
* formatting.
|
|
30
31
|
*/
|
|
31
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
32
32
|
function getConjunctionFormatter() {
|
|
33
|
-
if (
|
|
34
|
-
/* c8 ignore start */
|
|
35
|
-
|
|
33
|
+
if (conjunctionFormatter === void 0)
|
|
34
|
+
/* c8 ignore start - lazy singleton init runs once; not worth a dedicated test */
|
|
35
|
+
conjunctionFormatter = new require_primordials_intl.IntlListFormat("en", {
|
|
36
36
|
style: "long",
|
|
37
37
|
type: "conjunction"
|
|
38
38
|
});
|
|
39
|
-
return
|
|
39
|
+
return conjunctionFormatter;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Get a cached Intl.ListFormat instance for disjunction (or) formatting.
|
|
@@ -56,15 +56,14 @@ function getConjunctionFormatter() {
|
|
|
56
56
|
* @returns Cached Intl.ListFormat instance configured for disjunction
|
|
57
57
|
* formatting.
|
|
58
58
|
*/
|
|
59
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
60
59
|
function getDisjunctionFormatter() {
|
|
61
|
-
if (
|
|
62
|
-
/* c8 ignore start */
|
|
63
|
-
|
|
60
|
+
if (disjunctionFormatter === void 0)
|
|
61
|
+
/* c8 ignore start - lazy singleton init runs once; not worth a dedicated test */
|
|
62
|
+
disjunctionFormatter = new require_primordials_intl.IntlListFormat("en", {
|
|
64
63
|
style: "long",
|
|
65
64
|
type: "disjunction"
|
|
66
65
|
});
|
|
67
|
-
return
|
|
66
|
+
return disjunctionFormatter;
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
//#endregion
|
package/dist/arrays/chunk.js
CHANGED
|
@@ -40,7 +40,6 @@ const require_primordials_error = require('../primordials/error.js');
|
|
|
40
40
|
*
|
|
41
41
|
* @throws {Error} If chunk size is less than or equal to 0
|
|
42
42
|
*/
|
|
43
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
44
43
|
function arrayChunk(arr, size) {
|
|
45
44
|
const chunkSize = size ?? 2;
|
|
46
45
|
if (chunkSize <= 0) throw new require_primordials_error.ErrorCtor("Chunk size must be greater than 0");
|
package/dist/arrays/join.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Grammatical list joiners via `Intl.ListFormat` — Oxford-comma aware and
|
|
3
|
-
* locale-correct. `
|
|
3
|
+
* locale-correct. `joinList` (generalized), `joinAnd` ("a, b, and c"),
|
|
4
|
+
* `joinOr` ("a, b, or c").
|
|
4
5
|
*/
|
|
6
|
+
export interface JoinListOptions {
|
|
7
|
+
with?: string | undefined;
|
|
8
|
+
}
|
|
5
9
|
/**
|
|
6
10
|
* Join array elements with proper "and" conjunction formatting.
|
|
7
11
|
*
|
|
8
12
|
* Formats an array of strings into a grammatically correct list using "and" as
|
|
9
13
|
* the conjunction. Uses `Intl.ListFormat` for proper English formatting with
|
|
10
|
-
* Oxford comma support.
|
|
14
|
+
* Oxford comma support. Delegates to `joinList`.
|
|
11
15
|
*
|
|
12
16
|
* @example
|
|
13
17
|
* ```ts
|
|
@@ -38,12 +42,42 @@
|
|
|
38
42
|
* @returns Formatted string with proper "and" conjunction
|
|
39
43
|
*/
|
|
40
44
|
export declare function joinAnd(arr: string[] | readonly string[]): string;
|
|
45
|
+
/**
|
|
46
|
+
* Generalized list joiner covering bare join, comma-list, and
|
|
47
|
+
* conjunction/disjunction via `Intl.ListFormat`.
|
|
48
|
+
*
|
|
49
|
+
* - No options: bare concatenation (`'abc'`)
|
|
50
|
+
* - `{ with: 'and' }`: Oxford-comma "and" list via `Intl.ListFormat` (`'a, b, and
|
|
51
|
+
* c'`)
|
|
52
|
+
* - `{ with: 'or' }`: Oxford-comma "or" list via `Intl.ListFormat` (`'a, b, or
|
|
53
|
+
* c'`)
|
|
54
|
+
* - `{ with: <any other string> }`: `items.join(sep)` — e.g. `','` → `'a,b,c'`,
|
|
55
|
+
* `', '` → `'a, b, c'`, `' '` → `'a b c'`
|
|
56
|
+
*
|
|
57
|
+
* Each item is coerced via `String()` before formatting.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ;```ts
|
|
61
|
+
* joinList(['a', 'b', 'c']) // 'abc'
|
|
62
|
+
* joinList(['a', 'b', 'c'], { with: ', ' }) // 'a, b, c'
|
|
63
|
+
* joinList(['a', 'b', 'c'], { with: ' ' }) // 'a b c'
|
|
64
|
+
* joinList(['a', 'b', 'c'], { with: 'and' }) // 'a, b, and c'
|
|
65
|
+
* joinList(['a', 'b', 'c'], { with: 'or' }) // 'a, b, or c'
|
|
66
|
+
* joinList([1, 2, 3], { with: 'and' }) // '1, 2, and 3'
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @param items - Items to join (can be readonly, any type)
|
|
70
|
+
* @param options - Formatting options (optional)
|
|
71
|
+
*
|
|
72
|
+
* @returns Formatted string
|
|
73
|
+
*/
|
|
74
|
+
export declare function joinList(items: readonly unknown[], options?: JoinListOptions): string;
|
|
41
75
|
/**
|
|
42
76
|
* Join array elements with proper "or" disjunction formatting.
|
|
43
77
|
*
|
|
44
78
|
* Formats an array of strings into a grammatically correct list using "or" as
|
|
45
79
|
* the disjunction. Uses `Intl.ListFormat` for proper English formatting with
|
|
46
|
-
* Oxford comma support.
|
|
80
|
+
* Oxford comma support. Delegates to `joinList`.
|
|
47
81
|
*
|
|
48
82
|
* @example
|
|
49
83
|
* ```ts
|