import * as unplugin from 'unplugin'; import { UnpluginOptions } from 'unplugin'; declare const VIRTUAL_CLIENT_ID = "virtual:@unhead/streaming-client"; declare const VIRTUAL_IIFE_ID = "virtual:@unhead/streaming-iife.js"; type Nonce = string | (() => string | undefined); interface StreamingPluginOptions { /** Framework package e.g. '@unhead/vue' */ framework: string; /** Plugin name (optional, defaults to `${framework}:streaming`) */ name?: string; /** * File extension filter for transform hook, e.g. /\.vue$/. Optional; * only required by frameworks whose client streaming support relies on * source-level AST injection (React/Solid/Svelte). Vue does not use it. */ filter?: RegExp; /** Optional source-code prefilter for transform hooks. */ codeFilter?: RegExp; /** Transform handler called for files matching `filter`. */ transform?: (code: string, id: string, options?: { ssr?: boolean; }) => { code: string; map?: any; } | null | undefined | void; /** * How to load the streaming client (vite-only, ignored on webpack/rspack/rollup where * index.html injection isn't available; frameworks inject the iife themselves in SSR). * - 'async' (default): Non-blocking external script. In dev served from a virtual * module; in production emitted as a real asset chunk via `emitFile`. * - 'inline': Inline the IIFE directly in HTML. Largest HTML, smallest TTFB, * always safe in production. Recommended for streaming SSR. * - 'module': ES module dynamic import of the client bootstrap. Vite rewrites the * import path through its module graph so it survives production builds. * @default 'async' */ mode?: 'async' | 'inline' | 'module'; /** * CSP nonce forwarded on every injected `