/** * Astro renders its pages without Vite's `transformIndexHtml`, and that hook * is how the plugin puts its page runtime in the page: the timeline and * inspector that feed the panel, the source overlay, the HMR indicator and * the component manifest links. Without them HMR still works, since it rides * in the transformed modules, but the panel says the page never connected. * * So in dev the Astro integration runs the plugin's own `transformIndexHtml` * hooks for each HTML page Astro sends and splices in the tags they return. * Only the tags: the HTML the hooks rewrite is an `index.html` as written, * which an Astro page never is. Other plugins' hooks stay out of it, as * Astro keeps them out. */ import type { IncomingMessage, ServerResponse } from 'node:http'; import type { HtmlTagDescriptor, IndexHtmlTransformContext, Plugin, ViteDevServer } from 'vite'; /** The tags the plugins' `transformIndexHtml` hooks return for a page. */ export declare const collectPageTags: (plugins: readonly Plugin[], html: string, ctx: IndexHtmlTransformContext) => Promise; /** Splices tags in where their `injectTo` says, as Vite would. */ export declare const injectPageTags: (html: string, tags: readonly HtmlTagDescriptor[]) => string; /** When the module a URL names was last hot-updated, if it ever was. */ type LastUpdate = (url: string) => Promise; /** * Stamps each island's `component-url` the way Vite stamps every other * import of a module once it has been hot-updated: `?t=`. * Astro writes the URL plain, so on a page that also imports the component * in a script, which a custom element needs to be defined, the browser * loaded the module twice after an edit: two classes for one tag, the * second `define` taken for a hot patch on a plain load, and module state * split in two. */ export declare const stampIslandUrls: (html: string, lastUpdate: LastUpdate) => Promise; /** * A middleware that holds each HTML response back until it is complete, then * sends it with the plugins' tags in and its islands' URLs stamped. Dev * only, where streaming a page matters less than the panel seeing it. */ export declare const pageTagsMiddleware: (plugins: readonly Plugin[], server: ViteDevServer) => (req: IncomingMessage, res: ServerResponse, next: () => void) => void; export {}; //# sourceMappingURL=page-tags.d.ts.map