@socketsecurity/cli-with-sentry 1.16.1 → 1.17.1
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 +18 -0
- package/LICENSE +87 -0
- package/README.md +13 -13
- package/bin/cli.js +9 -9
- package/dist/.config/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/cli.js +2114 -4292
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +71 -87
- package/dist/constants.js.map +1 -1
- package/dist/env-helpers.js +63 -0
- package/dist/env-helpers.js.map +1 -0
- package/dist/instrument-with-sentry.js +7 -7
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/manifest-scripts/dotnet-tool/Microsoft.Build.Locator.dll +0 -0
- package/dist/manifest-scripts/dotnet-tool/socket-facts-dotnet.deps.json +2 -2
- package/dist/manifest-scripts/dotnet-tool/socket-facts-dotnet.dll +0 -0
- package/dist/manifest-scripts/maven-extension/coana-maven-extension.jar +0 -0
- package/dist/runtime-constants.js +345 -0
- package/dist/runtime-constants.js.map +1 -0
- package/dist/shadow-npm-bin2.js +9 -13
- package/dist/shadow-npm-bin2.js.map +1 -1
- package/dist/shadow-npm-inject.js +10 -15
- package/dist/shadow-npm-inject.js.map +1 -1
- package/dist/shadow-npx-bin.js.map +1 -1
- package/dist/shadow-pnpm-bin2.js +21 -25
- package/dist/shadow-pnpm-bin2.js.map +1 -1
- package/dist/shadow-yarn-bin.js +4 -6
- package/dist/shadow-yarn-bin.js.map +1 -1
- package/dist/socket-completion.bash +0 -0
- package/dist/spawn-sync.js +47 -0
- package/dist/spawn-sync.js.map +1 -0
- package/dist/spinner.js +182 -0
- package/dist/spinner.js.map +1 -0
- package/dist/types/commands/fix/generated-socket-facts.d.mts +5 -2
- package/dist/types/commands/fix/handle-fix.d.mts +1 -1
- package/dist/types/commands/fix/types.d.mts +1 -1
- package/dist/types/commands/manifest/bazel/process.d.mts +2 -2
- package/dist/types/commands/manifest/convert-dotnet-to-facts.d.mts +3 -6
- package/dist/types/commands/manifest/discover-manifest-roots.d.mts +10 -11
- package/dist/types/commands/manifest/generate-recursive-manifests.d.mts +16 -30
- package/dist/types/commands/manifest/generate_auto_manifest.d.mts +6 -11
- package/dist/types/commands/manifest/load-build.d.mts +3 -11
- package/dist/types/commands/manifest/run-manifest-facts.d.mts +88 -29
- package/dist/types/commands/manifest/scripts/build-tool.d.mts +2 -0
- package/dist/types/commands/optimize/add-overrides.d.mts +2 -2
- package/dist/types/commands/optimize/get-dependency-entries.d.mts +1 -1
- package/dist/types/commands/optimize/get-overrides-by-agent.d.mts +16 -7
- package/dist/types/commands/optimize/update-lockfile.d.mts +2 -2
- package/dist/types/commands/optimize/update-manifest-by-agent.d.mts +4 -2
- package/dist/types/commands/package/fetch-purls-shallow-score.d.mts +2 -2
- package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts +1 -1
- package/dist/types/commands/scan/generate-report.d.mts +1 -1
- package/dist/types/commands/scan/handle-create-new-scan.d.mts +5 -1
- package/dist/types/commands/scan/output-create-new-scan.d.mts +1 -1
- package/dist/types/commands/scan/output-diff-scan.d.mts +4 -2
- package/dist/types/commands/scan/perform-reachability-analysis.d.mts +4 -5
- package/dist/types/commands/scan/run-dynamic-sbom-inference.d.mts +7 -15
- package/dist/types/constants/runtime.d.mts +417 -0
- package/dist/types/constants.d.mts +9 -10
- package/dist/types/paths/coana.d.mts +5 -0
- package/dist/types/paths/uv.d.mts +2 -0
- package/dist/types/sea/adapters/cdxgen-worker.d.mts +1 -0
- package/dist/types/sea/adapters/synp-worker.d.mts +1 -0
- package/dist/types/sea/build/cdxgen-fixture.d.mts +4 -0
- package/dist/types/sea/build/smoke-test.d.mts +2 -0
- package/dist/types/sea/build-sea.d.mts +4 -2
- package/dist/types/sea/download-bytes.d.mts +0 -1
- package/dist/types/sea/paths/archive.d.mts +3 -0
- package/dist/types/sea/paths/coana-cache.d.mts +1 -0
- package/dist/types/sea/paths/native-tools.d.mts +13 -0
- package/dist/types/sea/pnpm-lock.d.mts +22 -0
- package/dist/types/sea/rollup-workers.d.mts +1 -0
- package/dist/types/sea/runtime.d.mts +4 -3
- package/dist/types/sea/vfs-digest.d.mts +2 -0
- package/dist/types/shadow/common.d.mts +1 -1
- package/dist/types/shadow/npm/arborist-helpers.d.mts +1 -1
- package/dist/types/shadow/npm/bin.d.mts +1 -1
- package/dist/types/shadow/npm/install.d.mts +3 -3
- package/dist/types/shadow/npm-base.d.mts +1 -1
- package/dist/types/shadow/npx/bin.d.mts +1 -1
- package/dist/types/shadow/pnpm/bin.d.mts +1 -1
- package/dist/types/shadow/yarn/bin.d.mts +1 -1
- package/dist/types/test/mocks/socket-auth.d.mts +40 -39
- package/dist/types/utils/agent.d.mts +6 -1
- package/dist/types/utils/alert/artifact.d.mts +1 -1
- package/dist/types/utils/alerts-map.d.mts +1 -1
- package/dist/types/utils/api.d.mts +1 -1
- package/dist/types/utils/arrays.d.mts +6 -0
- package/dist/types/utils/bin.d.mts +26 -0
- package/dist/types/utils/{coana-release.d.mts → coana/release.d.mts} +5 -3
- package/dist/types/utils/debug.d.mts +23 -49
- package/dist/types/utils/dlx.d.mts +1 -1
- package/dist/types/utils/ecosystem.d.mts +1 -9
- package/dist/types/utils/env.d.mts +24 -0
- package/dist/types/utils/errors.d.mts +2 -2
- package/dist/types/utils/escape-regexp.d.mts +6 -0
- package/dist/types/utils/fs.d.mts +33 -0
- package/dist/types/utils/github.d.mts +1 -1
- package/dist/types/utils/globs.d.mts +1 -0
- package/dist/types/utils/logger.d.mts +51 -0
- package/dist/types/utils/objects.d.mts +11 -0
- package/dist/types/utils/package-environment.d.mts +3 -3
- package/dist/types/utils/packages.d.mts +65 -0
- package/dist/types/utils/path.d.mts +3 -0
- package/dist/types/utils/promises.d.mts +23 -0
- package/dist/types/utils/prompts.d.mts +25 -0
- package/dist/types/utils/purl.d.mts +4 -1
- package/dist/types/utils/socket-package-alert.d.mts +1 -1
- package/dist/types/utils/socket-url.d.mts +1 -1
- package/dist/types/utils/sorts.d.mts +1 -0
- package/dist/types/utils/spawn-sync.d.mts +3 -0
- package/dist/types/utils/spawn.d.mts +67 -0
- package/dist/types/utils/spec.d.mts +1 -1
- package/dist/types/utils/spinner.d.mts +46 -0
- package/dist/types/utils/streams.d.mts +3 -0
- package/dist/types/utils/strings.d.mts +6 -0
- package/dist/types/utils/url.d.mts +2 -0
- package/dist/types/utils/words.d.mts +1 -0
- package/dist/utils.js +4475 -803
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +39737 -41318
- package/external/blessed-contrib/lib/widget/charts/line.js +172 -149
- package/package.json +41 -37
- package/shadow-bin/npm +0 -0
- package/shadow-bin/npx +0 -0
- package/shadow-bin/pnpm +0 -0
- package/shadow-bin/yarn +0 -0
- package/dist/types/commands/manifest/convert-gradle-to-facts.d.mts +0 -19
- package/dist/types/commands/manifest/convert-maven-to-facts.d.mts +0 -19
- package/dist/types/commands/manifest/convert-sbt-to-facts.d.mts +0 -22
- package/dist/types/commands/manifest/enumerate-workspaces.d.mts +0 -22
- package/dist/types/commands/manifest/expand-env-var-refs.d.mts +0 -9
- package/dist/types/sea/archive-paths.d.mts +0 -6
- package/external/@socketsecurity/registry/LICENSE +0 -21
- package/external/@socketsecurity/registry/README.md +0 -9
- package/external/@socketsecurity/registry/extensions.json +0 -28
- package/external/@socketsecurity/registry/external/@inquirer/confirm.js +0 -3165
- package/external/@socketsecurity/registry/external/@inquirer/input.js +0 -3202
- package/external/@socketsecurity/registry/external/@inquirer/password.js +0 -3307
- package/external/@socketsecurity/registry/external/@inquirer/search.js +0 -3519
- package/external/@socketsecurity/registry/external/@inquirer/select.js +0 -3655
- package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +0 -21406
- package/external/@socketsecurity/registry/external/@npmcli/package-json/lib/read-package.js +0 -183
- package/external/@socketsecurity/registry/external/@npmcli/package-json/lib/sort.js +0 -274
- package/external/@socketsecurity/registry/external/@npmcli/promise-spawn.js +0 -704
- package/external/@socketsecurity/registry/external/@socketregistry/is-unicode-supported.js +0 -54
- package/external/@socketsecurity/registry/external/@socketregistry/packageurl-js.js +0 -4516
- package/external/@socketsecurity/registry/external/@socketregistry/yocto-spinner.js +0 -453
- package/external/@socketsecurity/registry/external/@yarnpkg/extensions.js +0 -1406
- package/external/@socketsecurity/registry/external/browserslist.js +0 -20496
- package/external/@socketsecurity/registry/external/cacache.js +0 -16208
- package/external/@socketsecurity/registry/external/debug.js +0 -1163
- package/external/@socketsecurity/registry/external/fast-glob.js +0 -7994
- package/external/@socketsecurity/registry/external/fast-sort.js +0 -181
- package/external/@socketsecurity/registry/external/libnpmpack.js +0 -106271
- package/external/@socketsecurity/registry/external/make-fetch-happen.js +0 -38997
- package/external/@socketsecurity/registry/external/normalize-package-data.js +0 -5343
- package/external/@socketsecurity/registry/external/npm-package-arg.js +0 -5773
- package/external/@socketsecurity/registry/external/pacote.js +0 -74109
- package/external/@socketsecurity/registry/external/picomatch.js +0 -2307
- package/external/@socketsecurity/registry/external/semver.js +0 -2618
- package/external/@socketsecurity/registry/external/signal-exit.js +0 -336
- package/external/@socketsecurity/registry/external/spdx-correct.js +0 -1457
- package/external/@socketsecurity/registry/external/spdx-expression-parse.js +0 -1043
- package/external/@socketsecurity/registry/external/streaming-iterables.js +0 -326
- package/external/@socketsecurity/registry/external/validate-npm-package-name.js +0 -108
- package/external/@socketsecurity/registry/external/which.js +0 -405
- package/external/@socketsecurity/registry/external/yoctocolors-cjs.js +0 -101
- package/external/@socketsecurity/registry/index.js +0 -31
- package/external/@socketsecurity/registry/lib/agent.js +0 -390
- package/external/@socketsecurity/registry/lib/arrays.js +0 -89
- package/external/@socketsecurity/registry/lib/bin.js +0 -650
- package/external/@socketsecurity/registry/lib/constants/abort-controller.js +0 -15
- package/external/@socketsecurity/registry/lib/constants/abort-signal.js +0 -27
- package/external/@socketsecurity/registry/lib/constants/at-latest.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/biome-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/bun-lock.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/bun-lockb.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/bun.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ci.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/column-limit.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/copy-left-licenses.js +0 -27
- package/external/@socketsecurity/registry/lib/constants/darwin.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/dot-git-dir.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/dot-package-lock-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/dot-socket-dir.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/empty-file.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/empty-value.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/env.js +0 -59
- package/external/@socketsecurity/registry/lib/constants/eslint-config-js.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/esnext.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/exec-path.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-cjs.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-cmd.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-cts.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-dts.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-js.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-lock.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-lockb.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-md.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-mjs.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-mts.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-ps1.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-yaml.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-yml.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/extensions-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/extensions.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/get-ipc.js +0 -10
- package/external/@socketsecurity/registry/lib/constants/gitignore.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/index.js +0 -139
- package/external/@socketsecurity/registry/lib/constants/ipc-handler.js +0 -19
- package/external/@socketsecurity/registry/lib/constants/ipc-object.js +0 -6
- package/external/@socketsecurity/registry/lib/constants/ipc-promise.js +0 -47
- package/external/@socketsecurity/registry/lib/constants/ipc-target.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/k-internals-symbol.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/latest.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-glob-recursive.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-glob.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-original-glob-recursive.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-original-glob.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-original.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/lifecycle-script-names.js +0 -18
- package/external/@socketsecurity/registry/lib/constants/loop-sentinel.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/maintained-node-versions.js +0 -47
- package/external/@socketsecurity/registry/lib/constants/manifest-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/mit.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-auth-token.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-debug-flags.js +0 -9
- package/external/@socketsecurity/registry/lib/constants/node-env.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-harden-flags.js +0 -29
- package/external/@socketsecurity/registry/lib/constants/node-modules-glob-recursive.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-modules.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-no-warnings-flags.js +0 -16
- package/external/@socketsecurity/registry/lib/constants/node-version.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/npm-exec-path.js +0 -5
- package/external/@socketsecurity/registry/lib/constants/npm-real-exec-path.js +0 -6
- package/external/@socketsecurity/registry/lib/constants/npm-shrinkwrap-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/npm.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/npx.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/overrides.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/package-default-node-range.js +0 -6
- package/external/@socketsecurity/registry/lib/constants/package-default-socket-categories.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/package-default-version.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/package-extensions.js +0 -47
- package/external/@socketsecurity/registry/lib/constants/package-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/package-lock-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/packument-cache.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/pacote-cache-path.js +0 -9
- package/external/@socketsecurity/registry/lib/constants/pnpm-exec-path.js +0 -5
- package/external/@socketsecurity/registry/lib/constants/pnpm-lock-yaml.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/pnpm.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/pre-commit.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/readme-glob-recursive.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/readme-glob.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/readme-md.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/registry-scope-delimiter.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/registry.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/resolutions.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-github-org.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-ipc-handshake.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-override-scope.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-public-api-token.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-registry-npm-org.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-registry-package-name.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-registry-repo-name.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-registry-scope.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-security-scope.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/spinner.js +0 -4
- package/external/@socketsecurity/registry/lib/constants/supports-node-compile-cache-api.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-node-compile-cache-env-var.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-node-disable-warning-flag.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-node-permission-flag.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-node-require-module.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/supports-node-run.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-process-send.js +0 -5
- package/external/@socketsecurity/registry/lib/constants/ts-libs-available.js +0 -22
- package/external/@socketsecurity/registry/lib/constants/ts-types-available.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/tsconfig-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/undefined-token.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/unknown-error.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/unknown-value.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/unlicenced.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/unlicensed.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/utf8.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/vitest.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/vlt-lock-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/vlt.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/win32.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/yarn-berry.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/yarn-classic.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/yarn-exec-path.js +0 -5
- package/external/@socketsecurity/registry/lib/constants/yarn-lock.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/yarn.js +0 -3
- package/external/@socketsecurity/registry/lib/debug.js +0 -264
- package/external/@socketsecurity/registry/lib/env.js +0 -62
- package/external/@socketsecurity/registry/lib/fs.js +0 -556
- package/external/@socketsecurity/registry/lib/functions.js +0 -20
- package/external/@socketsecurity/registry/lib/globs.js +0 -145
- package/external/@socketsecurity/registry/lib/json.js +0 -69
- package/external/@socketsecurity/registry/lib/logger.js +0 -534
- package/external/@socketsecurity/registry/lib/objects.js +0 -422
- package/external/@socketsecurity/registry/lib/packages.js +0 -1379
- package/external/@socketsecurity/registry/lib/path.js +0 -231
- package/external/@socketsecurity/registry/lib/promises.js +0 -286
- package/external/@socketsecurity/registry/lib/prompts.js +0 -63
- package/external/@socketsecurity/registry/lib/regexps.js +0 -23
- package/external/@socketsecurity/registry/lib/sorts.js +0 -70
- package/external/@socketsecurity/registry/lib/spawn.js +0 -252
- package/external/@socketsecurity/registry/lib/spinner.js +0 -205
- package/external/@socketsecurity/registry/lib/streams.js +0 -84
- package/external/@socketsecurity/registry/lib/strings.js +0 -235
- package/external/@socketsecurity/registry/lib/url.js +0 -68
- package/external/@socketsecurity/registry/lib/words.js +0 -45
- package/external/@socketsecurity/registry/manifest.json +0 -1875
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { parse: JSONParse } = JSON
|
|
4
|
-
|
|
5
|
-
const { stripBom } = /*@__PURE__*/ require('./strings')
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Check if a value is a Buffer instance.
|
|
9
|
-
* @param {any} x - The value to check.
|
|
10
|
-
* @returns {boolean} True if the value is a Buffer.
|
|
11
|
-
*/
|
|
12
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
13
|
-
function isBuffer(x) {
|
|
14
|
-
if (!x || typeof x !== 'object' || typeof x.length !== 'number') {
|
|
15
|
-
return false
|
|
16
|
-
}
|
|
17
|
-
if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
|
|
18
|
-
return false
|
|
19
|
-
}
|
|
20
|
-
if (x.length > 0 && typeof x[0] !== 'number') {
|
|
21
|
-
return false
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const Ctor = x.constructor
|
|
25
|
-
return !!(typeof Ctor?.isBuffer === 'function' && Ctor.isBuffer(x))
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Check if a value is a JSON primitive (null, boolean, number, or string).
|
|
30
|
-
* @param {any} value - The value to check.
|
|
31
|
-
* @returns {boolean} True if the value is a JSON primitive.
|
|
32
|
-
*/
|
|
33
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
34
|
-
function isJsonPrimitive(value) {
|
|
35
|
-
return (
|
|
36
|
-
value === null ||
|
|
37
|
-
typeof value === 'boolean' ||
|
|
38
|
-
typeof value === 'number' ||
|
|
39
|
-
typeof value === 'string'
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Parse JSON content with error handling and BOM stripping.
|
|
45
|
-
* @param {string | Buffer} content - The JSON content to parse.
|
|
46
|
-
* @param {{filepath?: string; reviver?: Function; throws?: boolean}} [options] - Parse options.
|
|
47
|
-
* @returns {any} The parsed JSON object, or null if parsing fails and throws is false.
|
|
48
|
-
*/
|
|
49
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
50
|
-
function jsonParse(content, options) {
|
|
51
|
-
const { filepath, reviver, throws } = { __proto__: null, ...options }
|
|
52
|
-
const shouldThrow = throws === undefined || !!throws
|
|
53
|
-
const jsonStr = isBuffer(content) ? content.toString('utf8') : content
|
|
54
|
-
try {
|
|
55
|
-
return JSONParse(stripBom(jsonStr), reviver)
|
|
56
|
-
} catch (e) {
|
|
57
|
-
if (shouldThrow) {
|
|
58
|
-
if (e && typeof filepath === 'string') {
|
|
59
|
-
e.message = `${filepath}: ${e.message}`
|
|
60
|
-
}
|
|
61
|
-
throw e
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return null
|
|
65
|
-
}
|
|
66
|
-
module.exports = {
|
|
67
|
-
isJsonPrimitive,
|
|
68
|
-
jsonParse
|
|
69
|
-
}
|
|
@@ -1,534 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const globalConsole = console
|
|
4
|
-
const { assign: ObjectAssign, freeze: ObjectFreeze } = Object
|
|
5
|
-
const { apply: ReflectApply, construct: ReflectConstruct } = Reflect
|
|
6
|
-
|
|
7
|
-
const { applyLinePrefix, isBlankString } = /*@__PURE__*/ require('./strings')
|
|
8
|
-
|
|
9
|
-
let _Console
|
|
10
|
-
/**
|
|
11
|
-
* Construct a new Console instance.
|
|
12
|
-
* @param {...any} args - Arguments to pass to the Console constructor.
|
|
13
|
-
* @returns {Console} A new Console instance.
|
|
14
|
-
* @private
|
|
15
|
-
*/
|
|
16
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
17
|
-
function constructConsole(...args) {
|
|
18
|
-
if (_Console === undefined) {
|
|
19
|
-
// Use non-'node:' prefixed require to avoid Webpack errors.
|
|
20
|
-
// eslint-disable-next-line n/prefer-node-protocol
|
|
21
|
-
const nodeConsole = /*@__PURE__*/ require('console')
|
|
22
|
-
_Console = nodeConsole.Console
|
|
23
|
-
}
|
|
24
|
-
return ReflectConstruct(_Console, args)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let _yoctocolors
|
|
28
|
-
/**
|
|
29
|
-
* Get the yoctocolors module for terminal colors.
|
|
30
|
-
* @returns {Object} The yoctocolors module.
|
|
31
|
-
* @private
|
|
32
|
-
*/
|
|
33
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
34
|
-
function getYoctocolors() {
|
|
35
|
-
if (_yoctocolors === undefined) {
|
|
36
|
-
_yoctocolors = { ...require('../external/yoctocolors-cjs') }
|
|
37
|
-
}
|
|
38
|
-
return _yoctocolors
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const LOG_SYMBOLS = /*@__PURE__*/ (() => {
|
|
42
|
-
const target = { __proto__: null }
|
|
43
|
-
// Mutable handler to simulate a frozen target.
|
|
44
|
-
const handler = { __proto__: null }
|
|
45
|
-
const init = () => {
|
|
46
|
-
const supported =
|
|
47
|
-
/*@__PURE__*/ require('../external/@socketregistry/is-unicode-supported')()
|
|
48
|
-
const colors = getYoctocolors()
|
|
49
|
-
ObjectAssign(target, {
|
|
50
|
-
fail: colors.red(supported ? '✖' : '×'),
|
|
51
|
-
info: colors.blue(supported ? 'ℹ' : 'i'),
|
|
52
|
-
success: colors.green(supported ? '✔' : '√'),
|
|
53
|
-
warn: colors.yellow(supported ? '⚠' : '‼')
|
|
54
|
-
})
|
|
55
|
-
ObjectFreeze(target)
|
|
56
|
-
// The handler of a Proxy is mutable after proxy instantiation.
|
|
57
|
-
// We delete the traps to defer to native behavior.
|
|
58
|
-
for (const trapName in handler) {
|
|
59
|
-
delete handler[trapName]
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
for (const trapName of Reflect.ownKeys(Reflect)) {
|
|
63
|
-
const fn = Reflect[trapName]
|
|
64
|
-
if (typeof fn === 'function') {
|
|
65
|
-
handler[trapName] = (...args) => {
|
|
66
|
-
init()
|
|
67
|
-
return fn(...args)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return new Proxy(target, handler)
|
|
72
|
-
})()
|
|
73
|
-
|
|
74
|
-
const boundConsoleEntries = [
|
|
75
|
-
// Add bound properties from console[kBindProperties](ignoreErrors, colorMode, groupIndentation).
|
|
76
|
-
// https://github.com/nodejs/node/blob/v24.0.1/lib/internal/console/constructor.js#L230-L265
|
|
77
|
-
'_stderrErrorHandler',
|
|
78
|
-
'_stdoutErrorHandler',
|
|
79
|
-
// Add methods that need to be bound to function properly.
|
|
80
|
-
'assert',
|
|
81
|
-
'clear',
|
|
82
|
-
'count',
|
|
83
|
-
'countReset',
|
|
84
|
-
'createTask',
|
|
85
|
-
'debug',
|
|
86
|
-
'dir',
|
|
87
|
-
'dirxml',
|
|
88
|
-
'error',
|
|
89
|
-
// Skip group methods because in at least Node 20 with the Node --frozen-intrinsics
|
|
90
|
-
// flag it triggers a readonly property for Symbol(kGroupIndent). Instead, we
|
|
91
|
-
// implement these methods ourselves.
|
|
92
|
-
//'group',
|
|
93
|
-
//'groupCollapsed',
|
|
94
|
-
//'groupEnd',
|
|
95
|
-
'info',
|
|
96
|
-
'log',
|
|
97
|
-
'table',
|
|
98
|
-
'time',
|
|
99
|
-
'timeEnd',
|
|
100
|
-
'timeLog',
|
|
101
|
-
'trace',
|
|
102
|
-
'warn'
|
|
103
|
-
]
|
|
104
|
-
.filter(n => typeof globalConsole[n] === 'function')
|
|
105
|
-
.map(n => [n, globalConsole[n].bind(globalConsole)])
|
|
106
|
-
|
|
107
|
-
const consolePropAttributes = {
|
|
108
|
-
__proto__: null,
|
|
109
|
-
writable: true,
|
|
110
|
-
enumerable: false,
|
|
111
|
-
configurable: true
|
|
112
|
-
}
|
|
113
|
-
const maxIndentation = 1000
|
|
114
|
-
const privateConsole = new WeakMap()
|
|
115
|
-
|
|
116
|
-
const consoleSymbols = Object.getOwnPropertySymbols(globalConsole)
|
|
117
|
-
const incLogCallCountSymbol = Symbol.for('logger.logCallCount++')
|
|
118
|
-
const kGroupIndentationWidthSymbol =
|
|
119
|
-
consoleSymbols.find(s => s.label === 'kGroupIndentWidth') ??
|
|
120
|
-
Symbol('kGroupIndentWidth')
|
|
121
|
-
const lastWasBlankSymbol = Symbol.for('logger.lastWasBlank')
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Custom Logger class that wraps console with additional features.
|
|
125
|
-
* Supports indentation, symbols, and blank line tracking.
|
|
126
|
-
*/
|
|
127
|
-
/*@__PURE__*/
|
|
128
|
-
class Logger {
|
|
129
|
-
static LOG_SYMBOLS = LOG_SYMBOLS
|
|
130
|
-
|
|
131
|
-
#indention = ''
|
|
132
|
-
#lastWasBlank = false
|
|
133
|
-
#logCallCount = 0
|
|
134
|
-
|
|
135
|
-
constructor(...args) {
|
|
136
|
-
if (args.length) {
|
|
137
|
-
privateConsole.set(this, constructConsole(...args))
|
|
138
|
-
} else {
|
|
139
|
-
// Create a new console that acts like the builtin one so that it will
|
|
140
|
-
// work with Node's --frozen-intrinsics flag.
|
|
141
|
-
const con = constructConsole({
|
|
142
|
-
stdout: process.stdout,
|
|
143
|
-
stderr: process.stderr
|
|
144
|
-
})
|
|
145
|
-
for (const { 0: key, 1: method } of boundConsoleEntries) {
|
|
146
|
-
con[key] = method
|
|
147
|
-
}
|
|
148
|
-
privateConsole.set(this, con)
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Apply a console method with indentation.
|
|
154
|
-
* @param {string} methodName - Name of the console method to call.
|
|
155
|
-
* @param {any[]} args - Arguments to pass to the method.
|
|
156
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
157
|
-
* @private
|
|
158
|
-
*/
|
|
159
|
-
#apply(methodName, args) {
|
|
160
|
-
const con = privateConsole.get(this)
|
|
161
|
-
const text = args.at(0)
|
|
162
|
-
const hasText = typeof text === 'string'
|
|
163
|
-
const logArgs = hasText
|
|
164
|
-
? [applyLinePrefix(text, this.#indention), ...args.slice(1)]
|
|
165
|
-
: args
|
|
166
|
-
ReflectApply(con[methodName], con, logArgs)
|
|
167
|
-
this[lastWasBlankSymbol](hasText && isBlankString(logArgs[0]))
|
|
168
|
-
this[incLogCallCountSymbol]()
|
|
169
|
-
return this
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Apply a method with a symbol prefix.
|
|
174
|
-
* @param {string} symbolType - Type of symbol to use (fail, info, success, warn).
|
|
175
|
-
* @param {any[]} args - Arguments to pass to the method.
|
|
176
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
177
|
-
* @private
|
|
178
|
-
*/
|
|
179
|
-
#symbolApply(symbolType, args) {
|
|
180
|
-
const con = privateConsole.get(this)
|
|
181
|
-
let text = args.at(0)
|
|
182
|
-
let extras
|
|
183
|
-
if (typeof text === 'string') {
|
|
184
|
-
extras = args.slice(1)
|
|
185
|
-
} else {
|
|
186
|
-
extras = args
|
|
187
|
-
text = ''
|
|
188
|
-
}
|
|
189
|
-
// Note: Meta status messages (info/fail/etc) always go to stderr.
|
|
190
|
-
con.error(
|
|
191
|
-
applyLinePrefix(`${LOG_SYMBOLS[symbolType]} ${text}`, this.#indention),
|
|
192
|
-
...extras
|
|
193
|
-
)
|
|
194
|
-
this.#lastWasBlank = false
|
|
195
|
-
this[incLogCallCountSymbol]()
|
|
196
|
-
return this
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Get the current log call count.
|
|
201
|
-
* @returns {number} The number of log calls made.
|
|
202
|
-
*/
|
|
203
|
-
get logCallCount() {
|
|
204
|
-
return this.#logCallCount
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Increment the log call count.
|
|
209
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
210
|
-
*/
|
|
211
|
-
[incLogCallCountSymbol]() {
|
|
212
|
-
this.#logCallCount += 1
|
|
213
|
-
return this
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Set whether the last logged line was blank.
|
|
218
|
-
* @param {boolean} value - Whether the last line was blank.
|
|
219
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
220
|
-
*/
|
|
221
|
-
[lastWasBlankSymbol](value) {
|
|
222
|
-
this.#lastWasBlank = !!value
|
|
223
|
-
return this
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Log an assertion.
|
|
228
|
-
* @param {any} value - Value to assert.
|
|
229
|
-
* @param {...any} message - Message to log if assertion fails.
|
|
230
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
231
|
-
*/
|
|
232
|
-
assert(value, ...message) {
|
|
233
|
-
const con = privateConsole.get(this)
|
|
234
|
-
con.assert(value, ...message)
|
|
235
|
-
this[lastWasBlankSymbol](false)
|
|
236
|
-
return value ? this : this[incLogCallCountSymbol]()
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Clear the console.
|
|
241
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
242
|
-
*/
|
|
243
|
-
clear() {
|
|
244
|
-
const con = privateConsole.get(this)
|
|
245
|
-
con.clear()
|
|
246
|
-
if (con._stdout.isTTY) {
|
|
247
|
-
this[lastWasBlankSymbol](true)
|
|
248
|
-
this.#logCallCount = 0
|
|
249
|
-
}
|
|
250
|
-
return this
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Log a count for the given label.
|
|
255
|
-
* @param {string} label - Label to count.
|
|
256
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
257
|
-
*/
|
|
258
|
-
count(label) {
|
|
259
|
-
const con = privateConsole.get(this)
|
|
260
|
-
con.count(label)
|
|
261
|
-
this[lastWasBlankSymbol](false)
|
|
262
|
-
return this[incLogCallCountSymbol]()
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Decrease indentation level.
|
|
267
|
-
* @param {number} [spaces=2] - Number of spaces to dedent.
|
|
268
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
269
|
-
*/
|
|
270
|
-
dedent(spaces = 2) {
|
|
271
|
-
this.#indention = this.#indention.slice(0, -spaces)
|
|
272
|
-
return this
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Display an object's properties.
|
|
277
|
-
* @param {any} obj - Object to display.
|
|
278
|
-
* @param {Object} [options] - Display options.
|
|
279
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
280
|
-
*/
|
|
281
|
-
dir(obj, options) {
|
|
282
|
-
const con = privateConsole.get(this)
|
|
283
|
-
con.dir(obj, options)
|
|
284
|
-
this[lastWasBlankSymbol](false)
|
|
285
|
-
return this[incLogCallCountSymbol]()
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Display data as XML.
|
|
290
|
-
* @param {...any} data - Data to display.
|
|
291
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
292
|
-
*/
|
|
293
|
-
dirxml(...data) {
|
|
294
|
-
const con = privateConsole.get(this)
|
|
295
|
-
con.dirxml(data)
|
|
296
|
-
this[lastWasBlankSymbol](false)
|
|
297
|
-
return this[incLogCallCountSymbol]()
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Log an error message.
|
|
302
|
-
* @param {...any} args - Arguments to log.
|
|
303
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
304
|
-
*/
|
|
305
|
-
error(...args) {
|
|
306
|
-
return this.#apply('error', args)
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Log a newline to stderr if last line wasn't blank.
|
|
311
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
312
|
-
*/
|
|
313
|
-
errorNewline() {
|
|
314
|
-
return this.#lastWasBlank ? this : this.error('')
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Log a failure message with symbol.
|
|
319
|
-
* @param {...any} args - Arguments to log.
|
|
320
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
321
|
-
*/
|
|
322
|
-
fail(...args) {
|
|
323
|
-
return this.#symbolApply('fail', args)
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Start a new log group.
|
|
328
|
-
* @param {...any} label - Label for the group.
|
|
329
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
330
|
-
*/
|
|
331
|
-
group(...label) {
|
|
332
|
-
const { length } = label
|
|
333
|
-
if (length) {
|
|
334
|
-
ReflectApply(this.log, this, label)
|
|
335
|
-
}
|
|
336
|
-
this.indent(this[kGroupIndentationWidthSymbol])
|
|
337
|
-
if (length) {
|
|
338
|
-
this[lastWasBlankSymbol](false)
|
|
339
|
-
this[incLogCallCountSymbol]()
|
|
340
|
-
}
|
|
341
|
-
return this
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Start a new collapsed log group (alias for group).
|
|
346
|
-
* @param {...any} label - Label for the group.
|
|
347
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
348
|
-
*/
|
|
349
|
-
// groupCollapsed is an alias of group.
|
|
350
|
-
// https://nodejs.org/api/console.html#consolegroupcollapsed
|
|
351
|
-
groupCollapsed(...label) {
|
|
352
|
-
return ReflectApply(this.group, this, label)
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* End the current log group.
|
|
357
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
358
|
-
*/
|
|
359
|
-
groupEnd() {
|
|
360
|
-
this.dedent(this[kGroupIndentationWidthSymbol])
|
|
361
|
-
return this
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Increase indentation level.
|
|
366
|
-
* @param {number} [spaces=2] - Number of spaces to indent.
|
|
367
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
368
|
-
*/
|
|
369
|
-
indent(spaces = 2) {
|
|
370
|
-
this.#indention += ' '.repeat(Math.min(spaces, maxIndentation))
|
|
371
|
-
return this
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Log an info message with symbol.
|
|
376
|
-
* @param {...any} args - Arguments to log.
|
|
377
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
378
|
-
*/
|
|
379
|
-
info(...args) {
|
|
380
|
-
return this.#symbolApply('info', args)
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
/**
|
|
384
|
-
* Log a message.
|
|
385
|
-
* @param {...any} args - Arguments to log.
|
|
386
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
387
|
-
*/
|
|
388
|
-
log(...args) {
|
|
389
|
-
return this.#apply('log', args)
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* Log a newline to stdout if last line wasn't blank.
|
|
394
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
395
|
-
*/
|
|
396
|
-
logNewline() {
|
|
397
|
-
return this.#lastWasBlank ? this : this.log('')
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* Reset indentation to zero.
|
|
402
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
403
|
-
*/
|
|
404
|
-
resetIndent() {
|
|
405
|
-
this.#indention = ''
|
|
406
|
-
return this
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Log a success message with symbol.
|
|
411
|
-
* @param {...any} args - Arguments to log.
|
|
412
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
413
|
-
*/
|
|
414
|
-
success(...args) {
|
|
415
|
-
return this.#symbolApply('success', args)
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Display data in a table format.
|
|
420
|
-
* @param {any} tabularData - Data to display.
|
|
421
|
-
* @param {string[]} [properties] - Properties to display.
|
|
422
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
423
|
-
*/
|
|
424
|
-
table(tabularData, properties) {
|
|
425
|
-
const con = privateConsole.get(this)
|
|
426
|
-
con.table(tabularData, properties)
|
|
427
|
-
this[lastWasBlankSymbol](false)
|
|
428
|
-
return this[incLogCallCountSymbol]()
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* End a timer and log the elapsed time.
|
|
433
|
-
* @param {string} label - Timer label.
|
|
434
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
435
|
-
*/
|
|
436
|
-
timeEnd(label) {
|
|
437
|
-
const con = privateConsole.get(this)
|
|
438
|
-
con.timeEnd(label)
|
|
439
|
-
this[lastWasBlankSymbol](false)
|
|
440
|
-
return this[incLogCallCountSymbol]()
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Log the current timer value.
|
|
445
|
-
* @param {string} label - Timer label.
|
|
446
|
-
* @param {...any} data - Additional data to log.
|
|
447
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
448
|
-
*/
|
|
449
|
-
timeLog(label, ...data) {
|
|
450
|
-
const con = privateConsole.get(this)
|
|
451
|
-
con.timeLog(label, ...data)
|
|
452
|
-
this[lastWasBlankSymbol](false)
|
|
453
|
-
return this[incLogCallCountSymbol]()
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Log a stack trace.
|
|
458
|
-
* @param {string} message - Message to log with trace.
|
|
459
|
-
* @param {...any} args - Additional arguments.
|
|
460
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
461
|
-
*/
|
|
462
|
-
trace(message, ...args) {
|
|
463
|
-
const con = privateConsole.get(this)
|
|
464
|
-
con.trace(message, ...args)
|
|
465
|
-
this[lastWasBlankSymbol](false)
|
|
466
|
-
return this[incLogCallCountSymbol]()
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Log a warning message with symbol.
|
|
471
|
-
* @param {...any} args - Arguments to log.
|
|
472
|
-
* @returns {Logger} This Logger instance for chaining.
|
|
473
|
-
*/
|
|
474
|
-
warn(...args) {
|
|
475
|
-
return this.#symbolApply('warn', args)
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
Object.defineProperties(
|
|
480
|
-
Logger.prototype,
|
|
481
|
-
Object.fromEntries(
|
|
482
|
-
(() => {
|
|
483
|
-
const entries = [
|
|
484
|
-
[
|
|
485
|
-
kGroupIndentationWidthSymbol,
|
|
486
|
-
{
|
|
487
|
-
__proto__: null,
|
|
488
|
-
...consolePropAttributes,
|
|
489
|
-
value: 2
|
|
490
|
-
}
|
|
491
|
-
],
|
|
492
|
-
[
|
|
493
|
-
Symbol.toStringTag,
|
|
494
|
-
{
|
|
495
|
-
__proto__: null,
|
|
496
|
-
configurable: true,
|
|
497
|
-
value: 'logger'
|
|
498
|
-
}
|
|
499
|
-
]
|
|
500
|
-
]
|
|
501
|
-
for (const { 0: key, 1: value } of Object.entries(globalConsole)) {
|
|
502
|
-
if (!Logger.prototype[key] && typeof value === 'function') {
|
|
503
|
-
// Dynamically name the log method without using Object.defineProperty.
|
|
504
|
-
const { [key]: func } = {
|
|
505
|
-
[key](...args) {
|
|
506
|
-
const con = privateConsole.get(this)
|
|
507
|
-
const result = con[key](...args)
|
|
508
|
-
return result === undefined || result === con ? this : result
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
entries.push([
|
|
512
|
-
key,
|
|
513
|
-
{
|
|
514
|
-
__proto__: null,
|
|
515
|
-
...consolePropAttributes,
|
|
516
|
-
value: func
|
|
517
|
-
}
|
|
518
|
-
])
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
return entries
|
|
522
|
-
})()
|
|
523
|
-
)
|
|
524
|
-
)
|
|
525
|
-
|
|
526
|
-
const logger = new Logger()
|
|
527
|
-
|
|
528
|
-
module.exports = {
|
|
529
|
-
incLogCallCountSymbol,
|
|
530
|
-
lastWasBlankSymbol,
|
|
531
|
-
LOG_SYMBOLS,
|
|
532
|
-
Logger,
|
|
533
|
-
logger
|
|
534
|
-
}
|