acrylblends 0.8.1 → 0.9.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 (235) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +83 -7
  3. package/dist/index.js.map +1 -1
  4. package/lib/audit-BXnYsLge.d.ts +58 -0
  5. package/lib/cell-ChU41DZD.d.ts +32 -0
  6. package/lib/client-modules-CLvWOjbd.js +267 -0
  7. package/lib/connection-ZLEso7XL.d.ts +25 -0
  8. package/lib/conninfo.d.ts +1 -23
  9. package/lib/cordis/db-sqlite.d.ts +56 -0
  10. package/lib/cordis/db-sqlite.js +58 -0
  11. package/lib/cordis/db.d.ts +8 -0
  12. package/lib/cordis/db.js +1 -0
  13. package/lib/cordis/door.d.ts +159 -0
  14. package/lib/cordis/door.js +757 -0
  15. package/lib/cordis/inspect.d.ts +77 -0
  16. package/lib/cordis/inspect.js +149 -0
  17. package/lib/cordis/kv-db.d.ts +16 -0
  18. package/lib/cordis/kv-db.js +18 -0
  19. package/lib/cordis/kv-json.d.ts +16 -0
  20. package/lib/cordis/kv-json.js +44 -0
  21. package/lib/cordis/kv.d.ts +8 -0
  22. package/lib/cordis/kv.js +1 -0
  23. package/lib/cordis/node-server.d.ts +45 -0
  24. package/lib/cordis/node-server.js +93 -0
  25. package/lib/cordis/router-http.d.ts +56 -0
  26. package/lib/cordis/router-http.js +117 -0
  27. package/lib/cordis/router.d.ts +8 -0
  28. package/lib/cordis/router.js +7 -0
  29. package/lib/cordis/state/react.d.ts +6 -0
  30. package/lib/cordis/state/react.js +11 -0
  31. package/lib/cordis/state.d.ts +33 -0
  32. package/lib/cordis/state.js +163 -0
  33. package/lib/core-CaY8XDZ6.js +19 -0
  34. package/lib/database-DBHdwefi.d.ts +44 -0
  35. package/lib/db/conformance.d.ts +11 -0
  36. package/lib/db/conformance.js +267 -0
  37. package/lib/db/sqlite.d.ts +1 -1
  38. package/lib/db/sqlite.js +1 -196
  39. package/lib/db.d.ts +2 -1
  40. package/lib/{src-0hI7M7cN.js → deprecated-BP4fPt38.js} +0 -17
  41. package/lib/door/host.d.ts +24 -0
  42. package/lib/door/host.js +2 -0
  43. package/lib/door/page.d.ts +105 -0
  44. package/lib/door/page.js +1030 -0
  45. package/lib/door/protocol.d.ts +2 -0
  46. package/lib/door/protocol.js +197 -0
  47. package/lib/error-t4N2js2I.d.ts +8 -0
  48. package/lib/etag-DaKMOjty.js +135 -0
  49. package/lib/etag.js +1 -134
  50. package/lib/helpers-CvTauQT5.js +5 -0
  51. package/lib/http-exception-kpGJkmpi.d.ts +57 -0
  52. package/lib/http-exception.d.ts +1 -56
  53. package/lib/{index-BLTYsyc1.d.ts → index-BnGgRKTv.d.ts} +3 -39
  54. package/lib/index-BqVQkTnu.d.ts +98 -0
  55. package/lib/index-Dmst2QCQ.d.ts +44 -0
  56. package/lib/index.d.ts +1 -1
  57. package/lib/index.js +2 -1
  58. package/lib/jwk-LkzeoaU8.js +117 -0
  59. package/lib/jwk.js +1 -116
  60. package/lib/jwt-CskdhEW9.js +115 -0
  61. package/lib/jwt.js +2 -114
  62. package/lib/kv/conformance.d.ts +13 -0
  63. package/lib/kv/conformance.js +301 -0
  64. package/lib/kv/db.d.ts +2 -2
  65. package/lib/kv/json.d.ts +1 -1
  66. package/lib/kv-9f-AlRKN.d.ts +39 -0
  67. package/lib/kv.d.ts +2 -1
  68. package/lib/language-D9a4zqvn.js +198 -0
  69. package/lib/language.js +1 -197
  70. package/lib/middleware-CPQ8himN.js +12 -0
  71. package/lib/node-server/serve-static.d.ts +0 -1
  72. package/lib/node-server/serve-static.js +1 -1
  73. package/lib/node-server.d.ts +1 -7
  74. package/lib/node-server.js +3 -1586
  75. package/lib/open-CMhnJODn.js +197 -0
  76. package/lib/protocol-BizVt4J6.d.ts +144 -0
  77. package/lib/request-id-CKVvHOO1.js +34 -0
  78. package/lib/request-id.js +1 -33
  79. package/lib/secure-headers-mP3j6Hm6.js +163 -0
  80. package/lib/secure-headers.js +1 -162
  81. package/lib/{serve-static-B849HlX2.js → serve-static-3uo_9rjF.js} +1 -4
  82. package/lib/server-DvgMGtzo.js +1323 -0
  83. package/lib/snapshot-text-D3NspDyT.js +338 -0
  84. package/lib/src-CwABFr6r.js +328 -0
  85. package/lib/timeout.d.ts +1 -1
  86. package/lib/timing-Cky7C1Jf.js +183 -0
  87. package/lib/timing.js +1 -182
  88. package/package.json +89 -1
  89. package/plugins/acryl-db/plugin.json +6 -1
  90. package/plugins/acryl-db-sqlite/plugin.json +4 -0
  91. package/plugins/acryl-db-sqlite/src/facade/node.ts +1 -1
  92. package/plugins/acryl-db-sqlite/src/index.ts +2 -2
  93. package/plugins/acryl-db-sqlite/src/open.ts +2 -2
  94. package/plugins/acryl-door/plugin.json +4 -1
  95. package/plugins/acryl-door/src/host/http.ts +2 -2
  96. package/plugins/acryl-door/src/host/mcp-routes.ts +1 -1
  97. package/plugins/acryl-door/src/host/operator-routes.ts +1 -1
  98. package/plugins/acryl-door/src/host/page-routes.ts +3 -3
  99. package/plugins/acryl-door/src/index.ts +2 -2
  100. package/plugins/acryl-inspect/plugin.json +4 -1
  101. package/plugins/acryl-inspect/src/service.ts +2 -2
  102. package/plugins/acryl-kv/plugin.json +6 -1
  103. package/plugins/acryl-kv-db/plugin.json +4 -0
  104. package/plugins/acryl-kv-db/src/index.ts +1 -1
  105. package/plugins/acryl-kv-db/src/open.ts +3 -3
  106. package/plugins/acryl-kv-json/plugin.json +4 -0
  107. package/plugins/acryl-kv-json/src/index.ts +1 -1
  108. package/plugins/acryl-kv-json/src/open.ts +2 -2
  109. package/plugins/acryl-node-server/plugin.json +5 -1
  110. package/plugins/acryl-node-server/src/adapter/conninfo.ts +1 -1
  111. package/plugins/acryl-node-server/src/adapter/early-hints.ts +1 -1
  112. package/plugins/acryl-node-server/src/adapter/serve-static.ts +2 -2
  113. package/plugins/acryl-node-server/src/adapter/websocket.ts +2 -2
  114. package/plugins/acryl-node-server/src/client-modules.ts +2 -2
  115. package/plugins/acryl-node-server/src/index.ts +1 -1
  116. package/plugins/acryl-router/plugin.json +11 -1
  117. package/plugins/acryl-router/src/connection.d.ts +25 -0
  118. package/plugins/acryl-router/src/core/app-base.d.ts +215 -0
  119. package/plugins/acryl-router/src/core/app.d.ts +19 -0
  120. package/plugins/acryl-router/src/core/client/client.d.ts +4 -0
  121. package/plugins/acryl-router/src/core/client/fetch-result-please.d.ts +35 -0
  122. package/plugins/acryl-router/src/core/client/index.d.ts +7 -0
  123. package/plugins/acryl-router/src/core/client/types.d.ts +229 -0
  124. package/plugins/acryl-router/src/core/client/utils.d.ts +18 -0
  125. package/plugins/acryl-router/src/core/compose.d.ts +14 -0
  126. package/plugins/acryl-router/src/core/context.d.ts +443 -0
  127. package/plugins/acryl-router/src/core/helper/accepts/accepts.d.ts +30 -0
  128. package/plugins/acryl-router/src/core/helper/accepts/index.d.ts +5 -0
  129. package/plugins/acryl-router/src/core/helper/conninfo/index.d.ts +5 -0
  130. package/plugins/acryl-router/src/core/helper/conninfo/types.d.ts +36 -0
  131. package/plugins/acryl-router/src/core/helper/cookie/index.d.ts +25 -0
  132. package/plugins/acryl-router/src/core/helper/css/common.d.ts +59 -0
  133. package/plugins/acryl-router/src/core/helper/css/index.d.ts +80 -0
  134. package/plugins/acryl-router/src/core/helper/dev/index.d.ts +20 -0
  135. package/plugins/acryl-router/src/core/helper/factory/index.d.ts +82 -0
  136. package/plugins/acryl-router/src/core/helper/html/index.d.ts +8 -0
  137. package/plugins/acryl-router/src/core/helper/proxy/index.d.ts +73 -0
  138. package/plugins/acryl-router/src/core/helper/route/index.d.ts +75 -0
  139. package/plugins/acryl-router/src/core/helper/ssg/index.d.ts +7 -0
  140. package/plugins/acryl-router/src/core/helper/ssg/middleware.d.ts +44 -0
  141. package/plugins/acryl-router/src/core/helper/ssg/plugins.d.ts +27 -0
  142. package/plugins/acryl-router/src/core/helper/ssg/ssg.d.ts +91 -0
  143. package/plugins/acryl-router/src/core/helper/ssg/utils.d.ts +16 -0
  144. package/plugins/acryl-router/src/core/helper/streaming/index.d.ts +8 -0
  145. package/plugins/acryl-router/src/core/helper/streaming/sse.d.ts +13 -0
  146. package/plugins/acryl-router/src/core/helper/streaming/stream.d.ts +3 -0
  147. package/plugins/acryl-router/src/core/helper/streaming/text.d.ts +3 -0
  148. package/plugins/acryl-router/src/core/helper/streaming/utils.d.ts +1 -0
  149. package/plugins/acryl-router/src/core/helper/testing/index.d.ts +13 -0
  150. package/plugins/acryl-router/src/core/helper/websocket/index.d.ts +70 -0
  151. package/plugins/acryl-router/src/core/http-exception.d.ts +58 -0
  152. package/plugins/acryl-router/src/core/index.d.ts +37 -0
  153. package/plugins/acryl-router/src/core/jsx/base.d.ts +61 -0
  154. package/plugins/acryl-router/src/core/jsx/children.d.ts +9 -0
  155. package/plugins/acryl-router/src/core/jsx/components.d.ts +15 -0
  156. package/plugins/acryl-router/src/core/jsx/constants.d.ts +6 -0
  157. package/plugins/acryl-router/src/core/jsx/context.d.ts +51 -0
  158. package/plugins/acryl-router/src/core/jsx/dom/components.d.ts +10 -0
  159. package/plugins/acryl-router/src/core/jsx/dom/context.d.ts +3 -0
  160. package/plugins/acryl-router/src/core/jsx/dom/css.d.ts +83 -0
  161. package/plugins/acryl-router/src/core/jsx/dom/hooks/index.d.ts +39 -0
  162. package/plugins/acryl-router/src/core/jsx/dom/intrinsic-element/components.d.ts +16 -0
  163. package/plugins/acryl-router/src/core/jsx/dom/jsx-dev-runtime.d.ts +8 -0
  164. package/plugins/acryl-router/src/core/jsx/dom/jsx-runtime.d.ts +7 -0
  165. package/plugins/acryl-router/src/core/jsx/dom/render.d.ts +73 -0
  166. package/plugins/acryl-router/src/core/jsx/dom/utils.d.ts +1 -0
  167. package/plugins/acryl-router/src/core/jsx/hooks/index.d.ts +47 -0
  168. package/plugins/acryl-router/src/core/jsx/index.d.ts +76 -0
  169. package/plugins/acryl-router/src/core/jsx/intrinsic-element/common.d.ts +6 -0
  170. package/plugins/acryl-router/src/core/jsx/intrinsic-element/components.d.ts +13 -0
  171. package/plugins/acryl-router/src/core/jsx/intrinsic-elements.d.ts +735 -0
  172. package/plugins/acryl-router/src/core/jsx/streaming.d.ts +36 -0
  173. package/plugins/acryl-router/src/core/jsx/types.d.ts +36 -0
  174. package/plugins/acryl-router/src/core/jsx/utils.d.ts +4 -0
  175. package/plugins/acryl-router/src/core/request/constants.d.ts +1 -0
  176. package/plugins/acryl-router/src/core/request.d.ts +306 -0
  177. package/plugins/acryl-router/src/core/router/reg-exp-router/index.d.ts +6 -0
  178. package/plugins/acryl-router/src/core/router/reg-exp-router/matcher.d.ts +7 -0
  179. package/plugins/acryl-router/src/core/router/reg-exp-router/node.d.ts +13 -0
  180. package/plugins/acryl-router/src/core/router/reg-exp-router/prepared-router.d.ts +17 -0
  181. package/plugins/acryl-router/src/core/router/reg-exp-router/router.d.ts +11 -0
  182. package/plugins/acryl-router/src/core/router/reg-exp-router/trie.d.ts +8 -0
  183. package/plugins/acryl-router/src/core/router/smart-router/index.d.ts +5 -0
  184. package/plugins/acryl-router/src/core/router/smart-router/router.d.ts +11 -0
  185. package/plugins/acryl-router/src/core/router/trie-router/index.d.ts +5 -0
  186. package/plugins/acryl-router/src/core/router/trie-router/node.d.ts +6 -0
  187. package/plugins/acryl-router/src/core/router/trie-router/router.d.ts +7 -0
  188. package/plugins/acryl-router/src/core/router/utils.d.ts +1 -0
  189. package/plugins/acryl-router/src/core/router.d.ts +97 -0
  190. package/plugins/acryl-router/src/core/types.d.ts +573 -0
  191. package/plugins/acryl-router/src/core/utils/accept.d.ts +6 -0
  192. package/plugins/acryl-router/src/core/utils/body.d.ts +79 -0
  193. package/plugins/acryl-router/src/core/utils/buffer.d.ts +17 -0
  194. package/plugins/acryl-router/src/core/utils/color.d.ts +21 -0
  195. package/plugins/acryl-router/src/core/utils/concurrent.d.ts +11 -0
  196. package/plugins/acryl-router/src/core/utils/constants.d.ts +4 -0
  197. package/plugins/acryl-router/src/core/utils/cookie.d.ts +41 -0
  198. package/plugins/acryl-router/src/core/utils/crypto.d.ts +15 -0
  199. package/plugins/acryl-router/src/core/utils/handler.d.ts +6 -0
  200. package/plugins/acryl-router/src/core/utils/headers.d.ts +8 -0
  201. package/plugins/acryl-router/src/core/utils/html.d.ts +44 -0
  202. package/plugins/acryl-router/src/core/utils/http-status.d.ts +32 -0
  203. package/plugins/acryl-router/src/core/utils/mime.d.ts +70 -0
  204. package/plugins/acryl-router/src/core/utils/stream.d.ts +31 -0
  205. package/plugins/acryl-router/src/core/utils/types.d.ts +128 -0
  206. package/plugins/acryl-router/src/core/utils/url.d.ts +44 -0
  207. package/plugins/acryl-router/src/core/validator/index.d.ts +7 -0
  208. package/plugins/acryl-router/src/core/validator/utils.d.ts +29 -0
  209. package/plugins/acryl-router/src/core/validator/validator.d.ts +16 -0
  210. package/plugins/acryl-router/src/helpers/index.d.ts +17 -0
  211. package/plugins/acryl-router/src/helpers/schema-validator.d.ts +54 -0
  212. package/plugins/acryl-router-http/plugin.json +4 -1
  213. package/plugins/acryl-router-http/src/index.ts +1 -1
  214. package/plugins/acryl-state/plugin.json +5 -1
  215. package/plugins/acryl-state/src/service.ts +3 -3
  216. package/plugins/tsconfig.json +32 -20
  217. package/docs/framework/UPSTREAM.md +0 -3
  218. package/docs/framework/upstream.json +0 -9
  219. package/lib/index-D4FAsBZu.d.ts +0 -85
  220. package/plugins/acryl-db/upstream.json +0 -18
  221. package/plugins/acryl-db-sqlite/upstream.json +0 -21
  222. package/plugins/acryl-door/upstream.json +0 -28
  223. package/plugins/acryl-inspect/upstream.json +0 -18
  224. package/plugins/acryl-kv/upstream.json +0 -18
  225. package/plugins/acryl-kv-db/upstream.json +0 -21
  226. package/plugins/acryl-kv-json/upstream.json +0 -22
  227. package/plugins/acryl-node-server/upstream.json +0 -21
  228. package/plugins/acryl-router/upstream.json +0 -20
  229. package/plugins/acryl-router-http/upstream.json +0 -22
  230. package/plugins/acryl-state/NOTICE +0 -30
  231. package/plugins/acryl-state/upstream.json +0 -22
  232. package/plugins/desktop/upstream.json +0 -12
  233. package/plugins/desktop-web/upstream.json +0 -12
  234. package/templates/todo/upstream.json +0 -12
  235. /package/lib/{index-CTy4N7ng.d.ts → deprecated-CTy4N7ng.d.ts} +0 -0
@@ -8,10 +8,10 @@
8
8
  * code point in the end, whatever collation the database sorts with.
9
9
  */
10
10
 
11
- import type { Db } from '../../acryl-db/src/index.ts'
12
- import { checkKey, codePoints, compareKeys, decodeValue, encodeValue, type Kv, runChange } from '../../acryl-kv/src/index.ts'
11
+ import type { Db } from 'acryl-db'
12
+ import { checkKey, codePoints, compareKeys, decodeValue, encodeValue, type Kv, runChange } from 'acryl-kv'
13
13
 
14
- export type { Kv } from '../../acryl-kv/src/index.ts'
14
+ export type { Kv } from 'acryl-kv'
15
15
 
16
16
  export interface KvOnDbOptions {
17
17
  /** The table that holds the documents. Defaults to `kv`; a plain SQL identifier. */
@@ -12,5 +12,9 @@
12
12
  "omit": ["**/*.test.*", "**/*.spec.*", "**/*.case.ts"],
13
13
  "imports": {
14
14
  "#acryl-kv-json": "acryl-kv-json/src/index.ts"
15
+ },
16
+ "entries": {
17
+ "": "src/index.ts",
18
+ "/open": "src/open.ts"
15
19
  }
16
20
  }
@@ -10,7 +10,7 @@ import { dirname, isAbsolute, join, resolve } from 'node:path'
10
10
  import { fileURLToPath } from 'node:url'
11
11
  import type { Context } from '@deepseek-ai/cordis'
12
12
  import z from '@deepseek-ai/schemastery'
13
- import { KV_SERVICE } from '../../acryl-kv/src/index.ts'
13
+ import { KV_SERVICE } from 'acryl-kv'
14
14
  import { openKv } from './open.ts'
15
15
 
16
16
  export { openKv, type OpenKvOptions } from './open.ts'
@@ -13,9 +13,9 @@
13
13
 
14
14
  import { mkdir, open, readdir, readFile, rename, rm } from 'node:fs/promises'
15
15
  import { basename, dirname, join, resolve } from 'node:path'
16
- import { checkKey, compareKeys, decodeValue, encodeValue, type Kv, type KvOpened, runChange } from '../../acryl-kv/src/index.ts'
16
+ import { checkKey, compareKeys, decodeValue, encodeValue, type Kv, type KvOpened, runChange } from 'acryl-kv'
17
17
 
18
- export type { Kv, KvOpened } from '../../acryl-kv/src/index.ts'
18
+ export type { Kv, KvOpened } from 'acryl-kv'
19
19
 
20
20
  export interface OpenKvOptions {
21
21
  /** The JSON file; its folder is created if missing. */
@@ -9,5 +9,9 @@
9
9
  "@deepseek-ai/schemastery": "3.18.4"
10
10
  },
11
11
  "mount": "root.plugin(router); root.plugin(nodeServer, { port: 3000, hostname: '127.0.0.1', scan: 20 }); ctx.nodeServer.url",
12
- "omit": ["**/*.test.*", "**/*.case.ts"]
12
+ "omit": ["**/*.test.*", "**/*.case.ts"],
13
+ "entries": {
14
+ "": "src/index.ts",
15
+ "/client-modules": "src/client-modules.ts"
16
+ }
13
17
  }
@@ -1,4 +1,4 @@
1
- import type { GetConnInfo } from '../../../acryl-router/src/helpers/index.ts'
1
+ import type { GetConnInfo } from 'acryl-router/helpers'
2
2
  import type { HttpBindings } from './types.ts'
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { Context, Env, MiddlewareHandler } from '../../../acryl-router/src/index.ts'
1
+ import type { Context, Env, MiddlewareHandler } from 'acryl-router'
2
2
  import type { HttpBindings } from './types.ts'
3
3
 
4
4
  export type EarlyHintsOptions<E extends Env = Env> = {
@@ -1,5 +1,5 @@
1
- import type { Context, Env, MiddlewareHandler } from '../../../acryl-router/src/index.ts'
2
- import { getMimeType } from '../../../acryl-router/src/helpers/index.ts'
1
+ import type { Context, Env, MiddlewareHandler } from 'acryl-router'
2
+ import { getMimeType } from 'acryl-router/helpers'
3
3
  import type { Stats } from 'node:fs'
4
4
  import { createReadStream, statSync, existsSync } from 'node:fs'
5
5
  import { join } from 'node:path'
@@ -1,5 +1,5 @@
1
- import type { UpgradeWebSocket, WSContext } from '../../../acryl-router/src/helpers/index.ts'
2
- import { defineWebSocketHelper } from '../../../acryl-router/src/helpers/index.ts'
1
+ import type { UpgradeWebSocket, WSContext } from 'acryl-router/helpers'
2
+ import { defineWebSocketHelper } from 'acryl-router/helpers'
3
3
  import type { IncomingMessage } from 'node:http'
4
4
  import { STATUS_CODES } from 'node:http'
5
5
  import type { Duplex } from 'node:stream'
@@ -12,8 +12,8 @@
12
12
  import { copyFileSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from 'node:fs'
13
13
  import { dirname, extname, isAbsolute, join, relative, resolve, sep } from 'node:path'
14
14
  import { fileURLToPath } from 'node:url'
15
- import { Acryl } from '../../acryl-router/src/index.ts'
16
- import { basePath } from '../../acryl-router/src/helpers/index.ts'
15
+ import { Acryl } from 'acryl-router'
16
+ import { basePath } from 'acryl-router/helpers'
17
17
  import { MissingTypeScriptError, compileModule } from './transpile.ts'
18
18
 
19
19
  /** The folder the three browser files are served from, below the app's mount. A source folder of this name is not served. */
@@ -14,7 +14,7 @@ import type { Server } from 'node:http'
14
14
  import type { AddressInfo } from 'node:net'
15
15
  import { Context, Service } from '@deepseek-ai/cordis'
16
16
  import z from '@deepseek-ai/schemastery'
17
- import type {} from '../../acryl-router/src/index.ts'
17
+ import type {} from 'acryl-router'
18
18
  import { Request as AdapterRequest } from './adapter/request.ts'
19
19
  import { createAdaptorServer } from './adapter/server.ts'
20
20
 
@@ -9,5 +9,15 @@
9
9
  "@deepseek-ai/schemastery": "3.18.4"
10
10
  },
11
11
  "mount": "root.plugin(router); then in your own plugin: inject: ['router'] and ctx.router.get('/path', (c) => c.json({ ok: true }))",
12
- "omit": ["**/*.test.*", "**/*.case.ts"]
12
+ "omit": ["**/*.test.*", "**/*.case.ts"],
13
+ "entries": {
14
+ "": "src/index.ts",
15
+ "/middleware": "src/middleware/index.ts",
16
+ "/helpers": "src/helpers/index.ts",
17
+ "/client": "src/client.ts",
18
+ "/jsx": "src/core/jsx/index.ts",
19
+ "/jsx/jsx-runtime": "src/core/jsx/jsx-runtime.ts",
20
+ "/jsx/jsx-dev-runtime": "src/core/jsx/jsx-dev-runtime.ts",
21
+ "/jsx/streaming": "src/core/jsx/streaming.ts"
22
+ }
13
23
  }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Transport facts: who is on the other end of the socket and which local port it reached. The caller of `router.fetch` supplies them
3
+ * (an HTTP adapter passes the socket's peer address and real port); they travel in `c.env.connection`, beside the request and never in a header.
4
+ */
5
+ import type { Context } from './core/context.ts';
6
+ import type { GetConnInfo } from './core/helper/conninfo/types.ts';
7
+ /** An in-process caller (the terminal UI, a test) passes nothing, so a handler that needs a trusted peer must refuse an empty one. */
8
+ export interface ConnectionInfo {
9
+ /** The peer address of the socket, when the request came over one (for example `127.0.0.1`). */
10
+ readonly remoteAddress?: string | undefined;
11
+ /** The local port the socket is connected to, the real one a `Host` header should be checked against. */
12
+ readonly localPort?: number | undefined;
13
+ }
14
+ /** What the router puts in `c.env`. */
15
+ export interface RouterBindings {
16
+ readonly connection: ConnectionInfo;
17
+ }
18
+ /** The `Env` of an `Acryl` that wants `c.env.connection` typed: `new Acryl<RouterEnv>()`. */
19
+ export interface RouterEnv {
20
+ Bindings: RouterBindings;
21
+ }
22
+ /** The transport facts of this request; empty for an in-process call or an `Acryl` run outside the router. */
23
+ export declare function connectionOf(c: Context): ConnectionInfo;
24
+ /** The peer in the core's conninfo shape, for middleware written against it (for example `ipRestriction`). */
25
+ export declare const getConnInfo: GetConnInfo;
@@ -0,0 +1,215 @@
1
+ /**
2
+ * @module
3
+ * This module is the base module for the Acryl object.
4
+ */
5
+ import { Context } from './context.ts';
6
+ import type { ExecutionContext } from './context.ts';
7
+ import type { Router } from './router.ts';
8
+ import type { Env, ErrorHandler, H, HandlerInterface, MergePath, MergeSchemaPath, MiddlewareHandlerInterface, NotFoundHandler, OnHandlerInterface, RouterRoute, Schema } from './types.ts';
9
+ type GetPath<E extends Env> = (request: Request, options?: {
10
+ env?: E['Bindings'];
11
+ }) => string;
12
+ export type AcrylOptions<E extends Env> = {
13
+ /**
14
+ * `router` option specifies which router to use.
15
+ *
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const app = new Acryl({ router: new RegExpRouter() })
20
+ * ```
21
+ */
22
+ router?: Router<[H, RouterRoute]>;
23
+ } & ({
24
+ /**
25
+ * `strict` option specifies whether to distinguish whether the last path is a directory or not.
26
+ *
27
+ *
28
+ * @default true
29
+ */
30
+ strict?: true;
31
+ /**
32
+ * `getPath` can handle the host header value.
33
+ *
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const app = new Acryl({
38
+ * getPath: (req) =>
39
+ * '/' + req.headers.get('host') + req.url.replace(/^https?:\/\/[^/]+(\/[^?]*)/, '$1'),
40
+ * })
41
+ *
42
+ * app.get('/www1.example.com/hello', () => c.text('hello www1'))
43
+ *
44
+ * // A following request will match the route:
45
+ * // new Request('http://www1.example.com/hello', {
46
+ * // headers: { host: 'www1.example.com' },
47
+ * // })
48
+ * ```
49
+ */
50
+ getPath?: GetPath<E>;
51
+ } | {
52
+ /**
53
+ * `strict` option specifies whether to distinguish whether the last path is a directory or not.
54
+ * When `strict` is `false`, `getPath` is not used.
55
+ *
56
+ *
57
+ * @default true
58
+ */
59
+ strict: false;
60
+ getPath?: never;
61
+ });
62
+ type MountOptionHandler = (c: Context) => unknown;
63
+ type MountReplaceRequest = (originalRequest: Request) => Request;
64
+ type MountOptions = MountOptionHandler | {
65
+ optionHandler?: MountOptionHandler;
66
+ replaceRequest?: MountReplaceRequest | false;
67
+ };
68
+ declare class Acryl<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/', CurrentPath extends string = BasePath> {
69
+ #private;
70
+ get: HandlerInterface<E, 'get', S, BasePath, CurrentPath>;
71
+ post: HandlerInterface<E, 'post', S, BasePath, CurrentPath>;
72
+ put: HandlerInterface<E, 'put', S, BasePath, CurrentPath>;
73
+ delete: HandlerInterface<E, 'delete', S, BasePath, CurrentPath>;
74
+ options: HandlerInterface<E, 'options', S, BasePath, CurrentPath>;
75
+ patch: HandlerInterface<E, 'patch', S, BasePath, CurrentPath>;
76
+ query: HandlerInterface<E, 'query', S, BasePath, CurrentPath>;
77
+ all: HandlerInterface<E, 'all', S, BasePath, CurrentPath>;
78
+ on: OnHandlerInterface<E, S, BasePath>;
79
+ use: MiddlewareHandlerInterface<E, S, BasePath>;
80
+ router: Router<[H, RouterRoute]>;
81
+ readonly getPath: GetPath<E>;
82
+ private _basePath;
83
+ routes: RouterRoute[];
84
+ constructor(options?: AcrylOptions<E>);
85
+ private errorHandler;
86
+ /**
87
+ * `.route()` allows grouping other Acryl instance in routes.
88
+ *
89
+ *
90
+ * @param {string} path - base Path
91
+ * @param {Acryl} app - other Acryl instance
92
+ * @returns {Acryl} routed Acryl instance
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * const app = new Acryl()
97
+ * const app2 = new Acryl()
98
+ *
99
+ * app2.get("/user", (c) => c.text("user"))
100
+ * app.route("/api", app2) // GET /api/user
101
+ * ```
102
+ */
103
+ route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string, SubCurrentPath extends string>(path: SubPath, app: Acryl<SubEnv, SubSchema, SubBasePath, SubCurrentPath>): Acryl<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> | S, BasePath, CurrentPath>;
104
+ /**
105
+ * `.basePath()` allows base paths to be specified.
106
+ *
107
+ *
108
+ * @param {string} path - base Path
109
+ * @returns {Acryl} changed Acryl instance
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * const api = new Acryl().basePath('/api')
114
+ * ```
115
+ */
116
+ basePath<SubPath extends string>(path: SubPath): Acryl<E, S, MergePath<BasePath, SubPath>, MergePath<BasePath, SubPath>>;
117
+ /**
118
+ * `.onError()` handles an error and returns a customized Response.
119
+ *
120
+ *
121
+ * @param {ErrorHandler} handler - request Handler for error
122
+ * @returns {Acryl} changed Acryl instance
123
+ *
124
+ * @example
125
+ * ```ts
126
+ * app.onError((err, c) => {
127
+ * console.error(`${err}`)
128
+ * return c.text('Custom Error Message', 500)
129
+ * })
130
+ * ```
131
+ */
132
+ onError: (handler: ErrorHandler<E>) => Acryl<E, S, BasePath, CurrentPath>;
133
+ /**
134
+ * `.notFound()` allows you to customize a Not Found Response.
135
+ *
136
+ *
137
+ * @param {NotFoundHandler} handler - request handler for not-found
138
+ * @returns {Acryl} changed Acryl instance
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * app.notFound((c) => {
143
+ * return c.text('Custom 404 Message', 404)
144
+ * })
145
+ * ```
146
+ */
147
+ notFound: (handler: NotFoundHandler<E>) => Acryl<E, S, BasePath, CurrentPath>;
148
+ /**
149
+ * `.mount()` allows you to mount applications built with other frameworks into your Acryl application.
150
+ *
151
+ * @deprecated Use `mount()` from `acryl-router/mount` instead. `.mount()` will be removed in v5.
152
+ *
153
+ *
154
+ * @param {string} path - base Path
155
+ * @param {Function} applicationHandler - other Request Handler
156
+ * @param {MountOptions} [options] - options of `.mount()`
157
+ * @returns {Acryl} mounted Acryl instance
158
+ *
159
+ * @example
160
+ * ```ts
161
+ * import { Router as IttyRouter } from 'itty-router'
162
+ * import { Acryl } from 'acrylblends'
163
+ * // Create itty-router application
164
+ * const ittyRouter = IttyRouter()
165
+ * // GET /itty-router/hello
166
+ * ittyRouter.get('/hello', () => new Response('Hello from itty-router'))
167
+ *
168
+ * const app = new Acryl()
169
+ * app.mount('/itty-router', ittyRouter.handle)
170
+ * ```
171
+ *
172
+ * @example
173
+ * ```ts
174
+ * const app = new Acryl()
175
+ * // Send the request to another application without modification.
176
+ * app.mount('/app', anotherApp, {
177
+ * replaceRequest: (req) => req,
178
+ * })
179
+ * ```
180
+ */
181
+ mount(path: string, applicationHandler: (request: Request, ...args: any) => Response | Promise<Response>, options?: MountOptions): Acryl<E, S, BasePath, CurrentPath>;
182
+ /**
183
+ * `.fetch()` will be entry point of your app.
184
+ *
185
+ *
186
+ * @param {Request} request - request Object of request
187
+ * @param {Env} env - env Object
188
+ * @param {ExecutionContext} executionCtx - context of execution
189
+ * @returns {Response | Promise<Response>} response of request
190
+ *
191
+ */
192
+ fetch: (request: Request, env?: E['Bindings'] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response>;
193
+ /**
194
+ * `.request()` is a useful method for testing.
195
+ * You can pass a URL or pathname to send a GET request.
196
+ * app will return a Response object.
197
+ * ```ts
198
+ * test('GET /hello is ok', async () => {
199
+ * const res = await app.request('/hello')
200
+ * expect(res.status).toBe(200)
201
+ * })
202
+ * ```
203
+ */
204
+ request: (input: Request | string | URL, requestInit?: RequestInit, Env?: E["Bindings"] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response>;
205
+ /**
206
+ * `.fire()` automatically adds a global fetch event listener.
207
+ * This can be useful for environments that adhere to the Service Worker API, such as non-ES module Cloudflare Workers.
208
+ * @deprecated
209
+ * ACRYL ships no service-worker adapter: mount the app with `ctx.router.route(path, app)` and serve it through an ACRYL adapter instead.
210
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
211
+ * @see https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/
212
+ */
213
+ fire: () => void;
214
+ }
215
+ export { Acryl as AcrylBase };
@@ -0,0 +1,19 @@
1
+ import { AcrylBase } from './app-base.ts';
2
+ import type { AcrylOptions } from './app-base.ts';
3
+ import type { BlankEnv, BlankSchema, Env, Schema } from './types.ts';
4
+ /**
5
+ * The Acryl class extends the functionality of the AcrylBase class.
6
+ * It sets up routing and allows for custom options to be passed.
7
+ *
8
+ * @template E - The environment type.
9
+ * @template S - The schema type.
10
+ * @template BasePath - The base path type.
11
+ */
12
+ export declare class Acryl<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = '/'> extends AcrylBase<E, S, BasePath> {
13
+ /**
14
+ * Creates an instance of the Acryl class.
15
+ *
16
+ * @param options - Optional configuration options for the Acryl instance.
17
+ */
18
+ constructor(options?: AcrylOptions<E>);
19
+ }
@@ -0,0 +1,4 @@
1
+ import type { Acryl } from '../app.ts';
2
+ import type { UnionToIntersection } from '../utils/types.ts';
3
+ import type { Client, ClientRequestOptions } from './types.ts';
4
+ export declare const hc: <T extends Acryl<any, any, any>, Prefix extends string = string>(baseUrl: Prefix, options?: ClientRequestOptions) => UnionToIntersection<Client<T, Prefix>>;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @description This file is a modified version of `fetch-result-please` (`ofetch`), minimalized and adapted to Acryl's custom needs.
3
+ *
4
+ * @link https://www.npmjs.com/package/fetch-result-please
5
+ */
6
+ /**
7
+ * Smartly parses and return the consumable result from a fetch `Response`.
8
+ *
9
+ * Throwing a structured error if the response is not `ok`. ({@link DetailedError})
10
+ */
11
+ export declare function fetchRP(fetchRes: Response | Promise<Response>): Promise<any>;
12
+ export declare class DetailedError extends Error {
13
+ /**
14
+ * Additional `message` that will be logged AND returned to client
15
+ */
16
+ detail?: any;
17
+ /**
18
+ * Additional `code` that will be logged AND returned to client
19
+ */
20
+ code?: any;
21
+ /**
22
+ * Additional value that will be logged AND NOT returned to client
23
+ */
24
+ log?: any;
25
+ /**
26
+ * Optionally set the status code to return, in a web server context
27
+ */
28
+ statusCode?: any;
29
+ constructor(message: string, options?: {
30
+ detail?: any;
31
+ code?: any;
32
+ statusCode?: number;
33
+ log?: any;
34
+ });
35
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @module
3
+ * The HTTP Client for Acryl.
4
+ */
5
+ export { hc } from './client.ts';
6
+ export { parseResponse, DetailedError } from './utils.ts';
7
+ export type { InferResponseType, InferRequestType, Fetch, ClientRequestOptions, ClientRequest, ClientResponse, ApplyGlobalResponse, PickResponseByStatusCode, } from './types.ts';