acrylblends 0.6.1 → 0.6.3

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 (217) hide show
  1. package/README.md +11 -6
  2. package/docs/framework/README.md +3 -2
  3. package/docs/framework/UPSTREAM.md +1 -1
  4. package/docs/framework/api/presets.md +0 -3
  5. package/docs/framework/cordis/acryl-in-a-cordis-app.md +9 -0
  6. package/docs/framework/getting-started/basic.md +5 -4
  7. package/docs/framework/getting-started/desktop.md +41 -0
  8. package/docs/framework/guides/jsx-dom.md +0 -3
  9. package/docs/framework/guides/jsx.md +1 -4
  10. package/docs/framework/guides/middleware.md +1 -1
  11. package/docs/framework/helpers/cookie.md +1 -1
  12. package/docs/framework/helpers/css.md +0 -3
  13. package/docs/framework/helpers/dev.md +0 -3
  14. package/docs/framework/helpers/jwt.md +1 -1
  15. package/docs/framework/helpers/proxy.md +0 -3
  16. package/docs/framework/middleware/builtin/basic-auth.md +6 -6
  17. package/docs/framework/middleware/builtin/cache.md +0 -3
  18. package/docs/framework/middleware/builtin/combine.md +1 -1
  19. package/docs/framework/middleware/builtin/ip-restriction.md +1 -1
  20. package/docs/framework/middleware/builtin/logger.md +1 -1
  21. package/docs/framework/middleware/builtin/mount.md +0 -3
  22. package/docs/framework/upstream.json +3 -3
  23. package/lib/accepts.d.ts +1 -1
  24. package/lib/acryl-base.d.ts +1 -1
  25. package/lib/adapter.d.ts +1 -1
  26. package/lib/{app-CmAYW1Al.d.ts → app-wFwpg-bt.d.ts} +1 -1
  27. package/lib/base-BpQy2Rk7.d.ts +783 -0
  28. package/lib/base-ddiVmiE7.js +721 -0
  29. package/lib/basic-auth.d.ts +1 -1
  30. package/lib/bearer-auth.d.ts +1 -1
  31. package/lib/body-limit.d.ts +1 -1
  32. package/lib/cache.d.ts +43 -0
  33. package/lib/cache.js +169 -0
  34. package/lib/client.d.ts +2 -2
  35. package/lib/combine.d.ts +1 -1
  36. package/lib/common-D8Z4JRCw.d.ts +46 -0
  37. package/lib/components-Ce5FRyHU.js +268 -0
  38. package/lib/components-DYZdxJIJ.js +24 -0
  39. package/lib/compress.d.ts +1 -1
  40. package/lib/conninfo.d.ts +2 -2
  41. package/lib/constants-BR9jM9BC.js +9 -0
  42. package/lib/{context-Bm7rI-oK.d.ts → context-DVQBjuns.d.ts} +1 -1
  43. package/lib/context-DxFdY_un.d.ts +250 -0
  44. package/lib/context-storage.d.ts +1 -1
  45. package/lib/{cookie-ClMaKDQf.d.ts → cookie-CCelEqky.d.ts} +1 -1
  46. package/lib/cookie.d.ts +3 -3
  47. package/lib/cors.d.ts +1 -1
  48. package/lib/csrf.d.ts +1 -1
  49. package/lib/css-D2jb7X8b.js +320 -0
  50. package/lib/css.d.ts +82 -0
  51. package/lib/css.js +134 -0
  52. package/lib/dev.d.ts +19 -0
  53. package/lib/dev.js +50 -0
  54. package/lib/etag.d.ts +1 -1
  55. package/lib/factory.d.ts +2 -2
  56. package/lib/hooks-Bq5q9IMl.js +762 -0
  57. package/lib/html-SllAe0YT.d.ts +46 -0
  58. package/lib/html.d.ts +1 -1
  59. package/lib/index-C850MeBA.d.ts +94 -0
  60. package/lib/{index-oOClm_Xk.d.ts → index-CUTfU69R.d.ts} +3 -3
  61. package/lib/{index-B-3F4wt2.d.ts → index-Cqcdluyn.d.ts} +2 -2
  62. package/lib/{index-UTBmM3GX.d.ts → index-CsvB-F9j.d.ts} +2 -2
  63. package/lib/index.d.ts +4 -4
  64. package/lib/ip-restriction.d.ts +2 -2
  65. package/lib/jsx/dom/client.d.ts +30 -0
  66. package/lib/jsx/dom/client.js +49 -0
  67. package/lib/jsx/dom/css.d.ts +84 -0
  68. package/lib/jsx/dom/css.js +2 -0
  69. package/lib/jsx/dom/jsx-dev-runtime.d.ts +3 -0
  70. package/lib/jsx/dom/jsx-dev-runtime.js +2 -0
  71. package/lib/jsx/dom/jsx-runtime.d.ts +3 -0
  72. package/lib/jsx/dom/jsx-runtime.js +2 -0
  73. package/lib/jsx/dom/server.d.ts +105 -0
  74. package/lib/jsx/dom/server.js +37 -0
  75. package/lib/jsx/dom.d.ts +5 -0
  76. package/lib/jsx/dom.js +74 -0
  77. package/lib/jsx/jsx-dev-runtime.d.ts +6 -0
  78. package/lib/jsx/jsx-dev-runtime.js +14 -0
  79. package/lib/jsx/jsx-runtime.d.ts +10 -0
  80. package/lib/jsx/jsx-runtime.js +30 -0
  81. package/lib/jsx/streaming.d.ts +2 -0
  82. package/lib/jsx/streaming.js +2 -0
  83. package/lib/jsx-dev-runtime-B22O-Npk.d.ts +7 -0
  84. package/lib/jsx-dev-runtime-kAhR_4C7.js +354 -0
  85. package/lib/jsx-runtime-BVVgDSdq.d.ts +1 -0
  86. package/lib/jsx.d.ts +3 -0
  87. package/lib/jsx.js +47 -0
  88. package/lib/jwk.d.ts +4 -4
  89. package/lib/{jwt-Dg493Tai.d.ts → jwt-BARhotDz.d.ts} +1 -1
  90. package/lib/jwt.d.ts +4 -4
  91. package/lib/language.d.ts +1 -1
  92. package/lib/linear-router-C3FPib6h.js +96 -0
  93. package/lib/logger.d.ts +1 -1
  94. package/lib/loopback-only.d.ts +1 -1
  95. package/lib/method-not-allowed.d.ts +2 -2
  96. package/lib/method-override.d.ts +2 -2
  97. package/lib/mount.d.ts +44 -0
  98. package/lib/mount.js +67 -0
  99. package/lib/node-server/conninfo.d.ts +1 -1
  100. package/lib/node-server/serve-static.d.ts +1 -1
  101. package/lib/node-server/serve-static.js +1 -1
  102. package/lib/node-server.d.ts +1 -1
  103. package/lib/node-server.js +1 -1
  104. package/lib/pattern-router-HZxjDGEQ.js +41 -0
  105. package/lib/powered-by.d.ts +1 -1
  106. package/lib/pretty-json.d.ts +1 -1
  107. package/lib/proxy.d.ts +72 -0
  108. package/lib/proxy.js +121 -0
  109. package/lib/quick.d.ts +8 -0
  110. package/lib/quick.js +17 -0
  111. package/lib/request-id.d.ts +1 -1
  112. package/lib/request.d.ts +1 -1
  113. package/lib/route.d.ts +1 -1
  114. package/lib/router/linear-router.js +1 -95
  115. package/lib/router/pattern-router.js +1 -40
  116. package/lib/schema-validator.d.ts +1 -1
  117. package/lib/secure-headers.d.ts +1 -1
  118. package/lib/{serve-static-Dw_m6KxR.js → serve-static-Cw23shXv.js} +1 -0
  119. package/lib/serve-static.d.ts +1 -1
  120. package/lib/streaming.d.ts +1 -1
  121. package/lib/testing.d.ts +4 -4
  122. package/lib/timeout.d.ts +1 -1
  123. package/lib/timing.d.ts +1 -1
  124. package/lib/tiny.d.ts +8 -0
  125. package/lib/tiny.js +15 -0
  126. package/lib/trailing-slash.d.ts +1 -1
  127. package/lib/{types-CHesD1KG.d.ts → types-CQiGmsWW.d.ts} +3 -3
  128. package/lib/{types-CwrQjlaM.d.ts → types-Lqx5BxQF.d.ts} +10 -1
  129. package/lib/{types-CDO6I3B0.d.ts → types-nEL8VPDC.d.ts} +1 -1
  130. package/lib/types.d.ts +1 -1
  131. package/lib/utils/body.d.ts +1 -1
  132. package/lib/utils/cookie.d.ts +1 -1
  133. package/lib/utils/crypto.d.ts +1 -1
  134. package/lib/utils/html.d.ts +1 -45
  135. package/lib/utils/ipaddr.d.ts +1 -1
  136. package/lib/utils/jwt.d.ts +1 -1
  137. package/lib/utils/types.d.ts +2 -2
  138. package/lib/validator.d.ts +2 -2
  139. package/lib/ws.d.ts +1 -1
  140. package/package.json +69 -1
  141. package/plugins/acryl-inspect/upstream.json +1 -1
  142. package/plugins/acryl-node-server/upstream.json +1 -1
  143. package/plugins/acryl-router/src/core/helper/css/common.case.test.tsx +506 -0
  144. package/plugins/acryl-router/src/core/helper/css/common.ts +337 -0
  145. package/plugins/acryl-router/src/core/helper/css/index.test.tsx +678 -0
  146. package/plugins/acryl-router/src/core/helper/css/index.ts +262 -0
  147. package/plugins/acryl-router/src/core/helper/dev/index.test.ts +181 -0
  148. package/plugins/acryl-router/src/core/helper/dev/index.ts +79 -0
  149. package/plugins/acryl-router/src/core/helper/proxy/index.test.ts +356 -0
  150. package/plugins/acryl-router/src/core/helper/proxy/index.ts +203 -0
  151. package/plugins/acryl-router/src/core/helper/streaming/sse.test.tsx +557 -0
  152. package/plugins/acryl-router/src/core/jsx/base.test.tsx +97 -0
  153. package/plugins/acryl-router/src/core/jsx/base.ts +490 -0
  154. package/plugins/acryl-router/src/core/jsx/children.test.ts +52 -0
  155. package/plugins/acryl-router/src/core/jsx/children.ts +20 -0
  156. package/plugins/acryl-router/src/core/jsx/components.test.tsx +936 -0
  157. package/plugins/acryl-router/src/core/jsx/components.ts +257 -0
  158. package/plugins/acryl-router/src/core/jsx/constants.ts +6 -0
  159. package/plugins/acryl-router/src/core/jsx/context-isolation.test.ts +655 -0
  160. package/plugins/acryl-router/src/core/jsx/context.ts +266 -0
  161. package/plugins/acryl-router/src/core/jsx/dom/client.test.tsx +128 -0
  162. package/plugins/acryl-router/src/core/jsx/dom/client.ts +89 -0
  163. package/plugins/acryl-router/src/core/jsx/dom/components.test.tsx +330 -0
  164. package/plugins/acryl-router/src/core/jsx/dom/components.ts +39 -0
  165. package/plugins/acryl-router/src/core/jsx/dom/context.test.tsx +184 -0
  166. package/plugins/acryl-router/src/core/jsx/dom/context.ts +52 -0
  167. package/plugins/acryl-router/src/core/jsx/dom/css.test.tsx +149 -0
  168. package/plugins/acryl-router/src/core/jsx/dom/css.ts +263 -0
  169. package/plugins/acryl-router/src/core/jsx/dom/hooks/index.test.tsx +172 -0
  170. package/plugins/acryl-router/src/core/jsx/dom/hooks/index.ts +91 -0
  171. package/plugins/acryl-router/src/core/jsx/dom/index.test.tsx +3681 -0
  172. package/plugins/acryl-router/src/core/jsx/dom/index.ts +170 -0
  173. package/plugins/acryl-router/src/core/jsx/dom/intrinsic-element/components.test.tsx +1344 -0
  174. package/plugins/acryl-router/src/core/jsx/dom/intrinsic-element/components.ts +438 -0
  175. package/plugins/acryl-router/src/core/jsx/dom/jsx-dev-runtime.ts +23 -0
  176. package/plugins/acryl-router/src/core/jsx/dom/jsx-runtime.ts +8 -0
  177. package/plugins/acryl-router/src/core/jsx/dom/render.ts +879 -0
  178. package/plugins/acryl-router/src/core/jsx/dom/server.test.tsx +199 -0
  179. package/plugins/acryl-router/src/core/jsx/dom/server.ts +76 -0
  180. package/plugins/acryl-router/src/core/jsx/dom/utils.ts +7 -0
  181. package/plugins/acryl-router/src/core/jsx/hooks/dom.test.tsx +859 -0
  182. package/plugins/acryl-router/src/core/jsx/hooks/index.ts +437 -0
  183. package/plugins/acryl-router/src/core/jsx/hooks/string.test.tsx +40 -0
  184. package/plugins/acryl-router/src/core/jsx/index.test.tsx +1744 -0
  185. package/plugins/acryl-router/src/core/jsx/index.ts +115 -0
  186. package/plugins/acryl-router/src/core/jsx/intrinsic-element/common.ts +23 -0
  187. package/plugins/acryl-router/src/core/jsx/intrinsic-element/components.test.tsx +666 -0
  188. package/plugins/acryl-router/src/core/jsx/intrinsic-element/components.ts +210 -0
  189. package/plugins/acryl-router/src/core/jsx/intrinsic-elements.ts +938 -0
  190. package/plugins/acryl-router/src/core/jsx/jsx-dev-runtime.ts +26 -0
  191. package/plugins/acryl-router/src/core/jsx/jsx-runtime.test.tsx +85 -0
  192. package/plugins/acryl-router/src/core/jsx/jsx-runtime.ts +51 -0
  193. package/plugins/acryl-router/src/core/jsx/streaming.test.tsx +1281 -0
  194. package/plugins/acryl-router/src/core/jsx/streaming.ts +231 -0
  195. package/plugins/acryl-router/src/core/jsx/types.ts +41 -0
  196. package/plugins/acryl-router/src/core/jsx/utils.test.ts +366 -0
  197. package/plugins/acryl-router/src/core/jsx/utils.ts +202 -0
  198. package/plugins/acryl-router/src/core/middleware/cache/index.test.ts +1211 -0
  199. package/plugins/acryl-router/src/core/middleware/cache/index.ts +323 -0
  200. package/plugins/acryl-router/src/core/middleware/mount/index.test.ts +334 -0
  201. package/plugins/acryl-router/src/core/middleware/mount/index.ts +108 -0
  202. package/plugins/acryl-router/src/core/preset/quick.test.ts +42 -0
  203. package/plugins/acryl-router/src/core/preset/quick.ts +24 -0
  204. package/plugins/acryl-router/src/core/preset/tiny.test.ts +42 -0
  205. package/plugins/acryl-router/src/core/preset/tiny.ts +20 -0
  206. package/plugins/acryl-router/src/core/utils/types.ts +9 -0
  207. package/plugins/acryl-router/src/helpers/index.ts +3 -0
  208. package/plugins/acryl-router/src/middleware/index.ts +2 -0
  209. package/plugins/acryl-router/src/service.ts +22 -5
  210. package/plugins/acryl-router/tests/jsx.spec.tsx +63 -0
  211. package/plugins/acryl-router/upstream.json +3 -3
  212. package/plugins/acryl-router-http/upstream.json +1 -1
  213. package/plugins/acryl-state/upstream.json +1 -1
  214. package/plugins/desktop/upstream.json +1 -1
  215. package/plugins/desktop-web/upstream.json +1 -1
  216. package/plugins/save/plugin.json +1 -1
  217. package/templates/todo/upstream.json +1 -1
package/README.md CHANGED
@@ -22,7 +22,7 @@ One <code>Request</code> in, one <code>Response</code> out: routing, middleware,
22
22
  import { Acryl } from 'acrylblends'
23
23
 
24
24
  const app = new Acryl()
25
- app.get('/', (c) => c.text('Hello Acryl!'))
25
+ app.get('/', (c) => c.text('Acryl!'))
26
26
 
27
27
  export default app
28
28
  ```
@@ -68,7 +68,7 @@ import { Acryl } from 'acrylblends'
68
68
 
69
69
  const app = new Acryl()
70
70
 
71
- app.get('/', (c) => c.text('Hello Acryl!'))
71
+ app.get('/', (c) => c.text('Acryl!'))
72
72
 
73
73
  export default app
74
74
  ```
@@ -202,7 +202,7 @@ Export the app's type, and `acrylblends/client` calls its routes with typed path
202
202
  // api.ts
203
203
  import { Acryl } from 'acrylblends'
204
204
 
205
- const app = new Acryl().get('/api/hello', (c) => c.json({ message: 'Hello Acryl!' }))
205
+ const app = new Acryl().get('/api/hello', (c) => c.json({ message: 'Acryl!' }))
206
206
  export type AppType = typeof app
207
207
  export default app
208
208
  ```
@@ -231,7 +231,7 @@ import app from './index.ts'
231
231
  test('GET / says hello', async () => {
232
232
  const response = await app.request('/')
233
233
  assert.equal(response.status, 200)
234
- assert.equal(await response.text(), 'Hello Acryl!')
234
+ assert.equal(await response.text(), 'Acryl!')
235
235
  })
236
236
  ```
237
237
 
@@ -271,10 +271,15 @@ See [Node.js](https://github.com/acryldev/acryl/blob/main/docs/framework/getting
271
271
  | `acrylblends/http-exception` | `HTTPException` |
272
272
  | `acrylblends/router/*` | the routers: `reg-exp-router`, `smart-router`, `trie-router`, `pattern-router`, `linear-router` ([routers](https://github.com/acryldev/acryl/blob/main/docs/framework/concepts/routers.md)) |
273
273
  | `acrylblends/utils/*` | the utilities the framework is built from |
274
+ | `acrylblends/tiny`, `acrylblends/quick` | the presets: `Acryl` with another router (`PatternRouter`; `LinearRouter` and `TrieRouter`) ([presets](https://github.com/acryldev/acryl/blob/main/docs/framework/api/presets.md)) |
275
+ | `acrylblends/cache`, `acrylblends/mount` | the cache middleware and mounting another framework's fetch handler |
276
+ | `acrylblends/proxy`, `acrylblends/dev` | the proxy helper and the dev helpers (`showRoutes`, `inspectRoutes`, `getRouterName`) |
277
+ | `acrylblends/jsx` | JSX on the server: `jsxImportSource: 'acrylblends/jsx'`, with `jsx/streaming` ([JSX guide](https://github.com/acryldev/acryl/blob/main/docs/framework/guides/jsx.md)) |
278
+ | `acrylblends/jsx/dom` | JSX in the browser: hooks and `render` (needs the DOM library) ([client components](https://github.com/acryldev/acryl/blob/main/docs/framework/guides/jsx-dom.md)) |
279
+ | `acrylblends/css` | CSS in JSX: `css`, `cx`, `keyframes`, `Style` ([CSS helper](https://github.com/acryldev/acryl/blob/main/docs/framework/helpers/css.md)) |
274
280
  | `acrylblends/node-server` | `serve`, `createAdaptorServer`, `getRequestListener`; with `node-server/serve-static` and `node-server/conninfo` |
275
281
 
276
- Every subpath is listed in the package's `exports`. JSX, SSG, the cache, mount, proxy and dev helpers and other runtimes' adapters are
277
- being ported. The docs mark them "not yet available" until they ship
282
+ Every subpath is listed in the package's `exports`. The JSX renderer middleware, SSG and other runtimes' adapters are being ported. The docs mark them "not yet available" until they ship
278
283
  ([FAQ](https://github.com/acryldev/acryl/blob/main/docs/framework/guides/faq.md)).
279
284
 
280
285
  To extend the context's typed variables, augment the root module:
@@ -39,14 +39,15 @@ Verified: Node.js. Bun is experimental. The other runtimes the framework could t
39
39
 
40
40
  ## Not yet available
41
41
 
42
- Some parts of the documented API surface are not part of the package yet, and their pages say so at the top: the JSX packages, static site generation, the CSS helper, the
43
- `proxy`, `dev` and `cache` pieces, the `quick` and `tiny` presets and the adapters of the runtimes other than Node.js. They are enabled as they are ported.
42
+ Some parts of the documented API surface are not part of the package yet, and their pages say so at the top: the JSX renderer middleware, static site generation
43
+ and the adapters of the runtimes other than Node.js. They are enabled as they are ported.
44
44
 
45
45
  ## Where to read next
46
46
 
47
47
  | I want to | Read |
48
48
  | --- | --- |
49
49
  | Run something in five minutes | [Getting started](getting-started/basic.md) |
50
+ | Run the app as a desktop app | [Desktop](getting-started/desktop.md) |
50
51
  | Look up a call | [API](api/index.md), [Routing](api/routing.md), [Context](api/context.md), [Request](api/request.md), [API summary](api/summary.md) |
51
52
  | Understand the design | [Concepts](concepts/motivation.md) |
52
53
  | Copy a pattern | [Guides](guides/best-practices.md), [Validation](guides/validation.md), [Testing](guides/testing.md) |
@@ -1,3 +1,3 @@
1
1
  # Generated copy
2
2
 
3
- This folder is a copy of `docs/framework` of acryldev/acryl at commit `5743482e4199ded676a77f594bce15fd4aa0ca2f`, made by `scripts/sync-framework.mjs`. Do not edit it here: change the text in ACRYL and sync again. `pnpm run verify:framework` fails when a page differs from the recorded digest.
3
+ This folder is a copy of `docs/framework` of acryldev/acryl at commit `60491f81b7346d1f3867fa01ee4e2caffc7baf47`, made by `scripts/sync-framework.mjs`. Do not edit it here: change the text in ACRYL and sync again. `pnpm run verify:framework` fails when a page differs from the recorded digest.
@@ -1,8 +1,5 @@
1
1
  # Presets
2
2
 
3
- > **Partly available.** The default router (`SmartRouter`), `RegExpRouter`, `TrieRouter`, `LinearRouter` and `PatternRouter` are available and are chosen with the `router` option of `new Acryl()` (see [Routers](../concepts/routers.md)). The presets `acrylblends/quick` and `acrylblends/tiny` are **not yet available**; their examples below are not checked by the docs tests.
4
-
5
-
6
3
  Acryl has several routers, each designed for a specific purpose.
7
4
  You can specify the router you want to use in the constructor of Acryl.
8
5
 
@@ -43,6 +43,9 @@ export function apply(ctx: Context): void {
43
43
  | `GET /todo/todos/42` | `{ "id": "42" }` |
44
44
  | `GET /todo/` | 404: `/todo` and `/todo/` are different paths (see below) |
45
45
 
46
+ The app can come from `acryl-router` or from the published `acrylblends` package: `route` takes any app by its routes
47
+ (`MountableApp`), so an `Acryl` imported from `acrylblends` mounts as it is, with its middleware and its own `onError`.
48
+
46
49
  ### `/todo/` is a 404 until you choose
47
50
 
48
51
  `/todo/` is the first thing people type, and by default it is not found: the router treats `/todo` and `/todo/` as two paths. Choose
@@ -91,6 +94,12 @@ const app = new Acryl()
91
94
  Use middleware for authentication, logging, CORS, compression, request IDs and other behavior that should wrap more than one handler.
92
95
  The built-in set is listed in [Middleware](../concepts/middleware.md).
93
96
 
97
+ ## Render pages with JSX
98
+
99
+ A plugin renders HTML with the same JSX as the published package: set `"jsx": "react-jsx"` and `"jsxImportSource": "acryl-router/jsx"`
100
+ in its `tsconfig.json` (a `.tsx` file), and style with the CSS helper from `acryl-router/helpers`. Streaming with `Suspense` is in
101
+ `acryl-router/jsx/streaming`. The [JSX guide](../guides/jsx.md) covers the rest; its examples import from `acrylblends/jsx` instead.
102
+
94
103
  ## Run the same app on a surface
95
104
 
96
105
  The application does not open a socket. A surface supplies requests to it:
@@ -63,7 +63,7 @@ import { Acryl } from 'acrylblends'
63
63
  const app = new Acryl()
64
64
 
65
65
  app.get('/', (c) => {
66
- return c.text('Hello Acryl!')
66
+ return c.text('Acryl!')
67
67
  })
68
68
 
69
69
  export default app
@@ -83,7 +83,7 @@ const app = new Acryl()
83
83
  app.get('/api/hello', (c) => {
84
84
  return c.json({
85
85
  ok: true,
86
- message: 'Hello Acryl!',
86
+ message: 'Acryl!',
87
87
  })
88
88
  })
89
89
  ```
@@ -162,7 +162,7 @@ app.use(
162
162
  '/admin/*',
163
163
  basicAuth({
164
164
  username: 'admin',
165
- password: 'secret',
165
+ password: process.env.ADMIN_PASSWORD!,
166
166
  })
167
167
  )
168
168
 
@@ -181,7 +181,7 @@ An app is a function from `Request` to `Response`, so a test needs no server:
181
181
  import { Acryl } from 'acrylblends'
182
182
 
183
183
  const app = new Acryl()
184
- app.get('/', (c) => c.text('Hello Acryl!'))
184
+ app.get('/', (c) => c.text('Acryl!'))
185
185
 
186
186
  const response = await app.request('/')
187
187
  console.log(response.status, await response.text())
@@ -192,5 +192,6 @@ See [Testing](../guides/testing.md).
192
192
  ## Next
193
193
 
194
194
  - [Node.js](nodejs.md) and [Bun](bun.md) (experimental)
195
+ - [Desktop](desktop.md): the same app in an Electron window
195
196
  - [Routing](../api/routing.md), [Context](../api/context.md) and [Request](../api/request.md)
196
197
  - [Validation](../guides/validation.md)
@@ -0,0 +1,41 @@
1
+ # Desktop
2
+
3
+ An Acryl app also runs as a desktop app: an Electron window opens on the app's own server. It is the same app and the same code as `npm run dev`; nothing in the app changes. This page covers a plain Acryl app (the `nodejs`
4
+ template) and a Blend app (the `acryl-app` template or `acrylblends init`). It runs from source today: packaging a distributable app (dmg, exe, deb) is not part of it yet.
5
+
6
+ ## Add it
7
+
8
+ In an Acryl app made by `npm create acrylblends@latest my-app -- --template nodejs`:
9
+
10
+ ```sh
11
+ cd my-app
12
+ npm install
13
+ npx acrylblends add desktop
14
+ npm install
15
+ npm run desktop
16
+ ```
17
+
18
+ In a Blend app, the same two commands (`npx acrylblends add desktop`, `npm install`) add the Blend form of the shell, and `npx acrylblends init my-app --template todo --desktop` creates a Blend app with it already in.
19
+ `acrylblends add desktop` chooses the right form: a Blend app (it has `src/plugins/instance`) or a plain Acryl app.
20
+
21
+ ## What it adds
22
+
23
+ - `src/plugins/desktop-web/` (a plain app) or `src/plugins/desktop/` (a Blend app): the window code. Only this folder imports `electron`; the app's own code never does.
24
+ - `electron` as a development dependency (pinned to 44.0.0) and the script `npm run desktop`.
25
+ - `.acrylblends/` in `.gitignore`: Electron's user data (window state, cache, logs) lives in `.acrylblends/electron` inside the app's own folder, never in the user's application-data folder.
26
+
27
+ ## What `npm run desktop` does
28
+
29
+ 1. Serves the app on `127.0.0.1` with a free port: for a plain app, `app.fetch` from `src/app.ts` (`export default app`) through `acrylblends/node-server`; for a Blend app, its own `createApp`.
30
+ 2. Takes a single-instance lock: a second launch of the same app focuses the first window and exits.
31
+ 3. Opens one window on the server's address, with a locked-down renderer (context isolation, no Node in the page, the sandbox, web security). Navigation stays on the app's own origin; any other link opens in the system browser.
32
+ 4. When the window closes (or on SIGINT or SIGTERM), stops the server and exits.
33
+
34
+ ## The first launch downloads Electron
35
+
36
+ `npm install` does not download Electron's binary (Electron 44 has no install script). The first `npm run desktop` does: about 100 MB, once per machine, then it is cached. Behind a proxy or mirror set `ELECTRON_MIRROR`
37
+ (and `ELECTRON_CACHE` to reuse a download); if the download is blocked, run `npx install-electron` where the mirror is reachable.
38
+
39
+ ## A different start page
40
+
41
+ The window opens on `/`. To open another path, set it in `package.json`: `"acrylblends": { "desktopPath": "/todo" }`.
@@ -1,8 +1,5 @@
1
1
  # Client Components
2
2
 
3
- > **Not yet available.** The client-side JSX package (`acrylblends/jsx/dom`) is documented here so the page structure matches the rest of the framework, and is not part of acrylblends yet. The code on this page is not checked by the docs tests.
4
-
5
-
6
3
  `acrylblends/jsx` supports not only server side but also client side. This means that it is possible to create an interactive UI that runs in the browser. We call it Client Components or `acrylblends/jsx/dom`.
7
4
 
8
5
  It is fast and very small. The counter program in `acrylblends/jsx/dom` is only 2.8KB with Brotli compression, but 47.8KB for React.
@@ -1,8 +1,5 @@
1
1
  # JSX
2
2
 
3
- > **Not yet available.** The JSX packages (`acrylblends/jsx` and its subpaths) is documented here so the page structure matches the rest of the framework, and is not part of acrylblends yet. The code on this page is not checked by the docs tests.
4
-
5
-
6
3
  You can write HTML with JSX syntax with `acrylblends/jsx`.
7
4
 
8
5
  Although `acrylblends/jsx` works on the client, you will probably use it most often when rendering content on the server side. Here are some things related to JSX that are common to both server and client.
@@ -54,7 +51,7 @@ const Top: FC<{ messages: string[] }> = (props: {
54
51
  }) => {
55
52
  return (
56
53
  <Layout>
57
- <h1>Hello Acryl!</h1>
54
+ <h1>Acryl!</h1>
58
55
  <ul>
59
56
  {props.messages.map((message) => {
60
57
  return <li>{message}!!</li>
@@ -95,7 +95,7 @@ app.use(
95
95
  '/auth/*',
96
96
  basicAuth({
97
97
  username: 'acrylblends',
98
- password: 'acoolproject',
98
+ password: process.env.BASIC_AUTH_PASSWORD!,
99
99
  })
100
100
  )
101
101
  ```
@@ -37,7 +37,7 @@ app.get('/cookie', (c) => {
37
37
 
38
38
  ```ts
39
39
  app.get('/signed-cookie', (c) => {
40
- const secret = 'secret' // make sure it's a large enough string to be secure
40
+ const secret = process.env.COOKIE_SECRET! // a long random string, kept out of the source
41
41
 
42
42
  await setSignedCookie(c, 'cookie_name0', 'cookie_value', secret)
43
43
  const fortuneCookie = await getSignedCookie(
@@ -1,8 +1,5 @@
1
1
  # css Helper
2
2
 
3
- > **Not yet available.** The CSS helper (`acrylblends/css`) is documented here so the page structure matches the rest of the framework, and is not part of acrylblends yet. The code on this page is not checked by the docs tests.
4
-
5
-
6
3
  The CSS helper - `acrylblends/css` - is Acryl's built-in CSS in JS(X).
7
4
 
8
5
  You can write CSS in JSX in a JavaScript template literal named `css`. The return value of `css` will be the class name, which is set to the value of the class attribute. The `<Style />` component will then contain the value of the CSS.
@@ -1,8 +1,5 @@
1
1
  # Dev Helper
2
2
 
3
- > **Not yet available.** The dev helper (`acrylblends/dev`) is documented here so the page structure matches the rest of the framework, and is not part of acrylblends yet. The code on this page is not checked by the docs tests.
4
-
5
-
6
3
  Dev Helper provides useful methods you can use in development.
7
4
 
8
5
  ```ts
@@ -35,7 +35,7 @@ const payload = {
35
35
  role: 'admin',
36
36
  exp: Math.floor(Date.now() / 1000) + 60 * 5, // Token expires in 5 minutes
37
37
  }
38
- const secret = 'mySecretKey'
38
+ const secret = process.env.JWT_SECRET!
39
39
  const token = await sign(payload, secret)
40
40
  ```
41
41
 
@@ -1,8 +1,5 @@
1
1
  # Proxy Helper
2
2
 
3
- > **Not yet available.** The proxy helper (`acrylblends/proxy`) is documented here so the page structure matches the rest of the framework, and is not part of acrylblends yet. The code on this page is not checked by the docs tests.
4
-
5
-
6
3
  Proxy Helper provides useful functions when using Acryl application as a (reverse) proxy.
7
4
 
8
5
  ## Import
@@ -21,7 +21,7 @@ app.use(
21
21
  '/auth/*',
22
22
  basicAuth({
23
23
  username: 'acrylblends',
24
- password: 'acoolproject',
24
+ password: process.env.BASIC_AUTH_PASSWORD!,
25
25
  })
26
26
  )
27
27
 
@@ -41,7 +41,7 @@ app.get('/auth/page', (c) => {
41
41
 
42
42
  app.delete(
43
43
  '/auth/page',
44
- basicAuth({ username: 'acrylblends', password: 'acoolproject' }),
44
+ basicAuth({ username: 'acrylblends', password: process.env.BASIC_AUTH_PASSWORD! }),
45
45
  (c) => {
46
46
  return c.text('Page deleted')
47
47
  }
@@ -100,7 +100,7 @@ app.use(
100
100
  '/auth/*',
101
101
  basicAuth({
102
102
  username: 'acrylblends',
103
- password: 'acoolproject',
103
+ password: process.env.BASIC_AUTH_PASSWORD!,
104
104
  onAuthSuccess: (c, username) => {
105
105
  c.set('username', username)
106
106
  },
@@ -129,18 +129,18 @@ app.use(
129
129
  basicAuth(
130
130
  {
131
131
  username: 'acrylblends',
132
- password: 'acoolproject',
132
+ password: process.env.BASIC_AUTH_PASSWORD!,
133
133
  // Define other params in the first object
134
134
  realm: 'www.example.com',
135
135
  },
136
136
  {
137
137
  username: 'acrylblends-admin',
138
- password: 'super-secure',
138
+ password: process.env.ADMIN_PASSWORD!,
139
139
  // Cannot redefine other params here
140
140
  },
141
141
  {
142
142
  username: 'acrylblends-user-1',
143
- password: 'a-secret',
143
+ password: process.env.USER_1_PASSWORD!,
144
144
  // Or here
145
145
  }
146
146
  )
@@ -1,8 +1,5 @@
1
1
  # Cache Middleware
2
2
 
3
- > **Not yet available.** The cache middleware (`acrylblends/cache`) is documented here so the page structure matches the rest of the framework, and is not part of acrylblends yet. The code on this page is not checked by the docs tests.
4
-
5
-
6
3
  The Cache middleware uses the Web Standards' [Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache).
7
4
 
8
5
  The Cache middleware currently supports Cloudflare Workers projects using custom domains and Deno projects using [Deno 1.26+](https://github.com/denoland/deno/releases/tag/v1.26.0). Also available with Deno Deploy.
@@ -39,7 +39,7 @@ app.use(
39
39
  )
40
40
  )
41
41
 
42
- app.get('/', (c) => c.text('Hello Acryl!'))
42
+ app.get('/', (c) => c.text('Acryl!'))
43
43
  ```
44
44
 
45
45
  ### some
@@ -28,7 +28,7 @@ app.use(
28
28
  })
29
29
  )
30
30
 
31
- app.get('/', (c) => c.text('Hello Acryl!'))
31
+ app.get('/', (c) => c.text('Acryl!'))
32
32
  ```
33
33
 
34
34
  Pass the `getConninfo` from the [ConnInfo helper](../../helpers/conninfo.md) appropriate for your environment as the first argument of `ipRestriction`. For a runtime whose adapter is not yet available there is no `getConnInfo` to pass yet.
@@ -15,7 +15,7 @@ import { logger } from 'acrylblends/logger'
15
15
  const app = new Acryl()
16
16
 
17
17
  app.use(logger())
18
- app.get('/', (c) => c.text('Hello Acryl!'))
18
+ app.get('/', (c) => c.text('Acryl!'))
19
19
  ```
20
20
 
21
21
  ## Logging Details
@@ -1,8 +1,5 @@
1
1
  # Mount Middleware
2
2
 
3
- > **Not yet available.** The `acrylblends/mount` subpath (an app can still call `app.mount()`) is documented here so the page structure matches the rest of the framework, and is not part of acrylblends yet. The code on this page is not checked by the docs tests.
4
-
5
-
6
3
  The Mount Middleware lets you mount an application built with another framework into your Acryl application.
7
4
 
8
5
  ## Import
@@ -2,8 +2,8 @@
2
2
  "source": {
3
3
  "repo": "acryldev/acryl",
4
4
  "path": "docs/framework",
5
- "commit": "5743482e4199ded676a77f594bce15fd4aa0ca2f"
5
+ "commit": "60491f81b7346d1f3867fa01ee4e2caffc7baf47"
6
6
  },
7
- "files": 87,
8
- "digest": "sha256:31bf1c46fbe74d7d2664b3b935a18bd916b8cab1b9ee9c2b006b8a75617a04f6"
7
+ "files": 88,
8
+ "digest": "sha256:c8ac3dd071b4cbc2a1f0265695dea71ea48e71cba455e2b778f9d567ca50f957"
9
9
  }
package/lib/accepts.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Context } from "./context-Bm7rI-oK.js";
1
+ import { t as Context } from "./context-DVQBjuns.js";
2
2
  import { t as AcceptHeader } from "./headers-tu2YYN8T.js";
3
3
 
4
4
  //#region ../../plugins/acryl-router/src/core/helper/accepts/accepts.d.ts
@@ -1,2 +1,2 @@
1
- import { $ as Acryl, et as AcrylOptions } from "./context-Bm7rI-oK.js";
1
+ import { $ as Acryl, et as AcrylOptions } from "./context-DVQBjuns.js";
2
2
  export { Acryl as AcrylBase, AcrylOptions };
package/lib/adapter.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Context } from "./context-Bm7rI-oK.js";
1
+ import { t as Context } from "./context-DVQBjuns.js";
2
2
 
3
3
  //#region ../../plugins/acryl-router/src/core/helper/adapter/index.d.ts
4
4
  type Runtime = 'node' | 'deno' | 'bun' | 'workerd' | 'fastly' | 'edge-light' | 'other';
@@ -1,4 +1,4 @@
1
- import { $ as Acryl$1, J as Schema, _ as Env, et as AcrylOptions, h as BlankSchema, p as BlankEnv } from "./context-Bm7rI-oK.js";
1
+ import { $ as Acryl$1, J as Schema, _ as Env, et as AcrylOptions, h as BlankSchema, p as BlankEnv } from "./context-DVQBjuns.js";
2
2
 
3
3
  //#region ../../plugins/acryl-router/src/core/app.d.ts
4
4
  /**