import type { PluginOption, IndexHtmlTransformContext } from "vite"; import type { Notebook } from "../lib/notebook.js"; /** * A function which performs a per-page transformation of the template HTML. * * @param source The source of the template (typically HTML). * @param context The Vite plugin context. * @returns The transformed template source HTML. */ export type TemplateTransform = (source: string, context: IndexHtmlTransformContext) => string | Promise; /** * A function which transforms the parsed notebook. * * @param notebook The current (parsed) notebook. * @param context The Vite plugin context. * @returns The transformed notebook. */ export type NotebookTransform = (notebook: Notebook, context: IndexHtmlTransformContext) => Notebook | Promise; export interface ObservableOptions { /** The global window, for the default parser implementations. */ window?: Pick; /** The parser implementation; defaults to `new window.DOMParser()`. */ parser?: DOMParser; /** The path to the page template; defaults to the default template. */ template?: string; /** An optional function which transforms the template HTML for the current page. */ transformTemplate?: TemplateTransform; /** An optional function which transforms the notebook for the current page. */ transformNotebook?: NotebookTransform; } export declare function observable({ window, parser, template, transformTemplate, transformNotebook }?: ObservableOptions): PluginOption;