UNPKG

rwsdk

Version:

Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime

18 lines (17 loc) 914 B
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; import { renderToReadableStream as baseRenderToRscStream } from "react-server-dom-webpack/server.edge"; import { createClientManifest } from "./createClientManifest.js"; export const renderToRscStream = ({ input, onError, }) => { const { node: inputNode, actionResult } = input; // context(justinvdm, 2025-09-26): We add a marker here for our stitching logic in // renderDocumentHtmlStream() to find and use. It needs to live here rather than there, // since it needs to live in the RSC payload for hydration to work. const wrappedNode = (_jsxs(_Fragment, { children: [inputNode, _jsx("div", { id: "rwsdk-app-end" })] })); const wrappedInput = { node: wrappedNode, actionResult, }; return baseRenderToRscStream(wrappedInput, createClientManifest(), { onError, }); };