| 105 | } |
| 106 | |
| 107 | export function renderToNodeStream( |
| 108 | input: App | VNode, |
| 109 | context: SSRContext = {}, |
| 110 | ): Readable { |
| 111 | const stream: Readable = __CJS__ |
| 112 | ? new (require('node:stream').Readable)({ read() {} }) |
| 113 | : null |
| 114 | |
| 115 | if (!stream) { |
| 116 | throw new Error( |
| 117 | `ESM build of renderToStream() does not support renderToNodeStream(). ` + |
| 118 | `Use pipeToNodeWritable() with an existing Node.js Writable stream ` + |
| 119 | `instance instead.`, |
| 120 | ) |
| 121 | } |
| 122 | |
| 123 | return renderToSimpleStream(input, context, stream) |
| 124 | } |
| 125 | |
| 126 | export function pipeToNodeWritable( |
| 127 | input: App | VNode, |