effect-start 0.25.0 → 0.27.0

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 (174) hide show
  1. package/package.json +20 -86
  2. package/src/Entity.ts +6 -6
  3. package/src/FileRouterCodegen.ts +4 -4
  4. package/src/FileSystem.ts +4 -8
  5. package/src/RouteHook.ts +1 -1
  6. package/src/RouteSse.ts +3 -3
  7. package/src/SqlIntrospect.ts +2 -2
  8. package/src/Start.ts +102 -2
  9. package/src/Values.ts +11 -0
  10. package/src/bun/BunRoute.ts +1 -1
  11. package/src/bun/BunRuntime.ts +5 -5
  12. package/src/hyper/HyperHtml.ts +11 -7
  13. package/src/hyper/jsx.d.ts +1 -1
  14. package/src/lint/plugin.js +174 -4
  15. package/src/sql/SqlClient.ts +355 -0
  16. package/src/sql/bun/index.ts +117 -50
  17. package/src/sql/index.ts +1 -1
  18. package/src/sql/libsql/index.ts +91 -77
  19. package/src/sql/libsql/libsql.d.ts +4 -1
  20. package/src/sql/mssql/index.ts +141 -108
  21. package/src/sql/mssql/mssql.d.ts +1 -0
  22. package/src/testing/TestLogger.ts +4 -4
  23. package/src/x/tailwind/compile.ts +6 -14
  24. package/dist/ChildProcess.js +0 -42
  25. package/dist/Commander.js +0 -410
  26. package/dist/ContentNegotiation.js +0 -465
  27. package/dist/Cookies.js +0 -371
  28. package/dist/Development.js +0 -94
  29. package/dist/Effectify.js +0 -27
  30. package/dist/Entity.js +0 -289
  31. package/dist/Fetch.js +0 -192
  32. package/dist/FilePathPattern.js +0 -97
  33. package/dist/FileRouter.js +0 -204
  34. package/dist/FileRouterCodegen.js +0 -298
  35. package/dist/FileSystem.js +0 -132
  36. package/dist/Http.js +0 -107
  37. package/dist/PathPattern.js +0 -451
  38. package/dist/PlatformError.js +0 -40
  39. package/dist/PlatformRuntime.js +0 -71
  40. package/dist/Route.js +0 -143
  41. package/dist/RouteBody.js +0 -92
  42. package/dist/RouteError.js +0 -76
  43. package/dist/RouteHook.js +0 -64
  44. package/dist/RouteHttp.js +0 -367
  45. package/dist/RouteHttpTracer.js +0 -90
  46. package/dist/RouteMount.js +0 -86
  47. package/dist/RouteSchema.js +0 -271
  48. package/dist/RouteSse.js +0 -94
  49. package/dist/RouteTree.js +0 -119
  50. package/dist/RouteTrie.js +0 -179
  51. package/dist/SchemaExtra.js +0 -99
  52. package/dist/Socket.js +0 -40
  53. package/dist/SqlIntrospect.js +0 -515
  54. package/dist/Start.js +0 -79
  55. package/dist/StartApp.js +0 -3
  56. package/dist/StreamExtra.js +0 -135
  57. package/dist/System.js +0 -38
  58. package/dist/TuplePathPattern.js +0 -74
  59. package/dist/Unique.js +0 -226
  60. package/dist/Values.js +0 -52
  61. package/dist/bun/BunBundle.js +0 -186
  62. package/dist/bun/BunChildProcessSpawner.js +0 -142
  63. package/dist/bun/BunImportTrackerPlugin.js +0 -91
  64. package/dist/bun/BunRoute.js +0 -157
  65. package/dist/bun/BunRuntime.js +0 -41
  66. package/dist/bun/BunServer.js +0 -285
  67. package/dist/bun/BunVirtualFilesPlugin.js +0 -54
  68. package/dist/bun/_BunEnhancedResolve.js +0 -127
  69. package/dist/bun/index.js +0 -5
  70. package/dist/bundler/Bundle.js +0 -92
  71. package/dist/bundler/BundleFiles.js +0 -154
  72. package/dist/bundler/BundleRoute.js +0 -62
  73. package/dist/client/Overlay.js +0 -33
  74. package/dist/client/ScrollState.js +0 -106
  75. package/dist/client/index.js +0 -97
  76. package/dist/console/Console.js +0 -42
  77. package/dist/console/ConsoleErrors.js +0 -211
  78. package/dist/console/ConsoleLogger.js +0 -56
  79. package/dist/console/ConsoleMetrics.js +0 -72
  80. package/dist/console/ConsoleProcess.js +0 -59
  81. package/dist/console/ConsoleStore.js +0 -72
  82. package/dist/console/ConsoleTracer.js +0 -107
  83. package/dist/console/Simulation.js +0 -784
  84. package/dist/console/index.js +0 -3
  85. package/dist/console/routes/tree.js +0 -30
  86. package/dist/datastar/actions/fetch.js +0 -536
  87. package/dist/datastar/actions/peek.js +0 -13
  88. package/dist/datastar/actions/setAll.js +0 -19
  89. package/dist/datastar/actions/toggleAll.js +0 -19
  90. package/dist/datastar/attributes/attr.js +0 -49
  91. package/dist/datastar/attributes/bind.js +0 -194
  92. package/dist/datastar/attributes/class.js +0 -54
  93. package/dist/datastar/attributes/computed.js +0 -25
  94. package/dist/datastar/attributes/effect.js +0 -10
  95. package/dist/datastar/attributes/indicator.js +0 -33
  96. package/dist/datastar/attributes/init.js +0 -27
  97. package/dist/datastar/attributes/jsonSignals.js +0 -33
  98. package/dist/datastar/attributes/on.js +0 -81
  99. package/dist/datastar/attributes/onIntersect.js +0 -53
  100. package/dist/datastar/attributes/onInterval.js +0 -31
  101. package/dist/datastar/attributes/onSignalPatch.js +0 -51
  102. package/dist/datastar/attributes/ref.js +0 -11
  103. package/dist/datastar/attributes/show.js +0 -32
  104. package/dist/datastar/attributes/signals.js +0 -18
  105. package/dist/datastar/attributes/style.js +0 -57
  106. package/dist/datastar/attributes/text.js +0 -29
  107. package/dist/datastar/engine.js +0 -1145
  108. package/dist/datastar/index.js +0 -25
  109. package/dist/datastar/utils.js +0 -250
  110. package/dist/datastar/watchers/patchElements.js +0 -486
  111. package/dist/datastar/watchers/patchSignals.js +0 -14
  112. package/dist/experimental/EncryptedCookies.js +0 -328
  113. package/dist/experimental/index.js +0 -1
  114. package/dist/hyper/Hyper.js +0 -28
  115. package/dist/hyper/HyperHtml.js +0 -165
  116. package/dist/hyper/HyperNode.js +0 -13
  117. package/dist/hyper/HyperRoute.js +0 -45
  118. package/dist/hyper/html.js +0 -30
  119. package/dist/hyper/index.js +0 -5
  120. package/dist/hyper/jsx-runtime.js +0 -14
  121. package/dist/index.js +0 -8
  122. package/dist/node/NodeFileSystem.js +0 -675
  123. package/dist/node/NodeUtils.js +0 -23
  124. package/dist/sql/Sql.js +0 -8
  125. package/dist/sql/bun/index.js +0 -142
  126. package/dist/sql/index.js +0 -1
  127. package/dist/sql/libsql/index.js +0 -156
  128. package/dist/sql/mssql/docker.js +0 -110
  129. package/dist/sql/mssql/index.js +0 -194
  130. package/dist/testing/TestLogger.js +0 -42
  131. package/dist/testing/index.js +0 -2
  132. package/dist/testing/utils.js +0 -61
  133. package/dist/x/cloudflare/CloudflareTunnel.js +0 -63
  134. package/dist/x/cloudflare/index.js +0 -1
  135. package/dist/x/tailscale/TailscaleTunnel.js +0 -94
  136. package/dist/x/tailscale/index.js +0 -1
  137. package/dist/x/tailwind/TailwindPlugin.js +0 -294
  138. package/dist/x/tailwind/compile.js +0 -210
  139. package/dist/x/tailwind/plugin.js +0 -17
  140. package/src/console/Console.ts +0 -42
  141. package/src/console/ConsoleErrors.ts +0 -213
  142. package/src/console/ConsoleLogger.ts +0 -56
  143. package/src/console/ConsoleMetrics.ts +0 -72
  144. package/src/console/ConsoleProcess.ts +0 -59
  145. package/src/console/ConsoleStore.ts +0 -187
  146. package/src/console/ConsoleTracer.ts +0 -107
  147. package/src/console/Simulation.ts +0 -814
  148. package/src/console/console.html +0 -340
  149. package/src/console/index.ts +0 -3
  150. package/src/console/routes/errors/route.tsx +0 -97
  151. package/src/console/routes/fiberDetail.tsx +0 -54
  152. package/src/console/routes/fibers/route.tsx +0 -45
  153. package/src/console/routes/git/route.tsx +0 -64
  154. package/src/console/routes/layout.tsx +0 -4
  155. package/src/console/routes/logs/route.tsx +0 -77
  156. package/src/console/routes/metrics/route.tsx +0 -36
  157. package/src/console/routes/route.tsx +0 -8
  158. package/src/console/routes/routes/route.tsx +0 -30
  159. package/src/console/routes/services/route.tsx +0 -21
  160. package/src/console/routes/system/route.tsx +0 -43
  161. package/src/console/routes/traceDetail.tsx +0 -22
  162. package/src/console/routes/traces/route.tsx +0 -81
  163. package/src/console/routes/tree.ts +0 -30
  164. package/src/console/ui/Errors.tsx +0 -76
  165. package/src/console/ui/Fibers.tsx +0 -321
  166. package/src/console/ui/Git.tsx +0 -182
  167. package/src/console/ui/Logs.tsx +0 -46
  168. package/src/console/ui/Metrics.tsx +0 -78
  169. package/src/console/ui/Routes.tsx +0 -125
  170. package/src/console/ui/Services.tsx +0 -273
  171. package/src/console/ui/Shell.tsx +0 -62
  172. package/src/console/ui/System.tsx +0 -131
  173. package/src/console/ui/Traces.tsx +0 -426
  174. package/src/sql/Sql.ts +0 -51
@@ -1,465 +0,0 @@
1
- /**
2
- * RFC 7231 Content Negotiation compatible with Express/Node.js ecosystem.
3
- * Based on {@link https://github.com/jshttp/negotiator}
4
- */
5
-
6
- const simpleMediaTypeRegExp = /^\s*([^\s/;]+)\/([^;\s]+)\s*(?:;(.*))?$/
7
- const simpleLanguageRegExp = /^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/
8
- const simpleEncodingRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/
9
- const simpleCharsetRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/
10
-
11
- function parseQuality(params) {
12
- if (!params) return 1
13
- const match = params.match(/q\s*=\s*([0-9.]+)/)
14
- if (!match) return 1
15
- const q = parseFloat(match[1])
16
- return isNaN(q) ? 1 : Math.min(Math.max(q, 0), 1)
17
- }
18
-
19
- function splitMediaTypeParams(params) {
20
- const result = {}
21
- let q = 1
22
-
23
- const parts = params.split(";")
24
- for (const part of parts) {
25
- const trimmed = part.trim()
26
- const eqIndex = trimmed.indexOf("=")
27
- if (eqIndex === -1) continue
28
-
29
- const key = trimmed.slice(0, eqIndex).trim().toLowerCase()
30
- let value = trimmed.slice(eqIndex + 1).trim()
31
-
32
- if (value.startsWith('"') && value.endsWith('"')) {
33
- value = value.slice(1, -1)
34
- }
35
-
36
- if (key === "q") {
37
- q = parseFloat(value)
38
- if (isNaN(q)) q = 1
39
- q = Math.min(Math.max(q, 0), 1)
40
- } else {
41
- result[key] = value
42
- }
43
- }
44
-
45
- return { params: result, q }
46
- }
47
-
48
- function parseAccept(accept) {
49
- const specs = []
50
- const parts = accept.split(",")
51
-
52
- for (let o = 0; o < parts.length; o++) {
53
- const part = parts[o].trim()
54
- if (!part) continue
55
-
56
- const match = simpleMediaTypeRegExp.exec(part)
57
- if (!match) continue
58
-
59
- const type = match[1].toLowerCase()
60
- const subtype = match[2].toLowerCase()
61
- const { params, q } = match[3] ? splitMediaTypeParams(match[3]) : { params: {}, q: 1 }
62
-
63
- if (q > 0) {
64
- specs.push({ type, subtype, params, q, o })
65
- }
66
- }
67
-
68
- return specs
69
- }
70
-
71
- function specifyMediaType(
72
- type,
73
- subtype,
74
- params,
75
- spec,
76
- ) {
77
- let s = 0
78
-
79
- if (spec.type === type) {
80
- s |= 4 // exact match: highest specificity
81
- } else if (type === "*") {
82
- s |= 0 // server offers wildcard (e.g. */*): matches any client type
83
- } else if (spec.type !== "*") {
84
- // client is NOT requesting wildcard: no match
85
- return null
86
- }
87
-
88
- // client requests wildcard (e.g. Accept: */*)
89
- if (spec.subtype === subtype) {
90
- s |= 2 // // exact match: highest specificity
91
- } else if (subtype === "*") {
92
- s |= 1 // server offers wildcard (e.g. text/*)
93
- } else if (spec.subtype !== "*") {
94
- return null // client is NOT requesting wildcard
95
- }
96
-
97
- // client requests wildcard (e.g. Accept: text/*): matches any server subtype
98
- const specParams = Object.keys(spec.params)
99
- if (specParams.length > 0) {
100
- if (
101
- specParams.every(
102
- (key) => spec.params[key].toLowerCase() === (params[key] || "").toLowerCase(),
103
- )
104
- ) {
105
- s |= 1
106
- } else {
107
- return null
108
- }
109
- }
110
-
111
- return { q: spec.q, s, o: spec.o }
112
- }
113
-
114
- function getMediaTypePriority(
115
- mediaType,
116
- accepted,
117
- index,
118
- ) {
119
- let best = null
120
-
121
- const match = simpleMediaTypeRegExp.exec(mediaType)
122
- if (!match) {
123
- return { value: mediaType, q: 0, s: 0, o: -1, i: index }
124
- }
125
-
126
- const type = match[1].toLowerCase()
127
- const subtype = match[2].toLowerCase()
128
- const { params } = match[3] ? splitMediaTypeParams(match[3]) : { params: {} }
129
-
130
- for (const spec of accepted) {
131
- const result = specifyMediaType(type, subtype, params, spec)
132
- if (
133
- result &&
134
- (best === null ||
135
- result.s > best.s ||
136
- (result.s === best.s && result.q > best.q) ||
137
- (result.s === best.s && result.q === best.q && result.o < best.o))
138
- ) {
139
- best = result
140
- }
141
- }
142
-
143
- return {
144
- value: mediaType,
145
- q: best?.q ?? 0,
146
- s: best?.s ?? 0,
147
- o: best?.o ?? -1,
148
- i: index,
149
- }
150
- }
151
-
152
- function parseAcceptLanguage(
153
- accept,
154
- ) {
155
- const specs = []
156
- const parts = accept.split(",")
157
-
158
- for (let o = 0; o < parts.length; o++) {
159
- const part = parts[o].trim()
160
- if (!part) continue
161
-
162
- const match = simpleLanguageRegExp.exec(part)
163
- if (!match) continue
164
-
165
- const prefix = match[1].toLowerCase()
166
- const suffix = match[2]?.toLowerCase()
167
- const q = parseQuality(match[3])
168
-
169
- if (q > 0) {
170
- specs.push({ prefix, suffix, q, o })
171
- }
172
- }
173
-
174
- return specs
175
- }
176
-
177
- function specifyLanguage(
178
- language,
179
- spec,
180
- ) {
181
- const match = simpleLanguageRegExp.exec(language)
182
- if (!match) return null
183
-
184
- const prefix = match[1].toLowerCase()
185
- const suffix = match[2]?.toLowerCase()
186
-
187
- if (spec.prefix === "*") {
188
- return { q: spec.q, s: 0, o: spec.o }
189
- }
190
-
191
- if (spec.prefix !== prefix) {
192
- return null
193
- }
194
-
195
- if (spec.suffix === undefined) {
196
- return { q: spec.q, s: suffix ? 2 : 4, o: spec.o }
197
- }
198
-
199
- if (spec.suffix === suffix) {
200
- return { q: spec.q, s: 4, o: spec.o }
201
- }
202
-
203
- return null
204
- }
205
-
206
- function getLanguagePriority(
207
- language,
208
- accepted,
209
- index,
210
- ) {
211
- let best = null
212
-
213
- for (const spec of accepted) {
214
- const result = specifyLanguage(language, spec)
215
- if (
216
- result &&
217
- (best === null ||
218
- result.s > best.s ||
219
- (result.s === best.s && result.q > best.q) ||
220
- (result.s === best.s && result.q === best.q && result.o < best.o))
221
- ) {
222
- best = result
223
- }
224
- }
225
-
226
- return {
227
- value: language,
228
- q: best?.q ?? 0,
229
- s: best?.s ?? 0,
230
- o: best?.o ?? -1,
231
- i: index,
232
- }
233
- }
234
-
235
- function parseAcceptEncoding(accept) {
236
- const specs = []
237
- const parts = accept.split(",")
238
- let hasIdentity = false
239
-
240
- for (let o = 0; o < parts.length; o++) {
241
- const part = parts[o].trim()
242
- if (!part) continue
243
-
244
- const match = simpleEncodingRegExp.exec(part)
245
- if (!match) continue
246
-
247
- const encoding = match[1].toLowerCase()
248
- const q = parseQuality(match[2])
249
-
250
- if (encoding === "identity") hasIdentity = true
251
- if (encoding === "*") hasIdentity = true
252
-
253
- if (q > 0) {
254
- specs.push({ encoding, q, o })
255
- }
256
- }
257
-
258
- if (!hasIdentity) {
259
- specs.push({ encoding: "identity", q: 0.0001, o: specs.length })
260
- }
261
-
262
- return specs
263
- }
264
-
265
- function specifyEncoding(
266
- encoding,
267
- spec,
268
- ) {
269
- const e = encoding.toLowerCase()
270
- const s = spec.encoding
271
-
272
- if (s === "*" || s === e) {
273
- return { q: spec.q, s: s === e ? 1 : 0, o: spec.o }
274
- }
275
-
276
- return null
277
- }
278
-
279
- function getEncodingPriority(
280
- encoding,
281
- accepted,
282
- index,
283
- ) {
284
- let best = null
285
-
286
- for (const spec of accepted) {
287
- const result = specifyEncoding(encoding, spec)
288
- if (
289
- result &&
290
- (best === null ||
291
- result.s > best.s ||
292
- (result.s === best.s && result.q > best.q) ||
293
- (result.s === best.s && result.q === best.q && result.o < best.o))
294
- ) {
295
- best = result
296
- }
297
- }
298
-
299
- return {
300
- value: encoding,
301
- q: best?.q ?? 0,
302
- s: best?.s ?? 0,
303
- o: best?.o ?? -1,
304
- i: index,
305
- }
306
- }
307
-
308
- function parseAcceptCharset(accept) {
309
- const specs = []
310
- const parts = accept.split(",")
311
-
312
- for (let o = 0; o < parts.length; o++) {
313
- const part = parts[o].trim()
314
- if (!part) continue
315
-
316
- const match = simpleCharsetRegExp.exec(part)
317
- if (!match) continue
318
-
319
- const charset = match[1].toLowerCase()
320
- const q = parseQuality(match[2])
321
-
322
- if (q > 0) {
323
- specs.push({ charset, q, o })
324
- }
325
- }
326
-
327
- return specs
328
- }
329
-
330
- function specifyCharset(
331
- charset,
332
- spec,
333
- ) {
334
- const c = charset.toLowerCase()
335
- const s = spec.charset
336
-
337
- if (s === "*" || s === c) {
338
- return { q: spec.q, s: s === c ? 1 : 0, o: spec.o }
339
- }
340
-
341
- return null
342
- }
343
-
344
- function getCharsetPriority(
345
- charset,
346
- accepted,
347
- index,
348
- ) {
349
- let best = null
350
-
351
- for (const spec of accepted) {
352
- const result = specifyCharset(charset, spec)
353
- if (
354
- result &&
355
- (best === null ||
356
- result.s > best.s ||
357
- (result.s === best.s && result.q > best.q) ||
358
- (result.s === best.s && result.q === best.q && result.o < best.o))
359
- ) {
360
- best = result
361
- }
362
- }
363
-
364
- return {
365
- value: charset,
366
- q: best?.q ?? 0,
367
- s: best?.s ?? 0,
368
- o: best?.o ?? -1,
369
- i: index,
370
- }
371
- }
372
-
373
- function compareSpecs(a, b) {
374
- return b.q - a.q || b.s - a.s || a.o - b.o || a.i - b.i
375
- }
376
-
377
- export function media(accept, available) {
378
- const parsed = parseAccept(accept)
379
- if (parsed.length === 0) {
380
- return []
381
- }
382
-
383
- if (!available) {
384
- return parsed.sort((a, b) => b.q - a.q || a.o - b.o).map((p) => `${p.type}/${p.subtype}`)
385
- }
386
-
387
- const priorities = available.map((t, i) => getMediaTypePriority(t, parsed, i))
388
- const sorted = priorities.filter((p) => p.q > 0).sort(compareSpecs)
389
-
390
- return sorted.map((p) => p.value)
391
- }
392
-
393
- export function language(accept, available) {
394
- const parsed = parseAcceptLanguage(accept)
395
- if (parsed.length === 0) {
396
- return []
397
- }
398
-
399
- if (!available) {
400
- return parsed
401
- .sort((a, b) => b.q - a.q || a.o - b.o)
402
- .map((p) => (p.suffix ? `${p.prefix}-${p.suffix}` : p.prefix))
403
- }
404
-
405
- const priorities = available.map((l, i) => getLanguagePriority(l, parsed, i))
406
- const sorted = priorities.filter((p) => p.q > 0).sort(compareSpecs)
407
-
408
- return sorted.map((p) => p.value)
409
- }
410
-
411
- export function encoding(accept, available) {
412
- const parsed = parseAcceptEncoding(accept)
413
- if (parsed.length === 0) {
414
- return []
415
- }
416
-
417
- if (!available) {
418
- return parsed.sort((a, b) => b.q - a.q || a.o - b.o).map((p) => p.encoding)
419
- }
420
-
421
- const priorities = available.map((e, i) => getEncodingPriority(e, parsed, i))
422
- const sorted = priorities.filter((p) => p.q > 0).sort(compareSpecs)
423
-
424
- return sorted.map((p) => p.value)
425
- }
426
-
427
- export function charset(accept, available) {
428
- const parsed = parseAcceptCharset(accept)
429
- if (parsed.length === 0) {
430
- return []
431
- }
432
-
433
- if (!available) {
434
- return parsed.sort((a, b) => b.q - a.q || a.o - b.o).map((p) => p.charset)
435
- }
436
-
437
- const priorities = available.map((c, i) => getCharsetPriority(c, parsed, i))
438
- const sorted = priorities.filter((p) => p.q > 0).sort(compareSpecs)
439
-
440
- return sorted.map((p) => p.value)
441
- }
442
-
443
- export function headerMedia(headers, available) {
444
- const accept = headers.get("accept")
445
- if (!accept) return []
446
- return media(accept, available)
447
- }
448
-
449
- export function headerLanguage(headers, available) {
450
- const accept = headers.get("accept-language")
451
- if (!accept) return []
452
- return language(accept, available)
453
- }
454
-
455
- export function headerEncoding(headers, available) {
456
- const accept = headers.get("accept-encoding")
457
- if (!accept) return []
458
- return encoding(accept, available)
459
- }
460
-
461
- export function headerCharset(headers, available) {
462
- const accept = headers.get("accept-charset")
463
- if (!accept) return []
464
- return charset(accept, available)
465
- }