@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.20
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/README.md +1 -1
- package/dist/server.dev.js +5065 -0
- package/dist/server.js +1757 -355
- package/dist/{server.cjs → server.observe.js} +1951 -558
- package/dist/{dev.cjs → web.dev.js} +945 -550
- package/dist/web.js +635 -332
- package/dist/{dev.js → web.observe.js} +688 -403
- package/frames/dist/assets.js +92 -0
- package/frames/dist/client.dev.js +1296 -1198
- package/frames/dist/client.js +1128 -1191
- package/frames/dist/client.observe.js +2041 -0
- package/frames/dist/regions.js +171 -0
- package/frames/dist/server.dev.js +2549 -0
- package/frames/dist/server.js +1688 -3005
- package/frames/dist/server.observe.js +2548 -0
- package/frames/dist/trace.js +45 -0
- package/frames/dist/wire.js +594 -0
- package/frames/package.json +2 -25
- package/package.json +244 -256
- package/performance-tracks/dist/performance-tracks.dev.js +679 -0
- package/performance-tracks/dist/performance-tracks.js +6 -0
- package/performance-tracks/dist/performance-tracks.observe.js +667 -0
- package/performance-tracks/package.json +7 -0
- package/performance-tracks/types/index.d.ts +69 -0
- package/serialization/decode/package.json +2 -15
- package/serialization/dist/decode.js +121 -25
- package/serialization/dist/serialization.js +242 -88
- package/serialization/package.json +2 -15
- package/serialization/types/index.d.ts +85 -158
- package/serialization/types/serializer-decode.d.ts +173 -114
- package/serialization/types/serializer.d.ts +109 -0
- package/server-functions/dist/client.dev.js +1462 -0
- package/server-functions/dist/client.js +667 -165
- package/server-functions/dist/client.observe.js +1441 -0
- package/server-functions/dist/rich-args.js +84 -1
- package/server-functions/dist/server.dev.js +2714 -297
- package/server-functions/dist/server.js +2595 -271
- package/server-functions/dist/server.observe.js +3594 -0
- package/server-functions/package.json +2 -35
- package/server-functions/rich-args/package.json +2 -15
- package/skills/server-components/SKILL.md +117 -0
- package/storage/package.json +2 -15
- package/types/client.d.ts +342 -288
- package/types/constants.d.ts +22 -0
- package/types/cookies.d.ts +32 -84
- package/types/diagnostics.d.ts +80 -0
- package/types/frames/assets-tier.d.ts +78 -0
- package/types/frames/client.d.ts +40 -1
- package/types/frames/frame-client.d.ts +443 -280
- package/types/frames/frame-container-plugin.d.ts +64 -0
- package/types/frames/frame-morph.d.ts +29 -0
- package/types/frames/frame-sink.d.ts +141 -161
- package/types/frames/frame-transport.d.ts +263 -184
- package/types/frames/regions-tier.d.ts +60 -0
- package/types/frames/serializer-decode.d.ts +241 -0
- package/types/frames/serializer.d.ts +85 -158
- package/types/frames/server.d.ts +2 -2
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/tree-rewrite.d.ts +39 -0
- package/types/frames/wire-tier.d.ts +169 -0
- package/types/head.d.ts +20 -0
- package/types/index.d.ts +98 -81
- package/types/index.server.d.ts +159 -0
- package/types/jsx.d.ts +49 -44
- package/types/observe.d.ts +535 -0
- package/types/reconcile.d.ts +1 -0
- package/types/render.d.ts +11 -0
- package/types/request-error-hook.d.ts +5 -0
- package/types/response.d.ts +95 -147
- package/types/serializer-decode.d.ts +173 -114
- package/types/serializer.d.ts +85 -158
- package/types/server-functions/argument-codec.d.ts +30 -0
- package/types/server-functions/client.d.ts +238 -223
- package/types/server-functions/flash.d.ts +28 -30
- package/types/server-functions/registry.d.ts +105 -0
- package/types/server-functions/rich-args.d.ts +1 -10
- package/types/server-functions/server.d.ts +539 -531
- package/types/server-functions/shared.d.ts +398 -425
- package/types/server-functions/uploads.d.ts +50 -0
- package/types/server-mock.d.ts +120 -13
- package/types/server-observe.d.ts +86 -0
- package/types/server.d.ts +571 -422
- package/types/trace.d.ts +127 -0
- package/LICENSE +0 -21
- package/dist/web.cjs +0 -2033
- package/frames/dist/client.cjs +0 -2002
- package/frames/dist/client.dev.cjs +0 -2022
- package/frames/dist/server.cjs +0 -3877
- package/serialization/dist/decode.cjs +0 -139
- package/serialization/dist/serialization.cjs +0 -261
- package/serialization/types-cjs/index.d.cts +0 -182
- package/serialization/types-cjs/package.json +0 -3
- package/serialization/types-cjs/serializer-decode.d.cts +0 -182
- package/server-functions/dist/client.cjs +0 -834
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.cjs +0 -1242
- package/server-functions/dist/server.dev.cjs +0 -1242
- package/storage/dist/storage.cjs +0 -12
- package/storage/types-cjs/index.d.cts +0 -28
- package/storage/types-cjs/package.json +0 -3
- package/types/core.d.ts +0 -9
- package/types-cjs/client.d.cts +0 -337
- package/types-cjs/cookies.d.cts +0 -93
- package/types-cjs/core.d.cts +0 -9
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -356
- package/types-cjs/frames/frame-sink.d.cts +0 -194
- package/types-cjs/frames/frame-transport.d.cts +0 -222
- package/types-cjs/frames/serializer.d.cts +0 -182
- package/types-cjs/frames/server.d.cts +0 -52
- package/types-cjs/index.d.cts +0 -244
- package/types-cjs/jsx-properties.d.cts +0 -93
- package/types-cjs/jsx.d.cts +0 -4159
- package/types-cjs/package.json +0 -3
- package/types-cjs/response.d.cts +0 -174
- package/types-cjs/serializer-decode.d.cts +0 -182
- package/types-cjs/serializer.d.cts +0 -182
- package/types-cjs/server-functions/client.d.cts +0 -262
- package/types-cjs/server-functions/flash.d.cts +0 -38
- package/types-cjs/server-functions/rich-args.d.cts +0 -10
- package/types-cjs/server-functions/server.d.cts +0 -681
- package/types-cjs/server-functions/shared.d.cts +0 -523
- package/types-cjs/server-mock.d.cts +0 -286
- package/types-cjs/server.d.cts +0 -544
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export type { InvokeOptions, ServerFunction, ServerFunctionInvoker, ServerFunctionMetadata, ServerFunctionRPC } from "./shared.js";
|
|
2
|
+
import type { InvokeOptions } from "./shared.js";
|
|
3
|
+
export declare const SERVER_FUNCTION_METADATA: unique symbol;
|
|
4
|
+
/**
|
|
5
|
+
* Reads a server function reference's declaration metadata (e.g.
|
|
6
|
+
* `method: "GET"` for `GET(fn)` references). Returns undefined when `fn`
|
|
7
|
+
* is not a server function reference; plain references carry an empty
|
|
8
|
+
* metadata object.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getServerFunctionMetadata(fn: any): any;
|
|
11
|
+
/**
|
|
12
|
+
* Whether `fn` is a server function reference (a client proxy or a
|
|
13
|
+
* server-side registered callable). Detection is by the registered-symbol
|
|
14
|
+
* metadata brand, so it holds across duplicated module instances.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isServerFunction(fn: any): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Attaches user-declared transport metadata to a server function reference
|
|
19
|
+
* (client proxy or server-registered callable) and returns the reference.
|
|
20
|
+
* Writes ride the same channel `GET` uses: later writes shallow-merge over
|
|
21
|
+
* earlier ones, and `getServerFunctionMetadata(fn)` reads the merged bag —
|
|
22
|
+
* so `withMeta` composes with `GET` in either order.
|
|
23
|
+
*
|
|
24
|
+
* The pattern is declare-on-function, react-in-hook: metadata declared
|
|
25
|
+
* here is what `prepareRequest` receives as `context.meta`, letting
|
|
26
|
+
* session-dynamic transport policy key on declarations instead of
|
|
27
|
+
* comparing function ids:
|
|
28
|
+
*
|
|
29
|
+
* ```ts
|
|
30
|
+
* export const chargeCard = withMeta(async (amount: number) => {
|
|
31
|
+
* "use server";
|
|
32
|
+
* // ...
|
|
33
|
+
* }, { requiresAuth: true });
|
|
34
|
+
*
|
|
35
|
+
* configureServerFunctionsClient({
|
|
36
|
+
* prepareRequest(init, { meta }) {
|
|
37
|
+
* if (meta?.requiresAuth) {
|
|
38
|
+
* return {
|
|
39
|
+
* ...init,
|
|
40
|
+
* headers: { ...init.headers, Authorization: `Bearer ${session.token()}` }
|
|
41
|
+
* };
|
|
42
|
+
* }
|
|
43
|
+
* return init;
|
|
44
|
+
* }
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function withMeta(fn: any, meta: any): any;
|
|
49
|
+
export declare const SERVER_FUNCTION_INVOKE: unique symbol;
|
|
50
|
+
/**
|
|
51
|
+
* Applies a server function once with per-call, invocation-scoped options —
|
|
52
|
+
* `Function.prototype.call` for server functions, the options bag in the
|
|
53
|
+
* `thisArg` slot (declaration wrappers like `GET` and `withMeta` are `bind`:
|
|
54
|
+
* they return a new reference with context baked in; `invoke` applies one
|
|
55
|
+
* call and leaves no residue on the reference).
|
|
56
|
+
*
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { invoke } from "@solidjs/web/server-functions";
|
|
59
|
+
*
|
|
60
|
+
* const user = await invoke(getUser, { signal: controller.signal }, id);
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* Options are strictly invocation-scoped — things that vary between calls
|
|
64
|
+
* of the SAME function and cannot be declared or configured: `signal`
|
|
65
|
+
* (the call's lifecycle; aborting rejects the call and cancels the
|
|
66
|
+
* request), `keepalive` (calls made while the page unloads), `priority`
|
|
67
|
+
* (fetch priority hint). Anything with a longer lifetime is refused with a
|
|
68
|
+
* pointer to its home: session-dynamic transport policy → `prepareRequest`;
|
|
69
|
+
* declaration-static shape → `GET`/`withMeta`; call policy (retries,
|
|
70
|
+
* dedupe, deadlines) → the data layer that owns the call, wired through
|
|
71
|
+
* `signal`.
|
|
72
|
+
*
|
|
73
|
+
* Dispatches through the reference's invocation channel
|
|
74
|
+
* (`SERVER_FUNCTION_INVOKE`). Core's declaration wrappers forward it —
|
|
75
|
+
* `GET` invokes over its query encoding, `live` ends its iteration on
|
|
76
|
+
* abort. Wrappers that share calls (caches, channels) may adapt or decline
|
|
77
|
+
* it; a data layer needs neither — it holds the reference below such
|
|
78
|
+
* wrappers and invokes it directly with its own signal. On the server the
|
|
79
|
+
* call runs in-process: `signal`
|
|
80
|
+
* rejects the caller (the work, like a server behind HTTP, runs on unless
|
|
81
|
+
* the function observes a signal itself) and the transport hints are
|
|
82
|
+
* no-ops, since they describe a wire that does not exist.
|
|
83
|
+
*/
|
|
84
|
+
export declare function invoke<A extends readonly any[], R>(fn: (...args: A) => R, options: InvokeOptions, ...args: A): R;
|
|
85
|
+
export declare const LIVE_SOURCE: unique symbol;
|
|
86
|
+
export declare const LIVE_RESUME_FROM: unique symbol;
|
|
87
|
+
export declare const LIVE_LOCAL: unique symbol;
|
|
88
|
+
/**
|
|
89
|
+
* Fills the RPC seam. Called by the transport halves (client fetch RPC,
|
|
90
|
+
* server in-process dispatch) when the first server function reference is
|
|
91
|
+
* created; first write wins — both halves register equivalent surfaces, and
|
|
92
|
+
* a per-build half never coexists with the other build's.
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
export declare function provideServerFunctionRPC(rpc: any): void;
|
|
96
|
+
/**
|
|
97
|
+
* The registered RPC surface, or undefined when no server function exists
|
|
98
|
+
* in this build's graph. Integration plumbing (routers): gate every use of
|
|
99
|
+
* the transport/codec behind this read instead of importing it. Both halves
|
|
100
|
+
* carry `GET` and `decodeResponse`. (A handler re-asking a call it answered
|
|
101
|
+
* does so through the call's own `retry` thunk — `responseHandler` in the
|
|
102
|
+
* client config — not through this slot.)
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
export declare function getServerFunctionRPC(): any;
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Opt-in codec encoding for server-function ARGUMENTS. By default the client
|
|
3
|
-
* sends argument lists as plain JSON (no serializer in the bundle) and
|
|
4
|
-
* throws on values JSON can't carry faithfully. Call once at startup to
|
|
5
|
-
* send Dates, Maps, Sets, typed arrays, cyclic structures, etc. through the
|
|
6
|
-
* codec — at the cost of the serializer's write half (~5 KB gz on top of
|
|
7
|
-
* the decode half responses already need). The handler accepts both
|
|
8
|
-
* encodings unconditionally.
|
|
9
|
-
*/
|
|
10
|
-
export function enableRichArguments(): void;
|
|
1
|
+
export declare function enableRichArguments(): void;
|