@fictjs/ssr 0.19.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -53,7 +53,8 @@ interface RenderToStringOptions {
53
53
  doctype?: string | null;
54
54
  /**
55
55
  * Expose DOM globals (window/document/Node/Element/etc) during render.
56
- * Defaults to true.
56
+ * Defaults to false. Set to true only for compatibility with components
57
+ * that still read process-global DOM objects during server rendering.
57
58
  */
58
59
  exposeGlobals?: boolean;
59
60
  /**
@@ -76,6 +77,10 @@ interface RenderToStringOptions {
76
77
  * Defaults to 'container'.
77
78
  */
78
79
  snapshotTarget?: 'container' | 'body' | 'head';
80
+ /**
81
+ * Nonce applied to generated <script> tags for CSP compatibility.
82
+ */
83
+ scriptNonce?: string;
79
84
  }
80
85
  interface RenderToStreamOptions extends RenderToStringOptions {
81
86
  /**
@@ -100,6 +105,20 @@ interface RenderToStreamOptions extends RenderToStringOptions {
100
105
  * Abort signal to cancel the stream.
101
106
  */
102
107
  signal?: AbortSignal;
108
+ /**
109
+ * How to load the streaming patch runtime.
110
+ * Defaults to 'inline'. Use 'external' with streamRuntimeSrc for strict CSP.
111
+ */
112
+ streamRuntime?: 'inline' | 'external';
113
+ /**
114
+ * External streaming patch runtime URL when streamRuntime is 'external'.
115
+ */
116
+ streamRuntimeSrc?: string;
117
+ /**
118
+ * How resolved Suspense patch chunks are applied.
119
+ * Defaults to 'inline' for inline runtimes and 'observer' for external runtimes.
120
+ */
121
+ streamPatchMode?: 'inline' | 'observer';
103
122
  }
104
123
  interface PipeableStream {
105
124
  pipe: (writable: NodeJS.WritableStream) => void;
@@ -110,6 +129,9 @@ interface PipeableStream {
110
129
  interface PartialPrerenderResult {
111
130
  /**
112
131
  * Complete shell HTML (fallbacks + markers + initial snapshot scripts).
132
+ *
133
+ * @experimental Preview API for v1.0; the access pattern may change before
134
+ * this becomes stable.
113
135
  */
114
136
  shell: string;
115
137
  /**
@@ -131,6 +153,10 @@ declare function renderToString(view: () => FictNode, options?: RenderToStringOp
131
153
  declare function renderToStringAsync(view: () => FictNode, options?: RenderToStringOptions): Promise<string>;
132
154
  declare function renderToStream(view: () => FictNode, options?: RenderToStreamOptions): ReadableStream<Uint8Array>;
133
155
  declare function renderToPipeableStream(view: () => FictNode, options?: RenderToStreamOptions): PipeableStream;
156
+ /**
157
+ * @experimental Preview API for v1.0; the return shape may change before this
158
+ * becomes stable.
159
+ */
134
160
  declare function renderToPartial(view: () => FictNode, options?: RenderToStreamOptions): PartialPrerenderResult;
135
161
 
136
162
  export { type PartialPrerenderResult, type PipeableStream, type RenderToDocumentResult, type RenderToStreamOptions, type RenderToStringOptions, type SSRDom, createSSRDocument, renderToDocument, renderToPartial, renderToPipeableStream, renderToStream, renderToString, renderToStringAsync };
package/dist/index.d.ts CHANGED
@@ -53,7 +53,8 @@ interface RenderToStringOptions {
53
53
  doctype?: string | null;
54
54
  /**
55
55
  * Expose DOM globals (window/document/Node/Element/etc) during render.
56
- * Defaults to true.
56
+ * Defaults to false. Set to true only for compatibility with components
57
+ * that still read process-global DOM objects during server rendering.
57
58
  */
58
59
  exposeGlobals?: boolean;
59
60
  /**
@@ -76,6 +77,10 @@ interface RenderToStringOptions {
76
77
  * Defaults to 'container'.
77
78
  */
78
79
  snapshotTarget?: 'container' | 'body' | 'head';
80
+ /**
81
+ * Nonce applied to generated <script> tags for CSP compatibility.
82
+ */
83
+ scriptNonce?: string;
79
84
  }
80
85
  interface RenderToStreamOptions extends RenderToStringOptions {
81
86
  /**
@@ -100,6 +105,20 @@ interface RenderToStreamOptions extends RenderToStringOptions {
100
105
  * Abort signal to cancel the stream.
101
106
  */
102
107
  signal?: AbortSignal;
108
+ /**
109
+ * How to load the streaming patch runtime.
110
+ * Defaults to 'inline'. Use 'external' with streamRuntimeSrc for strict CSP.
111
+ */
112
+ streamRuntime?: 'inline' | 'external';
113
+ /**
114
+ * External streaming patch runtime URL when streamRuntime is 'external'.
115
+ */
116
+ streamRuntimeSrc?: string;
117
+ /**
118
+ * How resolved Suspense patch chunks are applied.
119
+ * Defaults to 'inline' for inline runtimes and 'observer' for external runtimes.
120
+ */
121
+ streamPatchMode?: 'inline' | 'observer';
103
122
  }
104
123
  interface PipeableStream {
105
124
  pipe: (writable: NodeJS.WritableStream) => void;
@@ -110,6 +129,9 @@ interface PipeableStream {
110
129
  interface PartialPrerenderResult {
111
130
  /**
112
131
  * Complete shell HTML (fallbacks + markers + initial snapshot scripts).
132
+ *
133
+ * @experimental Preview API for v1.0; the access pattern may change before
134
+ * this becomes stable.
113
135
  */
114
136
  shell: string;
115
137
  /**
@@ -131,6 +153,10 @@ declare function renderToString(view: () => FictNode, options?: RenderToStringOp
131
153
  declare function renderToStringAsync(view: () => FictNode, options?: RenderToStringOptions): Promise<string>;
132
154
  declare function renderToStream(view: () => FictNode, options?: RenderToStreamOptions): ReadableStream<Uint8Array>;
133
155
  declare function renderToPipeableStream(view: () => FictNode, options?: RenderToStreamOptions): PipeableStream;
156
+ /**
157
+ * @experimental Preview API for v1.0; the return shape may change before this
158
+ * becomes stable.
159
+ */
134
160
  declare function renderToPartial(view: () => FictNode, options?: RenderToStreamOptions): PartialPrerenderResult;
135
161
 
136
162
  export { type PartialPrerenderResult, type PipeableStream, type RenderToDocumentResult, type RenderToStreamOptions, type RenderToStringOptions, type SSRDom, createSSRDocument, renderToDocument, renderToPartial, renderToPipeableStream, renderToStream, renderToString, renderToStringAsync };