acrylblends 0.4.1 → 0.5.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 (416) hide show
  1. package/LICENSE +73 -0
  2. package/docs/framework/README.md +51 -51
  3. package/docs/framework/UPSTREAM.md +1 -1
  4. package/docs/framework/agents/index.md +24 -0
  5. package/docs/framework/api/acryl.md +259 -0
  6. package/docs/framework/api/context.md +527 -0
  7. package/docs/framework/api/exception.md +80 -0
  8. package/docs/framework/api/index.md +12 -0
  9. package/docs/framework/api/presets.md +65 -0
  10. package/docs/framework/api/request.md +396 -0
  11. package/docs/framework/api/routing.md +303 -0
  12. package/docs/framework/{api-summary.md → api/summary.md} +19 -17
  13. package/docs/framework/concepts/benchmarks.md +26 -0
  14. package/docs/framework/concepts/developer-experience.md +5 -0
  15. package/docs/framework/concepts/middleware.md +21 -0
  16. package/docs/framework/concepts/motivation.md +14 -0
  17. package/docs/framework/concepts/routers.md +63 -0
  18. package/docs/framework/concepts/stacks.md +235 -0
  19. package/docs/framework/concepts/web-standard.md +37 -0
  20. package/docs/framework/{getting-started.md → cordis/acryl-in-a-cordis-app.md} +16 -16
  21. package/docs/framework/{concepts.md → cordis/concepts.md} +2 -2
  22. package/docs/framework/cordis/middleware.md +8 -0
  23. package/docs/framework/{migration-from-0-3.md → cordis/migration-from-0-3.md} +16 -13
  24. package/docs/framework/cordis/migration-from-0-4.md +14 -0
  25. package/docs/framework/{migration-from-dsh-webserver.md → cordis/migration-from-dsh-webserver.md} +7 -7
  26. package/docs/framework/{routing.md → cordis/mounting.md} +5 -108
  27. package/docs/framework/{node-server.md → cordis/node-server.md} +4 -4
  28. package/docs/framework/{surfaces.md → cordis/surfaces.md} +2 -2
  29. package/docs/framework/cordis/transport-and-cancellation.md +57 -0
  30. package/docs/framework/{validation.md → cordis/validation.md} +9 -9
  31. package/docs/framework/getting-started/basic.md +196 -0
  32. package/docs/framework/getting-started/bun.md +221 -0
  33. package/docs/framework/getting-started/nodejs.md +344 -0
  34. package/docs/framework/getting-started/other-runtimes.md +23 -0
  35. package/docs/framework/guides/best-practices.md +231 -0
  36. package/docs/framework/guides/create-acrylblends.md +79 -0
  37. package/docs/framework/guides/examples.md +3 -0
  38. package/docs/framework/guides/faq.md +19 -0
  39. package/docs/framework/guides/helpers.md +33 -0
  40. package/docs/framework/guides/jsx-dom.md +299 -0
  41. package/docs/framework/guides/jsx.md +440 -0
  42. package/docs/framework/guides/middleware.md +253 -0
  43. package/docs/framework/guides/rpc.md +886 -0
  44. package/docs/framework/guides/testing.md +133 -0
  45. package/docs/framework/guides/validation.md +383 -0
  46. package/docs/framework/helpers/accepts.md +60 -0
  47. package/docs/framework/helpers/adapter.md +87 -0
  48. package/docs/framework/helpers/conninfo.md +112 -0
  49. package/docs/framework/helpers/cookie.md +232 -0
  50. package/docs/framework/helpers/css.md +285 -0
  51. package/docs/framework/helpers/dev.md +67 -0
  52. package/docs/framework/helpers/factory.md +180 -0
  53. package/docs/framework/helpers/html.md +123 -0
  54. package/docs/framework/helpers/jwt.md +184 -0
  55. package/docs/framework/helpers/proxy.md +118 -0
  56. package/docs/framework/helpers/route.md +143 -0
  57. package/docs/framework/helpers/ssg.md +393 -0
  58. package/docs/framework/helpers/streaming.md +119 -0
  59. package/docs/framework/helpers/testing.md +101 -0
  60. package/docs/framework/helpers/websocket.md +215 -0
  61. package/docs/framework/middleware/builtin/basic-auth.md +165 -0
  62. package/docs/framework/middleware/builtin/bearer-auth.md +138 -0
  63. package/docs/framework/middleware/builtin/body-limit.md +71 -0
  64. package/docs/framework/middleware/builtin/cache.md +122 -0
  65. package/docs/framework/middleware/builtin/combine.md +94 -0
  66. package/docs/framework/middleware/builtin/compress.md +59 -0
  67. package/docs/framework/middleware/builtin/context-storage.md +78 -0
  68. package/docs/framework/middleware/builtin/cors.md +135 -0
  69. package/docs/framework/middleware/builtin/csrf.md +105 -0
  70. package/docs/framework/middleware/builtin/etag.md +54 -0
  71. package/docs/framework/middleware/builtin/ip-restriction.md +69 -0
  72. package/docs/framework/middleware/builtin/jsx-renderer.md +286 -0
  73. package/docs/framework/middleware/builtin/jwk.md +192 -0
  74. package/docs/framework/middleware/builtin/jwt.md +145 -0
  75. package/docs/framework/middleware/builtin/language.md +232 -0
  76. package/docs/framework/middleware/builtin/logger.md +74 -0
  77. package/docs/framework/middleware/builtin/loopback-only.md +31 -0
  78. package/docs/framework/middleware/builtin/method-not-allowed.md +48 -0
  79. package/docs/framework/middleware/builtin/method-override.md +80 -0
  80. package/docs/framework/middleware/builtin/mount.md +106 -0
  81. package/docs/framework/middleware/builtin/pretty-json.md +53 -0
  82. package/docs/framework/middleware/builtin/request-id.md +94 -0
  83. package/docs/framework/middleware/builtin/secure-headers.md +247 -0
  84. package/docs/framework/middleware/builtin/timeout.md +98 -0
  85. package/docs/framework/middleware/builtin/timing.md +101 -0
  86. package/docs/framework/middleware/builtin/trailing-slash.md +74 -0
  87. package/docs/framework/middleware/third-party.md +4 -0
  88. package/docs/framework/upstream.json +3 -3
  89. package/lib/accepts-XBuZPVRI.js +52 -0
  90. package/lib/accepts.d.ts +33 -0
  91. package/lib/accepts.js +2 -0
  92. package/lib/acryl-base.d.ts +2 -0
  93. package/lib/acryl-base.js +332 -0
  94. package/lib/adapter.d.ts +12 -0
  95. package/lib/adapter.js +37 -0
  96. package/lib/app-BM0rTCp7.js +26 -0
  97. package/lib/app-CmAYW1Al.d.ts +21 -0
  98. package/lib/basic-auth.d.ts +72 -0
  99. package/lib/basic-auth.js +95 -0
  100. package/lib/bearer-auth.d.ts +89 -0
  101. package/lib/bearer-auth.js +94 -0
  102. package/lib/body-limit.d.ts +42 -0
  103. package/lib/body-limit.js +66 -0
  104. package/lib/client-BHTr318g.js +266 -0
  105. package/lib/client.d.ts +3 -0
  106. package/lib/client.js +2 -0
  107. package/lib/combine.d.ts +85 -0
  108. package/lib/combine.js +137 -0
  109. package/lib/compose-BuW2B6PZ.js +50 -0
  110. package/lib/compress.d.ts +38 -0
  111. package/lib/compress.js +79 -0
  112. package/lib/connection-C7xgP1hP.js +24 -0
  113. package/lib/conninfo.d.ts +25 -0
  114. package/lib/conninfo.js +2 -0
  115. package/lib/constants-Dy7ZvN1H.js +4 -0
  116. package/lib/context-Bm7rI-oK.d.ts +1234 -0
  117. package/lib/context-DDO0cfuP.js +365 -0
  118. package/lib/context-storage.d.ts +38 -0
  119. package/lib/context-storage.js +52 -0
  120. package/lib/cookie-ClMaKDQf.d.ts +40 -0
  121. package/lib/cookie.d.ts +24 -0
  122. package/lib/cookie.js +82 -0
  123. package/lib/cors.d.ts +52 -0
  124. package/lib/cors.js +106 -0
  125. package/lib/csrf.d.ts +75 -0
  126. package/lib/csrf.js +101 -0
  127. package/lib/etag.d.ts +40 -0
  128. package/lib/etag.js +135 -0
  129. package/lib/factory.d.ts +35 -0
  130. package/lib/factory.js +30 -0
  131. package/lib/headers-tu2YYN8T.d.ts +11 -0
  132. package/lib/html.d.ts +6 -0
  133. package/lib/html.js +31 -0
  134. package/lib/http-exception.d.ts +57 -0
  135. package/lib/http-exception.js +54 -0
  136. package/lib/http-status-DaAwGAFL.d.ts +35 -0
  137. package/lib/index-B-3F4wt2.d.ts +12 -0
  138. package/lib/index-UTBmM3GX.d.ts +68 -0
  139. package/lib/index-oOClm_Xk.d.ts +45 -0
  140. package/lib/index.d.ts +5 -0
  141. package/lib/index.js +28 -0
  142. package/lib/ip-restriction.d.ts +68 -0
  143. package/lib/ip-restriction.js +166 -0
  144. package/lib/jwk.d.ts +52 -0
  145. package/lib/jwk.js +117 -0
  146. package/lib/jwt-BGJBw5AF.js +403 -0
  147. package/lib/jwt-Dg493Tai.d.ts +51 -0
  148. package/lib/jwt.d.ts +72 -0
  149. package/lib/jwt.js +115 -0
  150. package/lib/language.d.ts +88 -0
  151. package/lib/language.js +198 -0
  152. package/lib/logger.d.ts +22 -0
  153. package/lib/logger.js +54 -0
  154. package/lib/loopback-only.d.ts +45 -0
  155. package/lib/loopback-only.js +90 -0
  156. package/lib/method-not-allowed.d.ts +47 -0
  157. package/lib/method-not-allowed.js +82 -0
  158. package/lib/method-override.d.ts +46 -0
  159. package/lib/method-override.js +103 -0
  160. package/lib/mime-BQOYHl-l.d.ts +72 -0
  161. package/lib/node-server/conninfo.d.ts +11 -0
  162. package/lib/node-server/conninfo.js +19 -0
  163. package/lib/node-server/serve-static.d.ts +19 -0
  164. package/lib/node-server/serve-static.js +2 -0
  165. package/lib/node-server.d.ts +103 -0
  166. package/lib/node-server.js +1325 -0
  167. package/lib/powered-by.d.ts +28 -0
  168. package/lib/powered-by.js +24 -0
  169. package/lib/pretty-json.d.ts +40 -0
  170. package/lib/pretty-json.js +39 -0
  171. package/lib/reg-exp-router-DC1R3qoY.js +363 -0
  172. package/lib/request-id.d.ts +45 -0
  173. package/lib/request-id.js +34 -0
  174. package/lib/request.d.ts +2 -0
  175. package/lib/request.js +323 -0
  176. package/lib/route.d.ts +78 -0
  177. package/lib/route.js +126 -0
  178. package/lib/router/linear-router.d.ts +11 -0
  179. package/lib/router/linear-router.js +96 -0
  180. package/lib/router/pattern-router.d.ts +11 -0
  181. package/lib/router/pattern-router.js +41 -0
  182. package/lib/router/reg-exp-router.d.ts +35 -0
  183. package/lib/router/reg-exp-router.js +2 -0
  184. package/lib/router/smart-router.d.ts +15 -0
  185. package/lib/router/smart-router.js +2 -0
  186. package/lib/router/trie-router.d.ts +11 -0
  187. package/lib/router/trie-router.js +2 -0
  188. package/lib/router-CvUxUTOq.d.ts +99 -0
  189. package/lib/router.d.ts +2 -0
  190. package/lib/router.js +35 -0
  191. package/lib/schema-validator.d.ts +28 -0
  192. package/lib/schema-validator.js +22 -0
  193. package/lib/secure-headers.d.ts +125 -0
  194. package/lib/secure-headers.js +163 -0
  195. package/lib/serve-static-Dw_m6KxR.js +213 -0
  196. package/lib/serve-static.d.ts +31 -0
  197. package/lib/serve-static.js +77 -0
  198. package/lib/smart-router-C5CZ5XSM.js +49 -0
  199. package/lib/stream-CPdqZ0Fp.d.ts +34 -0
  200. package/lib/streaming-DHST3Scg.js +96 -0
  201. package/lib/streaming.d.ts +23 -0
  202. package/lib/streaming.js +2 -0
  203. package/lib/testing.d.ts +10 -0
  204. package/lib/testing.js +17 -0
  205. package/lib/timeout.d.ts +30 -0
  206. package/lib/timeout.js +42 -0
  207. package/lib/timing.d.ts +130 -0
  208. package/lib/timing.js +183 -0
  209. package/lib/trailing-slash.d.ts +91 -0
  210. package/lib/trailing-slash.js +85 -0
  211. package/lib/trie-router-CfFbapzL.js +146 -0
  212. package/lib/types-CDO6I3B0.d.ts +40 -0
  213. package/lib/types-CHesD1KG.d.ts +195 -0
  214. package/lib/types-CwrQjlaM.d.ts +105 -0
  215. package/lib/types-DR95J00T.d.ts +29 -0
  216. package/lib/types.d.ts +2 -0
  217. package/lib/types.js +4 -0
  218. package/lib/utils/accept.d.ts +9 -0
  219. package/lib/utils/accept.js +193 -0
  220. package/lib/utils/basic-auth.d.ts +8 -0
  221. package/lib/utils/basic-auth.js +20 -0
  222. package/lib/utils/body.d.ts +2 -0
  223. package/lib/utils/body.js +94 -0
  224. package/lib/utils/buffer.d.ts +19 -0
  225. package/lib/utils/buffer.js +51 -0
  226. package/lib/utils/color.d.ts +24 -0
  227. package/lib/utils/color.js +37 -0
  228. package/lib/utils/compress.d.ts +11 -0
  229. package/lib/utils/compress.js +11 -0
  230. package/lib/utils/concurrent.d.ts +17 -0
  231. package/lib/utils/concurrent.js +30 -0
  232. package/lib/utils/constants.d.ts +7 -0
  233. package/lib/utils/constants.js +7 -0
  234. package/lib/utils/cookie.d.ts +2 -0
  235. package/lib/utils/cookie.js +125 -0
  236. package/lib/utils/crypto.d.ts +14 -0
  237. package/lib/utils/crypto.js +34 -0
  238. package/lib/utils/encode.d.ts +11 -0
  239. package/lib/utils/encode.js +33 -0
  240. package/lib/utils/filepath.d.ts +14 -0
  241. package/lib/utils/filepath.js +25 -0
  242. package/lib/utils/handler.d.ts +9 -0
  243. package/lib/utils/handler.js +12 -0
  244. package/lib/utils/headers.d.ts +2 -0
  245. package/lib/utils/headers.js +1 -0
  246. package/lib/utils/html.d.ts +46 -0
  247. package/lib/utils/html.js +103 -0
  248. package/lib/utils/http-status.d.ts +2 -0
  249. package/lib/utils/http-status.js +1 -0
  250. package/lib/utils/ipaddr.d.ts +56 -0
  251. package/lib/utils/ipaddr.js +238 -0
  252. package/lib/utils/jwt.d.ts +24 -0
  253. package/lib/utils/jwt.js +2 -0
  254. package/lib/utils/mime.d.ts +2 -0
  255. package/lib/utils/mime.js +77 -0
  256. package/lib/utils/stream.d.ts +2 -0
  257. package/lib/utils/stream.js +88 -0
  258. package/lib/utils/types.d.ts +2 -0
  259. package/lib/utils/types.js +1 -0
  260. package/lib/utils/url.d.ts +46 -0
  261. package/lib/utils/url.js +197 -0
  262. package/lib/utils-dw8lxqjL.js +4 -0
  263. package/lib/validator-D84mq-dO.js +65 -0
  264. package/lib/validator.d.ts +42 -0
  265. package/lib/validator.js +2 -0
  266. package/lib/ws.d.ts +2 -0
  267. package/lib/ws.js +53 -0
  268. package/package.json +312 -14
  269. package/plugins/acryl-inspect/src/service.ts +2 -2
  270. package/plugins/acryl-inspect/tests/service.spec.ts +3 -3
  271. package/plugins/acryl-inspect/upstream.json +2 -2
  272. package/plugins/acryl-node-server/tests/adapter/app.ts +2 -2
  273. package/plugins/acryl-node-server/tests/adapter/assets/static/acryl.html +1 -1
  274. package/plugins/acryl-node-server/tests/adapter/assets/static/index.html +1 -1
  275. package/plugins/acryl-node-server/tests/adapter/conninfo.test.ts +2 -2
  276. package/plugins/acryl-node-server/tests/adapter/content-length.test.ts +4 -4
  277. package/plugins/acryl-node-server/tests/adapter/early-hints.test.ts +5 -5
  278. package/plugins/acryl-node-server/tests/adapter/request-client-disconnect.test.ts +2 -2
  279. package/plugins/acryl-node-server/tests/adapter/serve-static.test.ts +20 -20
  280. package/plugins/acryl-node-server/tests/adapter/server-socket.test.ts +2 -2
  281. package/plugins/acryl-node-server/tests/adapter/server.test.ts +50 -50
  282. package/plugins/acryl-node-server/tests/adapter/utils/response.test.ts +4 -4
  283. package/plugins/acryl-node-server/tests/adapter/websocket.test.ts +9 -9
  284. package/plugins/acryl-node-server/tests/server.spec.ts +6 -6
  285. package/plugins/acryl-node-server/upstream.json +2 -2
  286. package/plugins/acryl-router/src/client.ts +1 -1
  287. package/plugins/acryl-router/src/connection.ts +2 -2
  288. package/plugins/acryl-router/src/core/app-base.ts +29 -29
  289. package/plugins/acryl-router/src/core/app.test.ts +175 -175
  290. package/plugins/acryl-router/src/core/app.ts +8 -8
  291. package/plugins/acryl-router/src/core/client/client.test.ts +76 -76
  292. package/plugins/acryl-router/src/core/client/client.ts +2 -2
  293. package/plugins/acryl-router/src/core/client/fetch-result-please.ts +1 -1
  294. package/plugins/acryl-router/src/core/client/index.ts +1 -1
  295. package/plugins/acryl-router/src/core/client/types.test.ts +6 -6
  296. package/plugins/acryl-router/src/core/client/types.ts +16 -16
  297. package/plugins/acryl-router/src/core/client/utils.test.ts +2 -2
  298. package/plugins/acryl-router/src/core/context.test.ts +4 -4
  299. package/plugins/acryl-router/src/core/context.ts +6 -6
  300. package/plugins/acryl-router/src/core/helper/accepts/accepts.test.ts +3 -3
  301. package/plugins/acryl-router/src/core/helper/accepts/index.ts +1 -1
  302. package/plugins/acryl-router/src/core/helper/adapter/index.test.ts +6 -6
  303. package/plugins/acryl-router/src/core/helper/adapter/index.ts +1 -1
  304. package/plugins/acryl-router/src/core/helper/conninfo/index.ts +1 -1
  305. package/plugins/acryl-router/src/core/helper/cookie/index.test.ts +8 -8
  306. package/plugins/acryl-router/src/core/helper/cookie/index.ts +1 -1
  307. package/plugins/acryl-router/src/core/helper/factory/index.test.ts +9 -9
  308. package/plugins/acryl-router/src/core/helper/factory/index.ts +10 -10
  309. package/plugins/acryl-router/src/core/helper/html/index.test.ts +4 -4
  310. package/plugins/acryl-router/src/core/helper/html/index.ts +1 -1
  311. package/plugins/acryl-router/src/core/helper/route/index.test.ts +7 -7
  312. package/plugins/acryl-router/src/core/helper/route/index.ts +8 -8
  313. package/plugins/acryl-router/src/core/helper/streaming/index.ts +1 -1
  314. package/plugins/acryl-router/src/core/helper/testing/index.test.ts +6 -6
  315. package/plugins/acryl-router/src/core/helper/testing/index.ts +4 -4
  316. package/plugins/acryl-router/src/core/helper/websocket/index.ts +2 -1
  317. package/plugins/acryl-router/src/core/http-exception.ts +1 -1
  318. package/plugins/acryl-router/src/core/index.ts +9 -9
  319. package/plugins/acryl-router/src/core/middleware/basic-auth/index.test.ts +6 -6
  320. package/plugins/acryl-router/src/core/middleware/basic-auth/index.ts +3 -3
  321. package/plugins/acryl-router/src/core/middleware/bearer-auth/index.test.ts +5 -5
  322. package/plugins/acryl-router/src/core/middleware/bearer-auth/index.ts +3 -3
  323. package/plugins/acryl-router/src/core/middleware/body-limit/index.test.ts +6 -6
  324. package/plugins/acryl-router/src/core/middleware/body-limit/index.ts +3 -3
  325. package/plugins/acryl-router/src/core/middleware/combine/index.test.ts +9 -9
  326. package/plugins/acryl-router/src/core/middleware/combine/index.ts +7 -7
  327. package/plugins/acryl-router/src/core/middleware/compress/index.test.ts +9 -9
  328. package/plugins/acryl-router/src/core/middleware/compress/index.ts +3 -3
  329. package/plugins/acryl-router/src/core/middleware/context-storage/index.test.ts +5 -5
  330. package/plugins/acryl-router/src/core/middleware/context-storage/index.ts +4 -4
  331. package/plugins/acryl-router/src/core/middleware/cors/index.test.ts +7 -7
  332. package/plugins/acryl-router/src/core/middleware/cors/index.ts +3 -3
  333. package/plugins/acryl-router/src/core/middleware/csrf/index.test.ts +10 -10
  334. package/plugins/acryl-router/src/core/middleware/csrf/index.ts +3 -3
  335. package/plugins/acryl-router/src/core/middleware/etag/index.test.ts +42 -42
  336. package/plugins/acryl-router/src/core/middleware/etag/index.ts +4 -4
  337. package/plugins/acryl-router/src/core/middleware/ip-restriction/index.test.ts +4 -4
  338. package/plugins/acryl-router/src/core/middleware/ip-restriction/index.ts +6 -6
  339. package/plugins/acryl-router/src/core/middleware/jwk/index.test.ts +16 -16
  340. package/plugins/acryl-router/src/core/middleware/jwk/jwk.ts +7 -6
  341. package/plugins/acryl-router/src/core/middleware/jwt/index.test.ts +16 -16
  342. package/plugins/acryl-router/src/core/middleware/jwt/jwt.ts +4 -3
  343. package/plugins/acryl-router/src/core/middleware/language/index.test.ts +3 -3
  344. package/plugins/acryl-router/src/core/middleware/language/language.ts +3 -3
  345. package/plugins/acryl-router/src/core/middleware/logger/index.test.ts +5 -5
  346. package/plugins/acryl-router/src/core/middleware/logger/index.ts +4 -4
  347. package/plugins/acryl-router/src/core/middleware/method-not-allowed/index.test.ts +24 -24
  348. package/plugins/acryl-router/src/core/middleware/method-not-allowed/index.ts +8 -8
  349. package/plugins/acryl-router/src/core/middleware/method-override/index.test.ts +5 -5
  350. package/plugins/acryl-router/src/core/middleware/method-override/index.ts +6 -6
  351. package/plugins/acryl-router/src/core/middleware/powered-by/index.test.ts +4 -4
  352. package/plugins/acryl-router/src/core/middleware/powered-by/index.ts +6 -6
  353. package/plugins/acryl-router/src/core/middleware/pretty-json/index.test.ts +30 -30
  354. package/plugins/acryl-router/src/core/middleware/pretty-json/index.ts +4 -4
  355. package/plugins/acryl-router/src/core/middleware/request-id/index.test.ts +15 -15
  356. package/plugins/acryl-router/src/core/middleware/request-id/request-id.ts +3 -3
  357. package/plugins/acryl-router/src/core/middleware/secure-headers/index.test.ts +35 -35
  358. package/plugins/acryl-router/src/core/middleware/secure-headers/secure-headers.ts +3 -3
  359. package/plugins/acryl-router/src/core/middleware/serve-static/index.test.ts +23 -23
  360. package/plugins/acryl-router/src/core/middleware/serve-static/index.ts +1 -1
  361. package/plugins/acryl-router/src/core/middleware/timeout/index.test.ts +2 -2
  362. package/plugins/acryl-router/src/core/middleware/timeout/index.ts +3 -3
  363. package/plugins/acryl-router/src/core/middleware/timing/index.test.ts +14 -14
  364. package/plugins/acryl-router/src/core/middleware/timing/timing.ts +3 -3
  365. package/plugins/acryl-router/src/core/middleware/trailing-slash/index.test.ts +7 -7
  366. package/plugins/acryl-router/src/core/middleware/trailing-slash/index.ts +7 -7
  367. package/plugins/acryl-router/src/core/request.test.ts +42 -42
  368. package/plugins/acryl-router/src/core/request.ts +6 -6
  369. package/plugins/acryl-router/src/core/router/linear-router/index.ts +1 -1
  370. package/plugins/acryl-router/src/core/router/pattern-router/index.ts +1 -1
  371. package/plugins/acryl-router/src/core/router/reg-exp-router/index.ts +1 -1
  372. package/plugins/acryl-router/src/core/router/smart-router/index.ts +1 -1
  373. package/plugins/acryl-router/src/core/router/trie-router/index.ts +1 -1
  374. package/plugins/acryl-router/src/core/types.test.ts +115 -115
  375. package/plugins/acryl-router/src/core/types.ts +72 -72
  376. package/plugins/acryl-router/src/core/utils/body.ts +8 -8
  377. package/plugins/acryl-router/src/core/utils/html.ts +1 -1
  378. package/plugins/acryl-router/src/core/utils/jwt/jws.ts +3 -3
  379. package/plugins/acryl-router/src/core/utils/jwt/jwt.test.ts +2 -2
  380. package/plugins/acryl-router/src/core/utils/jwt/jwt.ts +3 -3
  381. package/plugins/acryl-router/src/core/utils/jwt/types.ts +1 -1
  382. package/plugins/acryl-router/src/core/utils/types.ts +42 -0
  383. package/plugins/acryl-router/src/core/utils/url.test.ts +2 -2
  384. package/plugins/acryl-router/src/core/validator/index.ts +1 -1
  385. package/plugins/acryl-router/src/core/validator/validator.test.ts +28 -28
  386. package/plugins/acryl-router/src/deprecated.ts +15 -0
  387. package/plugins/acryl-router/src/index.ts +3 -2
  388. package/plugins/acryl-router/src/service.ts +10 -10
  389. package/plugins/acryl-router/tests/docs-examples.spec.ts +11 -11
  390. package/plugins/acryl-router/tests/live-install.spec.ts +2 -2
  391. package/plugins/acryl-router/tests/loader.spec.ts +3 -3
  392. package/plugins/acryl-router/tests/loopback-only.spec.ts +4 -4
  393. package/plugins/acryl-router/tests/no-dom/consumer.ts +11 -0
  394. package/plugins/acryl-router/tests/no-dom/tsconfig.json +13 -0
  395. package/plugins/acryl-router/tests/service.spec.ts +23 -23
  396. package/plugins/acryl-router/upstream.json +3 -3
  397. package/plugins/acryl-router-http/tests/adapter.spec.ts +3 -3
  398. package/plugins/acryl-router-http/tests/surfaces.spec.ts +2 -2
  399. package/plugins/acryl-router-http/upstream.json +2 -2
  400. package/plugins/acryl-state/src/service.ts +2 -2
  401. package/plugins/acryl-state/upstream.json +2 -2
  402. package/plugins/builder/script.ts +2 -2
  403. package/plugins/extensions/resolve.ts +70 -10
  404. package/plugins/openai/prompt.ts +5 -5
  405. package/shared/AGENTS.core.md +16 -9
  406. package/templates/agent/src/routes.ts +2 -2
  407. package/templates/agent/test/model.test.ts +2 -2
  408. package/templates/agent/tsconfig.json +40 -0
  409. package/templates/blank/src/routes.ts +2 -2
  410. package/templates/todo/src/todo.ts +2 -2
  411. package/templates/todo/upstream.json +2 -2
  412. package/docs/framework/context.md +0 -129
  413. package/docs/framework/helpers.md +0 -118
  414. package/docs/framework/middleware.md +0 -154
  415. package/docs/framework/request.md +0 -106
  416. /package/docs/framework/{plugin-lifecycle.md → cordis/plugin-lifecycle.md} +0 -0
@@ -3,7 +3,7 @@
3
3
  import { expectTypeOf } from 'vitest'
4
4
  import { hc } from './client/index.ts'
5
5
  import type { Context, ExecutionContext } from './context.ts'
6
- import { App } from './app.ts'
6
+ import { Acryl } from './app.ts'
7
7
  import { HTTPException } from './http-exception.ts'
8
8
  import { logger } from './middleware/logger/index.ts'
9
9
  import { poweredBy } from './middleware/powered-by/index.ts'
@@ -50,19 +50,19 @@ describe('GET Request', () => {
50
50
  describe('without middleware', () => {
51
51
  // In other words, this is a test for cases that do not use `compose()`
52
52
 
53
- const app = new App<Env>()
53
+ const app = new Acryl<Env>()
54
54
 
55
55
  app.get('/hello', async () => {
56
56
  return new Response('hello', {
57
57
  status: 200,
58
- statusText: 'App is OK',
58
+ statusText: 'Acryl is OK',
59
59
  })
60
60
  })
61
61
 
62
62
  app.get('/hello-with-shortcuts', (c) => {
63
- c.header('X-Custom', 'This is App')
63
+ c.header('X-Custom', 'This is Acryl')
64
64
  c.status(201)
65
- return c.html('<h1>App!!!</h1>')
65
+ return c.html('<h1>Acryl!!!</h1>')
66
66
  })
67
67
 
68
68
  app.get('/hello-env', (c) => {
@@ -77,7 +77,7 @@ describe('GET Request', () => {
77
77
  const res = await app.request('http://localhost/hello')
78
78
  expect(res).not.toBeNull()
79
79
  expect(res.status).toBe(200)
80
- expect(res.statusText).toBe('App is OK')
80
+ expect(res.statusText).toBe('Acryl is OK')
81
81
  expect(await res.text()).toBe('hello')
82
82
  })
83
83
 
@@ -90,7 +90,7 @@ describe('GET Request', () => {
90
90
  const res = await app.request('/hello')
91
91
  expect(res).not.toBeNull()
92
92
  expect(res.status).toBe(200)
93
- expect(res.statusText).toBe('App is OK')
93
+ expect(res.statusText).toBe('Acryl is OK')
94
94
  expect(await res.text()).toBe('hello')
95
95
  })
96
96
 
@@ -98,7 +98,7 @@ describe('GET Request', () => {
98
98
  const res = await app.request('hello')
99
99
  expect(res).not.toBeNull()
100
100
  expect(res.status).toBe(200)
101
- expect(res.statusText).toBe('App is OK')
101
+ expect(res.statusText).toBe('Acryl is OK')
102
102
  expect(await res.text()).toBe('hello')
103
103
  })
104
104
 
@@ -106,9 +106,9 @@ describe('GET Request', () => {
106
106
  const res = await app.request('http://localhost/hello-with-shortcuts')
107
107
  expect(res).not.toBeNull()
108
108
  expect(res.status).toBe(201)
109
- expect(res.headers.get('X-Custom')).toBe('This is App')
109
+ expect(res.headers.get('X-Custom')).toBe('This is Acryl')
110
110
  expect(res.headers.get('Content-Type')).toMatch(/text\/html/)
111
- expect(await res.text()).toBe('<h1>App!!!</h1>')
111
+ expect(await res.text()).toBe('<h1>Acryl!!!</h1>')
112
112
  })
113
113
 
114
114
  it('GET / is not found', async () => {
@@ -141,7 +141,7 @@ describe('GET Request', () => {
141
141
  describe('with middleware', () => {
142
142
  // when using `compose()`
143
143
 
144
- const app = new App<Env>()
144
+ const app = new Acryl<Env>()
145
145
 
146
146
  app.use('*', async (ctx, next) => {
147
147
  await next()
@@ -150,14 +150,14 @@ describe('GET Request', () => {
150
150
  app.get('/hello', async () => {
151
151
  return new Response('hello', {
152
152
  status: 200,
153
- statusText: 'App is OK',
153
+ statusText: 'Acryl is OK',
154
154
  })
155
155
  })
156
156
 
157
157
  app.get('/hello-with-shortcuts', (c) => {
158
- c.header('X-Custom', 'This is App')
158
+ c.header('X-Custom', 'This is Acryl')
159
159
  c.status(201)
160
- return c.html('<h1>App!!!</h1>')
160
+ return c.html('<h1>Acryl!!!</h1>')
161
161
  })
162
162
 
163
163
  app.get('/hello-env', (c) => {
@@ -172,7 +172,7 @@ describe('GET Request', () => {
172
172
  const res = await app.request('http://localhost/hello')
173
173
  expect(res).not.toBeNull()
174
174
  expect(res.status).toBe(200)
175
- expect(res.statusText).toBe('App is OK')
175
+ expect(res.statusText).toBe('Acryl is OK')
176
176
  expect(await res.text()).toBe('hello')
177
177
  })
178
178
 
@@ -185,7 +185,7 @@ describe('GET Request', () => {
185
185
  const res = await app.request('/hello')
186
186
  expect(res).not.toBeNull()
187
187
  expect(res.status).toBe(200)
188
- expect(res.statusText).toBe('App is OK')
188
+ expect(res.statusText).toBe('Acryl is OK')
189
189
  expect(await res.text()).toBe('hello')
190
190
  })
191
191
 
@@ -193,7 +193,7 @@ describe('GET Request', () => {
193
193
  const res = await app.request('hello')
194
194
  expect(res).not.toBeNull()
195
195
  expect(res.status).toBe(200)
196
- expect(res.statusText).toBe('App is OK')
196
+ expect(res.statusText).toBe('Acryl is OK')
197
197
  expect(await res.text()).toBe('hello')
198
198
  })
199
199
 
@@ -201,9 +201,9 @@ describe('GET Request', () => {
201
201
  const res = await app.request('http://localhost/hello-with-shortcuts')
202
202
  expect(res).not.toBeNull()
203
203
  expect(res.status).toBe(201)
204
- expect(res.headers.get('X-Custom')).toBe('This is App')
204
+ expect(res.headers.get('X-Custom')).toBe('This is Acryl')
205
205
  expect(res.headers.get('Content-Type')).toMatch(/text\/html/)
206
- expect(await res.text()).toBe('<h1>App!!!</h1>')
206
+ expect(await res.text()).toBe('<h1>Acryl!!!</h1>')
207
207
  })
208
208
 
209
209
  it('GET / is not found', async () => {
@@ -236,7 +236,7 @@ describe('GET Request', () => {
236
236
 
237
237
  describe('Register handlers without a path', () => {
238
238
  describe('No basePath', () => {
239
- const app = new App()
239
+ const app = new Acryl()
240
240
 
241
241
  app.get((c) => {
242
242
  return c.text('Hello')
@@ -255,7 +255,7 @@ describe('Register handlers without a path', () => {
255
255
  })
256
256
 
257
257
  describe('With specifying basePath', () => {
258
- const app = new App().basePath('/about')
258
+ const app = new Acryl().basePath('/about')
259
259
 
260
260
  app.get((c) => {
261
261
  return c.text('About')
@@ -274,7 +274,7 @@ describe('Register handlers without a path', () => {
274
274
  })
275
275
 
276
276
  describe('With chaining', () => {
277
- const app = new App()
277
+ const app = new Acryl()
278
278
 
279
279
  app.post('/books').get((c) => {
280
280
  return c.text('Books')
@@ -296,11 +296,11 @@ describe('Register handlers without a path', () => {
296
296
  describe('Options', () => {
297
297
  describe('router option', () => {
298
298
  it('Should be SmartRouter', () => {
299
- const app = new App()
299
+ const app = new Acryl()
300
300
  expect(app.router instanceof SmartRouter).toBe(true)
301
301
  })
302
302
  it('Should be RegExpRouter', () => {
303
- const app = new App({
303
+ const app = new Acryl({
304
304
  router: new RegExpRouter(),
305
305
  })
306
306
  expect(app.router instanceof RegExpRouter).toBe(true)
@@ -309,7 +309,7 @@ describe('Options', () => {
309
309
 
310
310
  describe('strict parameter', () => {
311
311
  describe('strict is true with not slash', () => {
312
- const app = new App()
312
+ const app = new Acryl()
313
313
 
314
314
  app.get('/hello', (c) => {
315
315
  return c.text('/hello')
@@ -326,7 +326,7 @@ describe('Options', () => {
326
326
  })
327
327
 
328
328
  describe('strict is true with slash', () => {
329
- const app = new App()
329
+ const app = new Acryl()
330
330
 
331
331
  app.get('/hello/', (c) => {
332
332
  return c.text('/hello/')
@@ -343,7 +343,7 @@ describe('Options', () => {
343
343
  })
344
344
 
345
345
  describe('strict is false', () => {
346
- const app = new App({ strict: false })
346
+ const app = new Acryl({ strict: false })
347
347
 
348
348
  app.get('/hello', (c) => {
349
349
  return c.text('/hello')
@@ -360,7 +360,7 @@ describe('Options', () => {
360
360
  })
361
361
 
362
362
  describe('strict is false with `getPath` option', () => {
363
- const app = new App({
363
+ const app = new Acryl({
364
364
  strict: false,
365
365
  // @ts-expect-error `getPath` is not used when `strict` is false
366
366
  getPath: getPath,
@@ -384,20 +384,20 @@ describe('Options', () => {
384
384
  it('Should not modify the options passed to it', () => {
385
385
  const options = { strict: true }
386
386
  const clone = structuredClone(options)
387
- const app = new App(clone)
387
+ const app = new Acryl(clone)
388
388
  expect(clone).toEqual(options)
389
389
  })
390
390
  })
391
391
 
392
392
  describe('Destruct functions in context', () => {
393
393
  it('Should return 200 response - text', async () => {
394
- const app = new App()
394
+ const app = new Acryl()
395
395
  app.get('/text', ({ text }) => text('foo'))
396
396
  const res = await app.request('http://localhost/text')
397
397
  expect(res.status).toBe(200)
398
398
  })
399
399
  it('Should return 200 response - json', async () => {
400
- const app = new App()
400
+ const app = new Acryl()
401
401
  app.get('/json', ({ json }) => json({ foo: 'bar' }))
402
402
  const res = await app.request('http://localhost/json')
403
403
  expect(res.status).toBe(200)
@@ -406,7 +406,7 @@ describe('Destruct functions in context', () => {
406
406
 
407
407
  describe('Routing', () => {
408
408
  it('Return it self', async () => {
409
- const app = new App()
409
+ const app = new Acryl()
410
410
 
411
411
  const app2 = app.get('/', () => new Response('get /'))
412
412
  expect(app2).not.toBeUndefined()
@@ -424,7 +424,7 @@ describe('Routing', () => {
424
424
  })
425
425
 
426
426
  it('Nested route', async () => {
427
- const app = new App()
427
+ const app = new Acryl()
428
428
 
429
429
  const book = app.basePath('/book')
430
430
  book.get('/', (c) => c.text('get /book'))
@@ -475,8 +475,8 @@ describe('Routing', () => {
475
475
  })
476
476
 
477
477
  it('Should match a suffix wildcard after falling back to TrieRouter', async () => {
478
- const app = new App()
479
- const sub = new App()
478
+ const app = new Acryl()
479
+ const sub = new Acryl()
480
480
  sub.post('/items', (c) => c.text('items'))
481
481
  sub.post('/:slug', (c) => c.text('slug'))
482
482
  app.route('/api', sub)
@@ -489,8 +489,8 @@ describe('Routing', () => {
489
489
  })
490
490
 
491
491
  it('Nested route - subApp with basePath', async () => {
492
- const app = new App()
493
- const book = new App().basePath('/book')
492
+ const app = new Acryl()
493
+ const book = new Acryl().basePath('/book')
494
494
  book.get('/', (c) => c.text('get /book'))
495
495
  app.route('/api', book)
496
496
 
@@ -501,8 +501,8 @@ describe('Routing', () => {
501
501
 
502
502
  describe('Nested route - basePath of the mounted routes', () => {
503
503
  it('Should set basePath to the mount path', () => {
504
- const app = new App()
505
- const sub = new App()
504
+ const app = new Acryl()
505
+ const sub = new Acryl()
506
506
  sub.get('/posts/:id', (c) => c.text('post'))
507
507
  app.route('/:sub', sub)
508
508
 
@@ -517,9 +517,9 @@ describe('Routing', () => {
517
517
  })
518
518
 
519
519
  it('Should accumulate basePath through nested route() calls', () => {
520
- const app = new App()
521
- const sub1 = new App()
522
- const sub2 = new App()
520
+ const app = new Acryl()
521
+ const sub1 = new Acryl()
522
+ const sub2 = new Acryl()
523
523
  sub2.get('/posts/:id', (c) => c.text('post'))
524
524
  sub1.route('/:sub2', sub2)
525
525
  app.route('/:sub1', sub1)
@@ -535,8 +535,8 @@ describe('Routing', () => {
535
535
  })
536
536
 
537
537
  it('Should merge the basePath of a subApp created with basePath()', () => {
538
- const app = new App()
539
- const sub = new App().basePath('/book')
538
+ const app = new Acryl()
539
+ const sub = new Acryl().basePath('/book')
540
540
  sub.get('/:id', (c) => c.text('book'))
541
541
  app.route('/api', sub)
542
542
 
@@ -552,12 +552,12 @@ describe('Routing', () => {
552
552
  })
553
553
 
554
554
  it('Multiple route', async () => {
555
- const app = new App()
555
+ const app = new Acryl()
556
556
 
557
- const book = new App()
557
+ const book = new Acryl()
558
558
  book.get('/hello', (c) => c.text('get /book/hello'))
559
559
 
560
- const user = new App()
560
+ const user = new Acryl()
561
561
  user.get('/hello', (c) => c.text('get /user/hello'))
562
562
 
563
563
  app.route('/book', book).route('/user', user)
@@ -572,21 +572,21 @@ describe('Routing', () => {
572
572
  })
573
573
 
574
574
  describe('Nested route with middleware', () => {
575
- const api = new App()
575
+ const api = new Acryl()
576
576
  const api2 = api.use('*', async (_c, next) => await next())
577
577
 
578
578
  it('Should mount routes with no type errors', () => {
579
- const app = new App().route('/api', api2)
579
+ const app = new Acryl().route('/api', api2)
580
580
  })
581
581
  })
582
582
 
583
583
  describe('Grouped route', () => {
584
- let one: App, two: App, three: App
584
+ let one: Acryl, two: Acryl, three: Acryl
585
585
 
586
586
  beforeEach(() => {
587
- one = new App()
588
- two = new App()
589
- three = new App()
587
+ one = new Acryl()
588
+ two = new Acryl()
589
+ three = new Acryl()
590
590
  })
591
591
 
592
592
  it('only works with correct order', async () => {
@@ -645,11 +645,11 @@ describe('Routing', () => {
645
645
  })
646
646
 
647
647
  it('routing with hostname', async () => {
648
- const app = new App({
648
+ const app = new Acryl({
649
649
  getPath: (req) => req.url.replace(/^https?:\/(.+?)$/, '$1'),
650
650
  })
651
651
 
652
- const sub = new App()
652
+ const sub = new Acryl()
653
653
  sub.get('/', (c) => c.text('hello sub'))
654
654
  sub.get('/foo', (c) => c.text('hello sub foo'))
655
655
 
@@ -686,12 +686,12 @@ describe('Routing', () => {
686
686
  })
687
687
 
688
688
  it('routing with request header', async () => {
689
- const app = new App({
689
+ const app = new Acryl({
690
690
  getPath: (req) =>
691
691
  '/' + req.headers.get('host') + req.url.replace(/^https?:\/\/[^/]+(\/[^?]*)/, '$1'),
692
692
  })
693
693
 
694
- const sub = new App()
694
+ const sub = new Acryl()
695
695
  sub.get('/', (c) => c.text('hello sub'))
696
696
  sub.get('/foo', (c) => c.text('hello sub foo'))
697
697
 
@@ -749,7 +749,7 @@ describe('Routing', () => {
749
749
  })
750
750
 
751
751
  describe('routing with the bindings value', () => {
752
- const app = new App<{ Bindings: { host: string } }>({
752
+ const app = new Acryl<{ Bindings: { host: string } }>({
753
753
  getPath: (req, options) => {
754
754
  const url = new URL(req.url)
755
755
  const host = options?.env?.host
@@ -776,7 +776,7 @@ describe('Routing', () => {
776
776
  })
777
777
 
778
778
  describe('Chained route', () => {
779
- const app = new App()
779
+ const app = new Acryl()
780
780
 
781
781
  app
782
782
  .get('/chained/:abc', (c) => {
@@ -804,9 +804,9 @@ describe('Routing', () => {
804
804
  })
805
805
 
806
806
  describe('Encoded path', () => {
807
- let app: App
807
+ let app: Acryl
808
808
  beforeEach(() => {
809
- app = new App()
809
+ app = new Acryl()
810
810
  })
811
811
 
812
812
  it('should decode path parameter', async () => {
@@ -864,9 +864,9 @@ describe('Routing', () => {
864
864
  })
865
865
 
866
866
  describe('param and query', () => {
867
- const apps: Record<string, App> = {}
867
+ const apps: Record<string, Acryl> = {}
868
868
  apps['get by name'] = (() => {
869
- const app = new App()
869
+ const app = new Acryl()
870
870
 
871
871
  app.get('/entry/:id', (c) => {
872
872
  const id = c.req.param('id')
@@ -898,7 +898,7 @@ describe('param and query', () => {
898
898
  })()
899
899
 
900
900
  apps['get all as an object'] = (() => {
901
- const app = new App()
901
+ const app = new Acryl()
902
902
 
903
903
  app.get('/entry/:id', (c) => {
904
904
  const { id } = c.req.param()
@@ -983,7 +983,7 @@ describe('param and query', () => {
983
983
  })
984
984
 
985
985
  describe('param with undefined', () => {
986
- const app = new App()
986
+ const app = new Acryl()
987
987
  app.get('/foo/:foo', (c) => {
988
988
  const bar = c.req.param('bar')
989
989
  return c.json({ foo: bar })
@@ -997,7 +997,7 @@ describe('param and query', () => {
997
997
  })
998
998
 
999
999
  describe('c.req.path', () => {
1000
- const app = new App()
1000
+ const app = new Acryl()
1001
1001
  app.get('/', (c) => c.text(c.req.path))
1002
1002
  app.get('/search', (c) => c.text(c.req.path))
1003
1003
 
@@ -1015,7 +1015,7 @@ describe('c.req.path', () => {
1015
1015
  })
1016
1016
 
1017
1017
  describe('Header', () => {
1018
- const app = new App()
1018
+ const app = new Acryl()
1019
1019
 
1020
1020
  app.get('/text', (c) => {
1021
1021
  return c.text('Hello')
@@ -1044,7 +1044,7 @@ describe('Header', () => {
1044
1044
 
1045
1045
  describe('Middleware', () => {
1046
1046
  describe('Basic', () => {
1047
- const app = new App()
1047
+ const app = new Acryl()
1048
1048
 
1049
1049
  // Custom Logger
1050
1050
  app.use('*', async (c, next) => {
@@ -1141,7 +1141,7 @@ describe('Middleware', () => {
1141
1141
  })
1142
1142
 
1143
1143
  describe('Chained route', () => {
1144
- const app = new App()
1144
+ const app = new Acryl()
1145
1145
  app
1146
1146
  .use('/chained/*', async (c, next) => {
1147
1147
  c.req.raw.headers.append('x-before', 'abc')
@@ -1166,7 +1166,7 @@ describe('Middleware', () => {
1166
1166
  })
1167
1167
 
1168
1168
  describe('Multiple handler', () => {
1169
- const app = new App()
1169
+ const app = new Acryl()
1170
1170
  app
1171
1171
  .use(
1172
1172
  '/multiple/*',
@@ -1194,7 +1194,7 @@ describe('Middleware', () => {
1194
1194
  })
1195
1195
 
1196
1196
  describe('Overwrite the response from middleware after next()', () => {
1197
- const app = new App()
1197
+ const app = new Acryl()
1198
1198
 
1199
1199
  app.use('/normal', async (c, next) => {
1200
1200
  await next()
@@ -1225,7 +1225,7 @@ describe('Middleware', () => {
1225
1225
  })
1226
1226
 
1227
1227
  describe('Builtin Middleware', () => {
1228
- const app = new App()
1228
+ const app = new Acryl()
1229
1229
  app.use('/abc', poweredBy())
1230
1230
  app.use('/def', async (c, next) => {
1231
1231
  const middleware = poweredBy()
@@ -1236,18 +1236,18 @@ describe('Builtin Middleware', () => {
1236
1236
 
1237
1237
  it('"powered-by" middleware', async () => {
1238
1238
  const res = await app.request('http://localhost/abc')
1239
- expect(res.headers.get('x-powered-by')).toBe('ACRYL')
1239
+ expect(res.headers.get('x-powered-by')).toBe('Acryl')
1240
1240
  })
1241
1241
 
1242
1242
  it('"powered-by" middleware in a handler', async () => {
1243
1243
  const res = await app.request('http://localhost/def')
1244
- expect(res.headers.get('x-powered-by')).toBe('ACRYL')
1244
+ expect(res.headers.get('x-powered-by')).toBe('Acryl')
1245
1245
  })
1246
1246
  })
1247
1247
 
1248
1248
  describe('Middleware with app.HTTP_METHOD', () => {
1249
1249
  describe('Basic', () => {
1250
- const app = new App()
1250
+ const app = new Acryl()
1251
1251
 
1252
1252
  app.all('*', async (c, next) => {
1253
1253
  c.header('x-before-dispatch', 'foo')
@@ -1290,7 +1290,7 @@ describe('Middleware with app.HTTP_METHOD', () => {
1290
1290
  })
1291
1291
 
1292
1292
  describe('With builtin middleware', () => {
1293
- const app = new App()
1293
+ const app = new Acryl()
1294
1294
  app.get('/abc', poweredBy(), (c) => {
1295
1295
  return c.text('GET /abc')
1296
1296
  })
@@ -1298,13 +1298,13 @@ describe('Middleware with app.HTTP_METHOD', () => {
1298
1298
  const res = await app.request('http://localhost/abc')
1299
1299
  expect(res.status).toBe(200)
1300
1300
  expect(await res.text()).toBe('GET /abc')
1301
- expect(res.headers.get('x-powered-by')).toBe('ACRYL')
1301
+ expect(res.headers.get('x-powered-by')).toBe('Acryl')
1302
1302
  })
1303
1303
  })
1304
1304
  })
1305
1305
 
1306
1306
  describe('Not Found', () => {
1307
- const app = new App()
1307
+ const app = new Acryl()
1308
1308
 
1309
1309
  app.notFound((c) => {
1310
1310
  return c.text('Custom 404 Not Found', 404)
@@ -1329,7 +1329,7 @@ describe('Not Found', () => {
1329
1329
  })
1330
1330
 
1331
1331
  describe('Not Found with a middleware', () => {
1332
- const app = new App()
1332
+ const app = new Acryl()
1333
1333
 
1334
1334
  app.get('/', (c) => c.text('hello'))
1335
1335
  app.use('*', async (c, next) => {
@@ -1348,7 +1348,7 @@ describe('Not Found', () => {
1348
1348
  })
1349
1349
 
1350
1350
  describe('Not Found with some middleware', () => {
1351
- const app = new App()
1351
+ const app = new Acryl()
1352
1352
 
1353
1353
  app.get('/', (c) => c.text('hello'))
1354
1354
  app.use('*', async (c, next) => {
@@ -1371,7 +1371,7 @@ describe('Not Found', () => {
1371
1371
  })
1372
1372
 
1373
1373
  describe('No response from a handler', () => {
1374
- const app = new App()
1374
+ const app = new Acryl()
1375
1375
 
1376
1376
  app.get('/', (c) => c.text('hello'))
1377
1377
  app.get('/not-found', async (c) => undefined)
@@ -1387,7 +1387,7 @@ describe('Not Found', () => {
1387
1387
  })
1388
1388
 
1389
1389
  describe('Custom 404 Not Found with a middleware like Compress Middleware', () => {
1390
- const app = new App()
1390
+ const app = new Acryl()
1391
1391
 
1392
1392
  // Custom Middleware which creates a new Response object after `next()`.
1393
1393
  app.use('*', async (c, next) => {
@@ -1408,7 +1408,7 @@ describe('Not Found', () => {
1408
1408
  })
1409
1409
 
1410
1410
  describe('Redirect', () => {
1411
- const app = new App()
1411
+ const app = new Acryl()
1412
1412
  app.get('/redirect', (c) => {
1413
1413
  return c.redirect('/')
1414
1414
  })
@@ -1422,7 +1422,7 @@ describe('Redirect', () => {
1422
1422
 
1423
1423
  describe('Error handle', () => {
1424
1424
  describe('Basic', () => {
1425
- const app = new App()
1425
+ const app = new Acryl()
1426
1426
 
1427
1427
  app.get('/error', () => {
1428
1428
  throw new Error('This is Error')
@@ -1459,7 +1459,7 @@ describe('Error handle', () => {
1459
1459
  })
1460
1460
 
1461
1461
  describe('Async custom handler', () => {
1462
- const app = new App()
1462
+ const app = new Acryl()
1463
1463
 
1464
1464
  app.get('/error', () => {
1465
1465
  throw new Error('This is Error')
@@ -1494,7 +1494,7 @@ describe('Error handle', () => {
1494
1494
  })
1495
1495
 
1496
1496
  describe('Handle HTTPException', () => {
1497
- const app = new App()
1497
+ const app = new Acryl()
1498
1498
 
1499
1499
  app.get('/exception', () => {
1500
1500
  throw new HTTPException(401, {
@@ -1508,7 +1508,7 @@ describe('Error handle', () => {
1508
1508
  expect(await res.text()).toBe('Unauthorized')
1509
1509
  })
1510
1510
 
1511
- const app2 = new App()
1511
+ const app2 = new Acryl()
1512
1512
 
1513
1513
  app2.get('/exception', () => {
1514
1514
  throw new HTTPException(401)
@@ -1529,7 +1529,7 @@ describe('Error handle', () => {
1529
1529
  })
1530
1530
 
1531
1531
  describe('Handle HTTPException like object', () => {
1532
- const app = new App()
1532
+ const app = new Acryl()
1533
1533
 
1534
1534
  class CustomError extends Error {
1535
1535
  getResponse() {
@@ -1549,7 +1549,7 @@ describe('Error handle', () => {
1549
1549
  })
1550
1550
 
1551
1551
  describe('HTTPException with finally block', () => {
1552
- const app = new App()
1552
+ const app = new Acryl()
1553
1553
  app.use(async (c) => {
1554
1554
  try {
1555
1555
  throw new Error()
@@ -1571,7 +1571,7 @@ describe('Error handle', () => {
1571
1571
  })
1572
1572
 
1573
1573
  describe('Error handling in middleware', () => {
1574
- const app = new App()
1574
+ const app = new Acryl()
1575
1575
 
1576
1576
  app.get('/handle-error-in-middleware', async (c, next) => {
1577
1577
  await next()
@@ -1617,7 +1617,7 @@ describe('Error handling in middleware', () => {
1617
1617
  })
1618
1618
 
1619
1619
  describe('Default route app.use', () => {
1620
- const app = new App()
1620
+ const app = new Acryl()
1621
1621
  app
1622
1622
  .use(async (c, next) => {
1623
1623
  c.header('x-default-use', 'abc')
@@ -1635,7 +1635,7 @@ describe('Error handling in middleware', () => {
1635
1635
  })
1636
1636
 
1637
1637
  describe('Error in `notFound()`', () => {
1638
- const app = new App()
1638
+ const app = new Acryl()
1639
1639
 
1640
1640
  app.use('*', async () => {})
1641
1641
 
@@ -1656,7 +1656,7 @@ describe('Error handling in middleware', () => {
1656
1656
  })
1657
1657
 
1658
1658
  describe('Request methods with custom middleware', () => {
1659
- const app = new App()
1659
+ const app = new Acryl()
1660
1660
 
1661
1661
  app.use('*', async (c, next) => {
1662
1662
  const query = c.req.query('foo')
@@ -1677,7 +1677,7 @@ describe('Request methods with custom middleware', () => {
1677
1677
  c.header('X-Query', query ?? throwExpression('missing `X-Query` header'))
1678
1678
  c.header('X-Param', param)
1679
1679
  c.header('X-Header', header ?? throwExpression('missing `X-Header` header'))
1680
- return c.body('App')
1680
+ return c.body('Acryl')
1681
1681
  })
1682
1682
 
1683
1683
  it('query', async () => {
@@ -1699,7 +1699,7 @@ describe('Request methods with custom middleware', () => {
1699
1699
  })
1700
1700
 
1701
1701
  describe('Middleware + c.json(0, requestInit)', () => {
1702
- const app = new App()
1702
+ const app = new Acryl()
1703
1703
  app.use('/', async (c, next) => {
1704
1704
  await next()
1705
1705
  })
@@ -1718,11 +1718,11 @@ describe('Middleware + c.json(0, requestInit)', () => {
1718
1718
  })
1719
1719
  })
1720
1720
 
1721
- describe('App with `app.route`', () => {
1721
+ describe('Acryl with `app.route`', () => {
1722
1722
  describe('Basic', () => {
1723
- const app = new App()
1724
- const api = new App()
1725
- const middleware = new App()
1723
+ const app = new Acryl()
1724
+ const api = new Acryl()
1725
+ const middleware = new Acryl()
1726
1726
 
1727
1727
  api.use('*', async (c, next) => {
1728
1728
  await next()
@@ -1785,10 +1785,10 @@ describe('App with `app.route`', () => {
1785
1785
  })
1786
1786
 
1787
1787
  describe('With app.get(...handler)', () => {
1788
- const app = new App()
1789
- const about = new App()
1788
+ const app = new Acryl()
1789
+ const about = new Acryl()
1790
1790
  about.get((c) => c.text('me'))
1791
- const subApp = new App()
1791
+ const subApp = new Acryl()
1792
1792
  subApp.route('/about', about)
1793
1793
  app.route('/', subApp)
1794
1794
 
@@ -1805,8 +1805,8 @@ describe('App with `app.route`', () => {
1805
1805
  })
1806
1806
 
1807
1807
  describe('With app.get(...handler) and app.basePath()', () => {
1808
- const app = new App()
1809
- const about = new App().basePath('/about')
1808
+ const app = new Acryl()
1809
+ const about = new Acryl().basePath('/about')
1810
1810
  about.get((c) => c.text('me'))
1811
1811
  app.route('/', about)
1812
1812
 
@@ -1824,8 +1824,8 @@ describe('App with `app.route`', () => {
1824
1824
  })
1825
1825
 
1826
1826
  describe('Chaining', () => {
1827
- const app = new App()
1828
- const route = new App()
1827
+ const app = new Acryl()
1828
+ const route = new Acryl()
1829
1829
  route.get('/post', (c) => c.text('GET /POST v2')).post((c) => c.text('POST /POST v2'))
1830
1830
  app.route('/v2', route)
1831
1831
 
@@ -1848,9 +1848,9 @@ describe('App with `app.route`', () => {
1848
1848
  })
1849
1849
 
1850
1850
  describe('Nested', () => {
1851
- const app = new App()
1852
- const api = new App()
1853
- const book = new App()
1851
+ const app = new Acryl()
1852
+ const api = new Acryl()
1853
+ const book = new Acryl()
1854
1854
 
1855
1855
  book.get('/', (c) => c.text('list books'))
1856
1856
  book.get('/:id', (c) => c.text(`book ${c.req.param('id')}`))
@@ -1887,8 +1887,8 @@ describe('App with `app.route`', () => {
1887
1887
  })
1888
1888
 
1889
1889
  describe('onError', () => {
1890
- const app = new App()
1891
- const sub = new App()
1890
+ const app = new Acryl()
1891
+ const sub = new Acryl()
1892
1892
 
1893
1893
  app.use('*', async (c, next) => {
1894
1894
  await next()
@@ -1941,8 +1941,8 @@ describe('App with `app.route`', () => {
1941
1941
  })
1942
1942
 
1943
1943
  describe('onError for a single handler', () => {
1944
- const app = new App()
1945
- const sub = new App()
1944
+ const app = new Acryl()
1945
+ const sub = new Acryl()
1946
1946
 
1947
1947
  sub.get('/ok', (c) => c.text('OK'))
1948
1948
 
@@ -1969,8 +1969,8 @@ describe('App with `app.route`', () => {
1969
1969
  })
1970
1970
 
1971
1971
  describe('notFound', () => {
1972
- const app = new App()
1973
- const sub = new App()
1972
+ const app = new Acryl()
1973
+ const sub = new Acryl()
1974
1974
 
1975
1975
  app.get('/explicit-404', async (c) => {
1976
1976
  c.header('explicit', '1')
@@ -2026,7 +2026,7 @@ describe('App with `app.route`', () => {
2026
2026
 
2027
2027
  describe('Using other methods with `app.on`', () => {
2028
2028
  it('Should handle PURGE method with RegExpRouter', async () => {
2029
- const app = new App({ router: new RegExpRouter() })
2029
+ const app = new Acryl({ router: new RegExpRouter() })
2030
2030
 
2031
2031
  app.on('PURGE', '/purge', (c) => c.text('Accepted', 202))
2032
2032
 
@@ -2039,7 +2039,7 @@ describe('Using other methods with `app.on`', () => {
2039
2039
  })
2040
2040
 
2041
2041
  it('Should handle PURGE method with TrieRouter', async () => {
2042
- const app = new App({ router: new TrieRouter() })
2042
+ const app = new Acryl({ router: new TrieRouter() })
2043
2043
 
2044
2044
  app.on('PURGE', '/purge', (c) => c.text('Accepted', 202))
2045
2045
 
@@ -2053,7 +2053,7 @@ describe('Using other methods with `app.on`', () => {
2053
2053
  })
2054
2054
 
2055
2055
  describe('Multiple methods with `app.on`', () => {
2056
- const app = new App()
2056
+ const app = new Acryl()
2057
2057
  app.on(['PUT', 'DELETE'], '/posts/:id', (c) => {
2058
2058
  return c.json({
2059
2059
  postId: c.req.param('id'),
@@ -2096,7 +2096,7 @@ describe('Multiple methods with `app.on`', () => {
2096
2096
 
2097
2097
  describe('Using QUERY with `app.query` and `app.on`', () => {
2098
2098
  it('Should handle QUERY method with app.query()', async () => {
2099
- const app = new App()
2099
+ const app = new Acryl()
2100
2100
 
2101
2101
  app.query('/query', (c) => c.text('Accepted', 202))
2102
2102
 
@@ -2109,7 +2109,7 @@ describe('Using QUERY with `app.query` and `app.on`', () => {
2109
2109
  })
2110
2110
 
2111
2111
  it('Should handle QUERY method with RegExpRouter', async () => {
2112
- const app = new App({ router: new RegExpRouter() })
2112
+ const app = new Acryl({ router: new RegExpRouter() })
2113
2113
 
2114
2114
  app.on('QUERY', '/query', (c) => c.text('Accepted', 202))
2115
2115
 
@@ -2122,7 +2122,7 @@ describe('Using QUERY with `app.query` and `app.on`', () => {
2122
2122
  })
2123
2123
 
2124
2124
  it('Should handle QUERY method with TrieRouter', async () => {
2125
- const app = new App({ router: new TrieRouter() })
2125
+ const app = new Acryl({ router: new TrieRouter() })
2126
2126
 
2127
2127
  app.on('QUERY', '/query', (c) => c.text('Accepted', 202))
2128
2128
 
@@ -2136,7 +2136,7 @@ describe('Using QUERY with `app.query` and `app.on`', () => {
2136
2136
  })
2137
2137
 
2138
2138
  describe('Multiple paths with one handler', () => {
2139
- const app = new App()
2139
+ const app = new Acryl()
2140
2140
 
2141
2141
  const paths = ['/hello', '/ja/hello', '/en/hello']
2142
2142
  app.on('GET', paths, (c) => {
@@ -2161,7 +2161,7 @@ describe('Multiple paths with one handler', () => {
2161
2161
 
2162
2162
  describe('Multiple handler', () => {
2163
2163
  describe('handler + handler', () => {
2164
- const app = new App()
2164
+ const app = new Acryl()
2165
2165
 
2166
2166
  app.get('/posts/:id', (c) => {
2167
2167
  const id = c.req.param('id')
@@ -2185,7 +2185,7 @@ describe('Multiple handler', () => {
2185
2185
 
2186
2186
  describe('Duplicate param name', () => {
2187
2187
  describe('basic', () => {
2188
- const app = new App()
2188
+ const app = new Acryl()
2189
2189
  app.get('/:type/:url', (c) => {
2190
2190
  return c.text(`type: ${c.req.param('type')}, url: ${c.req.param('url')}`)
2191
2191
  })
@@ -2206,7 +2206,7 @@ describe('Multiple handler', () => {
2206
2206
  })
2207
2207
 
2208
2208
  describe('self', () => {
2209
- const app = new App()
2209
+ const app = new Acryl()
2210
2210
  app.get('/:id/:id', (c) => {
2211
2211
  const id = c.req.param('id')
2212
2212
  return c.text(`id is ${id}`)
@@ -2220,13 +2220,13 @@ describe('Multiple handler', () => {
2220
2220
 
2221
2221
  describe('self with trailing static is stable across SmartRouter fallback', () => {
2222
2222
  it('Should return the first id whether or not an unrelated route is registered', async () => {
2223
- const a = new App()
2223
+ const a = new Acryl()
2224
2224
  a.get('/:id/:id/x', (c) => c.text(c.req.param('id')))
2225
2225
  const resA = await a.request('/123/456/x')
2226
2226
  expect(resA.status).toBe(200)
2227
2227
  expect(await resA.text()).toBe('123')
2228
2228
 
2229
- const b = new App()
2229
+ const b = new Acryl()
2230
2230
  b.get('/:id/:id/x', (c) => c.text(c.req.param('id')))
2231
2231
  b.get('/a', (c) => c.text('a'))
2232
2232
  const resB = await b.request('/123/456/x')
@@ -2237,7 +2237,7 @@ describe('Multiple handler', () => {
2237
2237
  })
2238
2238
 
2239
2239
  describe('hierarchy', () => {
2240
- const app = new App()
2240
+ const app = new Acryl()
2241
2241
  app.get('/posts/:id/comments/:comment_id', (c) => {
2242
2242
  return c.text(`post: ${c.req.param('id')}, comment: ${c.req.param('comment_id')}`)
2243
2243
  })
@@ -2257,7 +2257,7 @@ describe('Multiple handler', () => {
2257
2257
  })
2258
2258
 
2259
2259
  describe('different regular expression', () => {
2260
- const app = new App()
2260
+ const app = new Acryl()
2261
2261
  app.get('/:id/:action{create|update}', (c) => {
2262
2262
  return c.text(`id: ${c.req.param('id')}, action: ${c.req.param('action')}`)
2263
2263
  })
@@ -2286,7 +2286,7 @@ describe('Multiple handler', () => {
2286
2286
 
2287
2287
  describe('Multiple handler - async', () => {
2288
2288
  describe('handler + handler', () => {
2289
- const app = new App()
2289
+ const app = new Acryl()
2290
2290
  app.get('/posts/:id', async (c) => {
2291
2291
  await new Promise((resolve) => setTimeout(resolve, 1))
2292
2292
  c.header('foo2', 'bar2')
@@ -2311,7 +2311,7 @@ describe('Multiple handler - async', () => {
2311
2311
  })
2312
2312
 
2313
2313
  describe('Lack returning response with a single handler', () => {
2314
- const app = new App()
2314
+ const app = new Acryl()
2315
2315
  // @ts-expect-error it should return Response to type it
2316
2316
  app.get('/sync', () => {})
2317
2317
  app.get('/async', async () => {})
@@ -2329,7 +2329,7 @@ describe('Lack returning response with a single handler', () => {
2329
2329
 
2330
2330
  describe('Context is not finalized', () => {
2331
2331
  it('should throw error - lack `await next()`', async () => {
2332
- const app = new App()
2332
+ const app = new Acryl()
2333
2333
 
2334
2334
  // @ts-ignore
2335
2335
  app.use('*', () => {})
@@ -2345,7 +2345,7 @@ describe('Context is not finalized', () => {
2345
2345
  })
2346
2346
 
2347
2347
  it('should throw error - lack `returning Response`', async () => {
2348
- const app = new App()
2348
+ const app = new Acryl()
2349
2349
  app.use('*', async (_c, next) => {
2350
2350
  await next()
2351
2351
  })
@@ -2362,7 +2362,7 @@ describe('Context is not finalized', () => {
2362
2362
  })
2363
2363
 
2364
2364
  describe('Parse Body', () => {
2365
- const app = new App()
2365
+ const app = new Acryl()
2366
2366
 
2367
2367
  app.post('/json', async (c) => {
2368
2368
  return c.json<{}, 200>(await c.req.parseBody(), 200)
@@ -2416,7 +2416,7 @@ describe('Parse Body', () => {
2416
2416
 
2417
2417
  describe('Both two middleware returning response', () => {
2418
2418
  it('Should return correct Content-Type`', async () => {
2419
- const app = new App()
2419
+ const app = new Acryl()
2420
2420
  app.use('*', async (c, next) => {
2421
2421
  await next()
2422
2422
  return c.html('Foo')
@@ -2437,7 +2437,7 @@ describe('Count of logger called', () => {
2437
2437
  let count = 0
2438
2438
  let log = ''
2439
2439
 
2440
- const app = new App()
2440
+ const app = new Acryl()
2441
2441
 
2442
2442
  const logFn = (str: string) => {
2443
2443
  count++
@@ -2473,7 +2473,7 @@ describe('Context set/get variables', () => {
2473
2473
  title: string
2474
2474
  }
2475
2475
 
2476
- const app = new App<{ Variables: Variables }>()
2476
+ const app = new Acryl<{ Variables: Variables }>()
2477
2477
 
2478
2478
  it('Should set and get variables with correct types', async () => {
2479
2479
  app.use('*', async (c, next) => {
@@ -2502,7 +2502,7 @@ describe('Context binding variables', () => {
2502
2502
  USER_NAME: string
2503
2503
  }
2504
2504
 
2505
- const app = new App<{ Bindings: Bindings }>()
2505
+ const app = new Acryl<{ Bindings: Bindings }>()
2506
2506
 
2507
2507
  it('Should get binding variables with correct types', async () => {
2508
2508
  app.get('/', (c) => {
@@ -2515,7 +2515,7 @@ describe('Context binding variables', () => {
2515
2515
  })
2516
2516
 
2517
2517
  describe('Handler as variables', () => {
2518
- const app = new App()
2518
+ const app = new Acryl()
2519
2519
 
2520
2520
  it('Should be typed correctly', async () => {
2521
2521
  const handler: Handler = (c) => {
@@ -2531,7 +2531,7 @@ describe('Handler as variables', () => {
2531
2531
  })
2532
2532
 
2533
2533
  describe('json', () => {
2534
- const api = new App()
2534
+ const api = new Acryl()
2535
2535
 
2536
2536
  api.get('/message', (c) => {
2537
2537
  return c.json({
@@ -2546,7 +2546,7 @@ describe('json', () => {
2546
2546
  })
2547
2547
 
2548
2548
  describe('Single handler', () => {
2549
- const app = new App()
2549
+ const app = new Acryl()
2550
2550
  app.route('/api', api)
2551
2551
 
2552
2552
  it('Should return 200 response', async () => {
@@ -2567,7 +2567,7 @@ describe('json', () => {
2567
2567
  })
2568
2568
 
2569
2569
  describe('With middleware', () => {
2570
- const app = new App()
2570
+ const app = new Acryl()
2571
2571
  app.use('*', async (_c, next) => {
2572
2572
  await next()
2573
2573
  })
@@ -2592,7 +2592,7 @@ describe('json', () => {
2592
2592
  })
2593
2593
 
2594
2594
  describe('Optional parameters', () => {
2595
- const app = new App()
2595
+ const app = new Acryl()
2596
2596
  app.get('/api/:version/animal/:type?', (c) => {
2597
2597
  const type1 = c.req.param('type')
2598
2598
  expectTypeOf(type1).toEqualTypeOf<string | undefined>()
@@ -2622,7 +2622,7 @@ describe('Optional parameters', () => {
2622
2622
  })
2623
2623
 
2624
2624
  it('Should have a correct type with an optional parameter in a regexp path', async () => {
2625
- const app = new App()
2625
+ const app = new Acryl()
2626
2626
  app.get('/url/:url{.*}?', (c) => {
2627
2627
  const url = c.req.param('url')
2628
2628
  expectTypeOf(url).toEqualTypeOf<string | undefined>()
@@ -2669,12 +2669,12 @@ describe('app.mount()', () => {
2669
2669
  })
2670
2670
  }
2671
2671
 
2672
- const app = new App()
2672
+ const app = new Acryl()
2673
2673
  app.use('*', async (c, next) => {
2674
2674
  await next()
2675
2675
  c.header('x-message', 'Foo')
2676
2676
  })
2677
- app.get('/', (c) => c.text('App'))
2677
+ app.get('/', (c) => c.text('Acryl'))
2678
2678
  app.notFound((c) => {
2679
2679
  return c.text('Not Found from App', 404)
2680
2680
  })
@@ -2687,14 +2687,14 @@ describe('app.mount()', () => {
2687
2687
  })
2688
2688
  app.mount('/another-app2/sub-slash/', anotherApp)
2689
2689
 
2690
- const api = new App().basePath('/api')
2690
+ const api = new Acryl().basePath('/api')
2691
2691
  api.mount('/another-app', anotherApp)
2692
2692
 
2693
- it('Should return responses from App app', async () => {
2693
+ it('Should return responses from Acryl app', async () => {
2694
2694
  const res = await app.request('/')
2695
2695
  expect(res.status).toBe(200)
2696
2696
  expect(res.headers.get('x-message')).toBe('Foo')
2697
- expect(await res.text()).toBe('App')
2697
+ expect(await res.text()).toBe('Acryl')
2698
2698
  })
2699
2699
 
2700
2700
  it('Should return responses from AnotherApp', async () => {
@@ -2763,7 +2763,7 @@ describe('app.mount()', () => {
2763
2763
  const anotherApp = (req: Request) => new Response(getPath(req))
2764
2764
 
2765
2765
  it('Should strip a decoded non-ASCII mount prefix', async () => {
2766
- const app = new App()
2766
+ const app = new Acryl()
2767
2767
  app.mount('/api/é', anotherApp)
2768
2768
 
2769
2769
  const res = await app.request('/api/%C3%A9/hello')
@@ -2773,7 +2773,7 @@ describe('app.mount()', () => {
2773
2773
  })
2774
2774
 
2775
2775
  it('Should preserve an encoded slash as a literal path segment after stripping the prefix', async () => {
2776
- const app = new App()
2776
+ const app = new Acryl()
2777
2777
  app.mount('/api/v1', anotherApp)
2778
2778
 
2779
2779
  const res = await app.request('/api/v1/admin%2Fsecret')
@@ -2783,7 +2783,7 @@ describe('app.mount()', () => {
2783
2783
  })
2784
2784
 
2785
2785
  it('Should preserve encoded percent characters after stripping the prefix', async () => {
2786
- const app = new App()
2786
+ const app = new Acryl()
2787
2787
  app.mount('/api', anotherApp)
2788
2788
 
2789
2789
  const res = await app.request('/api/foo%252Fbar')
@@ -2814,7 +2814,7 @@ describe('app.mount()', () => {
2814
2814
  })
2815
2815
  }
2816
2816
 
2817
- const app = new App()
2817
+ const app = new Acryl()
2818
2818
  app.mount('/another-app', anotherApp)
2819
2819
 
2820
2820
  it('Should handle Env and ExecuteContext', async () => {
@@ -2864,7 +2864,7 @@ describe('app.mount()', () => {
2864
2864
  })
2865
2865
  }
2866
2866
 
2867
- const app = new App()
2867
+ const app = new Acryl()
2868
2868
  app.mount('/', anotherApp)
2869
2869
 
2870
2870
  it('Should return responses from AnotherApp - mount on `/`', async () => {
@@ -2892,7 +2892,7 @@ describe('app.mount()', () => {
2892
2892
  return new Response(null, { status: 404 })
2893
2893
  }
2894
2894
 
2895
- const app = new App()
2895
+ const app = new Acryl()
2896
2896
  app.mount('/app', anotherApp, {
2897
2897
  replaceRequest: (req) => req,
2898
2898
  })
@@ -2913,7 +2913,7 @@ describe('app.mount()', () => {
2913
2913
  return new Response(null, { status: 404 })
2914
2914
  }
2915
2915
 
2916
- const app = new App()
2916
+ const app = new Acryl()
2917
2917
  app.mount('/app', anotherApp, { replaceRequest: false })
2918
2918
 
2919
2919
  it('Should return 200 response with the correct path', async () => {
@@ -2925,7 +2925,7 @@ describe('app.mount()', () => {
2925
2925
  })
2926
2926
 
2927
2927
  describe('HEAD method', () => {
2928
- const app = new App()
2928
+ const app = new Acryl()
2929
2929
 
2930
2930
  app.get('/page', (c) => {
2931
2931
  c.header('X-Message', 'Foo')
@@ -2961,7 +2961,7 @@ declare module './context.ts' {
2961
2961
 
2962
2962
  describe('app.request()', () => {
2963
2963
  it('Should return response with Request and RequestInit as args', async () => {
2964
- const app = new App()
2964
+ const app = new Acryl()
2965
2965
  app.get('/foo', (c) => {
2966
2966
  return c.json(c.req.header('x-message'))
2967
2967
  })
@@ -2978,7 +2978,7 @@ describe('app.request()', () => {
2978
2978
 
2979
2979
  describe('app.fire()', () => {
2980
2980
  it('Should call global.addEventListener', () => {
2981
- const app = new App()
2981
+ const app = new Acryl()
2982
2982
  const addEventListener = vi.fn()
2983
2983
  global.addEventListener = addEventListener
2984
2984
  app.fire()
@@ -2993,7 +2993,7 @@ describe('app.fire()', () => {
2993
2993
  })
2994
2994
 
2995
2995
  describe('Context render and setRenderer', () => {
2996
- const app = new App()
2996
+ const app = new Acryl()
2997
2997
  app.get('/default', (c) => {
2998
2998
  return c.render('<h1>content</h1>', { title: 'dummy ' })
2999
2999
  })
@@ -3025,7 +3025,7 @@ describe('Context render and setRenderer', () => {
3025
3025
  })
3026
3026
 
3027
3027
  describe('c.var - with testing types', () => {
3028
- const app = new App<{
3028
+ const app = new Acryl<{
3029
3029
  Bindings: {
3030
3030
  Token: string
3031
3031
  }
@@ -3670,7 +3670,7 @@ describe('c.var - with testing types', () => {
3670
3670
  })
3671
3671
 
3672
3672
  it('Should not throw type errors', () => {
3673
- const app = new App<{
3673
+ const app = new Acryl<{
3674
3674
  Variables: {
3675
3675
  hello: () => string
3676
3676
  }
@@ -3700,7 +3700,7 @@ describe('c.var - with testing types', () => {
3700
3700
  })
3701
3701
 
3702
3702
  it('Should not throw a type error', (c) => {
3703
- const app = new App<{
3703
+ const app = new Acryl<{
3704
3704
  Bindings: {
3705
3705
  TOKEN: string
3706
3706
  }
@@ -3735,21 +3735,21 @@ describe('c.var - with testing types', () => {
3735
3735
  })
3736
3736
  })
3737
3737
 
3738
- describe('Compatible with extended App classes, such Zod OpenAPI App.', () => {
3739
- class ExtendedApp extends App {
3738
+ describe('Compatible with extended Acryl classes, such Zod OpenAPI Acryl.', () => {
3739
+ class ExtendedAcryl extends Acryl {
3740
3740
  // @ts-ignore
3741
- route(path: string, app?: App) {
3741
+ route(path: string, app?: Acryl) {
3742
3742
  // @ts-ignore
3743
3743
  super.route(path, app)
3744
3744
  return this
3745
3745
  }
3746
3746
  // @ts-ignore
3747
3747
  basePath(path: string) {
3748
- return new ExtendedApp(super.basePath(path))
3748
+ return new ExtendedAcryl(super.basePath(path))
3749
3749
  }
3750
3750
  }
3751
- const a = new ExtendedApp()
3752
- const sub = new App()
3751
+ const a = new ExtendedAcryl()
3752
+ const sub = new Acryl()
3753
3753
  sub.get('/foo', (c) => c.text('foo'))
3754
3754
  a.route('/sub', sub)
3755
3755
 
@@ -3766,11 +3766,11 @@ describe('Generics for Bindings and Variables', () => {
3766
3766
 
3767
3767
  it('Should not throw type errors', () => {
3768
3768
  // @ts-expect-error Bindings should extend object
3769
- new App<{
3769
+ new Acryl<{
3770
3770
  Bindings: number
3771
3771
  }>()
3772
3772
 
3773
- const appWithInterface = new App<{
3773
+ const appWithInterface = new Acryl<{
3774
3774
  Bindings: CloudflareBindings
3775
3775
  }>()
3776
3776
 
@@ -3779,7 +3779,7 @@ describe('Generics for Bindings and Variables', () => {
3779
3779
  return c.text('/')
3780
3780
  })
3781
3781
 
3782
- const appWithType = new App<{
3782
+ const appWithType = new Acryl<{
3783
3783
  Bindings: {
3784
3784
  foo: string
3785
3785
  }
@@ -3787,13 +3787,13 @@ describe('Generics for Bindings and Variables', () => {
3787
3787
 
3788
3788
  appWithType.get('/', (c) => {
3789
3789
  expectTypeOf(c.env.foo).toMatchTypeOf<string>()
3790
- return c.text('Hello App!')
3790
+ return c.text('Hello Acryl!')
3791
3791
  })
3792
3792
  })
3793
3793
  })
3794
3794
 
3795
3795
  describe('app.basePath() with the internal #clone()', () => {
3796
- const app = new App()
3796
+ const app = new Acryl()
3797
3797
  .notFound((c) => {
3798
3798
  return c.text('Custom not found', 404)
3799
3799
  })
@@ -3820,7 +3820,7 @@ describe('app.basePath() with the internal #clone()', () => {
3820
3820
 
3821
3821
  describe('Catch-all route with empty segment', () => {
3822
3822
  it('Should return empty string for empty catch-all param', async () => {
3823
- const app = new App()
3823
+ const app = new Acryl()
3824
3824
  app.get('/:remaining{.*}', (c) => {
3825
3825
  const remaining = c.req.param('remaining')
3826
3826
  return c.json({ type: typeof remaining, value: remaining })