@veryfront/ext-content-mdx 0.1.985
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/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +42 -0
- package/esm/_dnt.polyfills.d.ts +18 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +15 -0
- package/esm/_dnt.shims.d.ts +12 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +68 -0
- package/esm/deno.d.ts +427 -0
- package/esm/deno.d.ts.map +1 -0
- package/esm/deno.js +512 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_chars.d.ts +33 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_chars.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_chars.js +48 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_loader_state.d.ts +64 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_loader_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_loader_state.js +1371 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_schema.d.ts +44 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_schema.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_schema.js +117 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/binary.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/binary.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/binary.js +103 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/bool.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/bool.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/bool.js +32 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/float.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/float.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/float.js +96 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/int.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/int.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/int.js +159 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/map.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/map.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/map.js +14 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/merge.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/merge.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/merge.js +10 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/nil.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/nil.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/nil.js +22 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/omap.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/omap.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/omap.js +29 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.js +19 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.js +30 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/seq.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/seq.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/seq.js +10 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/set.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/set.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/set.js +14 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/str.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/str.js +9 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.js +81 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.js +20 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type.d.ts +32 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type.js +6 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_utils.d.ts +4 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_utils.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_utils.js +13 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/parse.d.ts +76 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/parse.js +91 -0
- package/esm/extensions/ext-content-mdx/src/compiler/markdown-compile.d.ts +3 -0
- package/esm/extensions/ext-content-mdx/src/compiler/markdown-compile.d.ts.map +1 -0
- package/esm/extensions/ext-content-mdx/src/compiler/markdown-compile.js +99 -0
- package/esm/extensions/ext-content-mdx/src/compiler/mdx-compile.d.ts +3 -0
- package/esm/extensions/ext-content-mdx/src/compiler/mdx-compile.d.ts.map +1 -0
- package/esm/extensions/ext-content-mdx/src/compiler/mdx-compile.js +53 -0
- package/esm/extensions/ext-content-mdx/src/index.d.ts +31 -0
- package/esm/extensions/ext-content-mdx/src/index.d.ts.map +1 -0
- package/esm/extensions/ext-content-mdx/src/index.js +56 -0
- package/esm/extensions/ext-content-mdx/src/plugins/plugin-loader.d.ts +4 -0
- package/esm/extensions/ext-content-mdx/src/plugins/plugin-loader.d.ts.map +1 -0
- package/esm/extensions/ext-content-mdx/src/plugins/plugin-loader.js +18 -0
- package/esm/extensions/ext-content-mdx/src/plugins/rehype-node-positions.d.ts +20 -0
- package/esm/extensions/ext-content-mdx/src/plugins/rehype-node-positions.d.ts.map +1 -0
- package/esm/extensions/ext-content-mdx/src/plugins/rehype-node-positions.js +45 -0
- package/esm/extensions/ext-content-mdx/src/plugins/remark-headings.d.ts +4 -0
- package/esm/extensions/ext-content-mdx/src/plugins/remark-headings.d.ts.map +1 -0
- package/esm/extensions/ext-content-mdx/src/plugins/remark-headings.js +69 -0
- package/esm/extensions/ext-content-mdx/src/plugins/remark-mdx-utils.d.ts +14 -0
- package/esm/extensions/ext-content-mdx/src/plugins/remark-mdx-utils.d.ts.map +1 -0
- package/esm/extensions/ext-content-mdx/src/plugins/remark-mdx-utils.js +191 -0
- package/esm/package.json +3 -0
- package/esm/src/config/defaults.d.ts +39 -0
- package/esm/src/config/defaults.d.ts.map +1 -0
- package/esm/src/config/defaults.js +65 -0
- package/esm/src/errors/error-registry/agent.d.ts +18 -0
- package/esm/src/errors/error-registry/agent.d.ts.map +1 -0
- package/esm/src/errors/error-registry/agent.js +60 -0
- package/esm/src/errors/error-registry/boundary.d.ts +16 -0
- package/esm/src/errors/error-registry/boundary.d.ts.map +1 -0
- package/esm/src/errors/error-registry/boundary.js +52 -0
- package/esm/src/errors/error-registry/build.d.ts +20 -0
- package/esm/src/errors/error-registry/build.d.ts.map +1 -0
- package/esm/src/errors/error-registry/build.js +68 -0
- package/esm/src/errors/error-registry/config.d.ts +22 -0
- package/esm/src/errors/error-registry/config.d.ts.map +1 -0
- package/esm/src/errors/error-registry/config.js +70 -0
- package/esm/src/errors/error-registry/deploy.d.ts +12 -0
- package/esm/src/errors/error-registry/deploy.d.ts.map +1 -0
- package/esm/src/errors/error-registry/deploy.js +36 -0
- package/esm/src/errors/error-registry/dev.d.ts +14 -0
- package/esm/src/errors/error-registry/dev.d.ts.map +1 -0
- package/esm/src/errors/error-registry/dev.js +44 -0
- package/esm/src/errors/error-registry/general.d.ts +29 -0
- package/esm/src/errors/error-registry/general.d.ts.map +1 -0
- package/esm/src/errors/error-registry/general.js +92 -0
- package/esm/src/errors/error-registry/module.d.ts +16 -0
- package/esm/src/errors/error-registry/module.d.ts.map +1 -0
- package/esm/src/errors/error-registry/module.js +52 -0
- package/esm/src/errors/error-registry/route.d.ts +16 -0
- package/esm/src/errors/error-registry/route.d.ts.map +1 -0
- package/esm/src/errors/error-registry/route.js +52 -0
- package/esm/src/errors/error-registry/runtime.d.ts +18 -0
- package/esm/src/errors/error-registry/runtime.d.ts.map +1 -0
- package/esm/src/errors/error-registry/runtime.js +60 -0
- package/esm/src/errors/error-registry/server.d.ts +39 -0
- package/esm/src/errors/error-registry/server.d.ts.map +1 -0
- package/esm/src/errors/error-registry/server.js +129 -0
- package/esm/src/errors/error-registry-helpers.d.ts +6 -0
- package/esm/src/errors/error-registry-helpers.d.ts.map +1 -0
- package/esm/src/errors/error-registry-helpers.js +9 -0
- package/esm/src/errors/error-registry.d.ts +114 -0
- package/esm/src/errors/error-registry.d.ts.map +1 -0
- package/esm/src/errors/error-registry.js +60 -0
- package/esm/src/errors/types.d.ts +84 -0
- package/esm/src/errors/types.d.ts.map +1 -0
- package/esm/src/errors/types.js +69 -0
- package/esm/src/errors/veryfront-error.d.ts +149 -0
- package/esm/src/errors/veryfront-error.d.ts.map +1 -0
- package/esm/src/errors/veryfront-error.js +61 -0
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.d.ts +13 -0
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.d.ts.map +1 -0
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.js +55 -0
- package/esm/src/observability/tracing/api-shim.d.ts +178 -0
- package/esm/src/observability/tracing/api-shim.d.ts.map +1 -0
- package/esm/src/observability/tracing/api-shim.js +241 -0
- package/esm/src/observability/tracing/otlp-setup.d.ts +56 -0
- package/esm/src/observability/tracing/otlp-setup.d.ts.map +1 -0
- package/esm/src/observability/tracing/otlp-setup.js +206 -0
- package/esm/src/observability/tracing/telemetry-env.d.ts +3 -0
- package/esm/src/observability/tracing/telemetry-env.d.ts.map +1 -0
- package/esm/src/observability/tracing/telemetry-env.js +10 -0
- package/esm/src/platform/adapters/base.d.ts +188 -0
- package/esm/src/platform/adapters/base.d.ts.map +1 -0
- package/esm/src/platform/adapters/base.js +15 -0
- package/esm/src/platform/compat/constants.d.ts +13 -0
- package/esm/src/platform/compat/constants.d.ts.map +1 -0
- package/esm/src/platform/compat/constants.js +12 -0
- package/esm/src/platform/compat/dynamic-import.d.ts +11 -0
- package/esm/src/platform/compat/dynamic-import.d.ts.map +1 -0
- package/esm/src/platform/compat/dynamic-import.js +10 -0
- package/esm/src/platform/compat/fs.d.ts +71 -0
- package/esm/src/platform/compat/fs.d.ts.map +1 -0
- package/esm/src/platform/compat/fs.js +277 -0
- package/esm/src/platform/compat/path/basic-operations.d.ts +9 -0
- package/esm/src/platform/compat/path/basic-operations.d.ts.map +1 -0
- package/esm/src/platform/compat/path/basic-operations.js +56 -0
- package/esm/src/platform/compat/path/index.d.ts +13 -0
- package/esm/src/platform/compat/path/index.d.ts.map +1 -0
- package/esm/src/platform/compat/path/index.js +11 -0
- package/esm/src/platform/compat/path/parse-format.d.ts +4 -0
- package/esm/src/platform/compat/path/parse-format.d.ts.map +1 -0
- package/esm/src/platform/compat/path/parse-format.js +26 -0
- package/esm/src/platform/compat/path/resolution.d.ts +6 -0
- package/esm/src/platform/compat/path/resolution.d.ts.map +1 -0
- package/esm/src/platform/compat/path/resolution.js +121 -0
- package/esm/src/platform/compat/path/runtime.d.ts +8 -0
- package/esm/src/platform/compat/path/runtime.d.ts.map +1 -0
- package/esm/src/platform/compat/path/runtime.js +20 -0
- package/esm/src/platform/compat/path/security.d.ts +2 -0
- package/esm/src/platform/compat/path/security.d.ts.map +1 -0
- package/esm/src/platform/compat/path/security.js +24 -0
- package/esm/src/platform/compat/path/types.d.ts +22 -0
- package/esm/src/platform/compat/path/types.d.ts.map +1 -0
- package/esm/src/platform/compat/path/types.js +1 -0
- package/esm/src/platform/compat/path/url-conversion.d.ts +3 -0
- package/esm/src/platform/compat/path/url-conversion.d.ts.map +1 -0
- package/esm/src/platform/compat/path/url-conversion.js +45 -0
- package/esm/src/platform/compat/process/command.d.ts +31 -0
- package/esm/src/platform/compat/process/command.d.ts.map +1 -0
- package/esm/src/platform/compat/process/command.js +194 -0
- package/esm/src/platform/compat/process/env.d.ts +35 -0
- package/esm/src/platform/compat/process/env.d.ts.map +1 -0
- package/esm/src/platform/compat/process/env.js +194 -0
- package/esm/src/platform/compat/process/lifecycle.d.ts +99 -0
- package/esm/src/platform/compat/process/lifecycle.d.ts.map +1 -0
- package/esm/src/platform/compat/process/lifecycle.js +327 -0
- package/esm/src/platform/compat/process/runtime-process.d.ts +10 -0
- package/esm/src/platform/compat/process/runtime-process.d.ts.map +1 -0
- package/esm/src/platform/compat/process/runtime-process.js +25 -0
- package/esm/src/platform/compat/process.d.ts +5 -0
- package/esm/src/platform/compat/process.d.ts.map +1 -0
- package/esm/src/platform/compat/process.js +4 -0
- package/esm/src/platform/compat/runtime.d.ts +51 -0
- package/esm/src/platform/compat/runtime.d.ts.map +1 -0
- package/esm/src/platform/compat/runtime.js +101 -0
- package/esm/src/platform/compat/std/front-matter-yaml.d.ts +13 -0
- package/esm/src/platform/compat/std/front-matter-yaml.d.ts.map +1 -0
- package/esm/src/platform/compat/std/front-matter-yaml.js +28 -0
- package/esm/src/transforms/import-rewriter/url-builder.d.ts +70 -0
- package/esm/src/transforms/import-rewriter/url-builder.d.ts.map +1 -0
- package/esm/src/transforms/import-rewriter/url-builder.js +152 -0
- package/esm/src/transforms/md/utils.d.ts +14 -0
- package/esm/src/transforms/md/utils.d.ts.map +1 -0
- package/esm/src/transforms/md/utils.js +17 -0
- package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts +6 -0
- package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts.map +1 -0
- package/esm/src/transforms/mdx/compiler/frontmatter-extractor.js +48 -0
- package/esm/src/transforms/mdx/compiler/import-rewriter.d.ts +10 -0
- package/esm/src/transforms/mdx/compiler/import-rewriter.d.ts.map +1 -0
- package/esm/src/transforms/mdx/compiler/import-rewriter.js +87 -0
- package/esm/src/utils/base64url.d.ts +6 -0
- package/esm/src/utils/base64url.d.ts.map +1 -0
- package/esm/src/utils/base64url.js +12 -0
- package/esm/src/utils/bundle-manifest.d.ts +63 -0
- package/esm/src/utils/bundle-manifest.d.ts.map +1 -0
- package/esm/src/utils/bundle-manifest.js +96 -0
- package/esm/src/utils/constants/buffers.d.ts +24 -0
- package/esm/src/utils/constants/buffers.d.ts.map +1 -0
- package/esm/src/utils/constants/buffers.js +23 -0
- package/esm/src/utils/constants/build.d.ts +8 -0
- package/esm/src/utils/constants/build.d.ts.map +1 -0
- package/esm/src/utils/constants/build.js +7 -0
- package/esm/src/utils/constants/cache.d.ts +74 -0
- package/esm/src/utils/constants/cache.d.ts.map +1 -0
- package/esm/src/utils/constants/cache.js +133 -0
- package/esm/src/utils/constants/cdn.d.ts +29 -0
- package/esm/src/utils/constants/cdn.d.ts.map +1 -0
- package/esm/src/utils/constants/cdn.js +58 -0
- package/esm/src/utils/constants/crypto.d.ts +10 -0
- package/esm/src/utils/constants/crypto.d.ts.map +1 -0
- package/esm/src/utils/constants/crypto.js +9 -0
- package/esm/src/utils/constants/env.d.ts +16 -0
- package/esm/src/utils/constants/env.d.ts.map +1 -0
- package/esm/src/utils/constants/env.js +20 -0
- package/esm/src/utils/constants/hash.d.ts +5 -0
- package/esm/src/utils/constants/hash.d.ts.map +1 -0
- package/esm/src/utils/constants/hash.js +4 -0
- package/esm/src/utils/constants/hmr.d.ts +24 -0
- package/esm/src/utils/constants/hmr.d.ts.map +1 -0
- package/esm/src/utils/constants/hmr.js +26 -0
- package/esm/src/utils/constants/html.d.ts +13 -0
- package/esm/src/utils/constants/html.d.ts.map +1 -0
- package/esm/src/utils/constants/html.js +12 -0
- package/esm/src/utils/constants/http.d.ts +77 -0
- package/esm/src/utils/constants/http.d.ts.map +1 -0
- package/esm/src/utils/constants/http.js +76 -0
- package/esm/src/utils/constants/index.d.ts +23 -0
- package/esm/src/utils/constants/index.d.ts.map +1 -0
- package/esm/src/utils/constants/index.js +22 -0
- package/esm/src/utils/constants/limits.d.ts +27 -0
- package/esm/src/utils/constants/limits.d.ts.map +1 -0
- package/esm/src/utils/constants/limits.js +26 -0
- package/esm/src/utils/constants/metrics.d.ts +10 -0
- package/esm/src/utils/constants/metrics.d.ts.map +1 -0
- package/esm/src/utils/constants/metrics.js +34 -0
- package/esm/src/utils/constants/network.d.ts +23 -0
- package/esm/src/utils/constants/network.d.ts.map +1 -0
- package/esm/src/utils/constants/network.js +27 -0
- package/esm/src/utils/constants/priorities.d.ts +31 -0
- package/esm/src/utils/constants/priorities.d.ts.map +1 -0
- package/esm/src/utils/constants/priorities.js +30 -0
- package/esm/src/utils/constants/retry.d.ts +14 -0
- package/esm/src/utils/constants/retry.d.ts.map +1 -0
- package/esm/src/utils/constants/retry.js +13 -0
- package/esm/src/utils/constants/security.d.ts +16 -0
- package/esm/src/utils/constants/security.d.ts.map +1 -0
- package/esm/src/utils/constants/security.js +15 -0
- package/esm/src/utils/constants/server.d.ts +107 -0
- package/esm/src/utils/constants/server.d.ts.map +1 -0
- package/esm/src/utils/constants/server.js +120 -0
- package/esm/src/utils/feature-flags.d.ts +7 -0
- package/esm/src/utils/feature-flags.d.ts.map +1 -0
- package/esm/src/utils/feature-flags.js +8 -0
- package/esm/src/utils/hash-utils.d.ts +19 -0
- package/esm/src/utils/hash-utils.d.ts.map +1 -0
- package/esm/src/utils/hash-utils.js +42 -0
- package/esm/src/utils/import-lockfile.d.ts +52 -0
- package/esm/src/utils/import-lockfile.d.ts.map +1 -0
- package/esm/src/utils/import-lockfile.js +187 -0
- package/esm/src/utils/index.d.ts +27 -0
- package/esm/src/utils/index.d.ts.map +1 -0
- package/esm/src/utils/index.js +25 -0
- package/esm/src/utils/logger/components.d.ts +73 -0
- package/esm/src/utils/logger/components.d.ts.map +1 -0
- package/esm/src/utils/logger/components.js +81 -0
- package/esm/src/utils/logger/core.d.ts +73 -0
- package/esm/src/utils/logger/core.d.ts.map +1 -0
- package/esm/src/utils/logger/core.js +143 -0
- package/esm/src/utils/logger/index.d.ts +10 -0
- package/esm/src/utils/logger/index.d.ts.map +1 -0
- package/esm/src/utils/logger/index.js +9 -0
- package/esm/src/utils/logger/logger.d.ts +166 -0
- package/esm/src/utils/logger/logger.d.ts.map +1 -0
- package/esm/src/utils/logger/logger.js +445 -0
- package/esm/src/utils/logger/redact.d.ts +74 -0
- package/esm/src/utils/logger/redact.d.ts.map +1 -0
- package/esm/src/utils/logger/redact.js +294 -0
- package/esm/src/utils/logger/request-context.d.ts +27 -0
- package/esm/src/utils/logger/request-context.d.ts.map +1 -0
- package/esm/src/utils/logger/request-context.js +28 -0
- package/esm/src/utils/memoize.d.ts +19 -0
- package/esm/src/utils/memoize.d.ts.map +1 -0
- package/esm/src/utils/memoize.js +72 -0
- package/esm/src/utils/parallel.d.ts +25 -0
- package/esm/src/utils/parallel.d.ts.map +1 -0
- package/esm/src/utils/parallel.js +91 -0
- package/esm/src/utils/path-utils.d.ts +34 -0
- package/esm/src/utils/path-utils.d.ts.map +1 -0
- package/esm/src/utils/path-utils.js +138 -0
- package/esm/src/utils/perf-timer.d.ts +11 -0
- package/esm/src/utils/perf-timer.d.ts.map +1 -0
- package/esm/src/utils/perf-timer.js +114 -0
- package/esm/src/utils/platform.d.ts +9 -0
- package/esm/src/utils/platform.d.ts.map +1 -0
- package/esm/src/utils/platform.js +20 -0
- package/esm/src/utils/runtime-guards.d.ts +29 -0
- package/esm/src/utils/runtime-guards.d.ts.map +1 -0
- package/esm/src/utils/runtime-guards.js +23 -0
- package/esm/src/utils/version-constant.d.ts +3 -0
- package/esm/src/utils/version-constant.d.ts.map +1 -0
- package/esm/src/utils/version-constant.js +4 -0
- package/esm/src/utils/version.d.ts +17 -0
- package/esm/src/utils/version.d.ts.map +1 -0
- package/esm/src/utils/version.js +36 -0
- package/package.json +80 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { type LogLevelName, type SerializedError } from "./core.js";
|
|
2
|
+
export declare enum LogLevel {
|
|
3
|
+
DEBUG = 0,
|
|
4
|
+
INFO = 1,
|
|
5
|
+
WARN = 2,
|
|
6
|
+
ERROR = 3
|
|
7
|
+
}
|
|
8
|
+
export type LogFormat = "text" | "json";
|
|
9
|
+
/**
|
|
10
|
+
* Structured log entry for JSON output.
|
|
11
|
+
* Fields are designed for easy Grafana/Loki filtering.
|
|
12
|
+
*/
|
|
13
|
+
export interface LogEntry {
|
|
14
|
+
timestamp: string;
|
|
15
|
+
level: LogLevelName;
|
|
16
|
+
service: string;
|
|
17
|
+
veryfrontVersion: string;
|
|
18
|
+
message: string;
|
|
19
|
+
component?: string;
|
|
20
|
+
context?: Record<string, unknown>;
|
|
21
|
+
error?: SerializedError;
|
|
22
|
+
/** @deprecated Use `request_id` instead. Kept for Grafana dashboard transition. Planned removal after Grafana dashboard migration is complete. */
|
|
23
|
+
requestId?: string;
|
|
24
|
+
/** @deprecated Use `trace_id` instead. Kept for Grafana dashboard transition. Planned removal after Grafana dashboard migration is complete. */
|
|
25
|
+
traceId?: string;
|
|
26
|
+
/** @deprecated Use `span_id` instead. Kept for Grafana dashboard transition. Planned removal after Grafana dashboard migration is complete. */
|
|
27
|
+
spanId?: string;
|
|
28
|
+
/** @deprecated Use `project_slug` instead. Kept for Grafana dashboard transition. Planned removal after Grafana dashboard migration is complete. */
|
|
29
|
+
projectSlug?: string;
|
|
30
|
+
request_id?: string;
|
|
31
|
+
trace_id?: string;
|
|
32
|
+
span_id?: string;
|
|
33
|
+
project_slug?: string;
|
|
34
|
+
request_url?: string;
|
|
35
|
+
domain?: string;
|
|
36
|
+
project_id?: string;
|
|
37
|
+
release_id?: string;
|
|
38
|
+
branch_id?: string;
|
|
39
|
+
branch_name?: string;
|
|
40
|
+
run_execution_id?: string;
|
|
41
|
+
batch_id?: string;
|
|
42
|
+
run_target?: string;
|
|
43
|
+
task?: string;
|
|
44
|
+
event_kind?: string;
|
|
45
|
+
user_visible?: string;
|
|
46
|
+
user_id?: string;
|
|
47
|
+
conversation_id?: string;
|
|
48
|
+
/** @deprecated Use `user_id` instead. Kept for Grafana dashboard transition. */
|
|
49
|
+
userId?: string;
|
|
50
|
+
/** @deprecated Use `conversation_id` instead. Kept for Grafana dashboard transition. */
|
|
51
|
+
conversationId?: string;
|
|
52
|
+
/** @deprecated Use `duration_ms` instead. Kept for Grafana dashboard transition. Planned removal after Grafana dashboard migration is complete. */
|
|
53
|
+
durationMs?: number;
|
|
54
|
+
duration_ms?: number;
|
|
55
|
+
}
|
|
56
|
+
/** Public API contract for logger. */
|
|
57
|
+
export interface Logger {
|
|
58
|
+
debug(message: string, ...args: unknown[]): void;
|
|
59
|
+
info(message: string, ...args: unknown[]): void;
|
|
60
|
+
warn(message: string, ...args: unknown[]): void;
|
|
61
|
+
error(message: string, ...args: unknown[]): void;
|
|
62
|
+
time<T>(label: string, fn: () => Promise<T>): Promise<T>;
|
|
63
|
+
/**
|
|
64
|
+
* Create a child logger with additional context bound to all log entries.
|
|
65
|
+
*/
|
|
66
|
+
child(context: Record<string, unknown>): Logger;
|
|
67
|
+
/**
|
|
68
|
+
* Create a component-scoped logger. The component name is included as a
|
|
69
|
+
* structured `component` field in JSON output and rendered as `[component]`
|
|
70
|
+
* in text output.
|
|
71
|
+
*/
|
|
72
|
+
component(name: string): Logger;
|
|
73
|
+
}
|
|
74
|
+
type ConsoleLoggerOptions = {
|
|
75
|
+
injectTraceContext?: boolean;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Determine the log level based on environment variables.
|
|
79
|
+
* Exported for testing purposes.
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
export declare function getDefaultLevel(envLevel?: string | undefined, debugFlag?: string | undefined): LogLevel;
|
|
83
|
+
/**
|
|
84
|
+
* Re-read logger configuration from environment variables.
|
|
85
|
+
* Call after loading .env files so the logger picks up any overrides.
|
|
86
|
+
*/
|
|
87
|
+
export declare function refreshLoggerConfig(): void;
|
|
88
|
+
/** @internal Alias kept for tests. */
|
|
89
|
+
export declare const __resetLoggerConfigForTests: typeof refreshLoggerConfig;
|
|
90
|
+
declare class ConsoleLogger implements Logger {
|
|
91
|
+
private prefix;
|
|
92
|
+
private readonly options;
|
|
93
|
+
private boundContext;
|
|
94
|
+
private componentName?;
|
|
95
|
+
constructor(prefix: string, boundContext?: Record<string, unknown>, componentName?: string, options?: ConsoleLoggerOptions);
|
|
96
|
+
child(context: Record<string, unknown>): Logger;
|
|
97
|
+
component(name: string): Logger;
|
|
98
|
+
private formatJson;
|
|
99
|
+
private formatTextLine;
|
|
100
|
+
private log;
|
|
101
|
+
debug(message: string, ...args: unknown[]): void;
|
|
102
|
+
info(message: string, ...args: unknown[]): void;
|
|
103
|
+
warn(message: string, ...args: unknown[]): void;
|
|
104
|
+
error(message: string, ...args: unknown[]): void;
|
|
105
|
+
time<T>(label: string, fn: () => Promise<T>): Promise<T>;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Register the request context getter.
|
|
109
|
+
* Called by request-context.ts during module initialization.
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
export declare function __registerRequestContextGetter(getter: () => {
|
|
113
|
+
logger: Logger;
|
|
114
|
+
} | undefined): void;
|
|
115
|
+
/**
|
|
116
|
+
* Register the trace context getter.
|
|
117
|
+
* Called by trace-bridge.ts after OTLP initialization.
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
export declare function __registerTraceContextGetter(getter: () => {
|
|
121
|
+
traceId?: string;
|
|
122
|
+
spanId?: string;
|
|
123
|
+
}): void;
|
|
124
|
+
/**
|
|
125
|
+
* Reset the trace context getter.
|
|
126
|
+
* Only intended for testing purposes.
|
|
127
|
+
* @internal
|
|
128
|
+
*/
|
|
129
|
+
export declare function __resetTraceContextGetterForTests(): void;
|
|
130
|
+
export declare const cliLogger: Logger;
|
|
131
|
+
/** Shared server logger value. */
|
|
132
|
+
export declare const serverLogger: Logger;
|
|
133
|
+
/** Shared renderer logger value. */
|
|
134
|
+
export declare const rendererLogger: Logger;
|
|
135
|
+
/** Shared bundler logger value. */
|
|
136
|
+
export declare const bundlerLogger: Logger;
|
|
137
|
+
/** Shared agent logger value. */
|
|
138
|
+
export declare const agentLogger: Logger;
|
|
139
|
+
export declare const proxyLogger: Logger;
|
|
140
|
+
/** Shared logger value. */
|
|
141
|
+
export declare const logger: Logger;
|
|
142
|
+
/**
|
|
143
|
+
* Get the base logger without request context awareness.
|
|
144
|
+
* Use this when you need to create a request-scoped logger in middleware.
|
|
145
|
+
*/
|
|
146
|
+
export declare function getBaseLogger(prefix: string, options?: ConsoleLoggerOptions): ConsoleLogger;
|
|
147
|
+
/**
|
|
148
|
+
* Create a logger for a specific request context.
|
|
149
|
+
* Useful for binding request-specific metadata to all logs.
|
|
150
|
+
*/
|
|
151
|
+
export declare function createRequestLogger(baseLogger: Logger, requestContext: {
|
|
152
|
+
requestId?: string;
|
|
153
|
+
traceId?: string;
|
|
154
|
+
projectSlug?: string;
|
|
155
|
+
}): Logger;
|
|
156
|
+
/** Create run user logger. */
|
|
157
|
+
export declare function createRunUserLogger(baseLogger: Logger, runContext: {
|
|
158
|
+
projectId: string;
|
|
159
|
+
runExecutionId: string;
|
|
160
|
+
task: string;
|
|
161
|
+
batchId?: string | null;
|
|
162
|
+
runTarget?: string | null;
|
|
163
|
+
eventKind?: string;
|
|
164
|
+
}): Logger;
|
|
165
|
+
export {};
|
|
166
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/src/utils/logger/logger.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,YAAY,EAEjB,KAAK,eAAe,EAErB,MAAM,WAAW,CAAC;AAGnB,oBAAY,QAAQ;IAClB,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAEhB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC,KAAK,CAAC,EAAE,eAAe,CAAC;IAExB,kJAAkJ;IAClJ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gJAAgJ;IAChJ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+IAA+I;IAC/I,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oJAAoJ;IACpJ,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,UAAU,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AM,EAClB,cAAc,EAAE;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GACA,MAAM,CAER;AAED,8BAA8B;AAC9B,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE;IACV,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,MAAM,CAUR"}
|
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { getEnv, isStdoutTTY } from "../../platform/compat/process.js";
|
|
2
|
+
import { RUNTIME_VERSION } from "../version.js";
|
|
3
|
+
import { ANSI, colorize, formatContextText, formatTimestamp, LEVEL_COLORS, LEVEL_GLYPHS, padTag, serializeError, } from "./core.js";
|
|
4
|
+
import { redactSensitive, sanitizeSerializedError, sanitizeUrlCredentials } from "./redact.js";
|
|
5
|
+
export var LogLevel;
|
|
6
|
+
(function (LogLevel) {
|
|
7
|
+
LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
|
|
8
|
+
LogLevel[LogLevel["INFO"] = 1] = "INFO";
|
|
9
|
+
LogLevel[LogLevel["WARN"] = 2] = "WARN";
|
|
10
|
+
LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
|
|
11
|
+
})(LogLevel || (LogLevel = {}));
|
|
12
|
+
// ---- Config helpers (must be declared before the eager init below) ----
|
|
13
|
+
const LOG_LEVEL_MAP = {
|
|
14
|
+
DEBUG: LogLevel.DEBUG,
|
|
15
|
+
INFO: LogLevel.INFO,
|
|
16
|
+
WARN: LogLevel.WARN,
|
|
17
|
+
ERROR: LogLevel.ERROR,
|
|
18
|
+
};
|
|
19
|
+
function parseLogLevel(levelString) {
|
|
20
|
+
if (!levelString)
|
|
21
|
+
return undefined;
|
|
22
|
+
return LOG_LEVEL_MAP[levelString.toUpperCase()];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Determine the log level based on environment variables.
|
|
26
|
+
* Exported for testing purposes.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export function getDefaultLevel(envLevel = getEnv("LOG_LEVEL"), debugFlag = getEnv("VERYFRONT_DEBUG")) {
|
|
30
|
+
const parsedLevel = parseLogLevel(envLevel);
|
|
31
|
+
if (parsedLevel !== undefined)
|
|
32
|
+
return parsedLevel;
|
|
33
|
+
if (debugFlag === "1" || debugFlag === "true")
|
|
34
|
+
return LogLevel.DEBUG;
|
|
35
|
+
return LogLevel.INFO;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Determine log format from environment.
|
|
39
|
+
* Defaults to JSON in production for Grafana compatibility.
|
|
40
|
+
*/
|
|
41
|
+
function getDefaultFormat(envFormat = getEnv("LOG_FORMAT"), envMode = getEnv("NODE_ENV")) {
|
|
42
|
+
if (envFormat === "json" || envFormat === "text")
|
|
43
|
+
return envFormat;
|
|
44
|
+
return envMode === "production" ? "json" : "text";
|
|
45
|
+
}
|
|
46
|
+
// ---- Eager config resolution ----
|
|
47
|
+
/**
|
|
48
|
+
* Eagerly resolved at module load time so the config is captured from
|
|
49
|
+
* host process env vars BEFORE any per-request project env overlay is
|
|
50
|
+
* active. The project overlay blocks access to host env (for security),
|
|
51
|
+
* which would cause the logger to fall back to "text" format during SSR.
|
|
52
|
+
*/
|
|
53
|
+
let loggerConfig = {
|
|
54
|
+
level: getDefaultLevel(),
|
|
55
|
+
format: getDefaultFormat(),
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Re-read logger configuration from environment variables.
|
|
59
|
+
* Call after loading .env files so the logger picks up any overrides.
|
|
60
|
+
*/
|
|
61
|
+
export function refreshLoggerConfig() {
|
|
62
|
+
loggerConfig = {
|
|
63
|
+
level: getDefaultLevel(),
|
|
64
|
+
format: getDefaultFormat(),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/** @internal Alias kept for tests. */
|
|
68
|
+
export const __resetLoggerConfigForTests = refreshLoggerConfig;
|
|
69
|
+
function resolveLoggerConfig() {
|
|
70
|
+
return loggerConfig;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Extract context from variadic args.
|
|
74
|
+
* First object argument becomes context, errors are handled specially.
|
|
75
|
+
*/
|
|
76
|
+
function extractContext(args) {
|
|
77
|
+
let context;
|
|
78
|
+
let error;
|
|
79
|
+
for (const arg of args) {
|
|
80
|
+
if (arg instanceof Error) {
|
|
81
|
+
error = serializeError(arg);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (typeof arg === "object" && arg !== null && !Array.isArray(arg)) {
|
|
85
|
+
const contextArg = arg;
|
|
86
|
+
if (contextArg.error instanceof Error) {
|
|
87
|
+
const { error: contextError, ...rest } = contextArg;
|
|
88
|
+
error = serializeError(contextError);
|
|
89
|
+
if (Object.keys(rest).length > 0) {
|
|
90
|
+
context = { ...context, ...rest };
|
|
91
|
+
}
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
context = { ...context, ...contextArg };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return { context, error };
|
|
98
|
+
}
|
|
99
|
+
const TAG_COLORS = {
|
|
100
|
+
CLI: ANSI.green,
|
|
101
|
+
SERVER: ANSI.blue,
|
|
102
|
+
RENDERER: ANSI.magenta,
|
|
103
|
+
BUNDLER: ANSI.yellow,
|
|
104
|
+
AGENT: ANSI.cyan,
|
|
105
|
+
PROXY: ANSI.cyan,
|
|
106
|
+
VERYFRONT: ANSI.cyan,
|
|
107
|
+
};
|
|
108
|
+
function isTty() {
|
|
109
|
+
try {
|
|
110
|
+
return isStdoutTTY();
|
|
111
|
+
}
|
|
112
|
+
catch (_) {
|
|
113
|
+
/* expected: TTY detection may fail in restricted environments */
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function shouldUseColor() {
|
|
118
|
+
const noColor = getEnv("NO_COLOR");
|
|
119
|
+
const forceColor = getEnv("FORCE_COLOR");
|
|
120
|
+
const logColor = getEnv("LOG_COLOR");
|
|
121
|
+
if (forceColor === "0" || logColor === "0")
|
|
122
|
+
return false;
|
|
123
|
+
if (noColor !== undefined)
|
|
124
|
+
return false;
|
|
125
|
+
if (getEnv("CI") !== undefined)
|
|
126
|
+
return false;
|
|
127
|
+
if (forceColor || logColor === "1" || logColor === "true")
|
|
128
|
+
return true;
|
|
129
|
+
return isTty();
|
|
130
|
+
}
|
|
131
|
+
function extractToEntryField(entry, context, key, coerce) {
|
|
132
|
+
if (!(key in context))
|
|
133
|
+
return;
|
|
134
|
+
entry[key] = coerce(context[key]);
|
|
135
|
+
delete context[key];
|
|
136
|
+
}
|
|
137
|
+
class ConsoleLogger {
|
|
138
|
+
prefix;
|
|
139
|
+
options;
|
|
140
|
+
boundContext;
|
|
141
|
+
componentName;
|
|
142
|
+
constructor(prefix, boundContext, componentName, options = {}) {
|
|
143
|
+
this.prefix = prefix;
|
|
144
|
+
this.options = options;
|
|
145
|
+
this.boundContext = boundContext ?? {};
|
|
146
|
+
this.componentName = componentName;
|
|
147
|
+
}
|
|
148
|
+
child(context) {
|
|
149
|
+
return new ConsoleLogger(this.prefix, { ...this.boundContext, ...context }, this.componentName, this.options);
|
|
150
|
+
}
|
|
151
|
+
component(name) {
|
|
152
|
+
return new ConsoleLogger(this.prefix, { ...this.boundContext }, name, this.options);
|
|
153
|
+
}
|
|
154
|
+
formatJson(level, message, args) {
|
|
155
|
+
const { context, error } = extractContext(args);
|
|
156
|
+
const mergedContext = { ...this.boundContext, ...context };
|
|
157
|
+
const entry = {
|
|
158
|
+
timestamp: new Date().toISOString(),
|
|
159
|
+
level,
|
|
160
|
+
service: this.prefix.toLowerCase(),
|
|
161
|
+
veryfrontVersion: RUNTIME_VERSION,
|
|
162
|
+
message,
|
|
163
|
+
};
|
|
164
|
+
if (this.componentName)
|
|
165
|
+
entry.component = this.componentName;
|
|
166
|
+
// Extract known fields to top level for easier Grafana filtering
|
|
167
|
+
extractToEntryField(entry, mergedContext, "requestId", (v) => String(v));
|
|
168
|
+
extractToEntryField(entry, mergedContext, "traceId", (v) => String(v));
|
|
169
|
+
extractToEntryField(entry, mergedContext, "spanId", (v) => String(v));
|
|
170
|
+
extractToEntryField(entry, mergedContext, "projectSlug", (v) => String(v));
|
|
171
|
+
extractToEntryField(entry, mergedContext, "durationMs", (v) => Number(v));
|
|
172
|
+
// Auto-inject trace context from OTel when not already set
|
|
173
|
+
if ((this.options.injectTraceContext ?? true) && traceContextGetter && !entry.traceId) {
|
|
174
|
+
const traceCtx = traceContextGetter();
|
|
175
|
+
if (traceCtx.traceId) {
|
|
176
|
+
entry.traceId = traceCtx.traceId;
|
|
177
|
+
entry.spanId = traceCtx.spanId;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// Extract standard snake_case fields for Loki filtering
|
|
181
|
+
extractToEntryField(entry, mergedContext, "request_id", (v) => String(v));
|
|
182
|
+
extractToEntryField(entry, mergedContext, "trace_id", (v) => String(v));
|
|
183
|
+
extractToEntryField(entry, mergedContext, "span_id", (v) => String(v));
|
|
184
|
+
extractToEntryField(entry, mergedContext, "project_slug", (v) => String(v));
|
|
185
|
+
// request_url / domain are URL-shaped and lifted out of mergedContext
|
|
186
|
+
// *before* redactSensitive runs, so they bypass the key-based redactor.
|
|
187
|
+
// Scrub embedded credentials (userinfo, ?access_token=, …) here (#1989).
|
|
188
|
+
extractToEntryField(entry, mergedContext, "request_url", (v) => sanitizeUrlCredentials(String(v)));
|
|
189
|
+
extractToEntryField(entry, mergedContext, "domain", (v) => sanitizeUrlCredentials(String(v)));
|
|
190
|
+
extractToEntryField(entry, mergedContext, "project_id", (v) => String(v));
|
|
191
|
+
extractToEntryField(entry, mergedContext, "release_id", (v) => String(v));
|
|
192
|
+
extractToEntryField(entry, mergedContext, "branch_id", (v) => String(v));
|
|
193
|
+
extractToEntryField(entry, mergedContext, "branch_name", (v) => String(v));
|
|
194
|
+
extractToEntryField(entry, mergedContext, "run_execution_id", (v) => String(v));
|
|
195
|
+
extractToEntryField(entry, mergedContext, "batch_id", (v) => String(v));
|
|
196
|
+
extractToEntryField(entry, mergedContext, "run_target", (v) => String(v));
|
|
197
|
+
extractToEntryField(entry, mergedContext, "task", (v) => String(v));
|
|
198
|
+
extractToEntryField(entry, mergedContext, "event_kind", (v) => String(v));
|
|
199
|
+
extractToEntryField(entry, mergedContext, "user_visible", (v) => String(v));
|
|
200
|
+
extractToEntryField(entry, mergedContext, "duration_ms", (v) => Number(v));
|
|
201
|
+
extractToEntryField(entry, mergedContext, "user_id", (v) => String(v));
|
|
202
|
+
extractToEntryField(entry, mergedContext, "conversation_id", (v) => String(v));
|
|
203
|
+
// Also extract camelCase variants so callers can use either convention
|
|
204
|
+
extractToEntryField(entry, mergedContext, "userId", (v) => String(v));
|
|
205
|
+
extractToEntryField(entry, mergedContext, "conversationId", (v) => String(v));
|
|
206
|
+
// Emit snake_case aliases for camelCase fields (transition period)
|
|
207
|
+
if (entry.requestId && !entry.request_id)
|
|
208
|
+
entry.request_id = entry.requestId;
|
|
209
|
+
if (entry.traceId && !entry.trace_id)
|
|
210
|
+
entry.trace_id = entry.traceId;
|
|
211
|
+
if (entry.spanId && !entry.span_id)
|
|
212
|
+
entry.span_id = entry.spanId;
|
|
213
|
+
if (entry.projectSlug && !entry.project_slug)
|
|
214
|
+
entry.project_slug = entry.projectSlug;
|
|
215
|
+
if (entry.durationMs != null && entry.duration_ms == null)
|
|
216
|
+
entry.duration_ms = entry.durationMs;
|
|
217
|
+
if (entry.userId && !entry.user_id)
|
|
218
|
+
entry.user_id = entry.userId;
|
|
219
|
+
if (entry.conversationId && !entry.conversation_id) {
|
|
220
|
+
entry.conversation_id = entry.conversationId;
|
|
221
|
+
}
|
|
222
|
+
// Redact credential-like keys from the free-form context bag before
|
|
223
|
+
// serialization (the deliberate top-level fields above are already
|
|
224
|
+
// extracted out of mergedContext, so they are unaffected).
|
|
225
|
+
if (Object.keys(mergedContext).length > 0)
|
|
226
|
+
entry.context = redactSensitive(mergedContext);
|
|
227
|
+
// The serialized error (name/message/stack) bypasses the key-based
|
|
228
|
+
// redactor; scrub credentials embedded in its message/stack (DSNs, Mongo
|
|
229
|
+
// URIs, ?access_token= URLs, userinfo) before emission (#1989).
|
|
230
|
+
if (error)
|
|
231
|
+
entry.error = sanitizeSerializedError(error);
|
|
232
|
+
return JSON.stringify(entry);
|
|
233
|
+
}
|
|
234
|
+
formatTextLine(level, message, args) {
|
|
235
|
+
const { context, error } = extractContext(args);
|
|
236
|
+
const mergedContext = { ...this.boundContext, ...context };
|
|
237
|
+
const enableColor = shouldUseColor();
|
|
238
|
+
const timestamp = colorize(formatTimestamp(), ANSI.dim, enableColor);
|
|
239
|
+
const tag = colorize(padTag(this.prefix), TAG_COLORS[this.prefix] ?? ANSI.cyan, enableColor);
|
|
240
|
+
const glyph = colorize(LEVEL_GLYPHS[level], LEVEL_COLORS[level], enableColor);
|
|
241
|
+
const componentTag = this.componentName
|
|
242
|
+
? ` ${colorize(`[${this.componentName}]`, ANSI.dim, enableColor)}`
|
|
243
|
+
: "";
|
|
244
|
+
const contextText = formatContextText(redactSensitive(mergedContext), sanitizeSerializedError(error), enableColor);
|
|
245
|
+
return `${timestamp} ${tag} ${glyph}${componentTag} ${message}${contextText}`;
|
|
246
|
+
}
|
|
247
|
+
log(level, logLevel, consoleFn, message, args) {
|
|
248
|
+
const { level: resolvedLevel, format: resolvedFormat } = resolveLoggerConfig();
|
|
249
|
+
if (resolvedLevel > logLevel)
|
|
250
|
+
return;
|
|
251
|
+
const line = resolvedFormat === "json"
|
|
252
|
+
? this.formatJson(level, message, args)
|
|
253
|
+
: this.formatTextLine(level, message, args);
|
|
254
|
+
consoleFn(line);
|
|
255
|
+
}
|
|
256
|
+
debug(message, ...args) {
|
|
257
|
+
this.log("debug", LogLevel.DEBUG, console.debug, message, args);
|
|
258
|
+
}
|
|
259
|
+
info(message, ...args) {
|
|
260
|
+
this.log("info", LogLevel.INFO, console.log, message, args);
|
|
261
|
+
}
|
|
262
|
+
warn(message, ...args) {
|
|
263
|
+
this.log("warn", LogLevel.WARN, console.warn, message, args);
|
|
264
|
+
}
|
|
265
|
+
error(message, ...args) {
|
|
266
|
+
this.log("error", LogLevel.ERROR, console.error, message, args);
|
|
267
|
+
}
|
|
268
|
+
async time(label, fn) {
|
|
269
|
+
const start = performance.now();
|
|
270
|
+
try {
|
|
271
|
+
const result = await fn();
|
|
272
|
+
const durationMs = performance.now() - start;
|
|
273
|
+
this.debug(`${label} completed`, { durationMs: Math.round(durationMs) });
|
|
274
|
+
return result;
|
|
275
|
+
}
|
|
276
|
+
catch (error) {
|
|
277
|
+
const durationMs = performance.now() - start;
|
|
278
|
+
this.error(`${label} failed`, { durationMs: Math.round(durationMs) }, error);
|
|
279
|
+
throw error;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function createLogger(prefix, options) {
|
|
284
|
+
return new ConsoleLogger(prefix, undefined, undefined, options);
|
|
285
|
+
}
|
|
286
|
+
// Base loggers without request context
|
|
287
|
+
const baseCliLogger = createLogger("CLI");
|
|
288
|
+
const baseServerLogger = createLogger("SERVER");
|
|
289
|
+
const baseRendererLogger = createLogger("RENDERER");
|
|
290
|
+
const baseBundlerLogger = createLogger("BUNDLER");
|
|
291
|
+
const baseAgentLogger = createLogger("AGENT");
|
|
292
|
+
const baseProxyLogger = createLogger("PROXY");
|
|
293
|
+
const baseLogger = createLogger("VERYFRONT");
|
|
294
|
+
const BASE_LOGGER_MAP = {
|
|
295
|
+
CLI: baseCliLogger,
|
|
296
|
+
SERVER: baseServerLogger,
|
|
297
|
+
RENDERER: baseRendererLogger,
|
|
298
|
+
BUNDLER: baseBundlerLogger,
|
|
299
|
+
AGENT: baseAgentLogger,
|
|
300
|
+
PROXY: baseProxyLogger,
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* Request context getter - set by request-context.ts to avoid circular imports.
|
|
304
|
+
* This pattern allows the logger module to be imported first without
|
|
305
|
+
* depending on request-context.ts.
|
|
306
|
+
*/
|
|
307
|
+
let requestContextGetter = null;
|
|
308
|
+
/**
|
|
309
|
+
* Register the request context getter.
|
|
310
|
+
* Called by request-context.ts during module initialization.
|
|
311
|
+
* @internal
|
|
312
|
+
*/
|
|
313
|
+
export function __registerRequestContextGetter(getter) {
|
|
314
|
+
requestContextGetter = getter;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Trace context getter - set by trace-bridge.ts to avoid importing OTel
|
|
318
|
+
* directly in the logger module. Returns the active span's traceId/spanId
|
|
319
|
+
* when OTel is initialized.
|
|
320
|
+
*/
|
|
321
|
+
let traceContextGetter = null;
|
|
322
|
+
/**
|
|
323
|
+
* Register the trace context getter.
|
|
324
|
+
* Called by trace-bridge.ts after OTLP initialization.
|
|
325
|
+
* @internal
|
|
326
|
+
*/
|
|
327
|
+
export function __registerTraceContextGetter(getter) {
|
|
328
|
+
traceContextGetter = getter;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Reset the trace context getter.
|
|
332
|
+
* Only intended for testing purposes.
|
|
333
|
+
* @internal
|
|
334
|
+
*/
|
|
335
|
+
export function __resetTraceContextGetterForTests() {
|
|
336
|
+
traceContextGetter = null;
|
|
337
|
+
}
|
|
338
|
+
function withRequestLogger(base) {
|
|
339
|
+
const ctx = requestContextGetter?.();
|
|
340
|
+
return ctx?.logger ?? base;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Create a context-aware logger proxy that automatically uses
|
|
344
|
+
* request-scoped context from AsyncLocalStorage when available.
|
|
345
|
+
*/
|
|
346
|
+
function createContextAwareLogger(base) {
|
|
347
|
+
return {
|
|
348
|
+
debug(message, ...args) {
|
|
349
|
+
withRequestLogger(base).debug(message, ...args);
|
|
350
|
+
},
|
|
351
|
+
info(message, ...args) {
|
|
352
|
+
withRequestLogger(base).info(message, ...args);
|
|
353
|
+
},
|
|
354
|
+
warn(message, ...args) {
|
|
355
|
+
withRequestLogger(base).warn(message, ...args);
|
|
356
|
+
},
|
|
357
|
+
error(message, ...args) {
|
|
358
|
+
withRequestLogger(base).error(message, ...args);
|
|
359
|
+
},
|
|
360
|
+
time(label, fn) {
|
|
361
|
+
return withRequestLogger(base).time(label, fn);
|
|
362
|
+
},
|
|
363
|
+
child(context) {
|
|
364
|
+
return withRequestLogger(base).child(context);
|
|
365
|
+
},
|
|
366
|
+
component(name) {
|
|
367
|
+
return createComponentAwareLogger(base, name);
|
|
368
|
+
},
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Create a component-scoped logger that still defers request-context
|
|
373
|
+
* resolution to call time. This avoids eagerly binding to whatever
|
|
374
|
+
* context exists at module load — critical because component loggers
|
|
375
|
+
* are typically created as top-level constants.
|
|
376
|
+
*/
|
|
377
|
+
function createComponentAwareLogger(base, componentName) {
|
|
378
|
+
return {
|
|
379
|
+
debug(message, ...args) {
|
|
380
|
+
withRequestLogger(base).component(componentName).debug(message, ...args);
|
|
381
|
+
},
|
|
382
|
+
info(message, ...args) {
|
|
383
|
+
withRequestLogger(base).component(componentName).info(message, ...args);
|
|
384
|
+
},
|
|
385
|
+
warn(message, ...args) {
|
|
386
|
+
withRequestLogger(base).component(componentName).warn(message, ...args);
|
|
387
|
+
},
|
|
388
|
+
error(message, ...args) {
|
|
389
|
+
withRequestLogger(base).component(componentName).error(message, ...args);
|
|
390
|
+
},
|
|
391
|
+
time(label, fn) {
|
|
392
|
+
return withRequestLogger(base).component(componentName).time(label, fn);
|
|
393
|
+
},
|
|
394
|
+
child(context) {
|
|
395
|
+
return withRequestLogger(base).component(componentName).child(context);
|
|
396
|
+
},
|
|
397
|
+
component(name) {
|
|
398
|
+
return createComponentAwareLogger(base, name);
|
|
399
|
+
},
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
// Context-aware loggers that automatically include request context
|
|
403
|
+
export const cliLogger = createContextAwareLogger(baseCliLogger);
|
|
404
|
+
/** Shared server logger value. */
|
|
405
|
+
export const serverLogger = createContextAwareLogger(baseServerLogger);
|
|
406
|
+
/** Shared renderer logger value. */
|
|
407
|
+
export const rendererLogger = createContextAwareLogger(baseRendererLogger);
|
|
408
|
+
/** Shared bundler logger value. */
|
|
409
|
+
export const bundlerLogger = createContextAwareLogger(baseBundlerLogger);
|
|
410
|
+
/** Shared agent logger value. */
|
|
411
|
+
export const agentLogger = createContextAwareLogger(baseAgentLogger);
|
|
412
|
+
export const proxyLogger = createContextAwareLogger(baseProxyLogger);
|
|
413
|
+
/** Shared logger value. */
|
|
414
|
+
export const logger = createContextAwareLogger(baseLogger);
|
|
415
|
+
/**
|
|
416
|
+
* Get the base logger without request context awareness.
|
|
417
|
+
* Use this when you need to create a request-scoped logger in middleware.
|
|
418
|
+
*/
|
|
419
|
+
export function getBaseLogger(prefix, options) {
|
|
420
|
+
const resolvedPrefix = prefix.toUpperCase();
|
|
421
|
+
const validPrefix = resolvedPrefix in BASE_LOGGER_MAP ? resolvedPrefix : "VERYFRONT";
|
|
422
|
+
if (options?.injectTraceContext === false) {
|
|
423
|
+
return createLogger(validPrefix, options);
|
|
424
|
+
}
|
|
425
|
+
return BASE_LOGGER_MAP[resolvedPrefix] ?? baseLogger;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Create a logger for a specific request context.
|
|
429
|
+
* Useful for binding request-specific metadata to all logs.
|
|
430
|
+
*/
|
|
431
|
+
export function createRequestLogger(baseLogger, requestContext) {
|
|
432
|
+
return baseLogger.child(requestContext);
|
|
433
|
+
}
|
|
434
|
+
/** Create run user logger. */
|
|
435
|
+
export function createRunUserLogger(baseLogger, runContext) {
|
|
436
|
+
return baseLogger.child({
|
|
437
|
+
project_id: runContext.projectId,
|
|
438
|
+
run_execution_id: runContext.runExecutionId,
|
|
439
|
+
...(runContext.batchId ? { batch_id: runContext.batchId } : {}),
|
|
440
|
+
...(runContext.runTarget ? { run_target: runContext.runTarget } : {}),
|
|
441
|
+
task: runContext.task,
|
|
442
|
+
event_kind: runContext.eventKind ?? "run_user_log",
|
|
443
|
+
user_visible: "true",
|
|
444
|
+
});
|
|
445
|
+
}
|