@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
package/dist/bin/resolve.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_primordials_string = require('../primordials/string.js');
|
|
5
4
|
const require_constants_platform = require('../constants/platform.js');
|
|
5
|
+
const require_primordials_string = require('../primordials/string.js');
|
|
6
6
|
const require_paths_normalize = require('../paths/normalize.js');
|
|
7
7
|
const require_node_fs = require('../node/fs.js');
|
|
8
8
|
const require_node_path = require('../node/path.js');
|
|
@@ -40,15 +40,14 @@ const require_bin_which = require('./which.js');
|
|
|
40
40
|
* // e.g. '/usr/local/lib/node_modules/npm/bin/npm-cli.js'
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
44
43
|
function resolveRealBinSync(binPath) {
|
|
45
|
-
const fs =
|
|
46
|
-
const path =
|
|
44
|
+
const fs = require_node_fs.getNodeFs();
|
|
45
|
+
const path = require_node_path.getNodePath();
|
|
47
46
|
if (!path.isAbsolute(binPath)) try {
|
|
48
47
|
const resolved = require_bin_which.whichRealSync(binPath);
|
|
49
48
|
if (resolved) binPath = resolved;
|
|
50
49
|
} catch {}
|
|
51
|
-
binPath =
|
|
50
|
+
binPath = require_paths_normalize.normalizePath(binPath);
|
|
52
51
|
if (binPath === ".") return binPath;
|
|
53
52
|
const ext = path.extname(binPath);
|
|
54
53
|
const extLowered = ext.toLowerCase();
|
|
@@ -67,7 +66,7 @@ function resolveRealBinSync(binPath) {
|
|
|
67
66
|
const voltaToolsPath = path.join(voltaPath, "tools");
|
|
68
67
|
const voltaImagePath = path.join(voltaToolsPath, "image");
|
|
69
68
|
const voltaUserPath = path.join(voltaToolsPath, "user");
|
|
70
|
-
const voltaPlatform =
|
|
69
|
+
const voltaPlatform = require_fs_read_json.readJsonSync(path.join(voltaUserPath, "platform.json"), { throws: false });
|
|
71
70
|
const voltaNodeVersion = voltaPlatform?.node?.runtime;
|
|
72
71
|
const voltaNpmVersion = voltaPlatform?.node?.npm;
|
|
73
72
|
let voltaBinPath = "";
|
|
@@ -83,7 +82,7 @@ function resolveRealBinSync(binPath) {
|
|
|
83
82
|
}
|
|
84
83
|
} else {
|
|
85
84
|
const voltaUserBinPath = path.join(voltaUserPath, "bin");
|
|
86
|
-
const binPackage =
|
|
85
|
+
const binPackage = require_fs_read_json.readJsonSync(path.join(voltaUserBinPath, `${basename}.json`), { throws: false })?.package;
|
|
87
86
|
if (binPackage) {
|
|
88
87
|
voltaBinPath = path.join(voltaImagePath, `packages/${binPackage}/bin/${basename}`);
|
|
89
88
|
if (!fs.existsSync(voltaBinPath)) {
|
|
@@ -96,7 +95,7 @@ function resolveRealBinSync(binPath) {
|
|
|
96
95
|
if (voltaBinPath) {
|
|
97
96
|
let resolvedVoltaPath = voltaBinPath;
|
|
98
97
|
try {
|
|
99
|
-
resolvedVoltaPath =
|
|
98
|
+
resolvedVoltaPath = require_paths_normalize.normalizePath(fs.realpathSync.native(voltaBinPath));
|
|
100
99
|
} catch {}
|
|
101
100
|
require_bin__internal.voltaBinCache.set(voltaCacheKey, resolvedVoltaPath);
|
|
102
101
|
return resolvedVoltaPath;
|
|
@@ -139,7 +138,7 @@ function resolveRealBinSync(binPath) {
|
|
|
139
138
|
} else if (extLowered === ".cmd") relPath = /(?<="%dp0%\\).*(?=" %\*\r\n)/.exec(source)?.[0] || "";
|
|
140
139
|
else if (extLowered === "") relPath = /(?<="$basedir\/).*(?=" "\$@"\n)/.exec(source)?.[0] || "";
|
|
141
140
|
else if (extLowered === ".ps1") relPath = /(?<="\$basedir\/).*(?=" $args\n)/.exec(source)?.[0] || "";
|
|
142
|
-
if (relPath) binPath =
|
|
141
|
+
if (relPath) binPath = require_paths_normalize.normalizePath(path.resolve(path.dirname(binPath), relPath));
|
|
143
142
|
}
|
|
144
143
|
} else {
|
|
145
144
|
let hasNoExt = extLowered === "";
|
|
@@ -151,7 +150,7 @@ function resolveRealBinSync(binPath) {
|
|
|
151
150
|
const baseBinPath = binPath.slice(0, binIndex + 10);
|
|
152
151
|
try {
|
|
153
152
|
if (fs.statSync(baseBinPath).isFile()) {
|
|
154
|
-
binPath =
|
|
153
|
+
binPath = require_paths_normalize.normalizePath(baseBinPath);
|
|
155
154
|
hasNoExt = !path.extname(binPath);
|
|
156
155
|
}
|
|
157
156
|
} catch {}
|
|
@@ -169,14 +168,14 @@ function resolveRealBinSync(binPath) {
|
|
|
169
168
|
}
|
|
170
169
|
if (relPath && basename === "pnpm" && require_primordials_string.StringPrototypeStartsWith(relPath, "pnpm/")) relPath = `../${relPath}`;
|
|
171
170
|
} else if (isNpmOrNpx) relPath = basename === "npm" ? /(?<=NPM_CLI_JS="\$CLI_BASEDIR\/).*(?=")/.exec(source)?.[0] || "" : /(?<=NPX_CLI_JS="\$CLI_BASEDIR\/).*(?=")/.exec(source)?.[0] || "";
|
|
172
|
-
if (relPath) binPath =
|
|
171
|
+
if (relPath) binPath = require_paths_normalize.normalizePath(path.resolve(path.dirname(binPath), relPath));
|
|
173
172
|
}
|
|
174
173
|
}
|
|
175
174
|
/* c8 ignore stop */
|
|
176
175
|
try {
|
|
177
|
-
return
|
|
176
|
+
return require_paths_normalize.normalizePath(fs.realpathSync.native(binPath));
|
|
178
177
|
} catch {}
|
|
179
|
-
return
|
|
178
|
+
return require_paths_normalize.normalizePath(binPath);
|
|
180
179
|
}
|
|
181
180
|
|
|
182
181
|
//#endregion
|
package/dist/bin/which.js
CHANGED
|
@@ -59,7 +59,7 @@ src_external_which = require_runtime.__toESM(src_external_which);
|
|
|
59
59
|
* path, the original path, or null if not found.
|
|
60
60
|
*/
|
|
61
61
|
async function which(binName, options) {
|
|
62
|
-
if (
|
|
62
|
+
if (require_paths_predicates.isPath(binName)) return binName;
|
|
63
63
|
try {
|
|
64
64
|
return await (0, src_external_which.default)(binName, options);
|
|
65
65
|
} catch {
|
|
@@ -80,7 +80,7 @@ async function which(binName, options) {
|
|
|
80
80
|
* @throws {Error} If the binary is not found and nothrow is false.
|
|
81
81
|
*/
|
|
82
82
|
async function whichReal(binName, options) {
|
|
83
|
-
const fs =
|
|
83
|
+
const fs = require_node_fs.getNodeFs();
|
|
84
84
|
const opts = {
|
|
85
85
|
__proto__: null,
|
|
86
86
|
nothrow: true,
|
|
@@ -107,7 +107,7 @@ async function whichReal(binName, options) {
|
|
|
107
107
|
if (opts?.all) {
|
|
108
108
|
const paths = require_primordials_array.ArrayIsArray(result) ? result : typeof result === "string" ? [result] : void 0;
|
|
109
109
|
if (paths?.length) {
|
|
110
|
-
const resolved = require_primordials_array.ArrayPrototypeMap(paths, (p) =>
|
|
110
|
+
const resolved = require_primordials_array.ArrayPrototypeMap(paths, (p) => require_bin_resolve.resolveRealBinSync(p));
|
|
111
111
|
require_bin__internal.binPathAllCache.set(binName, resolved);
|
|
112
112
|
return resolved;
|
|
113
113
|
}
|
|
@@ -115,7 +115,7 @@ async function whichReal(binName, options) {
|
|
|
115
115
|
}
|
|
116
116
|
if (!result) return;
|
|
117
117
|
/* c8 ignore stop */
|
|
118
|
-
const resolved =
|
|
118
|
+
const resolved = require_bin_resolve.resolveRealBinSync(result);
|
|
119
119
|
require_bin__internal.binPathCache.set(binName, resolved);
|
|
120
120
|
return resolved;
|
|
121
121
|
}
|
|
@@ -133,7 +133,7 @@ async function whichReal(binName, options) {
|
|
|
133
133
|
* @throws {Error} If the binary is not found and nothrow is false.
|
|
134
134
|
*/
|
|
135
135
|
function whichRealSync(binName, options) {
|
|
136
|
-
const fs =
|
|
136
|
+
const fs = require_node_fs.getNodeFs();
|
|
137
137
|
const opts = {
|
|
138
138
|
__proto__: null,
|
|
139
139
|
nothrow: true,
|
|
@@ -159,7 +159,7 @@ function whichRealSync(binName, options) {
|
|
|
159
159
|
if (opts.all) {
|
|
160
160
|
const paths = require_primordials_array.ArrayIsArray(result) ? result : typeof result === "string" ? [result] : void 0;
|
|
161
161
|
if (paths?.length) {
|
|
162
|
-
const resolved = require_primordials_array.ArrayPrototypeMap(paths, (p) =>
|
|
162
|
+
const resolved = require_primordials_array.ArrayPrototypeMap(paths, (p) => require_bin_resolve.resolveRealBinSync(p));
|
|
163
163
|
require_bin__internal.binPathAllCache.set(binName, resolved);
|
|
164
164
|
return resolved;
|
|
165
165
|
}
|
|
@@ -167,7 +167,7 @@ function whichRealSync(binName, options) {
|
|
|
167
167
|
}
|
|
168
168
|
if (!result) return;
|
|
169
169
|
/* c8 ignore stop */
|
|
170
|
-
const resolved =
|
|
170
|
+
const resolved = require_bin_resolve.resolveRealBinSync(result);
|
|
171
171
|
require_bin__internal.binPathCache.set(binName, resolved);
|
|
172
172
|
return resolved;
|
|
173
173
|
}
|
|
@@ -205,7 +205,7 @@ function whichRealSync(binName, options) {
|
|
|
205
205
|
* path if input is a path, or null if not found.
|
|
206
206
|
*/
|
|
207
207
|
function whichSync(binName, options) {
|
|
208
|
-
if (
|
|
208
|
+
if (require_paths_predicates.isPath(binName)) return binName;
|
|
209
209
|
try {
|
|
210
210
|
return src_external_which.default.sync(binName, options);
|
|
211
211
|
} catch {
|
package/dist/cache/ttl/store.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_primordials_error = require('../../primordials/error.js');
|
|
5
|
-
const require_primordials_string = require('../../primordials/string.js');
|
|
6
5
|
const require_primordials_math = require('../../primordials/math.js');
|
|
6
|
+
const require_primordials_string = require('../../primordials/string.js');
|
|
7
7
|
const require_primordials_regexp = require('../../primordials/regexp.js');
|
|
8
8
|
const require_primordials_map_set = require('../../primordials/map-set.js');
|
|
9
9
|
const require_primordials_date = require('../../primordials/date.js');
|
|
@@ -213,13 +213,13 @@ function createTtlCache(options) {
|
|
|
213
213
|
}
|
|
214
214
|
return await require_cacache_clear.clear({ prefix: fullPrefix }) ?? 0;
|
|
215
215
|
}
|
|
216
|
-
async function clear$1(
|
|
217
|
-
const
|
|
216
|
+
async function clear$1(clearOptions) {
|
|
217
|
+
const clearOpts = {
|
|
218
218
|
__proto__: null,
|
|
219
|
-
...
|
|
219
|
+
...clearOptions
|
|
220
220
|
};
|
|
221
221
|
memoCache.clear();
|
|
222
|
-
if (
|
|
222
|
+
if (clearOpts.memoOnly) return;
|
|
223
223
|
await deleteAll();
|
|
224
224
|
}
|
|
225
225
|
return {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file GENERATED — do not edit by hand. Run `node
|
|
3
|
-
* scripts/
|
|
4
|
-
* run build`) to regenerate from the `globals` npm package's
|
|
5
|
-
* crossed against src/primordials/*.ts `Ctor` exports. Source:
|
|
3
|
+
* scripts/post-build/make-primordials-defaults.mts` (also runs as part of
|
|
4
|
+
* `pnpm run build`) to regenerate from the `globals` npm package's
|
|
5
|
+
* globals.json crossed against src/primordials/*.ts `Ctor` exports. Source:
|
|
6
6
|
* globals@<bumped via taze>, env = builtin ∪ node. Filter: identifiers
|
|
7
7
|
* socket-lib exports as `<name>Ctor`.
|
|
8
8
|
*/
|
|
@@ -6,9 +6,9 @@ const require_primordials_object = require('../primordials/object.js');
|
|
|
6
6
|
//#region src/checks/primordials-defaults.ts
|
|
7
7
|
/**
|
|
8
8
|
* @file GENERATED — do not edit by hand. Run `node
|
|
9
|
-
* scripts/
|
|
10
|
-
* run build`) to regenerate from the `globals` npm package's
|
|
11
|
-
* crossed against src/primordials/*.ts `Ctor` exports. Source:
|
|
9
|
+
* scripts/post-build/make-primordials-defaults.mts` (also runs as part of
|
|
10
|
+
* `pnpm run build`) to regenerate from the `globals` npm package's
|
|
11
|
+
* globals.json crossed against src/primordials/*.ts `Ctor` exports. Source:
|
|
12
12
|
* globals@<bumped via taze>, env = builtin ∪ node. Filter: identifiers
|
|
13
13
|
* socket-lib exports as `<name>Ctor`.
|
|
14
14
|
*/
|
|
@@ -65,7 +65,7 @@ function checkPrimordials(config) {
|
|
|
65
65
|
}
|
|
66
66
|
const socketLibNames = readSocketLibPrimordialNames(resolveSocketLibPrimordials(config));
|
|
67
67
|
const findings = [];
|
|
68
|
-
for (const name of [...used].
|
|
68
|
+
for (const name of [...used].toSorted()) {
|
|
69
69
|
if (config.nodeInternalOnly.has(name)) continue;
|
|
70
70
|
if (socketLibNames.has(name)) continue;
|
|
71
71
|
const aliased = config.aliasMap.get(name);
|
|
@@ -85,7 +85,7 @@ function checkPrimordials(config) {
|
|
|
85
85
|
kind: "unmapped",
|
|
86
86
|
name,
|
|
87
87
|
files: usedToFiles.get(name) ?? [],
|
|
88
|
-
hint: `\`${name}\` is destructured from \`primordials\` but no socket-lib mapping exists. Pick one: ` +
|
|
88
|
+
hint: `\`${name}\` is destructured from \`primordials\` but no socket-lib mapping exists. Pick one: ` + require_arrays_join.joinOr([
|
|
89
89
|
`add \`${name}\` to the appropriate leaf under socket-lib/src/primordials/`,
|
|
90
90
|
`add a \`${name}\` → \`<libName>\` entry to the alias map`,
|
|
91
91
|
`add \`${name}\` to nodeInternalOnly (if Node-internal only)`
|
|
@@ -114,7 +114,8 @@ function collectJsFiles(dir) {
|
|
|
114
114
|
} catch {
|
|
115
115
|
continue;
|
|
116
116
|
}
|
|
117
|
-
for (
|
|
117
|
+
for (let i = 0, { length } = entries; i < length; i += 1) {
|
|
118
|
+
const name = entries[i];
|
|
118
119
|
const full = node_path.default.join(cur, name);
|
|
119
120
|
let stat;
|
|
120
121
|
try {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* success Exit codes: 0 — no drift 1 — drift detected (or config / lookup
|
|
10
10
|
* error)
|
|
11
11
|
*/
|
|
12
|
-
import {
|
|
12
|
+
import type { PrimordialsCheckConfig, PrimordialsCheckResult, PrimordialsFinding } from '../checks/primordials';
|
|
13
13
|
interface ParsedArgs {
|
|
14
14
|
readonly config: string | undefined;
|
|
15
15
|
readonly json: boolean;
|
|
@@ -17,7 +17,16 @@ interface ParsedArgs {
|
|
|
17
17
|
readonly silent: boolean;
|
|
18
18
|
readonly help: boolean;
|
|
19
19
|
}
|
|
20
|
+
interface SerializedFinding {
|
|
21
|
+
kind: PrimordialsFinding['kind'];
|
|
22
|
+
name: string;
|
|
23
|
+
files: readonly string[];
|
|
24
|
+
hint: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function loadConfig(configPath: string): PrimordialsCheckConfig;
|
|
20
27
|
export declare function parseArgs(argv: readonly string[]): ParsedArgs;
|
|
28
|
+
export declare function printHelp(): void;
|
|
29
|
+
export declare function renderHuman(result: PrimordialsCheckResult, args: ParsedArgs): void;
|
|
21
30
|
/**
|
|
22
31
|
* Pick the config file. Returns the explicit `--config` argument when given
|
|
23
32
|
* (even if it doesn't exist — the caller will surface the error with the path
|
|
@@ -26,19 +35,10 @@ export declare function parseArgs(argv: readonly string[]): ParsedArgs;
|
|
|
26
35
|
* "config file not found" error message names the canonical default.
|
|
27
36
|
*/
|
|
28
37
|
export declare function resolveConfigPath(explicit: string | undefined): string;
|
|
29
|
-
export declare function
|
|
30
|
-
export declare function loadConfig(configPath: string): PrimordialsCheckConfig;
|
|
31
|
-
interface SerializedFinding {
|
|
32
|
-
kind: PrimordialsFinding['kind'];
|
|
33
|
-
name: string;
|
|
34
|
-
files: readonly string[];
|
|
35
|
-
hint: string;
|
|
36
|
-
}
|
|
38
|
+
export declare function runCheckPrimordials(argv: readonly string[]): Promise<number>;
|
|
37
39
|
export declare function serialize(result: PrimordialsCheckResult): {
|
|
38
40
|
ok: boolean;
|
|
39
41
|
used: number;
|
|
40
42
|
findings: SerializedFinding[];
|
|
41
43
|
};
|
|
42
|
-
export declare function renderHuman(result: PrimordialsCheckResult, args: ParsedArgs): void;
|
|
43
|
-
export declare function runCheckPrimordials(argv: readonly string[]): Promise<number>;
|
|
44
44
|
export {};
|
|
@@ -4,8 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4
4
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
5
|
const require_primordials_error = require('../primordials/error.js');
|
|
6
6
|
const require_primordials_array = require('../primordials/array.js');
|
|
7
|
-
const
|
|
7
|
+
const require_primordials_map_set = require('../primordials/map-set.js');
|
|
8
8
|
const require_primordials_json = require('../primordials/json.js');
|
|
9
|
+
const require_primordials_object = require('../primordials/object.js');
|
|
9
10
|
const require_errors_message = require('../errors/message.js');
|
|
10
11
|
const require_logger_default = require('../logger/default.js');
|
|
11
12
|
const require_argv_parse = require('../argv/parse.js');
|
|
@@ -17,7 +18,7 @@ node_path = require_runtime.__toESM(node_path);
|
|
|
17
18
|
let node_process = require("node:process");
|
|
18
19
|
node_process = require_runtime.__toESM(node_process);
|
|
19
20
|
|
|
20
|
-
//#region src/
|
|
21
|
+
//#region src/cli/check-primordials.ts
|
|
21
22
|
/**
|
|
22
23
|
* @file `socket-lib check primordials` handler. Loads a JSON config from disk
|
|
23
24
|
* (default `primordials-coverage.config.json` at the repo root, override with
|
|
@@ -33,6 +34,32 @@ const logger = require_logger_default.getDefaultLogger();
|
|
|
33
34
|
const DEFAULT_CONFIG_PATH = ".socket-lib.json";
|
|
34
35
|
const FALLBACK_CONFIG_PATHS = [".socket-lib.json", ".config/socket-lib.json"];
|
|
35
36
|
const CONFIG_SECTION = "primordials";
|
|
37
|
+
function loadConfig(configPath) {
|
|
38
|
+
if (!(0, node_fs.existsSync)(configPath)) throw new require_primordials_error.ErrorCtor(`config file not found: ${configPath}`);
|
|
39
|
+
let parsed;
|
|
40
|
+
try {
|
|
41
|
+
parsed = require_primordials_json.JSONParse((0, node_fs.readFileSync)(configPath, "utf8"));
|
|
42
|
+
} catch (e) {
|
|
43
|
+
throw new require_primordials_error.ErrorCtor(`config file is not valid JSON: ${require_errors_message.errorMessage(e)}`);
|
|
44
|
+
}
|
|
45
|
+
if (typeof parsed !== "object" || parsed === null || require_primordials_array.ArrayIsArray(parsed)) throw new require_primordials_error.ErrorCtor("config root must be an object");
|
|
46
|
+
const root = parsed;
|
|
47
|
+
const sectional = root[CONFIG_SECTION];
|
|
48
|
+
const raw = sectional !== void 0 ? sectional : root;
|
|
49
|
+
if (!require_primordials_array.ArrayIsArray(raw.scanDirs)) throw new require_primordials_error.ErrorCtor(`config.scanDirs must be an array of strings (got ${typeof raw.scanDirs})`);
|
|
50
|
+
for (const [i, v] of raw.scanDirs.entries()) if (typeof v !== "string") throw new require_primordials_error.ErrorCtor(`config.scanDirs[${i}] must be a string`);
|
|
51
|
+
if (raw.aliasMap !== void 0 && (typeof raw.aliasMap !== "object" || raw.aliasMap === null || require_primordials_array.ArrayIsArray(raw.aliasMap))) throw new require_primordials_error.ErrorCtor("config.aliasMap must be an object of source→target");
|
|
52
|
+
if (raw.nodeInternalOnly !== void 0 && !require_primordials_array.ArrayIsArray(raw.nodeInternalOnly)) throw new require_primordials_error.ErrorCtor("config.nodeInternalOnly must be an array of strings");
|
|
53
|
+
const aliasMap = new require_primordials_map_set.MapCtor([...require_primordials_object.ObjectEntries(require_checks_primordials_defaults.DEFAULT_ALIAS_MAP), ...require_primordials_object.ObjectEntries(raw.aliasMap ?? {})]);
|
|
54
|
+
const nodeInternalOnly = new require_primordials_map_set.SetCtor([...require_checks_primordials_defaults.DEFAULT_NODE_INTERNAL_ONLY, ...(raw.nodeInternalOnly ?? []).filter((x) => typeof x === "string")]);
|
|
55
|
+
return {
|
|
56
|
+
scanDirs: raw.scanDirs,
|
|
57
|
+
aliasMap,
|
|
58
|
+
nodeInternalOnly,
|
|
59
|
+
socketLibPrimordialsPath: typeof raw.socketLibPrimordialsPath === "string" ? raw.socketLibPrimordialsPath : void 0,
|
|
60
|
+
repoRoot: node_process.default.cwd()
|
|
61
|
+
};
|
|
62
|
+
}
|
|
36
63
|
function parseArgs(argv) {
|
|
37
64
|
const { values } = require_argv_parse.parseArgs({
|
|
38
65
|
args: argv,
|
|
@@ -60,18 +87,6 @@ function parseArgs(argv) {
|
|
|
60
87
|
help: Boolean(values["help"])
|
|
61
88
|
};
|
|
62
89
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Pick the config file. Returns the explicit `--config` argument when given
|
|
65
|
-
* (even if it doesn't exist — the caller will surface the error with the path
|
|
66
|
-
* they typed). Otherwise probes the fallback list in order and returns the
|
|
67
|
-
* first hit. Returns the head of the list when none exist, so the caller's
|
|
68
|
-
* "config file not found" error message names the canonical default.
|
|
69
|
-
*/
|
|
70
|
-
function resolveConfigPath(explicit) {
|
|
71
|
-
if (explicit !== void 0) return explicit;
|
|
72
|
-
for (const candidate of FALLBACK_CONFIG_PATHS) if ((0, node_fs.existsSync)(node_path.default.resolve(candidate))) return candidate;
|
|
73
|
-
return FALLBACK_CONFIG_PATHS[0];
|
|
74
|
-
}
|
|
75
90
|
function printHelp() {
|
|
76
91
|
logger.log("socket-lib check primordials — primordials drift check");
|
|
77
92
|
logger.log("");
|
|
@@ -101,44 +116,6 @@ function printHelp() {
|
|
|
101
116
|
logger.log("A bare object (no `primordials` section) is also accepted for");
|
|
102
117
|
logger.log("repos that only run this one check.");
|
|
103
118
|
}
|
|
104
|
-
function loadConfig(configPath) {
|
|
105
|
-
if (!(0, node_fs.existsSync)(configPath)) throw new require_primordials_error.ErrorCtor(`config file not found: ${configPath}`);
|
|
106
|
-
let parsed;
|
|
107
|
-
try {
|
|
108
|
-
parsed = require_primordials_json.JSONParse((0, node_fs.readFileSync)(configPath, "utf8"));
|
|
109
|
-
} catch (e) {
|
|
110
|
-
throw new require_primordials_error.ErrorCtor(`config file is not valid JSON: ${require_errors_message.errorMessage(e)}`);
|
|
111
|
-
}
|
|
112
|
-
if (typeof parsed !== "object" || parsed === null || require_primordials_array.ArrayIsArray(parsed)) throw new require_primordials_error.ErrorCtor("config root must be an object");
|
|
113
|
-
const root = parsed;
|
|
114
|
-
const sectional = root[CONFIG_SECTION];
|
|
115
|
-
const raw = sectional !== void 0 ? sectional : root;
|
|
116
|
-
if (!require_primordials_array.ArrayIsArray(raw.scanDirs)) throw new require_primordials_error.ErrorCtor(`config.scanDirs must be an array of strings (got ${typeof raw.scanDirs})`);
|
|
117
|
-
for (const [i, v] of raw.scanDirs.entries()) if (typeof v !== "string") throw new require_primordials_error.ErrorCtor(`config.scanDirs[${i}] must be a string`);
|
|
118
|
-
if (raw.aliasMap !== void 0 && (typeof raw.aliasMap !== "object" || raw.aliasMap === null || require_primordials_array.ArrayIsArray(raw.aliasMap))) throw new require_primordials_error.ErrorCtor("config.aliasMap must be an object of source→target");
|
|
119
|
-
if (raw.nodeInternalOnly !== void 0 && !require_primordials_array.ArrayIsArray(raw.nodeInternalOnly)) throw new require_primordials_error.ErrorCtor("config.nodeInternalOnly must be an array of strings");
|
|
120
|
-
const aliasMap = new Map([...require_primordials_object.ObjectEntries(require_checks_primordials_defaults.DEFAULT_ALIAS_MAP), ...require_primordials_object.ObjectEntries(raw.aliasMap ?? {})]);
|
|
121
|
-
const nodeInternalOnly = new Set([...require_checks_primordials_defaults.DEFAULT_NODE_INTERNAL_ONLY, ...(raw.nodeInternalOnly ?? []).filter((x) => typeof x === "string")]);
|
|
122
|
-
return {
|
|
123
|
-
scanDirs: raw.scanDirs,
|
|
124
|
-
aliasMap,
|
|
125
|
-
nodeInternalOnly,
|
|
126
|
-
socketLibPrimordialsPath: typeof raw.socketLibPrimordialsPath === "string" ? raw.socketLibPrimordialsPath : void 0,
|
|
127
|
-
repoRoot: node_process.default.cwd()
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
function serialize(result) {
|
|
131
|
-
return {
|
|
132
|
-
ok: result.findings.length === 0,
|
|
133
|
-
used: result.used.size,
|
|
134
|
-
findings: result.findings.map((f) => ({
|
|
135
|
-
kind: f.kind,
|
|
136
|
-
name: f.name,
|
|
137
|
-
files: f.files,
|
|
138
|
-
hint: f.hint
|
|
139
|
-
}))
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
119
|
function renderHuman(result, args) {
|
|
143
120
|
if (result.findings.length === 0) {
|
|
144
121
|
if (!args.silent) logger.success(`Primordials coverage OK — ${result.used.size} names used, all accounted for.`);
|
|
@@ -157,6 +134,21 @@ function renderHuman(result, args) {
|
|
|
157
134
|
logger.error("Run with --explain for fix instructions and file references.");
|
|
158
135
|
}
|
|
159
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Pick the config file. Returns the explicit `--config` argument when given
|
|
139
|
+
* (even if it doesn't exist — the caller will surface the error with the path
|
|
140
|
+
* they typed). Otherwise probes the fallback list in order and returns the
|
|
141
|
+
* first hit. Returns the head of the list when none exist, so the caller's
|
|
142
|
+
* "config file not found" error message names the canonical default.
|
|
143
|
+
*/
|
|
144
|
+
function resolveConfigPath(explicit) {
|
|
145
|
+
if (explicit !== void 0) return explicit;
|
|
146
|
+
for (let i = 0, { length } = FALLBACK_CONFIG_PATHS; i < length; i += 1) {
|
|
147
|
+
const candidate = FALLBACK_CONFIG_PATHS[i];
|
|
148
|
+
if ((0, node_fs.existsSync)(node_path.default.resolve(candidate))) return candidate;
|
|
149
|
+
}
|
|
150
|
+
return FALLBACK_CONFIG_PATHS[0];
|
|
151
|
+
}
|
|
160
152
|
async function runCheckPrimordials(argv) {
|
|
161
153
|
const args = parseArgs(argv);
|
|
162
154
|
if (args.help) {
|
|
@@ -181,6 +173,18 @@ async function runCheckPrimordials(argv) {
|
|
|
181
173
|
else renderHuman(result, args);
|
|
182
174
|
return result.findings.length === 0 ? 0 : 1;
|
|
183
175
|
}
|
|
176
|
+
function serialize(result) {
|
|
177
|
+
return {
|
|
178
|
+
ok: result.findings.length === 0,
|
|
179
|
+
used: result.used.size,
|
|
180
|
+
findings: result.findings.map((f) => ({
|
|
181
|
+
kind: f.kind,
|
|
182
|
+
name: f.name,
|
|
183
|
+
files: f.files,
|
|
184
|
+
hint: f.hint
|
|
185
|
+
}))
|
|
186
|
+
};
|
|
187
|
+
}
|
|
184
188
|
|
|
185
189
|
//#endregion
|
|
186
190
|
exports.loadConfig = loadConfig;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with rolldown */
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_primordials_map_set = require('../primordials/map-set.js');
|
|
4
5
|
const require_logger_default = require('../logger/default.js');
|
|
5
|
-
const
|
|
6
|
+
const require_cli_check_primordials = require('./check-primordials.js');
|
|
6
7
|
|
|
7
|
-
//#region src/
|
|
8
|
+
//#region src/cli/check.ts
|
|
8
9
|
/**
|
|
9
10
|
* @file `socket-lib check <name>` subcommand group. Routes to per-check
|
|
10
11
|
* handlers by name. Each check resolves its config file and runs its check;
|
|
@@ -14,8 +15,8 @@ const require_bin_check_primordials = require('./check-primordials.js');
|
|
|
14
15
|
* prim → primordials.
|
|
15
16
|
*/
|
|
16
17
|
const logger = require_logger_default.getDefaultLogger();
|
|
17
|
-
const CHECKS = new
|
|
18
|
-
const ALIASES = new
|
|
18
|
+
const CHECKS = new require_primordials_map_set.MapCtor([["primordials", "primordials"], ["prim", "primordials"]]);
|
|
19
|
+
const ALIASES = new require_primordials_map_set.MapCtor([["primordials", ["prim"]]]);
|
|
19
20
|
function printHelp() {
|
|
20
21
|
logger.log("socket-lib check — fleet-wide static-analysis checks");
|
|
21
22
|
logger.log("");
|
|
@@ -43,7 +44,7 @@ async function runCheck(args) {
|
|
|
43
44
|
return 1;
|
|
44
45
|
}
|
|
45
46
|
switch (canonical) {
|
|
46
|
-
case "primordials": return await
|
|
47
|
+
case "primordials": return await require_cli_check_primordials.runCheckPrimordials(args.slice(1));
|
|
47
48
|
/* c8 ignore start */
|
|
48
49
|
default:
|
|
49
50
|
logger.error(`socket-lib check: missing handler for '${canonical}'`);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @file `socket-lib` CLI entry point — top-level dispatcher. socket-lib — print
|
|
4
4
|
* help, list commands socket-lib check <name> [opts...] — run a fleet-wide
|
|
5
|
-
* check Subcommands live as siblings under `src/
|
|
5
|
+
* check Subcommands live as siblings under `src/cli/`; each is its own file
|
|
6
6
|
* so a misbehaving check can't crash other commands at parse time. The
|
|
7
7
|
* dispatcher just routes; subcommands own their own arg parsing. The CLI is
|
|
8
8
|
* shipped via the `bin` field in package.json and intended to be invoked as
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
5
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
6
6
|
const require_logger_default = require('../logger/default.js');
|
|
7
|
-
const
|
|
7
|
+
const require_cli_check = require('./check.js');
|
|
8
8
|
let node_process = require("node:process");
|
|
9
9
|
node_process = require_runtime.__toESM(node_process);
|
|
10
10
|
|
|
11
|
-
//#region src/
|
|
11
|
+
//#region src/cli/socket-lib.ts
|
|
12
12
|
/**
|
|
13
13
|
* @file `socket-lib` CLI entry point — top-level dispatcher. socket-lib — print
|
|
14
14
|
* help, list commands socket-lib check <name> [opts...] — run a fleet-wide
|
|
15
|
-
* check Subcommands live as siblings under `src/
|
|
15
|
+
* check Subcommands live as siblings under `src/cli/`; each is its own file
|
|
16
16
|
* so a misbehaving check can't crash other commands at parse time. The
|
|
17
17
|
* dispatcher just routes; subcommands own their own arg parsing. The CLI is
|
|
18
18
|
* shipped via the `bin` field in package.json and intended to be invoked as
|
|
@@ -38,7 +38,7 @@ async function main(args = node_process.default.argv.slice(2)) {
|
|
|
38
38
|
return 0;
|
|
39
39
|
}
|
|
40
40
|
switch (command) {
|
|
41
|
-
case "check": return await
|
|
41
|
+
case "check": return await require_cli_check.runCheck(args.slice(1));
|
|
42
42
|
default:
|
|
43
43
|
logger.error(`socket-lib: unknown command '${command}'`);
|
|
44
44
|
logger.error("Run `socket-lib --help` for the list of commands.");
|
|
@@ -43,7 +43,6 @@ const HEX_BY_THEME = {
|
|
|
43
43
|
* `\x1b[39m` resets fg to the terminal default — using `[0m` would also clear
|
|
44
44
|
* bg / styles, which the caller may have set deliberately.
|
|
45
45
|
*/
|
|
46
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
47
46
|
function colorizer(hex) {
|
|
48
47
|
const prefix = `\x1b[38;2;${parseInt(hex.slice(1, 3), 16)};${parseInt(hex.slice(3, 5), 16)};${parseInt(hex.slice(5, 7), 16)}m`;
|
|
49
48
|
const suffix = "\x1B[39m";
|
|
@@ -61,18 +60,17 @@ function colorizer(hex) {
|
|
|
61
60
|
* process.stdout.write(palette.success('Build complete\n'))
|
|
62
61
|
* ```
|
|
63
62
|
*/
|
|
64
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
65
63
|
function getPalette(theme = "dark") {
|
|
66
64
|
const hex = HEX_BY_THEME[theme];
|
|
67
65
|
return {
|
|
68
|
-
alert:
|
|
69
|
-
error:
|
|
66
|
+
alert: colorizer(hex.alert),
|
|
67
|
+
error: colorizer(hex.error),
|
|
70
68
|
hex,
|
|
71
|
-
info:
|
|
72
|
-
socketPink:
|
|
73
|
-
socketPurple:
|
|
74
|
-
success:
|
|
75
|
-
warning:
|
|
69
|
+
info: colorizer(hex.info),
|
|
70
|
+
socketPink: colorizer(hex.socketPink),
|
|
71
|
+
socketPurple: colorizer(hex.socketPurple),
|
|
72
|
+
success: colorizer(hex.success),
|
|
73
|
+
warning: colorizer(hex.warning)
|
|
76
74
|
};
|
|
77
75
|
}
|
|
78
76
|
|
|
@@ -6,6 +6,18 @@
|
|
|
6
6
|
* no callers outside this directory.
|
|
7
7
|
*/
|
|
8
8
|
import type { CompressFileOptions, CompressOptions } from './types';
|
|
9
|
+
export interface ResolvedFileArgs {
|
|
10
|
+
destPath: string;
|
|
11
|
+
options: CompressOptions | undefined;
|
|
12
|
+
inPlace: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Disambiguate the `(src, dest, options?)` and `(src, options)` call shapes.
|
|
16
|
+
* Returns the resolved destPath, options, and inPlace flag. Validates that the
|
|
17
|
+
* explicit destPath is not the same as srcPath, since same-path streams would
|
|
18
|
+
* deadlock on read.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveFileArgs(fnName: string, srcPath: string, destOrOptions: string | CompressFileOptions | undefined, maybeOptions: CompressOptions | undefined, computeInPlaceDest: (src: string) => string): ResolvedFileArgs;
|
|
9
21
|
/**
|
|
10
22
|
* Strip the trailing extension from a filename when it matches one of `exts`.
|
|
11
23
|
* Returns the input unchanged when the trailing extname isn't in the set.
|
|
@@ -19,15 +31,3 @@ import type { CompressFileOptions, CompressOptions } from './types';
|
|
|
19
31
|
* `decompressGzipFile` for the canonical example).
|
|
20
32
|
*/
|
|
21
33
|
export declare function stripExt(filePath: string, exts: ReadonlySet<string>): string;
|
|
22
|
-
export interface ResolvedFileArgs {
|
|
23
|
-
destPath: string;
|
|
24
|
-
options: CompressOptions | undefined;
|
|
25
|
-
inPlace: boolean;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Disambiguate the `(src, dest, options?)` and `(src, options)` call shapes.
|
|
29
|
-
* Returns the resolved destPath, options, and inPlace flag. Validates that the
|
|
30
|
-
* explicit destPath is not the same as srcPath, since same-path streams would
|
|
31
|
-
* deadlock on read.
|
|
32
|
-
*/
|
|
33
|
-
export declare function resolveFileArgs(fnName: string, srcPath: string, destOrOptions: string | CompressFileOptions | undefined, maybeOptions: CompressOptions | undefined, computeInPlaceDest: (src: string) => string): ResolvedFileArgs;
|