@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.21

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 (124) hide show
  1. package/README.md +1 -1
  2. package/dist/server.dev.js +5165 -0
  3. package/dist/server.js +1876 -374
  4. package/dist/{server.cjs → server.observe.js} +2070 -577
  5. package/dist/{dev.cjs → web.dev.js} +955 -567
  6. package/dist/web.js +646 -350
  7. package/dist/{dev.js → web.observe.js} +699 -421
  8. package/frames/dist/assets.js +92 -0
  9. package/frames/dist/client.dev.js +1296 -1198
  10. package/frames/dist/client.js +1128 -1191
  11. package/frames/dist/client.observe.js +2041 -0
  12. package/frames/dist/regions.js +171 -0
  13. package/frames/dist/server.dev.js +2545 -0
  14. package/frames/dist/server.js +1683 -3004
  15. package/frames/dist/server.observe.js +2544 -0
  16. package/frames/dist/trace.js +45 -0
  17. package/frames/dist/wire.js +594 -0
  18. package/frames/package.json +2 -25
  19. package/package.json +244 -256
  20. package/performance-tracks/dist/performance-tracks.dev.js +679 -0
  21. package/performance-tracks/dist/performance-tracks.js +6 -0
  22. package/performance-tracks/dist/performance-tracks.observe.js +667 -0
  23. package/performance-tracks/package.json +7 -0
  24. package/performance-tracks/types/index.d.ts +69 -0
  25. package/serialization/decode/package.json +2 -15
  26. package/serialization/dist/decode.js +121 -25
  27. package/serialization/dist/serialization.js +282 -88
  28. package/serialization/package.json +2 -15
  29. package/serialization/types/index.d.ts +115 -153
  30. package/serialization/types/serializer-decode.d.ts +173 -114
  31. package/serialization/types/serializer.d.ts +144 -0
  32. package/server-functions/dist/client.dev.js +1462 -0
  33. package/server-functions/dist/client.js +667 -165
  34. package/server-functions/dist/client.observe.js +1441 -0
  35. package/server-functions/dist/rich-args.js +102 -1
  36. package/server-functions/dist/server.dev.js +2802 -299
  37. package/server-functions/dist/server.js +2724 -314
  38. package/server-functions/dist/server.observe.js +3680 -0
  39. package/server-functions/package.json +2 -35
  40. package/server-functions/rich-args/package.json +2 -15
  41. package/skills/server-components/SKILL.md +117 -0
  42. package/storage/package.json +2 -15
  43. package/types/client.d.ts +342 -288
  44. package/types/constants.d.ts +22 -0
  45. package/types/cookies.d.ts +32 -84
  46. package/types/diagnostics.d.ts +80 -0
  47. package/types/frames/assets-tier.d.ts +78 -0
  48. package/types/frames/client.d.ts +40 -1
  49. package/types/frames/frame-client.d.ts +443 -280
  50. package/types/frames/frame-container-plugin.d.ts +64 -0
  51. package/types/frames/frame-morph.d.ts +29 -0
  52. package/types/frames/frame-sink.d.ts +141 -161
  53. package/types/frames/frame-transport.d.ts +263 -184
  54. package/types/frames/regions-tier.d.ts +60 -0
  55. package/types/frames/serializer-decode.d.ts +241 -0
  56. package/types/frames/serializer.d.ts +115 -153
  57. package/types/frames/server.d.ts +2 -2
  58. package/types/frames/trace-tier.d.ts +2 -0
  59. package/types/frames/tree-rewrite.d.ts +39 -0
  60. package/types/frames/wire-tier.d.ts +169 -0
  61. package/types/head.d.ts +20 -0
  62. package/types/index.d.ts +98 -81
  63. package/types/index.server.d.ts +159 -0
  64. package/types/jsx.d.ts +49 -44
  65. package/types/observe.d.ts +535 -0
  66. package/types/reconcile.d.ts +1 -0
  67. package/types/render.d.ts +11 -0
  68. package/types/request-error-hook.d.ts +5 -0
  69. package/types/response.d.ts +95 -147
  70. package/types/serializer-decode.d.ts +173 -114
  71. package/types/serializer.d.ts +115 -153
  72. package/types/server-functions/argument-codec.d.ts +30 -0
  73. package/types/server-functions/client.d.ts +237 -223
  74. package/types/server-functions/flash.d.ts +28 -30
  75. package/types/server-functions/registry.d.ts +105 -0
  76. package/types/server-functions/rich-args.d.ts +1 -10
  77. package/types/server-functions/server.d.ts +538 -531
  78. package/types/server-functions/shared.d.ts +398 -425
  79. package/types/server-functions/uploads.d.ts +53 -0
  80. package/types/server-mock.d.ts +154 -20
  81. package/types/server-observe.d.ts +86 -0
  82. package/types/server.d.ts +601 -422
  83. package/types/trace.d.ts +127 -0
  84. package/LICENSE +0 -21
  85. package/dist/web.cjs +0 -2033
  86. package/frames/dist/client.cjs +0 -2002
  87. package/frames/dist/client.dev.cjs +0 -2022
  88. package/frames/dist/server.cjs +0 -3877
  89. package/serialization/dist/decode.cjs +0 -139
  90. package/serialization/dist/serialization.cjs +0 -261
  91. package/serialization/types-cjs/index.d.cts +0 -182
  92. package/serialization/types-cjs/package.json +0 -3
  93. package/serialization/types-cjs/serializer-decode.d.cts +0 -182
  94. package/server-functions/dist/client.cjs +0 -834
  95. package/server-functions/dist/rich-args.cjs +0 -11
  96. package/server-functions/dist/server.cjs +0 -1242
  97. package/server-functions/dist/server.dev.cjs +0 -1242
  98. package/storage/dist/storage.cjs +0 -12
  99. package/storage/types-cjs/index.d.cts +0 -28
  100. package/storage/types-cjs/package.json +0 -3
  101. package/types/core.d.ts +0 -9
  102. package/types-cjs/client.d.cts +0 -337
  103. package/types-cjs/cookies.d.cts +0 -93
  104. package/types-cjs/core.d.cts +0 -9
  105. package/types-cjs/frames/client.d.cts +0 -36
  106. package/types-cjs/frames/frame-client.d.cts +0 -356
  107. package/types-cjs/frames/frame-sink.d.cts +0 -194
  108. package/types-cjs/frames/frame-transport.d.cts +0 -222
  109. package/types-cjs/frames/serializer.d.cts +0 -182
  110. package/types-cjs/frames/server.d.cts +0 -52
  111. package/types-cjs/index.d.cts +0 -244
  112. package/types-cjs/jsx-properties.d.cts +0 -93
  113. package/types-cjs/jsx.d.cts +0 -4159
  114. package/types-cjs/package.json +0 -3
  115. package/types-cjs/response.d.cts +0 -174
  116. package/types-cjs/serializer-decode.d.cts +0 -182
  117. package/types-cjs/serializer.d.cts +0 -182
  118. package/types-cjs/server-functions/client.d.cts +0 -262
  119. package/types-cjs/server-functions/flash.d.cts +0 -38
  120. package/types-cjs/server-functions/rich-args.d.cts +0 -10
  121. package/types-cjs/server-functions/server.d.cts +0 -681
  122. package/types-cjs/server-functions/shared.d.cts +0 -523
  123. package/types-cjs/server-mock.d.cts +0 -286
  124. 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;