import { Writable } from 'node:stream'; import { ReactNode } from 'react'; import { StreamableHeadContext, PreparedTemplate, CreateStreamableServerHeadOptions } from 'unhead/stream/server'; export { BaseStreamableHeadContext, CreateStreamableServerHeadOptions, PreparedTemplate, StreamableHeadContext, StreamingTemplateParts, WebStreamableHeadContext, prepareStreamingTemplate, prepareTemplate, renderSSRHeadShell, renderSSRHeadSuspenseChunk, renderStreamBodyTags, renderStreamEnd, wrapStream } from 'unhead/stream/server'; import { ResolvableHead } from 'unhead/types'; import { U as UniversalUnheadProviderProps } from '../shared/react.DYgceLAG.mjs'; type UnheadProviderProps = UniversalUnheadProviderProps; declare function UnheadProvider({ value, children }: UnheadProviderProps): ReactNode; /** * Streaming head component for React. * * Return it before the output from the component that calls `useHead`: * * ```tsx * return <>{jsx} * ``` * * Keep it inside that component. A sibling may render before React detects * suspension. That early render clears the pending entries. * * The bundler plugin applies the wrapping form for you. */ declare function HeadStream(): ReactNode; /** * A pipe function from React's renderToPipeableStream */ type ReactPipeFunction = (writable: Writable) => void; /** * React-specific context returned by createStreamableHead. * Extends core StreamableHeadContext with React's wrap helper. */ interface ReactStreamableHeadContext extends Pick, 'head' | 'onShellReady'> { /** * Wrap React's pipe function to handle head injection automatically * @param pipe - The pipe function from renderToPipeableStream * @param template - The HTML template (from Vite's transformIndexHtml), or a `prepareTemplate()` result * @returns A new pipe function that handles shell rendering */ wrap: (pipe: ReactPipeFunction, template: string | PreparedTemplate) => (writable: Writable) => void; } /** * Creates a head instance configured for React streaming SSR. * * Returns a context with: * - `head`: The Unhead instance for UnheadProvider * - `onShellReady`: Callback to pass to renderToPipeableStream * - `wrap`: Wraps React's pipe to handle head injection * * @example * ```tsx * const { head, onShellReady, wrap } = createStreamableHead() * * const { pipe } = renderToPipeableStream( * , * { onShellReady } * ) * * return { pipe: wrap(pipe, template) } * ``` */ declare function createStreamableHead(options?: CreateStreamableServerHeadOptions): ReactStreamableHeadContext; export { HeadStream, UnheadProvider, createStreamableHead }; export type { ReactStreamableHeadContext, UnheadProviderProps };