import type { FrontmatterSchemaEntry } from "./options.js"; /** * Minimal shape of the upstream `VirtualCodePlugin` contract * (`@mdx-js/language-service`): a factory returning an object that can visit * mdast nodes and emit a JS string appended to the virtual `.jsx` file. */ export interface VirtualCodePluginObject { visit?(node: { type: string; }): void; finalize(): string; } export type VirtualCodePlugin = () => VirtualCodePluginObject; /** A function that returns the frontmatter schema entry matching a file, if any. */ export type FrontmatterMatcher = (file: string | undefined) => FrontmatterSchemaEntry | undefined; /** Compile the glob matchers once and reuse them across files in a program. */ export declare function createFrontmatterMatcher(entries: FrontmatterSchemaEntry[]): FrontmatterMatcher; /** * A VirtualCodePlugin that types the document's `frontmatter` export. * * Upstream emits `export const frontmatter = /** @type {any} *\/ (undefined)`. * We replace `any` with the schema type declared for the file's glob, so * `{frontmatter.title}` usages in the body are checked against it. The current * file is read from `getFile()` — safe because upstream instantiates and runs * plugins synchronously inside `createVirtualCode`, which our language-plugin * wrapper wraps to set that value first. (Checking of the frontmatter *values* * is layered on separately in the wrapper, since the plugin seam carries no * source mappings.) */ export declare function createFrontmatterPlugin(getFile: () => string | undefined, match: FrontmatterMatcher, exportName?: string): VirtualCodePlugin; export declare function stripExtension(modulePath: string): string;