@socketsecurity/lib 0.0.0 → 1.0.0
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 +270 -0
- package/LICENSE +21 -0
- package/README.md +80 -2
- package/data/extensions.json +28 -0
- package/dist/abort.d.ts +11 -0
- package/dist/abort.js +62 -0
- package/dist/abort.js.map +7 -0
- package/dist/agent.d.ts +102 -0
- package/dist/agent.js +288 -0
- package/dist/agent.js.map +7 -0
- package/dist/ansi.d.ts +29 -0
- package/dist/ansi.js +62 -0
- package/dist/ansi.js.map +7 -0
- package/dist/argv/flags.d.ts +199 -0
- package/dist/argv/flags.js +284 -0
- package/dist/argv/flags.js.map +7 -0
- package/dist/argv/parse.d.ts +76 -0
- package/dist/argv/parse.js +173 -0
- package/dist/argv/parse.js.map +7 -0
- package/dist/arrays.d.ts +29 -0
- package/dist/arrays.js +87 -0
- package/dist/arrays.js.map +7 -0
- package/dist/bin.d.ts +50 -0
- package/dist/bin.js +405 -0
- package/dist/bin.js.map +7 -0
- package/dist/cacache.d.ts +86 -0
- package/dist/cacache.js +140 -0
- package/dist/cacache.js.map +7 -0
- package/dist/cache-with-ttl.d.ts +133 -0
- package/dist/cache-with-ttl.js +225 -0
- package/dist/cache-with-ttl.js.map +7 -0
- package/dist/constants/agents.d.ts +37 -0
- package/dist/constants/agents.js +128 -0
- package/dist/constants/agents.js.map +7 -0
- package/dist/constants/core.d.ts +22 -0
- package/dist/constants/core.js +59 -0
- package/dist/constants/core.js.map +7 -0
- package/dist/constants/encoding.d.ts +13 -0
- package/dist/constants/encoding.js +50 -0
- package/dist/constants/encoding.js.map +7 -0
- package/dist/constants/github.d.ts +7 -0
- package/dist/constants/github.js +32 -0
- package/dist/constants/github.js.map +7 -0
- package/dist/constants/licenses.d.ts +8 -0
- package/dist/constants/licenses.js +68 -0
- package/dist/constants/licenses.js.map +7 -0
- package/dist/constants/node.d.ts +29 -0
- package/dist/constants/node.js +173 -0
- package/dist/constants/node.js.map +7 -0
- package/dist/constants/packages.d.ts +19 -0
- package/dist/constants/packages.js +130 -0
- package/dist/constants/packages.js.map +7 -0
- package/dist/constants/paths.d.ts +51 -0
- package/dist/constants/paths.js +152 -0
- package/dist/constants/paths.js.map +7 -0
- package/dist/constants/platform.d.ts +6 -0
- package/dist/constants/platform.js +43 -0
- package/dist/constants/platform.js.map +7 -0
- package/dist/constants/process.d.ts +7 -0
- package/dist/constants/process.js +54 -0
- package/dist/constants/process.js.map +7 -0
- package/dist/constants/socket.d.ts +29 -0
- package/dist/constants/socket.js +83 -0
- package/dist/constants/socket.js.map +7 -0
- package/dist/constants/testing.d.ts +9 -0
- package/dist/constants/testing.js +38 -0
- package/dist/constants/testing.js.map +7 -0
- package/dist/constants/time.d.ts +11 -0
- package/dist/constants/time.js +41 -0
- package/dist/constants/time.js.map +7 -0
- package/dist/constants/typescript.d.ts +6 -0
- package/dist/constants/typescript.js +56 -0
- package/dist/constants/typescript.js.map +7 -0
- package/dist/cover/code.d.ts +8 -0
- package/dist/cover/code.js +137 -0
- package/dist/cover/code.js.map +7 -0
- package/dist/cover/formatters.d.ts +9 -0
- package/dist/cover/formatters.js +103 -0
- package/dist/cover/formatters.js.map +7 -0
- package/dist/cover/type.d.ts +7 -0
- package/dist/cover/type.js +65 -0
- package/dist/cover/type.js.map +7 -0
- package/dist/cover/types.d.ts +70 -0
- package/dist/cover/types.js +17 -0
- package/dist/cover/types.js.map +7 -0
- package/dist/debug.d.ts +99 -0
- package/dist/debug.js +345 -0
- package/dist/debug.js.map +7 -0
- package/dist/dlx-binary.d.ts +49 -0
- package/dist/dlx-binary.js +261 -0
- package/dist/dlx-binary.js.map +7 -0
- package/dist/dlx.d.ts +64 -0
- package/dist/dlx.js +168 -0
- package/dist/dlx.js.map +7 -0
- package/dist/download-lock.d.ts +48 -0
- package/dist/download-lock.js +139 -0
- package/dist/download-lock.js.map +7 -0
- package/dist/effects/pulse-frames.d.ts +23 -0
- package/dist/effects/pulse-frames.js +66 -0
- package/dist/effects/pulse-frames.js.map +7 -0
- package/dist/effects/text-shimmer.d.ts +37 -0
- package/dist/effects/text-shimmer.js +175 -0
- package/dist/effects/text-shimmer.js.map +7 -0
- package/dist/effects/types.d.ts +41 -0
- package/dist/effects/types.js +17 -0
- package/dist/effects/types.js.map +7 -0
- package/dist/effects/ultra.d.ts +16 -0
- package/dist/effects/ultra.js +63 -0
- package/dist/effects/ultra.js.map +7 -0
- package/dist/env/appdata.d.ts +1 -0
- package/dist/env/appdata.js +30 -0
- package/dist/env/appdata.js.map +7 -0
- package/dist/env/ci.d.ts +1 -0
- package/dist/env/ci.js +31 -0
- package/dist/env/ci.js.map +7 -0
- package/dist/env/comspec.d.ts +1 -0
- package/dist/env/comspec.js +30 -0
- package/dist/env/comspec.js.map +7 -0
- package/dist/env/debug.d.ts +1 -0
- package/dist/env/debug.js +30 -0
- package/dist/env/debug.js.map +7 -0
- package/dist/env/getters.d.ts +40 -0
- package/dist/env/getters.js +283 -0
- package/dist/env/getters.js.map +7 -0
- package/dist/env/github-api-url.d.ts +1 -0
- package/dist/env/github-api-url.js +30 -0
- package/dist/env/github-api-url.js.map +7 -0
- package/dist/env/github-base-ref.d.ts +1 -0
- package/dist/env/github-base-ref.js +30 -0
- package/dist/env/github-base-ref.js.map +7 -0
- package/dist/env/github-ref-name.d.ts +1 -0
- package/dist/env/github-ref-name.js +30 -0
- package/dist/env/github-ref-name.js.map +7 -0
- package/dist/env/github-ref-type.d.ts +1 -0
- package/dist/env/github-ref-type.js +30 -0
- package/dist/env/github-ref-type.js.map +7 -0
- package/dist/env/github-repository.d.ts +1 -0
- package/dist/env/github-repository.js +30 -0
- package/dist/env/github-repository.js.map +7 -0
- package/dist/env/github-server-url.d.ts +1 -0
- package/dist/env/github-server-url.js +30 -0
- package/dist/env/github-server-url.js.map +7 -0
- package/dist/env/github-token.d.ts +1 -0
- package/dist/env/github-token.js +30 -0
- package/dist/env/github-token.js.map +7 -0
- package/dist/env/helpers.d.ts +6 -0
- package/dist/env/helpers.js +49 -0
- package/dist/env/helpers.js.map +7 -0
- package/dist/env/home.d.ts +1 -0
- package/dist/env/home.js +30 -0
- package/dist/env/home.js.map +7 -0
- package/dist/env/jest-worker-id.d.ts +1 -0
- package/dist/env/jest-worker-id.js +30 -0
- package/dist/env/jest-worker-id.js.map +7 -0
- package/dist/env/lang.d.ts +1 -0
- package/dist/env/lang.js +30 -0
- package/dist/env/lang.js.map +7 -0
- package/dist/env/lc-all.d.ts +1 -0
- package/dist/env/lc-all.js +30 -0
- package/dist/env/lc-all.js.map +7 -0
- package/dist/env/lc-messages.d.ts +1 -0
- package/dist/env/lc-messages.js +30 -0
- package/dist/env/lc-messages.js.map +7 -0
- package/dist/env/localappdata.d.ts +1 -0
- package/dist/env/localappdata.js +30 -0
- package/dist/env/localappdata.js.map +7 -0
- package/dist/env/node-auth-token.d.ts +1 -0
- package/dist/env/node-auth-token.js +30 -0
- package/dist/env/node-auth-token.js.map +7 -0
- package/dist/env/node-env.d.ts +1 -0
- package/dist/env/node-env.js +30 -0
- package/dist/env/node-env.js.map +7 -0
- package/dist/env/npm-config-registry.d.ts +1 -0
- package/dist/env/npm-config-registry.js +30 -0
- package/dist/env/npm-config-registry.js.map +7 -0
- package/dist/env/npm-config-user-agent.d.ts +1 -0
- package/dist/env/npm-config-user-agent.js +30 -0
- package/dist/env/npm-config-user-agent.js.map +7 -0
- package/dist/env/npm-lifecycle-event.d.ts +1 -0
- package/dist/env/npm-lifecycle-event.js +30 -0
- package/dist/env/npm-lifecycle-event.js.map +7 -0
- package/dist/env/npm-registry.d.ts +1 -0
- package/dist/env/npm-registry.js +30 -0
- package/dist/env/npm-registry.js.map +7 -0
- package/dist/env/npm-token.d.ts +1 -0
- package/dist/env/npm-token.js +30 -0
- package/dist/env/npm-token.js.map +7 -0
- package/dist/env/path.d.ts +1 -0
- package/dist/env/path.js +30 -0
- package/dist/env/path.js.map +7 -0
- package/dist/env/pre-commit.d.ts +1 -0
- package/dist/env/pre-commit.js +31 -0
- package/dist/env/pre-commit.js.map +7 -0
- package/dist/env/shell.d.ts +1 -0
- package/dist/env/shell.js +30 -0
- package/dist/env/shell.js.map +7 -0
- package/dist/env/socket-accept-risks.d.ts +1 -0
- package/dist/env/socket-accept-risks.js +31 -0
- package/dist/env/socket-accept-risks.js.map +7 -0
- package/dist/env/socket-api-base-url.d.ts +1 -0
- package/dist/env/socket-api-base-url.js +30 -0
- package/dist/env/socket-api-base-url.js.map +7 -0
- package/dist/env/socket-api-proxy.d.ts +1 -0
- package/dist/env/socket-api-proxy.js +30 -0
- package/dist/env/socket-api-proxy.js.map +7 -0
- package/dist/env/socket-api-timeout.d.ts +1 -0
- package/dist/env/socket-api-timeout.js +31 -0
- package/dist/env/socket-api-timeout.js.map +7 -0
- package/dist/env/socket-api-token.d.ts +1 -0
- package/dist/env/socket-api-token.js +30 -0
- package/dist/env/socket-api-token.js.map +7 -0
- package/dist/env/socket-cacache-dir.d.ts +1 -0
- package/dist/env/socket-cacache-dir.js +30 -0
- package/dist/env/socket-cacache-dir.js.map +7 -0
- package/dist/env/socket-cli-accept-risks.d.ts +1 -0
- package/dist/env/socket-cli-accept-risks.js +33 -0
- package/dist/env/socket-cli-accept-risks.js.map +7 -0
- package/dist/env/socket-cli-api-base-url.d.ts +1 -0
- package/dist/env/socket-cli-api-base-url.js +30 -0
- package/dist/env/socket-cli-api-base-url.js.map +7 -0
- package/dist/env/socket-cli-api-proxy.d.ts +1 -0
- package/dist/env/socket-cli-api-proxy.js +30 -0
- package/dist/env/socket-cli-api-proxy.js.map +7 -0
- package/dist/env/socket-cli-api-timeout.d.ts +1 -0
- package/dist/env/socket-cli-api-timeout.js +31 -0
- package/dist/env/socket-cli-api-timeout.js.map +7 -0
- package/dist/env/socket-cli-api-token.d.ts +1 -0
- package/dist/env/socket-cli-api-token.js +30 -0
- package/dist/env/socket-cli-api-token.js.map +7 -0
- package/dist/env/socket-cli-config.d.ts +1 -0
- package/dist/env/socket-cli-config.js +30 -0
- package/dist/env/socket-cli-config.js.map +7 -0
- package/dist/env/socket-cli-fix.d.ts +1 -0
- package/dist/env/socket-cli-fix.js +30 -0
- package/dist/env/socket-cli-fix.js.map +7 -0
- package/dist/env/socket-cli-no-api-token.d.ts +1 -0
- package/dist/env/socket-cli-no-api-token.js +33 -0
- package/dist/env/socket-cli-no-api-token.js.map +7 -0
- package/dist/env/socket-cli-optimize.d.ts +1 -0
- package/dist/env/socket-cli-optimize.js +31 -0
- package/dist/env/socket-cli-optimize.js.map +7 -0
- package/dist/env/socket-cli-org-slug.d.ts +1 -0
- package/dist/env/socket-cli-org-slug.js +30 -0
- package/dist/env/socket-cli-org-slug.js.map +7 -0
- package/dist/env/socket-cli-shadow-accept-risks.d.ts +1 -0
- package/dist/env/socket-cli-shadow-accept-risks.js +33 -0
- package/dist/env/socket-cli-shadow-accept-risks.js.map +7 -0
- package/dist/env/socket-cli-shadow-api-token.d.ts +1 -0
- package/dist/env/socket-cli-shadow-api-token.js +30 -0
- package/dist/env/socket-cli-shadow-api-token.js.map +7 -0
- package/dist/env/socket-cli-shadow-bin.d.ts +1 -0
- package/dist/env/socket-cli-shadow-bin.js +30 -0
- package/dist/env/socket-cli-shadow-bin.js.map +7 -0
- package/dist/env/socket-cli-shadow-progress.d.ts +1 -0
- package/dist/env/socket-cli-shadow-progress.js +33 -0
- package/dist/env/socket-cli-shadow-progress.js.map +7 -0
- package/dist/env/socket-cli-shadow-silent.d.ts +1 -0
- package/dist/env/socket-cli-shadow-silent.js +33 -0
- package/dist/env/socket-cli-shadow-silent.js.map +7 -0
- package/dist/env/socket-cli-view-all-risks.d.ts +1 -0
- package/dist/env/socket-cli-view-all-risks.js +33 -0
- package/dist/env/socket-cli-view-all-risks.js.map +7 -0
- package/dist/env/socket-config.d.ts +1 -0
- package/dist/env/socket-config.js +30 -0
- package/dist/env/socket-config.js.map +7 -0
- package/dist/env/socket-debug.d.ts +1 -0
- package/dist/env/socket-debug.js +30 -0
- package/dist/env/socket-debug.js.map +7 -0
- package/dist/env/socket-home.d.ts +1 -0
- package/dist/env/socket-home.js +30 -0
- package/dist/env/socket-home.js.map +7 -0
- package/dist/env/socket-no-api-token.d.ts +1 -0
- package/dist/env/socket-no-api-token.js +31 -0
- package/dist/env/socket-no-api-token.js.map +7 -0
- package/dist/env/socket-npm-registry.d.ts +1 -0
- package/dist/env/socket-npm-registry.js +30 -0
- package/dist/env/socket-npm-registry.js.map +7 -0
- package/dist/env/socket-org-slug.d.ts +1 -0
- package/dist/env/socket-org-slug.js +30 -0
- package/dist/env/socket-org-slug.js.map +7 -0
- package/dist/env/socket-registry-url.d.ts +1 -0
- package/dist/env/socket-registry-url.js +30 -0
- package/dist/env/socket-registry-url.js.map +7 -0
- package/dist/env/socket-view-all-risks.d.ts +1 -0
- package/dist/env/socket-view-all-risks.js +31 -0
- package/dist/env/socket-view-all-risks.js.map +7 -0
- package/dist/env/temp.d.ts +1 -0
- package/dist/env/temp.js +30 -0
- package/dist/env/temp.js.map +7 -0
- package/dist/env/term.d.ts +1 -0
- package/dist/env/term.js +30 -0
- package/dist/env/term.js.map +7 -0
- package/dist/env/tmp.d.ts +1 -0
- package/dist/env/tmp.js +30 -0
- package/dist/env/tmp.js.map +7 -0
- package/dist/env/tmpdir.d.ts +1 -0
- package/dist/env/tmpdir.js +30 -0
- package/dist/env/tmpdir.js.map +7 -0
- package/dist/env/userprofile.d.ts +1 -0
- package/dist/env/userprofile.js +30 -0
- package/dist/env/userprofile.js.map +7 -0
- package/dist/env/vitest.d.ts +1 -0
- package/dist/env/vitest.js +31 -0
- package/dist/env/vitest.js.map +7 -0
- package/dist/env/xdg-cache-home.d.ts +1 -0
- package/dist/env/xdg-cache-home.js +30 -0
- package/dist/env/xdg-cache-home.js.map +7 -0
- package/dist/env/xdg-config-home.d.ts +1 -0
- package/dist/env/xdg-config-home.js +30 -0
- package/dist/env/xdg-config-home.js.map +7 -0
- package/dist/env/xdg-data-home.d.ts +1 -0
- package/dist/env/xdg-data-home.js +30 -0
- package/dist/env/xdg-data-home.js.map +7 -0
- package/dist/env.d.ts +15 -0
- package/dist/env.js +63 -0
- package/dist/env.js.map +7 -0
- package/dist/external/@inquirer/checkbox.js +4 -0
- package/dist/external/@inquirer/confirm.js +22 -0
- package/dist/external/@inquirer/core.js +4 -0
- package/dist/external/@inquirer/input.js +1 -0
- package/dist/external/@inquirer/password.js +1 -0
- package/dist/external/@inquirer/prompts.js +4 -0
- package/dist/external/@inquirer/search.js +1 -0
- package/dist/external/@inquirer/select.js +25 -0
- package/dist/external/@npmcli/package-json/index.js +1 -0
- package/dist/external/@npmcli/package-json/lib/read-package.js +1 -0
- package/dist/external/@npmcli/package-json/lib/sort.js +1 -0
- package/dist/external/@npmcli/promise-spawn.js +5 -0
- package/dist/external/@socketregistry/is-unicode-supported.d.ts +2 -0
- package/dist/external/@socketregistry/is-unicode-supported.js +5 -0
- package/dist/external/@socketregistry/packageurl-js.js +34 -0
- package/dist/external/@socketregistry/yocto-spinner.d.ts +12 -0
- package/dist/external/@socketregistry/yocto-spinner.js +8 -0
- package/dist/external/@yarnpkg/extensions.d.ts +5 -0
- package/dist/external/@yarnpkg/extensions.js +5 -0
- package/dist/external/cacache.d.ts +93 -0
- package/dist/external/cacache.js +32 -0
- package/dist/external/debug.d.ts +25 -0
- package/dist/external/debug.js +9 -0
- package/dist/external/del.d.ts +1 -0
- package/dist/external/del.js +54 -0
- package/dist/external/fast-glob.js +54 -0
- package/dist/external/fast-sort.d.ts +4 -0
- package/dist/external/fast-sort.js +5 -0
- package/dist/external/get-east-asian-width.d.ts +5 -0
- package/dist/external/get-east-asian-width.js +5 -0
- package/dist/external/libnpmpack.d.ts +3 -0
- package/dist/external/libnpmpack.js +225 -0
- package/dist/external/make-fetch-happen.d.ts +16 -0
- package/dist/external/make-fetch-happen.js +69 -0
- package/dist/external/normalize-package-data.js +6 -0
- package/dist/external/npm-package-arg.js +6 -0
- package/dist/external/pacote.d.ts +19 -0
- package/dist/external/pacote.js +105 -0
- package/dist/external/picomatch.js +5 -0
- package/dist/external/semver.d.ts +3 -0
- package/dist/external/semver.js +5 -0
- package/dist/external/spdx-correct.js +5 -0
- package/dist/external/spdx-expression-parse.js +5 -0
- package/dist/external/streaming-iterables.js +5 -0
- package/dist/external/validate-npm-package-name.js +5 -0
- package/dist/external/which.js +5 -0
- package/dist/external/yargs-parser.d.ts +3 -0
- package/dist/external/yargs-parser.js +26 -0
- package/dist/external/yoctocolors-cjs.d.ts +38 -0
- package/dist/external/yoctocolors-cjs.js +5 -0
- package/dist/external/zod.d.ts +1 -0
- package/dist/external/zod.js +27 -0
- package/dist/fs.d.ts +184 -0
- package/dist/fs.js +610 -0
- package/dist/fs.js.map +7 -0
- package/dist/functions.d.ts +27 -0
- package/dist/functions.js +70 -0
- package/dist/functions.js.map +7 -0
- package/dist/git.d.ts +93 -0
- package/dist/git.js +321 -0
- package/dist/git.js.map +7 -0
- package/dist/github.d.ts +121 -0
- package/dist/github.js +203 -0
- package/dist/github.js.map +7 -0
- package/dist/globs.d.ts +46 -0
- package/dist/globs.js +154 -0
- package/dist/globs.js.map +7 -0
- package/dist/http-request.d.ts +53 -0
- package/dist/http-request.js +315 -0
- package/dist/http-request.js.map +7 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +64 -0
- package/dist/index.js.map +7 -0
- package/dist/ipc.d.ts +366 -0
- package/dist/ipc.js +234 -0
- package/dist/ipc.js.map +7 -0
- package/dist/json.d.ts +23 -0
- package/dist/json.js +75 -0
- package/dist/json.js.map +7 -0
- package/dist/logger.d.ts +183 -0
- package/dist/logger.js +653 -0
- package/dist/logger.js.map +7 -0
- package/dist/maintained-node-versions.d.ts +7 -0
- package/dist/maintained-node-versions.js +37 -0
- package/dist/maintained-node-versions.js.map +7 -0
- package/dist/memoization.d.ts +142 -0
- package/dist/memoization.js +212 -0
- package/dist/memoization.js.map +7 -0
- package/dist/objects.d.ts +146 -0
- package/dist/objects.js +321 -0
- package/dist/objects.js.map +7 -0
- package/dist/packages/editable.d.ts +107 -0
- package/dist/packages/editable.js +358 -0
- package/dist/packages/editable.js.map +7 -0
- package/dist/packages/exports.d.ts +30 -0
- package/dist/packages/exports.js +164 -0
- package/dist/packages/exports.js.map +7 -0
- package/dist/packages/isolation.d.ts +22 -0
- package/dist/packages/isolation.js +197 -0
- package/dist/packages/isolation.js.map +7 -0
- package/dist/packages/licenses.d.ts +68 -0
- package/dist/packages/licenses.js +216 -0
- package/dist/packages/licenses.js.map +7 -0
- package/dist/packages/manifest.d.ts +16 -0
- package/dist/packages/manifest.js +192 -0
- package/dist/packages/manifest.js.map +7 -0
- package/dist/packages/normalize.d.ts +21 -0
- package/dist/packages/normalize.js +122 -0
- package/dist/packages/normalize.js.map +7 -0
- package/dist/packages/operations.d.ts +54 -0
- package/dist/packages/operations.js +306 -0
- package/dist/packages/operations.js.map +7 -0
- package/dist/packages/paths.d.ts +10 -0
- package/dist/packages/paths.js +55 -0
- package/dist/packages/paths.js.map +7 -0
- package/dist/packages/provenance.d.ts +10 -0
- package/dist/packages/provenance.js +180 -0
- package/dist/packages/provenance.js.map +7 -0
- package/dist/packages/registry.d.ts +8 -0
- package/dist/packages/registry.js +30 -0
- package/dist/packages/registry.js.map +7 -0
- package/dist/packages/specs.d.ts +28 -0
- package/dist/packages/specs.js +85 -0
- package/dist/packages/specs.js.map +7 -0
- package/dist/packages/validation.d.ts +15 -0
- package/dist/packages/validation.js +53 -0
- package/dist/packages/validation.js.map +7 -0
- package/dist/packages.d.ts +154 -0
- package/dist/packages.js +131 -0
- package/dist/packages.js.map +7 -0
- package/dist/path.d.ts +74 -0
- package/dist/path.js +442 -0
- package/dist/path.js.map +7 -0
- package/dist/paths.d.ts +42 -0
- package/dist/paths.js +145 -0
- package/dist/paths.js.map +7 -0
- package/dist/performance.d.ts +178 -0
- package/dist/performance.js +219 -0
- package/dist/performance.js.map +7 -0
- package/dist/promise-queue.d.ts +35 -0
- package/dist/promise-queue.js +111 -0
- package/dist/promise-queue.js.map +7 -0
- package/dist/promises.d.ts +67 -0
- package/dist/promises.js +268 -0
- package/dist/promises.js.map +7 -0
- package/dist/prompts.d.ts +27 -0
- package/dist/prompts.js +60 -0
- package/dist/prompts.js.map +7 -0
- package/dist/regexps.d.ts +13 -0
- package/dist/regexps.js +32 -0
- package/dist/regexps.js.map +7 -0
- package/dist/sea.d.ts +10 -0
- package/dist/sea.js +46 -0
- package/dist/sea.js.map +7 -0
- package/dist/shadow.d.ts +17 -0
- package/dist/shadow.js +60 -0
- package/dist/shadow.js.map +7 -0
- package/dist/signal-exit.d.ts +23 -0
- package/dist/signal-exit.js +250 -0
- package/dist/signal-exit.js.map +7 -0
- package/dist/sorts.d.ts +28 -0
- package/dist/sorts.js +96 -0
- package/dist/sorts.js.map +7 -0
- package/dist/spawn.d.ts +207 -0
- package/dist/spawn.js +201 -0
- package/dist/spawn.js.map +7 -0
- package/dist/spinner.d.ts +208 -0
- package/dist/spinner.js +729 -0
- package/dist/spinner.js.map +7 -0
- package/dist/ssri.d.ts +95 -0
- package/dist/ssri.js +73 -0
- package/dist/ssri.js.map +7 -0
- package/dist/stdio/clear.d.ts +40 -0
- package/dist/stdio/clear.js +84 -0
- package/dist/stdio/clear.js.map +7 -0
- package/dist/stdio/divider.d.ts +48 -0
- package/dist/stdio/divider.js +81 -0
- package/dist/stdio/divider.js.map +7 -0
- package/dist/stdio/footer.d.ts +25 -0
- package/dist/stdio/footer.js +96 -0
- package/dist/stdio/footer.js.map +7 -0
- package/dist/stdio/header.d.ts +25 -0
- package/dist/stdio/header.js +102 -0
- package/dist/stdio/header.js.map +7 -0
- package/dist/stdio/mask.d.ts +72 -0
- package/dist/stdio/mask.js +187 -0
- package/dist/stdio/mask.js.map +7 -0
- package/dist/stdio/progress.d.ts +51 -0
- package/dist/stdio/progress.js +171 -0
- package/dist/stdio/progress.js.map +7 -0
- package/dist/stdio/prompts.d.ts +46 -0
- package/dist/stdio/prompts.js +90 -0
- package/dist/stdio/prompts.js.map +7 -0
- package/dist/stdio/stderr.d.ts +48 -0
- package/dist/stdio/stderr.js +91 -0
- package/dist/stdio/stderr.js.map +7 -0
- package/dist/stdio/stdout.d.ts +48 -0
- package/dist/stdio/stdout.js +105 -0
- package/dist/stdio/stdout.js.map +7 -0
- package/dist/streams.d.ts +20 -0
- package/dist/streams.js +80 -0
- package/dist/streams.js.map +7 -0
- package/dist/strings.d.ts +139 -0
- package/dist/strings.js +253 -0
- package/dist/strings.js.map +7 -0
- package/dist/suppress-warnings.d.ts +66 -0
- package/dist/suppress-warnings.js +100 -0
- package/dist/suppress-warnings.js.map +7 -0
- package/dist/tables.d.ts +69 -0
- package/dist/tables.js +130 -0
- package/dist/tables.js.map +7 -0
- package/dist/temporary-executor.d.ts +9 -0
- package/dist/temporary-executor.js +54 -0
- package/dist/temporary-executor.js.map +7 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.js +74 -0
- package/dist/types.js.map +7 -0
- package/dist/url.d.ts +60 -0
- package/dist/url.js +144 -0
- package/dist/url.js.map +7 -0
- package/dist/utils/get-ipc.d.ts +16 -0
- package/dist/utils/get-ipc.js +60 -0
- package/dist/utils/get-ipc.js.map +7 -0
- package/dist/validation/json-parser.d.ts +10 -0
- package/dist/validation/json-parser.js +129 -0
- package/dist/validation/json-parser.js.map +7 -0
- package/dist/validation/types.d.ts +40 -0
- package/dist/validation/types.js +17 -0
- package/dist/validation/types.js.map +7 -0
- package/dist/versions.d.ts +87 -0
- package/dist/versions.js +155 -0
- package/dist/versions.js.map +7 -0
- package/dist/words.d.ts +22 -0
- package/dist/words.js +52 -0
- package/dist/words.js.map +7 -0
- package/dist/zod.d.ts +5 -0
- package/dist/zod.js +29 -0
- package/dist/zod.js.map +7 -0
- package/package.json +856 -7
package/dist/path.js
ADDED
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
/* Socket Lib - Built with esbuild */
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var path_exports = {};
|
|
20
|
+
__export(path_exports, {
|
|
21
|
+
isAbsolute: () => isAbsolute,
|
|
22
|
+
isNodeModules: () => isNodeModules,
|
|
23
|
+
isPath: () => isPath,
|
|
24
|
+
isRelative: () => isRelative,
|
|
25
|
+
normalizePath: () => normalizePath,
|
|
26
|
+
pathLikeToString: () => pathLikeToString,
|
|
27
|
+
relativeResolve: () => relativeResolve,
|
|
28
|
+
splitPath: () => splitPath,
|
|
29
|
+
trimLeadingDotSlash: () => trimLeadingDotSlash
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(path_exports);
|
|
32
|
+
var import_platform = require("#constants/platform");
|
|
33
|
+
var import_strings = require("./strings");
|
|
34
|
+
const CHAR_BACKWARD_SLASH = 92;
|
|
35
|
+
const CHAR_COLON = 58;
|
|
36
|
+
const CHAR_FORWARD_SLASH = 47;
|
|
37
|
+
const CHAR_LOWERCASE_A = 97;
|
|
38
|
+
const CHAR_LOWERCASE_Z = 122;
|
|
39
|
+
const CHAR_UPPERCASE_A = 65;
|
|
40
|
+
const CHAR_UPPERCASE_Z = 90;
|
|
41
|
+
const slashRegExp = /[/\\]/;
|
|
42
|
+
const nodeModulesPathRegExp = /(?:^|[/\\])node_modules(?:[/\\]|$)/;
|
|
43
|
+
// @__NO_SIDE_EFFECTS__
|
|
44
|
+
function isPathSeparator(code) {
|
|
45
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
46
|
+
}
|
|
47
|
+
// @__NO_SIDE_EFFECTS__
|
|
48
|
+
function isWindowsDeviceRoot(code) {
|
|
49
|
+
return code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z || code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z;
|
|
50
|
+
}
|
|
51
|
+
let _buffer;
|
|
52
|
+
// @__NO_SIDE_EFFECTS__
|
|
53
|
+
function getBuffer() {
|
|
54
|
+
if (_buffer === void 0) {
|
|
55
|
+
_buffer = require("node:buffer");
|
|
56
|
+
}
|
|
57
|
+
return _buffer;
|
|
58
|
+
}
|
|
59
|
+
let _url;
|
|
60
|
+
// @__NO_SIDE_EFFECTS__
|
|
61
|
+
function getUrl() {
|
|
62
|
+
if (_url === void 0) {
|
|
63
|
+
_url = require("node:url");
|
|
64
|
+
}
|
|
65
|
+
return _url;
|
|
66
|
+
}
|
|
67
|
+
// @__NO_SIDE_EFFECTS__
|
|
68
|
+
function isNodeModules(pathLike) {
|
|
69
|
+
const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
|
|
70
|
+
return nodeModulesPathRegExp.test(filepath);
|
|
71
|
+
}
|
|
72
|
+
// @__NO_SIDE_EFFECTS__
|
|
73
|
+
function isAbsolute(pathLike) {
|
|
74
|
+
const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
|
|
75
|
+
const { length } = filepath;
|
|
76
|
+
if (length === 0) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
const code = filepath.charCodeAt(0);
|
|
80
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
if (import_platform.WIN32 && length > 2) {
|
|
87
|
+
if (/* @__PURE__ */ isWindowsDeviceRoot(code) && filepath.charCodeAt(1) === CHAR_COLON && /* @__PURE__ */ isPathSeparator(filepath.charCodeAt(2))) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
// @__NO_SIDE_EFFECTS__
|
|
94
|
+
function isPath(pathLike) {
|
|
95
|
+
const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
|
|
96
|
+
if (typeof filepath !== "string" || filepath.length === 0) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
if (/^[a-z][a-z0-9+.-]+:/i.test(filepath)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (filepath === "." || filepath === "..") {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
if (/* @__PURE__ */ isAbsolute(filepath)) {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
if (filepath.includes("/") || filepath.includes("\\")) {
|
|
109
|
+
if (filepath.startsWith("@") && !filepath.startsWith("@/")) {
|
|
110
|
+
const parts = filepath.split("/");
|
|
111
|
+
if (parts.length <= 2 && !parts[1]?.includes("\\")) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
// @__NO_SIDE_EFFECTS__
|
|
120
|
+
function isRelative(pathLike) {
|
|
121
|
+
const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
|
|
122
|
+
if (typeof filepath !== "string") {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
if (filepath.length === 0) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
return !/* @__PURE__ */ isAbsolute(filepath);
|
|
129
|
+
}
|
|
130
|
+
// @__NO_SIDE_EFFECTS__
|
|
131
|
+
function normalizePath(pathLike) {
|
|
132
|
+
const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
|
|
133
|
+
const { length } = filepath;
|
|
134
|
+
if (length === 0) {
|
|
135
|
+
return ".";
|
|
136
|
+
}
|
|
137
|
+
if (length < 2) {
|
|
138
|
+
return length === 1 && filepath.charCodeAt(0) === 92 ? "/" : filepath;
|
|
139
|
+
}
|
|
140
|
+
let code = 0;
|
|
141
|
+
let start = 0;
|
|
142
|
+
let prefix = "";
|
|
143
|
+
if (length > 4 && filepath.charCodeAt(3) === 92) {
|
|
144
|
+
const code2 = filepath.charCodeAt(2);
|
|
145
|
+
if ((code2 === 63 || code2 === 46) && filepath.charCodeAt(0) === 92 && filepath.charCodeAt(1) === 92) {
|
|
146
|
+
start = 2;
|
|
147
|
+
prefix = "//";
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (start === 0) {
|
|
151
|
+
if (length > 2 && (filepath.charCodeAt(0) === 92 && filepath.charCodeAt(1) === 92 && filepath.charCodeAt(2) !== 92 || filepath.charCodeAt(0) === 47 && filepath.charCodeAt(1) === 47 && filepath.charCodeAt(2) !== 47)) {
|
|
152
|
+
let firstSegmentEnd = -1;
|
|
153
|
+
let hasSecondSegment = false;
|
|
154
|
+
let i = 2;
|
|
155
|
+
while (i < length && (filepath.charCodeAt(i) === 47 || filepath.charCodeAt(i) === 92)) {
|
|
156
|
+
i++;
|
|
157
|
+
}
|
|
158
|
+
while (i < length) {
|
|
159
|
+
const char = filepath.charCodeAt(i);
|
|
160
|
+
if (char === 47 || char === 92) {
|
|
161
|
+
firstSegmentEnd = i;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
i++;
|
|
165
|
+
}
|
|
166
|
+
if (firstSegmentEnd > 2) {
|
|
167
|
+
i = firstSegmentEnd;
|
|
168
|
+
while (i < length && (filepath.charCodeAt(i) === 47 || filepath.charCodeAt(i) === 92)) {
|
|
169
|
+
i++;
|
|
170
|
+
}
|
|
171
|
+
if (i < length) {
|
|
172
|
+
hasSecondSegment = true;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (firstSegmentEnd > 2 && hasSecondSegment) {
|
|
176
|
+
start = 2;
|
|
177
|
+
prefix = "//";
|
|
178
|
+
} else {
|
|
179
|
+
code = filepath.charCodeAt(start);
|
|
180
|
+
while (code === 47 || code === 92) {
|
|
181
|
+
start += 1;
|
|
182
|
+
code = filepath.charCodeAt(start);
|
|
183
|
+
}
|
|
184
|
+
if (start) {
|
|
185
|
+
prefix = "/";
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
code = filepath.charCodeAt(start);
|
|
190
|
+
while (code === 47 || code === 92) {
|
|
191
|
+
start += 1;
|
|
192
|
+
code = filepath.charCodeAt(start);
|
|
193
|
+
}
|
|
194
|
+
if (start) {
|
|
195
|
+
prefix = "/";
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
let nextIndex = (0, import_strings.search)(filepath, slashRegExp, { fromIndex: start });
|
|
200
|
+
if (nextIndex === -1) {
|
|
201
|
+
const segment = filepath.slice(start);
|
|
202
|
+
if (segment === "." || segment.length === 0) {
|
|
203
|
+
return prefix || ".";
|
|
204
|
+
}
|
|
205
|
+
if (segment === "..") {
|
|
206
|
+
return prefix ? prefix.slice(0, -1) || "/" : "..";
|
|
207
|
+
}
|
|
208
|
+
return prefix + segment;
|
|
209
|
+
}
|
|
210
|
+
let collapsed = "";
|
|
211
|
+
let segmentCount = 0;
|
|
212
|
+
let leadingDotDots = 0;
|
|
213
|
+
while (nextIndex !== -1) {
|
|
214
|
+
const segment = filepath.slice(start, nextIndex);
|
|
215
|
+
if (segment.length > 0 && segment !== ".") {
|
|
216
|
+
if (segment === "..") {
|
|
217
|
+
if (segmentCount > 0) {
|
|
218
|
+
const lastSeparatorIndex = collapsed.lastIndexOf("/");
|
|
219
|
+
if (lastSeparatorIndex === -1) {
|
|
220
|
+
collapsed = "";
|
|
221
|
+
segmentCount = 0;
|
|
222
|
+
if (leadingDotDots > 0 && !prefix) {
|
|
223
|
+
collapsed = "..";
|
|
224
|
+
leadingDotDots = 1;
|
|
225
|
+
}
|
|
226
|
+
} else {
|
|
227
|
+
const lastSegmentStart = lastSeparatorIndex + 1;
|
|
228
|
+
const lastSegmentValue = collapsed.slice(lastSegmentStart);
|
|
229
|
+
if (lastSegmentValue === "..") {
|
|
230
|
+
collapsed = `${collapsed}/${segment}`;
|
|
231
|
+
leadingDotDots += 1;
|
|
232
|
+
} else {
|
|
233
|
+
collapsed = collapsed.slice(0, lastSeparatorIndex);
|
|
234
|
+
segmentCount -= 1;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
} else if (!prefix) {
|
|
238
|
+
collapsed = collapsed + (collapsed.length === 0 ? "" : "/") + segment;
|
|
239
|
+
leadingDotDots += 1;
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
collapsed = collapsed + (collapsed.length === 0 ? "" : "/") + segment;
|
|
243
|
+
segmentCount += 1;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
start = nextIndex + 1;
|
|
247
|
+
code = filepath.charCodeAt(start);
|
|
248
|
+
while (code === 47 || code === 92) {
|
|
249
|
+
start += 1;
|
|
250
|
+
code = filepath.charCodeAt(start);
|
|
251
|
+
}
|
|
252
|
+
nextIndex = (0, import_strings.search)(filepath, slashRegExp, { fromIndex: start });
|
|
253
|
+
}
|
|
254
|
+
const lastSegment = filepath.slice(start);
|
|
255
|
+
if (lastSegment.length > 0 && lastSegment !== ".") {
|
|
256
|
+
if (lastSegment === "..") {
|
|
257
|
+
if (segmentCount > 0) {
|
|
258
|
+
const lastSeparatorIndex = collapsed.lastIndexOf("/");
|
|
259
|
+
if (lastSeparatorIndex === -1) {
|
|
260
|
+
collapsed = "";
|
|
261
|
+
segmentCount = 0;
|
|
262
|
+
if (leadingDotDots > 0 && !prefix) {
|
|
263
|
+
collapsed = "..";
|
|
264
|
+
leadingDotDots = 1;
|
|
265
|
+
}
|
|
266
|
+
} else {
|
|
267
|
+
const lastSegmentStart = lastSeparatorIndex + 1;
|
|
268
|
+
const lastSegmentValue = collapsed.slice(lastSegmentStart);
|
|
269
|
+
if (lastSegmentValue === "..") {
|
|
270
|
+
collapsed = `${collapsed}/${lastSegment}`;
|
|
271
|
+
leadingDotDots += 1;
|
|
272
|
+
} else {
|
|
273
|
+
collapsed = collapsed.slice(0, lastSeparatorIndex);
|
|
274
|
+
segmentCount -= 1;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
} else if (!prefix) {
|
|
278
|
+
collapsed = collapsed + (collapsed.length === 0 ? "" : "/") + lastSegment;
|
|
279
|
+
leadingDotDots += 1;
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
collapsed = collapsed + (collapsed.length === 0 ? "" : "/") + lastSegment;
|
|
283
|
+
segmentCount += 1;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (collapsed.length === 0) {
|
|
287
|
+
return prefix || ".";
|
|
288
|
+
}
|
|
289
|
+
return prefix + collapsed;
|
|
290
|
+
}
|
|
291
|
+
// @__NO_SIDE_EFFECTS__
|
|
292
|
+
function pathLikeToString(pathLike) {
|
|
293
|
+
if (pathLike === null || pathLike === void 0) {
|
|
294
|
+
return "";
|
|
295
|
+
}
|
|
296
|
+
if (typeof pathLike === "string") {
|
|
297
|
+
return pathLike;
|
|
298
|
+
}
|
|
299
|
+
const { Buffer: Buffer2 } = /* @__PURE__ */ getBuffer();
|
|
300
|
+
if (Buffer2.isBuffer(pathLike)) {
|
|
301
|
+
return pathLike.toString("utf8");
|
|
302
|
+
}
|
|
303
|
+
const url = /* @__PURE__ */ getUrl();
|
|
304
|
+
if (pathLike instanceof URL) {
|
|
305
|
+
try {
|
|
306
|
+
return url.fileURLToPath(pathLike);
|
|
307
|
+
} catch {
|
|
308
|
+
const pathname = pathLike.pathname;
|
|
309
|
+
const decodedPathname = decodeURIComponent(pathname);
|
|
310
|
+
const WIN322 = require("../constants/platform").WIN32;
|
|
311
|
+
if (WIN322 && decodedPathname.startsWith("/")) {
|
|
312
|
+
const letter = decodedPathname.charCodeAt(1) | 32;
|
|
313
|
+
const hasValidDriveLetter = decodedPathname.length >= 3 && letter >= 97 && // 'a' to 'z'
|
|
314
|
+
letter <= 122 && decodedPathname.charAt(2) === ":";
|
|
315
|
+
if (!hasValidDriveLetter) {
|
|
316
|
+
return decodedPathname;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return decodedPathname;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return String(pathLike);
|
|
323
|
+
}
|
|
324
|
+
// @__NO_SIDE_EFFECTS__
|
|
325
|
+
function splitPath(pathLike) {
|
|
326
|
+
const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
|
|
327
|
+
if (filepath === "") {
|
|
328
|
+
return [];
|
|
329
|
+
}
|
|
330
|
+
return filepath.split(slashRegExp);
|
|
331
|
+
}
|
|
332
|
+
// @__NO_SIDE_EFFECTS__
|
|
333
|
+
function trimLeadingDotSlash(pathLike) {
|
|
334
|
+
const filepath = /* @__PURE__ */ pathLikeToString(pathLike);
|
|
335
|
+
if (filepath.startsWith("./") || filepath.startsWith(".\\")) {
|
|
336
|
+
return filepath.slice(2);
|
|
337
|
+
}
|
|
338
|
+
return filepath;
|
|
339
|
+
}
|
|
340
|
+
// @__NO_SIDE_EFFECTS__
|
|
341
|
+
function resolve(...segments) {
|
|
342
|
+
let resolvedPath = "";
|
|
343
|
+
let resolvedAbsolute = false;
|
|
344
|
+
for (let i = segments.length - 1; i >= 0 && !resolvedAbsolute; i -= 1) {
|
|
345
|
+
const segment = segments[i];
|
|
346
|
+
if (typeof segment !== "string" || segment.length === 0) {
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
resolvedPath = segment + (resolvedPath.length === 0 ? "" : `/${resolvedPath}`);
|
|
350
|
+
resolvedAbsolute = /* @__PURE__ */ isAbsolute(segment);
|
|
351
|
+
}
|
|
352
|
+
if (!resolvedAbsolute) {
|
|
353
|
+
const cwd = /* @__PURE__ */ require("node:process").cwd();
|
|
354
|
+
resolvedPath = cwd + (resolvedPath.length === 0 ? "" : `/${resolvedPath}`);
|
|
355
|
+
}
|
|
356
|
+
return /* @__PURE__ */ normalizePath(resolvedPath);
|
|
357
|
+
}
|
|
358
|
+
// @__NO_SIDE_EFFECTS__
|
|
359
|
+
function relative(from, to) {
|
|
360
|
+
if (from === to) {
|
|
361
|
+
return "";
|
|
362
|
+
}
|
|
363
|
+
const actualFrom = /* @__PURE__ */ resolve(from);
|
|
364
|
+
const actualTo = /* @__PURE__ */ resolve(to);
|
|
365
|
+
if (actualFrom === actualTo) {
|
|
366
|
+
return "";
|
|
367
|
+
}
|
|
368
|
+
const WIN322 = require("../constants/platform").WIN32;
|
|
369
|
+
if (WIN322) {
|
|
370
|
+
const fromLower = actualFrom.toLowerCase();
|
|
371
|
+
const toLower = actualTo.toLowerCase();
|
|
372
|
+
if (fromLower === toLower) {
|
|
373
|
+
return "";
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
const fromStart = 1;
|
|
377
|
+
const fromEnd = actualFrom.length;
|
|
378
|
+
const fromLen = fromEnd - fromStart;
|
|
379
|
+
const toStart = 1;
|
|
380
|
+
const toEnd = actualTo.length;
|
|
381
|
+
const toLen = toEnd - toStart;
|
|
382
|
+
const length = fromLen < toLen ? fromLen : toLen;
|
|
383
|
+
let lastCommonSep = -1;
|
|
384
|
+
let i = 0;
|
|
385
|
+
for (; i < length; i += 1) {
|
|
386
|
+
const fromCode = actualFrom.charCodeAt(fromStart + i);
|
|
387
|
+
const toCode = actualTo.charCodeAt(toStart + i);
|
|
388
|
+
if (fromCode !== toCode) {
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
391
|
+
if (/* @__PURE__ */ isPathSeparator(fromCode)) {
|
|
392
|
+
lastCommonSep = i;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
if (i === length) {
|
|
396
|
+
if (toLen > length) {
|
|
397
|
+
const toCode = actualTo.charCodeAt(toStart + i);
|
|
398
|
+
if (/* @__PURE__ */ isPathSeparator(toCode)) {
|
|
399
|
+
return actualTo.slice(toStart + i + 1);
|
|
400
|
+
}
|
|
401
|
+
if (i === 0) {
|
|
402
|
+
return actualTo.slice(toStart + i);
|
|
403
|
+
}
|
|
404
|
+
} else if (fromLen > length) {
|
|
405
|
+
const fromCode = actualFrom.charCodeAt(fromStart + i);
|
|
406
|
+
if (/* @__PURE__ */ isPathSeparator(fromCode)) {
|
|
407
|
+
lastCommonSep = i;
|
|
408
|
+
} else if (i === 0) {
|
|
409
|
+
lastCommonSep = 0;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
let out = "";
|
|
414
|
+
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; i += 1) {
|
|
415
|
+
const code = actualFrom.charCodeAt(i);
|
|
416
|
+
if (i === fromEnd || /* @__PURE__ */ isPathSeparator(code)) {
|
|
417
|
+
out += out.length === 0 ? ".." : "/..";
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return out + actualTo.slice(toStart + lastCommonSep);
|
|
421
|
+
}
|
|
422
|
+
// @__NO_SIDE_EFFECTS__
|
|
423
|
+
function relativeResolve(from, to) {
|
|
424
|
+
const rel = /* @__PURE__ */ relative(from, to);
|
|
425
|
+
if (rel === "") {
|
|
426
|
+
return "";
|
|
427
|
+
}
|
|
428
|
+
return /* @__PURE__ */ normalizePath(rel);
|
|
429
|
+
}
|
|
430
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
431
|
+
0 && (module.exports = {
|
|
432
|
+
isAbsolute,
|
|
433
|
+
isNodeModules,
|
|
434
|
+
isPath,
|
|
435
|
+
isRelative,
|
|
436
|
+
normalizePath,
|
|
437
|
+
pathLikeToString,
|
|
438
|
+
relativeResolve,
|
|
439
|
+
splitPath,
|
|
440
|
+
trimLeadingDotSlash
|
|
441
|
+
});
|
|
442
|
+
//# sourceMappingURL=path.js.map
|
package/dist/path.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/path.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @fileoverview Path manipulation utilities with cross-platform support.\n * Provides path normalization, validation, and file extension handling.\n */\n\nimport { WIN32 } from '#constants/platform'\n\nimport { search } from './strings'\n\n// Character code constants.\n// '\\'\nconst CHAR_BACKWARD_SLASH = 92\n// ':'\nconst CHAR_COLON = 58\n// '/'\nconst CHAR_FORWARD_SLASH = 47\n// 'a'\nconst CHAR_LOWERCASE_A = 97\n// 'z'\nconst CHAR_LOWERCASE_Z = 122\n// 'A'\nconst CHAR_UPPERCASE_A = 65\n// 'Z'\nconst CHAR_UPPERCASE_Z = 90\n\n// Regular expressions.\nconst slashRegExp = /[/\\\\]/\nconst nodeModulesPathRegExp = /(?:^|[/\\\\])node_modules(?:[/\\\\]|$)/\n\n/**\n * Check if a character code represents a path separator.\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction isPathSeparator(code: number): boolean {\n return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH\n}\n\n/**\n * Check if a character code represents a Windows device root letter.\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction isWindowsDeviceRoot(code: number): boolean {\n return (\n (code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) ||\n (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z)\n )\n}\n\nlet _buffer: typeof import('node:buffer') | undefined\n/**\n * Lazily load the buffer module.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getBuffer() {\n if (_buffer === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n _buffer = /*@__PURE__*/ require('node:buffer')\n }\n return _buffer as typeof import('node:buffer')\n}\n\nlet _url: typeof import('node:url') | undefined\n/**\n * Lazily load the url module.\n * @private\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction getUrl() {\n if (_url === undefined) {\n // Use non-'node:' prefixed require to avoid Webpack errors.\n\n _url = /*@__PURE__*/ require('node:url')\n }\n return _url as typeof import('node:url')\n}\n\n/**\n * Check if a path contains node_modules directory.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function isNodeModules(pathLike: string | Buffer | URL): boolean {\n const filepath = pathLikeToString(pathLike)\n return nodeModulesPathRegExp.test(filepath)\n}\n\n/**\n * Check if a path is absolute.\n *\n * An absolute path is one that specifies a location from the root of the file system.\n * This function handles both POSIX and Windows path formats.\n *\n * POSIX absolute paths:\n * - Start with forward slash '/'\n * - Examples: '/home/user', '/usr/bin/node'\n *\n * Windows absolute paths (3 types):\n * 1. Drive-letter paths: Start with drive letter + colon + separator\n * - Format: [A-Za-z]:[\\\\/]\n * - Examples: 'C:\\Windows', 'D:/data', 'c:\\Program Files'\n * - Reference: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#file-and-directory-names\n *\n * 2. UNC paths: Start with double backslash (handled by backslash check)\n * - Format: \\\\server\\share\n * - Examples: '\\\\server\\share\\file', '\\\\?\\C:\\path'\n * - Reference: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#unc-names\n *\n * 3. Device paths: Start with backslash\n * - Examples: '\\Windows', '\\\\.\\device'\n * - Note: Single backslash paths are relative to current drive\n *\n * Examples:\n * - isAbsolute('/home/user') \u2192 true (POSIX)\n * - isAbsolute('C:\\\\Windows') \u2192 true (Windows drive letter)\n * - isAbsolute('\\\\server\\\\share') \u2192 true (Windows UNC)\n * - isAbsolute('../relative') \u2192 false\n * - isAbsolute('relative/path') \u2192 false\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function isAbsolute(pathLike: string | Buffer | URL): boolean {\n const filepath = pathLikeToString(pathLike)\n const { length } = filepath\n\n // Empty paths are not absolute.\n if (length === 0) {\n return false\n }\n\n const code = filepath.charCodeAt(0)\n\n // POSIX: absolute paths start with forward slash '/'.\n // This is the simplest case and works for all UNIX-like systems.\n if (code === CHAR_FORWARD_SLASH) {\n return true\n }\n\n // Windows: absolute paths can start with backslash '\\'.\n // This includes UNC paths (\\\\server\\share) and device paths (\\\\.\\ or \\\\?\\).\n // Single backslash is technically relative to current drive, but treated as absolute.\n if (code === CHAR_BACKWARD_SLASH) {\n return true\n }\n\n // Windows: drive-letter absolute paths (e.g., C:\\, D:\\).\n // Format: [A-Za-z]:[\\\\/]\n // Requires at least 3 characters: drive letter + colon + separator.\n // Only treat as absolute on Windows platforms.\n if (WIN32 && length > 2) {\n // Check if first character is a letter (A-Z or a-z).\n // Check if second character is colon ':'.\n // Check if third character is a path separator (forward or backslash).\n // This matches patterns like 'C:\\', 'D:/', 'c:\\Users', etc.\n if (\n isWindowsDeviceRoot(code) &&\n filepath.charCodeAt(1) === CHAR_COLON &&\n isPathSeparator(filepath.charCodeAt(2))\n ) {\n return true\n }\n }\n\n // Not an absolute path.\n return false\n}\n\n/**\n * Check if a value is a valid file path (absolute or relative).\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function isPath(pathLike: string | Buffer | URL): boolean {\n const filepath = pathLikeToString(pathLike)\n if (typeof filepath !== 'string' || filepath.length === 0) {\n return false\n }\n\n // Exclude URLs with protocols (file:, http:, https:, git:, etc.).\n // These should be handled by package spec parsers, not treated as file paths.\n // Require at least 2 characters before colon to exclude Windows drive letters (C:, D:).\n if (/^[a-z][a-z0-9+.-]+:/i.test(filepath)) {\n return false\n }\n\n // Special relative paths.\n if (filepath === '.' || filepath === '..') {\n return true\n }\n\n // Absolute paths are always valid paths.\n if (isAbsolute(filepath)) {\n return true\n }\n\n // Contains path separators, so it's a path.\n if (filepath.includes('/') || filepath.includes('\\\\')) {\n // Distinguish scoped package names from paths starting with '@'.\n // Scoped packages: @scope/name (exactly 2 parts, no backslashes).\n // Paths: @scope/name/subpath (3+ parts) or @scope\\name (Windows backslash).\n // Special case: '@/' is a valid path (already handled by separator check).\n if (filepath.startsWith('@') && !filepath.startsWith('@/')) {\n const parts = filepath.split('/')\n // If exactly @scope/name with no Windows separators, it's a package name.\n if (parts.length <= 2 && !parts[1]?.includes('\\\\')) {\n return false\n }\n }\n return true\n }\n\n // Bare names without separators are package names, not paths.\n return false\n}\n\n/**\n * Check if a path is relative.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function isRelative(pathLike: string | Buffer | URL): boolean {\n const filepath = pathLikeToString(pathLike)\n if (typeof filepath !== 'string') {\n return false\n }\n // Empty string is considered relative.\n if (filepath.length === 0) {\n return true\n }\n // A path is relative if it's not absolute.\n return !isAbsolute(filepath)\n}\n\n/**\n * Normalize a path by converting backslashes to forward slashes and collapsing segments.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function normalizePath(pathLike: string | Buffer | URL): string {\n const filepath = pathLikeToString(pathLike)\n const { length } = filepath\n if (length === 0) {\n return '.'\n }\n if (length < 2) {\n return length === 1 && filepath.charCodeAt(0) === 92 /*'\\\\'*/\n ? '/'\n : filepath\n }\n\n let code = 0\n let start = 0\n\n // Ensure win32 namespaces have two leading slashes so they are handled properly\n // by path.win32.parse() after being normalized.\n // https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#namespaces\n // UNC paths, paths starting with double slashes, e.g. \"\\\\\\\\wsl.localhost\\\\Ubuntu\\home\\\\\",\n // are okay to convert to forward slashes.\n // https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions\n let prefix = ''\n if (length > 4 && filepath.charCodeAt(3) === 92 /*'\\\\'*/) {\n const code2 = filepath.charCodeAt(2)\n // Look for \\\\?\\ or \\\\.\\\n if (\n (code2 === 63 /*'?'*/ || code2 === 46) /*'.'*/ &&\n filepath.charCodeAt(0) === 92 /*'\\\\'*/ &&\n filepath.charCodeAt(1) === 92 /*'\\\\'*/\n ) {\n start = 2\n prefix = '//'\n }\n }\n if (start === 0) {\n // Check for UNC paths first (\\\\server\\share or //server/share)\n // UNC paths must start with exactly two slashes, not more\n if (\n length > 2 &&\n ((filepath.charCodeAt(0) === 92 /*'\\\\'*/ &&\n filepath.charCodeAt(1) === 92 /*'\\\\'*/ &&\n filepath.charCodeAt(2) !== 92) /*'\\\\'*/ ||\n (filepath.charCodeAt(0) === 47 /*'/'*/ &&\n filepath.charCodeAt(1) === 47 /*'/'*/ &&\n filepath.charCodeAt(2) !== 47)) /*'/'*/\n ) {\n // Check if this is a valid UNC path: must have server/share format\n // Find the first segment (server name) and second segment (share name)\n let firstSegmentEnd = -1\n let hasSecondSegment = false\n\n // Skip leading slashes after the initial double slash\n let i = 2\n while (\n i < length &&\n (filepath.charCodeAt(i) === 47 /*'/'*/ ||\n filepath.charCodeAt(i) === 92) /*'\\\\'*/\n ) {\n i++\n }\n\n // Find the end of first segment (server name)\n while (i < length) {\n const char = filepath.charCodeAt(i)\n if (char === 47 /*'/'*/ || char === 92 /*'\\\\'*/) {\n firstSegmentEnd = i\n break\n }\n i++\n }\n\n if (firstSegmentEnd > 2) {\n // Skip slashes after server name\n i = firstSegmentEnd\n while (\n i < length &&\n (filepath.charCodeAt(i) === 47 /*'/'*/ ||\n filepath.charCodeAt(i) === 92) /*'\\\\'*/\n ) {\n i++\n }\n // Check if there's a share name (second segment)\n if (i < length) {\n hasSecondSegment = true\n }\n }\n\n if (firstSegmentEnd > 2 && hasSecondSegment) {\n // Valid UNC path - preserve double leading slashes\n start = 2\n prefix = '//'\n } else {\n // Just repeated slashes, treat as regular path\n code = filepath.charCodeAt(start)\n while (code === 47 /*'/'*/ || code === 92 /*'\\\\'*/) {\n start += 1\n code = filepath.charCodeAt(start)\n }\n if (start) {\n prefix = '/'\n }\n }\n } else {\n // Trim leading slashes for regular paths\n code = filepath.charCodeAt(start)\n while (code === 47 /*'/'*/ || code === 92 /*'\\\\'*/) {\n start += 1\n code = filepath.charCodeAt(start)\n }\n if (start) {\n prefix = '/'\n }\n }\n }\n let nextIndex = search(filepath, slashRegExp, { fromIndex: start })\n if (nextIndex === -1) {\n const segment = filepath.slice(start)\n if (segment === '.' || segment.length === 0) {\n return prefix || '.'\n }\n if (segment === '..') {\n return prefix ? prefix.slice(0, -1) || '/' : '..'\n }\n return prefix + segment\n }\n // Process segments and handle '.', '..', and empty segments.\n let collapsed = ''\n let segmentCount = 0\n let leadingDotDots = 0\n while (nextIndex !== -1) {\n const segment = filepath.slice(start, nextIndex)\n if (segment.length > 0 && segment !== '.') {\n if (segment === '..') {\n // Handle '..' by removing the last segment if possible.\n if (segmentCount > 0) {\n // Find the last separator and remove the last segment.\n const lastSeparatorIndex = collapsed.lastIndexOf('/')\n if (lastSeparatorIndex === -1) {\n // Only one segment, remove it entirely.\n collapsed = ''\n segmentCount = 0\n // Check if this was a leading '..', restore it.\n if (leadingDotDots > 0 && !prefix) {\n collapsed = '..'\n leadingDotDots = 1\n }\n } else {\n const lastSegmentStart = lastSeparatorIndex + 1\n const lastSegmentValue = collapsed.slice(lastSegmentStart)\n // Don't collapse leading '..' segments.\n if (lastSegmentValue === '..') {\n // Preserve the '..' and add another one.\n collapsed = `${collapsed}/${segment}`\n leadingDotDots += 1\n } else {\n // Normal collapse: remove the last segment.\n collapsed = collapsed.slice(0, lastSeparatorIndex)\n segmentCount -= 1\n }\n }\n } else if (!prefix) {\n // Preserve '..' for relative paths.\n collapsed = collapsed + (collapsed.length === 0 ? '' : '/') + segment\n leadingDotDots += 1\n }\n } else {\n collapsed = collapsed + (collapsed.length === 0 ? '' : '/') + segment\n segmentCount += 1\n }\n }\n start = nextIndex + 1\n code = filepath.charCodeAt(start)\n while (code === 47 /*'/'*/ || code === 92 /*'\\\\'*/) {\n start += 1\n code = filepath.charCodeAt(start)\n }\n nextIndex = search(filepath, slashRegExp, { fromIndex: start })\n }\n const lastSegment = filepath.slice(start)\n if (lastSegment.length > 0 && lastSegment !== '.') {\n if (lastSegment === '..') {\n if (segmentCount > 0) {\n const lastSeparatorIndex = collapsed.lastIndexOf('/')\n if (lastSeparatorIndex === -1) {\n collapsed = ''\n segmentCount = 0\n // Check if this was a leading '..', restore it.\n if (leadingDotDots > 0 && !prefix) {\n collapsed = '..'\n leadingDotDots = 1\n }\n } else {\n const lastSegmentStart = lastSeparatorIndex + 1\n const lastSegmentValue = collapsed.slice(lastSegmentStart)\n // Don't collapse leading '..' segments.\n if (lastSegmentValue === '..') {\n // Preserve the '..' and add another one.\n collapsed = `${collapsed}/${lastSegment}`\n leadingDotDots += 1\n } else {\n // Normal collapse: remove the last segment.\n collapsed = collapsed.slice(0, lastSeparatorIndex)\n segmentCount -= 1\n }\n }\n } else if (!prefix) {\n collapsed =\n collapsed + (collapsed.length === 0 ? '' : '/') + lastSegment\n leadingDotDots += 1\n }\n } else {\n collapsed = collapsed + (collapsed.length === 0 ? '' : '/') + lastSegment\n segmentCount += 1\n }\n }\n\n if (collapsed.length === 0) {\n return prefix || '.'\n }\n return prefix + collapsed\n}\n\n/**\n * Convert a path-like value to a string.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function pathLikeToString(\n pathLike: string | Buffer | URL | null | undefined,\n): string {\n if (pathLike === null || pathLike === undefined) {\n return ''\n }\n if (typeof pathLike === 'string') {\n return pathLike\n }\n const { Buffer } = getBuffer()\n if (Buffer.isBuffer(pathLike)) {\n return pathLike.toString('utf8')\n }\n const url = getUrl()\n if (pathLike instanceof URL) {\n try {\n return url.fileURLToPath(pathLike)\n } catch {\n // On Windows, file URLs like `file:///C:/path` include drive letters.\n // If a file URL is missing its drive letter (malformed), fileURLToPath() throws an error.\n // This fallback extracts the pathname directly from the URL object.\n //\n // Example flows:\n // - Unix: file:///home/user \u2192 pathname '/home/user' \u2192 keep as-is\n // - Windows valid: file:///C:/path \u2192 handled by fileURLToPath()\n // - Windows invalid: file:///path \u2192 pathname '/path' \u2192 strips to 'path'\n const pathname = pathLike.pathname\n\n // Decode percent-encoded characters (e.g., %20 \u2192 space).\n // The pathname property keeps URL encoding, but file paths need decoded characters.\n // This is not platform-specific; all URLs use percent-encoding regardless of OS.\n const decodedPathname = decodeURIComponent(pathname)\n\n // URL pathnames always start with `/`.\n // On Windows, strip the leading slash only for malformed URLs that lack drive letters\n // (e.g., `/path` should be `path`, but `/C:/path` should be `C:/path`).\n // On Unix, keep the leading slash for absolute paths (e.g., `/home/user`).\n const WIN32 = require('../constants/platform').WIN32\n if (WIN32 && decodedPathname.startsWith('/')) {\n // Check for drive letter pattern following Node.js source: /[a-zA-Z]:/\n // Character at index 1 should be a letter, character at index 2 should be ':'\n // Convert to lowercase\n const letter = decodedPathname.charCodeAt(1) | 0x20\n const hasValidDriveLetter =\n decodedPathname.length >= 3 &&\n letter >= 97 &&\n // 'a' to 'z'\n letter <= 122 &&\n decodedPathname.charAt(2) === ':'\n\n if (!hasValidDriveLetter) {\n // On Windows, preserve Unix-style absolute paths that don't start with a drive letter.\n // Only strip the leading slash for truly malformed Windows paths.\n // Since fileURLToPath() failed, this is likely a valid Unix-style absolute path.\n return decodedPathname\n }\n }\n return decodedPathname\n }\n }\n return String(pathLike)\n}\n\n/**\n * Split a path into an array of segments.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function splitPath(pathLike: string | Buffer | URL): string[] {\n const filepath = pathLikeToString(pathLike)\n if (filepath === '') {\n return []\n }\n return filepath.split(slashRegExp)\n}\n\n/**\n * Remove leading ./ or ../ from a path.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function trimLeadingDotSlash(pathLike: string | Buffer | URL): string {\n const filepath = pathLikeToString(pathLike)\n // Only trim ./ not ../\n if (filepath.startsWith('./') || filepath.startsWith('.\\\\')) {\n return filepath.slice(2)\n }\n return filepath\n}\n\n/**\n * Resolve an absolute path from path segments.\n *\n * This function mimics Node.js path.resolve() behavior by:\n * 1. Processing segments from right to left\n * 2. Stopping when an absolute path is found\n * 3. Prepending current working directory if no absolute path found\n * 4. Normalizing the final path\n *\n * Examples:\n * - resolve('foo', 'bar', 'baz') \u2192 '/cwd/foo/bar/baz'\n * - resolve('/foo', 'bar', 'baz') \u2192 '/foo/bar/baz'\n * - resolve('foo', '/bar', 'baz') \u2192 '/bar/baz'\n * - resolve('C:\\\\foo', 'bar') \u2192 'C:/foo/bar' (Windows)\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction resolve(...segments: string[]): string {\n let resolvedPath = ''\n let resolvedAbsolute = false\n\n // Process segments from right to left until we find an absolute path.\n // This allows later segments to override earlier ones.\n // Example: resolve('/foo', '/bar') returns '/bar', not '/foo/bar'.\n for (let i = segments.length - 1; i >= 0 && !resolvedAbsolute; i -= 1) {\n const segment = segments[i]\n\n // Skip empty or non-string segments.\n if (typeof segment !== 'string' || segment.length === 0) {\n continue\n }\n\n // Prepend the segment to the resolved path.\n // Use forward slashes as separators (normalized later).\n resolvedPath =\n segment + (resolvedPath.length === 0 ? '' : `/${resolvedPath}`)\n\n // Check if this segment is absolute.\n // Absolute paths stop the resolution process.\n resolvedAbsolute = isAbsolute(segment)\n }\n\n // If no absolute path was found in segments, prepend current working directory.\n // This ensures the final path is always absolute.\n if (!resolvedAbsolute) {\n const cwd = /*@__PURE__*/ require('node:process').cwd()\n resolvedPath = cwd + (resolvedPath.length === 0 ? '' : `/${resolvedPath}`)\n }\n\n // Normalize the resolved path (collapse '..' and '.', convert separators).\n return normalizePath(resolvedPath)\n}\n\n/**\n * Calculate the relative path from one path to another.\n *\n * This function computes how to get from `from` to `to` using relative path notation.\n * Both paths are first resolved to absolute paths, then compared to find the common\n * base path, and finally a relative path is constructed using '../' for parent\n * directory traversal.\n *\n * Algorithm:\n * 1. Resolve both paths to absolute\n * 2. Find the longest common path prefix (up to a separator)\n * 3. For each remaining directory in `from`, add '../' to go up\n * 4. Append the remaining path from `to`\n *\n * Windows-specific behavior:\n * - File system paths are case-insensitive on Windows (NTFS, FAT32)\n * - 'C:\\Foo' and 'c:\\foo' are considered the same path\n * - Reference: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file\n * - Case is preserved but not significant for comparison\n *\n * Examples:\n * - relative('/foo/bar', '/foo/baz') \u2192 '../baz'\n * - relative('/foo/bar/baz', '/foo') \u2192 '../..'\n * - relative('/foo', '/foo/bar') \u2192 'bar'\n * - relative('C:\\\\foo\\\\bar', 'C:\\\\foo\\\\baz') \u2192 '../baz' (Windows)\n */\n/*@__NO_SIDE_EFFECTS__*/\nfunction relative(from: string, to: string): string {\n // Quick return if paths are already identical.\n if (from === to) {\n return ''\n }\n\n // Resolve both paths to absolute.\n // This handles relative paths, '.', '..', and ensures consistent format.\n const actualFrom = resolve(from)\n const actualTo = resolve(to)\n\n // Check again after resolution (paths might have been equivalent).\n if (actualFrom === actualTo) {\n return ''\n }\n\n const WIN32 = require('../constants/platform').WIN32\n\n // Windows: perform case-insensitive comparison.\n // NTFS and FAT32 preserve case but are case-insensitive for lookups.\n // This means 'C:\\Foo\\bar.txt' and 'c:\\foo\\BAR.TXT' refer to the same file.\n // Reference: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#case-sensitivity\n if (WIN32) {\n const fromLower = actualFrom.toLowerCase()\n const toLower = actualTo.toLowerCase()\n if (fromLower === toLower) {\n return ''\n }\n }\n\n // Skip the leading separator for comparison.\n // We compare paths starting after the root separator to find common directories.\n // Example: '/foo/bar' becomes 'foo/bar' for comparison (index 1).\n const fromStart = 1\n const fromEnd = actualFrom.length\n const fromLen = fromEnd - fromStart\n const toStart = 1\n const toEnd = actualTo.length\n const toLen = toEnd - toStart\n\n // Compare paths character by character to find the longest common prefix.\n // We only consider a common prefix valid if it ends at a directory separator.\n const length = fromLen < toLen ? fromLen : toLen\n // Index of last common directory separator.\n let lastCommonSep = -1\n let i = 0\n\n for (; i < length; i += 1) {\n const fromCode = actualFrom.charCodeAt(fromStart + i)\n const toCode = actualTo.charCodeAt(toStart + i)\n\n // Paths diverge at this character.\n if (fromCode !== toCode) {\n break\n }\n\n // Track directory separators (both forward and backslash for Windows compatibility).\n // We need this to ensure we only split at directory boundaries.\n if (isPathSeparator(fromCode)) {\n lastCommonSep = i\n }\n }\n\n // Handle edge cases where one path is a prefix of the other.\n if (i === length) {\n if (toLen > length) {\n // Destination path is longer.\n const toCode = actualTo.charCodeAt(toStart + i)\n if (isPathSeparator(toCode)) {\n // `from` is the exact base path for `to`.\n // Example: from='/foo/bar'; to='/foo/bar/baz' \u2192 'baz'\n // Skip the separator character (+1) to get just the relative portion.\n return actualTo.slice(toStart + i + 1)\n }\n if (i === 0) {\n // `from` is the root directory.\n // Example: from='/'; to='/foo' \u2192 'foo'\n return actualTo.slice(toStart + i)\n }\n } else if (fromLen > length) {\n // Source path is longer.\n const fromCode = actualFrom.charCodeAt(fromStart + i)\n if (isPathSeparator(fromCode)) {\n // `to` is the exact base path for `from`.\n // Example: from='/foo/bar/baz'; to='/foo/bar' \u2192 '..'\n // We need to go up from the extra directory.\n lastCommonSep = i\n } else if (i === 0) {\n // `to` is the root directory.\n // Example: from='/foo'; to='/' \u2192 '..'\n lastCommonSep = 0\n }\n }\n }\n\n // Generate the relative path by constructing '../' segments.\n let out = ''\n\n // Count the number of directories in `from` after the common base.\n // For each directory, we need to go up one level ('../').\n // Example: from='/a/b/c', to='/a/x' \u2192 common='a', need '../..' (up from c, up from b)\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; i += 1) {\n const code = actualFrom.charCodeAt(i)\n\n // At the end of the path or at a separator, add '../'.\n if (i === fromEnd || isPathSeparator(code)) {\n out += out.length === 0 ? '..' : '/..'\n }\n }\n\n // Append the rest of the destination path after the common base.\n // This gives us the path from the common ancestor to the destination.\n return out + actualTo.slice(toStart + lastCommonSep)\n}\n\n/**\n * Get the relative path from one path to another.\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function relativeResolve(from: string, to: string): string {\n const rel = relative(from, to)\n // Empty string means same path - don't normalize to '.'\n if (rel === '') {\n return ''\n }\n return normalizePath(rel)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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gB,MAAM,GAAG;AAI3B,eAAO,SAAS,MAAM,UAAU,IAAI,CAAC;AAAA,MACvC;AACA,UAAI,MAAM,GAAG;AAGX,eAAO,SAAS,MAAM,UAAU,CAAC;AAAA,MACnC;AAAA,IACF,WAAW,UAAU,QAAQ;AAE3B,YAAM,WAAW,WAAW,WAAW,YAAY,CAAC;AACpD,UAAI,gCAAgB,QAAQ,GAAG;AAI7B,wBAAgB;AAAA,MAClB,WAAW,MAAM,GAAG;AAGlB,wBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,EACF;AAGA,MAAI,MAAM;AAKV,OAAK,IAAI,YAAY,gBAAgB,GAAG,KAAK,SAAS,KAAK,GAAG;AAC5D,UAAM,OAAO,WAAW,WAAW,CAAC;AAGpC,QAAI,MAAM,WAAW,gCAAgB,IAAI,GAAG;AAC1C,aAAO,IAAI,WAAW,IAAI,OAAO;AAAA,IACnC;AAAA,EACF;AAIA,SAAO,MAAM,SAAS,MAAM,UAAU,aAAa;AACrD;AAAA;AAMO,SAAS,gBAAgB,MAAc,IAAoB;AAChE,QAAM,MAAM,yBAAS,MAAM,EAAE;AAE7B,MAAI,QAAQ,IAAI;AACd,WAAO;AAAA,EACT;AACA,SAAO,8BAAc,GAAG;AAC1B;",
|
|
6
|
+
"names": ["Buffer", "WIN32"]
|
|
7
|
+
}
|
package/dist/paths.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the Socket home directory (~/.socket).
|
|
3
|
+
* Alias for getSocketUserDir() for consistency across Socket projects.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getSocketHomePath(): string;
|
|
6
|
+
/**
|
|
7
|
+
* Get the Socket user directory (~/.socket).
|
|
8
|
+
*/
|
|
9
|
+
export declare function getSocketUserDir(): string;
|
|
10
|
+
/**
|
|
11
|
+
* Get a Socket app directory (~/.socket/_<appName>).
|
|
12
|
+
*/
|
|
13
|
+
export declare function getSocketAppDir(appName: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Get the Socket cacache directory (~/.socket/_cacache).
|
|
16
|
+
* Can be overridden with SOCKET_CACACHE_DIR environment variable for testing.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getSocketCacacheDir(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Get the Socket DLX directory (~/.socket/_dlx).
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSocketDlxDir(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Get a Socket app cache directory (~/.socket/_<appName>/cache).
|
|
25
|
+
*/
|
|
26
|
+
export declare function getSocketAppCacheDir(appName: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Get a Socket app TTL cache directory (~/.socket/_<appName>/cache/ttl).
|
|
29
|
+
*/
|
|
30
|
+
export declare function getSocketAppCacheTtlDir(appName: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Get the Socket CLI directory (~/.socket/_socket).
|
|
33
|
+
*/
|
|
34
|
+
export declare function getSocketCliDir(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Get the Socket Registry directory (~/.socket/_registry).
|
|
37
|
+
*/
|
|
38
|
+
export declare function getSocketRegistryDir(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Get the Socket Registry GitHub cache directory (~/.socket/_registry/cache/ttl/github).
|
|
41
|
+
*/
|
|
42
|
+
export declare function getSocketRegistryGithubCacheDir(): string;
|