@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,56 @@
|
|
|
1
|
+
import { isDeno, nodePath } from "./runtime.js";
|
|
2
|
+
function hasWindowsLikePath(path) {
|
|
3
|
+
return path.includes("\\") || /^[A-Za-z]:/.test(path) || path.startsWith("\\\\");
|
|
4
|
+
}
|
|
5
|
+
/** Normalize backslashes to forward slashes (for Deno on Windows). */
|
|
6
|
+
function normSep(p) {
|
|
7
|
+
return p.includes("\\") ? p.replace(/\\/g, "/") : p;
|
|
8
|
+
}
|
|
9
|
+
/** Join path segments. */
|
|
10
|
+
export function join(...paths) {
|
|
11
|
+
const joined = paths
|
|
12
|
+
.map(normSep)
|
|
13
|
+
.filter((p) => p.length > 0)
|
|
14
|
+
.join("/")
|
|
15
|
+
.replace(/\/+/g, "/")
|
|
16
|
+
.replace(/\/$/, "");
|
|
17
|
+
return joined || "/";
|
|
18
|
+
}
|
|
19
|
+
/** Return the parent directory path. */
|
|
20
|
+
export function dirname(path) {
|
|
21
|
+
if (!isDeno && nodePath && !hasWindowsLikePath(path))
|
|
22
|
+
return nodePath.dirname(path);
|
|
23
|
+
const p = normSep(path);
|
|
24
|
+
const lastSlash = p.lastIndexOf("/");
|
|
25
|
+
if (lastSlash === -1)
|
|
26
|
+
return ".";
|
|
27
|
+
if (lastSlash === 0)
|
|
28
|
+
return "/";
|
|
29
|
+
return p.slice(0, lastSlash);
|
|
30
|
+
}
|
|
31
|
+
/** Return the last path segment. */
|
|
32
|
+
export function basename(path, ext) {
|
|
33
|
+
if (!isDeno && nodePath && !hasWindowsLikePath(path)) {
|
|
34
|
+
// Only pass ext if defined - Bun is strict about this parameter
|
|
35
|
+
return ext === undefined ? nodePath.basename(path) : nodePath.basename(path, ext);
|
|
36
|
+
}
|
|
37
|
+
let normalizedPath = normSep(path);
|
|
38
|
+
while (normalizedPath.length > 1 && normalizedPath.endsWith("/")) {
|
|
39
|
+
normalizedPath = normalizedPath.slice(0, -1);
|
|
40
|
+
}
|
|
41
|
+
const lastSlash = normalizedPath.lastIndexOf("/");
|
|
42
|
+
let base = lastSlash === -1 ? normalizedPath : normalizedPath.slice(lastSlash + 1);
|
|
43
|
+
if (ext && base.endsWith(ext))
|
|
44
|
+
base = base.slice(0, -ext.length);
|
|
45
|
+
return base;
|
|
46
|
+
}
|
|
47
|
+
/** Return the file extension for a path. */
|
|
48
|
+
export function extname(path) {
|
|
49
|
+
if (!isDeno && nodePath && !hasWindowsLikePath(path))
|
|
50
|
+
return nodePath.extname(path);
|
|
51
|
+
const base = basename(path);
|
|
52
|
+
const lastDot = base.lastIndexOf(".");
|
|
53
|
+
if (lastDot <= 0)
|
|
54
|
+
return "";
|
|
55
|
+
return base.slice(lastDot);
|
|
56
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compat - Path
|
|
3
|
+
*
|
|
4
|
+
* @module platform/compat/path
|
|
5
|
+
*/
|
|
6
|
+
export type { NodePathModule, PathObject } from "./types.js";
|
|
7
|
+
export { delimiter, hasNodePath, isDeno, nodePath, sep, sep as SEPARATOR } from "./runtime.js";
|
|
8
|
+
export { basename, dirname, extname, join } from "./basic-operations.js";
|
|
9
|
+
export { isAbsolute, normalize, relative, resolve } from "./resolution.js";
|
|
10
|
+
export { format, parse } from "./parse-format.js";
|
|
11
|
+
export { fromFileUrl, toFileUrl } from "./url-conversion.js";
|
|
12
|
+
export { validatePathSecurity } from "./security.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/F,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compat - Path
|
|
3
|
+
*
|
|
4
|
+
* @module platform/compat/path
|
|
5
|
+
*/
|
|
6
|
+
export { delimiter, hasNodePath, isDeno, nodePath, sep, sep as SEPARATOR } from "./runtime.js";
|
|
7
|
+
export { basename, dirname, extname, join } from "./basic-operations.js";
|
|
8
|
+
export { isAbsolute, normalize, relative, resolve } from "./resolution.js";
|
|
9
|
+
export { format, parse } from "./parse-format.js";
|
|
10
|
+
export { fromFileUrl, toFileUrl } from "./url-conversion.js";
|
|
11
|
+
export { validatePathSecurity } from "./security.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-format.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/parse-format.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAgB9C;AAED,wBAAgB,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CASrD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isDeno, nodePath } from "./runtime.js";
|
|
2
|
+
import { basename, dirname, extname, join } from "./basic-operations.js";
|
|
3
|
+
import { isAbsolute } from "./resolution.js";
|
|
4
|
+
export function parse(path) {
|
|
5
|
+
if (!isDeno && nodePath) {
|
|
6
|
+
return nodePath.parse(path);
|
|
7
|
+
}
|
|
8
|
+
const dir = dirname(path);
|
|
9
|
+
const base = basename(path);
|
|
10
|
+
const ext = extname(path);
|
|
11
|
+
return {
|
|
12
|
+
root: isAbsolute(path) ? "/" : "",
|
|
13
|
+
dir,
|
|
14
|
+
base,
|
|
15
|
+
ext,
|
|
16
|
+
name: base.slice(0, base.length - ext.length),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function format(pathObject) {
|
|
20
|
+
if (!isDeno && nodePath) {
|
|
21
|
+
return nodePath.format(pathObject);
|
|
22
|
+
}
|
|
23
|
+
const { dir = "", base = "", name = "", ext = "" } = pathObject;
|
|
24
|
+
const fileName = base || name + ext;
|
|
25
|
+
return dir ? join(dir, fileName) : fileName;
|
|
26
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Resolve path segments to an absolute path. */
|
|
2
|
+
export declare function resolve(...paths: string[]): string;
|
|
3
|
+
export declare function isAbsolute(path: string): boolean;
|
|
4
|
+
export declare function relative(from: string, to: string): string;
|
|
5
|
+
export declare function normalize(path: string): string;
|
|
6
|
+
//# sourceMappingURL=resolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolution.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/resolution.ts"],"names":[],"mappings":"AAeA,iDAAiD;AACjD,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAqClD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMhD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CA8BzD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAyC9C"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
+
import { isDeno, nodePath } from "./runtime.js";
|
|
3
|
+
function hasWindowsLikePath(path) {
|
|
4
|
+
return path.includes("\\") || /^[A-Za-z]:/.test(path) || path.startsWith("\\\\");
|
|
5
|
+
}
|
|
6
|
+
/** Normalize backslashes to forward slashes (for Deno on Windows). */
|
|
7
|
+
function normSep(p) {
|
|
8
|
+
return p.includes("\\") ? p.replace(/\\/g, "/") : p;
|
|
9
|
+
}
|
|
10
|
+
/** Match Windows drive letter prefix like "C:/" */
|
|
11
|
+
const DRIVE_LETTER = /^[A-Za-z]:\//;
|
|
12
|
+
/** Resolve path segments to an absolute path. */
|
|
13
|
+
export function resolve(...paths) {
|
|
14
|
+
if (!isDeno && nodePath && !paths.some(hasWindowsLikePath))
|
|
15
|
+
return nodePath.resolve(...paths);
|
|
16
|
+
let resolvedPath = normSep(dntShim.dntGlobalThis.Deno?.cwd?.() ?? "/");
|
|
17
|
+
for (const rawPath of paths) {
|
|
18
|
+
if (!rawPath)
|
|
19
|
+
continue;
|
|
20
|
+
const path = normSep(rawPath);
|
|
21
|
+
if (path.startsWith("/") || DRIVE_LETTER.test(path)) {
|
|
22
|
+
resolvedPath = path;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
resolvedPath = `${resolvedPath}/${path}`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Preserve drive letter prefix (e.g. "D:/") if present
|
|
29
|
+
let prefix = "/";
|
|
30
|
+
const driveMatch = resolvedPath.match(DRIVE_LETTER);
|
|
31
|
+
if (driveMatch) {
|
|
32
|
+
prefix = driveMatch[0]; // e.g. "D:/"
|
|
33
|
+
resolvedPath = resolvedPath.slice(prefix.length);
|
|
34
|
+
}
|
|
35
|
+
else if (resolvedPath.startsWith("/")) {
|
|
36
|
+
resolvedPath = resolvedPath.slice(1);
|
|
37
|
+
}
|
|
38
|
+
const parts = resolvedPath.split("/").filter(Boolean);
|
|
39
|
+
const resolved = [];
|
|
40
|
+
for (const part of parts) {
|
|
41
|
+
if (part === "..") {
|
|
42
|
+
resolved.pop();
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (part !== ".")
|
|
46
|
+
resolved.push(part);
|
|
47
|
+
}
|
|
48
|
+
return `${prefix}${resolved.join("/")}`;
|
|
49
|
+
}
|
|
50
|
+
export function isAbsolute(path) {
|
|
51
|
+
if (!isDeno && nodePath && !hasWindowsLikePath(path) && nodePath.isAbsolute(path))
|
|
52
|
+
return true;
|
|
53
|
+
// Cross-platform fallback: Unix, Windows drive letters, and UNC paths
|
|
54
|
+
if (path.startsWith("/"))
|
|
55
|
+
return true;
|
|
56
|
+
if (/^[A-Za-z]:[/\\]/.test(path))
|
|
57
|
+
return true;
|
|
58
|
+
return /^\\\\[^\\]+\\[^\\]+/.test(path);
|
|
59
|
+
}
|
|
60
|
+
export function relative(from, to) {
|
|
61
|
+
if (!isDeno && nodePath && !hasWindowsLikePath(from) && !hasWindowsLikePath(to)) {
|
|
62
|
+
const relativePath = nodePath.relative(from, to);
|
|
63
|
+
return relativePath || ".";
|
|
64
|
+
}
|
|
65
|
+
const resolvedFrom = resolve(from);
|
|
66
|
+
const resolvedTo = resolve(to);
|
|
67
|
+
// Strip drive prefix for comparison (both will share the same drive after resolve)
|
|
68
|
+
const fromDrive = resolvedFrom.match(DRIVE_LETTER);
|
|
69
|
+
const fromBase = fromDrive ? resolvedFrom.slice(fromDrive[0].length) : resolvedFrom.slice(1);
|
|
70
|
+
const toDrive = resolvedTo.match(DRIVE_LETTER);
|
|
71
|
+
const toBase = toDrive ? resolvedTo.slice(toDrive[0].length) : resolvedTo.slice(1);
|
|
72
|
+
const fromParts = fromBase.split("/").filter(Boolean);
|
|
73
|
+
const toParts = toBase.split("/").filter(Boolean);
|
|
74
|
+
let common = 0;
|
|
75
|
+
const minLen = Math.min(fromParts.length, toParts.length);
|
|
76
|
+
for (let i = 0; i < minLen; i++) {
|
|
77
|
+
if (fromParts[i] !== toParts[i])
|
|
78
|
+
break;
|
|
79
|
+
common++;
|
|
80
|
+
}
|
|
81
|
+
const ups = fromParts.length - common;
|
|
82
|
+
const result = [...new Array(ups).fill(".."), ...toParts.slice(common)];
|
|
83
|
+
return result.join("/") || ".";
|
|
84
|
+
}
|
|
85
|
+
export function normalize(path) {
|
|
86
|
+
if (!isDeno && nodePath && !hasWindowsLikePath(path))
|
|
87
|
+
return nodePath.normalize(path);
|
|
88
|
+
if (path === "")
|
|
89
|
+
return ".";
|
|
90
|
+
const p = normSep(path);
|
|
91
|
+
const abs = isAbsolute(p);
|
|
92
|
+
// Preserve drive letter prefix
|
|
93
|
+
let prefix = "";
|
|
94
|
+
const driveMatch = p.match(DRIVE_LETTER);
|
|
95
|
+
if (driveMatch) {
|
|
96
|
+
prefix = driveMatch[0];
|
|
97
|
+
}
|
|
98
|
+
else if (abs) {
|
|
99
|
+
prefix = "/";
|
|
100
|
+
}
|
|
101
|
+
const pathWithoutPrefix = driveMatch ? p.slice(prefix.length) : abs ? p.slice(1) : p;
|
|
102
|
+
const parts = pathWithoutPrefix.split("/").filter((s) => s && s !== ".");
|
|
103
|
+
const normalized = [];
|
|
104
|
+
for (const part of parts) {
|
|
105
|
+
if (part !== "..") {
|
|
106
|
+
normalized.push(part);
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const last = normalized[normalized.length - 1];
|
|
110
|
+
if (normalized.length > 0 && last !== "..") {
|
|
111
|
+
normalized.pop();
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (!abs)
|
|
115
|
+
normalized.push("..");
|
|
116
|
+
}
|
|
117
|
+
const result = normalized.join("/");
|
|
118
|
+
if (abs)
|
|
119
|
+
return result ? `${prefix}${result}` : prefix || "/";
|
|
120
|
+
return result || ".";
|
|
121
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NodePathModule } from "./types.js";
|
|
2
|
+
export declare const isDeno: boolean;
|
|
3
|
+
declare let nodePath: NodePathModule | null;
|
|
4
|
+
export { nodePath };
|
|
5
|
+
export declare const sep: string;
|
|
6
|
+
export declare const delimiter: string;
|
|
7
|
+
export declare const hasNodePath: boolean;
|
|
8
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAKjD,eAAO,MAAM,MAAM,SAAsC,CAAC;AAE1D,QAAA,IAAI,QAAQ,EAAE,cAAc,GAAG,IAAW,CAAC;AAa3C,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB,eAAO,MAAM,GAAG,QAAuB,CAAC;AACxC,eAAO,MAAM,SAAS,QAA6B,CAAC;AACpD,eAAO,MAAM,WAAW,SAAoB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
+
const globalProcess = dntShim.dntGlobalThis.process;
|
|
3
|
+
const hasNodeApis = !!globalProcess?.versions?.node || "Bun" in dntShim.dntGlobalThis;
|
|
4
|
+
export const isDeno = typeof dntShim.Deno !== "undefined";
|
|
5
|
+
let nodePath = null;
|
|
6
|
+
if (hasNodeApis) {
|
|
7
|
+
try {
|
|
8
|
+
const nodeRequire = typeof require !== "undefined" ? require : null;
|
|
9
|
+
if (nodeRequire) {
|
|
10
|
+
nodePath = nodeRequire("node:path");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
catch (_) {
|
|
14
|
+
/* expected: node:path require may fail in non-Node runtimes */
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export { nodePath };
|
|
18
|
+
export const sep = nodePath?.sep ?? "/";
|
|
19
|
+
export const delimiter = nodePath?.delimiter ?? ":";
|
|
20
|
+
export const hasNodePath = nodePath !== null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/security.ts"],"names":[],"mappings":"AAMA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAsB1D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FORBIDDEN_PATH_PATTERNS, MAX_PATH_LENGTH, MAX_PATH_TRAVERSAL_DEPTH, } from "../../../utils/constants/security.js";
|
|
2
|
+
export function validatePathSecurity(path) {
|
|
3
|
+
if (path == null)
|
|
4
|
+
return false;
|
|
5
|
+
if (path.length > MAX_PATH_LENGTH)
|
|
6
|
+
return false;
|
|
7
|
+
for (const pattern of FORBIDDEN_PATH_PATTERNS) {
|
|
8
|
+
if (pattern.test(path))
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
const parts = path.split(/[\/\\]/);
|
|
12
|
+
let depth = 0;
|
|
13
|
+
for (const part of parts) {
|
|
14
|
+
if (part === "..") {
|
|
15
|
+
depth++;
|
|
16
|
+
}
|
|
17
|
+
else if (part !== "." && part !== "") {
|
|
18
|
+
depth = 0;
|
|
19
|
+
}
|
|
20
|
+
if (depth > MAX_PATH_TRAVERSAL_DEPTH)
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface PathObject {
|
|
2
|
+
root?: string;
|
|
3
|
+
dir?: string;
|
|
4
|
+
base?: string;
|
|
5
|
+
ext?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface NodePathModule {
|
|
9
|
+
sep: string;
|
|
10
|
+
delimiter: string;
|
|
11
|
+
join(...paths: string[]): string;
|
|
12
|
+
resolve(...paths: string[]): string;
|
|
13
|
+
dirname(path: string): string;
|
|
14
|
+
basename(path: string, ext?: string): string;
|
|
15
|
+
extname(path: string): string;
|
|
16
|
+
isAbsolute(path: string): boolean;
|
|
17
|
+
relative(from: string, to: string): string;
|
|
18
|
+
normalize(path: string): string;
|
|
19
|
+
parse(path: string): PathObject;
|
|
20
|
+
format(pathObject: PathObject): string;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IACjC,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IACpC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7C,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3C,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAChC,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC;CACxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-conversion.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/path/url-conversion.ts"],"names":[],"mappings":"AA6BA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAuBrD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAG3C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
+
import { hasNodePath, isDeno } from "./runtime.js";
|
|
3
|
+
import { isAbsolute, resolve } from "./resolution.js";
|
|
4
|
+
let _fileURLToPath = null;
|
|
5
|
+
function getFileURLToPath() {
|
|
6
|
+
if (_fileURLToPath)
|
|
7
|
+
return _fileURLToPath;
|
|
8
|
+
if (!hasNodePath)
|
|
9
|
+
return null;
|
|
10
|
+
try {
|
|
11
|
+
const nodeUrl = dntShim.dntGlobalThis.require?.("node:url");
|
|
12
|
+
const fileURLToPath = nodeUrl?.fileURLToPath;
|
|
13
|
+
if (!fileURLToPath)
|
|
14
|
+
return null;
|
|
15
|
+
_fileURLToPath = fileURLToPath;
|
|
16
|
+
return _fileURLToPath;
|
|
17
|
+
}
|
|
18
|
+
catch (_) {
|
|
19
|
+
/* expected: node:url require may fail in non-Node runtimes */
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function fromFileUrl(url) {
|
|
24
|
+
const fileURLToPath = getFileURLToPath();
|
|
25
|
+
if (fileURLToPath)
|
|
26
|
+
return fileURLToPath(url);
|
|
27
|
+
const urlString = typeof url === "string" ? url : url.toString();
|
|
28
|
+
if (isDeno) {
|
|
29
|
+
const g = dntShim.dntGlobalThis;
|
|
30
|
+
const hasCwd = Boolean(g.Deno?.cwd);
|
|
31
|
+
const isWindows = g.Deno?.build?.os === "windows";
|
|
32
|
+
if (hasCwd && isWindows) {
|
|
33
|
+
return decodeURIComponent(urlString.slice(8).replace(/\//g, "\\"));
|
|
34
|
+
}
|
|
35
|
+
return decodeURIComponent(urlString.slice(7));
|
|
36
|
+
}
|
|
37
|
+
if (!urlString.startsWith("file://")) {
|
|
38
|
+
throw new TypeError("Must be a file URL");
|
|
39
|
+
}
|
|
40
|
+
return decodeURIComponent(urlString.slice(7));
|
|
41
|
+
}
|
|
42
|
+
export function toFileUrl(path) {
|
|
43
|
+
const absolute = hasNodePath ? path : isAbsolute(path) ? path : resolve(path);
|
|
44
|
+
return new URL(`file://${absolute}`);
|
|
45
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface CommandResult {
|
|
2
|
+
success: boolean;
|
|
3
|
+
code: number;
|
|
4
|
+
stdout?: string;
|
|
5
|
+
stderr?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CommandOptions {
|
|
8
|
+
args?: string[];
|
|
9
|
+
cwd?: string;
|
|
10
|
+
env?: Record<string, string>;
|
|
11
|
+
/** Capture stdout/stderr to return in result */
|
|
12
|
+
capture?: boolean;
|
|
13
|
+
/** Inherit stdio from parent process (shows output in terminal) */
|
|
14
|
+
inherit?: boolean;
|
|
15
|
+
/** Use shell to run the command (needed for .cmd files on Windows) */
|
|
16
|
+
shell?: boolean;
|
|
17
|
+
/** Kill the command if it exceeds this duration (milliseconds) */
|
|
18
|
+
timeoutMs?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Run a command and return the result.
|
|
22
|
+
* Works across Deno, Node.js, and Bun.
|
|
23
|
+
*
|
|
24
|
+
* @param cmd - Command to run
|
|
25
|
+
* @param options - Command options
|
|
26
|
+
* @param options.capture - Capture stdout/stderr to return in result
|
|
27
|
+
* @param options.inherit - Inherit stdio from parent (shows output in terminal)
|
|
28
|
+
* @param options.shell - Use shell to run command (needed for .cmd on Windows)
|
|
29
|
+
*/
|
|
30
|
+
export declare function runCommand(cmd: string, options?: CommandOptions): Promise<CommandResult>;
|
|
31
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/command.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sEAAsE;IACtE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6ED;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC,CAuLxB"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
+
import { dynamicImport } from "../dynamic-import.js";
|
|
3
|
+
import { getDenoRuntime, isBun as IS_BUN, isDeno as IS_DENO } from "../runtime.js";
|
|
4
|
+
import { isWindowsPlatform, runtimeProcess } from "./runtime-process.js";
|
|
5
|
+
const COMMAND_TIMEOUT_EXIT_CODE = 124;
|
|
6
|
+
const FORCE_KILL_GRACE_MS = 250;
|
|
7
|
+
function createTimeoutResult(timeoutMs, stdout, stderr) {
|
|
8
|
+
return {
|
|
9
|
+
success: false,
|
|
10
|
+
code: COMMAND_TIMEOUT_EXIT_CODE,
|
|
11
|
+
stdout,
|
|
12
|
+
stderr: `${stderr ?? ""}\nCommand timed out after ${timeoutMs}ms`.trim(),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function createProcessTimeout(timeoutMs, terminate, forceTerminate) {
|
|
16
|
+
let timedOut = false;
|
|
17
|
+
let timeoutId;
|
|
18
|
+
let forceKillId;
|
|
19
|
+
if (timeoutMs && timeoutMs > 0) {
|
|
20
|
+
timeoutId = dntShim.setTimeout(() => {
|
|
21
|
+
timedOut = true;
|
|
22
|
+
try {
|
|
23
|
+
terminate();
|
|
24
|
+
}
|
|
25
|
+
catch (_) {
|
|
26
|
+
/* expected: best-effort terminate may fail if process already exited */
|
|
27
|
+
}
|
|
28
|
+
forceKillId = dntShim.setTimeout(() => {
|
|
29
|
+
try {
|
|
30
|
+
forceTerminate();
|
|
31
|
+
}
|
|
32
|
+
catch (_) {
|
|
33
|
+
/* expected: best-effort force terminate may fail if process already exited */
|
|
34
|
+
}
|
|
35
|
+
}, FORCE_KILL_GRACE_MS);
|
|
36
|
+
}, timeoutMs);
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
hasTimedOut: () => timedOut,
|
|
40
|
+
clear: () => {
|
|
41
|
+
if (timeoutId)
|
|
42
|
+
clearTimeout(timeoutId);
|
|
43
|
+
if (forceKillId)
|
|
44
|
+
clearTimeout(forceKillId);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
async function readStreamToString(stream) {
|
|
49
|
+
const reader = stream.getReader();
|
|
50
|
+
const chunks = [];
|
|
51
|
+
while (true) {
|
|
52
|
+
const { done, value } = await reader.read();
|
|
53
|
+
if (done)
|
|
54
|
+
break;
|
|
55
|
+
if (value)
|
|
56
|
+
chunks.push(value);
|
|
57
|
+
}
|
|
58
|
+
const total = chunks.reduce((acc, c) => acc + c.length, 0);
|
|
59
|
+
const merged = new Uint8Array(total);
|
|
60
|
+
let offset = 0;
|
|
61
|
+
for (const chunk of chunks) {
|
|
62
|
+
merged.set(chunk, offset);
|
|
63
|
+
offset += chunk.length;
|
|
64
|
+
}
|
|
65
|
+
return new TextDecoder().decode(merged);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Run a command and return the result.
|
|
69
|
+
* Works across Deno, Node.js, and Bun.
|
|
70
|
+
*
|
|
71
|
+
* @param cmd - Command to run
|
|
72
|
+
* @param options - Command options
|
|
73
|
+
* @param options.capture - Capture stdout/stderr to return in result
|
|
74
|
+
* @param options.inherit - Inherit stdio from parent (shows output in terminal)
|
|
75
|
+
* @param options.shell - Use shell to run command (needed for .cmd on Windows)
|
|
76
|
+
*/
|
|
77
|
+
export async function runCommand(cmd, options = {}) {
|
|
78
|
+
const { args = [], cwd: cmdCwd, env: cmdEnv, capture = false, inherit = false, shell = false, timeoutMs, } = options;
|
|
79
|
+
const effectiveTimeoutMs = timeoutMs && timeoutMs > 0 ? Math.floor(timeoutMs) : undefined;
|
|
80
|
+
// Determine stdio mode: inherit > capture > null
|
|
81
|
+
const stdioMode = inherit ? "inherit" : capture ? "piped" : "null";
|
|
82
|
+
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
83
|
+
if (deno) {
|
|
84
|
+
const command = new deno.Command(cmd, {
|
|
85
|
+
args,
|
|
86
|
+
cwd: cmdCwd,
|
|
87
|
+
env: cmdEnv,
|
|
88
|
+
stdin: inherit ? "inherit" : "null",
|
|
89
|
+
stdout: stdioMode,
|
|
90
|
+
stderr: stdioMode,
|
|
91
|
+
});
|
|
92
|
+
const child = command.spawn();
|
|
93
|
+
const timeout = createProcessTimeout(effectiveTimeoutMs, () => child.kill("SIGTERM"), () => child.kill("SIGKILL"));
|
|
94
|
+
try {
|
|
95
|
+
const [status, stdout, stderr] = await Promise.all([
|
|
96
|
+
child.status,
|
|
97
|
+
capture && child.stdout ? readStreamToString(child.stdout) : Promise.resolve(undefined),
|
|
98
|
+
capture && child.stderr ? readStreamToString(child.stderr) : Promise.resolve(undefined),
|
|
99
|
+
]);
|
|
100
|
+
if (timeout.hasTimedOut()) {
|
|
101
|
+
return createTimeoutResult(effectiveTimeoutMs ?? 0, stdout, stderr);
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
success: status.success,
|
|
105
|
+
code: status.code,
|
|
106
|
+
stdout,
|
|
107
|
+
stderr,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
timeout.clear();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (IS_BUN) {
|
|
115
|
+
const bunGlobal = dntShim.dntGlobalThis;
|
|
116
|
+
const bunStdio = inherit ? "inherit" : capture ? "pipe" : "ignore";
|
|
117
|
+
const isWindows = isWindowsPlatform();
|
|
118
|
+
const bunCmd = shell
|
|
119
|
+
? args.length === 0
|
|
120
|
+
? isWindows ? ["cmd", "/c", cmd] : ["sh", "-c", cmd]
|
|
121
|
+
: isWindows
|
|
122
|
+
? ["cmd", "/c", cmd, ...args]
|
|
123
|
+
: ["sh", "-c", 'exec "$@"', "sh", cmd, ...args]
|
|
124
|
+
: [cmd, ...args];
|
|
125
|
+
const proc = bunGlobal.Bun.spawn({
|
|
126
|
+
cmd: bunCmd,
|
|
127
|
+
cwd: cmdCwd,
|
|
128
|
+
env: cmdEnv,
|
|
129
|
+
stdout: bunStdio,
|
|
130
|
+
stderr: bunStdio,
|
|
131
|
+
});
|
|
132
|
+
const timeout = createProcessTimeout(effectiveTimeoutMs, () => proc.kill?.("SIGTERM"), () => proc.kill?.("SIGKILL"));
|
|
133
|
+
try {
|
|
134
|
+
const [code, stdout, stderr] = await Promise.all([
|
|
135
|
+
proc.exited,
|
|
136
|
+
capture && proc.stdout ? readStreamToString(proc.stdout) : Promise.resolve(undefined),
|
|
137
|
+
capture && proc.stderr ? readStreamToString(proc.stderr) : Promise.resolve(undefined),
|
|
138
|
+
]);
|
|
139
|
+
if (timeout.hasTimedOut()) {
|
|
140
|
+
return createTimeoutResult(effectiveTimeoutMs ?? 0, stdout, stderr);
|
|
141
|
+
}
|
|
142
|
+
return { success: code === 0, code, stdout, stderr };
|
|
143
|
+
}
|
|
144
|
+
finally {
|
|
145
|
+
timeout.clear();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (!runtimeProcess)
|
|
149
|
+
return { success: false, code: 1 };
|
|
150
|
+
const process = runtimeProcess;
|
|
151
|
+
const { spawn } = await dynamicImport("node:child_process");
|
|
152
|
+
const nodeStdio = inherit
|
|
153
|
+
? ["inherit", "inherit", "inherit"]
|
|
154
|
+
: capture
|
|
155
|
+
? ["ignore", "pipe", "pipe"]
|
|
156
|
+
: ["ignore", "ignore", "ignore"];
|
|
157
|
+
return await new Promise((resolve) => {
|
|
158
|
+
const child = spawn(cmd, args, {
|
|
159
|
+
cwd: cmdCwd,
|
|
160
|
+
env: cmdEnv ? { ...process.env, ...cmdEnv } : undefined,
|
|
161
|
+
stdio: nodeStdio,
|
|
162
|
+
shell,
|
|
163
|
+
});
|
|
164
|
+
let stdout = "";
|
|
165
|
+
let stderr = "";
|
|
166
|
+
const decoder = new TextDecoder();
|
|
167
|
+
const timeout = createProcessTimeout(effectiveTimeoutMs, () => child.kill("SIGTERM"), () => child.kill("SIGKILL"));
|
|
168
|
+
if (capture) {
|
|
169
|
+
child.stdout?.on("data", (data) => {
|
|
170
|
+
stdout += decoder.decode(data);
|
|
171
|
+
});
|
|
172
|
+
child.stderr?.on("data", (data) => {
|
|
173
|
+
stderr += decoder.decode(data);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
child.on("close", (code) => {
|
|
177
|
+
timeout.clear();
|
|
178
|
+
if (timeout.hasTimedOut()) {
|
|
179
|
+
resolve(createTimeoutResult(effectiveTimeoutMs ?? 0, capture ? stdout : undefined, capture ? stderr : undefined));
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
resolve({
|
|
183
|
+
success: code === 0,
|
|
184
|
+
code: code ?? 1,
|
|
185
|
+
stdout: capture ? stdout : undefined,
|
|
186
|
+
stderr: capture ? stderr : undefined,
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
child.on("error", () => {
|
|
190
|
+
timeout.clear();
|
|
191
|
+
resolve({ success: false, code: 1 });
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
}
|