effect-start 0.29.0 → 0.30.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 (228) hide show
  1. package/README.md +1 -1
  2. package/dist/{_Development.d.ts → Development.d.ts} +2 -1
  3. package/dist/Development.d.ts.map +1 -0
  4. package/dist/{_Development.js → Development.js} +2 -1
  5. package/dist/Development.js.map +1 -0
  6. package/dist/Fetch.d.ts +0 -8
  7. package/dist/Fetch.d.ts.map +1 -1
  8. package/dist/Fetch.js +6 -22
  9. package/dist/Fetch.js.map +1 -1
  10. package/dist/FileRouter.js +1 -1
  11. package/dist/FileRouter.js.map +1 -1
  12. package/dist/GlobalLayer.d.ts.map +1 -1
  13. package/dist/GlobalLayer.js +1 -1
  14. package/dist/GlobalLayer.js.map +1 -1
  15. package/dist/Html.d.ts +32 -0
  16. package/dist/Html.d.ts.map +1 -0
  17. package/dist/{hyper/HyperHtml.js → Html.js} +45 -26
  18. package/dist/Html.js.map +1 -0
  19. package/dist/Route.d.ts +20 -7
  20. package/dist/Route.d.ts.map +1 -1
  21. package/dist/Route.js +24 -3
  22. package/dist/Route.js.map +1 -1
  23. package/dist/RouteBody.d.ts +13 -6
  24. package/dist/RouteBody.d.ts.map +1 -1
  25. package/dist/RouteBody.js +38 -27
  26. package/dist/RouteBody.js.map +1 -1
  27. package/dist/RouteHttp.d.ts.map +1 -1
  28. package/dist/RouteHttp.js +18 -1
  29. package/dist/RouteHttp.js.map +1 -1
  30. package/dist/RouteMount.js +1 -1
  31. package/dist/RouteMount.js.map +1 -1
  32. package/dist/System.d.ts +1 -1
  33. package/dist/System.d.ts.map +1 -1
  34. package/dist/System.js.map +1 -1
  35. package/dist/_ChildProcess.d.ts +1 -1
  36. package/dist/_ChildProcess.d.ts.map +1 -1
  37. package/dist/_ChildProcess.js.map +1 -1
  38. package/dist/bun/BunRoute.d.ts +1 -1
  39. package/dist/bun/BunRoute.d.ts.map +1 -1
  40. package/dist/bun/BunRoute.js +102 -33
  41. package/dist/bun/BunRoute.js.map +1 -1
  42. package/dist/bun/BunServer.d.ts.map +1 -1
  43. package/dist/bun/BunServer.js.map +1 -1
  44. package/dist/cloudflare/CloudflareTunnel.d.ts +12 -0
  45. package/dist/cloudflare/CloudflareTunnel.d.ts.map +1 -0
  46. package/dist/{x/cloudflare → cloudflare}/CloudflareTunnel.js +1 -1
  47. package/dist/cloudflare/CloudflareTunnel.js.map +1 -0
  48. package/dist/cloudflare/index.d.ts.map +1 -0
  49. package/dist/cloudflare/index.js.map +1 -0
  50. package/dist/index.d.ts +3 -1
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +3 -1
  53. package/dist/index.js.map +1 -1
  54. package/dist/jsx-runtime.d.ts +8 -0
  55. package/dist/jsx-runtime.d.ts.map +1 -0
  56. package/dist/{hyper/jsx-runtime.js → jsx-runtime.js} +2 -2
  57. package/dist/jsx-runtime.js.map +1 -0
  58. package/dist/studio/routes/errors/route.d.ts.map +1 -1
  59. package/dist/studio/routes/errors/route.js +3 -4
  60. package/dist/studio/routes/errors/route.js.map +1 -1
  61. package/dist/studio/routes/fiberDetail.d.ts.map +1 -1
  62. package/dist/studio/routes/fiberDetail.js +1 -2
  63. package/dist/studio/routes/fiberDetail.js.map +1 -1
  64. package/dist/studio/routes/fibers/route.d.ts.map +1 -1
  65. package/dist/studio/routes/fibers/route.js +3 -4
  66. package/dist/studio/routes/fibers/route.js.map +1 -1
  67. package/dist/studio/routes/logs/route.d.ts.map +1 -1
  68. package/dist/studio/routes/logs/route.js +3 -4
  69. package/dist/studio/routes/logs/route.js.map +1 -1
  70. package/dist/studio/routes/metrics/route.d.ts.map +1 -1
  71. package/dist/studio/routes/metrics/route.js +3 -4
  72. package/dist/studio/routes/metrics/route.js.map +1 -1
  73. package/dist/studio/routes/route.d.ts +1 -1
  74. package/dist/studio/routes/routes/route.d.ts.map +1 -1
  75. package/dist/studio/routes/routes/route.js +1 -2
  76. package/dist/studio/routes/routes/route.js.map +1 -1
  77. package/dist/studio/routes/services/route.d.ts.map +1 -1
  78. package/dist/studio/routes/services/route.js +1 -2
  79. package/dist/studio/routes/services/route.js.map +1 -1
  80. package/dist/studio/routes/system/route.d.ts.map +1 -1
  81. package/dist/studio/routes/system/route.js +3 -4
  82. package/dist/studio/routes/system/route.js.map +1 -1
  83. package/dist/studio/routes/traceDetail.d.ts.map +1 -1
  84. package/dist/studio/routes/traceDetail.js +1 -2
  85. package/dist/studio/routes/traceDetail.js.map +1 -1
  86. package/dist/studio/routes/traces/route.d.ts.map +1 -1
  87. package/dist/studio/routes/traces/route.js +3 -4
  88. package/dist/studio/routes/traces/route.js.map +1 -1
  89. package/dist/studio/routes/tree.d.ts +1 -1
  90. package/dist/studio/ui/Errors.d.ts +1 -1
  91. package/dist/studio/ui/Errors.d.ts.map +1 -1
  92. package/dist/studio/ui/Fibers.d.ts +2 -2
  93. package/dist/studio/ui/Fibers.d.ts.map +1 -1
  94. package/dist/studio/ui/Logs.d.ts +1 -1
  95. package/dist/studio/ui/Logs.d.ts.map +1 -1
  96. package/dist/studio/ui/Metrics.d.ts +1 -1
  97. package/dist/studio/ui/Metrics.d.ts.map +1 -1
  98. package/dist/studio/ui/Routes.d.ts +1 -1
  99. package/dist/studio/ui/Routes.d.ts.map +1 -1
  100. package/dist/studio/ui/Services.d.ts +1 -1
  101. package/dist/studio/ui/Services.d.ts.map +1 -1
  102. package/dist/studio/ui/Shell.d.ts +2 -2
  103. package/dist/studio/ui/Shell.d.ts.map +1 -1
  104. package/dist/studio/ui/System.d.ts +1 -1
  105. package/dist/studio/ui/System.d.ts.map +1 -1
  106. package/dist/studio/ui/Traces.d.ts +3 -3
  107. package/dist/studio/ui/Traces.d.ts.map +1 -1
  108. package/dist/tailscale/TailscaleTunnel.d.ts +16 -0
  109. package/dist/tailscale/TailscaleTunnel.d.ts.map +1 -0
  110. package/dist/{x/tailscale → tailscale}/TailscaleTunnel.js +2 -2
  111. package/dist/tailscale/TailscaleTunnel.js.map +1 -0
  112. package/dist/tailscale/index.d.ts.map +1 -0
  113. package/dist/tailscale/index.js.map +1 -0
  114. package/dist/tailwind/TailwindPlugin.d.ts.map +1 -0
  115. package/dist/tailwind/TailwindPlugin.js.map +1 -0
  116. package/dist/tailwind/compile.d.ts.map +1 -0
  117. package/dist/{x/tailwind → tailwind}/compile.js +1 -1
  118. package/dist/tailwind/compile.js.map +1 -0
  119. package/dist/tailwind/index.d.ts +3 -0
  120. package/dist/tailwind/index.d.ts.map +1 -0
  121. package/dist/tailwind/index.js +3 -0
  122. package/dist/tailwind/index.js.map +1 -0
  123. package/dist/tailwind/plugin.d.ts.map +1 -0
  124. package/dist/{x/tailwind → tailwind}/plugin.js +1 -1
  125. package/dist/tailwind/plugin.js.map +1 -0
  126. package/package.json +37 -37
  127. package/src/{_Development.ts → Development.ts} +5 -0
  128. package/src/Fetch.ts +10 -37
  129. package/src/FileRouter.ts +1 -1
  130. package/src/GlobalLayer.ts +3 -1
  131. package/src/{hyper/HyperHtml.ts → Html.ts} +90 -30
  132. package/src/Route.ts +67 -11
  133. package/src/RouteBody.ts +87 -62
  134. package/src/RouteHttp.ts +19 -1
  135. package/src/RouteMount.ts +1 -1
  136. package/src/System.ts +1 -1
  137. package/src/_ChildProcess.ts +1 -1
  138. package/src/bun/BunRoute.ts +125 -37
  139. package/src/bun/BunServer.ts +1 -0
  140. package/src/{x/cloudflare → cloudflare}/CloudflareTunnel.ts +1 -1
  141. package/src/index.ts +3 -1
  142. package/src/jsx-runtime.ts +15 -0
  143. package/src/{hyper/jsx.d.ts → jsx.d.ts} +3 -3
  144. package/src/studio/routes/errors/route.tsx +3 -4
  145. package/src/studio/routes/fiberDetail.tsx +1 -2
  146. package/src/studio/routes/fibers/route.tsx +3 -4
  147. package/src/studio/routes/logs/route.tsx +3 -4
  148. package/src/studio/routes/metrics/route.tsx +3 -4
  149. package/src/studio/routes/routes/route.tsx +1 -2
  150. package/src/studio/routes/services/route.tsx +1 -2
  151. package/src/studio/routes/system/route.tsx +3 -4
  152. package/src/studio/routes/traceDetail.tsx +1 -2
  153. package/src/studio/routes/traces/route.tsx +3 -4
  154. package/src/{x/tailscale → tailscale}/TailscaleTunnel.ts +2 -2
  155. package/src/{x/tailwind → tailwind}/compile.ts +1 -1
  156. package/src/tailwind/index.ts +2 -0
  157. package/src/{x/tailwind → tailwind}/plugin.ts +1 -1
  158. package/dist/_Development.d.ts.map +0 -1
  159. package/dist/_Development.js.map +0 -1
  160. package/dist/hyper/Hyper.d.ts +0 -26
  161. package/dist/hyper/Hyper.d.ts.map +0 -1
  162. package/dist/hyper/Hyper.js +0 -24
  163. package/dist/hyper/Hyper.js.map +0 -1
  164. package/dist/hyper/HyperHtml.d.ts +0 -24
  165. package/dist/hyper/HyperHtml.d.ts.map +0 -1
  166. package/dist/hyper/HyperHtml.js.map +0 -1
  167. package/dist/hyper/HyperHtml.test.d.ts +0 -2
  168. package/dist/hyper/HyperHtml.test.d.ts.map +0 -1
  169. package/dist/hyper/HyperHtml.test.js +0 -283
  170. package/dist/hyper/HyperHtml.test.js.map +0 -1
  171. package/dist/hyper/HyperNode.d.ts +0 -14
  172. package/dist/hyper/HyperNode.d.ts.map +0 -1
  173. package/dist/hyper/HyperNode.js +0 -12
  174. package/dist/hyper/HyperNode.js.map +0 -1
  175. package/dist/hyper/HyperRoute.d.ts +0 -9
  176. package/dist/hyper/HyperRoute.d.ts.map +0 -1
  177. package/dist/hyper/HyperRoute.js +0 -33
  178. package/dist/hyper/HyperRoute.js.map +0 -1
  179. package/dist/hyper/HyperRoute.test.d.ts +0 -2
  180. package/dist/hyper/HyperRoute.test.d.ts.map +0 -1
  181. package/dist/hyper/HyperRoute.test.js +0 -84
  182. package/dist/hyper/HyperRoute.test.js.map +0 -1
  183. package/dist/hyper/html.d.ts +0 -12
  184. package/dist/hyper/html.d.ts.map +0 -1
  185. package/dist/hyper/html.js +0 -31
  186. package/dist/hyper/html.js.map +0 -1
  187. package/dist/hyper/index.d.ts +0 -7
  188. package/dist/hyper/index.d.ts.map +0 -1
  189. package/dist/hyper/index.js +0 -6
  190. package/dist/hyper/index.js.map +0 -1
  191. package/dist/hyper/jsx-runtime.d.ts +0 -8
  192. package/dist/hyper/jsx-runtime.d.ts.map +0 -1
  193. package/dist/hyper/jsx-runtime.js.map +0 -1
  194. package/dist/x/cloudflare/CloudflareTunnel.d.ts +0 -12
  195. package/dist/x/cloudflare/CloudflareTunnel.d.ts.map +0 -1
  196. package/dist/x/cloudflare/CloudflareTunnel.js.map +0 -1
  197. package/dist/x/cloudflare/index.d.ts.map +0 -1
  198. package/dist/x/cloudflare/index.js.map +0 -1
  199. package/dist/x/tailscale/TailscaleTunnel.d.ts +0 -16
  200. package/dist/x/tailscale/TailscaleTunnel.d.ts.map +0 -1
  201. package/dist/x/tailscale/TailscaleTunnel.js.map +0 -1
  202. package/dist/x/tailscale/index.d.ts.map +0 -1
  203. package/dist/x/tailscale/index.js.map +0 -1
  204. package/dist/x/tailwind/TailwindPlugin.d.ts.map +0 -1
  205. package/dist/x/tailwind/TailwindPlugin.js.map +0 -1
  206. package/dist/x/tailwind/compile.d.ts.map +0 -1
  207. package/dist/x/tailwind/compile.js.map +0 -1
  208. package/dist/x/tailwind/plugin.d.ts.map +0 -1
  209. package/dist/x/tailwind/plugin.js.map +0 -1
  210. package/src/hyper/Hyper.ts +0 -55
  211. package/src/hyper/HyperHtml.test.tsx +0 -395
  212. package/src/hyper/HyperNode.ts +0 -33
  213. package/src/hyper/HyperRoute.test.tsx +0 -166
  214. package/src/hyper/HyperRoute.ts +0 -59
  215. package/src/hyper/html.ts +0 -47
  216. package/src/hyper/index.ts +0 -6
  217. package/src/hyper/jsx-runtime.ts +0 -15
  218. /package/dist/{x/cloudflare → cloudflare}/index.d.ts +0 -0
  219. /package/dist/{x/cloudflare → cloudflare}/index.js +0 -0
  220. /package/dist/{x/tailscale → tailscale}/index.d.ts +0 -0
  221. /package/dist/{x/tailscale → tailscale}/index.js +0 -0
  222. /package/dist/{x/tailwind → tailwind}/TailwindPlugin.d.ts +0 -0
  223. /package/dist/{x/tailwind → tailwind}/TailwindPlugin.js +0 -0
  224. /package/dist/{x/tailwind → tailwind}/compile.d.ts +0 -0
  225. /package/dist/{x/tailwind → tailwind}/plugin.d.ts +0 -0
  226. /package/src/{x/cloudflare → cloudflare}/index.ts +0 -0
  227. /package/src/{x/tailscale → tailscale}/index.ts +0 -0
  228. /package/src/{x/tailwind → tailwind}/TailwindPlugin.ts +0 -0
@@ -1,11 +1,12 @@
1
- import type * as Bun from "bun"
1
+ import * as Bun from "bun"
2
+ import * as NPath from "node:path"
2
3
  import * as Data from "effect/Data"
3
4
  import * as Either from "effect/Either"
4
5
  import * as Effect from "effect/Effect"
6
+ import * as FiberRef from "effect/FiberRef"
5
7
  import * as Option from "effect/Option"
6
8
  import * as Entity from "../Entity.ts"
7
- import * as Hyper from "../hyper/Hyper.ts"
8
- import * as HyperHtml from "../hyper/HyperHtml.ts"
9
+ import * as Html from "../Html.ts"
9
10
  import * as PathPattern from "../_PathPattern.ts"
10
11
  import * as Route from "../Route.ts"
11
12
  import * as Unique from "../Unique.ts"
@@ -36,6 +37,8 @@ export function descriptors(
36
37
 
37
38
  type HTMLBundleModule = Bun.HTMLBundle | { default: Bun.HTMLBundle }
38
39
 
40
+ const bundleDepthRef = FiberRef.unsafeMake(0)
41
+
39
42
  export function htmlBundle(load: () => HTMLBundleModule | Promise<HTMLBundleModule>) {
40
43
  const bunPrefix = `/.BunRoute-${Unique.token(10)}`
41
44
  const bunLoad = () =>
@@ -66,6 +69,7 @@ export function htmlBundle(load: () => HTMLBundleModule | Promise<HTMLBundleModu
66
69
  > = (context, next) =>
67
70
  Effect.gen(function* () {
68
71
  const originalRequest = context.request
72
+ const bundleDepth = yield* FiberRef.get(bundleDepthRef)
69
73
 
70
74
  if (originalRequest.headers.get(INTERNAL_FETCH_HEADER) === "true") {
71
75
  const url = new URL(originalRequest.url)
@@ -79,60 +83,83 @@ export function htmlBundle(load: () => HTMLBundleModule | Promise<HTMLBundleModu
79
83
  )
80
84
  }
81
85
 
82
- const bunServer = yield* BunServer.BunServer
83
- const url = new URL(originalRequest.url)
86
+ let html = ""
87
+ let status = 200
88
+ let contentType = "text/html;charset=utf-8"
84
89
 
85
- const internalPath = `${bunPrefix}${url.pathname}`
86
- const internalUrl = new URL(internalPath, bunServer.server.url)
90
+ if (bundleDepth === 0) {
91
+ const bunServer = yield* BunServer.BunServer
92
+ const url = new URL(originalRequest.url)
87
93
 
88
- const headers = new Headers(originalRequest.headers)
89
- headers.set(INTERNAL_FETCH_HEADER, "true")
94
+ const internalPath = `${bunPrefix}${url.pathname}`
95
+ const internalUrl = new URL(internalPath, bunServer.server.url)
90
96
 
91
- const proxyRequest = new Request(internalUrl, {
92
- method: originalRequest.method,
93
- headers,
94
- })
97
+ const headers = new Headers(originalRequest.headers)
98
+ headers.set(INTERNAL_FETCH_HEADER, "true")
95
99
 
96
- const response = yield* Effect.tryPromise({
97
- try: () => fetch(proxyRequest),
98
- catch: (error) =>
99
- new BunRouteError({
100
- reason: "ProxyError",
101
- pattern: internalPath,
102
- message: `Failed to fetch internal HTML bundle: ${String(error)}`,
103
- }),
104
- })
100
+ const proxyRequest = new Request(internalUrl, {
101
+ method: originalRequest.method,
102
+ headers,
103
+ })
105
104
 
106
- let html = yield* Effect.tryPromise({
107
- try: () => response.text(),
108
- catch: (error) =>
109
- new BunRouteError({
110
- reason: "ProxyError",
111
- pattern: internalPath,
112
- message: String(error),
113
- }),
114
- })
105
+ const response = yield* Effect.tryPromise({
106
+ try: () => fetch(proxyRequest),
107
+ catch: (error) =>
108
+ new BunRouteError({
109
+ reason: "ProxyError",
110
+ pattern: internalPath,
111
+ message: `Failed to fetch internal HTML bundle: ${String(error)}`,
112
+ }),
113
+ })
115
114
 
116
- const childEntity = yield* next(context)
115
+ html = yield* Effect.tryPromise({
116
+ try: () => response.text(),
117
+ catch: (error) =>
118
+ new BunRouteError({
119
+ reason: "ProxyError",
120
+ pattern: internalPath,
121
+ message: String(error),
122
+ }),
123
+ })
124
+ status = response.status
125
+ contentType = response.headers.get("content-type") ?? contentType
126
+ } else {
127
+ html = yield* readBundleHtml(bunLoad).pipe(
128
+ Effect.mapError(
129
+ (error) =>
130
+ new BunRouteError({
131
+ reason: "ProxyError",
132
+ pattern: bunPrefix,
133
+ message: `Failed to load nested HTML bundle: ${String(error)}`,
134
+ }),
135
+ ),
136
+ )
137
+ }
138
+
139
+ const childEntity = yield* next(context).pipe(
140
+ Effect.locally(bundleDepthRef, bundleDepth + 1),
141
+ )
117
142
  const children = childEntity?.body ?? childEntity
118
143
 
119
144
  let childrenHtml = ""
120
145
  if (children != null) {
121
146
  if ((children as unknown) instanceof Response) {
122
147
  childrenHtml = yield* Effect.promise(() => (children as unknown as Response).text())
123
- } else if (Hyper.isGenericJsxObject(children)) {
124
- childrenHtml = HyperHtml.renderToString(children)
148
+ } else if (Html.isGenericJsxObject(children)) {
149
+ childrenHtml = Html.renderToString(children)
125
150
  } else {
126
151
  childrenHtml = String(children)
127
152
  }
128
153
  }
129
154
 
130
- html = html.replace(/%children%/g, childrenHtml)
155
+ childrenHtml = yield* stripInjectedBunScripts(childrenHtml)
156
+
157
+ html = html.replaceAll("%children%", childrenHtml)
131
158
 
132
159
  return Entity.make(html, {
133
- status: response.status,
160
+ status,
134
161
  headers: {
135
- "content-type": response.headers.get("content-type"),
162
+ "content-type": contentType,
136
163
  },
137
164
  })
138
165
  })
@@ -149,6 +176,67 @@ export function htmlBundle(load: () => HTMLBundleModule | Promise<HTMLBundleModu
149
176
  }
150
177
  }
151
178
 
179
+ function stripInjectedBunScripts(html: string) {
180
+ let removeNextInlineScript = false
181
+ const rewriter = new HTMLRewriter().on("script", {
182
+ element(element) {
183
+ const src = element.getAttribute("src")
184
+ const hasDevAttribute = element.getAttribute("data-bun-dev-server-script") !== null
185
+
186
+ if (hasDevAttribute || (src !== null && src.startsWith("/_bun/client/"))) {
187
+ element.remove()
188
+ removeNextInlineScript = true
189
+ return
190
+ }
191
+
192
+ if (removeNextInlineScript && src === null) {
193
+ element.remove()
194
+ removeNextInlineScript = false
195
+ return
196
+ }
197
+
198
+ removeNextInlineScript = false
199
+ },
200
+ })
201
+
202
+ return Effect.tryPromise({
203
+ try: () => rewriter.transform(new Response(html)).text(),
204
+ catch: (error) =>
205
+ new BunRouteError({
206
+ reason: "ProxyError",
207
+ pattern: "stripInjectedBunScripts",
208
+ message: String(error),
209
+ }),
210
+ })
211
+ }
212
+
213
+ function readBundleHtml(bunLoad: () => Promise<Bun.HTMLBundle>) {
214
+ return Effect.tryPromise({
215
+ try: () => bunLoad(),
216
+ catch: (error) =>
217
+ new BunRouteError({
218
+ reason: "ProxyError",
219
+ pattern: "readBundleHtml",
220
+ message: String(error),
221
+ }),
222
+ }).pipe(
223
+ Effect.andThen((bundle) => {
224
+ const indexPath = NPath.isAbsolute(bundle.index)
225
+ ? bundle.index
226
+ : NPath.resolve(NPath.dirname(Bun.main), bundle.index)
227
+ return Effect.tryPromise({
228
+ try: () => Bun.file(indexPath).text(),
229
+ catch: (error) =>
230
+ new BunRouteError({
231
+ reason: "ProxyError",
232
+ pattern: indexPath,
233
+ message: String(error),
234
+ }),
235
+ })
236
+ }),
237
+ )
238
+ }
239
+
152
240
  type BunServerFetchHandler = (
153
241
  request: Request,
154
242
  server: Bun.Server<unknown>,
@@ -19,6 +19,7 @@ import * as StartApp from "../_StartApp.ts"
19
19
  import type * as RouteMount from "../RouteMount.ts"
20
20
  import * as RouteTree from "../RouteTree.ts"
21
21
  import * as BunRoute from "./BunRoute.ts"
22
+
22
23
  export interface WebSocketContext {
23
24
  readonly deferred: Deferred.Deferred<Bun.ServerWebSocket<WebSocketContext>>
24
25
  readonly closeDeferred: Deferred.Deferred<void, Socket.SocketError>
@@ -1,4 +1,4 @@
1
- import * as System from "../../System.ts"
1
+ import * as System from "../System.ts"
2
2
  import { Config, Effect, Layer, LogLevel, Option, pipe, Stream, String } from "effect"
3
3
 
4
4
  export const start = (opts: {
package/src/index.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  export * as Bundle from "./bundler/Bundle.ts"
2
- export * as Development from "./_Development.ts"
2
+ export * as Development from "./Development.ts"
3
3
  export * as Entity from "./Entity.ts"
4
+ export { html } from "./Html.ts"
5
+ export * as Html from "./Html.ts"
4
6
  export * as FileRouter from "./FileRouter.ts"
5
7
  export * as Route from "./Route.ts"
6
8
  export * as Start from "./Start.ts"
@@ -0,0 +1,15 @@
1
+ import * as Html from "./Html.ts"
2
+ import type { JSX } from "./jsx.d.ts"
3
+
4
+ function Fragment(props: { children: JSX.Element }) {
5
+ return props.children
6
+ }
7
+
8
+ function jsx<T extends Html.ElementType>(
9
+ type: T,
10
+ props: T extends string ? Html.ElemenetProps : T extends (props: infer P) => any ? P : never,
11
+ ): Html.Element {
12
+ return Html.make(type, props)
13
+ }
14
+
15
+ export { Fragment, type JSX, jsx, jsx as jsxDEV, jsx as jsxs }
@@ -1,5 +1,5 @@
1
- import type * as HyperNode from "./HyperNode.ts"
2
- import type { DatastarAttributes } from "../datastar/jsx.d.ts"
1
+ import type * as Html from "./Html.ts"
2
+ import type { DatastarAttributes } from "./datastar/jsx.d.ts"
3
3
 
4
4
  /**
5
5
  * Based on JSX types for Surplus, Inferno, and dom-expressions.
@@ -17,7 +17,7 @@ import type { DatastarAttributes } from "../datastar/jsx.d.ts"
17
17
  type DOMElement = never
18
18
 
19
19
  export namespace JSX {
20
- type Element = HyperNode.HyperNode
20
+ type Element = Html.Element
21
21
  type Child = Element | string | number | bigint
22
22
  type Children = Child | SilentChild | Iterable<Children>
23
23
 
@@ -1,7 +1,6 @@
1
1
  import * as Stream from "effect/Stream"
2
2
  import * as Route from "../../../Route.ts"
3
- import * as HyperHtml from "../../../hyper/HyperHtml.ts"
4
- import * as HyperRoute from "../../../hyper/HyperRoute.ts"
3
+ import * as Html from "../../../Html.ts"
5
4
  import * as StudioStore from "../../StudioStore.ts"
6
5
  import * as Errors from "../../ui/Errors.tsx"
7
6
  import * as Shell from "../../ui/Shell.tsx"
@@ -9,7 +8,7 @@ import * as Shell from "../../ui/Shell.tsx"
9
8
  const prefix = StudioStore.store.prefix
10
9
 
11
10
  export default Route.get(
12
- HyperRoute.html(function* (ctx) {
11
+ Route.html(function* (ctx) {
13
12
  const url = new URL(ctx.request.url)
14
13
  const search = url.searchParams.get("errorSearch") || ""
15
14
  const tag = url.searchParams.get("errorTag") || ""
@@ -76,7 +75,7 @@ export default Route.get(
76
75
  Stream.fromPubSub(StudioStore.store.events).pipe(
77
76
  Stream.filter((e) => e._tag === "Error"),
78
77
  Stream.map((e) => {
79
- const html = HyperHtml.renderToString(<Errors.ErrorLine error={e.error} />).replace(
78
+ const html = Html.renderToString(<Errors.ErrorLine error={e.error} />).replace(
80
79
  /\n/g,
81
80
  "",
82
81
  )
@@ -2,14 +2,13 @@ import * as Schema from "effect/Schema"
2
2
  import * as Route from "../../Route.ts"
3
3
  import * as RouteSchema from "../../RouteSchema.ts"
4
4
  import * as Unique from "../../Unique.ts"
5
- import * as HyperRoute from "../../hyper/HyperRoute.ts"
6
5
  import * as StudioStore from "../StudioStore.ts"
7
6
  import * as Fibers from "../ui/Fibers.tsx"
8
7
  import * as Shell from "../ui/Shell.tsx"
9
8
 
10
9
  export default Route.get(
11
10
  RouteSchema.schemaPathParams(Schema.Struct({ id: Schema.String })),
12
- HyperRoute.html(function* (ctx) {
11
+ Route.html(function* (ctx) {
13
12
  const fiberId = ctx.pathParams.id
14
13
  const fiberName = fiberId.startsWith("#") ? fiberId : `#${fiberId}`
15
14
 
@@ -1,14 +1,13 @@
1
1
  import * as Effect from "effect/Effect"
2
2
  import * as Stream from "effect/Stream"
3
3
  import * as Route from "../../../Route.ts"
4
- import * as HyperHtml from "../../../hyper/HyperHtml.ts"
5
- import * as HyperRoute from "../../../hyper/HyperRoute.ts"
4
+ import * as Html from "../../../Html.ts"
6
5
  import * as StudioStore from "../../StudioStore.ts"
7
6
  import * as Fibers from "../../ui/Fibers.tsx"
8
7
  import * as Shell from "../../ui/Shell.tsx"
9
8
 
10
9
  export default Route.get(
11
- HyperRoute.html(function* () {
10
+ Route.html(function* () {
12
11
  const logs = yield* StudioStore.allLogs(StudioStore.store.sql)
13
12
  const spans = yield* StudioStore.allSpans(StudioStore.store.sql)
14
13
  const fibers = Fibers.collectFibers(logs, spans)
@@ -32,7 +31,7 @@ export default Route.get(
32
31
  const logs = yield* StudioStore.allLogs(StudioStore.store.sql)
33
32
  const spans = yield* StudioStore.allSpans(StudioStore.store.sql)
34
33
  const fibers = Fibers.collectFibers(logs, spans)
35
- const html = HyperHtml.renderToString(
34
+ const html = Html.renderToString(
36
35
  <Fibers.FiberList fibers={fibers} prefix={StudioStore.store.prefix} />,
37
36
  ).replace(/\n/g, "")
38
37
  return {
@@ -1,7 +1,6 @@
1
1
  import * as Stream from "effect/Stream"
2
2
  import * as Route from "../../../Route.ts"
3
- import * as HyperHtml from "../../../hyper/HyperHtml.ts"
4
- import * as HyperRoute from "../../../hyper/HyperRoute.ts"
3
+ import * as Html from "../../../Html.ts"
5
4
  import * as StudioStore from "../../StudioStore.ts"
6
5
  import * as Logs from "../../ui/Logs.tsx"
7
6
  import * as Shell from "../../ui/Shell.tsx"
@@ -9,7 +8,7 @@ import * as Shell from "../../ui/Shell.tsx"
9
8
  const prefix = StudioStore.store.prefix
10
9
 
11
10
  export default Route.get(
12
- HyperRoute.html(function* (ctx) {
11
+ Route.html(function* (ctx) {
13
12
  const url = new URL(ctx.request.url)
14
13
  const level = url.searchParams.get("logLevel") || ""
15
14
  const search = url.searchParams.get("logSearch") || ""
@@ -62,7 +61,7 @@ export default Route.get(
62
61
  Stream.fromPubSub(StudioStore.store.events).pipe(
63
62
  Stream.filter((e) => e._tag === "Log"),
64
63
  Stream.map((e) => {
65
- const html = HyperHtml.renderToString(<Logs.LogLine log={e.log} />).replace(/\n/g, "")
64
+ const html = Html.renderToString(<Logs.LogLine log={e.log} />).replace(/\n/g, "")
66
65
  return {
67
66
  event: "datastar-patch-elements",
68
67
  data: `selector #logs-container\nmode prepend\nelements ${html}`,
@@ -1,13 +1,12 @@
1
1
  import * as Stream from "effect/Stream"
2
2
  import * as Route from "../../../Route.ts"
3
- import * as HyperHtml from "../../../hyper/HyperHtml.ts"
4
- import * as HyperRoute from "../../../hyper/HyperRoute.ts"
3
+ import * as Html from "../../../Html.ts"
5
4
  import * as StudioStore from "../../StudioStore.ts"
6
5
  import * as Metrics from "../../ui/Metrics.tsx"
7
6
  import * as Shell from "../../ui/Shell.tsx"
8
7
 
9
8
  export default Route.get(
10
- HyperRoute.html(function* () {
9
+ Route.html(function* () {
11
10
  return (
12
11
  <Shell.Shell prefix={StudioStore.store.prefix} active="metrics">
13
12
  <div class="tab-header">Metrics</div>
@@ -22,7 +21,7 @@ export default Route.get(
22
21
  Stream.fromPubSub(StudioStore.store.events).pipe(
23
22
  Stream.filter((e) => e._tag === "MetricsSnapshot"),
24
23
  Stream.map((e) => {
25
- const html = HyperHtml.renderToString(<Metrics.MetricsGrid metrics={e.metrics} />).replace(
24
+ const html = Html.renderToString(<Metrics.MetricsGrid metrics={e.metrics} />).replace(
26
25
  /\n/g,
27
26
  "",
28
27
  )
@@ -1,12 +1,11 @@
1
1
  import * as Route from "../../../Route.ts"
2
2
  import * as RouteTree from "../../../RouteTree.ts"
3
- import * as HyperRoute from "../../../hyper/HyperRoute.ts"
4
3
  import * as StudioStore from "../../StudioStore.ts"
5
4
  import * as Routes from "../../ui/Routes.tsx"
6
5
  import * as Shell from "../../ui/Shell.tsx"
7
6
 
8
7
  export default Route.get(
9
- HyperRoute.html(function* () {
8
+ Route.html(function* () {
10
9
  const tree = yield* Route.Routes
11
10
  const routes: Array<Routes.RouteInfo> = []
12
11
  for (const route of RouteTree.walk(tree)) {
@@ -1,12 +1,11 @@
1
1
  import * as Effect from "effect/Effect"
2
2
  import * as Route from "../../../Route.ts"
3
- import * as HyperRoute from "../../../hyper/HyperRoute.ts"
4
3
  import * as StudioStore from "../../StudioStore.ts"
5
4
  import * as Services from "../../ui/Services.tsx"
6
5
  import * as Shell from "../../ui/Shell.tsx"
7
6
 
8
7
  export default Route.get(
9
- HyperRoute.html(function* () {
8
+ Route.html(function* () {
10
9
  const ctx = yield* Effect.context<never>()
11
10
  const services = Services.collectServices(ctx.unsafeMap)
12
11
  return (
@@ -1,13 +1,12 @@
1
1
  import * as Stream from "effect/Stream"
2
2
  import * as Route from "../../../Route.ts"
3
- import * as HyperHtml from "../../../hyper/HyperHtml.ts"
4
- import * as HyperRoute from "../../../hyper/HyperRoute.ts"
3
+ import * as Html from "../../../Html.ts"
5
4
  import * as StudioStore from "../../StudioStore.ts"
6
5
  import * as System from "../../ui/System.tsx"
7
6
  import * as Shell from "../../ui/Shell.tsx"
8
7
 
9
8
  export default Route.get(
10
- HyperRoute.html(function* () {
9
+ Route.html(function* () {
11
10
  const stats = StudioStore.store.process
12
11
  return (
13
12
  <Shell.Shell prefix={StudioStore.store.prefix} active="system">
@@ -29,7 +28,7 @@ export default Route.get(
29
28
  Stream.fromPubSub(StudioStore.store.events).pipe(
30
29
  Stream.filter((e) => e._tag === "ProcessSnapshot"),
31
30
  Stream.map((e) => {
32
- const html = HyperHtml.renderToString(<System.SystemStatsView stats={e.stats} />).replace(
31
+ const html = Html.renderToString(<System.SystemStatsView stats={e.stats} />).replace(
33
32
  /\n/g,
34
33
  "",
35
34
  )
@@ -1,14 +1,13 @@
1
1
  import * as Schema from "effect/Schema"
2
2
  import * as Route from "../../Route.ts"
3
3
  import * as RouteSchema from "../../RouteSchema.ts"
4
- import * as HyperRoute from "../../hyper/HyperRoute.ts"
5
4
  import * as StudioStore from "../StudioStore.ts"
6
5
  import * as Shell from "../ui/Shell.tsx"
7
6
  import * as Traces from "../ui/Traces.tsx"
8
7
 
9
8
  export default Route.get(
10
9
  RouteSchema.schemaPathParams(Schema.Struct({ id: Schema.String })),
11
- HyperRoute.html(function* (ctx) {
10
+ Route.html(function* (ctx) {
12
11
  let traceId: bigint
13
12
  try {
14
13
  traceId = BigInt(ctx.pathParams.id)
@@ -1,8 +1,7 @@
1
1
  import * as Effect from "effect/Effect"
2
2
  import * as Stream from "effect/Stream"
3
3
  import * as Route from "../../../Route.ts"
4
- import * as HyperHtml from "../../../hyper/HyperHtml.ts"
5
- import * as HyperRoute from "../../../hyper/HyperRoute.ts"
4
+ import * as Html from "../../../Html.ts"
6
5
  import * as StudioStore from "../../StudioStore.ts"
7
6
  import * as Shell from "../../ui/Shell.tsx"
8
7
  import * as Traces from "../../ui/Traces.tsx"
@@ -10,7 +9,7 @@ import * as Traces from "../../ui/Traces.tsx"
10
9
  const prefix = StudioStore.store.prefix
11
10
 
12
11
  export default Route.get(
13
- HyperRoute.html(function* (ctx) {
12
+ Route.html(function* (ctx) {
14
13
  const url = new URL(ctx.request.url)
15
14
  const search = url.searchParams.get("traceSearch") || ""
16
15
  const allSpans = yield* StudioStore.allSpans(StudioStore.store.sql)
@@ -57,7 +56,7 @@ export default Route.get(
57
56
  Stream.mapEffect(() =>
58
57
  Effect.gen(function* () {
59
58
  const spans = yield* StudioStore.allSpans(StudioStore.store.sql)
60
- const html = HyperHtml.renderToString(<Traces.TraceGroups spans={spans} />).replace(
59
+ const html = Html.renderToString(<Traces.TraceGroups spans={spans} />).replace(
61
60
  /\n/g,
62
61
  "",
63
62
  )
@@ -1,5 +1,5 @@
1
- import * as StartApp from "../../_StartApp.ts"
2
- import * as System from "../../System.ts"
1
+ import * as StartApp from "../_StartApp.ts"
2
+ import * as System from "../System.ts"
3
3
  import * as Deferred from "effect/Deferred"
4
4
  import * as Effect from "effect/Effect"
5
5
  import * as Layer from "effect/Layer"
@@ -2,7 +2,7 @@ import fsPromises from "node:fs/promises"
2
2
  import path from "node:path"
3
3
  import { pathToFileURL } from "node:url"
4
4
  import { compile as _compile, compileAst as _compileAst, Features, Polyfills } from "tailwindcss"
5
- import * as BunEnhancedResolve from "../../bun/_BunEnhancedResolve"
5
+ import * as BunEnhancedResolve from "../bun/_BunEnhancedResolve"
6
6
 
7
7
  type AstNode = Parameters<typeof _compileAst>[0][number]
8
8
 
@@ -0,0 +1,2 @@
1
+ export { default } from "./plugin.ts"
2
+ export * as TailwindPlugin from "./TailwindPlugin.ts"
@@ -1,5 +1,5 @@
1
1
  import * as NPath from "node:path"
2
- import * as NodeUtils from "../../node/NodeUtils.ts"
2
+ import * as NodeUtils from "../node/NodeUtils.ts"
3
3
  import * as TailwindPlugin from "./TailwindPlugin.ts"
4
4
 
5
5
  // Append `?dir=` to module identifier to pass custom directory to scan
@@ -1 +0,0 @@
1
- {"version":3,"file":"_Development.d.ts","sourceRoot":"","sources":["../src/_Development.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,MAAM,MAAM,gBAAgB,GACxB,UAAU,CAAC,UAAU,GACrB;IACE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CACxB,CAAA;AAOL,gBAAgB;AAChB,eAAO,MAAM,gBAAgB,YAG5B,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA;CACxC,CAAA;;AAED,qBAAa,WAAY,SAAQ,gBAG9B;CAAG;AA6DN,eAAO,MAAM,KAAK,GAAI,OAAO;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,KAAK,OAAO,CAAA;CACnD,2DAA2C,CAAA;AAE5C,eAAO,MAAM,MAAM,gEAAoC,CAAA;AAEvD,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAUlD,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"_Development.js","sourceRoot":"","sources":["../src/_Development.ts"],"names":[],"mappings":"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"}
@@ -1,26 +0,0 @@
1
- import * as Context from "effect/Context";
2
- import type { JSX } from "./jsx.d.ts";
3
- type Elements = JSX.IntrinsicElements;
4
- type Children = JSX.Children;
5
- export type { Children, Elements, JSX };
6
- declare const Hyper_base: Context.TagClass<Hyper, "Hyper", {}>;
7
- export declare class Hyper extends Hyper_base {
8
- }
9
- type Primitive = string | number | boolean | null | undefined;
10
- export type HyperType = string | HyperComponent;
11
- export type HyperProps = {
12
- [key: string]: Primitive | ReadonlyArray<Primitive> | HyperNode | HyperNode[] | null | undefined;
13
- };
14
- export type HyperComponent = (props: HyperProps) => HyperNode | Primitive;
15
- export interface HyperNode {
16
- type: HyperType;
17
- props: HyperProps;
18
- }
19
- export declare function h(type: HyperType, props: HyperProps): HyperNode;
20
- export declare function unsafeUse<Value>(tag: Context.Tag<any, Value>): Value;
21
- export type GenericJsxObject = {
22
- type: any;
23
- props: any;
24
- };
25
- export declare function isGenericJsxObject(value: unknown): value is GenericJsxObject;
26
- //# sourceMappingURL=Hyper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Hyper.d.ts","sourceRoot":"","sources":["../../src/hyper/Hyper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAGzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AAErC,KAAK,QAAQ,GAAG,GAAG,CAAC,iBAAiB,CAAA;AAErC,KAAK,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAA;AAE5B,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAA;;AAEvC,qBAAa,KAAM,SAAQ,UAAiC;CAAG;AAI/D,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;AAE7D,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,cAAc,CAAA;AAE/C,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,GAAG,SAAS,GAAG,SAAS,EAAE,GAAG,IAAI,GAAG,SAAS,CAAA;CACjG,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,SAAS,GAAG,SAAS,CAAA;AAEzE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,EAAE,UAAU,CAAA;CAClB;AAED,wBAAgB,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,SAAS,CAQ/D;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,SAK5D;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,GAAG,CAAA;IACT,KAAK,EAAE,GAAG,CAAA;CACX,CAAA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAE5E"}
@@ -1,24 +0,0 @@
1
- import * as Context from "effect/Context";
2
- import * as Fiber from "effect/Fiber";
3
- import * as Option from "effect/Option";
4
- export class Hyper extends Context.Tag("Hyper")() {
5
- }
6
- const NoChildren = Object.freeze([]);
7
- export function h(type, props) {
8
- return {
9
- type,
10
- props: {
11
- ...props,
12
- children: props.children ?? NoChildren,
13
- },
14
- };
15
- }
16
- export function unsafeUse(tag) {
17
- const currentFiber = Option.getOrThrow(Fiber.getCurrentFiber());
18
- const context = currentFiber.currentContext;
19
- return Context.unsafeGet(context, tag);
20
- }
21
- export function isGenericJsxObject(value) {
22
- return typeof value === "object" && value !== null && "type" in value && "props" in value;
23
- }
24
- //# sourceMappingURL=Hyper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Hyper.js","sourceRoot":"","sources":["../../src/hyper/Hyper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AASvC,MAAM,OAAO,KAAM,SAAQ,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAa;CAAG;AAE/D,MAAM,UAAU,GAAyB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AAiB1D,MAAM,UAAU,CAAC,CAAC,IAAe,EAAE,KAAiB;IAClD,OAAO;QACL,IAAI;QACJ,KAAK,EAAE;YACL,GAAG,KAAK;YACR,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,UAAU;SACvC;KACF,CAAA;AACH,CAAC;AAED,MAAM,UAAU,SAAS,CAAQ,GAA4B;IAC3D,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC,CAAA;IAC/D,MAAM,OAAO,GAAG,YAAY,CAAC,cAAc,CAAA;IAE3C,OAAO,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;AACxC,CAAC;AAOD,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,CAAA;AAC3F,CAAC"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Renders Hyper JSX nodes to HTML.
3
- *
4
- * Effect Start comes with {@link Hyper} and {@link JsxRuntime} to enable
5
- * JSX support. The advantage of using JSX over HTML strings or templates
6
- * is type safety and better editor support.
7
- *
8
- * JSX nodes are compatible with React's and Solid's.
9
-
10
- * You can enable JSX support by updating `tsconfig.json`:
11
- *
12
- * {
13
- * compilerOptions: {
14
- * jsx: "react-jsx",
15
- * jsxImportSource: "effect-start" | "react" | "praect" // etc.
16
- * }
17
- * }
18
- */
19
- import type * as HyperNode from "./HyperNode.ts";
20
- import type { JSX } from "./jsx.d.ts";
21
- export declare function renderToString(node: JSX.Children, hooks?: {
22
- onNode?: (node: HyperNode.HyperNode) => void;
23
- }): string;
24
- //# sourceMappingURL=HyperHtml.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HyperHtml.d.ts","sourceRoot":"","sources":["../../src/hyper/HyperHtml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAEhD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AAoCrC,wBAAgB,cAAc,CAC5B,IAAI,EAAE,GAAG,CAAC,QAAQ,EAClB,KAAK,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,KAAK,IAAI,CAAA;CAAE,GACvD,MAAM,CAgHR"}