vite-plugin-react-server
Version:
Vite plugin for React Server Components (RSC)
41 lines • 1.36 kB
TypeScript
import type { Worker } from "node:worker_threads";
import type { Logger } from "vite";
import { PassThrough } from "node:stream";
import type { SerializeableRenderToPipeableStreamOptions } from "../worker/rsc/types.js";
/**
* RSC-specific options for worker stream
*/
export interface RscWorkerStreamOptions {
worker: Worker;
route: string;
url: string;
projectRoot: string;
moduleBasePath: string;
moduleBaseURL: string;
moduleRootPath: string;
serverPipeableStreamOptions: SerializeableRenderToPipeableStreamOptions;
verbose?: boolean;
logger?: Logger;
panicThreshold?: any;
onError?: (error: Error, errorInfo?: any) => void;
rscTimeout?: number;
build?: any;
pagePath?: string;
propsPath?: string;
rootPath?: string;
htmlPath?: string;
}
/**
* Creates an RSC worker stream using the two-port architecture
*
* This function creates RSC streams by offloading React rendering to a separate worker thread
* using the two-port architecture (data port + control port) for clean separation of concerns.
*
* **Flow**: Route + Components → RSC Worker (two-port) → RSC Stream
*/
export declare function createRscWorkerStream(options: RscWorkerStreamOptions): {
stream: PassThrough;
dataPort1: any;
controlPort1: any;
};
//# sourceMappingURL=createRscWorkerStream.d.ts.map