@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/logger.js
ADDED
|
@@ -0,0 +1,653 @@
|
|
|
1
|
+
/* Socket Lib - Built with esbuild */
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var logger_exports = {};
|
|
30
|
+
__export(logger_exports, {
|
|
31
|
+
LOG_SYMBOLS: () => LOG_SYMBOLS,
|
|
32
|
+
Logger: () => Logger,
|
|
33
|
+
incLogCallCountSymbol: () => incLogCallCountSymbol,
|
|
34
|
+
lastWasBlankSymbol: () => lastWasBlankSymbol,
|
|
35
|
+
logger: () => logger
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(logger_exports);
|
|
38
|
+
var import_is_unicode_supported = __toESM(require("./external/@socketregistry/is-unicode-supported"));
|
|
39
|
+
var import_yoctocolors_cjs = __toESM(require("./external/yoctocolors-cjs"));
|
|
40
|
+
var import_objects = require("./objects");
|
|
41
|
+
var import_strings = require("./strings");
|
|
42
|
+
const globalConsole = console;
|
|
43
|
+
const ReflectApply = Reflect.apply;
|
|
44
|
+
const ReflectConstruct = Reflect.construct;
|
|
45
|
+
let _Console;
|
|
46
|
+
// @__NO_SIDE_EFFECTS__
|
|
47
|
+
function constructConsole(...args) {
|
|
48
|
+
if (_Console === void 0) {
|
|
49
|
+
const nodeConsole = require("node:console");
|
|
50
|
+
_Console = nodeConsole.Console;
|
|
51
|
+
}
|
|
52
|
+
return ReflectConstruct(
|
|
53
|
+
// biome-ignore lint/style/noNonNullAssertion: Initialized above.
|
|
54
|
+
_Console,
|
|
55
|
+
// eslint-disable-line no-undef
|
|
56
|
+
args
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
// @__NO_SIDE_EFFECTS__
|
|
60
|
+
function getYoctocolors() {
|
|
61
|
+
return import_yoctocolors_cjs.default;
|
|
62
|
+
}
|
|
63
|
+
const LOG_SYMBOLS = /* @__PURE__ */ (() => {
|
|
64
|
+
const target = {
|
|
65
|
+
__proto__: null
|
|
66
|
+
};
|
|
67
|
+
const handler = {
|
|
68
|
+
__proto__: null
|
|
69
|
+
};
|
|
70
|
+
const init = () => {
|
|
71
|
+
const supported = (0, import_is_unicode_supported.default)();
|
|
72
|
+
const colors = /* @__PURE__ */ getYoctocolors();
|
|
73
|
+
(0, import_objects.objectAssign)(target, {
|
|
74
|
+
fail: colors.red(supported ? "\u2716" : "\xD7"),
|
|
75
|
+
info: colors.blue(supported ? "\u2139" : "i"),
|
|
76
|
+
success: colors.green(supported ? "\u2714" : "\u221A"),
|
|
77
|
+
warn: colors.yellow(supported ? "\u26A0" : "\u203C")
|
|
78
|
+
});
|
|
79
|
+
(0, import_objects.objectFreeze)(target);
|
|
80
|
+
for (const trapName in handler) {
|
|
81
|
+
delete handler[trapName];
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
for (const trapName of Reflect.ownKeys(Reflect)) {
|
|
85
|
+
const fn = Reflect[trapName];
|
|
86
|
+
if (typeof fn === "function") {
|
|
87
|
+
;
|
|
88
|
+
handler[trapName] = (...args) => {
|
|
89
|
+
init();
|
|
90
|
+
return fn(...args);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return new Proxy(target, handler);
|
|
95
|
+
})();
|
|
96
|
+
const boundConsoleEntries = [
|
|
97
|
+
// Add bound properties from console[kBindProperties](ignoreErrors, colorMode, groupIndentation).
|
|
98
|
+
// https://github.com/nodejs/node/blob/v24.0.1/lib/internal/console/constructor.js#L230-L265
|
|
99
|
+
"_stderrErrorHandler",
|
|
100
|
+
"_stdoutErrorHandler",
|
|
101
|
+
// Add methods that need to be bound to function properly.
|
|
102
|
+
"assert",
|
|
103
|
+
"clear",
|
|
104
|
+
"count",
|
|
105
|
+
"countReset",
|
|
106
|
+
"createTask",
|
|
107
|
+
"debug",
|
|
108
|
+
"dir",
|
|
109
|
+
"dirxml",
|
|
110
|
+
"error",
|
|
111
|
+
// Skip group methods because in at least Node 20 with the Node --frozen-intrinsics
|
|
112
|
+
// flag it triggers a readonly property for Symbol(kGroupIndent). Instead, we
|
|
113
|
+
// implement these methods ourselves.
|
|
114
|
+
//'group',
|
|
115
|
+
//'groupCollapsed',
|
|
116
|
+
//'groupEnd',
|
|
117
|
+
"info",
|
|
118
|
+
"log",
|
|
119
|
+
"table",
|
|
120
|
+
"time",
|
|
121
|
+
"timeEnd",
|
|
122
|
+
"timeLog",
|
|
123
|
+
"trace",
|
|
124
|
+
"warn"
|
|
125
|
+
].filter((n) => typeof globalConsole[n] === "function").map((n) => [n, globalConsole[n].bind(globalConsole)]);
|
|
126
|
+
const consolePropAttributes = {
|
|
127
|
+
__proto__: null,
|
|
128
|
+
writable: true,
|
|
129
|
+
enumerable: false,
|
|
130
|
+
configurable: true
|
|
131
|
+
};
|
|
132
|
+
const maxIndentation = 1e3;
|
|
133
|
+
const privateConsole = /* @__PURE__ */ new WeakMap();
|
|
134
|
+
const consoleSymbols = Object.getOwnPropertySymbols(globalConsole);
|
|
135
|
+
const incLogCallCountSymbol = Symbol.for("logger.logCallCount++");
|
|
136
|
+
const kGroupIndentationWidthSymbol = (
|
|
137
|
+
// biome-ignore lint/suspicious/noExplicitAny: Symbol property access.
|
|
138
|
+
consoleSymbols.find((s) => s.label === "kGroupIndentWidth") ?? Symbol("kGroupIndentWidth")
|
|
139
|
+
);
|
|
140
|
+
const lastWasBlankSymbol = Symbol.for("logger.lastWasBlank");
|
|
141
|
+
class Logger {
|
|
142
|
+
static LOG_SYMBOLS = LOG_SYMBOLS;
|
|
143
|
+
#parent;
|
|
144
|
+
#boundStream;
|
|
145
|
+
#stderrLogger;
|
|
146
|
+
#stdoutLogger;
|
|
147
|
+
#stderrIndention = "";
|
|
148
|
+
#stdoutIndention = "";
|
|
149
|
+
#lastWasBlank = false;
|
|
150
|
+
#logCallCount = 0;
|
|
151
|
+
#constructorArgs;
|
|
152
|
+
#options;
|
|
153
|
+
constructor(...args) {
|
|
154
|
+
this.#constructorArgs = args;
|
|
155
|
+
const options = args["0"];
|
|
156
|
+
if (typeof options === "object" && options !== null) {
|
|
157
|
+
this.#options = { __proto__: null, ...options };
|
|
158
|
+
} else {
|
|
159
|
+
this.#options = { __proto__: null };
|
|
160
|
+
}
|
|
161
|
+
if (args.length) {
|
|
162
|
+
privateConsole.set(this, /* @__PURE__ */ constructConsole(...args));
|
|
163
|
+
} else {
|
|
164
|
+
const con = /* @__PURE__ */ constructConsole({
|
|
165
|
+
stdout: process.stdout,
|
|
166
|
+
stderr: process.stderr
|
|
167
|
+
});
|
|
168
|
+
for (const { 0: key, 1: method } of boundConsoleEntries) {
|
|
169
|
+
con[key] = method;
|
|
170
|
+
}
|
|
171
|
+
privateConsole.set(this, con);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Get a logger instance bound to stderr.
|
|
176
|
+
* All operations on this instance will use stderr.
|
|
177
|
+
*/
|
|
178
|
+
get stderr() {
|
|
179
|
+
if (!this.#stderrLogger) {
|
|
180
|
+
const instance = new Logger(...this.#constructorArgs);
|
|
181
|
+
instance.#parent = this;
|
|
182
|
+
instance.#boundStream = "stderr";
|
|
183
|
+
instance.#options = { __proto__: null, ...this.#options };
|
|
184
|
+
this.#stderrLogger = instance;
|
|
185
|
+
}
|
|
186
|
+
return this.#stderrLogger;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get a logger instance bound to stdout.
|
|
190
|
+
* All operations on this instance will use stdout.
|
|
191
|
+
*/
|
|
192
|
+
get stdout() {
|
|
193
|
+
if (!this.#stdoutLogger) {
|
|
194
|
+
const instance = new Logger(...this.#constructorArgs);
|
|
195
|
+
instance.#parent = this;
|
|
196
|
+
instance.#boundStream = "stdout";
|
|
197
|
+
instance.#options = { __proto__: null, ...this.#options };
|
|
198
|
+
this.#stdoutLogger = instance;
|
|
199
|
+
}
|
|
200
|
+
return this.#stdoutLogger;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Get the root logger (for accessing shared indentation state).
|
|
204
|
+
* @private
|
|
205
|
+
*/
|
|
206
|
+
#getRoot() {
|
|
207
|
+
return this.#parent || this;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Get indentation for a specific stream.
|
|
211
|
+
* @private
|
|
212
|
+
*/
|
|
213
|
+
#getIndent(stream) {
|
|
214
|
+
const root = this.#getRoot();
|
|
215
|
+
return stream === "stderr" ? root.#stderrIndention : root.#stdoutIndention;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Set indentation for a specific stream.
|
|
219
|
+
* @private
|
|
220
|
+
*/
|
|
221
|
+
#setIndent(stream, value) {
|
|
222
|
+
const root = this.#getRoot();
|
|
223
|
+
if (stream === "stderr") {
|
|
224
|
+
root.#stderrIndention = value;
|
|
225
|
+
} else {
|
|
226
|
+
root.#stdoutIndention = value;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Get the target stream for this logger instance.
|
|
231
|
+
* @private
|
|
232
|
+
*/
|
|
233
|
+
#getTargetStream() {
|
|
234
|
+
return this.#boundStream || "stderr";
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Apply a console method with indentation.
|
|
238
|
+
* @private
|
|
239
|
+
*/
|
|
240
|
+
#apply(methodName, args, stream) {
|
|
241
|
+
const con = privateConsole.get(this);
|
|
242
|
+
const text = args.at(0);
|
|
243
|
+
const hasText = typeof text === "string";
|
|
244
|
+
const targetStream = stream || (methodName === "log" ? "stdout" : "stderr");
|
|
245
|
+
const indent = this.#getIndent(targetStream);
|
|
246
|
+
const logArgs = hasText ? [(0, import_strings.applyLinePrefix)(text, { prefix: indent }), ...args.slice(1)] : args;
|
|
247
|
+
ReflectApply(
|
|
248
|
+
con[methodName],
|
|
249
|
+
con,
|
|
250
|
+
logArgs
|
|
251
|
+
);
|
|
252
|
+
this[lastWasBlankSymbol](hasText && (0, import_strings.isBlankString)(logArgs[0]));
|
|
253
|
+
this[incLogCallCountSymbol]();
|
|
254
|
+
return this;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Strip log symbols from the start of text.
|
|
258
|
+
* @private
|
|
259
|
+
*/
|
|
260
|
+
#stripSymbols(text) {
|
|
261
|
+
return text.replace(/^[✖×⚠‼✔√ℹ]\uFE0F?\s*/u, "");
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Apply a method with a symbol prefix.
|
|
265
|
+
* @private
|
|
266
|
+
*/
|
|
267
|
+
#symbolApply(symbolType, args) {
|
|
268
|
+
const con = privateConsole.get(this);
|
|
269
|
+
let text = args.at(0);
|
|
270
|
+
let extras;
|
|
271
|
+
if (typeof text === "string") {
|
|
272
|
+
text = this.#stripSymbols(text);
|
|
273
|
+
extras = args.slice(1);
|
|
274
|
+
} else {
|
|
275
|
+
extras = args;
|
|
276
|
+
text = "";
|
|
277
|
+
}
|
|
278
|
+
const indent = this.#getIndent("stderr");
|
|
279
|
+
con.error(
|
|
280
|
+
(0, import_strings.applyLinePrefix)(`${LOG_SYMBOLS[symbolType]} ${text}`, {
|
|
281
|
+
prefix: indent
|
|
282
|
+
}),
|
|
283
|
+
...extras
|
|
284
|
+
);
|
|
285
|
+
this.#lastWasBlank = false;
|
|
286
|
+
this[incLogCallCountSymbol]();
|
|
287
|
+
return this;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Get the current log call count.
|
|
291
|
+
*/
|
|
292
|
+
get logCallCount() {
|
|
293
|
+
return this.#logCallCount;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Increment the log call count.
|
|
297
|
+
*/
|
|
298
|
+
[incLogCallCountSymbol]() {
|
|
299
|
+
this.#logCallCount += 1;
|
|
300
|
+
return this;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Set whether the last logged line was blank.
|
|
304
|
+
*/
|
|
305
|
+
[lastWasBlankSymbol](value) {
|
|
306
|
+
this.#lastWasBlank = !!value;
|
|
307
|
+
return this;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Log an assertion.
|
|
311
|
+
*/
|
|
312
|
+
assert(value, ...message) {
|
|
313
|
+
const con = privateConsole.get(this);
|
|
314
|
+
con.assert(value, ...message);
|
|
315
|
+
this[lastWasBlankSymbol](false);
|
|
316
|
+
return value ? this : this[incLogCallCountSymbol]();
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Clear the visible terminal screen.
|
|
320
|
+
* Only available on the main logger instance.
|
|
321
|
+
*/
|
|
322
|
+
clearVisible() {
|
|
323
|
+
if (this.#boundStream) {
|
|
324
|
+
throw new Error(
|
|
325
|
+
"clearVisible() is only available on the main logger instance, not on stream-bound instances"
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
const con = privateConsole.get(this);
|
|
329
|
+
con.clear();
|
|
330
|
+
if (con._stdout.isTTY) {
|
|
331
|
+
;
|
|
332
|
+
this[lastWasBlankSymbol](true);
|
|
333
|
+
this.#logCallCount = 0;
|
|
334
|
+
}
|
|
335
|
+
return this;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Log a count for the given label.
|
|
339
|
+
*/
|
|
340
|
+
count(label) {
|
|
341
|
+
const con = privateConsole.get(this);
|
|
342
|
+
con.count(label);
|
|
343
|
+
this[lastWasBlankSymbol](false);
|
|
344
|
+
return this[incLogCallCountSymbol]();
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Create a task with a given name.
|
|
348
|
+
*/
|
|
349
|
+
createTask(name) {
|
|
350
|
+
return {
|
|
351
|
+
run: (f) => {
|
|
352
|
+
this.log(`Starting task: ${name}`);
|
|
353
|
+
const result = f();
|
|
354
|
+
this.log(`Completed task: ${name}`);
|
|
355
|
+
return result;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Decrease indentation level.
|
|
361
|
+
* If called on main logger, affects both streams.
|
|
362
|
+
* If called on stream-bound logger, affects only that stream.
|
|
363
|
+
*/
|
|
364
|
+
dedent(spaces = 2) {
|
|
365
|
+
if (this.#boundStream) {
|
|
366
|
+
const current = this.#getIndent(this.#boundStream);
|
|
367
|
+
this.#setIndent(this.#boundStream, current.slice(0, -spaces));
|
|
368
|
+
} else {
|
|
369
|
+
const stderrCurrent = this.#getIndent("stderr");
|
|
370
|
+
const stdoutCurrent = this.#getIndent("stdout");
|
|
371
|
+
this.#setIndent("stderr", stderrCurrent.slice(0, -spaces));
|
|
372
|
+
this.#setIndent("stdout", stdoutCurrent.slice(0, -spaces));
|
|
373
|
+
}
|
|
374
|
+
return this;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Display an object's properties.
|
|
378
|
+
*/
|
|
379
|
+
dir(obj, options) {
|
|
380
|
+
const con = privateConsole.get(this);
|
|
381
|
+
con.dir(obj, options);
|
|
382
|
+
this[lastWasBlankSymbol](false);
|
|
383
|
+
return this[incLogCallCountSymbol]();
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Display data as XML.
|
|
387
|
+
*/
|
|
388
|
+
dirxml(...data) {
|
|
389
|
+
const con = privateConsole.get(this);
|
|
390
|
+
con.dirxml(data);
|
|
391
|
+
this[lastWasBlankSymbol](false);
|
|
392
|
+
return this[incLogCallCountSymbol]();
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Log an error message.
|
|
396
|
+
*/
|
|
397
|
+
error(...args) {
|
|
398
|
+
return this.#apply("error", args);
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Log a newline to stderr if last line wasn't blank.
|
|
402
|
+
*/
|
|
403
|
+
errorNewline() {
|
|
404
|
+
return this.#lastWasBlank ? this : this.error("");
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Log a failure message with symbol.
|
|
408
|
+
*/
|
|
409
|
+
fail(...args) {
|
|
410
|
+
return this.#symbolApply("fail", args);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Start a new log group.
|
|
414
|
+
*/
|
|
415
|
+
group(...label) {
|
|
416
|
+
const { length } = label;
|
|
417
|
+
if (length) {
|
|
418
|
+
ReflectApply(this.log, this, label);
|
|
419
|
+
}
|
|
420
|
+
this.indent(this[kGroupIndentationWidthSymbol]);
|
|
421
|
+
if (length) {
|
|
422
|
+
;
|
|
423
|
+
this[lastWasBlankSymbol](false);
|
|
424
|
+
this[incLogCallCountSymbol]();
|
|
425
|
+
}
|
|
426
|
+
return this;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Start a new collapsed log group (alias for group).
|
|
430
|
+
*/
|
|
431
|
+
// groupCollapsed is an alias of group.
|
|
432
|
+
// https://nodejs.org/api/console.html#consolegroupcollapsed
|
|
433
|
+
groupCollapsed(...label) {
|
|
434
|
+
return ReflectApply(this.group, this, label);
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* End the current log group.
|
|
438
|
+
*/
|
|
439
|
+
groupEnd() {
|
|
440
|
+
this.dedent(this[kGroupIndentationWidthSymbol]);
|
|
441
|
+
return this;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Increase indentation level.
|
|
445
|
+
* If called on main logger, affects both streams.
|
|
446
|
+
* If called on stream-bound logger, affects only that stream.
|
|
447
|
+
*/
|
|
448
|
+
indent(spaces = 2) {
|
|
449
|
+
const spacesToAdd = " ".repeat(Math.min(spaces, maxIndentation));
|
|
450
|
+
if (this.#boundStream) {
|
|
451
|
+
const current = this.#getIndent(this.#boundStream);
|
|
452
|
+
this.#setIndent(this.#boundStream, current + spacesToAdd);
|
|
453
|
+
} else {
|
|
454
|
+
const stderrCurrent = this.#getIndent("stderr");
|
|
455
|
+
const stdoutCurrent = this.#getIndent("stdout");
|
|
456
|
+
this.#setIndent("stderr", stderrCurrent + spacesToAdd);
|
|
457
|
+
this.#setIndent("stdout", stdoutCurrent + spacesToAdd);
|
|
458
|
+
}
|
|
459
|
+
return this;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Log an info message with symbol.
|
|
463
|
+
*/
|
|
464
|
+
info(...args) {
|
|
465
|
+
return this.#symbolApply("info", args);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Log a message.
|
|
469
|
+
*/
|
|
470
|
+
log(...args) {
|
|
471
|
+
return this.#apply("log", args);
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Log a newline to stdout if last line wasn't blank.
|
|
475
|
+
*/
|
|
476
|
+
logNewline() {
|
|
477
|
+
return this.#lastWasBlank ? this : this.log("");
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Reset indentation to zero.
|
|
481
|
+
* If called on main logger, resets both streams.
|
|
482
|
+
* If called on stream-bound logger, resets only that stream.
|
|
483
|
+
*/
|
|
484
|
+
resetIndent() {
|
|
485
|
+
if (this.#boundStream) {
|
|
486
|
+
this.#setIndent(this.#boundStream, "");
|
|
487
|
+
} else {
|
|
488
|
+
this.#setIndent("stderr", "");
|
|
489
|
+
this.#setIndent("stdout", "");
|
|
490
|
+
}
|
|
491
|
+
return this;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Log a main step with blank line before (stateless).
|
|
495
|
+
*/
|
|
496
|
+
step(msg, ...extras) {
|
|
497
|
+
if (!this.#lastWasBlank) {
|
|
498
|
+
this.log("");
|
|
499
|
+
}
|
|
500
|
+
return this.log(msg, ...extras);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Log an indented substep (stateless).
|
|
504
|
+
*/
|
|
505
|
+
substep(msg, ...extras) {
|
|
506
|
+
const indentedMsg = ` ${msg}`;
|
|
507
|
+
return this.log(indentedMsg, ...extras);
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Log a success message with symbol.
|
|
511
|
+
*/
|
|
512
|
+
success(...args) {
|
|
513
|
+
return this.#symbolApply("success", args);
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Log a done message (alias for success).
|
|
517
|
+
* Does NOT auto-clear. Call clearLine() first if needed after progress().
|
|
518
|
+
*/
|
|
519
|
+
done(...args) {
|
|
520
|
+
return this.#symbolApply("success", args);
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Display data in a table format.
|
|
524
|
+
*/
|
|
525
|
+
table(tabularData, properties) {
|
|
526
|
+
const con = privateConsole.get(this);
|
|
527
|
+
con.table(tabularData, properties);
|
|
528
|
+
this[lastWasBlankSymbol](false);
|
|
529
|
+
return this[incLogCallCountSymbol]();
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* End a timer and log the elapsed time.
|
|
533
|
+
*/
|
|
534
|
+
timeEnd(label) {
|
|
535
|
+
const con = privateConsole.get(this);
|
|
536
|
+
con.timeEnd(label);
|
|
537
|
+
this[lastWasBlankSymbol](false);
|
|
538
|
+
return this[incLogCallCountSymbol]();
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Log the current timer value.
|
|
542
|
+
*/
|
|
543
|
+
timeLog(label, ...data) {
|
|
544
|
+
const con = privateConsole.get(this);
|
|
545
|
+
con.timeLog(label, ...data);
|
|
546
|
+
this[lastWasBlankSymbol](false);
|
|
547
|
+
return this[incLogCallCountSymbol]();
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Log a stack trace.
|
|
551
|
+
*/
|
|
552
|
+
trace(message, ...args) {
|
|
553
|
+
const con = privateConsole.get(this);
|
|
554
|
+
con.trace(message, ...args);
|
|
555
|
+
this[lastWasBlankSymbol](false);
|
|
556
|
+
return this[incLogCallCountSymbol]();
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Log a warning message with symbol.
|
|
560
|
+
*/
|
|
561
|
+
warn(...args) {
|
|
562
|
+
return this.#symbolApply("warn", args);
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Write to stdout without a newline or indentation.
|
|
566
|
+
*/
|
|
567
|
+
write(text) {
|
|
568
|
+
const con = privateConsole.get(this);
|
|
569
|
+
con._stdout.write(text);
|
|
570
|
+
this[lastWasBlankSymbol](false);
|
|
571
|
+
return this;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Show a progress indicator (can be cleared with clearLine).
|
|
575
|
+
* Simple status message without spinner animation.
|
|
576
|
+
*/
|
|
577
|
+
progress(text) {
|
|
578
|
+
const con = privateConsole.get(this);
|
|
579
|
+
const stream = this.#getTargetStream();
|
|
580
|
+
const streamObj = stream === "stderr" ? con._stderr : con._stdout;
|
|
581
|
+
streamObj.write(`\u2234 ${text}`);
|
|
582
|
+
this[lastWasBlankSymbol](false);
|
|
583
|
+
return this;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Clear the current line.
|
|
587
|
+
*/
|
|
588
|
+
clearLine() {
|
|
589
|
+
const con = privateConsole.get(this);
|
|
590
|
+
const stream = this.#getTargetStream();
|
|
591
|
+
const streamObj = stream === "stderr" ? con._stderr : con._stdout;
|
|
592
|
+
if (streamObj.isTTY) {
|
|
593
|
+
streamObj.cursorTo(0);
|
|
594
|
+
streamObj.clearLine(0);
|
|
595
|
+
} else {
|
|
596
|
+
streamObj.write("\r\x1B[K");
|
|
597
|
+
}
|
|
598
|
+
return this;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
Object.defineProperties(
|
|
602
|
+
Logger.prototype,
|
|
603
|
+
Object.fromEntries(
|
|
604
|
+
(() => {
|
|
605
|
+
const entries = [
|
|
606
|
+
[
|
|
607
|
+
kGroupIndentationWidthSymbol,
|
|
608
|
+
{
|
|
609
|
+
...consolePropAttributes,
|
|
610
|
+
value: 2
|
|
611
|
+
}
|
|
612
|
+
],
|
|
613
|
+
[
|
|
614
|
+
Symbol.toStringTag,
|
|
615
|
+
{
|
|
616
|
+
__proto__: null,
|
|
617
|
+
configurable: true,
|
|
618
|
+
value: "logger"
|
|
619
|
+
}
|
|
620
|
+
]
|
|
621
|
+
];
|
|
622
|
+
for (const { 0: key, 1: value } of Object.entries(globalConsole)) {
|
|
623
|
+
if (!Logger.prototype[key] && typeof value === "function") {
|
|
624
|
+
const { [key]: func } = {
|
|
625
|
+
[key](...args) {
|
|
626
|
+
const con = privateConsole.get(this);
|
|
627
|
+
const result = con[key](...args);
|
|
628
|
+
return result === void 0 || result === con ? this : result;
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
entries.push([
|
|
632
|
+
key,
|
|
633
|
+
{
|
|
634
|
+
...consolePropAttributes,
|
|
635
|
+
value: func
|
|
636
|
+
}
|
|
637
|
+
]);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
return entries;
|
|
641
|
+
})()
|
|
642
|
+
)
|
|
643
|
+
);
|
|
644
|
+
const logger = new Logger();
|
|
645
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
646
|
+
0 && (module.exports = {
|
|
647
|
+
LOG_SYMBOLS,
|
|
648
|
+
Logger,
|
|
649
|
+
incLogCallCountSymbol,
|
|
650
|
+
lastWasBlankSymbol,
|
|
651
|
+
logger
|
|
652
|
+
});
|
|
653
|
+
//# sourceMappingURL=logger.js.map
|