@solidjs/web 2.0.0-rc.1 → 2.0.0-rc.3

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 (84) hide show
  1. package/dist/dev.cjs +116 -66
  2. package/dist/dev.js +109 -65
  3. package/dist/server.cjs +386 -109
  4. package/dist/server.js +378 -113
  5. package/dist/web.cjs +113 -64
  6. package/dist/web.js +106 -63
  7. package/frames/dist/client.cjs +100 -14
  8. package/frames/dist/client.dev.cjs +103 -14
  9. package/frames/dist/client.dev.js +104 -15
  10. package/frames/dist/client.js +101 -15
  11. package/frames/dist/server.cjs +285 -154
  12. package/frames/dist/server.js +287 -156
  13. package/package.json +20 -22
  14. package/serialization/dist/decode.cjs +22 -5
  15. package/serialization/dist/decode.js +23 -6
  16. package/serialization/dist/serialization.cjs +26 -13
  17. package/serialization/dist/serialization.js +26 -8
  18. package/serialization/types/index.d.ts +69 -157
  19. package/serialization/types/serializer-decode.d.ts +89 -112
  20. package/serialization/types/serializer.d.ts +94 -0
  21. package/serialization/types-cjs/index.d.cts +69 -157
  22. package/serialization/types-cjs/serializer-decode.d.cts +89 -112
  23. package/serialization/types-cjs/serializer.d.cts +94 -0
  24. package/server-functions/dist/client.cjs +48 -7
  25. package/server-functions/dist/client.js +48 -8
  26. package/server-functions/dist/server.cjs +76 -5
  27. package/server-functions/dist/server.dev.cjs +76 -5
  28. package/server-functions/dist/server.dev.js +76 -6
  29. package/server-functions/dist/server.js +76 -6
  30. package/types/client.d.ts +150 -290
  31. package/types/constants.d.ts +18 -0
  32. package/types/cookies.d.ts +31 -75
  33. package/types/frames/frame-client.d.ts +287 -259
  34. package/types/frames/frame-container-plugin.d.ts +71 -0
  35. package/types/frames/frame-sink.d.ts +58 -160
  36. package/types/frames/frame-transport.d.ts +161 -194
  37. package/types/frames/serializer-decode.d.ts +159 -0
  38. package/types/frames/serializer.d.ts +69 -157
  39. package/types/head.d.ts +16 -0
  40. package/types/index.d.ts +0 -65
  41. package/types/index.server.d.ts +125 -0
  42. package/types/jsx.d.ts +5 -13
  43. package/types/reconcile.d.ts +1 -0
  44. package/types/render.d.ts +4 -0
  45. package/types/response.d.ts +41 -153
  46. package/types/serializer-decode.d.ts +89 -112
  47. package/types/serializer.d.ts +69 -157
  48. package/types/server-functions/client.d.ts +101 -199
  49. package/types/server-functions/flash.d.ts +10 -30
  50. package/types/server-functions/registry.d.ts +63 -0
  51. package/types/server-functions/rich-args.d.ts +1 -10
  52. package/types/server-functions/server.d.ts +301 -518
  53. package/types/server-functions/shared.d.ts +112 -458
  54. package/types/server-mock.d.ts +13 -4
  55. package/types/server.d.ts +256 -427
  56. package/types-cjs/client.d.cts +150 -290
  57. package/types-cjs/constants.d.cts +18 -0
  58. package/types-cjs/cookies.d.cts +31 -75
  59. package/types-cjs/frames/frame-client.d.cts +287 -259
  60. package/types-cjs/frames/frame-container-plugin.d.cts +71 -0
  61. package/types-cjs/frames/frame-sink.d.cts +58 -160
  62. package/types-cjs/frames/frame-transport.d.cts +161 -194
  63. package/types-cjs/frames/serializer-decode.d.cts +159 -0
  64. package/types-cjs/frames/serializer.d.cts +69 -157
  65. package/types-cjs/head.d.cts +16 -0
  66. package/types-cjs/index.d.cts +0 -65
  67. package/types-cjs/index.server.d.cts +125 -0
  68. package/types-cjs/jsx.d.cts +5 -13
  69. package/types-cjs/reconcile.d.cts +1 -0
  70. package/types-cjs/render.d.cts +4 -0
  71. package/types-cjs/response.d.cts +41 -153
  72. package/types-cjs/serializer-decode.d.cts +89 -112
  73. package/types-cjs/serializer.d.cts +69 -157
  74. package/types-cjs/server-functions/client.d.cts +101 -199
  75. package/types-cjs/server-functions/flash.d.cts +10 -30
  76. package/types-cjs/server-functions/registry.d.cts +63 -0
  77. package/types-cjs/server-functions/rich-args.d.cts +1 -10
  78. package/types-cjs/server-functions/server.d.cts +301 -518
  79. package/types-cjs/server-functions/shared.d.cts +112 -458
  80. package/types-cjs/server-mock.d.cts +13 -4
  81. package/types-cjs/server.d.cts +256 -427
  82. package/LICENSE +0 -21
  83. package/types/core.d.ts +0 -6
  84. package/types-cjs/core.d.cts +0 -6
@@ -0,0 +1,63 @@
1
+ export type { ServerFunction, ServerFunctionMetadata, ServerFunctionRPC } from "./shared.cjs";
2
+ export declare const SERVER_FUNCTION_METADATA: unique symbol;
3
+ /**
4
+ * Reads a server function reference's declaration metadata (e.g.
5
+ * `method: "GET"` for `GET(fn)` references). Returns undefined when `fn`
6
+ * is not a server function reference; plain references carry an empty
7
+ * metadata object.
8
+ */
9
+ export declare function getServerFunctionMetadata(fn: any): any;
10
+ /**
11
+ * Whether `fn` is a server function reference (a client proxy or a
12
+ * server-side registered callable). Detection is by the registered-symbol
13
+ * metadata brand, so it holds across duplicated module instances.
14
+ */
15
+ export declare function isServerFunction(fn: any): boolean;
16
+ /**
17
+ * Attaches user-declared transport metadata to a server function reference
18
+ * (client proxy or server-registered callable) and returns the reference.
19
+ * Writes ride the same channel `GET` uses: later writes shallow-merge over
20
+ * earlier ones, and `getServerFunctionMetadata(fn)` reads the merged bag —
21
+ * so `withMeta` composes with `GET` in either order.
22
+ *
23
+ * The pattern is declare-on-function, react-in-hook: metadata declared
24
+ * here is what `prepareRequest` receives as `context.meta`, letting
25
+ * session-dynamic transport policy key on declarations instead of
26
+ * comparing function ids:
27
+ *
28
+ * ```ts
29
+ * export const chargeCard = withMeta(async (amount: number) => {
30
+ * "use server";
31
+ * // ...
32
+ * }, { requiresAuth: true });
33
+ *
34
+ * configureServerFunctionsClient({
35
+ * prepareRequest(init, { meta }) {
36
+ * if (meta?.requiresAuth) {
37
+ * return {
38
+ * ...init,
39
+ * headers: { ...init.headers, Authorization: `Bearer ${session.token()}` }
40
+ * };
41
+ * }
42
+ * return init;
43
+ * }
44
+ * });
45
+ * ```
46
+ */
47
+ export declare function withMeta(fn: any, meta: any): any;
48
+ export declare const LIVE_SOURCE: unique symbol;
49
+ /**
50
+ * Fills the RPC seam. Called by the transport halves (client fetch RPC,
51
+ * server in-process dispatch) when the first server function reference is
52
+ * created; first write wins — both halves register equivalent surfaces, and
53
+ * a per-build half never coexists with the other build's.
54
+ * @internal
55
+ */
56
+ export declare function provideServerFunctionRPC(rpc: any): void;
57
+ /**
58
+ * The registered RPC surface, or undefined when no server function exists
59
+ * in this build's graph. Integration plumbing (routers): gate every use of
60
+ * the transport/codec behind this read instead of importing it.
61
+ * @internal
62
+ */
63
+ 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;