@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,35 @@
|
|
|
1
|
+
export type EnvOverlayStorage = {
|
|
2
|
+
getStore: () => unknown;
|
|
3
|
+
run?: <T>(store: unknown, fn: () => T) => T;
|
|
4
|
+
enterWith?: (store: unknown) => void;
|
|
5
|
+
};
|
|
6
|
+
/** Read and write process environment variables. */
|
|
7
|
+
export declare function env(): Record<string, string>;
|
|
8
|
+
/**
|
|
9
|
+
* Read a host-level environment variable without consulting any project env overlay.
|
|
10
|
+
* Use this for framework-owned runtime configuration that should not be shadowed by tenant env.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getHostEnv(key: string): string | undefined;
|
|
13
|
+
/** Read an environment variable from the active project scope. */
|
|
14
|
+
export declare function getEnv(key: string): string | undefined;
|
|
15
|
+
export interface EnvBooleanOptions {
|
|
16
|
+
trueValues?: readonly string[];
|
|
17
|
+
falseValues?: readonly string[];
|
|
18
|
+
trim?: boolean;
|
|
19
|
+
caseSensitive?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function getEnvString(key: string): string | undefined;
|
|
22
|
+
export declare function getEnvString(key: string, fallback: string): string;
|
|
23
|
+
export declare function getEnvNumber(key: string): number | undefined;
|
|
24
|
+
export declare function getEnvNumber(key: string, fallback: number): number;
|
|
25
|
+
export declare function getEnvBoolean(key: string, fallback?: boolean, options?: EnvBooleanOptions): boolean;
|
|
26
|
+
/** Sets env. */
|
|
27
|
+
export declare function setEnv(key: string, value: string): void;
|
|
28
|
+
/** Delete a process environment variable. */
|
|
29
|
+
export declare function deleteEnv(key: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Get an AsyncLocalStorage-based env overlay storage if installed.
|
|
32
|
+
* This enables per-async-context env isolation (e.g., in tests).
|
|
33
|
+
*/
|
|
34
|
+
export declare function getEnvOverlayStorage(): EnvOverlayStorage | null;
|
|
35
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/env.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC,CAAC;AAoBF,oDAAoD;AACpD,wBAAgB,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAoB5C;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAqB1D;AAqCD,kEAAkE;AAClE,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAWtD;AAKD,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAUD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAC9D,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;AAOpE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAC9D,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;AAUpE,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,QAAQ,UAAQ,EAChB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAmBT;AAED,gBAAgB;AAChB,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAiBvD;AAED,6CAA6C;AAC7C,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAiB3C;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,GAAG,IAAI,CAS/D"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
+
import { getDenoRuntime, isDeno as IS_DENO } from "../runtime.js";
|
|
3
|
+
import { runtimeProcess } from "./runtime-process.js";
|
|
4
|
+
function getEnvOverlayStore() {
|
|
5
|
+
const storage = getEnvOverlayStorage();
|
|
6
|
+
const store = storage?.getStore();
|
|
7
|
+
return store instanceof Map ? store : null;
|
|
8
|
+
}
|
|
9
|
+
function getOverlayEnvValue(store, key) {
|
|
10
|
+
if (!store?.has(key)) {
|
|
11
|
+
return { hasValue: false, value: undefined };
|
|
12
|
+
}
|
|
13
|
+
const value = store.get(key);
|
|
14
|
+
return { hasValue: true, value: value ?? undefined };
|
|
15
|
+
}
|
|
16
|
+
/** Read and write process environment variables. */
|
|
17
|
+
export function env() {
|
|
18
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
19
|
+
const base = deno
|
|
20
|
+
? deno.env.toObject()
|
|
21
|
+
: runtimeProcess
|
|
22
|
+
? { ...runtimeProcess.env }
|
|
23
|
+
: {};
|
|
24
|
+
const overlay = getEnvOverlayStore();
|
|
25
|
+
if (!overlay)
|
|
26
|
+
return base;
|
|
27
|
+
for (const [key, value] of overlay.entries()) {
|
|
28
|
+
if (value === null) {
|
|
29
|
+
delete base[key];
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
base[key] = value;
|
|
33
|
+
}
|
|
34
|
+
return base;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Read a host-level environment variable without consulting any project env overlay.
|
|
38
|
+
* Use this for framework-owned runtime configuration that should not be shadowed by tenant env.
|
|
39
|
+
*/
|
|
40
|
+
export function getHostEnv(key) {
|
|
41
|
+
const overlayResult = getOverlayEnvValue(getEnvOverlayStore(), key);
|
|
42
|
+
if (overlayResult.hasValue) {
|
|
43
|
+
return overlayResult.value;
|
|
44
|
+
}
|
|
45
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
46
|
+
if (deno) {
|
|
47
|
+
try {
|
|
48
|
+
return deno.env.get(key);
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// Under a tightened env permission allowlist (project isolation workers),
|
|
52
|
+
// reading a non-allowlisted variable throws NotCapable. Treat it as absent
|
|
53
|
+
// to match the prior `env: true` behavior where reads never threw, so
|
|
54
|
+
// optional-variable lookups degrade to undefined instead of crashing the
|
|
55
|
+
// request.
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (runtimeProcess)
|
|
60
|
+
return runtimeProcess.env[key];
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
// Lazy-loaded references to project-env/storage.ts functions.
|
|
64
|
+
// Uses globalThis to avoid circular imports (process compat is low-level, project-env is high-level).
|
|
65
|
+
// IMPORTANT: Only cache when the real getter is found. If storage.ts hasn't loaded yet,
|
|
66
|
+
// re-check globalThis on every call to avoid permanently caching the fallback.
|
|
67
|
+
let _getProjectEnv = null;
|
|
68
|
+
let _isProjectEnvActive = null;
|
|
69
|
+
function getProjectEnvSafe(key) {
|
|
70
|
+
if (_getProjectEnv === null) {
|
|
71
|
+
const mod = dntShim.dntGlobalThis.__vfProjectEnvGetter;
|
|
72
|
+
if (mod) {
|
|
73
|
+
_getProjectEnv = mod;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return _getProjectEnv(key);
|
|
80
|
+
}
|
|
81
|
+
function isProjectEnvActiveSafe() {
|
|
82
|
+
if (_isProjectEnvActive === null) {
|
|
83
|
+
const mod = dntShim.dntGlobalThis.__vfProjectEnvActiveChecker;
|
|
84
|
+
if (mod) {
|
|
85
|
+
_isProjectEnvActive = mod;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return _isProjectEnvActive();
|
|
92
|
+
}
|
|
93
|
+
/** Read an environment variable from the active project scope. */
|
|
94
|
+
export function getEnv(key) {
|
|
95
|
+
// Check per-request project env overlay first (AsyncLocalStorage)
|
|
96
|
+
const projectValue = getProjectEnvSafe(key);
|
|
97
|
+
if (projectValue !== undefined)
|
|
98
|
+
return projectValue;
|
|
99
|
+
// When a project env overlay is active (remote project request), do NOT
|
|
100
|
+
// fall through to host process env. This prevents remote projects from
|
|
101
|
+
// reading host-level secrets like AWS_SECRET_ACCESS_KEY, DATABASE_URL, etc.
|
|
102
|
+
if (isProjectEnvActiveSafe())
|
|
103
|
+
return undefined;
|
|
104
|
+
return getHostEnv(key);
|
|
105
|
+
}
|
|
106
|
+
const DEFAULT_ENV_TRUE_VALUES = ["1", "true", "yes"];
|
|
107
|
+
const DEFAULT_ENV_FALSE_VALUES = ["0", "false", "no"];
|
|
108
|
+
function normalizeEnvToken(value, options) {
|
|
109
|
+
const normalized = options.trim ? value.trim() : value;
|
|
110
|
+
return options.caseSensitive ? normalized : normalized.toLowerCase();
|
|
111
|
+
}
|
|
112
|
+
export function getEnvString(key, fallback) {
|
|
113
|
+
const value = getEnv(key);
|
|
114
|
+
if (value === undefined)
|
|
115
|
+
return fallback;
|
|
116
|
+
return value;
|
|
117
|
+
}
|
|
118
|
+
export function getEnvNumber(key, fallback) {
|
|
119
|
+
const value = getEnvString(key);
|
|
120
|
+
if (value === undefined)
|
|
121
|
+
return fallback;
|
|
122
|
+
const parsed = Number.parseInt(value, 10);
|
|
123
|
+
if (Number.isNaN(parsed))
|
|
124
|
+
return fallback ?? Number.NaN;
|
|
125
|
+
return parsed;
|
|
126
|
+
}
|
|
127
|
+
export function getEnvBoolean(key, fallback = false, options = {}) {
|
|
128
|
+
const value = getEnvString(key);
|
|
129
|
+
if (value === undefined)
|
|
130
|
+
return fallback;
|
|
131
|
+
const trim = options.trim ?? true;
|
|
132
|
+
const caseSensitive = options.caseSensitive ?? false;
|
|
133
|
+
const normalized = normalizeEnvToken(value, { trim, caseSensitive });
|
|
134
|
+
const trueValues = options.trueValues ?? DEFAULT_ENV_TRUE_VALUES;
|
|
135
|
+
for (const trueValue of trueValues) {
|
|
136
|
+
if (normalized === normalizeEnvToken(trueValue, { trim, caseSensitive }))
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
const falseValues = options.falseValues ?? DEFAULT_ENV_FALSE_VALUES;
|
|
140
|
+
for (const falseValue of falseValues) {
|
|
141
|
+
if (normalized === normalizeEnvToken(falseValue, { trim, caseSensitive }))
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
return fallback;
|
|
145
|
+
}
|
|
146
|
+
/** Sets env. */
|
|
147
|
+
export function setEnv(key, value) {
|
|
148
|
+
const overlay = getEnvOverlayStore();
|
|
149
|
+
if (overlay) {
|
|
150
|
+
overlay.set(key, value);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
154
|
+
if (deno) {
|
|
155
|
+
deno.env.set(key, value);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (runtimeProcess) {
|
|
159
|
+
runtimeProcess.env[key] = value;
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
throw new Error("setEnv() is not supported in this runtime");
|
|
163
|
+
}
|
|
164
|
+
/** Delete a process environment variable. */
|
|
165
|
+
export function deleteEnv(key) {
|
|
166
|
+
const overlay = getEnvOverlayStore();
|
|
167
|
+
if (overlay) {
|
|
168
|
+
overlay.set(key, null);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
172
|
+
if (deno) {
|
|
173
|
+
deno.env.delete(key);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (runtimeProcess) {
|
|
177
|
+
delete runtimeProcess.env[key];
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
throw new Error("deleteEnv() is not supported in this runtime");
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Get an AsyncLocalStorage-based env overlay storage if installed.
|
|
184
|
+
* This enables per-async-context env isolation (e.g., in tests).
|
|
185
|
+
*/
|
|
186
|
+
export function getEnvOverlayStorage() {
|
|
187
|
+
const globalAny = dntShim.dntGlobalThis;
|
|
188
|
+
const overlay = globalAny["__vfTestDenoEnvOverlay"] ??
|
|
189
|
+
globalAny["__vfTestEnvOverlay"];
|
|
190
|
+
const storage = overlay?.storage;
|
|
191
|
+
if (!storage || typeof storage.getStore !== "function")
|
|
192
|
+
return null;
|
|
193
|
+
return storage;
|
|
194
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
+
/** Get command-line arguments (cross-runtime: Deno.args or process.argv). */
|
|
3
|
+
export declare function getArgs(): string[];
|
|
4
|
+
/** Exit the process with an optional code (cross-runtime: Deno.exit or process.exit). */
|
|
5
|
+
export declare function exit(code?: number): never;
|
|
6
|
+
/** Return the current working directory. */
|
|
7
|
+
export declare function cwd(): string;
|
|
8
|
+
export declare function chdir(directory: string): void;
|
|
9
|
+
export declare function pid(): number;
|
|
10
|
+
export declare function memoryUsage(): {
|
|
11
|
+
rss: number;
|
|
12
|
+
heapTotal: number;
|
|
13
|
+
heapUsed: number;
|
|
14
|
+
external: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Check if stdin is a TTY (terminal)
|
|
18
|
+
*/
|
|
19
|
+
export declare function isInteractive(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Check if stdout is a TTY (terminal)
|
|
22
|
+
*/
|
|
23
|
+
export declare function isStdoutTTY(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Get terminal size (columns and rows)
|
|
26
|
+
* Returns default fallback values if terminal size cannot be determined
|
|
27
|
+
*/
|
|
28
|
+
export declare function getTerminalSize(): {
|
|
29
|
+
columns: number;
|
|
30
|
+
rows: number;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Get runtime version string
|
|
34
|
+
*/
|
|
35
|
+
export declare function getRuntimeVersion(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Get the operating system type
|
|
38
|
+
* Returns: "darwin" (macOS), "linux", "windows", or the raw platform string
|
|
39
|
+
*/
|
|
40
|
+
export declare function getOsType(): string;
|
|
41
|
+
/**
|
|
42
|
+
* Register a signal handler (SIGINT, SIGTERM) for graceful shutdown
|
|
43
|
+
*/
|
|
44
|
+
export declare function onSignal(signal: "SIGINT" | "SIGTERM", handler: () => void): void;
|
|
45
|
+
/**
|
|
46
|
+
* Register global error handlers for uncaught exceptions and unhandled promise rejections.
|
|
47
|
+
* These handlers prevent the process from crashing due to application code errors.
|
|
48
|
+
*
|
|
49
|
+
* IMPORTANT: These handlers should be registered early in the application lifecycle
|
|
50
|
+
* to catch errors that escape try/catch blocks.
|
|
51
|
+
*
|
|
52
|
+
* @param onError - Callback invoked with the error. Return true to prevent process exit.
|
|
53
|
+
*/
|
|
54
|
+
export declare function onGlobalError(onError: (error: Error, type: "uncaughtException" | "unhandledRejection") => boolean | void): void;
|
|
55
|
+
/**
|
|
56
|
+
* Unreference a timer to prevent it from keeping the process alive
|
|
57
|
+
*/
|
|
58
|
+
export declare function unrefTimer(timerId: ReturnType<typeof dntShim.setInterval>): void;
|
|
59
|
+
/**
|
|
60
|
+
* Get the executable path of the current runtime
|
|
61
|
+
*/
|
|
62
|
+
export declare function execPath(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Get process uptime in seconds
|
|
65
|
+
* Returns OS uptime on Deno, process uptime on Node.js
|
|
66
|
+
*/
|
|
67
|
+
export declare function uptime(): number;
|
|
68
|
+
/**
|
|
69
|
+
* Get stdout stream for writing
|
|
70
|
+
* Returns null if not available (e.g., in browser/workers)
|
|
71
|
+
*/
|
|
72
|
+
export declare function getStdout(): {
|
|
73
|
+
write: (data: string) => void;
|
|
74
|
+
} | null;
|
|
75
|
+
/**
|
|
76
|
+
* Write text directly to stdout (sync)
|
|
77
|
+
* No-op if stdout is not available
|
|
78
|
+
*/
|
|
79
|
+
export declare function writeStdout(text: string): void;
|
|
80
|
+
/**
|
|
81
|
+
* Write data to stdout asynchronously
|
|
82
|
+
* Returns a promise that resolves when the write is complete
|
|
83
|
+
*/
|
|
84
|
+
export declare function writeStdoutAsync(data: Uint8Array): Promise<number>;
|
|
85
|
+
/**
|
|
86
|
+
* Synchronous prompt function that works across Deno and Bun.
|
|
87
|
+
* Displays a message and reads user input from stdin.
|
|
88
|
+
*
|
|
89
|
+
* Note: This relies on globalThis.prompt which is available in Deno and Bun.
|
|
90
|
+
* Returns null in environments where prompt is not available (e.g., Node.js ESM).
|
|
91
|
+
*/
|
|
92
|
+
export declare function promptSync(message?: string): string | null;
|
|
93
|
+
/**
|
|
94
|
+
* Read a single byte from stdin synchronously.
|
|
95
|
+
* Requires raw mode to be enabled for character-by-character reading.
|
|
96
|
+
* Returns null on EOF or if stdin is not available.
|
|
97
|
+
*/
|
|
98
|
+
export declare function readStdinByteSync(): number | null;
|
|
99
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAIrD,6EAA6E;AAC7E,wBAAgB,OAAO,IAAI,MAAM,EAAE,CAKlC;AAED,yFAAyF;AACzF,wBAAgB,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAKzC;AAED,4CAA4C;AAC5C,wBAAgB,GAAG,IAAI,MAAM,CAK5B;AAED,wBAAgB,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAW7C;AAED,wBAAgB,GAAG,IAAI,MAAM,CAK5B;AAED,wBAAgB,WAAW,IAAI;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAaA;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAKvC;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAKrC;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAqBnE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAQ1C;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,CASlC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,QAAQ,GAAG,SAAS,EAC5B,OAAO,EAAE,MAAM,IAAI,GAClB,IAAI,CAON;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,mBAAmB,GAAG,oBAAoB,KAAK,OAAO,GAAG,IAAI,GAC1F,IAAI,CAiDN;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAahF;AAED;;GAEG;AACH,wBAAgB,QAAQ,IAAI,MAAM,CAKjC;AAED;;;GAGG;AACH,wBAAgB,MAAM,IAAI,MAAM,CAW/B;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI;IAAE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GAAG,IAAI,CAWpE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAexE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG1D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAuBjD"}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
+
import { getDenoRuntime, isBun as IS_BUN, isDeno as IS_DENO } from "../runtime.js";
|
|
3
|
+
import { runtimeProcess } from "./runtime-process.js";
|
|
4
|
+
/** Get command-line arguments (cross-runtime: Deno.args or process.argv). */
|
|
5
|
+
export function getArgs() {
|
|
6
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
7
|
+
if (deno)
|
|
8
|
+
return deno.args;
|
|
9
|
+
if (runtimeProcess)
|
|
10
|
+
return runtimeProcess.argv.slice(2);
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
/** Exit the process with an optional code (cross-runtime: Deno.exit or process.exit). */
|
|
14
|
+
export function exit(code) {
|
|
15
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
16
|
+
if (deno)
|
|
17
|
+
deno.exit(code);
|
|
18
|
+
if (runtimeProcess)
|
|
19
|
+
runtimeProcess.exit(code);
|
|
20
|
+
throw new Error("exit() is not supported in this runtime");
|
|
21
|
+
}
|
|
22
|
+
/** Return the current working directory. */
|
|
23
|
+
export function cwd() {
|
|
24
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
25
|
+
if (deno)
|
|
26
|
+
return deno.cwd();
|
|
27
|
+
if (runtimeProcess)
|
|
28
|
+
return runtimeProcess.cwd();
|
|
29
|
+
throw new Error("cwd() is not supported in this runtime");
|
|
30
|
+
}
|
|
31
|
+
export function chdir(directory) {
|
|
32
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
33
|
+
if (deno) {
|
|
34
|
+
deno.chdir(directory);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (runtimeProcess) {
|
|
38
|
+
runtimeProcess.chdir(directory);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
throw new Error("chdir() is not supported in this runtime");
|
|
42
|
+
}
|
|
43
|
+
export function pid() {
|
|
44
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
45
|
+
if (deno)
|
|
46
|
+
return deno.pid;
|
|
47
|
+
if (runtimeProcess)
|
|
48
|
+
return runtimeProcess.pid;
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
export function memoryUsage() {
|
|
52
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
53
|
+
if (deno) {
|
|
54
|
+
const { rss, heapTotal, heapUsed, external } = deno.memoryUsage();
|
|
55
|
+
return { rss, heapTotal, heapUsed, external };
|
|
56
|
+
}
|
|
57
|
+
if (!runtimeProcess) {
|
|
58
|
+
throw new Error("memoryUsage() is not supported in this runtime");
|
|
59
|
+
}
|
|
60
|
+
const { rss, heapTotal, heapUsed, external } = runtimeProcess.memoryUsage();
|
|
61
|
+
return { rss, heapTotal, heapUsed, external: external || 0 };
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Check if stdin is a TTY (terminal)
|
|
65
|
+
*/
|
|
66
|
+
export function isInteractive() {
|
|
67
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
68
|
+
if (deno)
|
|
69
|
+
return deno.stdin.isTerminal();
|
|
70
|
+
if (runtimeProcess)
|
|
71
|
+
return runtimeProcess.stdin.isTTY ?? false;
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Check if stdout is a TTY (terminal)
|
|
76
|
+
*/
|
|
77
|
+
export function isStdoutTTY() {
|
|
78
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
79
|
+
if (deno)
|
|
80
|
+
return deno.stdout.isTerminal();
|
|
81
|
+
if (runtimeProcess)
|
|
82
|
+
return runtimeProcess.stdout.isTTY ?? false;
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get terminal size (columns and rows)
|
|
87
|
+
* Returns default fallback values if terminal size cannot be determined
|
|
88
|
+
*/
|
|
89
|
+
export function getTerminalSize() {
|
|
90
|
+
const defaultSize = { columns: 80, rows: 24 };
|
|
91
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
92
|
+
if (deno) {
|
|
93
|
+
try {
|
|
94
|
+
const { columns, rows } = deno.consoleSize();
|
|
95
|
+
return { columns, rows };
|
|
96
|
+
}
|
|
97
|
+
catch (_) {
|
|
98
|
+
/* expected: Deno.consoleSize() fails when not attached to a terminal */
|
|
99
|
+
return defaultSize;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (!runtimeProcess)
|
|
103
|
+
return defaultSize;
|
|
104
|
+
const columns = runtimeProcess.stdout?.columns;
|
|
105
|
+
const rows = runtimeProcess.stdout?.rows;
|
|
106
|
+
if (columns && rows)
|
|
107
|
+
return { columns, rows };
|
|
108
|
+
return defaultSize;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get runtime version string
|
|
112
|
+
*/
|
|
113
|
+
export function getRuntimeVersion() {
|
|
114
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
115
|
+
if (deno)
|
|
116
|
+
return `Deno ${deno.version.deno}`;
|
|
117
|
+
if ("Bun" in dntShim.dntGlobalThis) {
|
|
118
|
+
return `Bun ${dntShim.dntGlobalThis.Bun.version}`;
|
|
119
|
+
}
|
|
120
|
+
if (runtimeProcess)
|
|
121
|
+
return `Node.js ${runtimeProcess.version}`;
|
|
122
|
+
return "unknown";
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get the operating system type
|
|
126
|
+
* Returns: "darwin" (macOS), "linux", "windows", or the raw platform string
|
|
127
|
+
*/
|
|
128
|
+
export function getOsType() {
|
|
129
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
130
|
+
if (deno)
|
|
131
|
+
return deno.build.os;
|
|
132
|
+
if (runtimeProcess) {
|
|
133
|
+
// Node/Bun uses process.platform which returns "win32" for Windows
|
|
134
|
+
const platform = runtimeProcess.platform;
|
|
135
|
+
return platform === "win32" ? "windows" : platform;
|
|
136
|
+
}
|
|
137
|
+
return "unknown";
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Register a signal handler (SIGINT, SIGTERM) for graceful shutdown
|
|
141
|
+
*/
|
|
142
|
+
export function onSignal(signal, handler) {
|
|
143
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
144
|
+
if (deno) {
|
|
145
|
+
deno.addSignalListener(signal, handler);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (runtimeProcess)
|
|
149
|
+
runtimeProcess.on(signal, handler);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Register global error handlers for uncaught exceptions and unhandled promise rejections.
|
|
153
|
+
* These handlers prevent the process from crashing due to application code errors.
|
|
154
|
+
*
|
|
155
|
+
* IMPORTANT: These handlers should be registered early in the application lifecycle
|
|
156
|
+
* to catch errors that escape try/catch blocks.
|
|
157
|
+
*
|
|
158
|
+
* @param onError - Callback invoked with the error. Return true to prevent process exit.
|
|
159
|
+
*/
|
|
160
|
+
export function onGlobalError(onError) {
|
|
161
|
+
if (IS_DENO) {
|
|
162
|
+
// Intentionally permanent: process-level handlers must persist for the entire runtime
|
|
163
|
+
globalThis.addEventListener("error", (event) => {
|
|
164
|
+
const error = event.error instanceof Error ? event.error : new Error(String(event.error));
|
|
165
|
+
if (onError(error, "uncaughtException"))
|
|
166
|
+
event.preventDefault();
|
|
167
|
+
});
|
|
168
|
+
globalThis.addEventListener("unhandledrejection", (event) => {
|
|
169
|
+
const error = event.reason instanceof Error ? event.reason : new Error(String(event.reason));
|
|
170
|
+
if (onError(error, "unhandledRejection"))
|
|
171
|
+
event.preventDefault();
|
|
172
|
+
});
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (!runtimeProcess)
|
|
176
|
+
return;
|
|
177
|
+
const process = runtimeProcess;
|
|
178
|
+
const handleNodeGlobalError = (error, type) => {
|
|
179
|
+
let shouldPreventExit = false;
|
|
180
|
+
try {
|
|
181
|
+
shouldPreventExit = onError(error, type) === true;
|
|
182
|
+
}
|
|
183
|
+
catch (handlerError) {
|
|
184
|
+
const handlerException = handlerError instanceof Error
|
|
185
|
+
? handlerError
|
|
186
|
+
: new Error(String(handlerError));
|
|
187
|
+
console.error("Global error handler threw while processing", type, handlerException);
|
|
188
|
+
}
|
|
189
|
+
if (shouldPreventExit)
|
|
190
|
+
return;
|
|
191
|
+
// Node/Bun suppress default fatal behavior when a listener is registered.
|
|
192
|
+
// If the callback did not explicitly handle the error, exit to preserve
|
|
193
|
+
// expected fatal semantics for uncaught exceptions and unhandled rejections.
|
|
194
|
+
process.exit(1);
|
|
195
|
+
};
|
|
196
|
+
runtimeProcess.on("uncaughtException", (error) => {
|
|
197
|
+
handleNodeGlobalError(error, "uncaughtException");
|
|
198
|
+
});
|
|
199
|
+
runtimeProcess.on("unhandledRejection", (reason) => {
|
|
200
|
+
const error = reason instanceof Error ? reason : new Error(String(reason));
|
|
201
|
+
handleNodeGlobalError(error, "unhandledRejection");
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Unreference a timer to prevent it from keeping the process alive
|
|
206
|
+
*/
|
|
207
|
+
export function unrefTimer(timerId) {
|
|
208
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
209
|
+
if (deno && typeof deno.unrefTimer === "function" && typeof timerId === "number") {
|
|
210
|
+
deno.unrefTimer(timerId);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (timerId && typeof timerId === "object") {
|
|
214
|
+
const unref = timerId.unref;
|
|
215
|
+
if (typeof unref === "function") {
|
|
216
|
+
unref.call(timerId);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Get the executable path of the current runtime
|
|
222
|
+
*/
|
|
223
|
+
export function execPath() {
|
|
224
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
225
|
+
if (deno)
|
|
226
|
+
return deno.execPath();
|
|
227
|
+
if (runtimeProcess)
|
|
228
|
+
return runtimeProcess.execPath;
|
|
229
|
+
return "";
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Get process uptime in seconds
|
|
233
|
+
* Returns OS uptime on Deno, process uptime on Node.js
|
|
234
|
+
*/
|
|
235
|
+
export function uptime() {
|
|
236
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
237
|
+
if (deno) {
|
|
238
|
+
// Deno.osUptime() returns system uptime in seconds
|
|
239
|
+
return deno.osUptime?.() ?? 0;
|
|
240
|
+
}
|
|
241
|
+
if (runtimeProcess) {
|
|
242
|
+
// process.uptime() returns process uptime in seconds
|
|
243
|
+
return runtimeProcess.uptime?.() ?? 0;
|
|
244
|
+
}
|
|
245
|
+
return 0;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get stdout stream for writing
|
|
249
|
+
* Returns null if not available (e.g., in browser/workers)
|
|
250
|
+
*/
|
|
251
|
+
export function getStdout() {
|
|
252
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
253
|
+
if (deno) {
|
|
254
|
+
const encoder = new TextEncoder();
|
|
255
|
+
return { write: (data) => deno.stdout.writeSync(encoder.encode(data)) };
|
|
256
|
+
}
|
|
257
|
+
const stdout = runtimeProcess?.stdout;
|
|
258
|
+
if (stdout) {
|
|
259
|
+
return { write: (data) => stdout.write(data) };
|
|
260
|
+
}
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Write text directly to stdout (sync)
|
|
265
|
+
* No-op if stdout is not available
|
|
266
|
+
*/
|
|
267
|
+
export function writeStdout(text) {
|
|
268
|
+
getStdout()?.write(text);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Write data to stdout asynchronously
|
|
272
|
+
* Returns a promise that resolves when the write is complete
|
|
273
|
+
*/
|
|
274
|
+
export async function writeStdoutAsync(data) {
|
|
275
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
276
|
+
if (deno)
|
|
277
|
+
return await deno.stdout.write(data);
|
|
278
|
+
const stdout = runtimeProcess?.stdout;
|
|
279
|
+
if (stdout) {
|
|
280
|
+
return await new Promise((resolve, reject) => {
|
|
281
|
+
stdout.write(data, (error) => {
|
|
282
|
+
if (error)
|
|
283
|
+
reject(error);
|
|
284
|
+
else
|
|
285
|
+
resolve(data.length);
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
return 0;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Synchronous prompt function that works across Deno and Bun.
|
|
293
|
+
* Displays a message and reads user input from stdin.
|
|
294
|
+
*
|
|
295
|
+
* Note: This relies on globalThis.prompt which is available in Deno and Bun.
|
|
296
|
+
* Returns null in environments where prompt is not available (e.g., Node.js ESM).
|
|
297
|
+
*/
|
|
298
|
+
export function promptSync(message) {
|
|
299
|
+
if (typeof globalThis.prompt !== "function")
|
|
300
|
+
return null;
|
|
301
|
+
return globalThis.prompt(message ?? "") ?? null;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Read a single byte from stdin synchronously.
|
|
305
|
+
* Requires raw mode to be enabled for character-by-character reading.
|
|
306
|
+
* Returns null on EOF or if stdin is not available.
|
|
307
|
+
*/
|
|
308
|
+
export function readStdinByteSync() {
|
|
309
|
+
const buf = new Uint8Array(1);
|
|
310
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
311
|
+
if (deno) {
|
|
312
|
+
const n = deno.stdin.readSync(buf);
|
|
313
|
+
return n ? buf[0] ?? null : null;
|
|
314
|
+
}
|
|
315
|
+
if (IS_BUN) {
|
|
316
|
+
// Bun: read one byte from the file descriptor directly
|
|
317
|
+
const BunGlobal = dntShim.dntGlobalThis
|
|
318
|
+
.Bun;
|
|
319
|
+
const chunk = BunGlobal?.stdin?.read?.(1);
|
|
320
|
+
if (chunk && chunk.length > 0) {
|
|
321
|
+
const first = chunk.at(0);
|
|
322
|
+
return first ?? null;
|
|
323
|
+
}
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type RuntimeProcess = typeof import("node:process");
|
|
2
|
+
/**
|
|
3
|
+
* Detect a real Node/Bun process object.
|
|
4
|
+
* Browser bundles may inject `window.process = { env: {} }`, which is not enough
|
|
5
|
+
* to safely call process APIs like cwd(), exit(), or on().
|
|
6
|
+
*/
|
|
7
|
+
export declare function testHasRuntimeProcess(processLike: unknown): processLike is RuntimeProcess;
|
|
8
|
+
export declare const runtimeProcess: RuntimeProcess | null;
|
|
9
|
+
export declare function isWindowsPlatform(): boolean;
|
|
10
|
+
//# sourceMappingURL=runtime-process.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-process.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/runtime-process.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG,cAAc,cAAc,CAAC,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,OAAO,GAAG,WAAW,IAAI,cAAc,CAIzF;AAED,eAAO,MAAM,cAAc,EAAE,cAAc,GAAG,IAEtC,CAAC;AAET,wBAAgB,iBAAiB,IAAI,OAAO,CAM3C"}
|