/** * @file The lazy URL loader (docs/LOADER.md): cache, abort, streaming. * * `loadMarkdown` resolves any URL the platform `fetch` accepts into a * compiled document. The shared LRU cache keys on normalized URL + * compile options, remembers `ETag`/`Last-Modified` validators, shares * in-flight fetches, and revalidates stale entries in the background. * When the response body is a `ReadableStream` the parser runs * block-by-block as chunks arrive — `streamMarkdown` exposes that as * an async iterator of completed top-level blocks. */ export type MdNode = import('./ast.js').MdNode; export type MdDocument = import('./ast.js').MdDocument; export type CompiledMd = import('./compiler.js').CompiledMd; export type MdCompileOptions = import('./compiler.js').MdCompileOptions; export type MdLoadOptions = MdCompileOptions & { base?: string | URL; signal?: AbortSignal; cache?: MdCache | false; fetch?: typeof globalThis.fetch; }; export type MdCache = { get: (key: string) => any; set: (key: string, entry: any) => void; delete: (key: string) => boolean; clear: () => void; }; /** * @typedef {import('./ast.js').MdNode} MdNode * @typedef {import('./ast.js').MdDocument} MdDocument * @typedef {import('./compiler.js').CompiledMd} CompiledMd * @typedef {import('./compiler.js').MdCompileOptions} MdCompileOptions */ /** * @typedef {MdCompileOptions & { * base?: string | URL, * signal?: AbortSignal, * cache?: MdCache | false, * fetch?: typeof globalThis.fetch, * }} MdLoadOptions */ /** * @typedef {object} MdCache * @property {(key: string) => any} get * @property {(key: string, entry: any) => void} set * @property {(key: string) => boolean} delete * @property {() => void} clear */ /** * The shared core LRU with Markdown's numeric-capacity policy: fractions * round down, values below one retain nothing, and Infinity or NaN * disable capacity eviction. * @param {number} [limit] * @returns {MdCache} */ export declare function createMdCache(limit?: number): MdCache; /** The shared default cache instance. */ export declare const defaultMdCache: MdCache; /** * Load and compile a Markdown document from a URL (docs/LOADER.md §1). * * @example * const md = await loadMarkdown('/docs/intro.md', { base: location.href }); * md.frontmatter; md.toVnode(); * * @param {string | URL} url * @param {MdLoadOptions} [options] * @returns {Promise} */ export declare function loadMarkdown(url: string | URL, options?: MdLoadOptions): Promise; /** * Stream a Markdown source, yielding completed top-level block nodes * as their end becomes certain; the generator's return value is the * finished MdDocument (docs/LOADER.md §4). * * Accepts a URL, a `Response`, a `ReadableStream`, or any (async) * iterable of string/Uint8Array chunks. * * @example * for await (const block of streamMarkdown('/big.md')) render(block); * * @param {any} urlOrStream * @param {MdLoadOptions} [options] * @returns {AsyncGenerator} */ export declare function streamMarkdown(urlOrStream: any, options?: MdLoadOptions): AsyncGenerator;