File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { VNode } from 'preact' ;
2
+ import { WritableStream } from 'node:stream' ;
3
+
4
+ interface RenderToPipeableStreamOptions {
5
+ onShellReady ?: ( ) => void ;
6
+ onAllReady ?: ( ) => void ;
7
+ onError ?: ( error : any ) => void ;
8
+ }
9
+
10
+ interface PipeableStream {
11
+ abort : ( ) => void ;
12
+ pipe : ( writable : WritableStream ) => void ;
13
+ }
14
+
15
+ export function renderToReadableStream (
16
+ vnode : VNode ,
17
+ options : RenderToPipeableStreamOptions ,
18
+ context ?: any
19
+ ) : PipeableStream ;
Original file line number Diff line number Diff line change @@ -8,11 +8,17 @@ import { renderToChunks } from './lib/chunked.js';
8
8
* @property {(error) => void } [onError]
9
9
*/
10
10
11
+ /**
12
+ * @typedef {object } PipeableStream
13
+ * @property {() => void } abort
14
+ * @property {(writable: import('stream').Writable) => void } pipe
15
+ */
16
+
11
17
/**
12
18
* @param {import('preact').VNode } vnode
13
19
* @param {RenderToPipeableStreamOptions } options
14
20
* @param {any } [context]
15
- * @returns {{} }
21
+ * @returns {PipeableStream }
16
22
*/
17
23
export function renderToPipeableStream ( vnode , options , context ) {
18
24
const encoder = new TextEncoder ( 'utf-8' ) ;
Original file line number Diff line number Diff line change
1
+ import { VNode } from 'preact' ;
2
+
3
+ interface RenderStream extends ReadableStream < Uint8Array > {
4
+ allReady : Promise < void > ;
5
+ }
6
+
7
+ export function renderToReadableStream (
8
+ vnode : VNode ,
9
+ context ?: any
10
+ ) : RenderStream ;
You can’t perform that action at this time.
0 commit comments