@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.
Files changed (124) hide show
  1. package/README.md +1 -1
  2. package/dist/server.dev.js +5065 -0
  3. package/dist/server.js +1757 -355
  4. package/dist/{server.cjs → server.observe.js} +1951 -558
  5. package/dist/{dev.cjs → web.dev.js} +945 -550
  6. package/dist/web.js +635 -332
  7. package/dist/{dev.js → web.observe.js} +688 -403
  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 +2549 -0
  14. package/frames/dist/server.js +1688 -3005
  15. package/frames/dist/server.observe.js +2548 -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 +242 -88
  28. package/serialization/package.json +2 -15
  29. package/serialization/types/index.d.ts +85 -158
  30. package/serialization/types/serializer-decode.d.ts +173 -114
  31. package/serialization/types/serializer.d.ts +109 -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 +84 -1
  36. package/server-functions/dist/server.dev.js +2714 -297
  37. package/server-functions/dist/server.js +2595 -271
  38. package/server-functions/dist/server.observe.js +3594 -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 +85 -158
  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 +85 -158
  72. package/types/server-functions/argument-codec.d.ts +30 -0
  73. package/types/server-functions/client.d.ts +238 -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 +539 -531
  78. package/types/server-functions/shared.d.ts +398 -425
  79. package/types/server-functions/uploads.d.ts +50 -0
  80. package/types/server-mock.d.ts +120 -13
  81. package/types/server-observe.d.ts +86 -0
  82. package/types/server.d.ts +571 -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,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.