@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
|
@@ -24,7 +24,7 @@ let src_external__npmcli_package_json_lib_sort = require("../external/@npmcli/pa
|
|
|
24
24
|
*
|
|
25
25
|
* - `getEditablePackageJsonClass` — lazy class accessor (Webpack-safe)
|
|
26
26
|
*/
|
|
27
|
-
let
|
|
27
|
+
let cachedEditablePackageJsonClass;
|
|
28
28
|
/**
|
|
29
29
|
* Get the EditablePackageJson class for package.json manipulation.
|
|
30
30
|
*
|
|
@@ -35,9 +35,8 @@ let _EditablePackageJsonClass;
|
|
|
35
35
|
* console.log(pkg.content.name)
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
39
38
|
function getEditablePackageJsonClass() {
|
|
40
|
-
if (
|
|
39
|
+
if (cachedEditablePackageJsonClass === void 0) cachedEditablePackageJsonClass = class EditablePackageJson extends src_external__npmcli_package_json.default {
|
|
41
40
|
static fixSteps = src_external__npmcli_package_json.default.fixSteps;
|
|
42
41
|
static normalizeSteps = src_external__npmcli_package_json.default.normalizeSteps;
|
|
43
42
|
static prepareSteps = src_external__npmcli_package_json.default.prepareSteps;
|
|
@@ -52,20 +51,20 @@ function getEditablePackageJsonClass() {
|
|
|
52
51
|
const path = this._path;
|
|
53
52
|
if (!path) return "";
|
|
54
53
|
if (require_primordials_string.StringPrototypeEndsWith(path, "package.json")) return path;
|
|
55
|
-
return
|
|
54
|
+
return require_node_path.getNodePath().join(path, "package.json");
|
|
56
55
|
}
|
|
57
56
|
static async create(path, opts = {}) {
|
|
58
|
-
const p = new
|
|
57
|
+
const p = new cachedEditablePackageJsonClass();
|
|
59
58
|
await p.create(path);
|
|
60
59
|
return opts.data ? p.update(opts.data) : p;
|
|
61
60
|
}
|
|
62
61
|
static async fix(path, opts) {
|
|
63
|
-
const p = new
|
|
62
|
+
const p = new cachedEditablePackageJsonClass();
|
|
64
63
|
await p.load(path, true);
|
|
65
64
|
return await p.fix(opts);
|
|
66
65
|
}
|
|
67
66
|
static async load(path, opts = {}) {
|
|
68
|
-
const p = new
|
|
67
|
+
const p = new cachedEditablePackageJsonClass();
|
|
69
68
|
if (!opts.create) return await p.load(path);
|
|
70
69
|
try {
|
|
71
70
|
return await p.load(path);
|
|
@@ -75,12 +74,12 @@ function getEditablePackageJsonClass() {
|
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
76
|
static async normalize(path, opts) {
|
|
78
|
-
const p = new
|
|
77
|
+
const p = new cachedEditablePackageJsonClass();
|
|
79
78
|
await p.load(path);
|
|
80
79
|
return await p.normalize(opts);
|
|
81
80
|
}
|
|
82
81
|
static async prepare(path, opts) {
|
|
83
|
-
const p = new
|
|
82
|
+
const p = new cachedEditablePackageJsonClass();
|
|
84
83
|
await p.load(path, true);
|
|
85
84
|
return await p.prepare(opts);
|
|
86
85
|
}
|
|
@@ -104,7 +103,7 @@ function getEditablePackageJsonClass() {
|
|
|
104
103
|
}
|
|
105
104
|
async load(path, create) {
|
|
106
105
|
this._path = path;
|
|
107
|
-
const { promises: fsPromises } =
|
|
106
|
+
const { promises: fsPromises } = require_node_fs.getNodeFs();
|
|
108
107
|
let parseErr;
|
|
109
108
|
try {
|
|
110
109
|
this._readFileContent = await (0, src_external__npmcli_package_json_lib_read_package.read)(this.filename);
|
|
@@ -113,7 +112,7 @@ function getEditablePackageJsonClass() {
|
|
|
113
112
|
parseErr = e;
|
|
114
113
|
}
|
|
115
114
|
if (parseErr) {
|
|
116
|
-
const indexFile =
|
|
115
|
+
const indexFile = require_node_path.getNodePath().resolve(this.path || "", "index.js");
|
|
117
116
|
let indexFileContent;
|
|
118
117
|
try {
|
|
119
118
|
indexFileContent = await fsPromises.readFile(indexFile, "utf8");
|
|
@@ -151,7 +150,7 @@ function getEditablePackageJsonClass() {
|
|
|
151
150
|
})) return false;
|
|
152
151
|
const content = require_json_format.stripFormattingSymbols(this.content);
|
|
153
152
|
const fileContent = require_json_format.stringifyWithFormatting(options?.sort ? (0, src_external__npmcli_package_json_lib_sort.packageSort)(content) : content, require_json_format.getFormattingFromContent(this.content));
|
|
154
|
-
const { promises: fsPromises } =
|
|
153
|
+
const { promises: fsPromises } = require_node_fs.getNodeFs();
|
|
155
154
|
await fsPromises.writeFile(this.filename, fileContent);
|
|
156
155
|
this._readFileContent = fileContent;
|
|
157
156
|
this._readFileJson = (0, src_external__npmcli_package_json_lib_read_package.parse)(fileContent);
|
|
@@ -165,12 +164,12 @@ function getEditablePackageJsonClass() {
|
|
|
165
164
|
};
|
|
166
165
|
const { [Symbol.for("indent")]: indent, [Symbol.for("newline")]: newline, ...rest } = this.content;
|
|
167
166
|
const content = sort ? (0, src_external__npmcli_package_json_lib_sort.packageSort)(rest) : rest;
|
|
168
|
-
if (ignoreWhitespace &&
|
|
167
|
+
if (ignoreWhitespace && require_node_util.getNodeUtil().isDeepStrictEqual(content, this._readFileJson)) return false;
|
|
169
168
|
const format = indent === void 0 || indent === null ? " " : indent;
|
|
170
169
|
const eol = newline === void 0 || newline === null ? "\n" : newline;
|
|
171
170
|
const fileContent = `${require_primordials_json.JSONStringify(content, void 0, format)}\n`.replace(/\n/g, eol);
|
|
172
171
|
if (!ignoreWhitespace && fileContent.trim() === this._readFileContent.trim()) return false;
|
|
173
|
-
|
|
172
|
+
require_node_fs.getNodeFs().writeFileSync(this.filename, fileContent);
|
|
174
173
|
this._readFileContent = fileContent;
|
|
175
174
|
this._readFileJson = (0, src_external__npmcli_package_json_lib_read_package.parse)(fileContent);
|
|
176
175
|
return true;
|
|
@@ -187,7 +186,7 @@ function getEditablePackageJsonClass() {
|
|
|
187
186
|
if (!this._canSave || this.content === void 0) return false;
|
|
188
187
|
const { [Symbol.for("indent")]: indent, [Symbol.for("newline")]: newline, ...rest } = this.content;
|
|
189
188
|
const content = sort ? (0, src_external__npmcli_package_json_lib_sort.packageSort)(rest) : rest;
|
|
190
|
-
if (ignoreWhitespace &&
|
|
189
|
+
if (ignoreWhitespace && require_node_util.getNodeUtil().isDeepStrictEqual(content, this._readFileJson)) return false;
|
|
191
190
|
const format = indent === void 0 || indent === null ? " " : indent;
|
|
192
191
|
const eol = newline === void 0 || newline === null ? "\n" : newline;
|
|
193
192
|
const fileContent = `${require_primordials_json.JSONStringify(content, void 0, format)}\n`.replace(/\n/g, eol);
|
|
@@ -195,7 +194,7 @@ function getEditablePackageJsonClass() {
|
|
|
195
194
|
return true;
|
|
196
195
|
}
|
|
197
196
|
};
|
|
198
|
-
return
|
|
197
|
+
return cachedEditablePackageJsonClass;
|
|
199
198
|
}
|
|
200
199
|
|
|
201
200
|
//#endregion
|
package/dist/packages/edit.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
const require_paths_predicates = require('../paths/predicates.js');
|
|
5
5
|
const require_primordials_json = require('../primordials/json.js');
|
|
6
|
-
const require_packages_normalize = require('./normalize.js');
|
|
7
|
-
const require_paths_packages = require('../paths/packages.js');
|
|
8
6
|
const require_packages_edit_class = require('./edit-class.js');
|
|
7
|
+
const require_paths_packages = require('../paths/packages.js');
|
|
8
|
+
const require_packages_normalize = require('./normalize.js');
|
|
9
9
|
|
|
10
10
|
//#region src/packages/edit.ts
|
|
11
11
|
/**
|
|
@@ -35,18 +35,17 @@ const require_packages_edit_class = require('./edit-class.js');
|
|
|
35
35
|
* )
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
39
38
|
async function toEditablePackageJson(pkgJson, options) {
|
|
40
39
|
const { path: filepath, ...restOptions } = {
|
|
41
40
|
__proto__: null,
|
|
42
41
|
...options
|
|
43
42
|
};
|
|
44
43
|
const { normalize, ...normalizeOptions } = restOptions;
|
|
45
|
-
const EditablePackageJson =
|
|
46
|
-
if (typeof filepath !== "string") return new EditablePackageJson().fromContent(normalize ?
|
|
47
|
-
const pkgJsonPath =
|
|
48
|
-
return (await EditablePackageJson.load(pkgJsonPath, { create: true })).fromJSON(`${require_primordials_json.JSONStringify(normalize ?
|
|
49
|
-
|
|
44
|
+
const EditablePackageJson = require_packages_edit_class.getEditablePackageJsonClass();
|
|
45
|
+
if (typeof filepath !== "string") return new EditablePackageJson().fromContent(normalize ? require_packages_normalize.normalizePackageJson(pkgJson, normalizeOptions) : pkgJson);
|
|
46
|
+
const pkgJsonPath = require_paths_packages.resolvePackageJsonDirname(filepath);
|
|
47
|
+
return (await EditablePackageJson.load(pkgJsonPath, { create: true })).fromJSON(`${require_primordials_json.JSONStringify(normalize ? require_packages_normalize.normalizePackageJson(pkgJson, {
|
|
48
|
+
...require_paths_predicates.isNodeModules(pkgJsonPath) ? {} : { preserve: ["repository"] },
|
|
50
49
|
...normalizeOptions
|
|
51
50
|
}) : pkgJson, void 0, 2)}\n`);
|
|
52
51
|
}
|
|
@@ -62,18 +61,17 @@ async function toEditablePackageJson(pkgJson, options) {
|
|
|
62
61
|
* )
|
|
63
62
|
* ```
|
|
64
63
|
*/
|
|
65
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
66
64
|
function toEditablePackageJsonSync(pkgJson, options) {
|
|
67
65
|
const { path: filepath, ...restOptions } = {
|
|
68
66
|
__proto__: null,
|
|
69
67
|
...options
|
|
70
68
|
};
|
|
71
69
|
const { normalize, ...normalizeOptions } = restOptions;
|
|
72
|
-
const EditablePackageJson =
|
|
73
|
-
if (typeof filepath !== "string") return new EditablePackageJson().fromContent(normalize ?
|
|
74
|
-
const pkgJsonPath =
|
|
75
|
-
return new EditablePackageJson().create(pkgJsonPath).fromJSON(`${require_primordials_json.JSONStringify(normalize ?
|
|
76
|
-
|
|
70
|
+
const EditablePackageJson = require_packages_edit_class.getEditablePackageJsonClass();
|
|
71
|
+
if (typeof filepath !== "string") return new EditablePackageJson().fromContent(normalize ? require_packages_normalize.normalizePackageJson(pkgJson, normalizeOptions) : pkgJson);
|
|
72
|
+
const pkgJsonPath = require_paths_packages.resolvePackageJsonDirname(filepath);
|
|
73
|
+
return new EditablePackageJson().create(pkgJsonPath).fromJSON(`${require_primordials_json.JSONStringify(normalize ? require_packages_normalize.normalizePackageJson(pkgJson, {
|
|
74
|
+
...require_paths_predicates.isNodeModules(pkgJsonPath) ? {} : { preserve: ["repository"] },
|
|
77
75
|
...normalizeOptions
|
|
78
76
|
}) : pkgJson, void 0, 2)}\n`);
|
|
79
77
|
}
|
package/dist/packages/exports.js
CHANGED
|
@@ -26,7 +26,6 @@ const require_objects_predicates = require('../objects/predicates.js');
|
|
|
26
26
|
* // types === './dist/index.d.ts'
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
30
29
|
function findTypesForSubpath(entryExports, subpath) {
|
|
31
30
|
const queue = [entryExports];
|
|
32
31
|
let pos = 0;
|
|
@@ -36,14 +35,14 @@ function findTypesForSubpath(entryExports, subpath) {
|
|
|
36
35
|
if (require_arrays_predicates.isArray(value)) for (let i = 0, { length } = value; i < length; i += 1) {
|
|
37
36
|
const item = value[i];
|
|
38
37
|
if (item === subpath) return value.types;
|
|
39
|
-
if (
|
|
38
|
+
if (require_objects_predicates.isObject(item)) queue.push(item);
|
|
40
39
|
}
|
|
41
|
-
else if (
|
|
40
|
+
else if (require_objects_predicates.isObject(value)) {
|
|
42
41
|
const keys = require_primordials_object.ObjectGetOwnPropertyNames(value);
|
|
43
42
|
for (let i = 0, { length } = keys; i < length; i += 1) {
|
|
44
43
|
const item = value[keys[i]];
|
|
45
44
|
if (item === subpath) return value.types;
|
|
46
|
-
if (
|
|
45
|
+
if (require_objects_predicates.isObject(item)) queue.push(item);
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
}
|
|
@@ -57,20 +56,19 @@ function findTypesForSubpath(entryExports, subpath) {
|
|
|
57
56
|
* getExportFilePaths(exports) // ['./dist/index.js', './dist/utils.js']
|
|
58
57
|
* ```
|
|
59
58
|
*/
|
|
60
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
61
59
|
function getExportFilePaths(entryExports) {
|
|
62
|
-
if (
|
|
60
|
+
if (!require_objects_predicates.isObject(entryExports)) return [];
|
|
63
61
|
const paths = [];
|
|
64
62
|
for (const key of require_primordials_object.ObjectGetOwnPropertyNames(entryExports)) {
|
|
65
63
|
if (!require_primordials_string.StringPrototypeStartsWith(key, ".")) continue;
|
|
66
64
|
const value = entryExports[key];
|
|
67
65
|
if (typeof value === "string") require_primordials_array.ArrayPrototypePush(paths, value);
|
|
68
|
-
else if (
|
|
66
|
+
else if (require_objects_predicates.isObject(value)) for (const subKey of require_primordials_object.ObjectGetOwnPropertyNames(value)) {
|
|
69
67
|
const subValue = value[subKey];
|
|
70
68
|
if (typeof subValue === "string") require_primordials_array.ArrayPrototypePush(paths, subValue);
|
|
71
69
|
else if (require_arrays_predicates.isArray(subValue)) {
|
|
72
70
|
for (const item of subValue) if (typeof item === "string") require_primordials_array.ArrayPrototypePush(paths, item);
|
|
73
|
-
else if (
|
|
71
|
+
else if (require_objects_predicates.isObject(item)) for (const nestedKey of require_primordials_object.ObjectGetOwnPropertyNames(item)) {
|
|
74
72
|
const nestedValue = item[nestedKey];
|
|
75
73
|
if (typeof nestedValue === "string") require_primordials_array.ArrayPrototypePush(paths, nestedValue);
|
|
76
74
|
}
|
|
@@ -88,9 +86,8 @@ function getExportFilePaths(entryExports) {
|
|
|
88
86
|
* getSubpaths(exports) // ['.', './utils']
|
|
89
87
|
* ```
|
|
90
88
|
*/
|
|
91
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
92
89
|
function getSubpaths(entryExports) {
|
|
93
|
-
if (
|
|
90
|
+
if (!require_objects_predicates.isObject(entryExports)) return [];
|
|
94
91
|
return require_primordials_object.ObjectGetOwnPropertyNames(entryExports).filter((key) => require_primordials_string.StringPrototypeStartsWith(key, "."));
|
|
95
92
|
}
|
|
96
93
|
/**
|
|
@@ -102,9 +99,8 @@ function getSubpaths(entryExports) {
|
|
|
102
99
|
* isConditionalExports({ '.': './index.js' }) // false
|
|
103
100
|
* ```
|
|
104
101
|
*/
|
|
105
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
106
102
|
function isConditionalExports(entryExports) {
|
|
107
|
-
if (
|
|
103
|
+
if (!require_objects_predicates.isPlainObject(entryExports)) return false;
|
|
108
104
|
const keys = require_primordials_object.ObjectGetOwnPropertyNames(entryExports);
|
|
109
105
|
const { length } = keys;
|
|
110
106
|
if (!length) return false;
|
|
@@ -123,9 +119,8 @@ function isConditionalExports(entryExports) {
|
|
|
123
119
|
* isSubpathExports({ import: './index.mjs' }) // false
|
|
124
120
|
* ```
|
|
125
121
|
*/
|
|
126
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
127
122
|
function isSubpathExports(entryExports) {
|
|
128
|
-
if (
|
|
123
|
+
if (require_objects_predicates.isPlainObject(entryExports)) {
|
|
129
124
|
const keys = require_primordials_object.ObjectGetOwnPropertyNames(entryExports);
|
|
130
125
|
for (let i = 0, { length } = keys; i < length; i += 1) if (keys[i]?.charCodeAt(0) === 46) return true;
|
|
131
126
|
}
|
|
@@ -143,11 +138,10 @@ function isSubpathExports(entryExports) {
|
|
|
143
138
|
* // { '.': './index.js' }
|
|
144
139
|
* ```
|
|
145
140
|
*/
|
|
146
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
147
141
|
function resolvePackageJsonEntryExports(entryExports) {
|
|
148
142
|
if (typeof entryExports === "string" || require_arrays_predicates.isArray(entryExports)) return { ".": entryExports };
|
|
149
|
-
if (
|
|
150
|
-
return
|
|
143
|
+
if (isConditionalExports(entryExports)) return entryExports;
|
|
144
|
+
return require_objects_predicates.isObject(entryExports) ? entryExports : void 0;
|
|
151
145
|
}
|
|
152
146
|
|
|
153
147
|
//#endregion
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Network-facing package helpers: the lazily-initialized
|
|
3
|
+
* make-fetch-happen fetcher (shared cache) and GitHub tarball-URL resolution
|
|
4
|
+
* for a package spec.
|
|
5
|
+
*/
|
|
6
|
+
import makeFetchHappen from '../external/make-fetch-happen';
|
|
7
|
+
export declare function getFetcher(): ReturnType<typeof makeFetchHappen.defaults>;
|
|
8
|
+
/**
|
|
9
|
+
* Resolve GitHub tarball URL for a package specifier.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ;```typescript
|
|
13
|
+
* const url = await resolveGitHubTgzUrl('my-pkg@1.0.0', '/tmp/my-project')
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveGitHubTgzUrl(pkgNameOrId: string, where?: unknown): Promise<string>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with rolldown */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
5
|
+
const require_objects_predicates = require('../objects/predicates.js');
|
|
6
|
+
const require_constants_packages = require('../constants/packages.js');
|
|
7
|
+
const require_packages_specs = require('./specs.js');
|
|
8
|
+
const require_packages_read = require('./read.js');
|
|
9
|
+
let src_external_npm_package_arg = require("../external/npm-package-arg");
|
|
10
|
+
src_external_npm_package_arg = require_runtime.__toESM(src_external_npm_package_arg);
|
|
11
|
+
let src_external_make_fetch_happen = require("../external/make-fetch-happen");
|
|
12
|
+
src_external_make_fetch_happen = require_runtime.__toESM(src_external_make_fetch_happen);
|
|
13
|
+
|
|
14
|
+
//#region src/packages/fetch.ts
|
|
15
|
+
/**
|
|
16
|
+
* @file Network-facing package helpers: the lazily-initialized
|
|
17
|
+
* make-fetch-happen fetcher (shared cache) and GitHub tarball-URL resolution
|
|
18
|
+
* for a package spec.
|
|
19
|
+
*/
|
|
20
|
+
const pacoteCachePath = require_constants_packages.getPacoteCachePath();
|
|
21
|
+
let cachedFetcher;
|
|
22
|
+
function getFetcher() {
|
|
23
|
+
if (cachedFetcher === void 0) cachedFetcher = src_external_make_fetch_happen.default.defaults({
|
|
24
|
+
cachePath: pacoteCachePath,
|
|
25
|
+
cache: "force-cache"
|
|
26
|
+
});
|
|
27
|
+
return cachedFetcher;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolve GitHub tarball URL for a package specifier.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ;```typescript
|
|
34
|
+
* const url = await resolveGitHubTgzUrl('my-pkg@1.0.0', '/tmp/my-project')
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
async function resolveGitHubTgzUrl(pkgNameOrId, where) {
|
|
38
|
+
const whereIsPkgJson = require_objects_predicates.isPlainObject(where);
|
|
39
|
+
const pkgJson = whereIsPkgJson ? where : await require_packages_read.readPackageJson(where, { normalize: true });
|
|
40
|
+
if (!pkgJson) return "";
|
|
41
|
+
const { version } = pkgJson;
|
|
42
|
+
const parsedSpec = (0, src_external_npm_package_arg.default)(pkgNameOrId, whereIsPkgJson ? void 0 : where);
|
|
43
|
+
if (require_packages_specs.isGitHubTgzSpec(parsedSpec)) return parsedSpec.saveSpec || "";
|
|
44
|
+
const isGitHubUrl = require_packages_specs.isGitHubUrlSpec(parsedSpec);
|
|
45
|
+
const repository = pkgJson.repository;
|
|
46
|
+
const { project, user } = (isGitHubUrl ? parsedSpec.hosted : require_packages_specs.getRepoUrlDetails(repository?.url)) || {
|
|
47
|
+
project: "",
|
|
48
|
+
user: ""
|
|
49
|
+
};
|
|
50
|
+
/* c8 ignore start - External GitHub API calls */
|
|
51
|
+
if (user && project) {
|
|
52
|
+
const fetcher = getFetcher();
|
|
53
|
+
let apiUrl = "";
|
|
54
|
+
if (isGitHubUrl) apiUrl = require_packages_specs.gitHubTagRefUrl(user, project, parsedSpec.gitCommittish || "");
|
|
55
|
+
else {
|
|
56
|
+
const versionStr = version;
|
|
57
|
+
apiUrl = require_packages_specs.gitHubTagRefUrl(user, project, `v${versionStr}`);
|
|
58
|
+
if (!(await fetcher(apiUrl, { method: "head" })).ok) {
|
|
59
|
+
apiUrl = require_packages_specs.gitHubTagRefUrl(user, project, versionStr);
|
|
60
|
+
if (!(await fetcher(apiUrl, { method: "head" })).ok) apiUrl = "";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (apiUrl) {
|
|
64
|
+
const resp = await fetcher(apiUrl);
|
|
65
|
+
let json;
|
|
66
|
+
try {
|
|
67
|
+
json = await resp.json();
|
|
68
|
+
} catch {
|
|
69
|
+
json = void 0;
|
|
70
|
+
}
|
|
71
|
+
const sha = json?.object?.sha;
|
|
72
|
+
if (sha) return require_packages_specs.gitHubTgzUrl(user, project, sha);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/* c8 ignore stop */
|
|
76
|
+
return "";
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
//#endregion
|
|
80
|
+
exports.getFetcher = getFetcher;
|
|
81
|
+
exports.resolveGitHubTgzUrl = resolveGitHubTgzUrl;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Find the nearest package.json (or other marker) walking up from an
|
|
3
|
+
* `import.meta` — the package-domain wrapper over the generic `findUpSync`
|
|
4
|
+
* lookup in `fs/find`. Lives here (not in `paths/`) because it touches the
|
|
5
|
+
* filesystem; `paths/packages.ts` stays pure path-string shaping.
|
|
6
|
+
*/
|
|
7
|
+
export interface FindUpPackageJsonOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Names to look for. Defaults to `['package.json']`. Pass alternate markers
|
|
10
|
+
* for non-package roots (e.g. `['pnpm-workspace.yaml']` for the workspace
|
|
11
|
+
* root in a pnpm monorepo).
|
|
12
|
+
*/
|
|
13
|
+
names?: readonly string[] | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Optional ancestor boundary. Useful when a script is run from a deeply
|
|
16
|
+
* nested fixture and you don't want to escape the test's tmpdir. Defaults to
|
|
17
|
+
* the filesystem root.
|
|
18
|
+
*/
|
|
19
|
+
stopAt?: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Find the nearest `package.json` walking up from `import.meta`. Returns the
|
|
23
|
+
* absolute path to the file (normalized to forward slashes), matching the
|
|
24
|
+
* `findUp` / `findUpSync` return shape. Throws when no marker is found — every
|
|
25
|
+
* script using this helper lives inside a package and should resolve.
|
|
26
|
+
*
|
|
27
|
+
* Use this instead of `path.join(__dirname, '..', '..'[, '..'])`. The ascent
|
|
28
|
+
* count is computed at runtime from the actual filesystem layout, not
|
|
29
|
+
* hard-coded into the source, so the helper stays correct across refactors that
|
|
30
|
+
* move scripts between directories.
|
|
31
|
+
*
|
|
32
|
+
* Pair with `readPackageJson` to find AND parse the nearest package.json:
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ;```ts
|
|
36
|
+
* const pkgJsonPath = findUpPackageJson(import.meta)
|
|
37
|
+
* // → '/abs/path/to/package.json'
|
|
38
|
+
* const pkg = await readPackageJson(pkgJsonPath)
|
|
39
|
+
* console.log(pkg?.name)
|
|
40
|
+
*
|
|
41
|
+
* // Workspace root in a pnpm monorepo:
|
|
42
|
+
* const wsRoot = findUpPackageJson(import.meta, {
|
|
43
|
+
* names: ['pnpm-workspace.yaml'],
|
|
44
|
+
* })
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @param meta - `import.meta` from the calling script.
|
|
48
|
+
* @param options - Override marker name(s) or set a stopAt boundary.
|
|
49
|
+
*
|
|
50
|
+
* @returns Absolute, normalized path to the marker file.
|
|
51
|
+
*
|
|
52
|
+
* @throws When no marker is found between the script and the filesystem root
|
|
53
|
+
* (or `stopAt`).
|
|
54
|
+
*/
|
|
55
|
+
export declare function findUpPackageJson(meta: ImportMeta, options?: FindUpPackageJsonOptions | undefined): string;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with rolldown */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_paths_normalize = require('../paths/normalize.js');
|
|
5
|
+
const require_node_path = require('../node/path.js');
|
|
6
|
+
const require_fs_find = require('../fs/find.js');
|
|
7
|
+
let node_url = require("node:url");
|
|
8
|
+
|
|
9
|
+
//#region src/packages/find.ts
|
|
10
|
+
/**
|
|
11
|
+
* @file Find the nearest package.json (or other marker) walking up from an
|
|
12
|
+
* `import.meta` — the package-domain wrapper over the generic `findUpSync`
|
|
13
|
+
* lookup in `fs/find`. Lives here (not in `paths/`) because it touches the
|
|
14
|
+
* filesystem; `paths/packages.ts` stays pure path-string shaping.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Find the nearest `package.json` walking up from `import.meta`. Returns the
|
|
18
|
+
* absolute path to the file (normalized to forward slashes), matching the
|
|
19
|
+
* `findUp` / `findUpSync` return shape. Throws when no marker is found — every
|
|
20
|
+
* script using this helper lives inside a package and should resolve.
|
|
21
|
+
*
|
|
22
|
+
* Use this instead of `path.join(__dirname, '..', '..'[, '..'])`. The ascent
|
|
23
|
+
* count is computed at runtime from the actual filesystem layout, not
|
|
24
|
+
* hard-coded into the source, so the helper stays correct across refactors that
|
|
25
|
+
* move scripts between directories.
|
|
26
|
+
*
|
|
27
|
+
* Pair with `readPackageJson` to find AND parse the nearest package.json:
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ;```ts
|
|
31
|
+
* const pkgJsonPath = findUpPackageJson(import.meta)
|
|
32
|
+
* // → '/abs/path/to/package.json'
|
|
33
|
+
* const pkg = await readPackageJson(pkgJsonPath)
|
|
34
|
+
* console.log(pkg?.name)
|
|
35
|
+
*
|
|
36
|
+
* // Workspace root in a pnpm monorepo:
|
|
37
|
+
* const wsRoot = findUpPackageJson(import.meta, {
|
|
38
|
+
* names: ['pnpm-workspace.yaml'],
|
|
39
|
+
* })
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param meta - `import.meta` from the calling script.
|
|
43
|
+
* @param options - Override marker name(s) or set a stopAt boundary.
|
|
44
|
+
*
|
|
45
|
+
* @returns Absolute, normalized path to the marker file.
|
|
46
|
+
*
|
|
47
|
+
* @throws When no marker is found between the script and the filesystem root
|
|
48
|
+
* (or `stopAt`).
|
|
49
|
+
*/
|
|
50
|
+
function findUpPackageJson(meta, options) {
|
|
51
|
+
const { names = ["package.json"], stopAt } = {
|
|
52
|
+
__proto__: null,
|
|
53
|
+
...options
|
|
54
|
+
};
|
|
55
|
+
const scriptPath = (0, node_url.fileURLToPath)(meta.url);
|
|
56
|
+
const found = require_fs_find.findUpSync(names, {
|
|
57
|
+
cwd: require_node_path.getNodePath().dirname(scriptPath),
|
|
58
|
+
stopAt
|
|
59
|
+
});
|
|
60
|
+
if (found === void 0) throw new Error(`findUpPackageJson: no ${names.join(" / ")} found between ${scriptPath} and ${stopAt ?? "filesystem root"}`);
|
|
61
|
+
return require_paths_normalize.normalizePath(found);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
exports.findUpPackageJson = findUpPackageJson;
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
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
|
-
const require_primordials_string = require('../primordials/string.js');
|
|
7
6
|
const require_constants_platform = require('../constants/platform.js');
|
|
7
|
+
const require_primordials_string = require('../primordials/string.js');
|
|
8
8
|
const require_paths_conversion = require('../paths/conversion.js');
|
|
9
9
|
const require_paths_predicates = require('../paths/predicates.js');
|
|
10
10
|
const require_node_fs = require('../node/fs.js');
|
|
11
11
|
const require_node_path = require('../node/path.js');
|
|
12
|
-
const require_primordials_object = require('../primordials/object.js');
|
|
13
12
|
const require_primordials_json = require('../primordials/json.js');
|
|
13
|
+
const require_primordials_object = require('../primordials/object.js');
|
|
14
14
|
const require_errors_message = require('../errors/message.js');
|
|
15
15
|
const require_process_spawn_child = require('../process/spawn/child.js');
|
|
16
16
|
const require_paths_socket = require('../paths/socket.js');
|
|
17
|
-
const
|
|
17
|
+
const require_packages_read = require('./read.js');
|
|
18
18
|
let src_external_npm_package_arg = require("../external/npm-package-arg");
|
|
19
19
|
src_external_npm_package_arg = require_runtime.__toESM(src_external_npm_package_arg);
|
|
20
20
|
|
|
@@ -47,8 +47,8 @@ const FS_CP_OPTIONS = {
|
|
|
47
47
|
* @throws {Error} When package installation or setup fails.
|
|
48
48
|
*/
|
|
49
49
|
async function isolatePackage(packageSpec, options) {
|
|
50
|
-
const fs =
|
|
51
|
-
const path =
|
|
50
|
+
const fs = require_node_fs.getNodeFs();
|
|
51
|
+
const path = require_node_path.getNodePath();
|
|
52
52
|
const { imports, install, onPackageJson, sourcePath: optSourcePath } = {
|
|
53
53
|
__proto__: null,
|
|
54
54
|
...options
|
|
@@ -56,12 +56,12 @@ async function isolatePackage(packageSpec, options) {
|
|
|
56
56
|
let sourcePath = optSourcePath;
|
|
57
57
|
let packageName;
|
|
58
58
|
let spec;
|
|
59
|
-
if (
|
|
60
|
-
const trimmedPath =
|
|
61
|
-
const pathToResolve =
|
|
59
|
+
if (require_paths_predicates.isPath(packageSpec)) {
|
|
60
|
+
const trimmedPath = require_paths_conversion.trimLeadingDotSlash(packageSpec);
|
|
61
|
+
const pathToResolve = require_paths_predicates.isAbsolute(trimmedPath) ? trimmedPath : packageSpec;
|
|
62
62
|
sourcePath = path.resolve(pathToResolve);
|
|
63
63
|
if (!fs.existsSync(sourcePath)) throw new require_primordials_error.ErrorCtor(`Source path does not exist: ${sourcePath}`);
|
|
64
|
-
const pkgJson = await
|
|
64
|
+
const pkgJson = await require_packages_read.readPackageJson(sourcePath, { normalize: true });
|
|
65
65
|
if (!pkgJson) throw new require_primordials_error.ErrorCtor(`Could not read package.json from: ${sourcePath}`);
|
|
66
66
|
packageName = pkgJson.name;
|
|
67
67
|
} else {
|
|
@@ -71,7 +71,7 @@ async function isolatePackage(packageSpec, options) {
|
|
|
71
71
|
sourcePath = parsed.fetchSpec;
|
|
72
72
|
if (!sourcePath || !fs.existsSync(sourcePath)) throw new require_primordials_error.ErrorCtor(`Source path does not exist: ${sourcePath}`);
|
|
73
73
|
if (!packageName) {
|
|
74
|
-
const pkgJson = await
|
|
74
|
+
const pkgJson = await require_packages_read.readPackageJson(sourcePath, { normalize: true });
|
|
75
75
|
if (!pkgJson) throw new require_primordials_error.ErrorCtor(`Could not read package.json from: ${sourcePath}`);
|
|
76
76
|
packageName = pkgJson.name;
|
|
77
77
|
}
|
|
@@ -97,7 +97,7 @@ async function isolatePackage(packageSpec, options) {
|
|
|
97
97
|
stdio: "pipe"
|
|
98
98
|
});
|
|
99
99
|
installedPath = path.join(packageTempDir, "node_modules", packageName);
|
|
100
|
-
originalPackageJson = await
|
|
100
|
+
originalPackageJson = await require_packages_read.readPackageJson(installedPath, { normalize: true });
|
|
101
101
|
if (sourcePath) {
|
|
102
102
|
const realInstalledPath = await resolveRealPath(installedPath);
|
|
103
103
|
if (await resolveRealPath(sourcePath) !== realInstalledPath) await fs.promises.cp(sourcePath, installedPath, FS_CP_OPTIONS);
|
|
@@ -135,7 +135,7 @@ async function isolatePackage(packageSpec, options) {
|
|
|
135
135
|
* Merge and write package.json with original and new values.
|
|
136
136
|
*/
|
|
137
137
|
async function mergePackageJson(pkgJsonPath, originalPkgJson) {
|
|
138
|
-
const fs =
|
|
138
|
+
const fs = require_node_fs.getNodeFs();
|
|
139
139
|
let pkgJson;
|
|
140
140
|
try {
|
|
141
141
|
pkgJson = require_primordials_json.JSONParse(await fs.promises.readFile(pkgJsonPath, "utf8"));
|
|
@@ -153,8 +153,8 @@ async function mergePackageJson(pkgJsonPath, originalPkgJson) {
|
|
|
153
153
|
* caller still gets a usable absolute path either way.
|
|
154
154
|
*/
|
|
155
155
|
async function resolveRealPath(pathStr) {
|
|
156
|
-
const fs =
|
|
157
|
-
const path =
|
|
156
|
+
const fs = require_node_fs.getNodeFs();
|
|
157
|
+
const path = require_node_path.getNodePath();
|
|
158
158
|
try {
|
|
159
159
|
return await fs.promises.realpath(pathStr);
|
|
160
160
|
} catch {
|