@acryldev/blends 0.0.0-stage → 1.7.1

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 (524) hide show
  1. package/LICENSE +73 -0
  2. package/README.md +424 -2
  3. package/bin/acrylblends.js +12 -0
  4. package/dist/index.d.ts +231 -0
  5. package/dist/index.js +4505 -0
  6. package/dist/index.js.map +1 -0
  7. package/lib/accept-B13wFRkc.js +193 -0
  8. package/lib/accepts-BN4uue4T.js +52 -0
  9. package/lib/accepts.d.ts +33 -0
  10. package/lib/accepts.js +2 -0
  11. package/lib/acryl-base.d.ts +2 -0
  12. package/lib/acryl-base.js +2 -0
  13. package/lib/adapter-Wt9Ntyhx.js +37 -0
  14. package/lib/adapter.d.ts +12 -0
  15. package/lib/adapter.js +2 -0
  16. package/lib/app-CM-rDcw6.js +26 -0
  17. package/lib/app-DGqSNBSd.d.ts +21 -0
  18. package/lib/app-base-BwplqlWX.js +332 -0
  19. package/lib/audit-B2H3sUfg.d.ts +136 -0
  20. package/lib/base-N-QVQhMZ.d.ts +783 -0
  21. package/lib/base-kl8P-za0.js +722 -0
  22. package/lib/basic-auth-ByZGvWGz.js +95 -0
  23. package/lib/basic-auth-CzulvSad.js +20 -0
  24. package/lib/basic-auth.d.ts +72 -0
  25. package/lib/basic-auth.js +2 -0
  26. package/lib/bearer-auth-CfR6YNqy.js +94 -0
  27. package/lib/bearer-auth.d.ts +89 -0
  28. package/lib/bearer-auth.js +2 -0
  29. package/lib/body-BQ-J23GI.js +94 -0
  30. package/lib/body-limit-DyO82Wes.js +66 -0
  31. package/lib/body-limit.d.ts +42 -0
  32. package/lib/body-limit.js +2 -0
  33. package/lib/browser/client.js +307 -0
  34. package/lib/browser/jsx-dom.js +1432 -0
  35. package/lib/browser/read-sse.js +84 -0
  36. package/lib/buffer-CWpxJrvI.js +51 -0
  37. package/lib/bun.d.ts +75 -0
  38. package/lib/bun.js +134 -0
  39. package/lib/cache-DllEV7kz.js +169 -0
  40. package/lib/cache.d.ts +43 -0
  41. package/lib/cache.js +2 -0
  42. package/lib/cell-wEBQA3d0.d.ts +32 -0
  43. package/lib/client-BMFCUlHG.js +143 -0
  44. package/lib/client-modules-ChLgW0l9.js +267 -0
  45. package/lib/client.d.ts +3 -0
  46. package/lib/client.js +3 -0
  47. package/lib/color-C26GR4OI.js +37 -0
  48. package/lib/combine-rXRCRMJx.js +137 -0
  49. package/lib/combine.d.ts +85 -0
  50. package/lib/combine.js +2 -0
  51. package/lib/common-CaqP5LIh.d.ts +46 -0
  52. package/lib/components-BZ8vBk_7.js +268 -0
  53. package/lib/components-Cq4hcRbo.js +24 -0
  54. package/lib/compose-DbuvN1rE.js +50 -0
  55. package/lib/compress-C7QjZM5f.js +11 -0
  56. package/lib/compress-CdDuP9-S.d.ts +11 -0
  57. package/lib/compress-T36YxGla.js +79 -0
  58. package/lib/compress.d.ts +38 -0
  59. package/lib/compress.js +3 -0
  60. package/lib/concurrent-B7z-2cwF.js +30 -0
  61. package/lib/connection-CzRPq1RP.d.ts +25 -0
  62. package/lib/connection-DLPx5pxD.js +24 -0
  63. package/lib/conninfo-BbxlV2HK.d.ts +11 -0
  64. package/lib/conninfo-CNYXEtnA.js +19 -0
  65. package/lib/conninfo.d.ts +3 -0
  66. package/lib/conninfo.js +2 -0
  67. package/lib/constants-D914mQY7.js +7 -0
  68. package/lib/constants-nJj4XhwC.js +4 -0
  69. package/lib/constants-vv1oZD_p.js +9 -0
  70. package/lib/context-BVI2RzT7.js +365 -0
  71. package/lib/context-Ca3uX_bh.d.ts +1234 -0
  72. package/lib/context-Dre4P1UW.d.ts +250 -0
  73. package/lib/context-storage-ClUlVtCZ.js +52 -0
  74. package/lib/context-storage.d.ts +38 -0
  75. package/lib/context-storage.js +2 -0
  76. package/lib/cookie-BqeGZ43j.d.ts +40 -0
  77. package/lib/cookie-DktnJ0tJ.js +82 -0
  78. package/lib/cookie-uMH6wAF3.js +125 -0
  79. package/lib/cookie.d.ts +24 -0
  80. package/lib/cookie.js +2 -0
  81. package/lib/cordis/db-sqlite.d.ts +56 -0
  82. package/lib/cordis/db-sqlite.js +66 -0
  83. package/lib/cordis/db.d.ts +8 -0
  84. package/lib/cordis/db.js +1 -0
  85. package/lib/cordis/door.d.ts +404 -0
  86. package/lib/cordis/door.js +1812 -0
  87. package/lib/cordis/inspect.d.ts +77 -0
  88. package/lib/cordis/inspect.js +149 -0
  89. package/lib/cordis/kv-db.d.ts +16 -0
  90. package/lib/cordis/kv-db.js +18 -0
  91. package/lib/cordis/kv-json.d.ts +16 -0
  92. package/lib/cordis/kv-json.js +52 -0
  93. package/lib/cordis/kv.d.ts +8 -0
  94. package/lib/cordis/kv.js +1 -0
  95. package/lib/cordis/node-server.d.ts +155 -0
  96. package/lib/cordis/node-server.js +4 -0
  97. package/lib/cordis/router-http.d.ts +85 -0
  98. package/lib/cordis/router-http.js +206 -0
  99. package/lib/cordis/router.d.ts +7 -0
  100. package/lib/cordis/router.js +6 -0
  101. package/lib/cordis/state/react.d.ts +6 -0
  102. package/lib/cordis/state/react.js +11 -0
  103. package/lib/cordis/state.d.ts +34 -0
  104. package/lib/cordis/state.js +527 -0
  105. package/lib/core-4oDBzv4Q.js +19 -0
  106. package/lib/cors-C0qqZ-O-.js +106 -0
  107. package/lib/cors.d.ts +52 -0
  108. package/lib/cors.js +2 -0
  109. package/lib/crypto-ciSjk9n3.js +34 -0
  110. package/lib/csrf-rMr2nM2c.js +101 -0
  111. package/lib/csrf.d.ts +75 -0
  112. package/lib/csrf.js +2 -0
  113. package/lib/css-Bd6tj88A.js +320 -0
  114. package/lib/css-CLgKjBuO.js +134 -0
  115. package/lib/css.d.ts +82 -0
  116. package/lib/css.js +3 -0
  117. package/lib/database-CyKvumAn.d.ts +44 -0
  118. package/lib/db/conformance.d.ts +15 -0
  119. package/lib/db/conformance.js +279 -0
  120. package/lib/db/sqlite.d.ts +3 -0
  121. package/lib/db/sqlite.js +2 -0
  122. package/lib/db.d.ts +3 -0
  123. package/lib/db.js +2 -0
  124. package/lib/dev-h25puJmg.js +50 -0
  125. package/lib/dev.d.ts +19 -0
  126. package/lib/dev.js +2 -0
  127. package/lib/dom-MsnhZjjn.js +74 -0
  128. package/lib/door/host.d.ts +24 -0
  129. package/lib/door/host.js +2 -0
  130. package/lib/door/page.d.ts +160 -0
  131. package/lib/door/page.js +1257 -0
  132. package/lib/door/protocol.d.ts +2 -0
  133. package/lib/door/protocol.js +2 -0
  134. package/lib/drivers.d.ts +77 -0
  135. package/lib/drivers.js +16 -0
  136. package/lib/encode-BbgU91Gc.js +33 -0
  137. package/lib/etag-DevxEjyU.js +135 -0
  138. package/lib/etag.d.ts +40 -0
  139. package/lib/etag.js +2 -0
  140. package/lib/factory-d6WBwm2j.js +30 -0
  141. package/lib/factory.d.ts +35 -0
  142. package/lib/factory.js +2 -0
  143. package/lib/handler-DXCHa3NV.js +12 -0
  144. package/lib/headers-DbujLUIi.d.ts +11 -0
  145. package/lib/helpers-qmReU164.js +5 -0
  146. package/lib/hooks-Bs7lFRjW.js +762 -0
  147. package/lib/html-1jTa7KN1.js +103 -0
  148. package/lib/html-CNr9FLdV.d.ts +46 -0
  149. package/lib/html-CoWdxS1u.js +31 -0
  150. package/lib/html.d.ts +3 -0
  151. package/lib/html.js +3 -0
  152. package/lib/http-exception-BKMYq4x6.js +54 -0
  153. package/lib/http-exception-Cm8QD9Fl.d.ts +57 -0
  154. package/lib/http-exception.d.ts +2 -0
  155. package/lib/http-exception.js +2 -0
  156. package/lib/http-status-uBFmbzzM.d.ts +35 -0
  157. package/lib/index-B_g6ECnm.d.ts +57 -0
  158. package/lib/index-BaOiJMWK.d.ts +31 -0
  159. package/lib/index-C5RhEyXO.d.ts +45 -0
  160. package/lib/index-C8xOqNUW.d.ts +71 -0
  161. package/lib/index-D1HlwHSL.d.ts +129 -0
  162. package/lib/index-DUYLk7OD.d.ts +44 -0
  163. package/lib/index-DYBSr8yW.d.ts +156 -0
  164. package/lib/index-Dv4qFsro.d.ts +94 -0
  165. package/lib/index-jdWVs88B.d.ts +6 -0
  166. package/lib/index.d.ts +4 -0
  167. package/lib/index.js +4 -0
  168. package/lib/ip-restriction-C4TZKPKl.js +166 -0
  169. package/lib/ip-restriction.d.ts +68 -0
  170. package/lib/ip-restriction.js +2 -0
  171. package/lib/ipaddr-CTeN6kNw.js +238 -0
  172. package/lib/jsx/dom/client.d.ts +30 -0
  173. package/lib/jsx/dom/client.js +49 -0
  174. package/lib/jsx/dom/css.d.ts +84 -0
  175. package/lib/jsx/dom/css.js +2 -0
  176. package/lib/jsx/dom/jsx-dev-runtime.d.ts +3 -0
  177. package/lib/jsx/dom/jsx-dev-runtime.js +2 -0
  178. package/lib/jsx/dom/jsx-runtime.d.ts +3 -0
  179. package/lib/jsx/dom/jsx-runtime.js +3 -0
  180. package/lib/jsx/dom/server.d.ts +105 -0
  181. package/lib/jsx/dom/server.js +37 -0
  182. package/lib/jsx/dom.d.ts +5 -0
  183. package/lib/jsx/dom.js +6 -0
  184. package/lib/jsx/jsx-dev-runtime.d.ts +3 -0
  185. package/lib/jsx/jsx-dev-runtime.js +3 -0
  186. package/lib/jsx/jsx-runtime.d.ts +10 -0
  187. package/lib/jsx/jsx-runtime.js +30 -0
  188. package/lib/jsx/streaming.d.ts +2 -0
  189. package/lib/jsx/streaming.js +2 -0
  190. package/lib/jsx-C5-YJG0l.js +47 -0
  191. package/lib/jsx-dev-runtime-CPsrmbgy.d.ts +7 -0
  192. package/lib/jsx-dev-runtime-Cs-uV30u.js +14 -0
  193. package/lib/jsx-dev-runtime-DK4z4RD3.js +354 -0
  194. package/lib/jsx-dev-runtime-DSQ8vSCY.d.ts +6 -0
  195. package/lib/jsx-renderer-B2wHa9Y8.js +99 -0
  196. package/lib/jsx-renderer.d.ts +75 -0
  197. package/lib/jsx-renderer.js +2 -0
  198. package/lib/jsx-runtime-BVVgDSdq.d.ts +1 -0
  199. package/lib/jsx-runtime-brX0UliB.js +2 -0
  200. package/lib/jsx.d.ts +3 -0
  201. package/lib/jsx.js +6 -0
  202. package/lib/jwk-BbiXIYhg.js +117 -0
  203. package/lib/jwk.d.ts +52 -0
  204. package/lib/jwk.js +2 -0
  205. package/lib/jwt-BCS5hH1O.d.ts +51 -0
  206. package/lib/jwt-Culfq-8m.js +403 -0
  207. package/lib/jwt-DaOoWaF3.js +115 -0
  208. package/lib/jwt.d.ts +72 -0
  209. package/lib/jwt.js +3 -0
  210. package/lib/kv/conformance.d.ts +17 -0
  211. package/lib/kv/conformance.js +313 -0
  212. package/lib/kv/db.d.ts +3 -0
  213. package/lib/kv/db.js +2 -0
  214. package/lib/kv/json.d.ts +3 -0
  215. package/lib/kv/json.js +2 -0
  216. package/lib/kv-Kv6J9zqu.d.ts +39 -0
  217. package/lib/kv.d.ts +3 -0
  218. package/lib/kv.js +2 -0
  219. package/lib/language-anRiLd9a.js +198 -0
  220. package/lib/language.d.ts +88 -0
  221. package/lib/language.js +2 -0
  222. package/lib/linear-router-BUrYQxcv.js +96 -0
  223. package/lib/logger-CLvaB463.js +54 -0
  224. package/lib/logger.d.ts +22 -0
  225. package/lib/logger.js +2 -0
  226. package/lib/loopback-only-0nTL30Zt.js +131 -0
  227. package/lib/loopback-only.d.ts +73 -0
  228. package/lib/loopback-only.js +2 -0
  229. package/lib/method-not-allowed-B3nMAp1f.js +82 -0
  230. package/lib/method-not-allowed.d.ts +47 -0
  231. package/lib/method-not-allowed.js +2 -0
  232. package/lib/method-override-Dhd_EJD9.js +103 -0
  233. package/lib/method-override.d.ts +46 -0
  234. package/lib/method-override.js +2 -0
  235. package/lib/middleware-B8gJUDgl.js +12 -0
  236. package/lib/mime-B9GbsqnN.d.ts +72 -0
  237. package/lib/mime-C-r9WxjH.js +77 -0
  238. package/lib/mount-RGiNYj2l.js +67 -0
  239. package/lib/mount.d.ts +44 -0
  240. package/lib/mount.js +2 -0
  241. package/lib/node-server/conninfo.d.ts +2 -0
  242. package/lib/node-server/conninfo.js +2 -0
  243. package/lib/node-server/register.d.ts +1 -0
  244. package/lib/node-server/register.js +59 -0
  245. package/lib/node-server/serve-static.d.ts +2 -0
  246. package/lib/node-server/serve-static.js +2 -0
  247. package/lib/node-server.d.ts +134 -0
  248. package/lib/node-server.js +5 -0
  249. package/lib/open-BC_BGIQt.d.ts +12 -0
  250. package/lib/open-BpnCtiKf.js +224 -0
  251. package/lib/open-CEE2hyrs.d.ts +11 -0
  252. package/lib/open-CwA_ZiPl.js +57 -0
  253. package/lib/open-DFt0lT26.js +197 -0
  254. package/lib/open-DXxlFxS0.d.ts +27 -0
  255. package/lib/pattern-router-DlkDNR9e.js +41 -0
  256. package/lib/powered-by-B9ufDvKH.js +24 -0
  257. package/lib/powered-by.d.ts +28 -0
  258. package/lib/powered-by.js +2 -0
  259. package/lib/pretty-json-B_5MzYgk.js +39 -0
  260. package/lib/pretty-json.d.ts +40 -0
  261. package/lib/pretty-json.js +2 -0
  262. package/lib/protocol-8HjYa5OX.js +217 -0
  263. package/lib/protocol-DdQgl224.d.ts +160 -0
  264. package/lib/proxy-C02n8qaX.js +121 -0
  265. package/lib/proxy.d.ts +72 -0
  266. package/lib/proxy.js +2 -0
  267. package/lib/quick.d.ts +8 -0
  268. package/lib/quick.js +17 -0
  269. package/lib/read-sse.d.ts +33 -0
  270. package/lib/read-sse.js +84 -0
  271. package/lib/reg-exp-router-DT_H6W_j.js +363 -0
  272. package/lib/request-PoZjfrb4.js +323 -0
  273. package/lib/request-id-CWyCgzyD.js +34 -0
  274. package/lib/request-id.d.ts +45 -0
  275. package/lib/request-id.js +2 -0
  276. package/lib/request.d.ts +2 -0
  277. package/lib/request.js +2 -0
  278. package/lib/route-D1WQ4cOh.js +126 -0
  279. package/lib/route.d.ts +78 -0
  280. package/lib/route.js +2 -0
  281. package/lib/router/linear-router.d.ts +11 -0
  282. package/lib/router/linear-router.js +2 -0
  283. package/lib/router/pattern-router.d.ts +11 -0
  284. package/lib/router/pattern-router.js +2 -0
  285. package/lib/router/reg-exp-router.d.ts +35 -0
  286. package/lib/router/reg-exp-router.js +2 -0
  287. package/lib/router/smart-router.d.ts +15 -0
  288. package/lib/router/smart-router.js +2 -0
  289. package/lib/router/trie-router.d.ts +11 -0
  290. package/lib/router/trie-router.js +2 -0
  291. package/lib/router-0TlTAMdt.d.ts +99 -0
  292. package/lib/router-wWGf3FlK.js +35 -0
  293. package/lib/router.d.ts +2 -0
  294. package/lib/router.js +2 -0
  295. package/lib/schema-validator-DGAFbTcN.js +22 -0
  296. package/lib/schema-validator.d.ts +54 -0
  297. package/lib/schema-validator.js +2 -0
  298. package/lib/secure-headers-eLrZcjSr.js +163 -0
  299. package/lib/secure-headers.d.ts +125 -0
  300. package/lib/secure-headers.js +2 -0
  301. package/lib/serve-static-D97E4ERX.d.ts +18 -0
  302. package/lib/serve-static-YoUetEZ8.js +212 -0
  303. package/lib/serve-static-cnLZvaYu.js +77 -0
  304. package/lib/serve-static.d.ts +2 -0
  305. package/lib/serve-static.js +2 -0
  306. package/lib/smart-router-BF56Yf23.js +49 -0
  307. package/lib/snapshot-text-Cyl69OKv.js +597 -0
  308. package/lib/src-6T1gCSq3.js +427 -0
  309. package/lib/src-BycZ1HUQ.js +407 -0
  310. package/lib/src-CZ1JoBaO.js +90 -0
  311. package/lib/src-C_00jcuj.js +85 -0
  312. package/lib/ssg-D_StqyTO.js +389 -0
  313. package/lib/ssg.d.ts +2 -0
  314. package/lib/ssg.js +2 -0
  315. package/lib/stream-CJ_0BMG2.js +88 -0
  316. package/lib/stream-Oxo9JHC6.d.ts +34 -0
  317. package/lib/streaming-CL2i3hX_.js +96 -0
  318. package/lib/streaming.d.ts +23 -0
  319. package/lib/streaming.js +2 -0
  320. package/lib/testing-DnLmBGle.js +17 -0
  321. package/lib/testing.d.ts +10 -0
  322. package/lib/testing.js +2 -0
  323. package/lib/timeout-Bib1sxFc.js +42 -0
  324. package/lib/timeout.d.ts +30 -0
  325. package/lib/timeout.js +2 -0
  326. package/lib/timing-CkkBmV23.js +183 -0
  327. package/lib/timing.d.ts +130 -0
  328. package/lib/timing.js +2 -0
  329. package/lib/tiny.d.ts +8 -0
  330. package/lib/tiny.js +15 -0
  331. package/lib/trailing-slash-qJLAJrAH.js +85 -0
  332. package/lib/trailing-slash.d.ts +91 -0
  333. package/lib/trailing-slash.js +2 -0
  334. package/lib/transpile-Bc6rZPK-.js +105 -0
  335. package/lib/trie-router-DhF3wn5_.js +146 -0
  336. package/lib/types-Zy1OzMX7.d.ts +29 -0
  337. package/lib/types-akvg9vbH.d.ts +40 -0
  338. package/lib/types-cu7acft5.d.ts +195 -0
  339. package/lib/types-nO2Jov17.d.ts +114 -0
  340. package/lib/types.d.ts +2 -0
  341. package/lib/types.js +4 -0
  342. package/lib/upgrade-hub-7og-sHcQ.d.ts +138 -0
  343. package/lib/upgrade-hub-B4hca91Y.js +1554 -0
  344. package/lib/url-Cyyh7Fiw.js +197 -0
  345. package/lib/utils/accept.d.ts +9 -0
  346. package/lib/utils/accept.js +2 -0
  347. package/lib/utils/basic-auth.d.ts +8 -0
  348. package/lib/utils/basic-auth.js +2 -0
  349. package/lib/utils/body.d.ts +2 -0
  350. package/lib/utils/body.js +2 -0
  351. package/lib/utils/buffer.d.ts +19 -0
  352. package/lib/utils/buffer.js +2 -0
  353. package/lib/utils/color.d.ts +24 -0
  354. package/lib/utils/color.js +2 -0
  355. package/lib/utils/compress.d.ts +2 -0
  356. package/lib/utils/compress.js +2 -0
  357. package/lib/utils/concurrent.d.ts +17 -0
  358. package/lib/utils/concurrent.js +2 -0
  359. package/lib/utils/constants.d.ts +7 -0
  360. package/lib/utils/constants.js +2 -0
  361. package/lib/utils/cookie.d.ts +2 -0
  362. package/lib/utils/cookie.js +2 -0
  363. package/lib/utils/crypto.d.ts +14 -0
  364. package/lib/utils/crypto.js +2 -0
  365. package/lib/utils/encode.d.ts +11 -0
  366. package/lib/utils/encode.js +2 -0
  367. package/lib/utils/filepath.d.ts +14 -0
  368. package/lib/utils/filepath.js +25 -0
  369. package/lib/utils/handler.d.ts +9 -0
  370. package/lib/utils/handler.js +2 -0
  371. package/lib/utils/headers.d.ts +2 -0
  372. package/lib/utils/headers.js +1 -0
  373. package/lib/utils/html.d.ts +2 -0
  374. package/lib/utils/html.js +2 -0
  375. package/lib/utils/http-status.d.ts +2 -0
  376. package/lib/utils/http-status.js +1 -0
  377. package/lib/utils/ipaddr.d.ts +56 -0
  378. package/lib/utils/ipaddr.js +2 -0
  379. package/lib/utils/jwt.d.ts +24 -0
  380. package/lib/utils/jwt.js +2 -0
  381. package/lib/utils/mime.d.ts +2 -0
  382. package/lib/utils/mime.js +2 -0
  383. package/lib/utils/stream.d.ts +2 -0
  384. package/lib/utils/stream.js +2 -0
  385. package/lib/utils/types.d.ts +2 -0
  386. package/lib/utils/types.js +1 -0
  387. package/lib/utils/url.d.ts +46 -0
  388. package/lib/utils/url.js +2 -0
  389. package/lib/utils-CYdUlhw1.js +125 -0
  390. package/lib/utils-CnUrxRO-.js +4 -0
  391. package/lib/validator-DkpCsiJC.js +65 -0
  392. package/lib/validator.d.ts +42 -0
  393. package/lib/validator.js +2 -0
  394. package/lib/vitest-binding-CctNu3jT.d.ts +15 -0
  395. package/lib/vitest-binding-CrH7rKg2.js +17 -0
  396. package/lib/websocket-Cy4jtqHv.js +56 -0
  397. package/lib/ws.d.ts +2 -0
  398. package/lib/ws.js +2 -0
  399. package/package.json +463 -3
  400. package/shared/AGENTS.core.md +84 -0
  401. package/shared/DEFAULTS.md +49 -0
  402. package/shared/library-history-versions.json +48 -0
  403. package/shared/library-history.json +786 -0
  404. package/shared/skills/acryl-add-ui/SKILL.md +19 -0
  405. package/shared/skills/acryl-app/SKILL.md +13 -0
  406. package/shared/skills/acryl-build-plugin/SKILL.md +22 -0
  407. package/shared/skills/acryl-change-plugin/SKILL.md +14 -0
  408. package/shared/skills/acryl-diagnose-plugin/SKILL.md +13 -0
  409. package/shared/skills/acryl-fix-plugin/SKILL.md +13 -0
  410. package/shared/skills/acryl-remove-plugin/SKILL.md +12 -0
  411. package/shared/skills/acryl-share-plugin/SKILL.md +16 -0
  412. package/shared/skills/cordis-plugin/SKILL.md +26 -0
  413. package/templates/agent/.gitattributes +2 -0
  414. package/templates/agent/AGENTS.md +20 -0
  415. package/templates/agent/Dockerfile +15 -0
  416. package/templates/agent/README.md +52 -0
  417. package/templates/agent/blend.yaml +71 -0
  418. package/templates/agent/dockerignore +3 -0
  419. package/templates/agent/gitignore +6 -0
  420. package/templates/agent/package.json +31 -0
  421. package/templates/agent/src/app.ts +293 -0
  422. package/templates/agent/src/frame.ts +17 -0
  423. package/templates/agent/src/main.ts +27 -0
  424. package/templates/agent/src/routes.ts +163 -0
  425. package/templates/agent/template.json +22 -0
  426. package/templates/agent/test/agent.test.ts +51 -0
  427. package/templates/agent/test/app.test.ts +270 -0
  428. package/templates/agent/test/builder.test.ts +210 -0
  429. package/templates/agent/test/model.test.ts +94 -0
  430. package/templates/agent/tsconfig.json +68 -0
  431. package/templates/blank/.gitattributes +2 -0
  432. package/templates/blank/AGENTS.md +6 -0
  433. package/templates/blank/README.md +26 -0
  434. package/templates/blank/blend.yaml +37 -0
  435. package/templates/blank/gitignore +6 -0
  436. package/templates/blank/package.json +31 -0
  437. package/templates/blank/src/about.tsx +14 -0
  438. package/templates/blank/src/app.ts +160 -0
  439. package/templates/blank/src/door.ts +7 -0
  440. package/templates/blank/src/first-page.ts +5 -0
  441. package/templates/blank/src/frame.ts +17 -0
  442. package/templates/blank/src/main.ts +20 -0
  443. package/templates/blank/src/routes.ts +79 -0
  444. package/templates/blank/template.json +15 -0
  445. package/templates/blank/test/app.test.ts +177 -0
  446. package/templates/blank/tsconfig.json +19 -0
  447. package/templates/chat/.gitattributes +2 -0
  448. package/templates/chat/AGENTS.md +16 -0
  449. package/templates/chat/blend.yaml +36 -0
  450. package/templates/chat/gitignore +9 -0
  451. package/templates/chat/migrations/001-chat.sql +12 -0
  452. package/templates/chat/package.json +35 -0
  453. package/templates/chat/src/access.ts +110 -0
  454. package/templates/chat/src/app.ts +165 -0
  455. package/templates/chat/src/chat-app.ts +120 -0
  456. package/templates/chat/src/client/chat.tsx +117 -0
  457. package/templates/chat/src/client/tsconfig.json +26 -0
  458. package/templates/chat/src/db.ts +43 -0
  459. package/templates/chat/src/door.ts +7 -0
  460. package/templates/chat/src/frame.ts +17 -0
  461. package/templates/chat/src/llm.ts +48 -0
  462. package/templates/chat/src/main.ts +23 -0
  463. package/templates/chat/src/page.tsx +42 -0
  464. package/templates/chat/src/routes.ts +29 -0
  465. package/templates/chat/src/runtime.ts +23 -0
  466. package/templates/chat/template.json +15 -0
  467. package/templates/chat/test/chat.test.ts +322 -0
  468. package/templates/chat/test/server.test.ts +92 -0
  469. package/templates/chat/tsconfig.json +20 -0
  470. package/templates/nodejs/.gitattributes +2 -0
  471. package/templates/nodejs/AGENTS.md +9 -0
  472. package/templates/nodejs/blend.yaml +33 -0
  473. package/templates/nodejs/gitignore +6 -0
  474. package/templates/nodejs/package.json +32 -0
  475. package/templates/nodejs/src/app.ts +158 -0
  476. package/templates/nodejs/src/client/counter.tsx +12 -0
  477. package/templates/nodejs/src/client/tsconfig.json +26 -0
  478. package/templates/nodejs/src/door.ts +7 -0
  479. package/templates/nodejs/src/frame.ts +17 -0
  480. package/templates/nodejs/src/main.ts +20 -0
  481. package/templates/nodejs/src/page.tsx +29 -0
  482. package/templates/nodejs/src/routes.ts +59 -0
  483. package/templates/nodejs/template.json +14 -0
  484. package/templates/nodejs/test/app.test.ts +112 -0
  485. package/templates/nodejs/test/server.test.ts +97 -0
  486. package/templates/nodejs/tsconfig.json +20 -0
  487. package/templates/notes/.gitattributes +2 -0
  488. package/templates/notes/AGENTS.md +26 -0
  489. package/templates/notes/blend.yaml +36 -0
  490. package/templates/notes/gitignore +9 -0
  491. package/templates/notes/migrations/001-notes.sql +18 -0
  492. package/templates/notes/package.json +35 -0
  493. package/templates/notes/src/app.ts +165 -0
  494. package/templates/notes/src/auth.ts +57 -0
  495. package/templates/notes/src/client/counter.tsx +21 -0
  496. package/templates/notes/src/client/tsconfig.json +26 -0
  497. package/templates/notes/src/db.ts +50 -0
  498. package/templates/notes/src/door.ts +7 -0
  499. package/templates/notes/src/frame.ts +17 -0
  500. package/templates/notes/src/main.ts +23 -0
  501. package/templates/notes/src/notes-app.ts +212 -0
  502. package/templates/notes/src/routes.ts +21 -0
  503. package/templates/notes/src/runtime.ts +23 -0
  504. package/templates/notes/src/schema.ts +38 -0
  505. package/templates/notes/src/views.tsx +145 -0
  506. package/templates/notes/template.json +15 -0
  507. package/templates/notes/test/notes.test.ts +318 -0
  508. package/templates/notes/test/server.test.ts +92 -0
  509. package/templates/notes/tsconfig.json +20 -0
  510. package/templates/todo/.gitattributes +2 -0
  511. package/templates/todo/AGENTS.md +5 -0
  512. package/templates/todo/README.md +27 -0
  513. package/templates/todo/blend.yaml +28 -0
  514. package/templates/todo/gitignore +6 -0
  515. package/templates/todo/package.json +31 -0
  516. package/templates/todo/src/app.ts +145 -0
  517. package/templates/todo/src/door.ts +7 -0
  518. package/templates/todo/src/frame.ts +17 -0
  519. package/templates/todo/src/main.ts +21 -0
  520. package/templates/todo/src/page.ts +35 -0
  521. package/templates/todo/src/todo.ts +137 -0
  522. package/templates/todo/template.json +14 -0
  523. package/templates/todo/test/todo.test.ts +228 -0
  524. package/templates/todo/tsconfig.json +19 -0
@@ -0,0 +1,389 @@
1
+ import "./router-wWGf3FlK.js";
2
+ import { t as html } from "./html-CoWdxS1u.js";
3
+ import { n as getExtension } from "./mime-C-r9WxjH.js";
4
+ import { n as isMiddleware, t as findTargetHandler } from "./handler-DXCHa3NV.js";
5
+ import { o as replaceUrlParam } from "./utils-CYdUlhw1.js";
6
+ import { t as createPool } from "./concurrent-B7z-2cwF.js";
7
+ //#region ../../../plugins/router/src/core/helper/ssg/utils.ts
8
+ /**
9
+ * Get dirname
10
+ * @param path File Path
11
+ * @returns Parent dir path
12
+ */
13
+ const dirname = (path) => {
14
+ return path.split(/[\/\\]/).slice(0, -1).join("/");
15
+ };
16
+ const normalizePath = (path) => {
17
+ return path.replace(/(\\)/g, "/").replace(/\/$/g, "");
18
+ };
19
+ const getUncRoot = (path) => {
20
+ const uncRoot = path.replace(/\\/g, "/").match(/^\/\/([^/]+)\/([^/]+)/);
21
+ if (uncRoot) return `${uncRoot[1].toLowerCase()}/${uncRoot[2].toLowerCase()}`;
22
+ };
23
+ const handleParent = (resultPaths) => {
24
+ if (resultPaths.length === 0 || resultPaths[resultPaths.length - 1] === "..") resultPaths.push("..");
25
+ else resultPaths.pop();
26
+ };
27
+ const handleNonDot = (path, resultPaths) => {
28
+ path = path.replace(/^\.(?!.)/, "");
29
+ if (path !== "") resultPaths.push(path);
30
+ };
31
+ const handleSegments = (paths, resultPaths) => {
32
+ for (const path of paths) if (path === "..") handleParent(resultPaths);
33
+ else handleNonDot(path, resultPaths);
34
+ };
35
+ const joinPaths = (...paths) => {
36
+ const hasUncPrefix = getUncRoot(paths[0]) !== void 0;
37
+ paths = paths.map(normalizePath);
38
+ const resultPaths = [];
39
+ handleSegments(paths.join("/").split("/"), resultPaths);
40
+ return (hasUncPrefix ? "//" : paths[0][0] === "/" ? "/" : "") + resultPaths.join("/");
41
+ };
42
+ const filterStaticGenerateRoutes = (acryl) => {
43
+ return acryl.routes.reduce((acc, { method, handler, path }) => {
44
+ const targetHandler = findTargetHandler(handler);
45
+ if (["GET", "ALL"].includes(method) && !isMiddleware(targetHandler)) acc.push({ path });
46
+ return acc;
47
+ }, []);
48
+ };
49
+ const isDynamicRoute = (path) => {
50
+ return path.split("/").some((segment) => segment.startsWith(":") || segment.includes("*"));
51
+ };
52
+ const toSegments = (path) => path === "" ? [] : path.split("/");
53
+ const getPathRoot = (path) => {
54
+ const normalizedPath = path.replace(/\\/g, "/");
55
+ const uncRoot = getUncRoot(normalizedPath);
56
+ if (uncRoot) return `unc:${uncRoot}`;
57
+ const driveRoot = normalizedPath.match(/^([A-Za-z]):/);
58
+ if (driveRoot) return `${normalizedPath[2] === "/" ? "drive-absolute" : "drive-relative"}:${driveRoot[1].toLowerCase()}`;
59
+ return normalizedPath.startsWith("/") ? "absolute" : "relative";
60
+ };
61
+ const ensureWithinOutDir = (outDir, filePath) => {
62
+ const outDirSegments = toSegments(joinPaths(outDir));
63
+ const filePathSegments = toSegments(joinPaths(filePath));
64
+ const hasMismatchedPathRoot = getPathRoot(outDir) !== getPathRoot(filePath);
65
+ const climbsAboveOutDir = filePathSegments[outDirSegments.length] === "..";
66
+ if (hasMismatchedPathRoot || filePathSegments.length <= outDirSegments.length || !outDirSegments.every((segment, i) => segment === filePathSegments[i]) || climbsAboveOutDir) throw new Error(`Path traversal detected: "${filePath}" is outside the output directory`);
67
+ };
68
+ //#endregion
69
+ //#region ../../../plugins/router/src/core/helper/ssg/middleware.ts
70
+ const SSG_CONTEXT = "ACRYL_SSG_CONTEXT";
71
+ const X_ACRYL_DISABLE_SSG_HEADER_KEY = "x-acryl-disable-ssg";
72
+ (() => {
73
+ try {
74
+ return new Response("SSG is disabled", {
75
+ status: 404,
76
+ headers: { [X_ACRYL_DISABLE_SSG_HEADER_KEY]: "true" }
77
+ });
78
+ } catch {
79
+ return null;
80
+ }
81
+ })();
82
+ /**
83
+ * Define SSG Route
84
+ */
85
+ const ssgParams = (params) => async (c, next) => {
86
+ if (isDynamicRoute(c.req.path)) {
87
+ c.req.raw.ssgParams = Array.isArray(params) ? params : await params(c);
88
+ return c.notFound();
89
+ }
90
+ await next();
91
+ };
92
+ /**
93
+ * @experimental
94
+ * `isSSGContext` is an experimental feature.
95
+ * The API might be changed.
96
+ */
97
+ const isSSGContext = (c) => !!c.env?.[SSG_CONTEXT];
98
+ /**
99
+ * @experimental
100
+ * `disableSSG` is an experimental feature.
101
+ * The API might be changed.
102
+ */
103
+ const disableSSG = () => async function disableSSG(c, next) {
104
+ if (isSSGContext(c)) {
105
+ c.header(X_ACRYL_DISABLE_SSG_HEADER_KEY, "true");
106
+ return c.notFound();
107
+ }
108
+ await next();
109
+ };
110
+ /**
111
+ * @experimental
112
+ * `onlySSG` is an experimental feature.
113
+ * The API might be changed.
114
+ */
115
+ const onlySSG = () => async function onlySSG(c, next) {
116
+ if (!isSSGContext(c)) return c.notFound();
117
+ await next();
118
+ };
119
+ //#endregion
120
+ //#region ../../../plugins/router/src/core/helper/ssg/plugins.ts
121
+ /**
122
+ * The default plugin that defines the recommended behavior.
123
+ *
124
+ * @experimental
125
+ * `defaultPlugin` is an experimental feature.
126
+ * The API might be changed.
127
+ */
128
+ const defaultPlugin = () => {
129
+ return { afterResponseHook: (res) => {
130
+ if (res.status !== 200) return false;
131
+ return res;
132
+ } };
133
+ };
134
+ const REDIRECT_STATUS_CODES = /* @__PURE__ */ new Set([
135
+ 301,
136
+ 302,
137
+ 303,
138
+ 307,
139
+ 308
140
+ ]);
141
+ const generateRedirectHtml = (location) => {
142
+ return html`<!DOCTYPE html>
143
+ <title>Redirecting to: ${location}</title>
144
+ <meta http-equiv="refresh" content="0;url=${location}" />
145
+ <meta name="robots" content="noindex" />
146
+ <link rel="canonical" href="${location}" />
147
+ <body>
148
+ <a href="${location}">Redirecting to <code>${location}</code></a>
149
+ </body>
150
+ `.toString().replace(/\n/g, "");
151
+ };
152
+ /**
153
+ * The redirect plugin that generates HTML redirect pages for HTTP redirect responses for status codes 301, 302, 303, 307 and 308.
154
+ *
155
+ * When used with `defaultPlugin`, place `redirectPlugin` before it, because `defaultPlugin` skips non-200 responses.
156
+ *
157
+ * ```ts
158
+ * // ✅ Will work as expected
159
+ * toSSG(app, fs, { plugins: [redirectPlugin(), defaultPlugin()] })
160
+ *
161
+ * // ❌ Will not work as expected
162
+ * toSSG(app, fs, { plugins: [defaultPlugin(), redirectPlugin()] })
163
+ * ```
164
+ *
165
+ * @experimental
166
+ * `redirectPlugin` is an experimental feature.
167
+ * The API might be changed.
168
+ */
169
+ const redirectPlugin = () => {
170
+ return { afterResponseHook: (res) => {
171
+ if (REDIRECT_STATUS_CODES.has(res.status)) {
172
+ const location = res.headers.get("Location");
173
+ if (!location) return false;
174
+ const htmlBody = generateRedirectHtml(location);
175
+ return new Response(htmlBody, {
176
+ status: 200,
177
+ headers: { "Content-Type": "text/html; charset=utf-8" }
178
+ });
179
+ }
180
+ return res;
181
+ } };
182
+ };
183
+ //#endregion
184
+ //#region ../../../plugins/router/src/core/helper/ssg/ssg.ts
185
+ const DEFAULT_CONCURRENCY = 2;
186
+ const DEFAULT_CONTENT_TYPE = "text/plain";
187
+ const DEFAULT_OUTPUT_DIR = "./static";
188
+ const generateFilePath = (routePath, outDir, mimeType, extensionMap) => {
189
+ const extension = determineExtension(mimeType, extensionMap);
190
+ let filePath;
191
+ if (routePath.endsWith(`.${extension}`)) filePath = joinPaths(outDir, routePath);
192
+ else if (routePath === "/") filePath = joinPaths(outDir, `index.${extension}`);
193
+ else if (routePath.endsWith("/")) filePath = joinPaths(outDir, routePath, `index.${extension}`);
194
+ else filePath = joinPaths(outDir, `${routePath}.${extension}`);
195
+ ensureWithinOutDir(outDir, filePath);
196
+ return filePath;
197
+ };
198
+ const parseResponseContent = async (response) => {
199
+ const contentType = response.headers.get("Content-Type");
200
+ try {
201
+ if (contentType?.includes("text") || contentType?.includes("json")) return await response.text();
202
+ else return await response.arrayBuffer();
203
+ } catch (error) {
204
+ throw new Error(`Error processing response: ${error instanceof Error ? error.message : "Unknown error"}`);
205
+ }
206
+ };
207
+ const defaultExtensionMap = {
208
+ "text/html": "html",
209
+ "text/xml": "xml",
210
+ "application/xml": "xml",
211
+ "application/atom+xml": "xml",
212
+ "application/rss+xml": "xml",
213
+ "application/yaml": "yaml"
214
+ };
215
+ const determineExtension = (mimeType, userExtensionMap) => {
216
+ const extensionMap = userExtensionMap || defaultExtensionMap;
217
+ if (mimeType in extensionMap) return extensionMap[mimeType];
218
+ return getExtension(mimeType) || "html";
219
+ };
220
+ const combineBeforeRequestHooks = (hooks) => {
221
+ if (!Array.isArray(hooks)) return hooks;
222
+ return async (req) => {
223
+ let currentReq = req;
224
+ for (const hook of hooks) {
225
+ const result = await hook(currentReq);
226
+ if (result === false) return false;
227
+ if (result instanceof Request) currentReq = result;
228
+ }
229
+ return currentReq;
230
+ };
231
+ };
232
+ const combineAfterResponseHooks = (hooks) => {
233
+ if (!Array.isArray(hooks)) return hooks;
234
+ return async (res) => {
235
+ let currentRes = res;
236
+ for (const hook of hooks) {
237
+ const result = await hook(currentRes);
238
+ if (result === false) return false;
239
+ if (result instanceof Response) currentRes = result;
240
+ }
241
+ return currentRes;
242
+ };
243
+ };
244
+ const combineAfterGenerateHooks = (hooks, fsModule, options) => {
245
+ if (!Array.isArray(hooks)) return hooks;
246
+ return async (result) => {
247
+ for (const hook of hooks) await hook(result, fsModule, options);
248
+ };
249
+ };
250
+ /**
251
+ * @experimental
252
+ * `fetchRoutesContent` is an experimental feature.
253
+ * The API might be changed.
254
+ */
255
+ const fetchRoutesContent = function* (app, beforeRequestHook, afterResponseHook, concurrency) {
256
+ const baseURL = "http://localhost";
257
+ const pool = createPool({ concurrency });
258
+ for (const route of filterStaticGenerateRoutes(app)) {
259
+ const thisRouteBaseURL = new URL(route.path, baseURL).toString();
260
+ let forGetInfoURLRequest = new Request(thisRouteBaseURL);
261
+ yield new Promise(async (resolveGetInfo, rejectGetInfo) => {
262
+ try {
263
+ if (beforeRequestHook) {
264
+ const maybeRequest = await beforeRequestHook(forGetInfoURLRequest);
265
+ if (!maybeRequest) {
266
+ resolveGetInfo(void 0);
267
+ return;
268
+ }
269
+ forGetInfoURLRequest = maybeRequest;
270
+ }
271
+ await pool.run(() => app.fetch(forGetInfoURLRequest, { [SSG_CONTEXT]: true }));
272
+ if (!forGetInfoURLRequest.ssgParams) {
273
+ if (isDynamicRoute(route.path)) {
274
+ resolveGetInfo(void 0);
275
+ return;
276
+ }
277
+ forGetInfoURLRequest.ssgParams = [{}];
278
+ }
279
+ const requestInit = {
280
+ method: forGetInfoURLRequest.method,
281
+ headers: forGetInfoURLRequest.headers
282
+ };
283
+ resolveGetInfo((function* () {
284
+ for (const param of forGetInfoURLRequest.ssgParams) yield new Promise(async (resolveReq, rejectReq) => {
285
+ try {
286
+ const replacedUrlParam = replaceUrlParam(route.path, param);
287
+ let response = await pool.run(() => app.request(replacedUrlParam, requestInit, { [SSG_CONTEXT]: true }));
288
+ if (response.headers.get("x-acryl-disable-ssg")) {
289
+ resolveReq(void 0);
290
+ return;
291
+ }
292
+ if (afterResponseHook) {
293
+ const maybeResponse = await afterResponseHook(response);
294
+ if (!maybeResponse) {
295
+ resolveReq(void 0);
296
+ return;
297
+ }
298
+ response = maybeResponse;
299
+ }
300
+ resolveReq({
301
+ routePath: replacedUrlParam,
302
+ mimeType: response.headers.get("Content-Type")?.split(";")[0] || DEFAULT_CONTENT_TYPE,
303
+ content: await parseResponseContent(response)
304
+ });
305
+ } catch (error) {
306
+ rejectReq(error);
307
+ }
308
+ });
309
+ })());
310
+ } catch (error) {
311
+ rejectGetInfo(error);
312
+ }
313
+ });
314
+ }
315
+ };
316
+ /**
317
+ * @experimental
318
+ * `saveContentToFile` is an experimental feature.
319
+ * The API might be changed.
320
+ */
321
+ const createdDirs = /* @__PURE__ */ new Set();
322
+ const saveContentToFile = async (data, fsModule, outDir, extensionMap) => {
323
+ const awaitedData = await data;
324
+ if (!awaitedData) return;
325
+ const { routePath, content, mimeType } = awaitedData;
326
+ const filePath = generateFilePath(routePath, outDir, mimeType, extensionMap);
327
+ const dirPath = dirname(filePath);
328
+ if (dirPath !== "" && !createdDirs.has(dirPath)) {
329
+ await fsModule.mkdir(dirPath, { recursive: true });
330
+ createdDirs.add(dirPath);
331
+ }
332
+ if (typeof content === "string") await fsModule.writeFile(filePath, content);
333
+ else if (content instanceof ArrayBuffer) await fsModule.writeFile(filePath, new Uint8Array(content));
334
+ return filePath;
335
+ };
336
+ /**
337
+ * @experimental
338
+ * `toSSG` is an experimental feature.
339
+ * The API might be changed.
340
+ */
341
+ const toSSG = async (app, fs, options) => {
342
+ let result;
343
+ const getInfoPromises = [];
344
+ const savePromises = [];
345
+ const plugins = options?.plugins || [defaultPlugin()];
346
+ const beforeRequestHooks = [];
347
+ const afterResponseHooks = [];
348
+ const afterGenerateHooks = [];
349
+ if (options?.beforeRequestHook) beforeRequestHooks.push(...Array.isArray(options.beforeRequestHook) ? options.beforeRequestHook : [options.beforeRequestHook]);
350
+ if (options?.afterResponseHook) afterResponseHooks.push(...Array.isArray(options.afterResponseHook) ? options.afterResponseHook : [options.afterResponseHook]);
351
+ if (options?.afterGenerateHook) afterGenerateHooks.push(...Array.isArray(options.afterGenerateHook) ? options.afterGenerateHook : [options.afterGenerateHook]);
352
+ for (const plugin of plugins) {
353
+ if (plugin.beforeRequestHook) beforeRequestHooks.push(...Array.isArray(plugin.beforeRequestHook) ? plugin.beforeRequestHook : [plugin.beforeRequestHook]);
354
+ if (plugin.afterResponseHook) afterResponseHooks.push(...Array.isArray(plugin.afterResponseHook) ? plugin.afterResponseHook : [plugin.afterResponseHook]);
355
+ if (plugin.afterGenerateHook) afterGenerateHooks.push(...Array.isArray(plugin.afterGenerateHook) ? plugin.afterGenerateHook : [plugin.afterGenerateHook]);
356
+ }
357
+ try {
358
+ const outputDir = options?.dir ?? "./static";
359
+ const concurrency = options?.concurrency ?? DEFAULT_CONCURRENCY;
360
+ const combinedBeforeRequestHook = combineBeforeRequestHooks(beforeRequestHooks.length > 0 ? beforeRequestHooks : [(req) => req]);
361
+ const combinedAfterResponseHook = combineAfterResponseHooks(afterResponseHooks.length > 0 ? afterResponseHooks : [(req) => req]);
362
+ const getInfoGen = fetchRoutesContent(app, combinedBeforeRequestHook, combinedAfterResponseHook, concurrency);
363
+ for (const getInfo of getInfoGen) getInfoPromises.push(getInfo.then((getContentGen) => {
364
+ if (!getContentGen) return;
365
+ for (const content of getContentGen) savePromises.push(saveContentToFile(content, fs, outputDir, options?.extensionMap).catch((e) => e));
366
+ }));
367
+ await Promise.all(getInfoPromises);
368
+ const files = [];
369
+ for (const savePromise of savePromises) {
370
+ const fileOrError = await savePromise;
371
+ if (typeof fileOrError === "string") files.push(fileOrError);
372
+ else if (fileOrError) throw fileOrError;
373
+ }
374
+ result = {
375
+ success: true,
376
+ files
377
+ };
378
+ } catch (error) {
379
+ result = {
380
+ success: false,
381
+ files: [],
382
+ error: error instanceof Error ? error : new Error(String(error))
383
+ };
384
+ }
385
+ if (afterGenerateHooks.length > 0) await combineAfterGenerateHooks(afterGenerateHooks, fs, options)(result, fs, options);
386
+ return result;
387
+ };
388
+ //#endregion
389
+ export { defaultExtensionMap as a, toSSG as c, X_ACRYL_DISABLE_SSG_HEADER_KEY as d, disableSSG as f, ssgParams as h, combineBeforeRequestHooks as i, defaultPlugin as l, onlySSG as m, combineAfterGenerateHooks as n, fetchRoutesContent as o, isSSGContext as p, combineAfterResponseHooks as r, saveContentToFile as s, DEFAULT_OUTPUT_DIR as t, redirectPlugin as u };
package/lib/ssg.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { C as saveContentToFile, S as fetchRoutesContent, _ as ToSSGResult, a as isSSGContext, b as combineBeforeRequestHooks, c as AfterGenerateHook, d as DEFAULT_OUTPUT_DIR, f as FileSystemModule, g as ToSSGOptions, h as ToSSGInterface, i as disableSSG, l as AfterResponseHook, m as ToSSGAdaptorInterface, n as redirectPlugin, o as onlySSG, p as SSGPlugin, r as X_ACRYL_DISABLE_SSG_HEADER_KEY, s as ssgParams, t as defaultPlugin, u as BeforeRequestHook, v as combineAfterGenerateHooks, w as toSSG, x as defaultExtensionMap, y as combineAfterResponseHooks } from "./index-DYBSr8yW.js";
2
+ export { AfterGenerateHook, AfterResponseHook, BeforeRequestHook, DEFAULT_OUTPUT_DIR, FileSystemModule, SSGPlugin, ToSSGAdaptorInterface, ToSSGInterface, ToSSGOptions, ToSSGResult, X_ACRYL_DISABLE_SSG_HEADER_KEY, combineAfterGenerateHooks, combineAfterResponseHooks, combineBeforeRequestHooks, defaultExtensionMap, defaultPlugin, disableSSG, fetchRoutesContent, isSSGContext, onlySSG, redirectPlugin, saveContentToFile, ssgParams, toSSG };
package/lib/ssg.js ADDED
@@ -0,0 +1,2 @@
1
+ import { a as defaultExtensionMap, c as toSSG, d as X_ACRYL_DISABLE_SSG_HEADER_KEY, f as disableSSG, h as ssgParams, i as combineBeforeRequestHooks, l as defaultPlugin, m as onlySSG, n as combineAfterGenerateHooks, o as fetchRoutesContent, p as isSSGContext, r as combineAfterResponseHooks, s as saveContentToFile, t as DEFAULT_OUTPUT_DIR, u as redirectPlugin } from "./ssg-D_StqyTO.js";
2
+ export { DEFAULT_OUTPUT_DIR, X_ACRYL_DISABLE_SSG_HEADER_KEY, combineAfterGenerateHooks, combineAfterResponseHooks, combineBeforeRequestHooks, defaultExtensionMap, defaultPlugin, disableSSG, fetchRoutesContent, isSSGContext, onlySSG, redirectPlugin, saveContentToFile, ssgParams, toSSG };
@@ -0,0 +1,88 @@
1
+ //#region ../../../plugins/router/src/core/utils/stream.ts
2
+ /**
3
+ * @module
4
+ * Stream utility.
5
+ */
6
+ var StreamingApi = class {
7
+ writer;
8
+ encoder;
9
+ writable;
10
+ abortSubscribers = [];
11
+ responseReadable;
12
+ /**
13
+ * Whether the stream has been aborted.
14
+ */
15
+ aborted = false;
16
+ /**
17
+ * Whether the stream has been closed normally.
18
+ */
19
+ closed = false;
20
+ constructor(writable, _readable) {
21
+ this.writable = writable;
22
+ this.writer = writable.getWriter();
23
+ this.encoder = new TextEncoder();
24
+ const reader = _readable.getReader();
25
+ this.abortSubscribers.push(async () => {
26
+ await reader.cancel();
27
+ });
28
+ this.responseReadable = new ReadableStream({
29
+ async pull(controller) {
30
+ const { done, value } = await reader.read();
31
+ done ? controller.close() : controller.enqueue(value);
32
+ },
33
+ cancel: () => {
34
+ if (!this.closed) this.abort();
35
+ }
36
+ });
37
+ }
38
+ async write(input) {
39
+ try {
40
+ if (typeof input === "string") input = this.encoder.encode(input);
41
+ await this.writer.write(input);
42
+ } catch {}
43
+ return this;
44
+ }
45
+ async writeln(input) {
46
+ await this.write(input + "\n");
47
+ return this;
48
+ }
49
+ sleep(ms) {
50
+ return new Promise((res) => setTimeout(res, ms));
51
+ }
52
+ async close() {
53
+ this.closed = true;
54
+ try {
55
+ await this.writer.close();
56
+ } catch {}
57
+ }
58
+ async pipe(body) {
59
+ this.writer.releaseLock();
60
+ try {
61
+ await body.pipeTo(this.writable, {
62
+ preventClose: true,
63
+ preventAbort: true
64
+ });
65
+ } finally {
66
+ this.writer = this.writable.getWriter();
67
+ }
68
+ }
69
+ onAbort(listener) {
70
+ this.abortSubscribers.push(listener);
71
+ }
72
+ /**
73
+ * Abort the stream.
74
+ * You can call this method when stream is aborted by external event.
75
+ */
76
+ abort() {
77
+ if (!this.aborted) {
78
+ this.aborted = true;
79
+ this.abortSubscribers.forEach((subscriber) => {
80
+ try {
81
+ Promise.resolve(subscriber()).catch(() => {});
82
+ } catch {}
83
+ });
84
+ }
85
+ }
86
+ };
87
+ //#endregion
88
+ export { StreamingApi as t };
@@ -0,0 +1,34 @@
1
+ //#region ../../../plugins/router/src/core/utils/stream.d.ts
2
+ /**
3
+ * @module
4
+ * Stream utility.
5
+ */
6
+ declare class StreamingApi {
7
+ private writer;
8
+ private encoder;
9
+ private writable;
10
+ private abortSubscribers;
11
+ responseReadable: ReadableStream;
12
+ /**
13
+ * Whether the stream has been aborted.
14
+ */
15
+ aborted: boolean;
16
+ /**
17
+ * Whether the stream has been closed normally.
18
+ */
19
+ closed: boolean;
20
+ constructor(writable: WritableStream, _readable: ReadableStream);
21
+ write(input: Uint8Array | string): Promise<StreamingApi>;
22
+ writeln(input: string): Promise<StreamingApi>;
23
+ sleep(ms: number): Promise<unknown>;
24
+ close(): Promise<void>;
25
+ pipe(body: ReadableStream): Promise<void>;
26
+ onAbort(listener: () => void | Promise<void>): void;
27
+ /**
28
+ * Abort the stream.
29
+ * You can call this method when stream is aborted by external event.
30
+ */
31
+ abort(): void;
32
+ }
33
+ //#endregion
34
+ export { StreamingApi as t };
@@ -0,0 +1,96 @@
1
+ import { i as resolveCallback, t as HtmlEscapedCallbackPhase } from "./html-1jTa7KN1.js";
2
+ import { n as TEXT_PLAIN } from "./context-BVI2RzT7.js";
3
+ import { t as StreamingApi } from "./stream-CJ_0BMG2.js";
4
+ //#region ../../../plugins/router/src/core/helper/streaming/utils.ts
5
+ let isOldBunVersion = () => {
6
+ const version = typeof Bun !== "undefined" ? Bun.version : void 0;
7
+ if (version === void 0) return false;
8
+ const result = version.startsWith("1.1") || version.startsWith("1.0") || version.startsWith("0.");
9
+ isOldBunVersion = () => result;
10
+ return result;
11
+ };
12
+ //#endregion
13
+ //#region ../../../plugins/router/src/core/helper/streaming/stream.ts
14
+ const contextStash$1 = /* @__PURE__ */ new WeakMap();
15
+ const stream = (c, cb, onError) => {
16
+ const { readable, writable } = new TransformStream();
17
+ const stream = new StreamingApi(writable, readable);
18
+ if (isOldBunVersion()) c.req.raw.signal.addEventListener("abort", () => {
19
+ if (!stream.closed) stream.abort();
20
+ });
21
+ contextStash$1.set(stream.responseReadable, c);
22
+ (async () => {
23
+ try {
24
+ await cb(stream);
25
+ } catch (e) {
26
+ if (e === void 0) {} else if (e instanceof Error && onError) await onError(e, stream);
27
+ else console.error(e);
28
+ } finally {
29
+ stream.close();
30
+ }
31
+ })();
32
+ return c.newResponse(stream.responseReadable);
33
+ };
34
+ //#endregion
35
+ //#region ../../../plugins/router/src/core/helper/streaming/sse.ts
36
+ var SSEStreamingApi = class extends StreamingApi {
37
+ constructor(writable, readable) {
38
+ super(writable, readable);
39
+ }
40
+ async writeSSE(message) {
41
+ const dataLines = (await resolveCallback(message.data, HtmlEscapedCallbackPhase.Stringify, false, {})).split(/\r\n|\r|\n/).map((line) => {
42
+ return `data: ${line}`;
43
+ }).join("\n");
44
+ for (const key of ["event", "id"]) {
45
+ const value = message[key];
46
+ if (value && /[\r\n]/.test(value)) throw new Error(`${key} must not contain "\\r" or "\\n"`);
47
+ }
48
+ const sseData = [
49
+ message.event && `event: ${message.event}`,
50
+ dataLines,
51
+ message.id !== void 0 && `id: ${message.id}`,
52
+ message.retry !== void 0 && `retry: ${message.retry}`
53
+ ].filter(Boolean).join("\n") + "\n\n";
54
+ await this.write(sseData);
55
+ }
56
+ };
57
+ const run = async (stream, cb, onError) => {
58
+ try {
59
+ await cb(stream);
60
+ } catch (e) {
61
+ if (e instanceof Error && onError) {
62
+ await onError(e, stream);
63
+ await stream.writeSSE({
64
+ event: "error",
65
+ data: e.message
66
+ });
67
+ } else console.error(e);
68
+ } finally {
69
+ stream.close();
70
+ }
71
+ };
72
+ const contextStash = /* @__PURE__ */ new WeakMap();
73
+ const streamSSE = (c, cb, onError) => {
74
+ const { readable, writable } = new TransformStream();
75
+ const stream = new SSEStreamingApi(writable, readable);
76
+ if (isOldBunVersion()) c.req.raw.signal.addEventListener("abort", () => {
77
+ if (!stream.closed) stream.abort();
78
+ });
79
+ contextStash.set(stream.responseReadable, c);
80
+ c.header("Transfer-Encoding", "chunked");
81
+ c.header("Content-Type", "text/event-stream");
82
+ c.header("Cache-Control", "no-cache");
83
+ c.header("Connection", "keep-alive");
84
+ run(stream, cb, onError);
85
+ return c.newResponse(stream.responseReadable);
86
+ };
87
+ //#endregion
88
+ //#region ../../../plugins/router/src/core/helper/streaming/text.ts
89
+ const streamText = (c, cb, onError) => {
90
+ c.header("Content-Type", TEXT_PLAIN);
91
+ c.header("X-Content-Type-Options", "nosniff");
92
+ c.header("Transfer-Encoding", "chunked");
93
+ return stream(c, cb, onError);
94
+ };
95
+ //#endregion
96
+ export { stream as i, SSEStreamingApi as n, streamSSE as r, streamText as t };
@@ -0,0 +1,23 @@
1
+ import { t as Context } from "./context-Ca3uX_bh.js";
2
+ import { t as StreamingApi } from "./stream-Oxo9JHC6.js";
3
+
4
+ //#region ../../../plugins/router/src/core/helper/streaming/stream.d.ts
5
+ declare const stream: (c: Context, cb: (stream: StreamingApi) => Promise<void>, onError?: (e: Error, stream: StreamingApi) => Promise<void>) => Response;
6
+ //#endregion
7
+ //#region ../../../plugins/router/src/core/helper/streaming/sse.d.ts
8
+ interface SSEMessage {
9
+ data: string | Promise<string>;
10
+ event?: string;
11
+ id?: string;
12
+ retry?: number;
13
+ }
14
+ declare class SSEStreamingApi extends StreamingApi {
15
+ constructor(writable: WritableStream, readable: ReadableStream);
16
+ writeSSE(message: SSEMessage): Promise<void>;
17
+ }
18
+ declare const streamSSE: (c: Context, cb: (stream: SSEStreamingApi) => Promise<void>, onError?: (e: Error, stream: SSEStreamingApi) => Promise<void>) => Response;
19
+ //#endregion
20
+ //#region ../../../plugins/router/src/core/helper/streaming/text.d.ts
21
+ declare const streamText: (c: Context, cb: (stream: StreamingApi) => Promise<void>, onError?: (e: Error, stream: StreamingApi) => Promise<void>) => Response;
22
+ //#endregion
23
+ export { type SSEMessage, SSEStreamingApi, stream, streamSSE, streamText };
@@ -0,0 +1,2 @@
1
+ import { i as stream, n as SSEStreamingApi, r as streamSSE, t as streamText } from "./streaming-CL2i3hX_.js";
2
+ export { SSEStreamingApi, stream, streamSSE, streamText };
@@ -0,0 +1,17 @@
1
+ import { t as hc } from "./client-BMFCUlHG.js";
2
+ //#region ../../../plugins/router/src/core/helper/testing/index.ts
3
+ /**
4
+ * @module
5
+ * Testing Helper for Acryl.
6
+ */
7
+ const testClient = (app, Env, executionCtx, options) => {
8
+ const customFetch = (input, init) => {
9
+ return app.request(input, init, Env, executionCtx);
10
+ };
11
+ return hc("http://localhost", {
12
+ ...options,
13
+ fetch: customFetch
14
+ });
15
+ };
16
+ //#endregion
17
+ export { testClient as t };
@@ -0,0 +1,10 @@
1
+ import { Y as Schema, a as ExecutionContext } from "./context-Ca3uX_bh.js";
2
+ import { D as UnionToIntersection } from "./types-nO2Jov17.js";
3
+ import { t as Acryl } from "./app-DGqSNBSd.js";
4
+ import { i as ClientRequestOptions, n as Client } from "./types-cu7acft5.js";
5
+
6
+ //#region ../../../plugins/router/src/core/helper/testing/index.d.ts
7
+ type ExtractEnv<T> = T extends Acryl<infer E, Schema, string> ? E : never;
8
+ declare const testClient: <T extends Acryl<any, Schema, string>>(app: T, Env?: ExtractEnv<T>["Bindings"] | {}, executionCtx?: ExecutionContext, options?: Omit<ClientRequestOptions, "fetch">) => UnionToIntersection<Client<T, "http://localhost">>;
9
+ //#endregion
10
+ export { testClient };
package/lib/testing.js ADDED
@@ -0,0 +1,2 @@
1
+ import { t as testClient } from "./testing-DnLmBGle.js";
2
+ export { testClient };