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

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 (107) hide show
  1. package/dist/server.dev.js +4472 -0
  2. package/dist/server.js +1301 -251
  3. package/dist/{server.cjs → server.observe.js} +1501 -452
  4. package/dist/{dev.cjs → web.dev.js} +699 -360
  5. package/dist/web.js +454 -139
  6. package/dist/{dev.js → web.observe.js} +505 -211
  7. package/frames/dist/client.dev.js +463 -71
  8. package/frames/dist/client.js +363 -70
  9. package/frames/dist/{client.dev.cjs → client.observe.js} +486 -133
  10. package/frames/dist/server.dev.js +1713 -0
  11. package/frames/dist/server.js +552 -2583
  12. package/frames/dist/server.observe.js +1713 -0
  13. package/frames/package.json +2 -25
  14. package/package.json +214 -255
  15. package/performance-tracks/dist/performance-tracks.dev.js +678 -0
  16. package/performance-tracks/dist/performance-tracks.js +6 -0
  17. package/performance-tracks/dist/performance-tracks.observe.js +666 -0
  18. package/performance-tracks/package.json +7 -0
  19. package/performance-tracks/types/index.d.ts +67 -0
  20. package/serialization/decode/package.json +2 -15
  21. package/serialization/dist/decode.js +92 -15
  22. package/serialization/dist/serialization.js +103 -23
  23. package/serialization/package.json +2 -15
  24. package/serialization/types/index.d.ts +76 -157
  25. package/serialization/types/serializer-decode.d.ts +149 -112
  26. package/serialization/types/serializer.d.ts +101 -0
  27. package/server-functions/dist/client.dev.js +1364 -0
  28. package/server-functions/dist/client.js +611 -97
  29. package/server-functions/dist/client.observe.js +1343 -0
  30. package/server-functions/dist/server.dev.js +2138 -202
  31. package/server-functions/dist/server.js +2042 -199
  32. package/server-functions/dist/server.observe.js +3043 -0
  33. package/server-functions/package.json +2 -35
  34. package/server-functions/rich-args/package.json +2 -15
  35. package/storage/package.json +2 -15
  36. package/types/client.d.ts +193 -288
  37. package/types/constants.d.ts +20 -0
  38. package/types/cookies.d.ts +32 -84
  39. package/types/diagnostics.d.ts +56 -0
  40. package/types/frames/client.d.ts +1 -1
  41. package/types/frames/frame-client.d.ts +323 -259
  42. package/types/frames/frame-container-plugin.d.ts +72 -0
  43. package/types/frames/frame-sink.d.ts +101 -158
  44. package/types/frames/frame-transport.d.ts +192 -190
  45. package/types/frames/serializer-decode.d.ts +219 -0
  46. package/types/frames/serializer.d.ts +76 -157
  47. package/types/frames/server.d.ts +1 -1
  48. package/types/head.d.ts +19 -0
  49. package/types/index.d.ts +52 -80
  50. package/types/index.server.d.ts +174 -0
  51. package/types/jsx.d.ts +33 -35
  52. package/types/observe.d.ts +358 -0
  53. package/types/reconcile.d.ts +1 -0
  54. package/types/render.d.ts +9 -0
  55. package/types/response.d.ts +75 -150
  56. package/types/serializer-decode.d.ts +149 -112
  57. package/types/serializer.d.ts +76 -157
  58. package/types/server-functions/client.d.ts +192 -194
  59. package/types/server-functions/flash.d.ts +28 -30
  60. package/types/server-functions/registry.d.ts +102 -0
  61. package/types/server-functions/rich-args.d.ts +1 -10
  62. package/types/server-functions/server.d.ts +511 -475
  63. package/types/server-functions/shared.d.ts +366 -425
  64. package/types/server-mock.d.ts +110 -13
  65. package/types/server-observe.d.ts +77 -0
  66. package/types/server.d.ts +425 -425
  67. package/types/trace.d.ts +127 -0
  68. package/LICENSE +0 -21
  69. package/dist/web.cjs +0 -2008
  70. package/frames/dist/client.cjs +0 -1916
  71. package/frames/dist/server.cjs +0 -3756
  72. package/serialization/dist/decode.cjs +0 -122
  73. package/serialization/dist/serialization.cjs +0 -244
  74. package/serialization/types-cjs/index.d.cts +0 -182
  75. package/serialization/types-cjs/package.json +0 -3
  76. package/serialization/types-cjs/serializer-decode.d.cts +0 -182
  77. package/server-functions/dist/client.cjs +0 -793
  78. package/server-functions/dist/rich-args.cjs +0 -11
  79. package/server-functions/dist/server.cjs +0 -1171
  80. package/server-functions/dist/server.dev.cjs +0 -1171
  81. package/storage/dist/storage.cjs +0 -12
  82. package/storage/types-cjs/index.d.cts +0 -28
  83. package/storage/types-cjs/package.json +0 -3
  84. package/types/core.d.ts +0 -6
  85. package/types-cjs/client.d.cts +0 -337
  86. package/types-cjs/cookies.d.cts +0 -93
  87. package/types-cjs/core.d.cts +0 -6
  88. package/types-cjs/frames/client.d.cts +0 -36
  89. package/types-cjs/frames/frame-client.d.cts +0 -338
  90. package/types-cjs/frames/frame-sink.d.cts +0 -194
  91. package/types-cjs/frames/frame-transport.d.cts +0 -222
  92. package/types-cjs/frames/serializer.d.cts +0 -182
  93. package/types-cjs/frames/server.d.cts +0 -52
  94. package/types-cjs/index.d.cts +0 -244
  95. package/types-cjs/jsx-properties.d.cts +0 -93
  96. package/types-cjs/jsx.d.cts +0 -4159
  97. package/types-cjs/package.json +0 -3
  98. package/types-cjs/response.d.cts +0 -174
  99. package/types-cjs/serializer-decode.d.cts +0 -182
  100. package/types-cjs/serializer.d.cts +0 -182
  101. package/types-cjs/server-functions/client.d.cts +0 -231
  102. package/types-cjs/server-functions/flash.d.cts +0 -38
  103. package/types-cjs/server-functions/rich-args.d.cts +0 -10
  104. package/types-cjs/server-functions/server.d.cts +0 -616
  105. package/types-cjs/server-functions/shared.d.cts +0 -523
  106. package/types-cjs/server-mock.d.cts +0 -277
  107. package/types-cjs/server.d.cts +0 -523
@@ -0,0 +1,127 @@
1
+ import { type BoundaryEvent } from "solid-js";
2
+ import type { InvocationEvent, RenderEvent } from "./observe.js";
3
+ /**
4
+ * The trace the current request belongs to — continued from the incoming
5
+ * W3C `traceparent` when there was one, originated by the runtime
6
+ * otherwise. Read with `getTraceContext()`.
7
+ */
8
+ export interface TraceContext {
9
+ /** 32 lowercase hex — the whole trace. */
10
+ traceId: string;
11
+ /** 16 lowercase hex — this request's span: runtime-generated unless a provider supplied it. */
12
+ spanId: string;
13
+ /** The incoming parent span, when the request continued a trace. */
14
+ parentId?: string;
15
+ /** The incoming `traceparent` sampled flag (bit 0); `undefined` when the runtime originated. */
16
+ sampled?: boolean;
17
+ /** The incoming `tracestate` header, verbatim. */
18
+ state?: string;
19
+ /** The incoming `baggage` header, verbatim. */
20
+ baggage?: string;
21
+ /**
22
+ * Named entries handed to the browser on the first response — emitted
23
+ * both as `Server-Timing` entries (`<name>;desc="<value>"`) and, for HTML
24
+ * documents, as `<meta name="<name>" content="<value>">` in the shell.
25
+ * The runtime fills `traceparent`; a provider adds its vendor pair
26
+ * (`sentry-trace`, `baggage`). Also what application code forwards
27
+ * downstream: `fetch(url, { headers: { traceparent: entries.traceparent } })`.
28
+ */
29
+ entries: Record<string, string>;
30
+ }
31
+ /**
32
+ * An observer's answer for the trace a request belongs to, merged over the
33
+ * runtime's default derivation: fields it returns replace the derived
34
+ * ones (`traceId`/`spanId` from an APM's active span), its `entries` merge
35
+ * by name over the runtime's. Called once per request (or per render, for
36
+ * a render outside a request scope — `request` is then `undefined`), at
37
+ * shell flush or the first `getTraceContext()`, whichever comes first.
38
+ * Return `undefined` to leave the derivation alone.
39
+ */
40
+ export type TraceProvider = (request: Request | undefined) => Partial<TraceContext> | undefined;
41
+ declare module "solid-js" {
42
+ interface ServerTrace {
43
+ /** Installs `provider`, replacing any current one. Returns the uninstall. */
44
+ provide(provider: TraceProvider): () => void;
45
+ }
46
+ }
47
+ /**
48
+ * The request's server work as recorded — the `"invocation"` and
49
+ * `"boundary"` records made while it was served, in completion order —
50
+ * from which the `Server-Timing` metrics are projected at head commit
51
+ * (`appendTraceServerTiming`): `solid-invocation;dur=<durationMs>;desc="<id>"`
52
+ * for an execution, `solid-boundary;dur=<durationMs>;desc="<owner path>"` for
53
+ * a `<Loading>` boundary the shell waited on (the `"render"` record on the
54
+ * same `TraceRecord` gives `solid-shell;dur=<shellMs>`). One gate for record
55
+ * and metric alike: a record is built in dev builds always, and in observe
56
+ * builds while a listener is on its type (`OBSERVE.records.observed`), so
57
+ * the header is a projection of what was recorded, never a second clock —
58
+ * an app with no observer sees no wire change (the trace's rule). What
59
+ * rides is what the server knew when the head left — the function that
60
+ * produced a response; for a document, the shell and the boundaries that
61
+ * settled inside it. The Performance-panel adapter paints these under the
62
+ * matching client span (`@solidjs/web/performance-tracks`).
63
+ */
64
+ export type TimedWork = {
65
+ type: "invocation";
66
+ event: InvocationEvent;
67
+ } | {
68
+ type: "boundary";
69
+ event: BoundaryEvent;
70
+ };
71
+ /** A derived trace plus whether the browser is told about it (see the header note). */
72
+ export interface TraceRecord {
73
+ context: TraceContext;
74
+ emit: boolean;
75
+ /** The request's recorded server work, in completion order (see `TimedWork`). */
76
+ timing: TimedWork[];
77
+ /**
78
+ * The render this request is serving, while one is being recorded — the
79
+ * `"render"` record as it fills (`RenderEvent`): `solid-shell` is its
80
+ * `shellMs`, once the shell is complete.
81
+ */
82
+ render?: RenderEvent;
83
+ }
84
+ /** `00-<traceId>-<spanId>-<flags>` for a context. */
85
+ export declare function formatTraceparent(context: TraceContext): string;
86
+ /**
87
+ * The trace record for `key`, derived once: incoming `traceparent` /
88
+ * `tracestate` / `baggage` from `request`, origination when absent, then
89
+ * (observe/dev) the installed provider's answer merged over it.
90
+ */
91
+ export declare function traceFor(key: object, request: Request | undefined): TraceRecord;
92
+ /**
93
+ * The trace record for a request event — keyed on its `request` (shared by
94
+ * the derived events direct server-function calls run under, so a call
95
+ * during a render sees the render's trace) or on the event itself.
96
+ */
97
+ export declare function traceForEvent(event: {
98
+ request?: Request;
99
+ }): TraceRecord;
100
+ /** Whether `appendTraceServerTiming` has anything to write for `record`. */
101
+ export declare function hasServerTiming(record: TraceRecord): boolean;
102
+ /**
103
+ * Appends the record to `headers` as `Server-Timing` metrics — its trace
104
+ * entries as `<name>;desc="<value>"` when the browser is told (see
105
+ * `TraceRecord`), never duplicating a name the app already wrote; and the
106
+ * server work it recorded as `<name>;dur=<ms>;desc="<desc>"`, each metric a
107
+ * projection of one record (see `TimedWork`): `solid-shell` first, from the
108
+ * render record, then the invocations and boundaries in completion order.
109
+ * Metrics repeat their names by design (one `solid-boundary` per boundary),
110
+ * so they are not name-deduplicated. Must run before the response head
111
+ * commits.
112
+ */
113
+ export declare function appendTraceServerTiming(headers: Headers, record: TraceRecord): void;
114
+ /**
115
+ * Folds a `Server-Timing` header value onto `target` entry by entry,
116
+ * skipping names `target` already carries — the header is a list, so a
117
+ * stub's trace entries and a response's own metrics (`db;dur=53`) coexist
118
+ * instead of one replacing the other. Names repeated within `value` itself
119
+ * (one `solid-boundary` per boundary) all fold: the skip is against what
120
+ * the target had, not what this fold added.
121
+ */
122
+ export declare function mergeServerTiming(target: Headers, value: string): void;
123
+ /**
124
+ * The record's entries as `<meta name content>` tags for the HTML shell's
125
+ * prelude (after charset/base). Empty when the browser is not told.
126
+ */
127
+ export declare function traceMetaMarkup(record: TraceRecord): string;
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2016-2025 Ryan Carniato
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.