@solidjs/web 2.0.0-rc.20 → 2.0.0-rc.22

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 (36) hide show
  1. package/dist/server.dev.js +521 -280
  2. package/dist/server.js +518 -279
  3. package/dist/server.observe.js +518 -279
  4. package/dist/web.dev.js +142 -106
  5. package/dist/web.js +120 -105
  6. package/dist/web.observe.js +120 -105
  7. package/frames/dist/client.dev.js +7 -2
  8. package/frames/dist/client.js +7 -2
  9. package/frames/dist/client.observe.js +7 -2
  10. package/frames/dist/server.dev.js +124 -68
  11. package/frames/dist/server.js +124 -68
  12. package/frames/dist/server.observe.js +124 -68
  13. package/frames/dist/wire.js +1 -1
  14. package/package.json +2 -2
  15. package/serialization/dist/serialization.js +53 -12
  16. package/serialization/types/index.d.ts +42 -0
  17. package/serialization/types/serializer.d.ts +42 -0
  18. package/server-functions/dist/client.dev.js +5 -3
  19. package/server-functions/dist/client.js +5 -3
  20. package/server-functions/dist/client.observe.js +5 -3
  21. package/server-functions/dist/rich-args.js +27 -9
  22. package/server-functions/dist/server.dev.js +122 -36
  23. package/server-functions/dist/server.js +122 -36
  24. package/server-functions/dist/server.observe.js +122 -36
  25. package/types/client.d.ts +54 -3
  26. package/types/constants.d.ts +2 -1
  27. package/types/frames/frame-client.d.ts +2 -0
  28. package/types/frames/serializer.d.ts +42 -0
  29. package/types/frames/tree-rewrite.d.ts +7 -0
  30. package/types/serializer.d.ts +42 -0
  31. package/types/server-functions/client.d.ts +0 -1
  32. package/types/server-functions/server.d.ts +0 -1
  33. package/types/server-functions/shared.d.ts +3 -2
  34. package/types/server-functions/uploads.d.ts +3 -0
  35. package/types/server-mock.d.ts +35 -8
  36. package/types/server.d.ts +89 -18
@@ -1331,7 +1331,19 @@ function createUploadDeserializer(form) {
1331
1331
  if (typeof index !== "number" || !Number.isSafeInteger(index) || index < 0) refuse();
1332
1332
  const part = form.get(UPLOAD_FILE_PART + index);
1333
1333
  if (!isBlob(part)) refuse();
1334
- return part;
1334
+ if (node.t === undefined) return part;
1335
+ const type = ctx.deserialize(node.t);
1336
+ if (typeof type !== "string") refuse();
1337
+ if (node.n === undefined) return new Blob([part], {
1338
+ type
1339
+ });
1340
+ const name = ctx.deserialize(node.n);
1341
+ const lastModified = node.l === undefined ? undefined : ctx.deserialize(node.l);
1342
+ if (typeof name !== "string" || typeof lastModified !== "number") refuse();
1343
+ return new File([part], name, {
1344
+ type,
1345
+ lastModified
1346
+ });
1335
1347
  }
1336
1348
  };
1337
1349
  }
@@ -1429,59 +1441,124 @@ function scopeDeferredResult(value, scope) {
1429
1441
  return scopeDeferredContents(value, scope);
1430
1442
  }
1431
1443
  class ScopeFrame {
1432
- constructor(value, prototype, keys, descriptors) {
1444
+ constructor(value, prototype, keys, i, first) {
1433
1445
  this.value = value;
1434
1446
  this.prototype = prototype;
1435
1447
  this.next = null;
1436
1448
  this.keys = keys;
1437
- this.descriptors = descriptors;
1438
- this.i = 0;
1449
+ this.i = i;
1450
+ this.first = first;
1451
+ this.descriptors = null;
1452
+ this.snapshotted = false;
1439
1453
  this.changed = false;
1440
1454
  }
1441
1455
  }
1442
1456
  function frameShell(frame) {
1443
- return frame.next ??= frame.keys ? Object.create(frame.prototype, frame.descriptors) : frame.value.slice();
1457
+ return frame.next ??= frame.keys ? Object.create(frame.prototype, frame.descriptors ?? Object.getOwnPropertyDescriptors(frame.value)) : frame.value.slice();
1458
+ }
1459
+ function writableValue(descriptor) {
1460
+ return descriptor !== undefined && "value" in descriptor && descriptor.writable === true ? descriptor.value : undefined;
1461
+ }
1462
+ function carrierSlot(frame, key) {
1463
+ return writableValue(frame.descriptors ? frame.descriptors[key] : Object.getOwnPropertyDescriptor(frame.value, key));
1464
+ }
1465
+ function snapshotFrames(stack) {
1466
+ for (let k = stack.length - 1; k >= 0 && !stack[k].snapshotted; k--) {
1467
+ const frame = stack[k];
1468
+ frame.snapshotted = true;
1469
+ if (frame.keys) frame.descriptors = Object.getOwnPropertyDescriptors(frame.value);
1470
+ }
1471
+ }
1472
+ function isLeaf(value) {
1473
+ return value === null || typeof value !== "object" && typeof value !== "function";
1474
+ }
1475
+ function sharedPrototypesInert() {
1476
+ const {
1477
+ toStringTag,
1478
+ asyncIterator,
1479
+ iterator,
1480
+ hasInstance
1481
+ } = Symbol;
1482
+ return !(Object.hasOwn(Promise, hasInstance) || typeof ReadableStream !== "undefined" && Object.hasOwn(ReadableStream, hasInstance) || Object.hasOwn(Object.prototype, toStringTag) || Object.hasOwn(Object.prototype, asyncIterator) || Object.hasOwn(Object.prototype, iterator) || Object.hasOwn(Array.prototype, toStringTag) || Object.hasOwn(Array.prototype, asyncIterator));
1483
+ }
1484
+ function isInertCarrier(value, prototype, isArray) {
1485
+ const {
1486
+ toStringTag,
1487
+ asyncIterator,
1488
+ iterator
1489
+ } = Symbol;
1490
+ return (isArray ? prototype === Array.prototype : prototype === Object.prototype || prototype === null) && !Object.hasOwn(value, toStringTag) && !Object.hasOwn(value, asyncIterator) && (isArray || !Object.hasOwn(value, iterator)) && typeof value[asyncIterator] !== "function" && (isArray || typeof value[iterator] !== "function");
1444
1491
  }
1445
1492
  function enterScopeCarrier(value, state) {
1446
- if (value === null || typeof value !== "object" && typeof value !== "function") return value;
1447
- if (state.seen.has(value)) {
1493
+ if (isLeaf(value)) return value;
1494
+ const seen = state.seen.get(value);
1495
+ if (seen !== undefined) {
1448
1496
  state.cyclic.add(value);
1449
- const seen = state.seen.get(value);
1450
1497
  return seen instanceof ScopeFrame ? frameShell(seen) : seen;
1451
1498
  }
1452
- const bound = bindDeferredBody(value, state.scope);
1453
- if (bound !== value) {
1454
- state.seen.set(value, bound);
1455
- return bound;
1499
+ let isArray = false;
1500
+ let prototype;
1501
+ if (typeof value === "object") {
1502
+ isArray = Array.isArray(value);
1503
+ prototype = Object.getPrototypeOf(value);
1456
1504
  }
1457
- if (typeof value !== "object") return value;
1458
- if (Array.isArray(value)) {
1505
+ if (!state.inert || prototype === undefined || !isInertCarrier(value, prototype, isArray)) {
1506
+ snapshotFrames(state.stack);
1507
+ const bound = bindDeferredBody(value, state.scope);
1508
+ if (bound !== value) {
1509
+ state.seen.set(value, bound);
1510
+ return bound;
1511
+ }
1512
+ if (typeof value !== "object") return value;
1513
+ }
1514
+ if (isArray) {
1459
1515
  if (Object.isFrozen(value)) {
1460
1516
  state.seen.set(value, value);
1461
1517
  return value;
1462
1518
  }
1463
- const frame = new ScopeFrame(value, null, null, null);
1519
+ let i = 0;
1520
+ let first;
1521
+ while (i < value.length && isLeaf(first = value[i])) i++;
1522
+ if (i === value.length) {
1523
+ state.seen.set(value, value);
1524
+ return value;
1525
+ }
1526
+ const frame = new ScopeFrame(value, null, null, i, first);
1464
1527
  state.seen.set(value, frame);
1465
1528
  return frame;
1466
1529
  }
1467
- const prototype = Object.getPrototypeOf(value);
1468
- if (prototype !== Object.prototype && prototype !== null || Object.isFrozen(value)) {
1530
+ if (prototype !== Object.prototype && prototype !== null) {
1531
+ state.seen.set(value, value);
1532
+ return value;
1533
+ }
1534
+ const keys = Object.keys(value);
1535
+ let i = 0;
1536
+ let first;
1537
+ while (i < keys.length && isLeaf(first = writableValue(Object.getOwnPropertyDescriptor(value, keys[i])))) i++;
1538
+ if (i === keys.length) {
1539
+ state.seen.set(value, value);
1540
+ return value;
1541
+ }
1542
+ if (Object.isFrozen(value)) {
1469
1543
  state.seen.set(value, value);
1470
1544
  return value;
1471
1545
  }
1472
- const frame = new ScopeFrame(value, prototype, Object.keys(value), Object.getOwnPropertyDescriptors(value));
1546
+ const frame = new ScopeFrame(value, prototype, keys, i, first);
1473
1547
  state.seen.set(value, frame);
1474
1548
  return frame;
1475
1549
  }
1476
1550
  function scopeDeferredContents(root, scope) {
1551
+ const stack = [];
1477
1552
  const state = {
1478
1553
  seen: new Map(),
1479
1554
  cyclic: new Set(),
1480
- scope
1555
+ scope,
1556
+ inert: sharedPrototypesInert(),
1557
+ stack
1481
1558
  };
1482
1559
  const entered = enterScopeCarrier(root, state);
1483
1560
  if (!(entered instanceof ScopeFrame)) return entered;
1484
- const stack = [entered];
1561
+ stack.push(entered);
1485
1562
  let delivered = NOTHING;
1486
1563
  for (;;) {
1487
1564
  const top = stack[stack.length - 1];
@@ -1490,17 +1567,11 @@ function scopeDeferredContents(root, scope) {
1490
1567
  while (top.i < length) {
1491
1568
  const i = top.i;
1492
1569
  let original;
1493
- let writable = true;
1494
- if (top.keys) {
1495
- const descriptor = top.descriptors[top.keys[i]];
1496
- writable = "value" in descriptor && descriptor.writable === true;
1497
- original = writable ? descriptor.value : undefined;
1570
+ if (top.first !== NOTHING) {
1571
+ original = top.first;
1572
+ top.first = NOTHING;
1498
1573
  } else {
1499
- original = top.value[i];
1500
- }
1501
- if (!writable) {
1502
- top.i++;
1503
- continue;
1574
+ original = top.keys ? carrierSlot(top, top.keys[i]) : top.value[i];
1504
1575
  }
1505
1576
  let bound;
1506
1577
  if (delivered !== NOTHING) {
@@ -1537,7 +1608,7 @@ function scopeDeferredContents(root, scope) {
1537
1608
  }
1538
1609
  }
1539
1610
  function bindDeferredBody(value, scope) {
1540
- if (value === null || typeof value !== "object" && typeof value !== "function") return value;
1611
+ if (isLeaf(value)) return value;
1541
1612
  const promised = scope(() => nativePromise(value));
1542
1613
  if (promised) {
1543
1614
  return promised.then(result => scope(() => scopeDeferredResult(result, scope)));
@@ -1806,8 +1877,8 @@ function broadcast(fn) {
1806
1877
  BROADCASTS.add(fn.id);
1807
1878
  return ref;
1808
1879
  }
1809
- function encodedArguments(request, argsEncoding, argumentBytes) {
1810
- if (request.method !== "POST") return argsEncoding || "";
1880
+ function encodedArguments(request, url, argsEncoding, argumentBytes) {
1881
+ if (request.method !== "POST") return argsEncoding || url.search;
1811
1882
  if (!argumentBytes) return undefined;
1812
1883
  return (request.headers.get("content-type") || "") + "\0" + (argsEncoding || "") + "\0" + new TextDecoder("latin1").decode(argumentBytes);
1813
1884
  }
@@ -3338,7 +3409,7 @@ async function handleServerFunctionRequest(request, options = {}) {
3338
3409
  id: functionId,
3339
3410
  live: !!live,
3340
3411
  broadcast: shared || undefined,
3341
- shareKey: shared ? encodedArguments(request, argsEncoding, argumentBytes) : undefined
3412
+ shareKey: shared ? encodedArguments(request, url, argsEncoding, argumentBytes) : undefined
3342
3413
  });
3343
3414
  const run = () => serverFunction(...parsed);
3344
3415
  return observeInvocation({
@@ -3408,7 +3479,8 @@ async function handleServerFunctionRequest(request, options = {}) {
3408
3479
  }
3409
3480
  if (!scripted) {
3410
3481
  if (handleNoJS) {
3411
- return handleNoJS(result == null && metadata !== undefined ? metadata : result, request, parsed);
3482
+ const outcome = result == null && metadata !== undefined ? metadata : result;
3483
+ return withEnvelopeCookies(await handleNoJS(outcome, request, parsed), outcome, metadata);
3412
3484
  }
3413
3485
  if (result instanceof Response) return result;
3414
3486
  return encodeResult(result, headers, status, codec, request.signal, scope);
@@ -3491,7 +3563,10 @@ async function handleServerFunctionRequest(request, options = {}) {
3491
3563
  }
3492
3564
  headers.set(ERROR_HEADER, "true");
3493
3565
  if (!scripted) {
3494
- if (handleNoJS) return handleNoJS(x ?? metadata, request, parsed, true);
3566
+ if (handleNoJS) {
3567
+ const outcome = x ?? metadata;
3568
+ return withEnvelopeCookies(await handleNoJS(outcome, request, parsed, true), outcome, metadata);
3569
+ }
3495
3570
  if (x instanceof Response) return x;
3496
3571
  }
3497
3572
  if (scripted && status === 304) warnScripted304(functionId);
@@ -3548,6 +3623,17 @@ function withholdTrace(event) {
3548
3623
  if (event.response && event.response.committed) return;
3549
3624
  traceForEvent(event).emit = false;
3550
3625
  }
3626
+ function withEnvelopeCookies(response, outcome, metadata) {
3627
+ if (outcome === metadata || !metadata || !metadata.headers || !(response instanceof Response)) {
3628
+ return response;
3629
+ }
3630
+ const cookies = metadata.headers.getSetCookie ? metadata.headers.getSetCookie() : [];
3631
+ if (!cookies.length) return response;
3632
+ const owned = ownResponse(response);
3633
+ if (owned === response) return response;
3634
+ for (const cookie of cookies) owned.headers.append("Set-Cookie", cookie);
3635
+ return owned;
3636
+ }
3551
3637
  function ownResponse(response) {
3552
3638
  try {
3553
3639
  return new Response(response.body, response);
package/types/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { getOwner, createComponent, untrack, merge as mergeProps } from "solid-js";
1
+ import { getOwner, createComponent, untrack, merge as mergeProps, heldRead } from "solid-js";
2
2
  import type { ClientErrorHook, Owner } from "solid-js";
3
3
  import { effect, memo } from "./render.js";
4
4
  import { JSX } from "./jsx.js";
@@ -100,6 +100,15 @@ export declare function HydrationScript(_props?: {
100
100
  eventNames?: string[];
101
101
  }): null;
102
102
  export { effect, memo, untrack, getOwner, createComponent };
103
+ /**
104
+ * Compiled grouped effects read it after their values: a stateful DOM prop
105
+ * (`value`, `checked`, …) whose value did not change is not written again
106
+ * while the effect is a stale reader of an open hold (#4872). The hold's
107
+ * landing re-runs the effect and writes the bound value.
108
+ *
109
+ * @internal Compiler output only.
110
+ */
111
+ export { heldRead };
103
112
  /**
104
113
  * Compiler-emitted prop-spread helper. The JSX transform emits
105
114
  * `mergeProps(...)` when compiling prop spreads on components — not a
@@ -175,6 +184,33 @@ export declare function render(code: () => JSX.Element, element: MountableElemen
175
184
  */
176
185
  onError?: ClientErrorHook;
177
186
  }): () => void;
187
+ /**
188
+ * Sets the Trusted Types policy that HTML is parsed through.
189
+ *
190
+ * A page that enforces `require-trusted-types-for 'script'` rejects a plain
191
+ * string assigned to `innerHTML`. With a policy set, the runtime assigns the
192
+ * `TrustedHTML` that `policy.createHTML(html)` returns. It is asked for two
193
+ * kinds of HTML: the static markup the compiler emitted for a template, and
194
+ * the HTML a server component sends, which the frames client parses. The app
195
+ * creates the policy, so its name and its checks stay under the app's
196
+ * Content Security Policy:
197
+ *
198
+ * ```ts
199
+ * setTrustedTypesPolicy(trustedTypes.createPolicy("my-app", { createHTML: html => html }));
200
+ * ```
201
+ *
202
+ * Call it before the first render. `undefined` goes back to plain strings.
203
+ */
204
+ export declare function setTrustedTypesPolicy(policy: {
205
+ createHTML(html: string): unknown;
206
+ } | undefined): void;
207
+ /**
208
+ * What a parse assigns to `innerHTML` for `html`: the policy's `TrustedHTML`
209
+ * when `setTrustedTypesPolicy` set one, otherwise the string. Integration
210
+ * plumbing for the frames client, which parses outside this module.
211
+ * @internal
212
+ */
213
+ export declare function trustedHTML(html: string): string;
178
214
  export declare function template(html: string, flag?: 1 | 2): () => Element;
179
215
  export declare function delegateEvents(eventNames: string[]): void;
180
216
  export declare function registerDelegatedRoot(root: MountableElement): void;
@@ -215,6 +251,19 @@ export declare function setProperty(node: Element, name: string, value: any): vo
215
251
  * @internal Compiler output only.
216
252
  */
217
253
  export declare function setStatefulProperty(node: Element, name: string, value: any): void;
254
+ /**
255
+ * An event handler expression from dev-compiled DOM output (#1742):
256
+ * `onClick={props.onClick}` compiles to `strictHandler(() => props.onClick)`
257
+ * where production output inlines `props.onClick`. A handler is bound once,
258
+ * where its element is created, so a reactive read in the expression is a
259
+ * mistake: dev warns `STRICT_READ_UNTRACKED` (a pending async read throws
260
+ * `PENDING_ASYNC_UNTRACKED_READ`). The read still tracks, so dev re-mounts
261
+ * on a change exactly as production does. Production compile output never
262
+ * imports it, so it tree-shakes away.
263
+ *
264
+ * @internal Compiler output only.
265
+ */
266
+ export declare function strictHandler<T>(fn: () => T): T;
218
267
  /**
219
268
  * Options for `registerElementClaim`.
220
269
  * @internal
@@ -275,8 +324,8 @@ export declare function style(node: Element, value: {
275
324
  * read per key; a clsx-style class array is re-mapped element-wise (className
276
325
  * allocates for an array anyway; measured at parity).
277
326
  *
278
- * The proxy's keys are read with `Reflect.ownKeys` directly — what
279
- * `sourceKeys(value, SOURCE_PROXY)` resolves to by definition (`leafOf` is
327
+ * The proxy's keys are read with `Reflect.ownKeys` directly — the keys
328
+ * `sourceKeys(value, SOURCE_PROXY)` returns by definition (`leafOf` is
280
329
  * the identity for a proxy kind; `leafKeys` answers a proxy with one
281
330
  * `ownKeys` trap) — rather than through `sourceKeys`, whose kind argument is
282
331
  * a runtime value: calling it here retained the merge/omit view walkers
@@ -294,6 +343,8 @@ export declare function applyRef<T extends Element = Element>(r: ((element: NoIn
294
343
  export declare function ref(fn: () => ((element: Element) => void) | ((element: Element) => void)[], element: Element): void;
295
344
  /** Compiler-emitted primitive; not for hand-written code. @internal */
296
345
  export declare function scope<T extends () => any>(fn: T): T;
346
+ /** Integration plumbing for Portal. @internal */
347
+ export declare function installHostTagging(): void;
297
348
  export declare function installHydrationRuntime(): void;
298
349
  /**
299
350
  * Compiler-emitted primitive; not for hand-written code.
@@ -8,6 +8,7 @@ declare const DOMWithState: Record<string, Record<string, 1 | 2>>;
8
8
  declare const ChildProperties: Set<string>;
9
9
  declare const LinkAttributes: Set<string>;
10
10
  declare const $$SLOT: unique symbol;
11
+ declare const $$INDEX: unique symbol;
11
12
  declare const $$HOST: unique symbol;
12
13
  declare const DelegatedEvents: Set<string>;
13
14
  declare const SVGElements: Set<string>;
@@ -19,4 +20,4 @@ declare const DOMElements: Set<string>;
19
20
  declare const COMPOSED_BODY_FRAMING: ReadonlySet<string>;
20
21
  declare function isHttpNavigationTarget(target: string): boolean;
21
22
  declare function isEventName(name: string): boolean;
22
- export { DOMWithState, ChildProperties, LinkAttributes, DelegatedEvents, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DOMElements, $$SLOT, $$HOST, COMPOSED_BODY_FRAMING, isHttpNavigationTarget, isEventName };
23
+ export { DOMWithState, ChildProperties, LinkAttributes, DelegatedEvents, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DOMElements, $$SLOT, $$INDEX, $$HOST, COMPOSED_BODY_FRAMING, isHttpNavigationTarget, isEventName };
@@ -500,6 +500,8 @@ export declare function makeFrameElement(id: any): HTMLElement;
500
500
  /** Whether `node` is a frame boundary/region element (carries our id attr).
501
501
  * @internal */
502
502
  export declare function isFrameElement(node: any): any;
503
+ /** @internal */
504
+ export declare function setTrustedHTML(wrap: ((html: string) => unknown) | undefined): void;
503
505
  /** Parse an HTML string into a document fragment, preserving comments. */
504
506
  export declare function parseFragment(html: any): DocumentFragment;
505
507
  /** The `<!--pl-KEY-->` comment closing a placeholder range, or null. */
@@ -100,6 +100,48 @@ export declare function createHydrationSerializer(options: HydrationSerializerOp
100
100
  flush(): void;
101
101
  close(): void;
102
102
  };
103
+ /**
104
+ * `createHydrationSerializer`'s `late`, which wraps its seroval session
105
+ * per write: rejects, on the client, what a write that failed to serialize
106
+ * midstream left pending (#4647; maintainer ruling,
107
+ * 2026-11-03). seroval 1.7 ends a write at its first failure without
108
+ * settling anything it already declared: the key's promise, a promise or
109
+ * async iterable nested in a value it already sent, each would stay pending
110
+ * forever. Every promise the write sent is rejected (its resolver is indexed
111
+ * right after it, `parsePromise`) and every stream it sent is thrown into,
112
+ * with one error naming the key; one that already settled ignores it. The
113
+ * failure's own text went to the error hook and is not sent. The promise is
114
+ * left unmarked (no `s`/`v`, which seroval's own failure call sets for
115
+ * synchronous adoption): the hydrating read sees it pending and takes the
116
+ * rejection after the claim pass, so the reading computation throws into
117
+ * the nearest `<Errored>`, whose fallback then replaces the server's
118
+ * content. Read synchronously, the fallback would be built in the claim pass
119
+ * against markup that is the content's.
120
+ *
121
+ * Which write a reference belongs to: seroval indexes a value into the
122
+ * shared `refs` as it parses it and hands the chunk that declares it to that
123
+ * write's `onSerialize` in the same synchronous step, so the indexes taken
124
+ * since the last chunk are the next chunk's, or the failed parse's when the
125
+ * write fails instead. Those never went out: they leave `refs`, or a later
126
+ * write reaching the same value (a second key on the same promise) would
127
+ * reference a slot the client never filled and resolve `undefined`; it
128
+ * parses the value again and fails on its own. seroval takes the next index
129
+ * from `refs.size`, so the size counts every index ever taken.
130
+ *
131
+ * `plain(key)` answers with a message when the failure is the key's own
132
+ * rejection and the renderer sends a plain `Error` in its place (#4709): an
133
+ * `<Errored>` drew its fallback from that error, so the promise is rejected
134
+ * with the message and marked the way seroval marks a rejection. The
135
+ * hydrating read then throws it in the claim pass, against the fallback's
136
+ * markup.
137
+ * @internal
138
+ */
139
+ export declare function rejectUnserializedKey(serialize: any, refs: any, onData: any, scopeId: any, plain: any): (key: any, value: any, callbacks: any, live: any) => any; /**
140
+ * Renderer primitive — returns the cross-reference bootstrap script SSR
141
+ * emits ahead of hydration data for a render scope. Not meant for
142
+ * hand-written code.
143
+ * @internal
144
+ */
103
145
  export declare function getLocalHeaderScript(id?: string): string;
104
146
  export declare function serializeJSON(value: unknown, options: JSONSerializeOptions): () => void;
105
147
  export declare function createJSONSerializer(options: JSONSerializerOptions): {
@@ -26,6 +26,13 @@
26
26
  * the first pass — a cycle revisits its nodes on every level down to the
27
27
  * catch — and every node of the clone pass answer from the record, so a
28
28
  * visitor's side effects run once per node whichever way the walk went.
29
+ * The clone pass is copy-on-write too (#4846): it first marks, a strongly
30
+ * connected component at a time, the containers a replacement is reachable
31
+ * from, and copies only those. A subtree with nothing to replace keeps its
32
+ * identity on the cyclic path as on the acyclic one, so a value the
33
+ * serializer also writes in another record (an async memo's answer a store
34
+ * holds) stays one reference, and a cycle with nothing to replace comes
35
+ * back as itself.
29
36
  * Walks that replace nothing never pay the lookup. A value reachable at two
30
37
  * paths is one node: its replacement is shared (one seat for one iterable —
31
38
  * the identity the input had, which the serializer writes once and the
@@ -100,6 +100,48 @@ export declare function createHydrationSerializer(options: HydrationSerializerOp
100
100
  flush(): void;
101
101
  close(): void;
102
102
  };
103
+ /**
104
+ * `createHydrationSerializer`'s `late`, which wraps its seroval session
105
+ * per write: rejects, on the client, what a write that failed to serialize
106
+ * midstream left pending (#4647; maintainer ruling,
107
+ * 2026-11-03). seroval 1.7 ends a write at its first failure without
108
+ * settling anything it already declared: the key's promise, a promise or
109
+ * async iterable nested in a value it already sent, each would stay pending
110
+ * forever. Every promise the write sent is rejected (its resolver is indexed
111
+ * right after it, `parsePromise`) and every stream it sent is thrown into,
112
+ * with one error naming the key; one that already settled ignores it. The
113
+ * failure's own text went to the error hook and is not sent. The promise is
114
+ * left unmarked (no `s`/`v`, which seroval's own failure call sets for
115
+ * synchronous adoption): the hydrating read sees it pending and takes the
116
+ * rejection after the claim pass, so the reading computation throws into
117
+ * the nearest `<Errored>`, whose fallback then replaces the server's
118
+ * content. Read synchronously, the fallback would be built in the claim pass
119
+ * against markup that is the content's.
120
+ *
121
+ * Which write a reference belongs to: seroval indexes a value into the
122
+ * shared `refs` as it parses it and hands the chunk that declares it to that
123
+ * write's `onSerialize` in the same synchronous step, so the indexes taken
124
+ * since the last chunk are the next chunk's, or the failed parse's when the
125
+ * write fails instead. Those never went out: they leave `refs`, or a later
126
+ * write reaching the same value (a second key on the same promise) would
127
+ * reference a slot the client never filled and resolve `undefined`; it
128
+ * parses the value again and fails on its own. seroval takes the next index
129
+ * from `refs.size`, so the size counts every index ever taken.
130
+ *
131
+ * `plain(key)` answers with a message when the failure is the key's own
132
+ * rejection and the renderer sends a plain `Error` in its place (#4709): an
133
+ * `<Errored>` drew its fallback from that error, so the promise is rejected
134
+ * with the message and marked the way seroval marks a rejection. The
135
+ * hydrating read then throws it in the claim pass, against the fallback's
136
+ * markup.
137
+ * @internal
138
+ */
139
+ export declare function rejectUnserializedKey(serialize: any, refs: any, onData: any, scopeId: any, plain: any): (key: any, value: any, callbacks: any, live: any) => any; /**
140
+ * Renderer primitive — returns the cross-reference bootstrap script SSR
141
+ * emits ahead of hydration data for a render scope. Not meant for
142
+ * hand-written code.
143
+ * @internal
144
+ */
103
145
  export declare function getLocalHeaderScript(id?: string): string;
104
146
  export declare function serializeJSON(value: unknown, options: JSONSerializeOptions): () => void;
105
147
  export declare function createJSONSerializer(options: JSONSerializerOptions): {
@@ -256,7 +256,6 @@ export interface LiveServerFunction<A extends readonly any[] = any[], R = any> {
256
256
  /**
257
257
  * Declares a live server function whose answer is the same for every
258
258
  * viewer: on the client exactly `live(fn)` — the sharing is the server's.
259
- * @experimental
260
259
  */
261
260
  export declare function broadcast<A extends readonly any[], R>(fn: (...args: A) => R): LiveServerFunction<A, Awaited<R>>;
262
261
  /**
@@ -546,7 +546,6 @@ export declare function live<A extends readonly any[], R>(fn: (...args: A) => R)
546
546
  * data source (see sharedSourceResponse). The outer body still runs per
547
547
  * call — a gate (auth, redirects) — but what it returns is the shared
548
548
  * answer's to render.
549
- * @experimental
550
549
  */
551
550
  export declare function broadcast<A extends readonly any[], R>(fn: (...args: A) => R): ServerFunction<A, LiveSource<Awaited<R>>>;
552
551
  export declare function getServerFunctionInvocation(): ServerFunctionInvocation | undefined;
@@ -200,8 +200,9 @@ export declare function hasFlightMetadata(response: Response): boolean;
200
200
  * value. Pending entries in the slices (values the collector folded while
201
201
  * still in flight, streamed after the response head) are settled before
202
202
  * any consumer runs. A consumer whose source was not folded is skipped —
203
- * unless the response carries integration metadata, in which case it runs
204
- * with `data` `undefined` to apply the metadata. Consumers are looked up
203
+ * unless the response carries integration metadata, or the server folded
204
+ * nothing at all (a plain mutation, #4883), in which case it runs with
205
+ * `data` `undefined` to apply the metadata or its default. Consumers are looked up
205
206
  * per delivery: an awaited consumer may unsubscribe another (a provider
206
207
  * tearing down under a navigation).
207
208
  *
@@ -16,12 +16,15 @@ export declare function createUploadSerializer(files: any): {
16
16
  parse: {
17
17
  sync: (value: any, ctx: any) => {
18
18
  i: any;
19
+ t: any;
19
20
  };
20
21
  async: (value: any, ctx: any) => Promise<{
21
22
  i: any;
23
+ t: any;
22
24
  }>;
23
25
  stream: (value: any, ctx: any) => {
24
26
  i: any;
27
+ t: any;
25
28
  };
26
29
  };
27
30
  serialize: (node: any, ctx: any) => any;
@@ -71,14 +71,21 @@ export type PreloadLink = PreloadLinkAttributes & ({
71
71
  * (unknown fields pass through untyped), but any bundler integration can
72
72
  * produce it. Only these fields are ever read: `preloads` is Solid's
73
73
  * extension slot for explicit typed links the integration selects.
74
+ *
75
+ * Keys are module ids, except `_`-prefixed metadata strings: `_base` (the
76
+ * public base joined with every `file`), plus any an integration stamps,
77
+ * such as the vite plugin's `_entry`. The index signature carries both
78
+ * (solidjs/solid#4502), so a read by key is an entry only once narrowed,
79
+ * e.g. `typeof entry === "object"`.
74
80
  */
75
- export type AssetManifest = Record<string, {
76
- file: string;
77
- css?: string[];
78
- isEntry?: boolean;
79
- imports?: string[];
80
- preloads?: PreloadLink[];
81
- }> & {
81
+ export type AssetManifest = {
82
+ [key: string]: {
83
+ file: string;
84
+ css?: string[];
85
+ isEntry?: boolean;
86
+ imports?: string[];
87
+ preloads?: PreloadLink[];
88
+ } | string | undefined;
82
89
  _base?: string;
83
90
  };
84
91
  /** Inline style content, e.g. dev CSS collected from a bundler's module graph. */
@@ -144,6 +151,13 @@ export declare function renderToString<T>(fn: () => T, options?: {
144
151
  noScripts?: boolean;
145
152
  plugins?: any[];
146
153
  manifest?: AssetManifest | AssetResolver | AssetResolverFn;
154
+ /**
155
+ * Server modulepreload hints for modules outside the entry's static import
156
+ * closure (lazy and route chunks) carry `fetchpriority="low"` so they do not
157
+ * compete with the modules hydration waits on. `false` emits them at default
158
+ * priority.
159
+ */
160
+ lowPriorityPreloads?: boolean;
147
161
  /** This render's server error hook, ahead of `configureServerErrors`' (see the server entry). */
148
162
  onError?: ServerErrorHook;
149
163
  /**
@@ -190,6 +204,13 @@ export declare function renderToStream<T>(fn: () => T, options?: {
190
204
  noScripts?: boolean;
191
205
  plugins?: any[];
192
206
  manifest?: AssetManifest | AssetResolver | AssetResolverFn;
207
+ /**
208
+ * Server modulepreload hints for modules outside the entry's static import
209
+ * closure (lazy and route chunks) carry `fetchpriority="low"` so they do not
210
+ * compete with the modules hydration waits on. `false` emits them at default
211
+ * priority.
212
+ */
213
+ lowPriorityPreloads?: boolean;
193
214
  onCompleteShell?: (info: {
194
215
  write: (v: string) => void;
195
216
  }) => void;
@@ -215,6 +236,12 @@ export declare function renderToStream<T>(fn: () => T, options?: {
215
236
  * "signal"`); the one teardown handle for a host whose transport cannot
216
237
  * report a dead consumer through the sink or the readable view — pass
217
238
  * `request.signal`.
239
+ * Awaiting the render rejects with `signal.reason` when this signal aborts;
240
+ * the streaming forms stop writing and end cleanly — a close, not an
241
+ * error, since bytes are already out: `pipe` ends its sink, `pipeTo`
242
+ * closes its writable (after the writes already handed to it) and
243
+ * resolves, and `readable` closes. `onError` and `onCompleteAll` are not
244
+ * called (#4646).
218
245
  */
219
246
  signal?: AbortSignal;
220
247
  }): {
@@ -222,7 +249,7 @@ export declare function renderToStream<T>(fn: () => T, options?: {
222
249
  * Awaiting the stream resolves with the complete HTML once every boundary
223
250
  * settles — the fully-settled-string form of the render. Render errors
224
251
  * route through `onError` and the promise resolves with whatever HTML the
225
- * render produced; it never rejects.
252
+ * render produced. Signal cancellation rejects with `signal.reason`.
226
253
  */
227
254
  then<TResult1 = string, TResult2 = never>(onfulfilled?: ((html: string) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
228
255
  pipe: (writable: {