import type { CodeMapping } from "@volar/language-core"; import type { FrontmatterSchemaEntry } from "./options.js"; /** The generated code for the frontmatter validation and its source mappings. */ export interface FrontmatterValidation { /** JS appended to the embedded file. */ text: string; /** Mappings whose parallel arrays relocate generated tokens onto the MDX source. */ mappings: CodeMapping[]; } /** Extract the leading YAML frontmatter block and its offset within the MDX. */ export declare function extractYamlFrontmatter(mdx: string): { yaml: string; offset: number; } | undefined; /** * Build code that type-checks parsed frontmatter against the schema, arranged so * TypeScript names the offending field: * * - An inferred value object assigned to a `T`-typed const surfaces missing * fields (TS2741 "Property 'x' is missing") and wrong-typed values (TS2322 * "Types of property 'x' are incompatible") — both naming the field. These * map to the frontmatter block. * - A separate keys-only literal, typed to reject unknown keys, surfaces excess * keys (TS2353 naming the key), mapped to the exact key in the YAML. * * Returns undefined when there is nothing checkable (empty or non-object YAML, * or YAML that itself fails to parse). */ export declare function buildFrontmatterValidation(yaml: string, blockOffset: number, entry: FrontmatterSchemaEntry): FrontmatterValidation | undefined;