/** * @jorvel/ssr — renderToStream * * Streaming SSR via React 18's `renderToPipeableStream`. Returns a Node.js * `Readable` stream that yields the rendered HTML in chunks. For edge * runtimes use `renderRouteToString` (no node:stream dependency). */ import type { Readable } from 'node:stream'; import type { ComponentType } from 'react'; import type { SsrRoute } from './types.js'; export type StreamRenderResult = { /** Pipe the rendered stream to a Node.js writable (e.g. `res`). */ pipe: (destination: NodeJS.WritableStream) => void; /** Promise that resolves when the full shell has been flushed. */ shellReady: Promise; /** Promise that resolves (or rejects) when the render is complete. */ allReady: Promise; /** HTTP status code — may be updated to 500 on shell error. */ readonly statusCode: number; /** Errors that fired inside Suspense boundaries after shell flush. */ readonly errors: Error[]; /** Abort the in-flight render. */ abort: () => void; }; export interface RenderRouteToStreamOptions { /** AbortSignal for cooperative cancellation (e.g. client disconnect). */ signal?: AbortSignal; /** Hard timeout for `allReady`. After this, the stream is aborted. */ timeoutMs?: number; /** Optional reporter for deferred Suspense errors. */ onError?: (err: Error) => void; } /** * Render a React component tree to a Node.js pipeable stream. */ export declare function renderRouteToStream(App: ComponentType<{ path: string; params?: Record; }>, route: SsrRoute, opts?: RenderRouteToStreamOptions): StreamRenderResult; /** * Collect a streaming render into a string. Use `renderRouteToStream` directly * when you actually need streaming. */ export declare function collectStream(stream: Readable): Promise; //# sourceMappingURL=render-to-stream.d.ts.map