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,166 +0,0 @@
1
- /** @jsxImportSource effect-start */
2
- import * as test from "bun:test"
3
- import type * as Engine from "../datastar/engine.ts"
4
- import * as Effect from "effect/Effect"
5
- import * as Entity from "../Entity.ts"
6
- import * as Fetch from "../Fetch.ts"
7
- import * as Route from "../Route.ts"
8
- import * as RouteHttp from "../RouteHttp.ts"
9
- import * as HyperRoute from "./HyperRoute.ts"
10
-
11
- test.describe("HyperRoute.html", () => {
12
- test.it("renders JSX to HTML string", async () => {
13
- const handler = RouteHttp.toWebHandler(Route.get(HyperRoute.html(<div>Hello World</div>)))
14
-
15
- const response = await Fetch.fromHandler(handler, { path: "/" })
16
-
17
- test.expect(response.status).toBe(200)
18
- test.expect(response.headers.get("Content-Type")).toBe("text/html; charset=utf-8")
19
- test.expect(await response.text()).toBe("<div>Hello World</div>")
20
- })
21
-
22
- test.it("renders nested JSX elements", async () => {
23
- const handler = RouteHttp.toWebHandler(
24
- Route.get(
25
- HyperRoute.html(
26
- <div class="container">
27
- <h1>Title</h1>
28
- <p>Paragraph</p>
29
- </div>,
30
- ),
31
- ),
32
- )
33
-
34
- const response = await Fetch.fromHandler(handler, { path: "/" })
35
-
36
- test
37
- .expect(await response.text())
38
- .toBe('<div class="container"><h1>Title</h1><p>Paragraph</p></div>')
39
- })
40
-
41
- test.it("renders JSX from Effect", async () => {
42
- const handler = RouteHttp.toWebHandler(
43
- Route.get(HyperRoute.html(Effect.succeed(<span>From Effect</span>))),
44
- )
45
-
46
- const response = await Fetch.fromHandler(handler, { path: "/" })
47
-
48
- test.expect(await response.text()).toBe("<span>From Effect</span>")
49
- })
50
-
51
- test.it("renders JSX from generator function", async () => {
52
- const handler = RouteHttp.toWebHandler(
53
- Route.get(
54
- HyperRoute.html(
55
- Effect.gen(function* () {
56
- const name = yield* Effect.succeed("World")
57
- return <div>Hello {name}</div>
58
- }),
59
- ),
60
- ),
61
- )
62
-
63
- const response = await Fetch.fromHandler(handler, { path: "/" })
64
-
65
- test.expect(await response.text()).toBe("<div>Hello World</div>")
66
- })
67
-
68
- test.it("renders JSX from handler function", async () => {
69
- const handler = RouteHttp.toWebHandler(
70
- Route.get(HyperRoute.html((context) => Effect.succeed(<div>Request received</div>))),
71
- )
72
-
73
- const response = await Fetch.fromHandler(handler, { path: "/" })
74
-
75
- test.expect(await response.text()).toBe("<div>Request received</div>")
76
- })
77
-
78
- test.it("renders JSX with dynamic content", async () => {
79
- const items = ["Apple", "Banana", "Cherry"]
80
-
81
- const handler = RouteHttp.toWebHandler(
82
- Route.get(
83
- HyperRoute.html(
84
- <ul>
85
- {items.map((item) => (
86
- <li>{item}</li>
87
- ))}
88
- </ul>,
89
- ),
90
- ),
91
- )
92
-
93
- const response = await Fetch.fromHandler(handler, { path: "/" })
94
-
95
- test.expect(await response.text()).toBe("<ul><li>Apple</li><li>Banana</li><li>Cherry</li></ul>")
96
- })
97
-
98
- test.it("handles Entity with JSX body", async () => {
99
- const handler = RouteHttp.toWebHandler(
100
- Route.get(HyperRoute.html(Entity.make(<div>With Entity</div>, { status: 201 }))),
101
- )
102
-
103
- const response = await Fetch.fromHandler(handler, { path: "/" })
104
-
105
- test.expect(response.status).toBe(201)
106
- test.expect(await response.text()).toBe("<div>With Entity</div>")
107
- })
108
-
109
- test.it("renders data-* attributes with object values as JSON", async () => {
110
- const handler = RouteHttp.toWebHandler(
111
- Route.get(
112
- HyperRoute.html(
113
- <div
114
- data-signals={{
115
- draft: "",
116
- pendingDraft: "",
117
- username: "User123",
118
- }}
119
- >
120
- Content
121
- </div>,
122
- ),
123
- ),
124
- )
125
-
126
- const response = await Fetch.fromHandler(handler, { path: "/" })
127
-
128
- test
129
- .expect(await response.text())
130
- .toBe(`<div data-signals='{"draft":"","pendingDraft":"","username":"User123"}'>Content</div>`)
131
- })
132
-
133
- test.it("data-on-click function argument is typed as DataEvent", () => {
134
- const node = (
135
- <button
136
- data-on:click={(e) => {
137
- test.expectTypeOf(e).toMatchTypeOf<Engine.DataEvent>()
138
- test.expectTypeOf(e.window).toMatchTypeOf<Window & typeof globalThis>()
139
- }}
140
- />
141
- )
142
-
143
- test.expect(node).toBeDefined()
144
- })
145
-
146
- test.it("renders script with function child as IIFE", async () => {
147
- const handler = RouteHttp.toWebHandler(
148
- Route.get(
149
- HyperRoute.html(
150
- <script>
151
- {(window) => {
152
- console.log("Hello from", window.document.title)
153
- }}
154
- </script>,
155
- ),
156
- ),
157
- )
158
-
159
- const response = await Fetch.fromHandler(handler, { path: "/" })
160
- const text = await response.text()
161
-
162
- test.expect(text).toContain("<script>(")
163
- test.expect(text).toContain(")(window)</script>")
164
- test.expect(text).toContain("window.document.title")
165
- })
166
- })
@@ -1,59 +0,0 @@
1
- import * as Effect from "effect/Effect"
2
- import * as Entity from "../Entity.ts"
3
- import * as Route from "../Route.ts"
4
- import type * as RouteBody from "../RouteBody.ts"
5
- import type * as Values from "../_Values.ts"
6
- import * as HyperHtml from "./HyperHtml.ts"
7
- import type { JSX } from "./jsx.d.ts"
8
-
9
- function renderValue(
10
- value: JSX.Children | Entity.Entity<JSX.Children>,
11
- ): string | Entity.Entity<string> {
12
- if (Entity.isEntity(value)) {
13
- return Entity.make(HyperHtml.renderToString(value.body), {
14
- status: value.status,
15
- url: value.url,
16
- headers: value.headers,
17
- })
18
- }
19
- return HyperHtml.renderToString(value)
20
- }
21
-
22
- function normalizeToEffect<B, A, E, R>(
23
- handler: RouteBody.HandlerInput<B, A, E, R>,
24
- context: Values.Simplify<B>,
25
- next: (context?: Partial<B> & Record<string, unknown>) => Entity.Entity<A>,
26
- ): Effect.Effect<A | Entity.Entity<A>, E, R> {
27
- if (Effect.isEffect(handler)) {
28
- return handler
29
- }
30
- if (typeof handler === "function") {
31
- const result = (handler as Function)(context, next)
32
- if (Effect.isEffect(result)) {
33
- return result as Effect.Effect<A | Entity.Entity<A>, E, R>
34
- }
35
- return Effect.gen(function* () {
36
- return yield* result
37
- }) as Effect.Effect<A | Entity.Entity<A>, E, R>
38
- }
39
- return Effect.succeed(handler as A | Entity.Entity<A>)
40
- }
41
-
42
- export function html<
43
- D extends Route.RouteDescriptor.Any,
44
- B extends {},
45
- I extends Route.Route.Tuple,
46
- E = never,
47
- R = never,
48
- >(
49
- handler: RouteBody.HandlerInput<
50
- NoInfer<D & B & Route.ExtractBindings<I> & { format: "html" }>,
51
- JSX.Children,
52
- E,
53
- R
54
- >,
55
- ) {
56
- return Route.html<D, B, I, string, E, R>((context, next) =>
57
- Effect.map(normalizeToEffect(handler, context, next as never), renderValue),
58
- )
59
- }
package/src/hyper/html.ts DELETED
@@ -1,47 +0,0 @@
1
- const HtmlStringSymbol = Symbol.for("HtmlString")
2
-
3
- export interface HtmlString {
4
- readonly [HtmlStringSymbol]: true
5
- readonly value: string
6
- }
7
-
8
- const makeHtmlString = (value: string): HtmlString => ({
9
- [HtmlStringSymbol]: true,
10
- value,
11
- })
12
-
13
- const isHtmlString = (value: unknown): value is HtmlString =>
14
- typeof value === "object" && value !== null && HtmlStringSymbol in value
15
-
16
- export type HtmlValue =
17
- | string
18
- | number
19
- | bigint
20
- | boolean
21
- | null
22
- | undefined
23
- | HtmlString
24
- | Function
25
- | Record<string, unknown>
26
- | ReadonlyArray<HtmlValue>
27
-
28
- const resolveValue = (value: HtmlValue): string => {
29
- if (value === null || value === undefined || value === false || value === true) return ""
30
- if (isHtmlString(value)) return value.value
31
- if (Array.isArray(value)) return (value as Array<HtmlValue>).map(resolveValue).join("")
32
- if (typeof value === "function") return value.toString()
33
- if (typeof value === "object") return JSON.stringify(value)
34
- if (typeof value === "string") return value
35
- return String(value)
36
- }
37
-
38
- export const html = (strings: TemplateStringsArray, ...values: Array<HtmlValue>): HtmlString => {
39
- let result = strings[0]
40
- for (let i = 0; i < values.length; i++) {
41
- result += resolveValue(values[i])
42
- result += strings[i + 1]
43
- }
44
- return makeHtmlString(result)
45
- }
46
-
47
- html.raw = (value: string): HtmlString => makeHtmlString(value)
@@ -1,6 +0,0 @@
1
- export * as Hyper from "./Hyper.ts"
2
- export { html } from "./html.ts"
3
- export type { HtmlString, HtmlValue } from "./html.ts"
4
- export * as HyperHtml from "./HyperHtml.ts"
5
- export * as HyperNode from "./HyperNode.ts"
6
- export * as HyperRoute from "./HyperRoute.ts"
@@ -1,15 +0,0 @@
1
- import * as HyperNode from "./HyperNode.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 HyperNode.Type>(
9
- type: T,
10
- props: T extends string ? HyperNode.Props : T extends (props: infer P) => any ? P : never,
11
- ): HyperNode.HyperNode {
12
- return HyperNode.make(type, props)
13
- }
14
-
15
- export { Fragment, type JSX, jsx, jsx as jsxDEV, jsx as jsxs }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes