@solidjs/web 2.0.0-rc.6 → 2.0.0-rc.8

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.
Files changed (82) hide show
  1. package/dist/{server.cjs → server.dev.js} +274 -272
  2. package/dist/server.js +119 -36
  3. package/dist/{dev.js → web.dev.js} +131 -399
  4. package/dist/web.js +78 -388
  5. package/dist/{web.cjs → web.observe.js} +174 -622
  6. package/frames/dist/client.dev.js +11 -3
  7. package/frames/dist/client.js +11 -3
  8. package/frames/dist/{server.cjs → server.dev.js} +375 -125
  9. package/frames/dist/server.js +253 -32
  10. package/frames/package.json +7 -15
  11. package/package.json +88 -251
  12. package/serialization/decode/package.json +3 -9
  13. package/serialization/dist/decode.js +18 -4
  14. package/serialization/dist/serialization.js +18 -4
  15. package/serialization/package.json +3 -9
  16. package/serialization/types/serializer-decode.d.ts +49 -2
  17. package/server-functions/dist/client.js +13 -14
  18. package/server-functions/dist/server.dev.js +359 -85
  19. package/server-functions/dist/server.js +352 -86
  20. package/server-functions/package.json +6 -24
  21. package/server-functions/rich-args/package.json +3 -9
  22. package/storage/package.json +3 -9
  23. package/types/client.d.ts +17 -3
  24. package/types/frames/frame-client.d.ts +1 -1
  25. package/types/frames/serializer-decode.d.ts +49 -2
  26. package/types/head.d.ts +3 -0
  27. package/types/index.d.ts +18 -7
  28. package/types/index.server.d.ts +31 -9
  29. package/types/render.d.ts +3 -1
  30. package/types/serializer-decode.d.ts +49 -2
  31. package/types/server-functions/flash.d.ts +12 -3
  32. package/types/server-functions/server.d.ts +50 -3
  33. package/types/server-mock.d.ts +43 -7
  34. package/types/server.d.ts +48 -6
  35. package/dist/dev.cjs +0 -2590
  36. package/frames/dist/client.cjs +0 -2035
  37. package/frames/dist/client.dev.cjs +0 -2055
  38. package/serialization/dist/decode.cjs +0 -141
  39. package/serialization/dist/serialization.cjs +0 -261
  40. package/serialization/types-cjs/index.d.cts +0 -101
  41. package/serialization/types-cjs/package.json +0 -3
  42. package/serialization/types-cjs/serializer-decode.d.cts +0 -172
  43. package/serialization/types-cjs/serializer.d.cts +0 -101
  44. package/server-functions/dist/client.cjs +0 -1070
  45. package/server-functions/dist/rich-args.cjs +0 -11
  46. package/server-functions/dist/server.cjs +0 -2133
  47. package/server-functions/dist/server.dev.cjs +0 -2153
  48. package/storage/dist/storage.cjs +0 -12
  49. package/storage/types-cjs/index.d.cts +0 -28
  50. package/storage/types-cjs/package.json +0 -3
  51. package/types/patch-driver.d.ts +0 -3
  52. package/types-cjs/client.d.cts +0 -200
  53. package/types-cjs/constants.d.cts +0 -20
  54. package/types-cjs/cookies.d.cts +0 -41
  55. package/types-cjs/frames/client.d.cts +0 -36
  56. package/types-cjs/frames/frame-client.d.cts +0 -370
  57. package/types-cjs/frames/frame-container-plugin.d.cts +0 -71
  58. package/types-cjs/frames/frame-sink.d.cts +0 -92
  59. package/types-cjs/frames/frame-transport.d.cts +0 -189
  60. package/types-cjs/frames/serializer-decode.d.cts +0 -172
  61. package/types-cjs/frames/serializer.d.cts +0 -101
  62. package/types-cjs/frames/server.d.cts +0 -52
  63. package/types-cjs/head.d.cts +0 -16
  64. package/types-cjs/index.d.cts +0 -180
  65. package/types-cjs/index.server.d.cts +0 -125
  66. package/types-cjs/jsx-properties.d.cts +0 -93
  67. package/types-cjs/jsx.d.cts +0 -4146
  68. package/types-cjs/package.json +0 -3
  69. package/types-cjs/patch-driver.d.cts +0 -3
  70. package/types-cjs/reconcile.d.cts +0 -1
  71. package/types-cjs/render.d.cts +0 -4
  72. package/types-cjs/response.d.cts +0 -81
  73. package/types-cjs/serializer-decode.d.cts +0 -172
  74. package/types-cjs/serializer.d.cts +0 -101
  75. package/types-cjs/server-functions/client.d.cts +0 -184
  76. package/types-cjs/server-functions/flash.d.cts +0 -27
  77. package/types-cjs/server-functions/registry.d.cts +0 -100
  78. package/types-cjs/server-functions/rich-args.d.cts +0 -1
  79. package/types-cjs/server-functions/server.d.cts +0 -522
  80. package/types-cjs/server-functions/shared.d.cts +0 -283
  81. package/types-cjs/server-mock.d.cts +0 -301
  82. package/types-cjs/server.d.cts +0 -366
@@ -1,370 +0,0 @@
1
- /**
2
- * Client frame runtime — the consumer side of a frame stream. A frame
3
- * renders server-owned content into a DOM boundary from a resident keyed
4
- * record store: chunks are writes, not events, so application is
5
- * prerequisite-driven and order-independent. Client-owned slot ranges
6
- * inside the boundary are preserved across server updates — the
7
- * version is a stale-guard only ("policy A"): newer content morphs in
8
- * place, and teardown is `dispose()`, never a version bump.
9
- *
10
- * EXPERIMENTAL — the frames/server-components surface ships as an
11
- * experimental preview, excluded from the 2.0 stability guarantee: API
12
- * shapes and the wire format may change between prereleases (RFC 11).
13
- * Every export in this module is `@experimental`.
14
- */
15
- /**
16
- * One transport chunk of a frame stream, addressed by frame `id`.
17
- * @experimental
18
- */
19
- export type FrameChunk = {
20
- type: "start";
21
- id: string;
22
- version: number;
23
- } | {
24
- type: "html";
25
- id: string;
26
- version: number;
27
- html: string;
28
- } | {
29
- type: "fragment";
30
- id: string;
31
- version: number;
32
- key: string;
33
- html: string;
34
- } | {
35
- type: "reveal";
36
- id: string;
37
- version: number;
38
- keys: string[];
39
- waitForStyles?: boolean;
40
- fallback?: boolean;
41
- } | {
42
- type: "data";
43
- id: string;
44
- version: number;
45
- key?: string;
46
- node?: unknown;
47
- initial?: boolean;
48
- /** Eval-style hydration script — only when produced with the hydration serializer. */
49
- payload?: string;
50
- } | {
51
- type: "assets";
52
- id: string;
53
- version: number;
54
- key: string;
55
- modules?: string[];
56
- styles?: string[];
57
- inlineStyles?: {
58
- id: string;
59
- content?: string;
60
- attrs?: Record<string, string>;
61
- }[];
62
- preloads?: {
63
- href: string;
64
- attrs: Record<string, string>;
65
- }[];
66
- } | {
67
- type: "slot";
68
- id: string;
69
- version: number;
70
- key: string;
71
- args: Record<string, unknown>;
72
- } | {
73
- type: "complete";
74
- id: string;
75
- version: number;
76
- } | {
77
- type: "error";
78
- id: string;
79
- version: number;
80
- key?: string;
81
- error: unknown;
82
- };
83
- /**
84
- * One store write applied to a frame: `r` maps record keys to values
85
- * (`chunkToRecords` produces these from wire chunks) and `version` is the
86
- * stream stamp — an older version than the frame's current one is ignored.
87
- * @experimental
88
- */
89
- export interface FrameWrite {
90
- version: number;
91
- r: Record<string, unknown>;
92
- }
93
- /**
94
- * Context passed to a slot callback.
95
- * @experimental
96
- */
97
- export interface SlotContext {
98
- /**
99
- * True only for the hydration-attach invocation of an adopted
100
- * document-SSR range — the one call a consumer may answer with a claim
101
- * (`existing` IS the server-rendered output for these args). Unset on
102
- * stream-driven re-calls: those must render for real, or content the
103
- * re-call displaced (e.g. `{$frame}` region ranges) is dropped.
104
- */
105
- adopted?: boolean;
106
- /**
107
- * Whether this occurrence is a render-prop CALL (the producer placed it
108
- * with arguments — possibly empty — via a slot record) as opposed to a
109
- * direct-insert position. Consumers cannot tell from the resolved props
110
- * alone: an argless render prop and a direct insert both arrive as `{}`,
111
- * but one is a function to invoke and the other a value to place.
112
- */
113
- invoked?: boolean;
114
- /**
115
- * Register cleanup for when this occurrence's range is removed from the
116
- * server content, or the owning frame is disposed.
117
- */
118
- onCleanup(fn: () => void): void;
119
- /**
120
- * Live-props opt-in: a binding that registers here receives the
121
- * re-resolved props when a re-sent record's args CHANGE in value, instead
122
- * of the occurrence being re-called — the invocation's instance (and its
123
- * client state) survives the change. Register synchronously during the
124
- * invocation; one updater per occurrence (last registration wins). A
125
- * genuine re-call or unmount clears it before/with the binding it served.
126
- */
127
- onUpdate(fn: (props: Record<string, unknown>) => void): void;
128
- /**
129
- * The range's current interior — server-rendered client content on an
130
- * adopted document-SSR boot, or the previous output on a re-call. A
131
- * framework binding hydrates onto it and returns `undefined` to claim it
132
- * in place (zero DOM mutation).
133
- */
134
- existing: ChildNode[];
135
- /**
136
- * The range's own marker comments, when the occurrence has a placed range.
137
- * A framework binding whose slot content is reactive at the top level (a
138
- * boundary accessor, changing route children) owns the interior instead of
139
- * returning nodes: bind before `end` with the framework's insert primitive
140
- * and return `undefined` — the frame leaves the range alone (server morphs
141
- * already protect slot ranges).
142
- */
143
- range?: {
144
- start: Comment;
145
- end: Comment;
146
- };
147
- }
148
- /**
149
- * Client content for a server-declared slot. Direct-insert occurrences
150
- * call it with empty props; render-prop occurrences pass the occurrence's
151
- * resolved args (primitives literal, `{$ref}` data resolved through the
152
- * host, `{$frame}` regions as marker-range fragments). Return nodes to fill
153
- * the range, or `undefined` to claim `ctx.existing` untouched.
154
- * @experimental
155
- */
156
- export type Slot = (props: Record<string, unknown>, ctx: SlotContext) => Node | Node[] | undefined;
157
- /** @experimental */
158
- export interface Frame {
159
- /** Merge a write into the store and flush (morph/reveal/slot sync). */
160
- apply(write: FrameWrite): void;
161
- /** The active version, or undefined before the first apply. */
162
- readonly version: number | undefined;
163
- /** Read-only view of the resident record store. */
164
- readonly store: Readonly<Record<string, unknown>>;
165
- /** The stream's error record, if an `error` chunk arrived. */
166
- readonly error: unknown;
167
- /** Whether the named fragment has been revealed into the boundary. */
168
- isRevealed(segment: string): boolean;
169
- /**
170
- * Re-key this live frame to a different boundary id (the mount-preserving
171
- * half of a call-site handoff): nothing tears down — the element, store,
172
- * and slot state stay — while leaving the old id stashes a retention
173
- * snapshot under it and joining the new id seeds/drains its retained
174
- * store and buffered chunks. Version affinity resets: histories are per
175
- * boundary id.
176
- */
177
- rebind(id: string): void;
178
- /**
179
- * Forget the version baseline without touching content — the next write
180
- * is accepted whatever its number. Called by the host after seeding a
181
- * registration from a retained snapshot, whose numbering belongs to a
182
- * different stream space.
183
- */
184
- rebase(): void;
185
- /** Tear down: slot cleanups cascade, later chunks are ignored. Idempotent. */
186
- dispose(): void;
187
- }
188
- /**
189
- * Routes a flat stream of addressed chunks to frames by id, buffering chunks
190
- * for frames that have not registered yet (only the newest version's chunks
191
- * are kept). `data` chunks are response-scoped and go to `applyData`.
192
- *
193
- * An id may have several frames (the same server component mounted more
194
- * than once): chunks fan out to all of them, and a frame registering after
195
- * delivery is seeded from a sibling's store.
196
- * @experimental
197
- */
198
- export interface FrameHost {
199
- register(id: string, frame: Frame): void;
200
- /** Remove one frame (or all frames of the id when `frame` is omitted). */
201
- unregister(id: string, frame?: Frame): void;
202
- apply(chunk: FrameChunk): void;
203
- /** The first registered frame under the id, if any. */
204
- get(id: string): Frame | undefined;
205
- serialize(value: unknown): {
206
- $ref: string;
207
- };
208
- /** `frameId` is the resolving frame's id — route to its stream's table. */
209
- resolve(ref: {
210
- $ref: string;
211
- }, frameId?: string): unknown;
212
- /** See FrameHostOptions.revive. */
213
- revive?(value: unknown): unknown;
214
- /** See FrameHostOptions.isContainer. */
215
- isContainer?(value: unknown): boolean;
216
- }
217
- /**
218
- * Options for `createFrameHost`.
219
- * @experimental
220
- */
221
- export interface FrameHostOptions {
222
- /**
223
- * Backs `{$ref}` slot args (typically a codec data table's `resolve`).
224
- * `frameId` identifies the resolving frame — data tables are
225
- * response-scoped, so multi-stream hosts route by it (nested region ids
226
- * prefix-match their root).
227
- */
228
- resolve?(ref: {
229
- $ref: string;
230
- }, frameId?: string): unknown;
231
- /** Test/host-side counterpart of `resolve`. */
232
- serialize?(value: unknown): {
233
- $ref: string;
234
- };
235
- /**
236
- * Receives each `data` chunk whole. Wire a codec table:
237
- * `applyData: c => table.apply(c)` (see `createJSONDataTable`).
238
- */
239
- applyData?(chunk: Extract<FrameChunk, {
240
- type: "data";
241
- }>): void;
242
- /**
243
- * A lazily-loaded deserializer's load, awaited by the transport before it
244
- * delivers a `data` chunk — `applyData`/`resolve` can assume the codec is
245
- * resident once data has arrived. Keeps codec weight out of the eager
246
- * client graph for responses that never carry serialized data.
247
- */
248
- prepareData?(): Promise<unknown>;
249
- /**
250
- * Revive protocol markers inside LITERAL slot args (values that are
251
- * neither `{$ref}` nor `{$frame}`) at arg-resolution time. Document-face
252
- * container traces ride this way — inline in the record, revived by the
253
- * integration (`reviveContainerTraces`) into live local containers.
254
- */
255
- revive?(value: unknown): unknown;
256
- /**
257
- * Whether a resolved arg value is a LIVE CONTAINER (a materialized trace —
258
- * see `isMaterializedContainer`). The record-dedupe compare must know: a
259
- * pending container's property reads throw not-ready, so async probes and
260
- * serialization compares would detonate it. Containers compare by
261
- * identity only.
262
- */
263
- isContainer?(value: unknown): boolean;
264
- /**
265
- * Arms event types for behavior claims: the `_bnd` sweep collects the
266
- * event names it finds and hands them here so delegated dispatch can
267
- * reach them. Platform glue passes its `delegateEvents` — the option
268
- * exists (rather than client.js importing the event system) so
269
- * tree-shaken subsets without events pay nothing. Frames registered
270
- * with this host inherit it unless they pass their own `delegate`.
271
- */
272
- delegate?(eventNames: Iterable<string>): void;
273
- }
274
- /**
275
- * Options for `createFrame` / `createFrameElement`.
276
- * @experimental
277
- */
278
- export interface FrameOptions {
279
- /** Register with this host under `id`, receiving routed/buffered chunks. */
280
- host?: FrameHost;
281
- id?: string;
282
- /** Client content keyed by prop name (occurrences resolve by prop). */
283
- slots?: Record<string, Slot>;
284
- /**
285
- * Raw client props for behavior-claim resolution: server elements carrying
286
- * `_bnd="pos=prop"` markers (compiled under the `serverComponents` option)
287
- * resolve ref/event positions by name through this object — read live at
288
- * dispatch/materialize time, so compiled prop getters stay latest-value.
289
- */
290
- props?: Record<string, unknown>;
291
- /**
292
- * Adopt existing server-rendered DOM: the first apply morphs against it,
293
- * and slots sync immediately (hydration attach) — a document-SSR boot
294
- * needs no chunk.
295
- */
296
- adopt?: boolean;
297
- /** Called after each apply flush (tests/telemetry). */
298
- onApply?(info: {
299
- version: number;
300
- reason: "materialize" | "morph" | "reveal" | "error";
301
- }): void;
302
- /**
303
- * Wraps element-claim sweeps (`a[href]`/`form[action]` in materialized
304
- * server content — and only those) so claim consumers register their
305
- * per-element cleanup against the boundary's reactive owner, e.g.
306
- * `fn => runWithOwner(owner, fn)`. Nested region frames inherit it.
307
- * Without it, sweeps run under whatever owner is current (none, for
308
- * streamed chunks).
309
- */
310
- ownerScope?<T>(fn: () => T): T;
311
- /** Per-frame override of the host's `delegate` (see FrameHostOptions). */
312
- delegate?(eventNames: Iterable<string>): void;
313
- /**
314
- * Boundary-driven segment reveal. When present, `#revealSegment` hands the
315
- * placeholder seam to this hook instead of swapping imperatively: the binding
316
- * reconstructs a client `<Loading>` there — `fallback` is the placeholder's
317
- * own template content (shown while holding), `content()` materializes the
318
- * segment and renders its client fills INSIDE the boundary so their readiness
319
- * gates the reveal — and inserts it before `before`. An unboundaried async
320
- * fill suspends up to that boundary and is covered instead of orphaned; one
321
- * boundary per revealed segment, i.e. per author-placed `<Loading>`. Omit it
322
- * for the framework-agnostic imperative swap (no reactive reveal).
323
- */
324
- reveal?(seam: {
325
- before: Node;
326
- fallback: Node[];
327
- content: () => Node | DocumentFragment;
328
- }): void;
329
- /**
330
- * Document-face record-race guard (adopt path only — solidjs/solid#2968).
331
- * Nothing on the wire formally orders an occurrence's args-record data
332
- * script before the event that triggers adoption, so a recordless
333
- * occurrence is ambiguous while this returns true: the frame defers its
334
- * mount one macrotask (all currently parsed scripts run first), calls
335
- * `drainRecords`, and classifies with whatever is then resolvable. Return
336
- * false once the document can run no further data scripts.
337
- */
338
- recordsPending?(): boolean;
339
- /** Re-absorb the document's arrived-by-now records (idempotent per key). */
340
- drainRecords?(): void;
341
- }
342
- export declare function chunkToRecords(chunk: FrameChunk): Record<string, unknown>;
343
- export declare function createFrameHost(options?: FrameHostOptions): FrameHost;
344
- /**
345
- * The bubbling DOM event a frame dispatches from its parent element after
346
- * server content lands in the document (root materialize/morph, segment
347
- * reveal, fallback materialization) — `detail: { id, version, reason }`.
348
- * Document-level listeners (router affordance reflection, scroll
349
- * restoration) react to server-driven DOM changes without a
350
- * MutationObserver; nested region frames dispatch too and the event
351
- * bubbles, so one listener sees every boundary. Client-side renders never
352
- * fire it — client code has reactivity to subscribe with.
353
- */
354
- export declare const FRAME_APPLIED_EVENT = "frame:applied";
355
- export declare function createFrame(boundary: Element, options?: FrameOptions): Frame;
356
- export declare const FRAME_TAG = "solid-frame";
357
- export declare const FRAME_ID_ATTR = "data-fid"; /**
358
- * Create a boundary/region ELEMENT and bind a host-registered frame to it.
359
- * The frame mounts INTO the element (server content is its children, morphed
360
- * in place). Because the boundary is a real node, `insert` places the
361
- * returned `element` in any position — single, array, or fragment — with no
362
- * special-casing. One frame per element; lifecycle belongs to the creator via
363
- * `dispose()` (register it with your owner's cleanup).
364
- * @experimental
365
- */
366
- export declare function createFrameElement(options: FrameOptions): {
367
- readonly element: Element;
368
- readonly frame: Frame;
369
- dispose(): void;
370
- };
@@ -1,71 +0,0 @@
1
- /**
2
- * The container tier at the slot border: reactive containers (projections)
3
- * cross serialization boundaries as TRACES — an async iterable whose first
4
- * yield is a full state snapshot and whose later yields are patch batches —
5
- * and materialize back into live local containers. Renderer-agnostic glue;
6
- * the reactive core injects both halves. See frame-container-plugin.js.
7
- * @experimental
8
- */
9
- /** A container's border serialization: one subscribe() per consumer. */
10
- export interface ContainerTrace {
11
- subscribe(): AsyncIterable<any>;
12
- /** Whether the container's root is an array — the consumer's seed shape. */
13
- array: boolean;
14
- }
15
- /** The eval-face wire literal a trace decodes to before materialization. */
16
- export interface ContainerTraceMarker {
17
- $tr: AsyncIterable<any>;
18
- $ta?: number;
19
- }
20
- export declare function setContainerTraceResolver(fn: (value: unknown) => ContainerTrace | undefined): void;
21
- export declare function setContainerTraceMaterializer(fn: (marker: ContainerTraceMarker) => unknown): void;
22
- /**
23
- * Serializer half: install the async-iterable → raw-seroval-stream mint
24
- * (serializer-decode.js, which already carries seroval — this module must
25
- * stay seroval-free because it also rides the EAGER frames-client graph,
26
- * and seroval ships without `sideEffects: false`).
27
- *
28
- * Why a raw stream and not the iterable itself: seroval decodes an async
29
- * iterable as a generator WRAPPER over its internal stream, so every
30
- * buffered value is microtasks away — but hydration's claim walk is
31
- * SYNCHRONOUS. A trace whose snapshot the document already delivered must
32
- * read as ready DURING the walk (every other async source has a sync
33
- * hydration answer: promise stamps, serialized records), or the consuming
34
- * boundary renders a phantom fallback over settled markup (the chat
35
- * welcome/status meter miss). A raw stream decodes as the stream object
36
- * itself, whose `.on()` replays the buffer synchronously at subscribe.
37
- */
38
- export declare function setContainerTraceStreamMint(fn: any): void; /** Whether a value is a traced container (server side; WeakMap probe, trap-safe). */
39
- export declare function isContainerTraced(value: unknown): boolean;
40
- export declare function envelopeContainerTraces(value: unknown): unknown;
41
- export declare function isMaterializedContainer(value: unknown): boolean;
42
- export declare function isContainerTraceMarker(value: unknown): value is ContainerTraceMarker;
43
- export declare function reviveContainerTraces(value: unknown): unknown;
44
- declare function parseTrace(value: any, ctx: any): {
45
- a: number;
46
- i: any;
47
- };
48
- /**
49
- * Seroval plugin carrying reactive containers across the slot border as
50
- * traces. Part of the codec's DEFAULT plugin set (serializer-decode.js), so
51
- * every face — the hydration serializer, the frames codec, flight
52
- * payloads, the client data tables — carries it with nothing to wire, and
53
- * its weight lives in the (lazy) codec graph, never the eager client.
54
- *
55
- * @type {import("seroval").Plugin<object, { a: number, i: any }>}
56
- */
57
- export declare const ContainerTracePlugin: {
58
- tag: string;
59
- test(value: any): boolean;
60
- parse: {
61
- sync(): never;
62
- async(value: any, ctx: any): Promise<{
63
- a: number;
64
- i: any;
65
- }>;
66
- stream: typeof parseTrace;
67
- };
68
- serialize(node: any, ctx: any): string;
69
- deserialize(node: any, ctx: any): any;
70
- };
71
- export {};
@@ -1,92 +0,0 @@
1
- import { FrameChunk } from "./frame-client.cjs";
2
- /**
3
- * Addresses a frame stream: the boundary id and this response's version.
4
- * @experimental
5
- */
6
- export interface FrameAddress {
7
- id: string;
8
- version: number;
9
- }
10
- /**
11
- * Options shared by the frame producers.
12
- * @experimental
13
- */
14
- export interface FrameStreamOptions {
15
- /** Boundary address; defaults to `{ id: "", version: 1 }`. */
16
- frame?: {
17
- id?: string;
18
- version?: number;
19
- };
20
- /** Remaining `renderToStream` options (plugins, onError, manifest, ...). */
21
- [key: string]: unknown;
22
- }
23
- /**
24
- * A produced frame stream: pipe chunks, or await the collected array.
25
- * @experimental
26
- */
27
- export interface FrameStream extends PromiseLike<FrameChunk[]> {
28
- pipe(writable: {
29
- write(chunk: FrameChunk): void;
30
- end?(): void;
31
- }): void;
32
- }
33
- export { SERVER_COMPONENT, SERVER_COMPONENT_SOURCE, SERVER_COMPONENT_ADDRESS, ServerComponentPlugin } from "./frame-transport.cjs";
34
- /**
35
- * Statement form of the registry bootstrap, for a document shell that wants
36
- * to install `_$SC` ahead of every data script (e.g. a plugin injecting it
37
- * into `<head>`). No longer required — serialized references self-bootstrap
38
- * — but kept for integrations still emitting it; the idempotent form makes
39
- * the double-definition harmless. Never splice it before the authored
40
- * `<head>` elements: a head-open script claims as the first walked child at
41
- * hydration and drifts every positional claim after it.
42
- */
43
- export declare const SERVER_COMPONENT_BOOTSTRAP: string; /**
44
- * The emission surface `renderToStream` routes through when producing a
45
- * frame stream instead of a document (see the `sink` render option). Each
46
- * method emits transport-agnostic chunks; `emit` is the envelope boundary.
47
- * @internal Compiler/renderer wiring — use `renderToFrameStream` or
48
- * `renderServerComponent` instead.
49
- * @experimental
50
- */
51
- export declare function createFrameSink(emit: (chunk: FrameChunk) => void, frame: FrameAddress): Record<string, (...args: any[]) => void>;
52
- export declare function renderToFrameStream(code: () => unknown, options?: FrameStreamOptions): FrameStream;
53
- export declare function renderServerComponent(component: (props: Record<string, any>) => unknown, options?: FrameStreamOptions): FrameStream;
54
- /**
55
- * Document-mode slot props — the t = 0 counterpart of
56
- * `createSlotProps`: the server component renders INLINE in the
57
- * document and the client's real props render server-side inside its
58
- * positions (the one hydration-time exception), wrapped in the same marker
59
- * dialect the chunk producer emits so the adopting client binds slots and
60
- * regions onto the server-rendered ranges.
61
- * @experimental
62
- */
63
- export declare function createDocumentSlotProps(clientProps: Record<string, unknown>, frameId: string): Record<string, unknown>;
64
- export declare function frameTransformDirectResult<T>(value: T, options: {
65
- id: string;
66
- args?: unknown[];
67
- }): T;
68
- export declare function createSlotProps(sink: ReturnType<typeof createFrameSink>, frame: FrameAddress): Record<string, any>;
69
- export declare function serverComponentResponse(component: (props: Record<string, any>) => unknown, options?: FrameStreamOptions, init?: {
70
- headers?: HeadersInit;
71
- status?: number;
72
- }): Response;
73
- export declare function frameTransformResult(event: unknown, result: unknown): unknown;
74
- export declare function frameTransformFlightResult(event: unknown, outcome: {
75
- value: unknown;
76
- data: unknown;
77
- }, context?: unknown): Promise<Response | undefined>;
78
- /**
79
- * A framed response carrying several frames and a single-flight outcome:
80
- * each frame's chunks in order (the host routes and buffers by id), then the
81
- * `{ value, data }` envelope as `outcome` chunks.
82
- *
83
- * Those chunks carry the codec's own nodes, one per chunk, so async values
84
- * inside flight data settle progressively exactly as they do in a plain
85
- * single-flight body — the consumer replays them into the same decoder.
86
- */
87
- export declare function frameFlightResponse({ primary, regions, outcome, codec }: {
88
- primary: any;
89
- regions?: any[];
90
- outcome: any;
91
- codec: any;
92
- }, init?: {}): Response;