@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,53 @@
|
|
|
1
|
+
import { compile } from "@mdx-js/mdx";
|
|
2
|
+
import { extractFrontmatter } from "../../../../src/transforms/mdx/compiler/frontmatter-extractor.js";
|
|
3
|
+
import { rewriteBodyImports, rewriteCompiledImports } from "../../../../src/transforms/mdx/compiler/import-rewriter.js";
|
|
4
|
+
import { getRehypePlugins, getRemarkPlugins } from "../plugins/plugin-loader.js";
|
|
5
|
+
import { rehypeNodePositions } from "../plugins/rehype-node-positions.js";
|
|
6
|
+
export async function compileMdx(options) {
|
|
7
|
+
const { projectDir, content, frontmatter: providedFrontmatter, filePath, target = "server", baseUrl, studioEmbed, outputFormat = "program", remarkPlugins: additionalRemarkPlugins = [], rehypePlugins: additionalRehypePlugins = [], } = options;
|
|
8
|
+
const remarkPlugins = [
|
|
9
|
+
...getRemarkPlugins(),
|
|
10
|
+
...additionalRemarkPlugins,
|
|
11
|
+
];
|
|
12
|
+
const rehypePlugins = [
|
|
13
|
+
...getRehypePlugins(),
|
|
14
|
+
...additionalRehypePlugins,
|
|
15
|
+
];
|
|
16
|
+
if (studioEmbed && filePath) {
|
|
17
|
+
rehypePlugins.push([rehypeNodePositions, { filePath }]);
|
|
18
|
+
}
|
|
19
|
+
const { body: extractedBody, frontmatter: extractedFrontmatter } = extractFrontmatter(content, providedFrontmatter);
|
|
20
|
+
const shouldRewriteImports = Boolean(filePath) &&
|
|
21
|
+
(target === "browser" || target === "server");
|
|
22
|
+
const body = shouldRewriteImports
|
|
23
|
+
? rewriteBodyImports(extractedBody, { filePath: filePath, target, baseUrl, projectDir })
|
|
24
|
+
: extractedBody;
|
|
25
|
+
const compiled = await compile(body, {
|
|
26
|
+
outputFormat,
|
|
27
|
+
// Always false: @mdx-js/mdx development mode emits extra JSX
|
|
28
|
+
// transforms that break the existing rendering pipeline.
|
|
29
|
+
development: false,
|
|
30
|
+
remarkPlugins,
|
|
31
|
+
rehypePlugins,
|
|
32
|
+
providerImportSource: undefined,
|
|
33
|
+
jsxImportSource: "react",
|
|
34
|
+
});
|
|
35
|
+
const headings = compiled.data?.headings ??
|
|
36
|
+
[];
|
|
37
|
+
const compiledString = String(compiled);
|
|
38
|
+
const compiledCode = shouldRewriteImports
|
|
39
|
+
? rewriteCompiledImports(compiledString, {
|
|
40
|
+
filePath: filePath,
|
|
41
|
+
target,
|
|
42
|
+
baseUrl,
|
|
43
|
+
projectDir,
|
|
44
|
+
})
|
|
45
|
+
: compiledString;
|
|
46
|
+
return {
|
|
47
|
+
compiledCode,
|
|
48
|
+
frontmatter: extractedFrontmatter,
|
|
49
|
+
globals: {},
|
|
50
|
+
headings,
|
|
51
|
+
nodeMap: new Map(),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ext-content-mdx: ContentProcessor implementation backed by MDX + remark/rehype.
|
|
3
|
+
*
|
|
4
|
+
* Provides the `ContentProcessor` contract:
|
|
5
|
+
* - `compileMdx(options)` runs @mdx-js/mdx through Veryfront's remark +
|
|
6
|
+
* rehype plugin stack and returns compiled ESM plus extracted headings
|
|
7
|
+
* and frontmatter.
|
|
8
|
+
* - `compileMarkdown(options)` runs a unified markdown pipeline
|
|
9
|
+
* (remark-parse to remark-rehype to rehype-sanitize to rehype-stringify)
|
|
10
|
+
* producing sanitized HTML wrapped in a React component.
|
|
11
|
+
*
|
|
12
|
+
* Core's `src/transforms/md/compiler` and `src/transforms/mdx/compiler`
|
|
13
|
+
* resolve this contract at call time. When the extension is not installed,
|
|
14
|
+
* core throws an actionable install message (see
|
|
15
|
+
* `src/extensions/recommendations.ts`).
|
|
16
|
+
*
|
|
17
|
+
* @module extensions/ext-content-mdx
|
|
18
|
+
*/
|
|
19
|
+
import "../../../_dnt.polyfills.js";
|
|
20
|
+
import type { ExtensionFactory } from "veryfront/extensions";
|
|
21
|
+
import type { ContentCompileOptions, ContentPlugin, ContentProcessingResult, ContentProcessor } from "veryfront/extensions/content";
|
|
22
|
+
declare class MdxContentProcessor implements ContentProcessor {
|
|
23
|
+
compileMdx(options: ContentCompileOptions): Promise<ContentProcessingResult>;
|
|
24
|
+
compileMarkdown(options: ContentCompileOptions): Promise<ContentProcessingResult>;
|
|
25
|
+
getRemarkPlugins(): ContentPlugin[];
|
|
26
|
+
getRehypePlugins(): ContentPlugin[];
|
|
27
|
+
}
|
|
28
|
+
declare const extMdx: ExtensionFactory;
|
|
29
|
+
export default extMdx;
|
|
30
|
+
export { MdxContentProcessor };
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-content-mdx/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EACV,qBAAqB,EACrB,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAKtC,cAAM,mBAAoB,YAAW,gBAAgB;IACnD,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAG5E,eAAe,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAGjF,gBAAgB,IAAI,aAAa,EAAE;IAGnC,gBAAgB,IAAI,aAAa,EAAE;CAGpC;AAED,QAAA,MAAM,MAAM,EAAE,gBAiBb,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ext-content-mdx: ContentProcessor implementation backed by MDX + remark/rehype.
|
|
3
|
+
*
|
|
4
|
+
* Provides the `ContentProcessor` contract:
|
|
5
|
+
* - `compileMdx(options)` runs @mdx-js/mdx through Veryfront's remark +
|
|
6
|
+
* rehype plugin stack and returns compiled ESM plus extracted headings
|
|
7
|
+
* and frontmatter.
|
|
8
|
+
* - `compileMarkdown(options)` runs a unified markdown pipeline
|
|
9
|
+
* (remark-parse to remark-rehype to rehype-sanitize to rehype-stringify)
|
|
10
|
+
* producing sanitized HTML wrapped in a React component.
|
|
11
|
+
*
|
|
12
|
+
* Core's `src/transforms/md/compiler` and `src/transforms/mdx/compiler`
|
|
13
|
+
* resolve this contract at call time. When the extension is not installed,
|
|
14
|
+
* core throws an actionable install message (see
|
|
15
|
+
* `src/extensions/recommendations.ts`).
|
|
16
|
+
*
|
|
17
|
+
* @module extensions/ext-content-mdx
|
|
18
|
+
*/
|
|
19
|
+
import "../../../_dnt.polyfills.js";
|
|
20
|
+
import { compileMdx } from "./compiler/mdx-compile.js";
|
|
21
|
+
import { compileMarkdown } from "./compiler/markdown-compile.js";
|
|
22
|
+
import { getRehypePlugins, getRemarkPlugins } from "./plugins/plugin-loader.js";
|
|
23
|
+
class MdxContentProcessor {
|
|
24
|
+
compileMdx(options) {
|
|
25
|
+
return compileMdx(options);
|
|
26
|
+
}
|
|
27
|
+
compileMarkdown(options) {
|
|
28
|
+
return compileMarkdown(options);
|
|
29
|
+
}
|
|
30
|
+
getRemarkPlugins() {
|
|
31
|
+
return getRemarkPlugins();
|
|
32
|
+
}
|
|
33
|
+
getRehypePlugins() {
|
|
34
|
+
return getRehypePlugins();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const extMdx = () => {
|
|
38
|
+
const impl = new MdxContentProcessor();
|
|
39
|
+
return {
|
|
40
|
+
name: "ext-content-mdx",
|
|
41
|
+
version: "0.1.0",
|
|
42
|
+
contracts: {
|
|
43
|
+
provides: ["ContentProcessor"],
|
|
44
|
+
},
|
|
45
|
+
capabilities: [],
|
|
46
|
+
setup(ctx) {
|
|
47
|
+
ctx.provide("ContentProcessor", impl);
|
|
48
|
+
ctx.logger.info("[ext-content-mdx] ContentProcessor registered");
|
|
49
|
+
},
|
|
50
|
+
teardown() {
|
|
51
|
+
// No resources to release.
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export default extMdx;
|
|
56
|
+
export { MdxContentProcessor };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-content-mdx/src/plugins/plugin-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAQzC,wBAAgB,gBAAgB,IAAI,SAAS,EAAE,CAQ9C;AAED,wBAAgB,gBAAgB,IAAI,SAAS,EAAE,CAE9C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import rehypeHighlight from "rehype-highlight";
|
|
2
|
+
import rehypeSlug from "rehype-slug";
|
|
3
|
+
import remarkFrontmatter from "remark-frontmatter";
|
|
4
|
+
import remarkGfm from "remark-gfm";
|
|
5
|
+
import { remarkMdxHeadings } from "./remark-headings.js";
|
|
6
|
+
import { remarkCodeBlocks, remarkMdxRemoveParagraphs } from "./remark-mdx-utils.js";
|
|
7
|
+
export function getRemarkPlugins() {
|
|
8
|
+
return [
|
|
9
|
+
remarkGfm,
|
|
10
|
+
remarkFrontmatter,
|
|
11
|
+
remarkMdxHeadings,
|
|
12
|
+
remarkMdxRemoveParagraphs,
|
|
13
|
+
remarkCodeBlocks,
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
export function getRehypePlugins() {
|
|
17
|
+
return [rehypeHighlight, rehypeSlug];
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rehype plugin that injects source location attributes on every element.
|
|
3
|
+
*
|
|
4
|
+
* Handles both:
|
|
5
|
+
* - HTML elements from markdown (h1, p, li, …)
|
|
6
|
+
* - MDX JSX nodes (mdxJsxFlowElement, mdxJsxTextElement)
|
|
7
|
+
*
|
|
8
|
+
* Injected attributes:
|
|
9
|
+
* data-node-file — project-relative source file path
|
|
10
|
+
* data-node-name — element or component name
|
|
11
|
+
* data-node-line — source line number
|
|
12
|
+
* data-node-column — source column number (0-based)
|
|
13
|
+
*/
|
|
14
|
+
import type { Root } from "@types/hast";
|
|
15
|
+
interface RehypeNodePositionsOptions {
|
|
16
|
+
filePath?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function rehypeNodePositions(options?: RehypeNodePositionsOptions): (tree: Root) => void;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=rehype-node-positions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rehype-node-positions.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-content-mdx/src/plugins/rehype-node-positions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,aAAa,CAAC;AAGjD,UAAU,0BAA0B;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AASD,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,0BAA+B,GACvC,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAoCtB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rehype plugin that injects source location attributes on every element.
|
|
3
|
+
*
|
|
4
|
+
* Handles both:
|
|
5
|
+
* - HTML elements from markdown (h1, p, li, …)
|
|
6
|
+
* - MDX JSX nodes (mdxJsxFlowElement, mdxJsxTextElement)
|
|
7
|
+
*
|
|
8
|
+
* Injected attributes:
|
|
9
|
+
* data-node-file — project-relative source file path
|
|
10
|
+
* data-node-name — element or component name
|
|
11
|
+
* data-node-line — source line number
|
|
12
|
+
* data-node-column — source column number (0-based)
|
|
13
|
+
*/
|
|
14
|
+
import { visit } from "unist-util-visit";
|
|
15
|
+
export function rehypeNodePositions(options = {}) {
|
|
16
|
+
return function transform(tree) {
|
|
17
|
+
visit(tree, (node) => {
|
|
18
|
+
if (node.type === "element") {
|
|
19
|
+
const el = node;
|
|
20
|
+
if (!el.position)
|
|
21
|
+
return;
|
|
22
|
+
const props = el.properties ?? (el.properties = {});
|
|
23
|
+
const { start } = el.position;
|
|
24
|
+
if (options.filePath)
|
|
25
|
+
props["data-node-file"] = options.filePath;
|
|
26
|
+
props["data-node-name"] = el.tagName;
|
|
27
|
+
props["data-node-line"] = String(start.line);
|
|
28
|
+
props["data-node-column"] = String(start.column - 1);
|
|
29
|
+
props["data-node-source"] = "md";
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (node.type !== "mdxJsxFlowElement" && node.type !== "mdxJsxTextElement")
|
|
33
|
+
return;
|
|
34
|
+
const mdx = node;
|
|
35
|
+
if (!mdx.position)
|
|
36
|
+
return;
|
|
37
|
+
const attrs = mdx.attributes ?? (mdx.attributes = []);
|
|
38
|
+
const { start } = mdx.position;
|
|
39
|
+
if (options.filePath) {
|
|
40
|
+
attrs.push({ type: "mdxJsxAttribute", name: "data-node-file", value: options.filePath });
|
|
41
|
+
}
|
|
42
|
+
attrs.push({ type: "mdxJsxAttribute", name: "data-node-name", value: mdx.name || "unknown" }, { type: "mdxJsxAttribute", name: "data-node-line", value: String(start.line) }, { type: "mdxJsxAttribute", name: "data-node-column", value: String(start.column - 1) });
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remark-headings.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-content-mdx/src/plugins/remark-headings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AA0BnC,wBAAgB,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,KAAK,IAAI,CA8DrE"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import GithubSlugger from "github-slugger";
|
|
2
|
+
import { toString } from "mdast-util-to-string";
|
|
3
|
+
import { visit } from "unist-util-visit";
|
|
4
|
+
function createHeadingProperty(name, value) {
|
|
5
|
+
return {
|
|
6
|
+
type: "Property",
|
|
7
|
+
key: { type: "Identifier", name },
|
|
8
|
+
value: { type: "Literal", value },
|
|
9
|
+
kind: "init",
|
|
10
|
+
method: false,
|
|
11
|
+
shorthand: false,
|
|
12
|
+
computed: false,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function remarkMdxHeadings() {
|
|
16
|
+
const slugger = new GithubSlugger();
|
|
17
|
+
return (tree, file) => {
|
|
18
|
+
const headings = [];
|
|
19
|
+
slugger.reset();
|
|
20
|
+
visit(tree, "heading", (node) => {
|
|
21
|
+
const text = toString(node);
|
|
22
|
+
const id = slugger.slug(text);
|
|
23
|
+
node.data ??= {};
|
|
24
|
+
node.data.hProperties ??= {};
|
|
25
|
+
node.data.hProperties.id = id;
|
|
26
|
+
headings.push({ text, id, level: node.depth });
|
|
27
|
+
});
|
|
28
|
+
file.data.headings = headings;
|
|
29
|
+
const headingsExport = {
|
|
30
|
+
type: "mdxjsEsm",
|
|
31
|
+
value: "",
|
|
32
|
+
data: {
|
|
33
|
+
estree: {
|
|
34
|
+
type: "Program",
|
|
35
|
+
sourceType: "module",
|
|
36
|
+
body: [
|
|
37
|
+
{
|
|
38
|
+
type: "ExportNamedDeclaration",
|
|
39
|
+
specifiers: [],
|
|
40
|
+
source: null,
|
|
41
|
+
declaration: {
|
|
42
|
+
type: "VariableDeclaration",
|
|
43
|
+
kind: "const",
|
|
44
|
+
declarations: [
|
|
45
|
+
{
|
|
46
|
+
type: "VariableDeclarator",
|
|
47
|
+
id: { type: "Identifier", name: "headings" },
|
|
48
|
+
init: {
|
|
49
|
+
type: "ArrayExpression",
|
|
50
|
+
elements: headings.map((h) => ({
|
|
51
|
+
type: "ObjectExpression",
|
|
52
|
+
properties: [
|
|
53
|
+
createHeadingProperty("text", h.text),
|
|
54
|
+
createHeadingProperty("id", h.id),
|
|
55
|
+
createHeadingProperty("level", h.level),
|
|
56
|
+
],
|
|
57
|
+
})),
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
tree.children.unshift(headingsExport);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Root } from "@types/mdast";
|
|
2
|
+
import type { VFile } from "vfile";
|
|
3
|
+
/**
|
|
4
|
+
* Removes unnecessary <p> elements from MDX content.
|
|
5
|
+
*
|
|
6
|
+
* Handles edge cases where <p> elements get incorrectly nested inside JSX components:
|
|
7
|
+
* - `<Button><p>text</p></Button>` → `<Button>text</Button>`
|
|
8
|
+
* - Inline parents: `<span><p>text</p></span>` → `<span>text</span>`
|
|
9
|
+
* - Multiple children with mixed content
|
|
10
|
+
*/
|
|
11
|
+
export declare function remarkMdxRemoveParagraphs(): (tree: Root) => void;
|
|
12
|
+
export declare function remarkCodeBlocks(): (tree: Root) => void;
|
|
13
|
+
export declare function remarkMdxImports(): (tree: Root, file: VFile) => void;
|
|
14
|
+
//# sourceMappingURL=remark-mdx-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remark-mdx-utils.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-content-mdx/src/plugins/remark-mdx-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAoGnC;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,IAAI,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CA6EhE;AAYD,wBAAgB,gBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAmBvD;AAQD,wBAAgB,gBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,KAAK,IAAI,CAmBpE"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { CONTINUE, SKIP, visit } from "unist-util-visit";
|
|
2
|
+
/**
|
|
3
|
+
* Spacer node to preserve whitespace when unwrapping paragraphs
|
|
4
|
+
*/
|
|
5
|
+
const spacer = {
|
|
6
|
+
type: "mdxFlowExpression",
|
|
7
|
+
value: "' '",
|
|
8
|
+
data: {
|
|
9
|
+
estree: {
|
|
10
|
+
type: "Program",
|
|
11
|
+
body: [
|
|
12
|
+
{
|
|
13
|
+
type: "ExpressionStatement",
|
|
14
|
+
expression: {
|
|
15
|
+
type: "Literal",
|
|
16
|
+
value: " ",
|
|
17
|
+
raw: "' '",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
sourceType: "module",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
// Replace node at index with multiple children nodes
|
|
26
|
+
// Reference: https://github.com/mdx-js/mdx/issues/1451#issuecomment-780428572
|
|
27
|
+
function mergeChildren(node, index, children) {
|
|
28
|
+
node.children?.splice(index, 1, ...children);
|
|
29
|
+
}
|
|
30
|
+
const textNodeTypes = new Set([
|
|
31
|
+
"text",
|
|
32
|
+
"paragraph",
|
|
33
|
+
"heading",
|
|
34
|
+
"link",
|
|
35
|
+
"image",
|
|
36
|
+
"list",
|
|
37
|
+
"listItem",
|
|
38
|
+
"emphasis",
|
|
39
|
+
"strong",
|
|
40
|
+
"blockquote",
|
|
41
|
+
"code",
|
|
42
|
+
"inlineCode",
|
|
43
|
+
"thematicBreak",
|
|
44
|
+
"table",
|
|
45
|
+
"tableRow",
|
|
46
|
+
"tableCell",
|
|
47
|
+
"footnote",
|
|
48
|
+
"footnoteDefinition",
|
|
49
|
+
]);
|
|
50
|
+
const validParentBlockElements = new Set([
|
|
51
|
+
"address",
|
|
52
|
+
"article",
|
|
53
|
+
"aside",
|
|
54
|
+
"blockquote",
|
|
55
|
+
"details",
|
|
56
|
+
"dialog",
|
|
57
|
+
"canvas",
|
|
58
|
+
"dl",
|
|
59
|
+
"dt",
|
|
60
|
+
"dd",
|
|
61
|
+
"div",
|
|
62
|
+
"fieldset",
|
|
63
|
+
"figcaption",
|
|
64
|
+
"figure",
|
|
65
|
+
"footer",
|
|
66
|
+
"form",
|
|
67
|
+
"header",
|
|
68
|
+
"hgroup",
|
|
69
|
+
"main",
|
|
70
|
+
"nav",
|
|
71
|
+
"pre",
|
|
72
|
+
"section",
|
|
73
|
+
"video",
|
|
74
|
+
]);
|
|
75
|
+
function isJsxComponentName(name = "") {
|
|
76
|
+
// Check if name starts with a capital letter (JSX component, not HTML element)
|
|
77
|
+
return name.match(/^[A-Z]/);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Removes unnecessary <p> elements from MDX content.
|
|
81
|
+
*
|
|
82
|
+
* Handles edge cases where <p> elements get incorrectly nested inside JSX components:
|
|
83
|
+
* - `<Button><p>text</p></Button>` → `<Button>text</Button>`
|
|
84
|
+
* - Inline parents: `<span><p>text</p></span>` → `<span>text</span>`
|
|
85
|
+
* - Multiple children with mixed content
|
|
86
|
+
*/
|
|
87
|
+
export function remarkMdxRemoveParagraphs() {
|
|
88
|
+
return function transformer(tree) {
|
|
89
|
+
// First pass: add spacers between elements when parent has non-text children
|
|
90
|
+
visit(tree, "paragraph", (_node, _index, parent) => {
|
|
91
|
+
const extParent = parent;
|
|
92
|
+
if (!extParent)
|
|
93
|
+
return CONTINUE;
|
|
94
|
+
const parentName = extParent.name ?? extParent.type ?? extParent.tagName;
|
|
95
|
+
if (parentName === "root")
|
|
96
|
+
return CONTINUE;
|
|
97
|
+
const hasNonTextChild = extParent.children?.some((child) => !textNodeTypes.has(child.type));
|
|
98
|
+
if (!hasNonTextChild)
|
|
99
|
+
return CONTINUE;
|
|
100
|
+
if (extParent.children.some((c) => c.isMdxTextSpacer))
|
|
101
|
+
return CONTINUE;
|
|
102
|
+
const children = [];
|
|
103
|
+
extParent.children.forEach((child, i) => {
|
|
104
|
+
if (i > 0) {
|
|
105
|
+
children.push({ ...spacer, isMdxTextSpacer: true });
|
|
106
|
+
}
|
|
107
|
+
children.push(child);
|
|
108
|
+
});
|
|
109
|
+
extParent.children = children;
|
|
110
|
+
return CONTINUE;
|
|
111
|
+
});
|
|
112
|
+
// Second pass: unwrap paragraphs
|
|
113
|
+
visit(tree, "paragraph", (node, index, parent) => {
|
|
114
|
+
const extParent = parent;
|
|
115
|
+
if (!extParent)
|
|
116
|
+
return CONTINUE;
|
|
117
|
+
const paragraphNode = node;
|
|
118
|
+
const parentName = extParent.name ?? extParent.type ?? extParent.tagName;
|
|
119
|
+
const idx = typeof index === "number" ? index : -1;
|
|
120
|
+
const previousChild = idx >= 0 ? extParent.children[idx - 1] : undefined;
|
|
121
|
+
// Unwrap <p> elements when they appear inside a direct <p> parent
|
|
122
|
+
if (parentName === "p" && idx >= 0) {
|
|
123
|
+
const child = paragraphNode.children?.[0];
|
|
124
|
+
if (child)
|
|
125
|
+
extParent.children[idx] = child;
|
|
126
|
+
return [SKIP, idx];
|
|
127
|
+
}
|
|
128
|
+
// Keep behavior consistent between children
|
|
129
|
+
if (previousChild?.type === "paragraph")
|
|
130
|
+
return CONTINUE;
|
|
131
|
+
if (parentName === "root")
|
|
132
|
+
return CONTINUE;
|
|
133
|
+
const hasNonTextChild = extParent.children.some((child) => !textNodeTypes.has(child.type));
|
|
134
|
+
if (hasNonTextChild && idx >= 0) {
|
|
135
|
+
// Unwrap <p> elements when child contains other children besides text
|
|
136
|
+
mergeChildren(extParent, idx, paragraphNode.children);
|
|
137
|
+
return [SKIP, idx];
|
|
138
|
+
}
|
|
139
|
+
// Unwrap <p> elements with single text child elements
|
|
140
|
+
// e.g. <Button><p>Do not wrap</p></Button> => <Button>Do not wrap</Button>
|
|
141
|
+
if (extParent.children.length === 1) {
|
|
142
|
+
extParent.children = paragraphNode.children;
|
|
143
|
+
return [SKIP, idx >= 0 ? idx : 0];
|
|
144
|
+
}
|
|
145
|
+
const isElementParent = !isJsxComponentName(parentName);
|
|
146
|
+
const isInlineParent = !validParentBlockElements.has(parentName ?? "");
|
|
147
|
+
// Unwrap <p> elements which are children of inline elements
|
|
148
|
+
// e.g. <span><p>Do not wrap</p></span> => <span>Do not wrap</span>
|
|
149
|
+
if (isElementParent && isInlineParent && idx >= 0) {
|
|
150
|
+
const child = paragraphNode.children?.[0];
|
|
151
|
+
if (child)
|
|
152
|
+
extParent.children[idx] = child;
|
|
153
|
+
}
|
|
154
|
+
return CONTINUE;
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
export function remarkCodeBlocks() {
|
|
159
|
+
return function transformer(tree) {
|
|
160
|
+
visit(tree, "code", (node) => {
|
|
161
|
+
const codeNode = node;
|
|
162
|
+
codeNode.data ??= {};
|
|
163
|
+
codeNode.data.hProperties ??= {};
|
|
164
|
+
if (codeNode.lang) {
|
|
165
|
+
codeNode.data.hProperties.className = [`language-${codeNode.lang}`];
|
|
166
|
+
}
|
|
167
|
+
if (!codeNode.meta)
|
|
168
|
+
return;
|
|
169
|
+
const highlightMatch = codeNode.meta.match(/\{([\d,-]+)\}/);
|
|
170
|
+
if (highlightMatch) {
|
|
171
|
+
codeNode.data.hProperties["data-line-numbers"] = highlightMatch[1];
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
export function remarkMdxImports() {
|
|
177
|
+
return function transformer(tree, file) {
|
|
178
|
+
const imports = [];
|
|
179
|
+
visit(tree, "mdxjsEsm", (node) => {
|
|
180
|
+
if (!node.value?.includes("import"))
|
|
181
|
+
return;
|
|
182
|
+
const importMatches = node.value.matchAll(/import\s+(?:(?:\{[^}]*\}|\*\s+as\s+\w+|\w+)\s+from\s+)?['"]([^'"]+)['"]/g);
|
|
183
|
+
for (const match of importMatches) {
|
|
184
|
+
const path = match[1];
|
|
185
|
+
if (typeof path === "string")
|
|
186
|
+
imports.push(path);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
file.data.imports = imports;
|
|
190
|
+
};
|
|
191
|
+
}
|
package/esm/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DEFAULT_PORT } from "../platform/compat/constants.js";
|
|
2
|
+
export { DEFAULT_PORT };
|
|
3
|
+
export declare const DEFAULT_TIMEOUT_MS = 5000;
|
|
4
|
+
export declare const SSR_TIMEOUT_MS = 10000;
|
|
5
|
+
export declare const SANDBOX_TIMEOUT_MS = 5000;
|
|
6
|
+
/** Timeout for user data fetching functions (getServerData, getStaticData) */
|
|
7
|
+
export declare const DATA_FETCH_TIMEOUT_MS = 10000;
|
|
8
|
+
export declare const DEFAULT_CACHE_MAX_SIZE = 100;
|
|
9
|
+
export declare const DURATION_HISTOGRAM_BOUNDARIES_MS: readonly [5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000];
|
|
10
|
+
export declare const SIZE_HISTOGRAM_BOUNDARIES_KB: readonly [1, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000];
|
|
11
|
+
export declare const defaultConfig: {
|
|
12
|
+
readonly server: {
|
|
13
|
+
readonly port: 3000;
|
|
14
|
+
readonly hostname: "0.0.0.0";
|
|
15
|
+
};
|
|
16
|
+
readonly timeouts: {
|
|
17
|
+
readonly default: 5000;
|
|
18
|
+
readonly api: 30000;
|
|
19
|
+
readonly ssr: 10000;
|
|
20
|
+
readonly hmr: 30000;
|
|
21
|
+
readonly sandbox: 5000;
|
|
22
|
+
};
|
|
23
|
+
readonly cache: {
|
|
24
|
+
readonly jit: {
|
|
25
|
+
readonly maxSize: 100;
|
|
26
|
+
readonly tempDirPrefix: "vf-bundle-";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
readonly metrics: {
|
|
30
|
+
readonly ssrBoundaries: readonly [5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare const DEFAULT_PREFETCH_DELAY_MS = 100;
|
|
34
|
+
export declare const DEFAULT_METRICS_COLLECT_INTERVAL_MS = 60000;
|
|
35
|
+
export declare const DEFAULT_REDIS_SCAN_COUNT = 100;
|
|
36
|
+
export declare const DEFAULT_REDIS_BATCH_DELETE_SIZE = 1000;
|
|
37
|
+
export declare const PAGE_TRANSITION_DELAY_MS = 150;
|
|
38
|
+
export type DefaultConfig = typeof defaultConfig;
|
|
39
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/src/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAE3C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,gCAAgC,iFAenC,CAAC;AAEX,eAAO,MAAM,4BAA4B,qEAa/B,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;CAqBhB,CAAC;AAEX,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAC7C,eAAO,MAAM,mCAAmC,QAAQ,CAAC;AACzD,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,+BAA+B,OAAO,CAAC;AACpD,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { DEFAULT_PORT } from "../platform/compat/constants.js";
|
|
2
|
+
export { DEFAULT_PORT };
|
|
3
|
+
export const DEFAULT_TIMEOUT_MS = 5000;
|
|
4
|
+
export const SSR_TIMEOUT_MS = 10000;
|
|
5
|
+
export const SANDBOX_TIMEOUT_MS = 5000;
|
|
6
|
+
/** Timeout for user data fetching functions (getServerData, getStaticData) */
|
|
7
|
+
export const DATA_FETCH_TIMEOUT_MS = 10000;
|
|
8
|
+
export const DEFAULT_CACHE_MAX_SIZE = 100;
|
|
9
|
+
export const DURATION_HISTOGRAM_BOUNDARIES_MS = [
|
|
10
|
+
5,
|
|
11
|
+
10,
|
|
12
|
+
25,
|
|
13
|
+
50,
|
|
14
|
+
75,
|
|
15
|
+
100,
|
|
16
|
+
250,
|
|
17
|
+
500,
|
|
18
|
+
750,
|
|
19
|
+
1000,
|
|
20
|
+
2500,
|
|
21
|
+
5000,
|
|
22
|
+
7500,
|
|
23
|
+
10000,
|
|
24
|
+
];
|
|
25
|
+
export const SIZE_HISTOGRAM_BOUNDARIES_KB = [
|
|
26
|
+
1,
|
|
27
|
+
5,
|
|
28
|
+
10,
|
|
29
|
+
25,
|
|
30
|
+
50,
|
|
31
|
+
100,
|
|
32
|
+
250,
|
|
33
|
+
500,
|
|
34
|
+
1000,
|
|
35
|
+
2500,
|
|
36
|
+
5000,
|
|
37
|
+
10000,
|
|
38
|
+
];
|
|
39
|
+
export const defaultConfig = {
|
|
40
|
+
server: {
|
|
41
|
+
port: DEFAULT_PORT,
|
|
42
|
+
hostname: "0.0.0.0",
|
|
43
|
+
},
|
|
44
|
+
timeouts: {
|
|
45
|
+
default: DEFAULT_TIMEOUT_MS,
|
|
46
|
+
api: 30000,
|
|
47
|
+
ssr: SSR_TIMEOUT_MS,
|
|
48
|
+
hmr: 30000,
|
|
49
|
+
sandbox: SANDBOX_TIMEOUT_MS,
|
|
50
|
+
},
|
|
51
|
+
cache: {
|
|
52
|
+
jit: {
|
|
53
|
+
maxSize: DEFAULT_CACHE_MAX_SIZE,
|
|
54
|
+
tempDirPrefix: "vf-bundle-",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
metrics: {
|
|
58
|
+
ssrBoundaries: DURATION_HISTOGRAM_BOUNDARIES_MS,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
export const DEFAULT_PREFETCH_DELAY_MS = 100;
|
|
62
|
+
export const DEFAULT_METRICS_COLLECT_INTERVAL_MS = 60000;
|
|
63
|
+
export const DEFAULT_REDIS_SCAN_COUNT = 100;
|
|
64
|
+
export const DEFAULT_REDIS_BATCH_DELETE_SIZE = 1000;
|
|
65
|
+
export const PAGE_TRANSITION_DELAY_MS = 150;
|