import { n as MdxComponentMap } from "./mdx-component-registry.types-BucDknxl.js"; import { ComponentType } from "react"; //#region src/components/mdx/mdx-runtime.d.ts type CompiledMdxComponent = ComponentType<{ components: MdxComponentMap; }>; declare const __mdxBodyBrand__: unique symbol; /** * A precompiled MDX body string produced by a trusted build pipeline. * * SECURITY: This brand is the trust boundary for the `new Function(body)` call * in `compileMdxBody`. The brand is a phantom type — callers cannot construct * one from a raw `string`; they MUST pass through `trustCompiledMdxBody`, * which makes the trust decision explicit and grep-able. * * Never call `trustCompiledMdxBody` on a value that originated from user * input, request bodies, search params, or any runtime source. The only * legitimate callers are build-time tools (e.g. `@gentleduck/md`) that have * compiled MDX themselves on the server. */ type CompiledMdxBody = string & { readonly [__mdxBodyBrand__]: 'CompiledMdxBody'; }; /** * Tags a string as trusted MDX body output from a build pipeline. * * SECURITY: Calling this on attacker-controlled input is arbitrary code * execution — `compileMdxBody` runs the body through `new Function`. Only * call this from server-side build code that produced the string itself. */ declare function trustCompiledMdxBody(body: string): CompiledMdxBody; /** * Compiles a precompiled MDX body string back to a React component. * * SECURITY: equivalent to `eval()`. Only accepts a `CompiledMdxBody`, which * the caller must have minted via `trustCompiledMdxBody`. The runtime check * below validates the shape `@mdx-js/mdx` emits; it runs AFTER `new Function(body)` * has already executed — so a hostile body that throws at top-level, mutates * globals, or starts side-effecting timers wins before any check fires. The * brand is the ONLY defence; the shape validation guards the return contract, * not the side-effects of evaluation. Keep `trustCompiledMdxBody` callers * grep-able and pinned to build-time origins. */ declare function compileMdxBody(body: CompiledMdxBody): CompiledMdxComponent; /** * @deprecated Use `compileMdxBody` with a `CompiledMdxBody` brand minted via * `trustCompiledMdxBody` instead. This shim auto-casts a raw `string` to the * brand, which silently bypasses the trust gate — that's the entire reason * the brand exists. Kept only for migration; will be removed in a future * major. Do not introduce new callers. */ declare const useMDXComponent: (code: string) => CompiledMdxComponent; //#endregion export { useMDXComponent as a, trustCompiledMdxBody as i, CompiledMdxComponent as n, compileMdxBody as r, CompiledMdxBody as t };