@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.
- package/dist/server.dev.js +521 -280
- package/dist/server.js +518 -279
- package/dist/server.observe.js +518 -279
- package/dist/web.dev.js +142 -106
- package/dist/web.js +120 -105
- package/dist/web.observe.js +120 -105
- package/frames/dist/client.dev.js +7 -2
- package/frames/dist/client.js +7 -2
- package/frames/dist/client.observe.js +7 -2
- package/frames/dist/server.dev.js +124 -68
- package/frames/dist/server.js +124 -68
- package/frames/dist/server.observe.js +124 -68
- package/frames/dist/wire.js +1 -1
- package/package.json +2 -2
- package/serialization/dist/serialization.js +53 -12
- package/serialization/types/index.d.ts +42 -0
- package/serialization/types/serializer.d.ts +42 -0
- package/server-functions/dist/client.dev.js +5 -3
- package/server-functions/dist/client.js +5 -3
- package/server-functions/dist/client.observe.js +5 -3
- package/server-functions/dist/rich-args.js +27 -9
- package/server-functions/dist/server.dev.js +122 -36
- package/server-functions/dist/server.js +122 -36
- package/server-functions/dist/server.observe.js +122 -36
- package/types/client.d.ts +54 -3
- package/types/constants.d.ts +2 -1
- package/types/frames/frame-client.d.ts +2 -0
- package/types/frames/serializer.d.ts +42 -0
- package/types/frames/tree-rewrite.d.ts +7 -0
- package/types/serializer.d.ts +42 -0
- package/types/server-functions/client.d.ts +0 -1
- package/types/server-functions/server.d.ts +0 -1
- package/types/server-functions/shared.d.ts +3 -2
- package/types/server-functions/uploads.d.ts +3 -0
- package/types/server-mock.d.ts +35 -8
- package/types/server.d.ts +89 -18
package/types/server.d.ts
CHANGED
|
@@ -54,14 +54,21 @@ export type PreloadLink = PreloadLinkAttributes & ({
|
|
|
54
54
|
* (unknown fields pass through untyped), but any bundler integration can
|
|
55
55
|
* produce it. Only these fields are ever read: `preloads` is Solid's
|
|
56
56
|
* extension slot for explicit typed links the integration selects.
|
|
57
|
+
*
|
|
58
|
+
* Keys are module ids, except `_`-prefixed metadata strings: `_base` (the
|
|
59
|
+
* public base joined with every `file`), plus any an integration stamps,
|
|
60
|
+
* such as the vite plugin's `_entry`. The index signature carries both
|
|
61
|
+
* (solidjs/solid#4502), so a read by key is an entry only once narrowed,
|
|
62
|
+
* e.g. `typeof entry === "object"`.
|
|
57
63
|
*/
|
|
58
|
-
export type AssetManifest =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
export type AssetManifest = {
|
|
65
|
+
[key: string]: {
|
|
66
|
+
file: string;
|
|
67
|
+
css?: string[];
|
|
68
|
+
isEntry?: boolean;
|
|
69
|
+
imports?: string[];
|
|
70
|
+
preloads?: PreloadLink[];
|
|
71
|
+
} | string | undefined;
|
|
65
72
|
_base?: string;
|
|
66
73
|
};
|
|
67
74
|
/** Inline style content, e.g. dev CSS collected from a bundler's module graph. */
|
|
@@ -224,6 +231,13 @@ export declare function renderToString<T>(fn: () => T, options?: {
|
|
|
224
231
|
noScripts?: boolean;
|
|
225
232
|
plugins?: SerializerPlugin[];
|
|
226
233
|
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
234
|
+
/**
|
|
235
|
+
* Server modulepreload hints for modules outside the entry's static import
|
|
236
|
+
* closure (lazy and route chunks) carry `fetchpriority="low"` so they do not
|
|
237
|
+
* compete with the modules hydration waits on. `false` emits them at default
|
|
238
|
+
* priority.
|
|
239
|
+
*/
|
|
240
|
+
lowPriorityPreloads?: boolean;
|
|
227
241
|
/**
|
|
228
242
|
* This render's server error hook, ahead of `configureServerErrors`'
|
|
229
243
|
* (see `ServerErrorHook`): every failure the render handles — an
|
|
@@ -252,6 +266,13 @@ export declare function renderToStream<T>(fn: () => T, options?: {
|
|
|
252
266
|
noScripts?: boolean;
|
|
253
267
|
plugins?: SerializerPlugin[];
|
|
254
268
|
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
269
|
+
/**
|
|
270
|
+
* Server modulepreload hints for modules outside the entry's static import
|
|
271
|
+
* closure (lazy and route chunks) carry `fetchpriority="low"` so they do not
|
|
272
|
+
* compete with the modules hydration waits on. `false` emits them at default
|
|
273
|
+
* priority.
|
|
274
|
+
*/
|
|
275
|
+
lowPriorityPreloads?: boolean;
|
|
255
276
|
onCompleteShell?: (info: {
|
|
256
277
|
write: (v: string) => void;
|
|
257
278
|
}) => void;
|
|
@@ -263,7 +284,10 @@ export declare function renderToStream<T>(fn: () => T, options?: {
|
|
|
263
284
|
* (see `ServerErrorHook`): every failure the render handles — an
|
|
264
285
|
* `<Errored>` fallback (`handling: "fallback"`), a rejected fragment
|
|
265
286
|
* (`"client"`), a hydration value that would not serialize
|
|
266
|
-
* (`"serialize"
|
|
287
|
+
* (`"serialize"`: a default serializer failure before the first flush
|
|
288
|
+
* also fails the render, with no `onCompleteAll` (#4709); after it,
|
|
289
|
+
* published values reject on the client (#4647)), and the one that fails
|
|
290
|
+
* the request (`"failed"`),
|
|
267
291
|
* once per error per kind per request (per render outside one), with
|
|
268
292
|
* where it was met. A one-argument listener still
|
|
269
293
|
* works; it hears them all — filter on `context.handling` for the
|
|
@@ -286,13 +310,19 @@ export declare function renderToStream<T>(fn: () => T, options?: {
|
|
|
286
310
|
* The request's lifecycle. Aborting tears the render down exactly as a
|
|
287
311
|
* client disconnect does (`SSR_STREAM_ABANDONED`, `data.reason:
|
|
288
312
|
* "signal"`): in-flight reactive work is disposed, every async source
|
|
289
|
-
* still being pulled is returned, and nothing more
|
|
290
|
-
* the host whose transport cannot report a dead consumer
|
|
291
|
-
* sink or the readable view — a frame stream whose emission
|
|
292
|
-
* touches the document writable, a platform whose response body
|
|
293
|
-
* consumed by a proxy — this is the one teardown handle; pass
|
|
313
|
+
* still being pulled is returned, and nothing more is written to the
|
|
314
|
+
* sink. For the host whose transport cannot report a dead consumer
|
|
315
|
+
* through the sink or the readable view — a frame stream whose emission
|
|
316
|
+
* never touches the document writable, a platform whose response body
|
|
317
|
+
* is consumed by a proxy — this is the one teardown handle; pass
|
|
294
318
|
* `request.signal`. Idempotent with the sink and consumer paths: whichever
|
|
295
319
|
* fires first tears down, the rest are no-ops.
|
|
320
|
+
* Awaiting the render rejects with `signal.reason` when this signal aborts;
|
|
321
|
+
* the streaming forms stop writing and end cleanly — a close, not an
|
|
322
|
+
* error, since bytes are already out: `pipe` ends its sink, `pipeTo`
|
|
323
|
+
* closes its writable (after the writes already handed to it) and
|
|
324
|
+
* resolves, and `readable` closes. `onError` and `onCompleteAll` are not
|
|
325
|
+
* called (#4646).
|
|
296
326
|
*/
|
|
297
327
|
signal?: AbortSignal;
|
|
298
328
|
}): {
|
|
@@ -300,8 +330,8 @@ export declare function renderToStream<T>(fn: () => T, options?: {
|
|
|
300
330
|
* Awaiting the stream resolves with the complete HTML once every boundary
|
|
301
331
|
* settles — the fully-settled-string form of the render (`const html =
|
|
302
332
|
* await renderToStream(...)`). Render errors route through `onError` and
|
|
303
|
-
* the promise resolves with whatever HTML the render produced
|
|
304
|
-
* rejects.
|
|
333
|
+
* the promise resolves with whatever HTML the render produced. Signal
|
|
334
|
+
* cancellation rejects with `signal.reason`.
|
|
305
335
|
*
|
|
306
336
|
* Completion is this path's head-freeze point: the request event's
|
|
307
337
|
* `response` head (the request scope the render was started in) is
|
|
@@ -389,6 +419,38 @@ export declare function createLiveHoles(sink: any, scoped: any, settled: any, er
|
|
|
389
419
|
/** The shared id counter — `ssr()` mints an attr address at injection
|
|
390
420
|
* time, before its capture completes. */
|
|
391
421
|
mint(): number;
|
|
422
|
+
/**
|
|
423
|
+
* Open an attr capture for the tag whose open ends at `off` in `text`
|
|
424
|
+
* (`ssr()`'s tag-open segment): mint its address and splice
|
|
425
|
+
* ` data-lha="N"` in, or — a boundary resume re-rendering a tag whose
|
|
426
|
+
* capture went pending (see `retry`), where the address is already on
|
|
427
|
+
* the element — take that address over, so the pending capture never
|
|
428
|
+
* registers. Returns the capture, its segment's new text on `text`.
|
|
429
|
+
*/
|
|
430
|
+
open(text: any, off: any, hole: any): {
|
|
431
|
+
id: any;
|
|
432
|
+
parts: any[];
|
|
433
|
+
base: any;
|
|
434
|
+
inject: any;
|
|
435
|
+
waiting: number;
|
|
436
|
+
text: any;
|
|
437
|
+
};
|
|
438
|
+
/**
|
|
439
|
+
* An in-tag hole that escalated (its value is still pending) resolves later
|
|
440
|
+
* as a retry fn, one of two ways. A boundary resume re-renders the open tag
|
|
441
|
+
* through `ssr(pending.t, ...pending.h)`, which captures it again. At the
|
|
442
|
+
* top of a render there is no boundary: the tree resolver pulls the retry
|
|
443
|
+
* as a function node, which it otherwise treats as content and routes
|
|
444
|
+
* through the live-hole engine, so its markers would land inside the tag
|
|
445
|
+
* (`<div<!--lh:N--> style="…"<!--lh:/N-->>`) or inside the attribute value.
|
|
446
|
+
* The retry is tagged (`$lhInTag`, carried through re-wraps) so the engine
|
|
447
|
+
* never marks it. When the tag was being captured, the capture stays open
|
|
448
|
+
* as pending (`$lhAttr`): its address stays on the element, and the engine
|
|
449
|
+
* registers its binding once the tag's last retry resolves, with the text
|
|
450
|
+
* at that moment as the baseline. A boundary resume adopts the address
|
|
451
|
+
* instead (see `open`), so the element carries one.
|
|
452
|
+
*/
|
|
453
|
+
retry(fn: any, cap: any): void;
|
|
392
454
|
/** Whether interception may arm at the current evaluation point —
|
|
393
455
|
* `ssr()` asks before opening an attr capture (the `data-lha`
|
|
394
456
|
* injection must not touch out-of-scope bytes, nor address an element
|
|
@@ -445,8 +507,12 @@ export type LinkClaimHandler = (attrs: Readonly<Record<string, unknown>>) => str
|
|
|
445
507
|
* @internal
|
|
446
508
|
*/
|
|
447
509
|
export declare function ssrLinkClaim(attrs: Readonly<Record<string, unknown>>): string;
|
|
448
|
-
|
|
449
|
-
export declare function
|
|
510
|
+
/** Compiler-emitted primitive; not for hand-written code. @internal */
|
|
511
|
+
export declare function ssrSelect(value: any): any;
|
|
512
|
+
/** Compiler-emitted primitive; not for hand-written code. @internal */
|
|
513
|
+
export declare function ssrIn<T>(state: any, fn: () => T): T;
|
|
514
|
+
/** Compiler-emitted primitive; not for hand-written code. @internal */
|
|
515
|
+
export declare function ssrOption(value: any, state?: any, own?: any): string;
|
|
450
516
|
export declare function escape(s: any, attr?: boolean): any;
|
|
451
517
|
export declare function getHydrationKey(): string | undefined;
|
|
452
518
|
export declare function applyRef(r: ((element: any) => void) | ((element: any) => void)[], element: any): void;
|
|
@@ -685,9 +751,14 @@ export type ElementClaimOptions = {
|
|
|
685
751
|
* register isomorphically. Returns a no-op unregister function.
|
|
686
752
|
*/
|
|
687
753
|
export declare function registerElementClaim(handler: (element: Element) => void, options?: ElementClaimOptions): () => void;
|
|
754
|
+
export declare function setTrustedTypesPolicy(policy: {
|
|
755
|
+
createHTML(html: string): unknown;
|
|
756
|
+
} | undefined): void;
|
|
757
|
+
/** Server: markup stays a string. @internal */
|
|
758
|
+
export declare function trustedHTML(html: string): string;
|
|
688
759
|
export declare function claimElement<T extends Element>(node: T, owner?: Owner | null): T;
|
|
689
760
|
export declare function claimElementTree<T extends Node>(root: T): T;
|
|
690
761
|
/** Server: `fn()`. No event is dispatched during SSR, so there is no interaction to join. */
|
|
691
762
|
export declare function dispatchAsInteraction<T>(_e: Event, fn: () => T): T;
|
|
692
|
-
export { notSup as style, notSup as insert, notSup as spread, notSup as delegateEvents, notSup as registerDelegatedRoot, notSup as unregisterDelegatedRoot, notSup as registerDelegatedContainer, notSup as unregisterDelegatedContainer, notSup as getDelegatedRoot, notSup as dynamicProperty, notSup as setAttribute, notSup as setAttributeNS, notSup as addEvent, notSup as render, notSup as template, notSup as setProperty, notSup as setStatefulProperty, notSup as className, notSup as assign, notSup as hydrate, notSup as getNextElement, notSup as getNextMatch, notSup as getNextMarker, notSup as runHydrationEvents, notSup as ref, notSup as setStyleProperty, notSup as readShallow, notSup as acquireAsset };
|
|
763
|
+
export { notSup as style, notSup as insert, notSup as spread, notSup as delegateEvents, notSup as registerDelegatedRoot, notSup as unregisterDelegatedRoot, notSup as registerDelegatedContainer, notSup as unregisterDelegatedContainer, notSup as getDelegatedRoot, notSup as dynamicProperty, notSup as setAttribute, notSup as setAttributeNS, notSup as addEvent, notSup as render, notSup as template, notSup as setProperty, notSup as setStatefulProperty, notSup as heldRead, notSup as strictHandler, notSup as className, notSup as assign, notSup as hydrate, notSup as getNextElement, notSup as getNextMatch, notSup as getNextMarker, notSup as runHydrationEvents, notSup as ref, notSup as setStyleProperty, notSup as readShallow, notSup as acquireAsset };
|
|
693
764
|
declare function notSup(): void;
|