@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.
- package/LICENSE +73 -0
- package/README.md +424 -2
- package/bin/acrylblends.js +12 -0
- package/dist/index.d.ts +231 -0
- package/dist/index.js +4505 -0
- package/dist/index.js.map +1 -0
- package/lib/accept-B13wFRkc.js +193 -0
- package/lib/accepts-BN4uue4T.js +52 -0
- package/lib/accepts.d.ts +33 -0
- package/lib/accepts.js +2 -0
- package/lib/acryl-base.d.ts +2 -0
- package/lib/acryl-base.js +2 -0
- package/lib/adapter-Wt9Ntyhx.js +37 -0
- package/lib/adapter.d.ts +12 -0
- package/lib/adapter.js +2 -0
- package/lib/app-CM-rDcw6.js +26 -0
- package/lib/app-DGqSNBSd.d.ts +21 -0
- package/lib/app-base-BwplqlWX.js +332 -0
- package/lib/audit-B2H3sUfg.d.ts +136 -0
- package/lib/base-N-QVQhMZ.d.ts +783 -0
- package/lib/base-kl8P-za0.js +722 -0
- package/lib/basic-auth-ByZGvWGz.js +95 -0
- package/lib/basic-auth-CzulvSad.js +20 -0
- package/lib/basic-auth.d.ts +72 -0
- package/lib/basic-auth.js +2 -0
- package/lib/bearer-auth-CfR6YNqy.js +94 -0
- package/lib/bearer-auth.d.ts +89 -0
- package/lib/bearer-auth.js +2 -0
- package/lib/body-BQ-J23GI.js +94 -0
- package/lib/body-limit-DyO82Wes.js +66 -0
- package/lib/body-limit.d.ts +42 -0
- package/lib/body-limit.js +2 -0
- package/lib/browser/client.js +307 -0
- package/lib/browser/jsx-dom.js +1432 -0
- package/lib/browser/read-sse.js +84 -0
- package/lib/buffer-CWpxJrvI.js +51 -0
- package/lib/bun.d.ts +75 -0
- package/lib/bun.js +134 -0
- package/lib/cache-DllEV7kz.js +169 -0
- package/lib/cache.d.ts +43 -0
- package/lib/cache.js +2 -0
- package/lib/cell-wEBQA3d0.d.ts +32 -0
- package/lib/client-BMFCUlHG.js +143 -0
- package/lib/client-modules-ChLgW0l9.js +267 -0
- package/lib/client.d.ts +3 -0
- package/lib/client.js +3 -0
- package/lib/color-C26GR4OI.js +37 -0
- package/lib/combine-rXRCRMJx.js +137 -0
- package/lib/combine.d.ts +85 -0
- package/lib/combine.js +2 -0
- package/lib/common-CaqP5LIh.d.ts +46 -0
- package/lib/components-BZ8vBk_7.js +268 -0
- package/lib/components-Cq4hcRbo.js +24 -0
- package/lib/compose-DbuvN1rE.js +50 -0
- package/lib/compress-C7QjZM5f.js +11 -0
- package/lib/compress-CdDuP9-S.d.ts +11 -0
- package/lib/compress-T36YxGla.js +79 -0
- package/lib/compress.d.ts +38 -0
- package/lib/compress.js +3 -0
- package/lib/concurrent-B7z-2cwF.js +30 -0
- package/lib/connection-CzRPq1RP.d.ts +25 -0
- package/lib/connection-DLPx5pxD.js +24 -0
- package/lib/conninfo-BbxlV2HK.d.ts +11 -0
- package/lib/conninfo-CNYXEtnA.js +19 -0
- package/lib/conninfo.d.ts +3 -0
- package/lib/conninfo.js +2 -0
- package/lib/constants-D914mQY7.js +7 -0
- package/lib/constants-nJj4XhwC.js +4 -0
- package/lib/constants-vv1oZD_p.js +9 -0
- package/lib/context-BVI2RzT7.js +365 -0
- package/lib/context-Ca3uX_bh.d.ts +1234 -0
- package/lib/context-Dre4P1UW.d.ts +250 -0
- package/lib/context-storage-ClUlVtCZ.js +52 -0
- package/lib/context-storage.d.ts +38 -0
- package/lib/context-storage.js +2 -0
- package/lib/cookie-BqeGZ43j.d.ts +40 -0
- package/lib/cookie-DktnJ0tJ.js +82 -0
- package/lib/cookie-uMH6wAF3.js +125 -0
- package/lib/cookie.d.ts +24 -0
- package/lib/cookie.js +2 -0
- package/lib/cordis/db-sqlite.d.ts +56 -0
- package/lib/cordis/db-sqlite.js +66 -0
- package/lib/cordis/db.d.ts +8 -0
- package/lib/cordis/db.js +1 -0
- package/lib/cordis/door.d.ts +404 -0
- package/lib/cordis/door.js +1812 -0
- package/lib/cordis/inspect.d.ts +77 -0
- package/lib/cordis/inspect.js +149 -0
- package/lib/cordis/kv-db.d.ts +16 -0
- package/lib/cordis/kv-db.js +18 -0
- package/lib/cordis/kv-json.d.ts +16 -0
- package/lib/cordis/kv-json.js +52 -0
- package/lib/cordis/kv.d.ts +8 -0
- package/lib/cordis/kv.js +1 -0
- package/lib/cordis/node-server.d.ts +155 -0
- package/lib/cordis/node-server.js +4 -0
- package/lib/cordis/router-http.d.ts +85 -0
- package/lib/cordis/router-http.js +206 -0
- package/lib/cordis/router.d.ts +7 -0
- package/lib/cordis/router.js +6 -0
- package/lib/cordis/state/react.d.ts +6 -0
- package/lib/cordis/state/react.js +11 -0
- package/lib/cordis/state.d.ts +34 -0
- package/lib/cordis/state.js +527 -0
- package/lib/core-4oDBzv4Q.js +19 -0
- package/lib/cors-C0qqZ-O-.js +106 -0
- package/lib/cors.d.ts +52 -0
- package/lib/cors.js +2 -0
- package/lib/crypto-ciSjk9n3.js +34 -0
- package/lib/csrf-rMr2nM2c.js +101 -0
- package/lib/csrf.d.ts +75 -0
- package/lib/csrf.js +2 -0
- package/lib/css-Bd6tj88A.js +320 -0
- package/lib/css-CLgKjBuO.js +134 -0
- package/lib/css.d.ts +82 -0
- package/lib/css.js +3 -0
- package/lib/database-CyKvumAn.d.ts +44 -0
- package/lib/db/conformance.d.ts +15 -0
- package/lib/db/conformance.js +279 -0
- package/lib/db/sqlite.d.ts +3 -0
- package/lib/db/sqlite.js +2 -0
- package/lib/db.d.ts +3 -0
- package/lib/db.js +2 -0
- package/lib/dev-h25puJmg.js +50 -0
- package/lib/dev.d.ts +19 -0
- package/lib/dev.js +2 -0
- package/lib/dom-MsnhZjjn.js +74 -0
- package/lib/door/host.d.ts +24 -0
- package/lib/door/host.js +2 -0
- package/lib/door/page.d.ts +160 -0
- package/lib/door/page.js +1257 -0
- package/lib/door/protocol.d.ts +2 -0
- package/lib/door/protocol.js +2 -0
- package/lib/drivers.d.ts +77 -0
- package/lib/drivers.js +16 -0
- package/lib/encode-BbgU91Gc.js +33 -0
- package/lib/etag-DevxEjyU.js +135 -0
- package/lib/etag.d.ts +40 -0
- package/lib/etag.js +2 -0
- package/lib/factory-d6WBwm2j.js +30 -0
- package/lib/factory.d.ts +35 -0
- package/lib/factory.js +2 -0
- package/lib/handler-DXCHa3NV.js +12 -0
- package/lib/headers-DbujLUIi.d.ts +11 -0
- package/lib/helpers-qmReU164.js +5 -0
- package/lib/hooks-Bs7lFRjW.js +762 -0
- package/lib/html-1jTa7KN1.js +103 -0
- package/lib/html-CNr9FLdV.d.ts +46 -0
- package/lib/html-CoWdxS1u.js +31 -0
- package/lib/html.d.ts +3 -0
- package/lib/html.js +3 -0
- package/lib/http-exception-BKMYq4x6.js +54 -0
- package/lib/http-exception-Cm8QD9Fl.d.ts +57 -0
- package/lib/http-exception.d.ts +2 -0
- package/lib/http-exception.js +2 -0
- package/lib/http-status-uBFmbzzM.d.ts +35 -0
- package/lib/index-B_g6ECnm.d.ts +57 -0
- package/lib/index-BaOiJMWK.d.ts +31 -0
- package/lib/index-C5RhEyXO.d.ts +45 -0
- package/lib/index-C8xOqNUW.d.ts +71 -0
- package/lib/index-D1HlwHSL.d.ts +129 -0
- package/lib/index-DUYLk7OD.d.ts +44 -0
- package/lib/index-DYBSr8yW.d.ts +156 -0
- package/lib/index-Dv4qFsro.d.ts +94 -0
- package/lib/index-jdWVs88B.d.ts +6 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -0
- package/lib/ip-restriction-C4TZKPKl.js +166 -0
- package/lib/ip-restriction.d.ts +68 -0
- package/lib/ip-restriction.js +2 -0
- package/lib/ipaddr-CTeN6kNw.js +238 -0
- package/lib/jsx/dom/client.d.ts +30 -0
- package/lib/jsx/dom/client.js +49 -0
- package/lib/jsx/dom/css.d.ts +84 -0
- package/lib/jsx/dom/css.js +2 -0
- package/lib/jsx/dom/jsx-dev-runtime.d.ts +3 -0
- package/lib/jsx/dom/jsx-dev-runtime.js +2 -0
- package/lib/jsx/dom/jsx-runtime.d.ts +3 -0
- package/lib/jsx/dom/jsx-runtime.js +3 -0
- package/lib/jsx/dom/server.d.ts +105 -0
- package/lib/jsx/dom/server.js +37 -0
- package/lib/jsx/dom.d.ts +5 -0
- package/lib/jsx/dom.js +6 -0
- package/lib/jsx/jsx-dev-runtime.d.ts +3 -0
- package/lib/jsx/jsx-dev-runtime.js +3 -0
- package/lib/jsx/jsx-runtime.d.ts +10 -0
- package/lib/jsx/jsx-runtime.js +30 -0
- package/lib/jsx/streaming.d.ts +2 -0
- package/lib/jsx/streaming.js +2 -0
- package/lib/jsx-C5-YJG0l.js +47 -0
- package/lib/jsx-dev-runtime-CPsrmbgy.d.ts +7 -0
- package/lib/jsx-dev-runtime-Cs-uV30u.js +14 -0
- package/lib/jsx-dev-runtime-DK4z4RD3.js +354 -0
- package/lib/jsx-dev-runtime-DSQ8vSCY.d.ts +6 -0
- package/lib/jsx-renderer-B2wHa9Y8.js +99 -0
- package/lib/jsx-renderer.d.ts +75 -0
- package/lib/jsx-renderer.js +2 -0
- package/lib/jsx-runtime-BVVgDSdq.d.ts +1 -0
- package/lib/jsx-runtime-brX0UliB.js +2 -0
- package/lib/jsx.d.ts +3 -0
- package/lib/jsx.js +6 -0
- package/lib/jwk-BbiXIYhg.js +117 -0
- package/lib/jwk.d.ts +52 -0
- package/lib/jwk.js +2 -0
- package/lib/jwt-BCS5hH1O.d.ts +51 -0
- package/lib/jwt-Culfq-8m.js +403 -0
- package/lib/jwt-DaOoWaF3.js +115 -0
- package/lib/jwt.d.ts +72 -0
- package/lib/jwt.js +3 -0
- package/lib/kv/conformance.d.ts +17 -0
- package/lib/kv/conformance.js +313 -0
- package/lib/kv/db.d.ts +3 -0
- package/lib/kv/db.js +2 -0
- package/lib/kv/json.d.ts +3 -0
- package/lib/kv/json.js +2 -0
- package/lib/kv-Kv6J9zqu.d.ts +39 -0
- package/lib/kv.d.ts +3 -0
- package/lib/kv.js +2 -0
- package/lib/language-anRiLd9a.js +198 -0
- package/lib/language.d.ts +88 -0
- package/lib/language.js +2 -0
- package/lib/linear-router-BUrYQxcv.js +96 -0
- package/lib/logger-CLvaB463.js +54 -0
- package/lib/logger.d.ts +22 -0
- package/lib/logger.js +2 -0
- package/lib/loopback-only-0nTL30Zt.js +131 -0
- package/lib/loopback-only.d.ts +73 -0
- package/lib/loopback-only.js +2 -0
- package/lib/method-not-allowed-B3nMAp1f.js +82 -0
- package/lib/method-not-allowed.d.ts +47 -0
- package/lib/method-not-allowed.js +2 -0
- package/lib/method-override-Dhd_EJD9.js +103 -0
- package/lib/method-override.d.ts +46 -0
- package/lib/method-override.js +2 -0
- package/lib/middleware-B8gJUDgl.js +12 -0
- package/lib/mime-B9GbsqnN.d.ts +72 -0
- package/lib/mime-C-r9WxjH.js +77 -0
- package/lib/mount-RGiNYj2l.js +67 -0
- package/lib/mount.d.ts +44 -0
- package/lib/mount.js +2 -0
- package/lib/node-server/conninfo.d.ts +2 -0
- package/lib/node-server/conninfo.js +2 -0
- package/lib/node-server/register.d.ts +1 -0
- package/lib/node-server/register.js +59 -0
- package/lib/node-server/serve-static.d.ts +2 -0
- package/lib/node-server/serve-static.js +2 -0
- package/lib/node-server.d.ts +134 -0
- package/lib/node-server.js +5 -0
- package/lib/open-BC_BGIQt.d.ts +12 -0
- package/lib/open-BpnCtiKf.js +224 -0
- package/lib/open-CEE2hyrs.d.ts +11 -0
- package/lib/open-CwA_ZiPl.js +57 -0
- package/lib/open-DFt0lT26.js +197 -0
- package/lib/open-DXxlFxS0.d.ts +27 -0
- package/lib/pattern-router-DlkDNR9e.js +41 -0
- package/lib/powered-by-B9ufDvKH.js +24 -0
- package/lib/powered-by.d.ts +28 -0
- package/lib/powered-by.js +2 -0
- package/lib/pretty-json-B_5MzYgk.js +39 -0
- package/lib/pretty-json.d.ts +40 -0
- package/lib/pretty-json.js +2 -0
- package/lib/protocol-8HjYa5OX.js +217 -0
- package/lib/protocol-DdQgl224.d.ts +160 -0
- package/lib/proxy-C02n8qaX.js +121 -0
- package/lib/proxy.d.ts +72 -0
- package/lib/proxy.js +2 -0
- package/lib/quick.d.ts +8 -0
- package/lib/quick.js +17 -0
- package/lib/read-sse.d.ts +33 -0
- package/lib/read-sse.js +84 -0
- package/lib/reg-exp-router-DT_H6W_j.js +363 -0
- package/lib/request-PoZjfrb4.js +323 -0
- package/lib/request-id-CWyCgzyD.js +34 -0
- package/lib/request-id.d.ts +45 -0
- package/lib/request-id.js +2 -0
- package/lib/request.d.ts +2 -0
- package/lib/request.js +2 -0
- package/lib/route-D1WQ4cOh.js +126 -0
- package/lib/route.d.ts +78 -0
- package/lib/route.js +2 -0
- package/lib/router/linear-router.d.ts +11 -0
- package/lib/router/linear-router.js +2 -0
- package/lib/router/pattern-router.d.ts +11 -0
- package/lib/router/pattern-router.js +2 -0
- package/lib/router/reg-exp-router.d.ts +35 -0
- package/lib/router/reg-exp-router.js +2 -0
- package/lib/router/smart-router.d.ts +15 -0
- package/lib/router/smart-router.js +2 -0
- package/lib/router/trie-router.d.ts +11 -0
- package/lib/router/trie-router.js +2 -0
- package/lib/router-0TlTAMdt.d.ts +99 -0
- package/lib/router-wWGf3FlK.js +35 -0
- package/lib/router.d.ts +2 -0
- package/lib/router.js +2 -0
- package/lib/schema-validator-DGAFbTcN.js +22 -0
- package/lib/schema-validator.d.ts +54 -0
- package/lib/schema-validator.js +2 -0
- package/lib/secure-headers-eLrZcjSr.js +163 -0
- package/lib/secure-headers.d.ts +125 -0
- package/lib/secure-headers.js +2 -0
- package/lib/serve-static-D97E4ERX.d.ts +18 -0
- package/lib/serve-static-YoUetEZ8.js +212 -0
- package/lib/serve-static-cnLZvaYu.js +77 -0
- package/lib/serve-static.d.ts +2 -0
- package/lib/serve-static.js +2 -0
- package/lib/smart-router-BF56Yf23.js +49 -0
- package/lib/snapshot-text-Cyl69OKv.js +597 -0
- package/lib/src-6T1gCSq3.js +427 -0
- package/lib/src-BycZ1HUQ.js +407 -0
- package/lib/src-CZ1JoBaO.js +90 -0
- package/lib/src-C_00jcuj.js +85 -0
- package/lib/ssg-D_StqyTO.js +389 -0
- package/lib/ssg.d.ts +2 -0
- package/lib/ssg.js +2 -0
- package/lib/stream-CJ_0BMG2.js +88 -0
- package/lib/stream-Oxo9JHC6.d.ts +34 -0
- package/lib/streaming-CL2i3hX_.js +96 -0
- package/lib/streaming.d.ts +23 -0
- package/lib/streaming.js +2 -0
- package/lib/testing-DnLmBGle.js +17 -0
- package/lib/testing.d.ts +10 -0
- package/lib/testing.js +2 -0
- package/lib/timeout-Bib1sxFc.js +42 -0
- package/lib/timeout.d.ts +30 -0
- package/lib/timeout.js +2 -0
- package/lib/timing-CkkBmV23.js +183 -0
- package/lib/timing.d.ts +130 -0
- package/lib/timing.js +2 -0
- package/lib/tiny.d.ts +8 -0
- package/lib/tiny.js +15 -0
- package/lib/trailing-slash-qJLAJrAH.js +85 -0
- package/lib/trailing-slash.d.ts +91 -0
- package/lib/trailing-slash.js +2 -0
- package/lib/transpile-Bc6rZPK-.js +105 -0
- package/lib/trie-router-DhF3wn5_.js +146 -0
- package/lib/types-Zy1OzMX7.d.ts +29 -0
- package/lib/types-akvg9vbH.d.ts +40 -0
- package/lib/types-cu7acft5.d.ts +195 -0
- package/lib/types-nO2Jov17.d.ts +114 -0
- package/lib/types.d.ts +2 -0
- package/lib/types.js +4 -0
- package/lib/upgrade-hub-7og-sHcQ.d.ts +138 -0
- package/lib/upgrade-hub-B4hca91Y.js +1554 -0
- package/lib/url-Cyyh7Fiw.js +197 -0
- package/lib/utils/accept.d.ts +9 -0
- package/lib/utils/accept.js +2 -0
- package/lib/utils/basic-auth.d.ts +8 -0
- package/lib/utils/basic-auth.js +2 -0
- package/lib/utils/body.d.ts +2 -0
- package/lib/utils/body.js +2 -0
- package/lib/utils/buffer.d.ts +19 -0
- package/lib/utils/buffer.js +2 -0
- package/lib/utils/color.d.ts +24 -0
- package/lib/utils/color.js +2 -0
- package/lib/utils/compress.d.ts +2 -0
- package/lib/utils/compress.js +2 -0
- package/lib/utils/concurrent.d.ts +17 -0
- package/lib/utils/concurrent.js +2 -0
- package/lib/utils/constants.d.ts +7 -0
- package/lib/utils/constants.js +2 -0
- package/lib/utils/cookie.d.ts +2 -0
- package/lib/utils/cookie.js +2 -0
- package/lib/utils/crypto.d.ts +14 -0
- package/lib/utils/crypto.js +2 -0
- package/lib/utils/encode.d.ts +11 -0
- package/lib/utils/encode.js +2 -0
- package/lib/utils/filepath.d.ts +14 -0
- package/lib/utils/filepath.js +25 -0
- package/lib/utils/handler.d.ts +9 -0
- package/lib/utils/handler.js +2 -0
- package/lib/utils/headers.d.ts +2 -0
- package/lib/utils/headers.js +1 -0
- package/lib/utils/html.d.ts +2 -0
- package/lib/utils/html.js +2 -0
- package/lib/utils/http-status.d.ts +2 -0
- package/lib/utils/http-status.js +1 -0
- package/lib/utils/ipaddr.d.ts +56 -0
- package/lib/utils/ipaddr.js +2 -0
- package/lib/utils/jwt.d.ts +24 -0
- package/lib/utils/jwt.js +2 -0
- package/lib/utils/mime.d.ts +2 -0
- package/lib/utils/mime.js +2 -0
- package/lib/utils/stream.d.ts +2 -0
- package/lib/utils/stream.js +2 -0
- package/lib/utils/types.d.ts +2 -0
- package/lib/utils/types.js +1 -0
- package/lib/utils/url.d.ts +46 -0
- package/lib/utils/url.js +2 -0
- package/lib/utils-CYdUlhw1.js +125 -0
- package/lib/utils-CnUrxRO-.js +4 -0
- package/lib/validator-DkpCsiJC.js +65 -0
- package/lib/validator.d.ts +42 -0
- package/lib/validator.js +2 -0
- package/lib/vitest-binding-CctNu3jT.d.ts +15 -0
- package/lib/vitest-binding-CrH7rKg2.js +17 -0
- package/lib/websocket-Cy4jtqHv.js +56 -0
- package/lib/ws.d.ts +2 -0
- package/lib/ws.js +2 -0
- package/package.json +463 -3
- package/shared/AGENTS.core.md +84 -0
- package/shared/DEFAULTS.md +49 -0
- package/shared/library-history-versions.json +48 -0
- package/shared/library-history.json +786 -0
- package/shared/skills/acryl-add-ui/SKILL.md +19 -0
- package/shared/skills/acryl-app/SKILL.md +13 -0
- package/shared/skills/acryl-build-plugin/SKILL.md +22 -0
- package/shared/skills/acryl-change-plugin/SKILL.md +14 -0
- package/shared/skills/acryl-diagnose-plugin/SKILL.md +13 -0
- package/shared/skills/acryl-fix-plugin/SKILL.md +13 -0
- package/shared/skills/acryl-remove-plugin/SKILL.md +12 -0
- package/shared/skills/acryl-share-plugin/SKILL.md +16 -0
- package/shared/skills/cordis-plugin/SKILL.md +26 -0
- package/templates/agent/.gitattributes +2 -0
- package/templates/agent/AGENTS.md +20 -0
- package/templates/agent/Dockerfile +15 -0
- package/templates/agent/README.md +52 -0
- package/templates/agent/blend.yaml +71 -0
- package/templates/agent/dockerignore +3 -0
- package/templates/agent/gitignore +6 -0
- package/templates/agent/package.json +31 -0
- package/templates/agent/src/app.ts +293 -0
- package/templates/agent/src/frame.ts +17 -0
- package/templates/agent/src/main.ts +27 -0
- package/templates/agent/src/routes.ts +163 -0
- package/templates/agent/template.json +22 -0
- package/templates/agent/test/agent.test.ts +51 -0
- package/templates/agent/test/app.test.ts +270 -0
- package/templates/agent/test/builder.test.ts +210 -0
- package/templates/agent/test/model.test.ts +94 -0
- package/templates/agent/tsconfig.json +68 -0
- package/templates/blank/.gitattributes +2 -0
- package/templates/blank/AGENTS.md +6 -0
- package/templates/blank/README.md +26 -0
- package/templates/blank/blend.yaml +37 -0
- package/templates/blank/gitignore +6 -0
- package/templates/blank/package.json +31 -0
- package/templates/blank/src/about.tsx +14 -0
- package/templates/blank/src/app.ts +160 -0
- package/templates/blank/src/door.ts +7 -0
- package/templates/blank/src/first-page.ts +5 -0
- package/templates/blank/src/frame.ts +17 -0
- package/templates/blank/src/main.ts +20 -0
- package/templates/blank/src/routes.ts +79 -0
- package/templates/blank/template.json +15 -0
- package/templates/blank/test/app.test.ts +177 -0
- package/templates/blank/tsconfig.json +19 -0
- package/templates/chat/.gitattributes +2 -0
- package/templates/chat/AGENTS.md +16 -0
- package/templates/chat/blend.yaml +36 -0
- package/templates/chat/gitignore +9 -0
- package/templates/chat/migrations/001-chat.sql +12 -0
- package/templates/chat/package.json +35 -0
- package/templates/chat/src/access.ts +110 -0
- package/templates/chat/src/app.ts +165 -0
- package/templates/chat/src/chat-app.ts +120 -0
- package/templates/chat/src/client/chat.tsx +117 -0
- package/templates/chat/src/client/tsconfig.json +26 -0
- package/templates/chat/src/db.ts +43 -0
- package/templates/chat/src/door.ts +7 -0
- package/templates/chat/src/frame.ts +17 -0
- package/templates/chat/src/llm.ts +48 -0
- package/templates/chat/src/main.ts +23 -0
- package/templates/chat/src/page.tsx +42 -0
- package/templates/chat/src/routes.ts +29 -0
- package/templates/chat/src/runtime.ts +23 -0
- package/templates/chat/template.json +15 -0
- package/templates/chat/test/chat.test.ts +322 -0
- package/templates/chat/test/server.test.ts +92 -0
- package/templates/chat/tsconfig.json +20 -0
- package/templates/nodejs/.gitattributes +2 -0
- package/templates/nodejs/AGENTS.md +9 -0
- package/templates/nodejs/blend.yaml +33 -0
- package/templates/nodejs/gitignore +6 -0
- package/templates/nodejs/package.json +32 -0
- package/templates/nodejs/src/app.ts +158 -0
- package/templates/nodejs/src/client/counter.tsx +12 -0
- package/templates/nodejs/src/client/tsconfig.json +26 -0
- package/templates/nodejs/src/door.ts +7 -0
- package/templates/nodejs/src/frame.ts +17 -0
- package/templates/nodejs/src/main.ts +20 -0
- package/templates/nodejs/src/page.tsx +29 -0
- package/templates/nodejs/src/routes.ts +59 -0
- package/templates/nodejs/template.json +14 -0
- package/templates/nodejs/test/app.test.ts +112 -0
- package/templates/nodejs/test/server.test.ts +97 -0
- package/templates/nodejs/tsconfig.json +20 -0
- package/templates/notes/.gitattributes +2 -0
- package/templates/notes/AGENTS.md +26 -0
- package/templates/notes/blend.yaml +36 -0
- package/templates/notes/gitignore +9 -0
- package/templates/notes/migrations/001-notes.sql +18 -0
- package/templates/notes/package.json +35 -0
- package/templates/notes/src/app.ts +165 -0
- package/templates/notes/src/auth.ts +57 -0
- package/templates/notes/src/client/counter.tsx +21 -0
- package/templates/notes/src/client/tsconfig.json +26 -0
- package/templates/notes/src/db.ts +50 -0
- package/templates/notes/src/door.ts +7 -0
- package/templates/notes/src/frame.ts +17 -0
- package/templates/notes/src/main.ts +23 -0
- package/templates/notes/src/notes-app.ts +212 -0
- package/templates/notes/src/routes.ts +21 -0
- package/templates/notes/src/runtime.ts +23 -0
- package/templates/notes/src/schema.ts +38 -0
- package/templates/notes/src/views.tsx +145 -0
- package/templates/notes/template.json +15 -0
- package/templates/notes/test/notes.test.ts +318 -0
- package/templates/notes/test/server.test.ts +92 -0
- package/templates/notes/tsconfig.json +20 -0
- package/templates/todo/.gitattributes +2 -0
- package/templates/todo/AGENTS.md +5 -0
- package/templates/todo/README.md +27 -0
- package/templates/todo/blend.yaml +28 -0
- package/templates/todo/gitignore +6 -0
- package/templates/todo/package.json +31 -0
- package/templates/todo/src/app.ts +145 -0
- package/templates/todo/src/door.ts +7 -0
- package/templates/todo/src/frame.ts +17 -0
- package/templates/todo/src/main.ts +21 -0
- package/templates/todo/src/page.ts +35 -0
- package/templates/todo/src/todo.ts +137 -0
- package/templates/todo/template.json +14 -0
- package/templates/todo/test/todo.test.ts +228 -0
- package/templates/todo/tsconfig.json +19 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { B as NotFoundHandler, E as H, y as ErrorHandler } from "./context-Ca3uX_bh.js";
|
|
2
|
+
import { t as ConnectionInfo } from "./connection-CzRPq1RP.js";
|
|
3
|
+
import { n as UpgradeWebSocket } from "./index-C8xOqNUW.js";
|
|
4
|
+
import { Context, Service } from "@deepseek-ai/cordis";
|
|
5
|
+
import z from "@deepseek-ai/schemastery";
|
|
6
|
+
|
|
7
|
+
//#region ../../../plugins/router/src/service.d.ts
|
|
8
|
+
/** How a trailing slash is read: `strict` keeps `/a` and `/a/` distinct, `ignore` treats them as one path. */
|
|
9
|
+
type TrailingSlash = 'strict' | 'ignore';
|
|
10
|
+
/** Validated plugin configuration. */
|
|
11
|
+
interface Config {
|
|
12
|
+
trailingSlash: TrailingSlash;
|
|
13
|
+
disposeGraceMs: number;
|
|
14
|
+
}
|
|
15
|
+
/** Every field has a default, so a caller passes only what it changes: `ctx.plugin(plugin, { ... })` takes the partial shape. */
|
|
16
|
+
declare const Config: z<Partial<Config>, Config>;
|
|
17
|
+
/**
|
|
18
|
+
* The Web adapter's service (`ctx.routerHttp`, provided by `@acryldev/router-http`). Declared here, beside `router`, so a plugin can ask for its routes to be
|
|
19
|
+
* served over HTTP without depending on the adapter package.
|
|
20
|
+
*/
|
|
21
|
+
interface RouterHttpService {
|
|
22
|
+
/**
|
|
23
|
+
* Serve `prefix` and everything below it through the router; returns a remover. The mount also goes away when the calling plugin unloads.
|
|
24
|
+
* `options.upgrade` lists the exact paths below the prefix that may be upgraded to a WebSocket (each must be inside the prefix); no other path of the mount accepts an upgrade.
|
|
25
|
+
*/
|
|
26
|
+
mount(prefix: string, options?: {
|
|
27
|
+
readonly upgrade?: readonly string[];
|
|
28
|
+
}): () => void;
|
|
29
|
+
/**
|
|
30
|
+
* `upgradeWebSocket` for the calling plugin: `app.get('/terminal', upgrade((c) => ({ onMessage(event, ws) { ... } })))` on a route the plugin mounted with `upgrade: ['/terminal']`.
|
|
31
|
+
* Checks go in ordinary middleware on the route; a handler that returns a `Response` refuses with that status before any handshake. The sockets it accepts belong to the calling
|
|
32
|
+
* plugin: when it unloads they are closed with 1001 and the handler sees `close` once. Needs the `ws` package.
|
|
33
|
+
*/
|
|
34
|
+
upgrades(): UpgradeWebSocket;
|
|
35
|
+
/** How many WebSocket connections are open now. */
|
|
36
|
+
readonly sockets: number;
|
|
37
|
+
}
|
|
38
|
+
declare module '@deepseek-ai/cordis' {
|
|
39
|
+
interface Context {
|
|
40
|
+
router: Router;
|
|
41
|
+
routerHttp: RouterHttpService;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Stable Cordis plugin name, equal to the package name and the Loader row id. */
|
|
45
|
+
declare const name = "acryl-router";
|
|
46
|
+
/**
|
|
47
|
+
* What {@link Router.route} takes: any app with routes, read structurally. An `Acryl` from this package qualifies, and so does one built from
|
|
48
|
+
* another copy of the framework (the published `acrylblends`), whose classes TypeScript would refuse nominally for their private members:
|
|
49
|
+
* mounting copies the app's routes (and keeps its own `onError`), which is all the router reads. Their handlers are then called with this
|
|
50
|
+
* router's `Context`, which has the same shape.
|
|
51
|
+
*/
|
|
52
|
+
interface MountableApp {
|
|
53
|
+
readonly routes: readonly MountableRoute[];
|
|
54
|
+
}
|
|
55
|
+
/** One route of a {@link MountableApp}, as the core lists it. A handler of any context type fits (`never` parameters accept every function). */
|
|
56
|
+
interface MountableRoute {
|
|
57
|
+
readonly basePath: string;
|
|
58
|
+
readonly path: string;
|
|
59
|
+
readonly method: string;
|
|
60
|
+
readonly handler: (c: never, next: never) => unknown;
|
|
61
|
+
}
|
|
62
|
+
declare class Router extends Service {
|
|
63
|
+
/** Everything that changes after construction, kept in one object so the service's live state is in one place. */
|
|
64
|
+
private readonly state;
|
|
65
|
+
private readonly flights;
|
|
66
|
+
/** The flight of each request the router dispatched, keyed by the request its handlers see as `c.req.raw`. */
|
|
67
|
+
private readonly flightOf;
|
|
68
|
+
private readonly strict;
|
|
69
|
+
private readonly graceMs;
|
|
70
|
+
private readonly logError;
|
|
71
|
+
constructor(ctx: Context, config?: Partial<Config>);
|
|
72
|
+
/** Registrations currently held (mounts, and the router-wide error and not-found handlers); a leak check for reload tests. */
|
|
73
|
+
get size(): number;
|
|
74
|
+
/**
|
|
75
|
+
* Serve `app` under `path` (`'/'` for its own paths as they are). The mount belongs to the calling plugin and goes away when it unloads;
|
|
76
|
+
* the returned function removes it sooner. Mounts are composed in the order they were made. Like the core's own `app.route`, the routes
|
|
77
|
+
* are copied now: one the app registers after this call is not served (mount again, or finish the app first).
|
|
78
|
+
*/
|
|
79
|
+
route(path: string, app: MountableApp): () => void;
|
|
80
|
+
/**
|
|
81
|
+
* Run `middleware` around every request the router serves, whenever the plugin that asks was mounted: a middleware in a plain mount wraps only the routes mounted after it,
|
|
82
|
+
* which is the wrong tool for a plugin that must see every page (the door adds its script to each HTML response, the pages of a plugin that loaded earlier included). It goes
|
|
83
|
+
* outside all mounts, in the order wrappers were added, and goes away when the calling plugin unloads or when the returned function is called.
|
|
84
|
+
*/
|
|
85
|
+
wrap(middleware: H): () => void;
|
|
86
|
+
/**
|
|
87
|
+
* The mount's own copy of `app`'s routes as they are now (like the core's `app.route`), each handler wrapped so the router knows which
|
|
88
|
+
* mount's code a request is in. The core's `app.route` runs first so a sub-app's own `onError` still applies to its routes.
|
|
89
|
+
*/
|
|
90
|
+
private snapshot;
|
|
91
|
+
/**
|
|
92
|
+
* The router's own disposal: let the flights already in flight finish within `disposeGraceMs` - a save being written when the app stops must not be cut
|
|
93
|
+
* by the router beneath it - then abort what is left and settle it for a moment, so disposal does not wait a second full grace on code that ignores
|
|
94
|
+
* its abort signal.
|
|
95
|
+
*/
|
|
96
|
+
private drain;
|
|
97
|
+
/** The one draining rule: let `flights` finish inside the grace, then abort and settle what is left. */
|
|
98
|
+
private drainFlights;
|
|
99
|
+
/** Resolve true when every flight settled inside `ms`, false at the deadline. */
|
|
100
|
+
private settledWithin;
|
|
101
|
+
/** Abort `flights`, cut their bodies short and wait for them to settle, at most `settleMs`. */
|
|
102
|
+
private end;
|
|
103
|
+
/** Turn errors no mounted app handled into responses. One handler per router; the calling plugin owns it. */
|
|
104
|
+
onError(handler: ErrorHandler): () => void;
|
|
105
|
+
/** Answer requests no route claimed. One handler per router; the calling plugin owns it. */
|
|
106
|
+
notFound(handler: NotFoundHandler): () => void;
|
|
107
|
+
/**
|
|
108
|
+
* Call the router the way a test calls an app: a path or URL string, a `URL` or a `Request`, with the usual init.
|
|
109
|
+
* A relative path is resolved against `http://localhost`.
|
|
110
|
+
*/
|
|
111
|
+
request(input: string | URL | Request, init?: RequestInit, connection?: ConnectionInfo): Promise<Response>;
|
|
112
|
+
/**
|
|
113
|
+
* Run a request in process. Never throws: failures become a 500, a disposed router answers 503. `connection` describes the transport
|
|
114
|
+
* (an HTTP adapter passes the socket's peer address and local port); an in-process caller omits it. Handlers read it with
|
|
115
|
+
* `connectionOf(c)`, abort with `c.req.raw.signal` and keep the request in flight with `c.executionCtx.waitUntil(task)`.
|
|
116
|
+
* `bindings` is an object an adapter hands to the handler as `c.env` (an upgrade request's socket hooks, for `upgradeWebSocket`); `connection` is added to it.
|
|
117
|
+
*/
|
|
118
|
+
fetch(request: Request, connection?: ConnectionInfo, bindings?: object): Promise<Response>;
|
|
119
|
+
private dispatch;
|
|
120
|
+
private app;
|
|
121
|
+
/**
|
|
122
|
+
* Hand the caller a body the router can end. Reading it passes the handler's chunks through; disposal cancels the handler's stream (which runs
|
|
123
|
+
* the stream helpers' own abort cleanup) and closes the caller's side, so a stream never outlives the plugin that served it.
|
|
124
|
+
*/
|
|
125
|
+
private track;
|
|
126
|
+
}
|
|
127
|
+
declare function apply(ctx: Context, config?: Partial<Config>): void;
|
|
128
|
+
//#endregion
|
|
129
|
+
export { TrailingSlash as a, RouterHttpService as i, MountableApp as n, apply as o, Router as r, name as s, Config as t };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { t as Db } from "./database-CyKvumAn.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../../plugins/db/src/facade/migrations.d.ts
|
|
4
|
+
type Migration = {
|
|
5
|
+
readonly version: number;
|
|
6
|
+
readonly statements: readonly string[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Apply all pending migrations atomically, tracking their version in the named metadata table.
|
|
10
|
+
*
|
|
11
|
+
* The bookkeeping SQL runs unchanged on SQLite and Postgres: no `STRICT` table, `ON CONFLICT DO NOTHING`
|
|
12
|
+
* instead of `INSERT OR IGNORE`, and the version written as a checked integer rather than a binding,
|
|
13
|
+
* since the two dialects spell placeholders differently.
|
|
14
|
+
*/
|
|
15
|
+
declare function applyMigrations(database: Db, migrations: readonly Migration[], options: {
|
|
16
|
+
readonly table: string;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region ../../../plugins/db/src/facade/schema.d.ts
|
|
20
|
+
/** Validate a prefix before using it as part of a SQL identifier. */
|
|
21
|
+
declare function validateSchemaPrefix(prefix: string): void;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region ../../../plugins/db/src/migration-files.d.ts
|
|
24
|
+
/**
|
|
25
|
+
* Read every `NNN-name.sql` file of a folder, in number order.
|
|
26
|
+
* @throws when a `.sql` file is not named `NNN-name.sql`, or the numbers do not run 1, 2, 3, ... without gaps or repeats.
|
|
27
|
+
*/
|
|
28
|
+
declare function readMigrationFiles(folder: string | URL): Promise<Migration[]>;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region ../../../plugins/db/src/index.d.ts
|
|
31
|
+
/**
|
|
32
|
+
* The `db` port: what an app's code sees of its relational database, whichever provider (`@acryldev/db-sqlite`, `@acryldev/db-postgres`) serves
|
|
33
|
+
* it. Plain code (an acrylblends app) opens a database with a provider's `openDb`; a Cordis plugin declares `inject: ['db']`, imports
|
|
34
|
+
* `@acryldev/db/cordis` for the `ctx.db` type, and never imports a driver.
|
|
35
|
+
*
|
|
36
|
+
* Bindings are positional `?` placeholders on every provider; a provider whose database spells them differently translates them.
|
|
37
|
+
* This entry imports nothing from Cordis, at runtime or in its types.
|
|
38
|
+
*/
|
|
39
|
+
/** The service name every `db` provider registers. */
|
|
40
|
+
declare const DB_SERVICE = "db";
|
|
41
|
+
/** The table that records an app's migration version. */
|
|
42
|
+
declare const MIGRATIONS_TABLE = "_migrations";
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Migration as a, validateSchemaPrefix as i, MIGRATIONS_TABLE as n, applyMigrations as o, readMigrationFiles as r, DB_SERVICE as t };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { L as MiddlewareHandler, Y as Schema, t as Context, v as Env } from "./context-Ca3uX_bh.js";
|
|
2
|
+
import { t as Acryl } from "./app-DGqSNBSd.js";
|
|
3
|
+
|
|
4
|
+
//#region ../../../plugins/router/src/core/helper/ssg/ssg.d.ts
|
|
5
|
+
declare const DEFAULT_OUTPUT_DIR = "./static";
|
|
6
|
+
/**
|
|
7
|
+
* @experimental
|
|
8
|
+
* `FileSystemModule` is an experimental feature.
|
|
9
|
+
* The API might be changed.
|
|
10
|
+
*/
|
|
11
|
+
interface FileSystemModule {
|
|
12
|
+
writeFile(path: string, data: string | Uint8Array): Promise<void>;
|
|
13
|
+
mkdir(path: string, options: {
|
|
14
|
+
recursive: boolean;
|
|
15
|
+
}): Promise<void | string>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @experimental
|
|
19
|
+
* `ToSSGResult` is an experimental feature.
|
|
20
|
+
* The API might be changed.
|
|
21
|
+
*/
|
|
22
|
+
interface ToSSGResult {
|
|
23
|
+
success: boolean;
|
|
24
|
+
files: string[];
|
|
25
|
+
error?: Error;
|
|
26
|
+
}
|
|
27
|
+
declare const defaultExtensionMap: Record<string, string>;
|
|
28
|
+
type BeforeRequestHook = (req: Request) => Request | false | Promise<Request | false>;
|
|
29
|
+
type AfterResponseHook = (res: Response) => Response | false | Promise<Response | false>;
|
|
30
|
+
type AfterGenerateHook = (result: ToSSGResult, fsModule: FileSystemModule, options?: ToSSGOptions) => void | Promise<void>;
|
|
31
|
+
declare const combineBeforeRequestHooks: (hooks: BeforeRequestHook | BeforeRequestHook[]) => BeforeRequestHook;
|
|
32
|
+
declare const combineAfterResponseHooks: (hooks: AfterResponseHook | AfterResponseHook[]) => AfterResponseHook;
|
|
33
|
+
declare const combineAfterGenerateHooks: (hooks: AfterGenerateHook | AfterGenerateHook[], fsModule: FileSystemModule, options?: ToSSGOptions) => AfterGenerateHook;
|
|
34
|
+
interface SSGPlugin {
|
|
35
|
+
beforeRequestHook?: BeforeRequestHook | BeforeRequestHook[];
|
|
36
|
+
afterResponseHook?: AfterResponseHook | AfterResponseHook[];
|
|
37
|
+
afterGenerateHook?: AfterGenerateHook | AfterGenerateHook[];
|
|
38
|
+
}
|
|
39
|
+
interface ToSSGOptions {
|
|
40
|
+
dir?: string;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Use plugins[].beforeRequestHook instead.
|
|
43
|
+
*/
|
|
44
|
+
beforeRequestHook?: BeforeRequestHook | BeforeRequestHook[];
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Use plugins[].afterResponseHook instead.
|
|
47
|
+
*/
|
|
48
|
+
afterResponseHook?: AfterResponseHook | AfterResponseHook[];
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated Use plugins[].afterGenerateHook instead.
|
|
51
|
+
*/
|
|
52
|
+
afterGenerateHook?: AfterGenerateHook | AfterGenerateHook[];
|
|
53
|
+
concurrency?: number;
|
|
54
|
+
extensionMap?: Record<string, string>;
|
|
55
|
+
plugins?: SSGPlugin[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @experimental
|
|
59
|
+
* `fetchRoutesContent` is an experimental feature.
|
|
60
|
+
* The API might be changed.
|
|
61
|
+
*/
|
|
62
|
+
declare const fetchRoutesContent: <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Acryl<E, S, BasePath>, beforeRequestHook?: BeforeRequestHook, afterResponseHook?: AfterResponseHook, concurrency?: number) => Generator<Promise<Generator<Promise<{
|
|
63
|
+
routePath: string;
|
|
64
|
+
mimeType: string;
|
|
65
|
+
content: string | ArrayBuffer;
|
|
66
|
+
} | undefined>> | undefined>>;
|
|
67
|
+
declare const saveContentToFile: (data: Promise<{
|
|
68
|
+
routePath: string;
|
|
69
|
+
content: string | ArrayBuffer;
|
|
70
|
+
mimeType: string;
|
|
71
|
+
} | undefined>, fsModule: FileSystemModule, outDir: string, extensionMap?: Record<string, string>) => Promise<string | undefined>;
|
|
72
|
+
/**
|
|
73
|
+
* @experimental
|
|
74
|
+
* `ToSSGInterface` is an experimental feature.
|
|
75
|
+
* The API might be changed.
|
|
76
|
+
*/
|
|
77
|
+
interface ToSSGInterface {
|
|
78
|
+
(app: Acryl<any, any, any>, fsModule: FileSystemModule, options?: ToSSGOptions): Promise<ToSSGResult>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @experimental
|
|
82
|
+
* `ToSSGAdaptorInterface` is an experimental feature.
|
|
83
|
+
* The API might be changed.
|
|
84
|
+
*/
|
|
85
|
+
interface ToSSGAdaptorInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/'> {
|
|
86
|
+
(app: Acryl<E, S, BasePath>, options?: ToSSGOptions): Promise<ToSSGResult>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @experimental
|
|
90
|
+
* `toSSG` is an experimental feature.
|
|
91
|
+
* The API might be changed.
|
|
92
|
+
*/
|
|
93
|
+
declare const toSSG: ToSSGInterface;
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region ../../../plugins/router/src/core/helper/ssg/middleware.d.ts
|
|
96
|
+
declare const X_ACRYL_DISABLE_SSG_HEADER_KEY = "x-acryl-disable-ssg";
|
|
97
|
+
interface SSGParam {
|
|
98
|
+
[key: string]: string;
|
|
99
|
+
}
|
|
100
|
+
type SSGParams = SSGParam[];
|
|
101
|
+
interface SSGParamsMiddleware {
|
|
102
|
+
<E extends Env = Env>(generateParams: (c: Context<E>) => SSGParams | Promise<SSGParams>): MiddlewareHandler<E>;
|
|
103
|
+
<E extends Env = Env>(params: SSGParams): MiddlewareHandler<E>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Define SSG Route
|
|
107
|
+
*/
|
|
108
|
+
declare const ssgParams: SSGParamsMiddleware;
|
|
109
|
+
/**
|
|
110
|
+
* @experimental
|
|
111
|
+
* `isSSGContext` is an experimental feature.
|
|
112
|
+
* The API might be changed.
|
|
113
|
+
*/
|
|
114
|
+
declare const isSSGContext: (c: Context) => boolean;
|
|
115
|
+
/**
|
|
116
|
+
* @experimental
|
|
117
|
+
* `disableSSG` is an experimental feature.
|
|
118
|
+
* The API might be changed.
|
|
119
|
+
*/
|
|
120
|
+
declare const disableSSG: () => MiddlewareHandler;
|
|
121
|
+
/**
|
|
122
|
+
* @experimental
|
|
123
|
+
* `onlySSG` is an experimental feature.
|
|
124
|
+
* The API might be changed.
|
|
125
|
+
*/
|
|
126
|
+
declare const onlySSG: () => MiddlewareHandler;
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region ../../../plugins/router/src/core/helper/ssg/plugins.d.ts
|
|
129
|
+
/**
|
|
130
|
+
* The default plugin that defines the recommended behavior.
|
|
131
|
+
*
|
|
132
|
+
* @experimental
|
|
133
|
+
* `defaultPlugin` is an experimental feature.
|
|
134
|
+
* The API might be changed.
|
|
135
|
+
*/
|
|
136
|
+
declare const defaultPlugin: () => SSGPlugin;
|
|
137
|
+
/**
|
|
138
|
+
* The redirect plugin that generates HTML redirect pages for HTTP redirect responses for status codes 301, 302, 303, 307 and 308.
|
|
139
|
+
*
|
|
140
|
+
* When used with `defaultPlugin`, place `redirectPlugin` before it, because `defaultPlugin` skips non-200 responses.
|
|
141
|
+
*
|
|
142
|
+
* ```ts
|
|
143
|
+
* // ✅ Will work as expected
|
|
144
|
+
* toSSG(app, fs, { plugins: [redirectPlugin(), defaultPlugin()] })
|
|
145
|
+
*
|
|
146
|
+
* // ❌ Will not work as expected
|
|
147
|
+
* toSSG(app, fs, { plugins: [defaultPlugin(), redirectPlugin()] })
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @experimental
|
|
151
|
+
* `redirectPlugin` is an experimental feature.
|
|
152
|
+
* The API might be changed.
|
|
153
|
+
*/
|
|
154
|
+
declare const redirectPlugin: () => SSGPlugin;
|
|
155
|
+
//#endregion
|
|
156
|
+
export { saveContentToFile as C, fetchRoutesContent as S, ToSSGResult as _, isSSGContext as a, combineBeforeRequestHooks as b, AfterGenerateHook as c, DEFAULT_OUTPUT_DIR as d, FileSystemModule as f, ToSSGOptions as g, ToSSGInterface as h, disableSSG as i, AfterResponseHook as l, ToSSGAdaptorInterface as m, redirectPlugin as n, onlySSG as o, SSGPlugin as p, X_ACRYL_DISABLE_SSG_HEADER_KEY as r, ssgParams as s, defaultPlugin as t, BeforeRequestHook as u, combineAfterGenerateHooks as v, toSSG as w, defaultExtensionMap as x, combineAfterResponseHooks as y };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { C as PropsWithChildren, G as useRef, Q as FallbackRender, Z as ErrorHandler, k as RefObject, t as Context } from "./context-Dre4P1UW.js";
|
|
2
|
+
import { a as JSX, o as JSXNode, r as FC, s as Props, t as Child } from "./base-N-QVQhMZ.js";
|
|
3
|
+
|
|
4
|
+
//#region ../../../plugins/router/src/core/jsx/dom/components.d.ts
|
|
5
|
+
declare const ErrorBoundary: FC<PropsWithChildren<{
|
|
6
|
+
fallback?: Child;
|
|
7
|
+
fallbackRender?: FallbackRender;
|
|
8
|
+
onError?: ErrorHandler;
|
|
9
|
+
}>>;
|
|
10
|
+
declare const Suspense: FC<PropsWithChildren<{
|
|
11
|
+
fallback: any;
|
|
12
|
+
}>>;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region ../../../plugins/router/src/core/jsx/dom/context.d.ts
|
|
15
|
+
declare const createContext: <T>(defaultValue: T) => Context<T>;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region ../../../plugins/router/src/core/jsx/dom/render.d.ts
|
|
18
|
+
type Container = HTMLElement | DocumentFragment;
|
|
19
|
+
declare const render: (jsxNode: Child, container: Container) => void;
|
|
20
|
+
declare const flushSync: (callback: () => void) => void;
|
|
21
|
+
declare const createPortal: (children: Child, container: HTMLElement, key?: string) => Child;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region ../../../plugins/router/src/core/jsx/dom/index.d.ts
|
|
24
|
+
declare const createElement: (tag: string | ((props: Props) => JSXNode), props: Props | null, ...children: Child[]) => JSXNode;
|
|
25
|
+
declare const cloneElement: <T extends JSXNode | JSX.Element>(element: T, props: Props, ...children: Child[]) => T;
|
|
26
|
+
declare const memo: <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean) => FC<T>;
|
|
27
|
+
declare const _default: {
|
|
28
|
+
version: string;
|
|
29
|
+
useState: {
|
|
30
|
+
<T>(initialState: T | (() => T)): [T, (newState: T | ((currentState: T) => T)) => void];
|
|
31
|
+
<T = undefined>(): [T | undefined, (newState: T | ((currentState: T | undefined) => T | undefined) | undefined) => void];
|
|
32
|
+
};
|
|
33
|
+
useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
34
|
+
useRef: typeof useRef;
|
|
35
|
+
useCallback: <T extends Function>(callback: T, deps: readonly unknown[]) => T;
|
|
36
|
+
use: <T>(promise: Promise<T>) => T;
|
|
37
|
+
startTransition: (callback: () => void) => void;
|
|
38
|
+
useTransition: () => [boolean, (callback: () => void | Promise<void>) => void];
|
|
39
|
+
useDeferredValue: <T>(value: T, initialValue?: T) => T;
|
|
40
|
+
startViewTransition: (callback: () => void) => void;
|
|
41
|
+
useViewTransition: () => [boolean, (callback: () => void) => void];
|
|
42
|
+
useMemo: <T>(factory: () => T, deps: readonly unknown[]) => T;
|
|
43
|
+
useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
44
|
+
useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
45
|
+
useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [T, (action: A) => void];
|
|
46
|
+
useId: () => string;
|
|
47
|
+
useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
|
|
48
|
+
createRef: <T>() => RefObject<T | null>;
|
|
49
|
+
forwardRef: <T, P = {}>(Component: (props: P, ref?: RefObject<T | null>) => JSX.Element) => ((props: P & {
|
|
50
|
+
ref?: RefObject<T | null>;
|
|
51
|
+
}) => JSX.Element);
|
|
52
|
+
useImperativeHandle: <T>(ref: RefObject<T | null>, createHandle: () => T, deps: readonly unknown[]) => void;
|
|
53
|
+
useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
|
|
54
|
+
useFormStatus: () => {
|
|
55
|
+
pending: false;
|
|
56
|
+
data: null;
|
|
57
|
+
method: null;
|
|
58
|
+
action: null;
|
|
59
|
+
} | {
|
|
60
|
+
pending: true;
|
|
61
|
+
data: FormData;
|
|
62
|
+
method: "get" | "post";
|
|
63
|
+
action: string | ((formData: FormData) => void | Promise<void>);
|
|
64
|
+
};
|
|
65
|
+
useActionState: <T>(fn: Function, initialState: T, permalink?: string) => [T, Function];
|
|
66
|
+
useOptimistic: <T, N>(state: T, updateState: (currentState: T, action: N) => T) => [T, (action: N) => void];
|
|
67
|
+
Suspense: FC<PropsWithChildren<{
|
|
68
|
+
fallback: any;
|
|
69
|
+
}>>;
|
|
70
|
+
ErrorBoundary: FC<PropsWithChildren<{
|
|
71
|
+
fallback?: Child;
|
|
72
|
+
fallbackRender?: FallbackRender;
|
|
73
|
+
onError?: ErrorHandler;
|
|
74
|
+
}>>;
|
|
75
|
+
createContext: <T>(defaultValue: T) => Context<T>;
|
|
76
|
+
useContext: <T>(context: Context<T>) => T;
|
|
77
|
+
memo: <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean) => FC<T>;
|
|
78
|
+
isValidElement: (element: unknown) => element is JSXNode;
|
|
79
|
+
createElement: (tag: string | ((props: Props) => JSXNode), props: Props | null, ...children: Child[]) => JSXNode;
|
|
80
|
+
cloneElement: <T extends JSXNode | JSX.Element>(element: T, props: Props, ...children: Child[]) => T;
|
|
81
|
+
Children: {
|
|
82
|
+
map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[];
|
|
83
|
+
forEach: (children: Child[], fn: (child: Child, index: number) => void) => void;
|
|
84
|
+
count: (children: Child[]) => number;
|
|
85
|
+
only: (_children: Child[]) => Child;
|
|
86
|
+
toArray: (children: Child) => Child[];
|
|
87
|
+
};
|
|
88
|
+
Fragment: (props: Record<string, unknown>) => JSXNode;
|
|
89
|
+
StrictMode: (props: Record<string, unknown>) => JSXNode;
|
|
90
|
+
flushSync: (callback: () => void) => void;
|
|
91
|
+
createPortal: (children: Child, container: HTMLElement, key?: string) => Child;
|
|
92
|
+
};
|
|
93
|
+
//#endregion
|
|
94
|
+
export { createPortal as a, createContext as c, memo as i, ErrorBoundary as l, cloneElement as n, flushSync as o, createElement as r, render as s, _default as t, Suspense as u };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { i as HtmlEscapedString } from "./html-CNr9FLdV.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../../plugins/router/src/core/helper/html/index.d.ts
|
|
4
|
+
declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => HtmlEscapedString | Promise<HtmlEscapedString>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { html as t };
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { B as NotFoundHandler, L as MiddlewareHandler, O as Handler, Q as ValidationTargets, V as NotFoundResponse, X as ToSchema, Y as Schema, Z as TypedResponse, a as ExecutionContext, j as Input, n as ContextRenderer, r as ContextVariableMap, s as AcrylRequest, t as Context, v as Env, y as ErrorHandler, z as Next } from "./context-Ca3uX_bh.js";
|
|
2
|
+
import { t as Acryl } from "./app-DGqSNBSd.js";
|
|
3
|
+
import { c as InferRequestType, i as ClientRequestOptions, l as InferResponseType } from "./types-cu7acft5.js";
|
|
4
|
+
export { Acryl, type AcrylRequest, type ClientRequestOptions, Context, type ContextRenderer, type ContextVariableMap, type Env, type ErrorHandler, type ExecutionContext, type Handler, type InferRequestType, type InferResponseType, type Input, type MiddlewareHandler, type Next, type NotFoundHandler, type NotFoundResponse, type Schema, type ToSchema, type TypedResponse, type ValidationTargets };
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { t as HTTPException } from "./http-exception-BKMYq4x6.js";
|
|
2
|
+
import { a as convertIPv6BinaryToString, i as convertIPv4ToBinary, l as isIPv4MappedIPv6, o as convertIPv6ToBinary, r as convertIPv4MappedIPv6ToIPv4, s as distinctRemoteAddr } from "./ipaddr-CTeN6kNw.js";
|
|
3
|
+
//#region ../../../plugins/router/src/core/middleware/ip-restriction/index.ts
|
|
4
|
+
const IS_CIDR_NOTATION_REGEX = /\/[^/]*$/;
|
|
5
|
+
const parseCidrPrefix = (rule, prefix, max) => {
|
|
6
|
+
if (!/^[0-9]{1,3}$/.test(prefix)) throw new TypeError(`Invalid rule: ${rule}`);
|
|
7
|
+
const parsedPrefix = parseInt(prefix);
|
|
8
|
+
if (parsedPrefix > max) throw new TypeError(`Invalid rule: ${rule}`);
|
|
9
|
+
return parsedPrefix;
|
|
10
|
+
};
|
|
11
|
+
const buildMatcher = (rules) => {
|
|
12
|
+
const functionRules = [];
|
|
13
|
+
const staticRules = /* @__PURE__ */ new Set();
|
|
14
|
+
const staticIPv4Rules = /* @__PURE__ */ new Set();
|
|
15
|
+
const staticIPv6Rules = /* @__PURE__ */ new Set();
|
|
16
|
+
const cidrRules = [];
|
|
17
|
+
const registerStaticRule = (rule) => {
|
|
18
|
+
const type = distinctRemoteAddr(rule);
|
|
19
|
+
if (type === void 0) throw new TypeError(`Invalid rule: ${rule}`);
|
|
20
|
+
if (type === "IPv4") {
|
|
21
|
+
const ipv4binary = convertIPv4ToBinary(rule);
|
|
22
|
+
staticRules.add(rule);
|
|
23
|
+
staticRules.add(`::ffff:${rule}`);
|
|
24
|
+
staticIPv4Rules.add(ipv4binary);
|
|
25
|
+
staticIPv6Rules.add(65535n << 32n | ipv4binary);
|
|
26
|
+
} else {
|
|
27
|
+
const ipv6binary = convertIPv6ToBinary(rule);
|
|
28
|
+
const ipv6Addr = convertIPv6BinaryToString(ipv6binary);
|
|
29
|
+
staticRules.add(ipv6Addr);
|
|
30
|
+
staticIPv6Rules.add(ipv6binary);
|
|
31
|
+
if (isIPv4MappedIPv6(ipv6binary)) {
|
|
32
|
+
staticRules.add(ipv6Addr.substring(7));
|
|
33
|
+
staticIPv4Rules.add(convertIPv4MappedIPv6ToIPv4(ipv6binary));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
for (let rule of rules) if (rule === "*") return () => true;
|
|
38
|
+
else if (typeof rule === "function") functionRules.push(rule);
|
|
39
|
+
else {
|
|
40
|
+
if (IS_CIDR_NOTATION_REGEX.test(rule)) {
|
|
41
|
+
const separatedRule = rule.split("/");
|
|
42
|
+
const addrStr = separatedRule[0];
|
|
43
|
+
const type = distinctRemoteAddr(addrStr);
|
|
44
|
+
if (type === void 0) throw new TypeError(`Invalid rule: ${rule}`);
|
|
45
|
+
let isIPv4 = type === "IPv4";
|
|
46
|
+
let prefix = parseCidrPrefix(rule, separatedRule[1], isIPv4 ? 32 : 128);
|
|
47
|
+
if (isIPv4 ? prefix === 32 : prefix === 128) rule = addrStr;
|
|
48
|
+
else {
|
|
49
|
+
let addr = (isIPv4 ? convertIPv4ToBinary : convertIPv6ToBinary)(addrStr);
|
|
50
|
+
if (type === "IPv6" && isIPv4MappedIPv6(addr) && prefix >= 96) {
|
|
51
|
+
isIPv4 = true;
|
|
52
|
+
addr = convertIPv4MappedIPv6ToIPv4(addr);
|
|
53
|
+
prefix -= 96;
|
|
54
|
+
}
|
|
55
|
+
const mask = (1n << BigInt(prefix)) - 1n << BigInt((isIPv4 ? 32 : 128) - prefix);
|
|
56
|
+
cidrRules.push([
|
|
57
|
+
isIPv4,
|
|
58
|
+
addr & mask,
|
|
59
|
+
mask
|
|
60
|
+
]);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
registerStaticRule(rule);
|
|
65
|
+
}
|
|
66
|
+
return (remote) => {
|
|
67
|
+
if (staticRules.has(remote.addr)) return true;
|
|
68
|
+
const remoteAddr = remote.binaryAddr ||= (remote.isIPv4 ? convertIPv4ToBinary : convertIPv6ToBinary)(remote.addr);
|
|
69
|
+
const remoteIPv4Addr = remote.isIPv4 || isIPv4MappedIPv6(remoteAddr) ? remote.isIPv4 ? remoteAddr : convertIPv4MappedIPv6ToIPv4(remoteAddr) : void 0;
|
|
70
|
+
if ((remote.isIPv4 ? staticIPv4Rules : staticIPv6Rules).has(remoteAddr)) return true;
|
|
71
|
+
for (const [isIPv4, addr, mask] of cidrRules) {
|
|
72
|
+
if (isIPv4) {
|
|
73
|
+
if (remoteIPv4Addr === void 0) continue;
|
|
74
|
+
if ((remoteIPv4Addr & mask) === addr) return true;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (remote.isIPv4) continue;
|
|
78
|
+
if ((remoteAddr & mask) === addr) return true;
|
|
79
|
+
}
|
|
80
|
+
for (const rule of functionRules) if (rule({
|
|
81
|
+
addr: remote.addr,
|
|
82
|
+
type: remote.type
|
|
83
|
+
})) return true;
|
|
84
|
+
return false;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* IP Restriction Middleware for Acryl.
|
|
89
|
+
*
|
|
90
|
+
*
|
|
91
|
+
* @param {GetConnInfo | ((c: Context) => string)} getIP - A function to retrieve the client IP address. Use `getConnInfo` from the appropriate runtime adapter.
|
|
92
|
+
* @param {IPRestrictionRules} rules - An object with optional `denyList` and `allowList` arrays of IP rules. Each rule can be a static IP, a CIDR range, or a custom function.
|
|
93
|
+
* @param {(remote: { addr: string; type: AddressType }, c: Context) => Response | Promise<Response>} [onError] - Optional custom handler invoked when a request is blocked. Defaults to returning a 403 Forbidden response.
|
|
94
|
+
* @returns {MiddlewareHandler} The middleware handler function.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* import { Acryl } from '@acryldev/blends'
|
|
99
|
+
* import { ipRestriction } from '@acryldev/blends/ip-restriction'
|
|
100
|
+
* import { getConnInfo } from '@acryldev/blends/cloudflare-workers'
|
|
101
|
+
*
|
|
102
|
+
* const app = new Acryl()
|
|
103
|
+
*
|
|
104
|
+
* app.use(
|
|
105
|
+
* '*',
|
|
106
|
+
* ipRestriction(getConnInfo, {
|
|
107
|
+
* // Block a specific IP and an entire subnet
|
|
108
|
+
* denyList: ['192.168.0.5', '10.0.0.0/8'],
|
|
109
|
+
* // Only allow requests from localhost and a private range
|
|
110
|
+
* allowList: ['127.0.0.1', '::1', '192.168.1.0/24'],
|
|
111
|
+
* })
|
|
112
|
+
* )
|
|
113
|
+
*
|
|
114
|
+
* // With a custom error handler
|
|
115
|
+
* app.use(
|
|
116
|
+
* '/admin/*',
|
|
117
|
+
* ipRestriction(
|
|
118
|
+
* getConnInfo,
|
|
119
|
+
* { allowList: ['203.0.113.0/24'] },
|
|
120
|
+
* (remote, c) => c.text(`Access denied for ${remote.addr}`, 403)
|
|
121
|
+
* )
|
|
122
|
+
* )
|
|
123
|
+
*
|
|
124
|
+
* app.get('/', (c) => c.text('Hello!'))
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
const ipRestriction = (getIP, { denyList = [], allowList = [] }, onError) => {
|
|
128
|
+
const allowLength = allowList.length;
|
|
129
|
+
const denyMatcher = buildMatcher(denyList);
|
|
130
|
+
const allowMatcher = buildMatcher(allowList);
|
|
131
|
+
const blockError = (c) => new HTTPException(403, { res: c.text("Forbidden", { status: 403 }) });
|
|
132
|
+
return async function ipRestriction(c, next) {
|
|
133
|
+
const connInfo = getIP(c);
|
|
134
|
+
const addr = typeof connInfo === "string" ? connInfo : connInfo.remote.address;
|
|
135
|
+
if (!addr) throw blockError(c);
|
|
136
|
+
const type = typeof connInfo !== "string" && connInfo.remote.addressType || distinctRemoteAddr(addr);
|
|
137
|
+
const remoteData = {
|
|
138
|
+
addr,
|
|
139
|
+
type,
|
|
140
|
+
isIPv4: type === "IPv4"
|
|
141
|
+
};
|
|
142
|
+
try {
|
|
143
|
+
if (denyMatcher(remoteData)) {
|
|
144
|
+
if (onError) return onError({
|
|
145
|
+
addr,
|
|
146
|
+
type
|
|
147
|
+
}, c);
|
|
148
|
+
throw blockError(c);
|
|
149
|
+
}
|
|
150
|
+
if (allowMatcher(remoteData)) return await next();
|
|
151
|
+
} catch (e) {
|
|
152
|
+
if (e instanceof TypeError && e.code === "ERR_INVALID_IP_ADDRESS") throw blockError(c);
|
|
153
|
+
throw e;
|
|
154
|
+
}
|
|
155
|
+
if (allowLength === 0) return await next();
|
|
156
|
+
else {
|
|
157
|
+
if (onError) return await onError({
|
|
158
|
+
addr,
|
|
159
|
+
type
|
|
160
|
+
}, c);
|
|
161
|
+
throw blockError(c);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
//#endregion
|
|
166
|
+
export { ipRestriction as t };
|