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
package/dist/Commander.js DELETED
@@ -1,410 +0,0 @@
1
- import * as Data from "effect/Data"
2
- import * as Effect from "effect/Effect"
3
- import * as Pipeable from "effect/Pipeable"
4
- import * as Predicate from "effect/Predicate"
5
- import * as Schema from "effect/Schema"
6
-
7
- export class CommanderError extends Data.TaggedError("CommanderError") {}
8
-
9
- const TypeId = Symbol.for("effect-start/Commander")
10
-
11
- export const option = (
12
- long,
13
- short,
14
- ) => {
15
- const longName = long
16
- const shortName = short ? short.slice(1) : undefined
17
-
18
- return {
19
- schema: (schema) => ({
20
- _tag: /** @type {const} */ "OptionBuilder",
21
- name: longName,
22
- long: longName,
23
- short: shortName,
24
- description: "",
25
- schema,
26
- }),
27
-
28
- description: (desc) => ({
29
- schema: (schema) => ({
30
- _tag: /** @type {const} */ "OptionBuilder",
31
- name: longName,
32
- long: longName,
33
- short: shortName,
34
- description: desc,
35
- schema,
36
- }),
37
-
38
- default: (value) => ({
39
- schema: (schema) => ({
40
- _tag: /** @type {const} */ "OptionBuilder",
41
- name: longName,
42
- long: longName,
43
- short: shortName,
44
- description: desc,
45
- schema,
46
- defaultValue: value,
47
- }),
48
- }),
49
- }),
50
-
51
- default: (value) => ({
52
- schema: (schema) => ({
53
- _tag: /** @type {const} */ "OptionBuilder",
54
- name: longName,
55
- long: longName,
56
- short: shortName,
57
- description: "",
58
- schema,
59
- defaultValue: value,
60
- }),
61
-
62
- description: (desc) => ({
63
- schema: (schema) => ({
64
- _tag: /** @type {const} */ "OptionBuilder",
65
- name: longName,
66
- long: longName,
67
- short: shortName,
68
- description: desc,
69
- schema,
70
- defaultValue: value,
71
- }),
72
- }),
73
- }),
74
- }
75
- }
76
-
77
- const optionMethod = function (
78
- opt,
79
- ) {
80
- const base = (this && typeof this === "object" ? this : {})
81
- const baseName = base.name ?? ""
82
- const baseOptions = base.options ?? {}
83
- const baseSubcommands = base.subcommands ?? []
84
- const baseDescription = base.description
85
- const baseVersion = base.version
86
-
87
- const camelKey = kebabToCamel(stripPrefix(opt.long))
88
-
89
- return makeSet({
90
- name: baseName,
91
- description: baseDescription,
92
- version: baseVersion,
93
- options: { ...baseOptions, [camelKey]: opt },
94
- subcommands: baseSubcommands,
95
- })
96
- }
97
-
98
- export const optionHelp = function (
99
- ) {
100
- const base = (this && typeof this === "object" ? this : {})
101
- const baseName = base.name ?? ""
102
- const baseOptions = base.options ?? {}
103
- const baseSubcommands = base.subcommands ?? []
104
- const baseDescription = base.description
105
- const baseVersion = base.version
106
-
107
- const helpOption = {
108
- _tag: "OptionBuilder",
109
- name: "--help",
110
- long: "--help",
111
- short: "h",
112
- description: "Show help information",
113
- defaultValue: false,
114
- }
115
-
116
- return makeSet({
117
- name: baseName,
118
- description: baseDescription,
119
- version: baseVersion,
120
- options: { ...baseOptions, help: helpOption },
121
- subcommands: baseSubcommands,
122
- })
123
- }
124
-
125
- export const optionVersion = function (
126
- ) {
127
- const base = (this && typeof this === "object" ? this : {})
128
- const baseName = base.name ?? ""
129
- const baseOptions = base.options ?? {}
130
- const baseSubcommands = base.subcommands ?? []
131
- const baseDescription = base.description
132
- const baseVersion = base.version
133
-
134
- const versionOption = {
135
- _tag: "OptionBuilder",
136
- name: "--version",
137
- long: "--version",
138
- short: "V",
139
- description: "Show version information",
140
- defaultValue: false,
141
- }
142
-
143
- return makeSet({
144
- name: baseName,
145
- description: baseDescription,
146
- version: baseVersion,
147
- options: { ...baseOptions, version: versionOption },
148
- subcommands: baseSubcommands,
149
- })
150
- }
151
-
152
- export const subcommand = function (
153
- cmd,
154
- ) {
155
- const base = (this && typeof this === "object" ? this : {})
156
- const baseName = base.name ?? ""
157
- const baseOptions = base.options ?? {}
158
- const baseSubcommands = base.subcommands ?? []
159
- const baseDescription = base.description
160
- const baseVersion = base.version
161
-
162
- const subDef = {
163
- _tag: "SubcommandDef",
164
- command: cmd,
165
- }
166
-
167
- return makeSet({
168
- name: baseName,
169
- description: baseDescription,
170
- version: baseVersion,
171
- options: baseOptions,
172
- subcommands: [...baseSubcommands, subDef],
173
- })
174
- }
175
-
176
- export const handle = function (
177
- handler,
178
- ) {
179
- const base = this
180
-
181
- return makeSet({
182
- name: base.name,
183
- description: base.description,
184
- version: base.version,
185
- options: base.options,
186
- subcommands: base.subcommands,
187
- handler,
188
- })
189
- }
190
-
191
- export const make = (config) =>
192
- makeSet({
193
- name: config.name,
194
- description: config.description,
195
- version: config.version,
196
- options: {},
197
- subcommands: [],
198
- })
199
-
200
- const CommanderProto = {
201
- [TypeId]: TypeId,
202
-
203
- option: optionMethod,
204
- optionHelp,
205
- optionVersion,
206
- subcommand,
207
- handle,
208
-
209
- pipe() {
210
- return Pipeable.pipeArguments(this, arguments)
211
- },
212
- }
213
-
214
- function makeSet(config) {
215
- return Object.assign(Object.create(CommanderProto), config)
216
- }
217
-
218
- export function isCommanderSet(input) {
219
- return Predicate.hasProperty(input, TypeId)
220
- }
221
-
222
- const kebabToCamel = (str) => {
223
- return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())
224
- }
225
-
226
- const stripPrefix = (str) => {
227
- if (str.startsWith("--")) return str.slice(2)
228
- if (str.startsWith("-")) return str.slice(1)
229
- return str
230
- }
231
-
232
- const parseRawArgs = (args) =>
233
- Effect.gen(function* () {
234
- const flags = {}
235
- const options = {}
236
- const positional = []
237
-
238
- let i = 0
239
- while (i < args.length) {
240
- const arg = args[i]
241
-
242
- if (arg === "--") {
243
- positional.push(...args.slice(i + 1))
244
- break
245
- }
246
-
247
- if (arg.startsWith("--")) {
248
- const equalIndex = arg.indexOf("=")
249
- if (equalIndex !== -1) {
250
- const key = arg.slice(2, equalIndex)
251
- const value = arg.slice(equalIndex + 1)
252
- options[key] = value
253
- } else {
254
- const key = arg.slice(2)
255
- if (i + 1 < args.length && !args[i + 1].startsWith("-")) {
256
- options[key] = args[i + 1]
257
- i++
258
- } else {
259
- flags[key] = true
260
- }
261
- }
262
- } else if (arg.startsWith("-") && arg.length > 1) {
263
- const chars = arg.slice(1)
264
- for (let j = 0; j < chars.length; j++) {
265
- const char = chars[j]
266
- if (j === chars.length - 1 && i + 1 < args.length && !args[i + 1].startsWith("-")) {
267
- options[char] = args[i + 1]
268
- i++
269
- } else {
270
- flags[char] = true
271
- }
272
- }
273
- } else {
274
- positional.push(arg)
275
- }
276
-
277
- i++
278
- }
279
-
280
- return { flags, options, positional }
281
- })
282
-
283
- export const parse = (
284
- cmd,
285
- args,
286
- ) =>
287
- Effect.gen(function* () {
288
- const parsed = yield* parseRawArgs(args)
289
-
290
- const result = {}
291
-
292
- for (const optBuilder of Object.values(cmd.options)) {
293
- const longName = stripPrefix(optBuilder.long)
294
- const shortName = optBuilder.short
295
-
296
- const longMatch = parsed.options[longName] || parsed.flags[longName]
297
- const shortMatch = shortName
298
- ? parsed.options[shortName] || parsed.flags[shortName]
299
- : undefined
300
-
301
- const rawValue = longMatch ?? shortMatch
302
-
303
- const camelKey = kebabToCamel(stripPrefix(optBuilder.long))
304
-
305
- if (rawValue !== undefined) {
306
- if (typeof rawValue === "boolean") {
307
- result[camelKey] = rawValue
308
- } else if (optBuilder.schema) {
309
- const decoded = yield* Schema.decode(optBuilder.schema)(rawValue).pipe(
310
- Effect.mapError(
311
- (error) =>
312
- new CommanderError({
313
- message: `Invalid value for option ${optBuilder.long}: ${error.message}`,
314
- cause: error,
315
- }),
316
- ),
317
- )
318
- result[camelKey] = decoded
319
- } else {
320
- result[camelKey] = rawValue
321
- }
322
- } else if (optBuilder.defaultValue !== undefined) {
323
- result[camelKey] = optBuilder.defaultValue
324
- }
325
- }
326
-
327
- return result
328
- })
329
-
330
- export const runMain = (
331
- cmd,
332
- ) =>
333
- Effect.gen(function* () {
334
- const args = typeof process !== "undefined" ? process.argv.slice(2) : []
335
-
336
- const parsedOptions = yield* parse(cmd, args)
337
-
338
- if (Predicate.hasProperty(parsedOptions, "help") && parsedOptions.help) {
339
- console.log(generateHelp(cmd))
340
- return
341
- }
342
-
343
- if (Predicate.hasProperty(parsedOptions, "version") && parsedOptions.version && cmd.version) {
344
- console.log(`${cmd.name} v${cmd.version}`)
345
- return
346
- }
347
-
348
- if (cmd.handler) {
349
- yield* cmd.handler(parsedOptions)
350
- }
351
- })
352
-
353
- const generateHelp = (
354
- cmd,
355
- ) => {
356
- const lines = []
357
-
358
- if (cmd.description) {
359
- lines.push(cmd.description)
360
- lines.push("")
361
- }
362
-
363
- lines.push(`Usage: ${cmd.name} [options]`)
364
- lines.push("")
365
-
366
- const optionsArray = Object.values(cmd.options)
367
- if (optionsArray.length > 0) {
368
- lines.push("Options:")
369
-
370
- for (const opt of optionsArray) {
371
- const short = opt.short ? `-${opt.short}, ` : " "
372
- const long = opt.long
373
- const hasValue = opt.schema !== undefined
374
- const name = hasValue ? `${long} <value>` : long
375
- lines.push(` ${short}${name.padEnd(20)} ${opt.description}`)
376
- }
377
-
378
- lines.push("")
379
- }
380
-
381
- if (cmd.subcommands.length > 0) {
382
- lines.push("Commands:")
383
- for (const sub of cmd.subcommands) {
384
- const subCmd = sub.command
385
- lines.push(` ${subCmd.name.padEnd(20)} ${subCmd.description || ""}`)
386
- }
387
- lines.push("")
388
- }
389
-
390
- return lines.join("\n")
391
- }
392
-
393
- export const help = (
394
- cmd,
395
- ) => generateHelp(cmd)
396
-
397
- export const NumberFromString = Schema.NumberFromString
398
-
399
- export const choice = (
400
- choices,
401
- ) => Schema.Literal(...choices)
402
-
403
- export const repeatable = (
404
- schema,
405
- ) =>
406
- Schema.transform(Schema.String, Schema.Array(Schema.String), {
407
- strict: true,
408
- decode: (s) => s.split(",").map((part) => part.trim()),
409
- encode: (arr) => arr.join(","),
410
- }).pipe(Schema.compose(Schema.Array(schema)))