UNPKG

@mintlify/common

Version:

Commonly shared code within Mintlify

18 lines (17 loc) 960 B
import type { Root } from 'mdast'; export declare const MDX_COMPONENT_BOUNDARY_NAME = "_MdxComponentBoundary"; /** * Collects the names of function-valued exports declared in the MDX itself — `export function X`, * `export const X = () => …` / `function(){}`, and re-exported local functions (`export { X }`). * These are the user-authored components we treat as renderable (and, in remarkMdxRemoveUnknownJsx, * as "known"), as opposed to exported plain values which are not components. */ export declare function getExportedFunctionNames(tree: Root): Set<string>; /** * Wraps each user-authored component usage in a `_MdxComponentBoundary` element so the client can * isolate it behind an error boundary — a single component that throws at render time then renders * nothing instead of crashing the whole page. */ export declare const remarkMdxClientComponentBoundaries: ({ allowlist }?: { allowlist?: string[]; }) => (tree: Root) => void;