@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
13 lines • 825 B
text/typescript
import type { Code, ControlledCode, ParseSource } from "./types.mjs";
import type { PreParsedCacheEntry } from "./CodeHighlighterContext.mjs";
/**
* Pure function to parse controlled code and convert it to regular Code format.
* Handles the conversion from ControlledCode (string|null sources) to Code (HAST nodes).
*
* When `preParsedCache` is supplied, each file's source is first looked up in
* the cache. If the cached entry's source string matches byte-for-byte, the
* cached HAST is reused and `parseSource` is skipped for that file. On a
* mismatch the stale entry is evicted before re-parsing so the cache cannot
* grow stale across rapid edits.
*/
export declare function parseControlledCode(controlledCode: ControlledCode, parseSource: ParseSource, preParsedCache?: Map<string, PreParsedCacheEntry>): Code;