@fictjs/ssr 0.27.0 → 0.28.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.
@@ -1,187 +0,0 @@
1
- import { FictNode } from "@fictjs/runtime";
2
-
3
- //#region src/render-core.d.ts
4
- interface SSRDom {
5
- window: Window;
6
- document: Document;
7
- }
8
- interface RenderToStringOptions {
9
- /**
10
- * Provide a pre-created DOM (document + window). If omitted, a new DOM is
11
- * created per render using `html`.
12
- */
13
- dom?: SSRDom;
14
- /**
15
- * Provide a document directly. If `window` is omitted, `document.defaultView`
16
- * will be used when available.
17
- */
18
- document?: Document;
19
- /**
20
- * Provide a window directly. If `document` is omitted, `window.document` is used.
21
- */
22
- window?: Window;
23
- /**
24
- * HTML template used when creating a new DOM.
25
- */
26
- html?: string;
27
- /**
28
- * Provide a container element to render into.
29
- */
30
- container?: HTMLElement;
31
- /**
32
- * Tag name for the auto-created container.
33
- */
34
- containerTag?: string;
35
- /**
36
- * id applied to the auto-created container.
37
- */
38
- containerId?: string;
39
- /**
40
- * Additional attributes applied to the auto-created container.
41
- */
42
- containerAttributes?: Record<string, string | number | boolean | null | undefined>;
43
- /**
44
- * Return the container element including its outer tag.
45
- */
46
- includeContainer?: boolean;
47
- /**
48
- * Return a full HTML document string (doctype + documentElement.outerHTML).
49
- */
50
- fullDocument?: boolean;
51
- /**
52
- * Override doctype when `fullDocument` is true. Use `null` to omit.
53
- */
54
- doctype?: string | null;
55
- /**
56
- * Expose DOM globals (window/document/Node/Element/etc) during render.
57
- * Defaults to false. Set to true only for compatibility with components
58
- * that still read process-global DOM objects during server rendering.
59
- */
60
- exposeGlobals?: boolean;
61
- /**
62
- * Manifest mapping module URLs to built client chunk URLs.
63
- * Can be an object or a path to a JSON file.
64
- * File path mode requires Deno sync filesystem access or a CommonJS
65
- * environment where `require('node:fs')` is available. Pass an object when
66
- * rendering from Node ESM or edge runtimes.
67
- */
68
- manifest?: Record<string, string> | string;
69
- /**
70
- * Include the SSR snapshot script for resumability.
71
- * Defaults to true.
72
- */
73
- includeSnapshot?: boolean;
74
- /**
75
- * Script element id for the snapshot.
76
- */
77
- snapshotScriptId?: string;
78
- /**
79
- * Where to append the snapshot script when not returning full document.
80
- * Defaults to 'container'.
81
- */
82
- snapshotTarget?: 'container' | 'body' | 'head';
83
- /**
84
- * Nonce applied to generated <script> tags for CSP compatibility.
85
- */
86
- scriptNonce?: string;
87
- /**
88
- * Stable namespace for resumable scope identifiers in `data-fict-s` and
89
- * snapshot payloads. Set this when independently cached or separately rendered
90
- * outputs can share a document, and keep it unique within that document.
91
- * This does not change streaming Suspense patch identifiers.
92
- *
93
- * Values must contain 1-128 ASCII letters, digits, `_`, `.`, `:`, or `-`, and
94
- * must not contain `--`. When omitted, each render gets an automatic edge-safe
95
- * namespace.
96
- */
97
- scopeIdentifierPrefix?: string;
98
- }
99
- interface RenderToStreamOptions extends RenderToStringOptions {
100
- /**
101
- * Streaming mode:
102
- * - 'shell': send fallback shell first, then patch resolved boundaries
103
- * - 'all': wait for all suspense boundaries, then send full HTML
104
- */
105
- mode?: 'shell' | 'all';
106
- /**
107
- * Called once the initial shell has been written.
108
- */
109
- onShellReady?: () => void;
110
- /**
111
- * Called once all pending boundaries resolve and the stream completes.
112
- */
113
- onAllReady?: () => void;
114
- /**
115
- * Called when an error occurs during streaming.
116
- */
117
- onError?: (err: unknown) => void;
118
- /**
119
- * Abort signal to cancel the stream.
120
- */
121
- signal?: AbortSignal;
122
- /**
123
- * How to load the streaming patch runtime.
124
- * Defaults to 'inline'. Use 'external' with streamRuntimeSrc for strict CSP.
125
- */
126
- streamRuntime?: 'inline' | 'external';
127
- /**
128
- * External streaming patch runtime URL when streamRuntime is 'external'.
129
- */
130
- streamRuntimeSrc?: string;
131
- /**
132
- * How resolved Suspense patch chunks are applied.
133
- * Defaults to 'inline' for inline runtimes and 'observer' for external runtimes.
134
- */
135
- streamPatchMode?: 'inline' | 'observer';
136
- /**
137
- * Stable namespace for Suspense patch identifiers. Set this when independently
138
- * cached or separately rendered streams can share a document, and keep it unique
139
- * within that document. This does not change resumable scope identifiers.
140
- *
141
- * Values must contain 1-128 ASCII letters, digits, `_`, `.`, `:`, or `-`, and
142
- * must not contain `--`. When omitted, each shell stream gets an automatic
143
- * edge-safe namespace.
144
- */
145
- streamIdentifierPrefix?: string;
146
- }
147
- interface PipeableStream {
148
- pipe: (writable: NodeJS.WritableStream) => void;
149
- abort: (reason?: unknown) => void;
150
- shellReady: Promise<void>;
151
- allReady: Promise<void>;
152
- }
153
- interface PartialPrerenderResult {
154
- /**
155
- * Complete shell HTML (fallbacks + markers + initial snapshot scripts).
156
- *
157
- * @experimental Preview API for v1.0; the access pattern may change before
158
- * this becomes stable.
159
- */
160
- shell: string;
161
- /**
162
- * Stream of deferred patch chunks and incremental snapshots.
163
- */
164
- stream: ReadableStream<Uint8Array>;
165
- shellReady: Promise<void>;
166
- allReady: Promise<void>;
167
- abort: (reason?: unknown) => void;
168
- }
169
- interface RenderToDocumentResult extends SSRDom {
170
- html: string;
171
- container: HTMLElement;
172
- dispose: () => void;
173
- }
174
- declare function createSSRDocument(html?: string): SSRDom;
175
- declare function renderToDocument(view: () => FictNode, options?: RenderToStringOptions): RenderToDocumentResult;
176
- declare function renderToString(view: () => FictNode, options?: RenderToStringOptions): string;
177
- declare function renderToStringAsync(view: () => FictNode, options?: RenderToStringOptions): Promise<string>;
178
- declare function renderToStream(view: () => FictNode, options?: RenderToStreamOptions): ReadableStream<Uint8Array>;
179
- declare function renderToPipeableStream(view: () => FictNode, options?: RenderToStreamOptions): PipeableStream;
180
- /**
181
- * @experimental Preview API for v1.0; the return shape may change before this
182
- * becomes stable.
183
- */
184
- declare function renderToPartial(view: () => FictNode, options?: RenderToStreamOptions): PartialPrerenderResult;
185
- //#endregion
186
- export { RenderToStringOptions as a, renderToDocument as c, renderToStream as d, renderToString as f, RenderToStreamOptions as i, renderToPartial as l, PipeableStream as n, SSRDom as o, renderToStringAsync as p, RenderToDocumentResult as r, createSSRDocument as s, PartialPrerenderResult as t, renderToPipeableStream as u };
187
- //# sourceMappingURL=render-core-KCiJV_SK.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-core-KCiJV_SK.d.cts","names":[],"sources":["../src/render-core.ts"],"mappings":";;;UAkCiB,MAAA;EACf,MAAA,EAAQ,MAAA;EACR,QAAA,EAAU,QAAQ;AAAA;AAAA,UAGH,qBAAA;EAHG;;;;EAQlB,GAAA,GAAM,MAAA;EARY;AAAA;AAGpB;;EAUE,QAAA,GAAW,QAAA;EALL;;;EASN,MAAA,GAAS,MAAA;EAoBa;;;EAhBtB,IAAA;EAbA;;;EAiBA,SAAA,GAAY,WAAA;EARZ;;;EAYA,YAAA;EAJY;;;EAQZ,WAAA;EAIsB;;;EAAtB,mBAAA,GAAsB,MAAA;EAkBtB;;;EAdA,gBAAA;EA+BA;;;EA3BA,YAAA;EA+CqB;AAAA;AAGvB;EA9CE,OAAA;;;;;;EAMA,aAAA;EA0DA;;;;;;;EAlDA,QAAA,GAAW,MAAA;EA8EW;AAAA;AAGxB;;EA5EE,eAAA;EA6EiB;;;EAzEjB,gBAAA;EA4EiB;;;;EAvEjB,cAAA;EAqEA;;;EAjEA,WAAA;EAmEA;;;AAAiB;AAGnB;;;;;;EA3DE,qBAAA;AAAA;AAAA,UAGe,qBAAA,SAA8B,qBAAqB;EA+DlE;;;;;EAzDA,IAAA;EA+DA;;;EA3DA,YAAA;EA4DwB;AAAA;AAG1B;EA3DE,UAAA;;;;EAIA,OAAA,IAAW,GAAA;EAyDX;;;EArDA,MAAA,GAAS,WAAA;EAsDF;AAQT;;;EAzDE,aAAA;EAyDoE;AAStE;;EA9DE,gBAAA;EA+DY;;;;EA1DZ,eAAA;EA0DY;;;;;;AAEW;AA+DzB;;EAjHE,sBAAA;AAAA;AAAA,UAGe,cAAA;EACf,IAAA,GAAO,QAAA,EAAU,MAAA,CAAO,cAAA;EACxB,KAAA,GAAQ,MAAA;EACR,UAAA,EAAY,OAAA;EACZ,QAAA,EAAU,OAAA;AAAA;AAAA,UAGK,sBAAA;EA8GwB;;;;;;EAvGvC,KAAA;EAwGY;;;EApGZ,MAAA,EAAQ,cAAA,CAAe,UAAA;EACvB,UAAA,EAAY,OAAA;EACZ,QAAA,EAAU,OAAA;EACV,KAAA,GAAQ,MAAA;AAAA;AAAA,UAGO,sBAAA,SAA+B,MAAM;EACpD,IAAA;EACA,SAAA,EAAW,WAAA;EACX,OAAA;AAAA;AAAA,iBAQc,iBAAA,CAAkB,IAAA,YAA8B,MAAM;AAAA,iBAStD,gBAAA,CACd,IAAA,QAAY,QAAA,EACZ,OAAA,GAAS,qBAAA,GACR,sBAAA;AAAA,iBA+Da,cAAA,CAAe,IAAA,QAAY,QAAA,EAAU,OAAA,GAAS,qBAA0B;AAAA,iBAOlE,mBAAA,CACpB,IAAA,QAAY,QAAA,EACZ,OAAA,GAAS,qBAAA,GACR,OAAA;AAAA,iBA6Ba,cAAA,CACd,IAAA,QAAY,QAAA,EACZ,OAAA,GAAS,qBAAA,GACR,cAAA,CAAe,UAAA;AAAA,iBAkFF,sBAAA,CACd,IAAA,QAAY,QAAA,EACZ,OAAA,GAAS,qBAAA,GACR,cAAA;;;;;iBA8Ba,eAAA,CACd,IAAA,QAAY,QAAA,EACZ,OAAA,GAAS,qBAAA,GACR,sBAAA"}
@@ -1,187 +0,0 @@
1
- import { FictNode } from "@fictjs/runtime";
2
-
3
- //#region src/render-core.d.ts
4
- interface SSRDom {
5
- window: Window;
6
- document: Document;
7
- }
8
- interface RenderToStringOptions {
9
- /**
10
- * Provide a pre-created DOM (document + window). If omitted, a new DOM is
11
- * created per render using `html`.
12
- */
13
- dom?: SSRDom;
14
- /**
15
- * Provide a document directly. If `window` is omitted, `document.defaultView`
16
- * will be used when available.
17
- */
18
- document?: Document;
19
- /**
20
- * Provide a window directly. If `document` is omitted, `window.document` is used.
21
- */
22
- window?: Window;
23
- /**
24
- * HTML template used when creating a new DOM.
25
- */
26
- html?: string;
27
- /**
28
- * Provide a container element to render into.
29
- */
30
- container?: HTMLElement;
31
- /**
32
- * Tag name for the auto-created container.
33
- */
34
- containerTag?: string;
35
- /**
36
- * id applied to the auto-created container.
37
- */
38
- containerId?: string;
39
- /**
40
- * Additional attributes applied to the auto-created container.
41
- */
42
- containerAttributes?: Record<string, string | number | boolean | null | undefined>;
43
- /**
44
- * Return the container element including its outer tag.
45
- */
46
- includeContainer?: boolean;
47
- /**
48
- * Return a full HTML document string (doctype + documentElement.outerHTML).
49
- */
50
- fullDocument?: boolean;
51
- /**
52
- * Override doctype when `fullDocument` is true. Use `null` to omit.
53
- */
54
- doctype?: string | null;
55
- /**
56
- * Expose DOM globals (window/document/Node/Element/etc) during render.
57
- * Defaults to false. Set to true only for compatibility with components
58
- * that still read process-global DOM objects during server rendering.
59
- */
60
- exposeGlobals?: boolean;
61
- /**
62
- * Manifest mapping module URLs to built client chunk URLs.
63
- * Can be an object or a path to a JSON file.
64
- * File path mode requires Deno sync filesystem access or a CommonJS
65
- * environment where `require('node:fs')` is available. Pass an object when
66
- * rendering from Node ESM or edge runtimes.
67
- */
68
- manifest?: Record<string, string> | string;
69
- /**
70
- * Include the SSR snapshot script for resumability.
71
- * Defaults to true.
72
- */
73
- includeSnapshot?: boolean;
74
- /**
75
- * Script element id for the snapshot.
76
- */
77
- snapshotScriptId?: string;
78
- /**
79
- * Where to append the snapshot script when not returning full document.
80
- * Defaults to 'container'.
81
- */
82
- snapshotTarget?: 'container' | 'body' | 'head';
83
- /**
84
- * Nonce applied to generated <script> tags for CSP compatibility.
85
- */
86
- scriptNonce?: string;
87
- /**
88
- * Stable namespace for resumable scope identifiers in `data-fict-s` and
89
- * snapshot payloads. Set this when independently cached or separately rendered
90
- * outputs can share a document, and keep it unique within that document.
91
- * This does not change streaming Suspense patch identifiers.
92
- *
93
- * Values must contain 1-128 ASCII letters, digits, `_`, `.`, `:`, or `-`, and
94
- * must not contain `--`. When omitted, each render gets an automatic edge-safe
95
- * namespace.
96
- */
97
- scopeIdentifierPrefix?: string;
98
- }
99
- interface RenderToStreamOptions extends RenderToStringOptions {
100
- /**
101
- * Streaming mode:
102
- * - 'shell': send fallback shell first, then patch resolved boundaries
103
- * - 'all': wait for all suspense boundaries, then send full HTML
104
- */
105
- mode?: 'shell' | 'all';
106
- /**
107
- * Called once the initial shell has been written.
108
- */
109
- onShellReady?: () => void;
110
- /**
111
- * Called once all pending boundaries resolve and the stream completes.
112
- */
113
- onAllReady?: () => void;
114
- /**
115
- * Called when an error occurs during streaming.
116
- */
117
- onError?: (err: unknown) => void;
118
- /**
119
- * Abort signal to cancel the stream.
120
- */
121
- signal?: AbortSignal;
122
- /**
123
- * How to load the streaming patch runtime.
124
- * Defaults to 'inline'. Use 'external' with streamRuntimeSrc for strict CSP.
125
- */
126
- streamRuntime?: 'inline' | 'external';
127
- /**
128
- * External streaming patch runtime URL when streamRuntime is 'external'.
129
- */
130
- streamRuntimeSrc?: string;
131
- /**
132
- * How resolved Suspense patch chunks are applied.
133
- * Defaults to 'inline' for inline runtimes and 'observer' for external runtimes.
134
- */
135
- streamPatchMode?: 'inline' | 'observer';
136
- /**
137
- * Stable namespace for Suspense patch identifiers. Set this when independently
138
- * cached or separately rendered streams can share a document, and keep it unique
139
- * within that document. This does not change resumable scope identifiers.
140
- *
141
- * Values must contain 1-128 ASCII letters, digits, `_`, `.`, `:`, or `-`, and
142
- * must not contain `--`. When omitted, each shell stream gets an automatic
143
- * edge-safe namespace.
144
- */
145
- streamIdentifierPrefix?: string;
146
- }
147
- interface PipeableStream {
148
- pipe: (writable: NodeJS.WritableStream) => void;
149
- abort: (reason?: unknown) => void;
150
- shellReady: Promise<void>;
151
- allReady: Promise<void>;
152
- }
153
- interface PartialPrerenderResult {
154
- /**
155
- * Complete shell HTML (fallbacks + markers + initial snapshot scripts).
156
- *
157
- * @experimental Preview API for v1.0; the access pattern may change before
158
- * this becomes stable.
159
- */
160
- shell: string;
161
- /**
162
- * Stream of deferred patch chunks and incremental snapshots.
163
- */
164
- stream: ReadableStream<Uint8Array>;
165
- shellReady: Promise<void>;
166
- allReady: Promise<void>;
167
- abort: (reason?: unknown) => void;
168
- }
169
- interface RenderToDocumentResult extends SSRDom {
170
- html: string;
171
- container: HTMLElement;
172
- dispose: () => void;
173
- }
174
- declare function createSSRDocument(html?: string): SSRDom;
175
- declare function renderToDocument(view: () => FictNode, options?: RenderToStringOptions): RenderToDocumentResult;
176
- declare function renderToString(view: () => FictNode, options?: RenderToStringOptions): string;
177
- declare function renderToStringAsync(view: () => FictNode, options?: RenderToStringOptions): Promise<string>;
178
- declare function renderToStream(view: () => FictNode, options?: RenderToStreamOptions): ReadableStream<Uint8Array>;
179
- declare function renderToPipeableStream(view: () => FictNode, options?: RenderToStreamOptions): PipeableStream;
180
- /**
181
- * @experimental Preview API for v1.0; the return shape may change before this
182
- * becomes stable.
183
- */
184
- declare function renderToPartial(view: () => FictNode, options?: RenderToStreamOptions): PartialPrerenderResult;
185
- //#endregion
186
- export { RenderToStringOptions as a, renderToDocument as c, renderToStream as d, renderToString as f, RenderToStreamOptions as i, renderToPartial as l, PipeableStream as n, SSRDom as o, renderToStringAsync as p, RenderToDocumentResult as r, createSSRDocument as s, PartialPrerenderResult as t, renderToPipeableStream as u };
187
- //# sourceMappingURL=render-core-KCiJV_SK.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-core-KCiJV_SK.d.ts","names":[],"sources":["../src/render-core.ts"],"mappings":";;;UAkCiB,MAAA;EACf,MAAA,EAAQ,MAAA;EACR,QAAA,EAAU,QAAQ;AAAA;AAAA,UAGH,qBAAA;EAHG;;;;EAQlB,GAAA,GAAM,MAAA;EARY;AAAA;AAGpB;;EAUE,QAAA,GAAW,QAAA;EALL;;;EASN,MAAA,GAAS,MAAA;EAoBa;;;EAhBtB,IAAA;EAbA;;;EAiBA,SAAA,GAAY,WAAA;EARZ;;;EAYA,YAAA;EAJY;;;EAQZ,WAAA;EAIsB;;;EAAtB,mBAAA,GAAsB,MAAA;EAkBtB;;;EAdA,gBAAA;EA+BA;;;EA3BA,YAAA;EA+CqB;AAAA;AAGvB;EA9CE,OAAA;;;;;;EAMA,aAAA;EA0DA;;;;;;;EAlDA,QAAA,GAAW,MAAA;EA8EW;AAAA;AAGxB;;EA5EE,eAAA;EA6EiB;;;EAzEjB,gBAAA;EA4EiB;;;;EAvEjB,cAAA;EAqEA;;;EAjEA,WAAA;EAmEA;;;AAAiB;AAGnB;;;;;;EA3DE,qBAAA;AAAA;AAAA,UAGe,qBAAA,SAA8B,qBAAqB;EA+DlE;;;;;EAzDA,IAAA;EA+DA;;;EA3DA,YAAA;EA4DwB;AAAA;AAG1B;EA3DE,UAAA;;;;EAIA,OAAA,IAAW,GAAA;EAyDX;;;EArDA,MAAA,GAAS,WAAA;EAsDF;AAQT;;;EAzDE,aAAA;EAyDoE;AAStE;;EA9DE,gBAAA;EA+DY;;;;EA1DZ,eAAA;EA0DY;;;;;;AAEW;AA+DzB;;EAjHE,sBAAA;AAAA;AAAA,UAGe,cAAA;EACf,IAAA,GAAO,QAAA,EAAU,MAAA,CAAO,cAAA;EACxB,KAAA,GAAQ,MAAA;EACR,UAAA,EAAY,OAAA;EACZ,QAAA,EAAU,OAAA;AAAA;AAAA,UAGK,sBAAA;EA8GwB;;;;;;EAvGvC,KAAA;EAwGY;;;EApGZ,MAAA,EAAQ,cAAA,CAAe,UAAA;EACvB,UAAA,EAAY,OAAA;EACZ,QAAA,EAAU,OAAA;EACV,KAAA,GAAQ,MAAA;AAAA;AAAA,UAGO,sBAAA,SAA+B,MAAM;EACpD,IAAA;EACA,SAAA,EAAW,WAAA;EACX,OAAA;AAAA;AAAA,iBAQc,iBAAA,CAAkB,IAAA,YAA8B,MAAM;AAAA,iBAStD,gBAAA,CACd,IAAA,QAAY,QAAA,EACZ,OAAA,GAAS,qBAAA,GACR,sBAAA;AAAA,iBA+Da,cAAA,CAAe,IAAA,QAAY,QAAA,EAAU,OAAA,GAAS,qBAA0B;AAAA,iBAOlE,mBAAA,CACpB,IAAA,QAAY,QAAA,EACZ,OAAA,GAAS,qBAAA,GACR,OAAA;AAAA,iBA6Ba,cAAA,CACd,IAAA,QAAY,QAAA,EACZ,OAAA,GAAS,qBAAA,GACR,cAAA,CAAe,UAAA;AAAA,iBAkFF,sBAAA,CACd,IAAA,QAAY,QAAA,EACZ,OAAA,GAAS,qBAAA,GACR,cAAA;;;;;iBA8Ba,eAAA,CACd,IAAA,QAAY,QAAA,EACZ,OAAA,GAAS,qBAAA,GACR,sBAAA"}
@@ -1,15 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/stream-runtime.ts
3
- /**
4
- * Create the browser-side streaming patch runtime as classic-script JavaScript.
5
- *
6
- * The generated package asset `@fictjs/ssr/fict-stream-runtime.js` is built from
7
- * this helper with `observerMode: true`.
8
- */
9
- function createStreamRuntimeCode(options = {}) {
10
- return "(function(){var runtime=window.__FICT_STREAM;function walk(root,visit){var stack=[root];while(stack.length){var node=stack.pop();if(visit(node)===false)return false;var container=node.nodeType===1&&node.localName===\"template\"&&node.content?node.content:node;for(var child=container.lastChild;child;child=child.previousSibling)stack.push(child);}return true;}if(!runtime||typeof runtime.apply!==\"function\"){var cache=new Map();function findTemplate(id){var tpl=null;walk(document,function(n){if(n.nodeType===1&&n.localName===\"template\"&&n.content&&n.getAttribute(\"data-fict-suspense\")===id){tpl=n;return false;}});return tpl;}function find(id){var hit=cache.get(id);if(hit)return hit;var startMarker=\"fict:suspense-start:\"+id,endMarker=\"fict:suspense-end:\"+id;walk(document,function(n){if(n.nodeType!==8||n.data!==startMarker)return;var end=n.nextSibling;while(end&&(end.nodeType!==8||end.data!==endMarker))end=end.nextSibling;if(end){hit={start:n,end:end};return false;}});if(hit)cache.set(id,hit);return hit;}function apply(id){if(typeof id!==\"string\"||!id)return;var tpl=findTemplate(id);if(!tpl)return;var b=find(id);if(!b)return;var parent=b.start.parentNode;if(!parent||b.end.parentNode!==parent)return;var cursor=b.start.nextSibling;while(cursor&&cursor!==b.end)cursor=cursor.nextSibling;if(cursor!==b.end)return;var content=tpl.content;var ns=tpl.getAttribute(\"data-fict-patch-namespace\");if(ns){var tag=ns===\"svg\"?\"svg\":ns===\"mathml\"?\"math\":null;var wrapper=content.firstElementChild;if(!tag||!wrapper||wrapper.localName!==tag)return;var fragment=document.createDocumentFragment();while(wrapper.firstChild)fragment.appendChild(wrapper.firstChild);content=fragment;}var node=b.start.nextSibling;while(node&&node!==b.end){var next=node.nextSibling;node.parentNode&&node.parentNode.removeChild(node);node=next;}parent.insertBefore(content,b.end);tpl.parentNode&&tpl.parentNode.removeChild(tpl);}runtime={apply:apply};window.__FICT_STREAM=runtime;}" + (options.observerMode ?? true ? "if(runtime.observerInstalled)return;runtime.observerInstalled=true;function scan(root){var ids=[];walk(root,function(n){if(n.nodeType===1&&n.localName===\"template\"&&n.content&&n.hasAttribute(\"data-fict-suspense\")){var id=n.getAttribute(\"data-fict-suspense\");if(id)ids.push(id);}});for(var i=0;i<ids.length;i++)runtime.apply(ids[i]);}if(typeof MutationObserver===\"function\"){new MutationObserver(function(muts){for(var i=0;i<muts.length;i++){for(var j=0;j<muts[i].addedNodes.length;j++){var n=muts[i].addedNodes[j];if(n.nodeType===1)scan(n);}}}).observe(document.documentElement||document,{childList:true,subtree:true});}if(document.readyState===\"loading\"){document.addEventListener(\"DOMContentLoaded\",function(){scan(document);},{once:true});}else{scan(document);}" : "") + "})();";
11
- }
12
- const FICT_STREAM_RUNTIME_CODE = createStreamRuntimeCode({ observerMode: true });
13
- //#endregion
14
- exports.FICT_STREAM_RUNTIME_CODE = FICT_STREAM_RUNTIME_CODE;
15
- exports.createStreamRuntimeCode = createStreamRuntimeCode;
@@ -1,20 +0,0 @@
1
- //#region src/stream-runtime.d.ts
2
- interface StreamRuntimeCodeOptions {
3
- /**
4
- * Enable observer mode so patch templates are applied without per-chunk inline scripts.
5
- * Existing template fragments are covered by the initial scan; observation follows
6
- * additions to the document tree made while streamed HTML is parsed.
7
- */
8
- observerMode?: boolean;
9
- }
10
- /**
11
- * Create the browser-side streaming patch runtime as classic-script JavaScript.
12
- *
13
- * The generated package asset `@fictjs/ssr/fict-stream-runtime.js` is built from
14
- * this helper with `observerMode: true`.
15
- */
16
- declare function createStreamRuntimeCode(options?: StreamRuntimeCodeOptions): string;
17
- declare const FICT_STREAM_RUNTIME_CODE: string;
18
- //#endregion
19
- export { FICT_STREAM_RUNTIME_CODE, StreamRuntimeCodeOptions, createStreamRuntimeCode };
20
- //# sourceMappingURL=stream-runtime.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-runtime.d.cts","names":[],"sources":["../src/stream-runtime.ts"],"mappings":";UAAiB,wBAAA;EAAA;;;;AAMH;EAAZ,YAAY;AAAA;;;AASgE;AAsD9E;;;iBAtDgB,uBAAA,CAAwB,OAAsC,GAA7B,wBAA6B;AAAA,cAsDjE,wBAAA"}
@@ -1,20 +0,0 @@
1
- //#region src/stream-runtime.d.ts
2
- interface StreamRuntimeCodeOptions {
3
- /**
4
- * Enable observer mode so patch templates are applied without per-chunk inline scripts.
5
- * Existing template fragments are covered by the initial scan; observation follows
6
- * additions to the document tree made while streamed HTML is parsed.
7
- */
8
- observerMode?: boolean;
9
- }
10
- /**
11
- * Create the browser-side streaming patch runtime as classic-script JavaScript.
12
- *
13
- * The generated package asset `@fictjs/ssr/fict-stream-runtime.js` is built from
14
- * this helper with `observerMode: true`.
15
- */
16
- declare function createStreamRuntimeCode(options?: StreamRuntimeCodeOptions): string;
17
- declare const FICT_STREAM_RUNTIME_CODE: string;
18
- //#endregion
19
- export { FICT_STREAM_RUNTIME_CODE, StreamRuntimeCodeOptions, createStreamRuntimeCode };
20
- //# sourceMappingURL=stream-runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-runtime.d.ts","names":[],"sources":["../src/stream-runtime.ts"],"mappings":";UAAiB,wBAAA;EAAA;;;;AAMH;EAAZ,YAAY;AAAA;;;AASgE;AAsD9E;;;iBAtDgB,uBAAA,CAAwB,OAAsC,GAA7B,wBAA6B;AAAA,cAsDjE,wBAAA"}
@@ -1,15 +0,0 @@
1
- //#region src/stream-runtime.ts
2
- /**
3
- * Create the browser-side streaming patch runtime as classic-script JavaScript.
4
- *
5
- * The generated package asset `@fictjs/ssr/fict-stream-runtime.js` is built from
6
- * this helper with `observerMode: true`.
7
- */
8
- function createStreamRuntimeCode(options = {}) {
9
- return "(function(){var runtime=window.__FICT_STREAM;function walk(root,visit){var stack=[root];while(stack.length){var node=stack.pop();if(visit(node)===false)return false;var container=node.nodeType===1&&node.localName===\"template\"&&node.content?node.content:node;for(var child=container.lastChild;child;child=child.previousSibling)stack.push(child);}return true;}if(!runtime||typeof runtime.apply!==\"function\"){var cache=new Map();function findTemplate(id){var tpl=null;walk(document,function(n){if(n.nodeType===1&&n.localName===\"template\"&&n.content&&n.getAttribute(\"data-fict-suspense\")===id){tpl=n;return false;}});return tpl;}function find(id){var hit=cache.get(id);if(hit)return hit;var startMarker=\"fict:suspense-start:\"+id,endMarker=\"fict:suspense-end:\"+id;walk(document,function(n){if(n.nodeType!==8||n.data!==startMarker)return;var end=n.nextSibling;while(end&&(end.nodeType!==8||end.data!==endMarker))end=end.nextSibling;if(end){hit={start:n,end:end};return false;}});if(hit)cache.set(id,hit);return hit;}function apply(id){if(typeof id!==\"string\"||!id)return;var tpl=findTemplate(id);if(!tpl)return;var b=find(id);if(!b)return;var parent=b.start.parentNode;if(!parent||b.end.parentNode!==parent)return;var cursor=b.start.nextSibling;while(cursor&&cursor!==b.end)cursor=cursor.nextSibling;if(cursor!==b.end)return;var content=tpl.content;var ns=tpl.getAttribute(\"data-fict-patch-namespace\");if(ns){var tag=ns===\"svg\"?\"svg\":ns===\"mathml\"?\"math\":null;var wrapper=content.firstElementChild;if(!tag||!wrapper||wrapper.localName!==tag)return;var fragment=document.createDocumentFragment();while(wrapper.firstChild)fragment.appendChild(wrapper.firstChild);content=fragment;}var node=b.start.nextSibling;while(node&&node!==b.end){var next=node.nextSibling;node.parentNode&&node.parentNode.removeChild(node);node=next;}parent.insertBefore(content,b.end);tpl.parentNode&&tpl.parentNode.removeChild(tpl);}runtime={apply:apply};window.__FICT_STREAM=runtime;}" + (options.observerMode ?? true ? "if(runtime.observerInstalled)return;runtime.observerInstalled=true;function scan(root){var ids=[];walk(root,function(n){if(n.nodeType===1&&n.localName===\"template\"&&n.content&&n.hasAttribute(\"data-fict-suspense\")){var id=n.getAttribute(\"data-fict-suspense\");if(id)ids.push(id);}});for(var i=0;i<ids.length;i++)runtime.apply(ids[i]);}if(typeof MutationObserver===\"function\"){new MutationObserver(function(muts){for(var i=0;i<muts.length;i++){for(var j=0;j<muts[i].addedNodes.length;j++){var n=muts[i].addedNodes[j];if(n.nodeType===1)scan(n);}}}).observe(document.documentElement||document,{childList:true,subtree:true});}if(document.readyState===\"loading\"){document.addEventListener(\"DOMContentLoaded\",function(){scan(document);},{once:true});}else{scan(document);}" : "") + "})();";
10
- }
11
- const FICT_STREAM_RUNTIME_CODE = createStreamRuntimeCode({ observerMode: true });
12
- //#endregion
13
- export { FICT_STREAM_RUNTIME_CODE, createStreamRuntimeCode };
14
-
15
- //# sourceMappingURL=stream-runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-runtime.js","names":[],"sources":["../src/stream-runtime.ts"],"sourcesContent":["export interface StreamRuntimeCodeOptions {\n /**\n * Enable observer mode so patch templates are applied without per-chunk inline scripts.\n * Existing template fragments are covered by the initial scan; observation follows\n * additions to the document tree made while streamed HTML is parsed.\n */\n observerMode?: boolean\n}\n\n/**\n * Create the browser-side streaming patch runtime as classic-script JavaScript.\n *\n * The generated package asset `@fictjs/ssr/fict-stream-runtime.js` is built from\n * this helper with `observerMode: true`.\n */\nexport function createStreamRuntimeCode(options: StreamRuntimeCodeOptions = {}): string {\n const observerMode = options.observerMode ?? true\n return (\n '(function(){' +\n 'var runtime=window.__FICT_STREAM;' +\n 'function walk(root,visit){' +\n 'var stack=[root];while(stack.length){' +\n 'var node=stack.pop();if(visit(node)===false)return false;' +\n 'var container=node.nodeType===1&&node.localName===\"template\"&&node.content?node.content:node;' +\n 'for(var child=container.lastChild;child;child=child.previousSibling)stack.push(child);' +\n '}return true;' +\n '}' +\n 'if(!runtime||typeof runtime.apply!==\"function\"){' +\n 'var cache=new Map();' +\n 'function findTemplate(id){' +\n 'var tpl=null;walk(document,function(n){' +\n 'if(n.nodeType===1&&n.localName===\"template\"&&n.content&&n.getAttribute(\"data-fict-suspense\")===id){tpl=n;return false;}' +\n '});return tpl;' +\n '}' +\n 'function find(id){' +\n 'var hit=cache.get(id);if(hit)return hit;' +\n 'var startMarker=\"fict:suspense-start:\"+id,endMarker=\"fict:suspense-end:\"+id;' +\n 'walk(document,function(n){' +\n 'if(n.nodeType!==8||n.data!==startMarker)return;' +\n 'var end=n.nextSibling;while(end&&(end.nodeType!==8||end.data!==endMarker))end=end.nextSibling;' +\n 'if(end){hit={start:n,end:end};return false;}' +\n '});' +\n 'if(hit)cache.set(id,hit);return hit;' +\n '}' +\n 'function apply(id){' +\n 'if(typeof id!==\"string\"||!id)return;' +\n 'var tpl=findTemplate(id);if(!tpl)return;' +\n 'var b=find(id);if(!b)return;' +\n 'var parent=b.start.parentNode;if(!parent||b.end.parentNode!==parent)return;' +\n 'var cursor=b.start.nextSibling;while(cursor&&cursor!==b.end)cursor=cursor.nextSibling;if(cursor!==b.end)return;' +\n 'var content=tpl.content;var ns=tpl.getAttribute(\"data-fict-patch-namespace\");' +\n 'if(ns){var tag=ns===\"svg\"?\"svg\":ns===\"mathml\"?\"math\":null;var wrapper=content.firstElementChild;if(!tag||!wrapper||wrapper.localName!==tag)return;var fragment=document.createDocumentFragment();while(wrapper.firstChild)fragment.appendChild(wrapper.firstChild);content=fragment;}' +\n 'var node=b.start.nextSibling;' +\n 'while(node&&node!==b.end){var next=node.nextSibling;node.parentNode&&node.parentNode.removeChild(node);node=next;}' +\n 'parent.insertBefore(content,b.end);' +\n 'tpl.parentNode&&tpl.parentNode.removeChild(tpl);' +\n '}' +\n 'runtime={apply:apply};window.__FICT_STREAM=runtime;' +\n '}' +\n (observerMode\n ? 'if(runtime.observerInstalled)return;runtime.observerInstalled=true;' +\n 'function scan(root){var ids=[];walk(root,function(n){if(n.nodeType===1&&n.localName===\"template\"&&n.content&&n.hasAttribute(\"data-fict-suspense\")){var id=n.getAttribute(\"data-fict-suspense\");if(id)ids.push(id);}});for(var i=0;i<ids.length;i++)runtime.apply(ids[i]);}' +\n 'if(typeof MutationObserver===\"function\"){new MutationObserver(function(muts){for(var i=0;i<muts.length;i++){for(var j=0;j<muts[i].addedNodes.length;j++){var n=muts[i].addedNodes[j];if(n.nodeType===1)scan(n);}}}).observe(document.documentElement||document,{childList:true,subtree:true});}' +\n 'if(document.readyState===\"loading\"){document.addEventListener(\"DOMContentLoaded\",function(){scan(document);},{once:true});}else{scan(document);}'\n : '') +\n '})();'\n )\n}\n\nexport const FICT_STREAM_RUNTIME_CODE = createStreamRuntimeCode({ observerMode: true })\n"],"mappings":";;;;;;;AAeA,SAAgB,wBAAwB,UAAoC,CAAC,GAAW;CAEtF,OACE,87DAFmB,QAAQ,gBAAgB,OA4CvC,6wBAIA,MACJ;AAEJ;AAEA,MAAa,2BAA2B,wBAAwB,EAAE,cAAc,KAAK,CAAC"}