@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,15 @@
|
|
|
1
|
+
import { c as Result, l as Router } from "../router-0TlTAMdt.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../../plugins/router/src/core/router/smart-router/router.d.ts
|
|
4
|
+
declare class SmartRouter<T> implements Router<T> {
|
|
5
|
+
#private;
|
|
6
|
+
name: string;
|
|
7
|
+
constructor(init: {
|
|
8
|
+
routers: Router<T>[];
|
|
9
|
+
});
|
|
10
|
+
add(method: string, path: string, handler: T): void;
|
|
11
|
+
match(method: string, path: string): Result<T>;
|
|
12
|
+
get activeRouter(): Router<T>;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { SmartRouter };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { c as Result, l as Router } from "../router-0TlTAMdt.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../../plugins/router/src/core/router/trie-router/router.d.ts
|
|
4
|
+
declare class TrieRouter<T> implements Router<T> {
|
|
5
|
+
#private;
|
|
6
|
+
name: string;
|
|
7
|
+
add(method: string, path: string, handler: T): void;
|
|
8
|
+
match(method: string, path: string): Result<T>;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { TrieRouter };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
//#region ../../../plugins/router/src/core/router.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* @module
|
|
4
|
+
* This module provides types definitions and variables for the routers.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Constant representing all HTTP methods in uppercase.
|
|
8
|
+
*/
|
|
9
|
+
declare const METHOD_NAME_ALL: "ALL";
|
|
10
|
+
/**
|
|
11
|
+
* Constant representing all HTTP methods in lowercase.
|
|
12
|
+
*/
|
|
13
|
+
declare const METHOD_NAME_ALL_LOWERCASE: "all";
|
|
14
|
+
/**
|
|
15
|
+
* Array of supported HTTP methods.
|
|
16
|
+
*/
|
|
17
|
+
declare const METHODS: readonly ["get", "post", "put", "delete", "options", "patch", "query"];
|
|
18
|
+
/**
|
|
19
|
+
* Error message indicating that a route cannot be added because the matcher is already built.
|
|
20
|
+
*/
|
|
21
|
+
declare const MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is already built.";
|
|
22
|
+
/**
|
|
23
|
+
* Interface representing a router.
|
|
24
|
+
*
|
|
25
|
+
* @template T - The type of the handler.
|
|
26
|
+
*/
|
|
27
|
+
interface Router<T> {
|
|
28
|
+
/**
|
|
29
|
+
* The name of the router.
|
|
30
|
+
*/
|
|
31
|
+
name: string;
|
|
32
|
+
/**
|
|
33
|
+
* Adds a route to the router.
|
|
34
|
+
*
|
|
35
|
+
* @param method - The HTTP method (e.g., 'get', 'post').
|
|
36
|
+
* @param path - The path for the route.
|
|
37
|
+
* @param handler - The handler for the route.
|
|
38
|
+
*/
|
|
39
|
+
add(method: string, path: string, handler: T): void;
|
|
40
|
+
/**
|
|
41
|
+
* Matches a route based on the given method and path.
|
|
42
|
+
*
|
|
43
|
+
* @param method - The HTTP method (e.g., 'get', 'post').
|
|
44
|
+
* @param path - The path to match.
|
|
45
|
+
* @returns The result of the match.
|
|
46
|
+
*/
|
|
47
|
+
match(method: string, path: string): Result<T>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Type representing a map of parameter indices.
|
|
51
|
+
*/
|
|
52
|
+
type ParamIndexMap = Record<string, number>;
|
|
53
|
+
/**
|
|
54
|
+
* Type representing a stash of parameters.
|
|
55
|
+
*/
|
|
56
|
+
type ParamStash = string[];
|
|
57
|
+
/**
|
|
58
|
+
* Type representing a map of parameters.
|
|
59
|
+
*/
|
|
60
|
+
type Params = Record<string, string>;
|
|
61
|
+
/**
|
|
62
|
+
* Type representing the result of a route match.
|
|
63
|
+
*
|
|
64
|
+
* The result can be in one of two formats:
|
|
65
|
+
* 1. An array of handlers with their corresponding parameter index maps, followed by a parameter stash.
|
|
66
|
+
* 2. An array of handlers with their corresponding parameter maps.
|
|
67
|
+
*
|
|
68
|
+
* Example:
|
|
69
|
+
*
|
|
70
|
+
* [[handler, paramIndexMap][], paramArray]
|
|
71
|
+
* ```typescript
|
|
72
|
+
* [
|
|
73
|
+
* [
|
|
74
|
+
* [middlewareA, {}], // '*'
|
|
75
|
+
* [funcA, {'id': 0}], // '/user/:id/*'
|
|
76
|
+
* [funcB, {'id': 0, 'action': 1}], // '/user/:id/:action'
|
|
77
|
+
* ],
|
|
78
|
+
* ['123', 'abc']
|
|
79
|
+
* ]
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* [[handler, params][]]
|
|
83
|
+
* ```typescript
|
|
84
|
+
* [
|
|
85
|
+
* [
|
|
86
|
+
* [middlewareA, {}], // '*'
|
|
87
|
+
* [funcA, {'id': '123'}], // '/user/:id/*'
|
|
88
|
+
* [funcB, {'id': '123', 'action': 'abc'}], // '/user/:id/:action'
|
|
89
|
+
* ]
|
|
90
|
+
* ]
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
type Result<T> = [[T, ParamIndexMap][], ParamStash] | [[T, Params][]];
|
|
94
|
+
/**
|
|
95
|
+
* Error class representing an unsupported path error.
|
|
96
|
+
*/
|
|
97
|
+
declare class UnsupportedPathError extends Error {}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { ParamIndexMap as a, Result as c, METHOD_NAME_ALL_LOWERCASE as i, Router as l, METHODS as n, ParamStash as o, METHOD_NAME_ALL as r, Params as s, MESSAGE_MATCHER_IS_ALREADY_BUILT as t, UnsupportedPathError as u };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region ../../../plugins/router/src/core/router.ts
|
|
2
|
+
/**
|
|
3
|
+
* @module
|
|
4
|
+
* This module provides types definitions and variables for the routers.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Constant representing all HTTP methods in uppercase.
|
|
8
|
+
*/
|
|
9
|
+
const METHOD_NAME_ALL = "ALL";
|
|
10
|
+
/**
|
|
11
|
+
* Constant representing all HTTP methods in lowercase.
|
|
12
|
+
*/
|
|
13
|
+
const METHOD_NAME_ALL_LOWERCASE = "all";
|
|
14
|
+
/**
|
|
15
|
+
* Array of supported HTTP methods.
|
|
16
|
+
*/
|
|
17
|
+
const METHODS = [
|
|
18
|
+
"get",
|
|
19
|
+
"post",
|
|
20
|
+
"put",
|
|
21
|
+
"delete",
|
|
22
|
+
"options",
|
|
23
|
+
"patch",
|
|
24
|
+
"query"
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Error message indicating that a route cannot be added because the matcher is already built.
|
|
28
|
+
*/
|
|
29
|
+
const MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is already built.";
|
|
30
|
+
/**
|
|
31
|
+
* Error class representing an unsupported path error.
|
|
32
|
+
*/
|
|
33
|
+
var UnsupportedPathError = class extends Error {};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { UnsupportedPathError as a, METHOD_NAME_ALL_LOWERCASE as i, METHODS as n, METHOD_NAME_ALL as r, MESSAGE_MATCHER_IS_ALREADY_BUILT as t };
|
package/lib/router.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ParamIndexMap, c as Result, i as METHOD_NAME_ALL_LOWERCASE, l as Router, n as METHODS, o as ParamStash, r as METHOD_NAME_ALL, s as Params, t as MESSAGE_MATCHER_IS_ALREADY_BUILT, u as UnsupportedPathError } from "./router-0TlTAMdt.js";
|
|
2
|
+
export { MESSAGE_MATCHER_IS_ALREADY_BUILT, METHODS, METHOD_NAME_ALL, METHOD_NAME_ALL_LOWERCASE, ParamIndexMap, ParamStash, Params, Result, Router, UnsupportedPathError };
|
package/lib/router.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as UnsupportedPathError, i as METHOD_NAME_ALL_LOWERCASE, n as METHODS, r as METHOD_NAME_ALL, t as MESSAGE_MATCHER_IS_ALREADY_BUILT } from "./router-wWGf3FlK.js";
|
|
2
|
+
export { MESSAGE_MATCHER_IS_ALREADY_BUILT, METHODS, METHOD_NAME_ALL, METHOD_NAME_ALL_LOWERCASE, UnsupportedPathError };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { t as validator } from "./validator-DkpCsiJC.js";
|
|
2
|
+
//#region ../../../plugins/router/src/helpers/schema-validator.ts
|
|
3
|
+
const pathOf = (path) => (path ?? []).map((part) => String(typeof part === "object" ? part.key : part)).join(".");
|
|
4
|
+
/**
|
|
5
|
+
* The core `validator` driven by a Standard Schema. A failure answers 400 with `{ error, issues }`; success makes the parsed value the
|
|
6
|
+
* handler's `c.req.valid(target)`, typed by the schema's output.
|
|
7
|
+
*/
|
|
8
|
+
function schemaValidator(target, schema) {
|
|
9
|
+
return validator(target, async (value, c) => {
|
|
10
|
+
const result = await schema["~standard"].validate(value);
|
|
11
|
+
if (result.issues !== void 0) return c.json({
|
|
12
|
+
error: `invalid ${target}`,
|
|
13
|
+
issues: result.issues.map((issue) => ({
|
|
14
|
+
message: issue.message,
|
|
15
|
+
path: pathOf(issue.path)
|
|
16
|
+
}))
|
|
17
|
+
}, 400);
|
|
18
|
+
return result.value;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { schemaValidator as t };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { L as MiddlewareHandler, Q as ValidationTargets, v as Env } from "./context-Ca3uX_bh.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../../plugins/router/src/helpers/schema-validator.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The Standard Schema v1 interface (https://standardschema.dev), declared here so the framework needs no dependency for it. Schemastery
|
|
6
|
+
* (what Cordis uses), Zod and Valibot implement it, and a hand-written schema object of the same shape is accepted as well. Only
|
|
7
|
+
* `validate` is called, so `version` and `vendor` may be left out of a hand-written schema.
|
|
8
|
+
*/
|
|
9
|
+
interface StandardSchema<Input = unknown, Output = Input> {
|
|
10
|
+
readonly '~standard': StandardSchemaProps<Input, Output>;
|
|
11
|
+
}
|
|
12
|
+
/** The `~standard` properties of a {@link StandardSchema}. */
|
|
13
|
+
interface StandardSchemaProps<Input = unknown, Output = Input> {
|
|
14
|
+
/** The version of the standard; every library sets it. */
|
|
15
|
+
readonly version?: 1 | undefined;
|
|
16
|
+
/** The name of the schema library; every library sets it. */
|
|
17
|
+
readonly vendor?: string | undefined;
|
|
18
|
+
/** Validates an unknown value. */
|
|
19
|
+
readonly validate: (value: unknown, options?: StandardSchemaOptions | undefined) => StandardResult<Output> | Promise<StandardResult<Output>>;
|
|
20
|
+
/** The input and output types, for inference only. */
|
|
21
|
+
readonly types?: {
|
|
22
|
+
readonly input: Input;
|
|
23
|
+
readonly output: Output;
|
|
24
|
+
} | undefined;
|
|
25
|
+
}
|
|
26
|
+
/** Options a caller may pass to `validate`. */
|
|
27
|
+
interface StandardSchemaOptions {
|
|
28
|
+
/** Library-specific parameters. */
|
|
29
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
30
|
+
}
|
|
31
|
+
/** One validation issue: a message and where in the value it applies. */
|
|
32
|
+
interface StandardIssue {
|
|
33
|
+
readonly message: string;
|
|
34
|
+
readonly path?: readonly (PropertyKey | {
|
|
35
|
+
readonly key: PropertyKey;
|
|
36
|
+
})[] | undefined;
|
|
37
|
+
}
|
|
38
|
+
/** What `validate` answers: the parsed value, or the issues. */
|
|
39
|
+
type StandardResult<Output> = {
|
|
40
|
+
readonly value: Output;
|
|
41
|
+
readonly issues?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
readonly issues: readonly StandardIssue[];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The core `validator` driven by a Standard Schema. A failure answers 400 with `{ error, issues }`; success makes the parsed value the
|
|
47
|
+
* handler's `c.req.valid(target)`, typed by the schema's output.
|
|
48
|
+
*/
|
|
49
|
+
declare function schemaValidator<Target extends keyof ValidationTargets, Out, E extends Env = Env, P extends string = string>(target: Target, schema: StandardSchema<unknown, Out>): MiddlewareHandler<E, P, {
|
|
50
|
+
in: { [K in Target]: Out };
|
|
51
|
+
out: { [K in Target]: Out };
|
|
52
|
+
}>;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { StandardIssue, StandardResult, StandardSchema, StandardSchemaOptions, StandardSchemaProps, schemaValidator };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { r as encodeBase64 } from "./encode-BbgU91Gc.js";
|
|
2
|
+
//#region ../../../plugins/router/src/core/middleware/secure-headers/secure-headers.ts
|
|
3
|
+
const HEADERS_MAP = {
|
|
4
|
+
crossOriginEmbedderPolicy: ["Cross-Origin-Embedder-Policy", "require-corp"],
|
|
5
|
+
crossOriginResourcePolicy: ["Cross-Origin-Resource-Policy", "same-origin"],
|
|
6
|
+
crossOriginOpenerPolicy: ["Cross-Origin-Opener-Policy", "same-origin"],
|
|
7
|
+
originAgentCluster: ["Origin-Agent-Cluster", "?1"],
|
|
8
|
+
referrerPolicy: ["Referrer-Policy", "no-referrer"],
|
|
9
|
+
strictTransportSecurity: ["Strict-Transport-Security", "max-age=15552000; includeSubDomains"],
|
|
10
|
+
xContentTypeOptions: ["X-Content-Type-Options", "nosniff"],
|
|
11
|
+
xDnsPrefetchControl: ["X-DNS-Prefetch-Control", "off"],
|
|
12
|
+
xDownloadOptions: ["X-Download-Options", "noopen"],
|
|
13
|
+
xFrameOptions: ["X-Frame-Options", "SAMEORIGIN"],
|
|
14
|
+
xPermittedCrossDomainPolicies: ["X-Permitted-Cross-Domain-Policies", "none"],
|
|
15
|
+
xXssProtection: ["X-XSS-Protection", "0"]
|
|
16
|
+
};
|
|
17
|
+
const DEFAULT_OPTIONS = {
|
|
18
|
+
crossOriginEmbedderPolicy: false,
|
|
19
|
+
crossOriginResourcePolicy: true,
|
|
20
|
+
crossOriginOpenerPolicy: true,
|
|
21
|
+
originAgentCluster: true,
|
|
22
|
+
referrerPolicy: true,
|
|
23
|
+
strictTransportSecurity: true,
|
|
24
|
+
xContentTypeOptions: true,
|
|
25
|
+
xDnsPrefetchControl: true,
|
|
26
|
+
xDownloadOptions: true,
|
|
27
|
+
xFrameOptions: true,
|
|
28
|
+
xPermittedCrossDomainPolicies: true,
|
|
29
|
+
xXssProtection: true,
|
|
30
|
+
removePoweredBy: true,
|
|
31
|
+
permissionsPolicy: {}
|
|
32
|
+
};
|
|
33
|
+
const generateNonce = () => {
|
|
34
|
+
const arrayBuffer = /* @__PURE__ */ new Uint8Array(16);
|
|
35
|
+
crypto.getRandomValues(arrayBuffer);
|
|
36
|
+
return encodeBase64(arrayBuffer.buffer);
|
|
37
|
+
};
|
|
38
|
+
const NONCE = (ctx) => {
|
|
39
|
+
const key = "secureHeadersNonce";
|
|
40
|
+
const init = ctx.get(key);
|
|
41
|
+
const nonce = init || generateNonce();
|
|
42
|
+
if (init == null) ctx.set(key, nonce);
|
|
43
|
+
return `'nonce-${nonce}'`;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Secure Headers Middleware for Acryl.
|
|
47
|
+
*
|
|
48
|
+
*
|
|
49
|
+
* @param {Partial<SecureHeadersOptions>} [customOptions] - The options for the secure headers middleware.
|
|
50
|
+
* @param {ContentSecurityPolicyOptions} [customOptions.contentSecurityPolicy] - Settings for the Content-Security-Policy header.
|
|
51
|
+
* @param {ContentSecurityPolicyOptions} [customOptions.contentSecurityPolicyReportOnly] - Settings for the Content-Security-Policy-Report-Only header.
|
|
52
|
+
* @param {overridableHeader} [customOptions.crossOriginEmbedderPolicy=false] - Settings for the Cross-Origin-Embedder-Policy header.
|
|
53
|
+
* @param {overridableHeader} [customOptions.crossOriginResourcePolicy=true] - Settings for the Cross-Origin-Resource-Policy header.
|
|
54
|
+
* @param {overridableHeader} [customOptions.crossOriginOpenerPolicy=true] - Settings for the Cross-Origin-Opener-Policy header.
|
|
55
|
+
* @param {overridableHeader} [customOptions.originAgentCluster=true] - Settings for the Origin-Agent-Cluster header.
|
|
56
|
+
* @param {overridableHeader} [customOptions.referrerPolicy=true] - Settings for the Referrer-Policy header.
|
|
57
|
+
* @param {ReportingEndpointOptions[]} [customOptions.reportingEndpoints] - Settings for the Reporting-Endpoints header.
|
|
58
|
+
* @param {ReportToOptions[]} [customOptions.reportTo] - Settings for the Report-To header.
|
|
59
|
+
* @param {overridableHeader} [customOptions.strictTransportSecurity=true] - Settings for the Strict-Transport-Security header.
|
|
60
|
+
* @param {overridableHeader} [customOptions.xContentTypeOptions=true] - Settings for the X-Content-Type-Options header.
|
|
61
|
+
* @param {overridableHeader} [customOptions.xDnsPrefetchControl=true] - Settings for the X-DNS-Prefetch-Control header.
|
|
62
|
+
* @param {overridableHeader} [customOptions.xDownloadOptions=true] - Settings for the X-Download-Options header.
|
|
63
|
+
* @param {overridableHeader} [customOptions.xFrameOptions=true] - Settings for the X-Frame-Options header.
|
|
64
|
+
* @param {overridableHeader} [customOptions.xPermittedCrossDomainPolicies=true] - Settings for the X-Permitted-Cross-Domain-Policies header.
|
|
65
|
+
* @param {overridableHeader} [customOptions.xXssProtection=true] - Settings for the X-XSS-Protection header.
|
|
66
|
+
* @param {boolean} [customOptions.removePoweredBy=true] - Settings for remove X-Powered-By header.
|
|
67
|
+
* @param {PermissionsPolicyOptions} [customOptions.permissionsPolicy] - Settings for the Permissions-Policy header.
|
|
68
|
+
* @returns {MiddlewareHandler} The middleware handler function.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const app = new Acryl()
|
|
73
|
+
* app.use(secureHeaders())
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
const secureHeaders = (customOptions) => {
|
|
77
|
+
const options = {
|
|
78
|
+
...DEFAULT_OPTIONS,
|
|
79
|
+
...customOptions
|
|
80
|
+
};
|
|
81
|
+
const headersToSet = getFilteredHeaders(options);
|
|
82
|
+
const callbacks = [];
|
|
83
|
+
if (options.contentSecurityPolicy) {
|
|
84
|
+
const [callback, value] = getCSPDirectives(options.contentSecurityPolicy, "Content-Security-Policy");
|
|
85
|
+
if (callback) callbacks.push(callback);
|
|
86
|
+
headersToSet.push(["Content-Security-Policy", value]);
|
|
87
|
+
}
|
|
88
|
+
if (options.contentSecurityPolicyReportOnly) {
|
|
89
|
+
const [callback, value] = getCSPDirectives(options.contentSecurityPolicyReportOnly, "Content-Security-Policy-Report-Only");
|
|
90
|
+
if (callback) callbacks.push(callback);
|
|
91
|
+
headersToSet.push(["Content-Security-Policy-Report-Only", value]);
|
|
92
|
+
}
|
|
93
|
+
if (options.permissionsPolicy && Object.keys(options.permissionsPolicy).length > 0) headersToSet.push(["Permissions-Policy", getPermissionsPolicyDirectives(options.permissionsPolicy)]);
|
|
94
|
+
if (options.reportingEndpoints) headersToSet.push(["Reporting-Endpoints", getReportingEndpoints(options.reportingEndpoints)]);
|
|
95
|
+
if (options.reportTo) headersToSet.push(["Report-To", getReportToOptions(options.reportTo)]);
|
|
96
|
+
return async function secureHeaders(ctx, next) {
|
|
97
|
+
const headersToSetForReq = callbacks.length === 0 ? headersToSet : callbacks.reduce((acc, cb) => cb(ctx, acc), headersToSet);
|
|
98
|
+
await next();
|
|
99
|
+
setHeaders(ctx, headersToSetForReq);
|
|
100
|
+
if (options?.removePoweredBy) ctx.res.headers.delete("X-Powered-By");
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
function getFilteredHeaders(options) {
|
|
104
|
+
return Object.entries(HEADERS_MAP).filter(([key]) => options[key]).map(([key, defaultValue]) => {
|
|
105
|
+
const overrideValue = options[key];
|
|
106
|
+
return typeof overrideValue === "string" ? [defaultValue[0], overrideValue] : defaultValue;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function getCSPDirectives(contentSecurityPolicy, headerName) {
|
|
110
|
+
const callbacks = [];
|
|
111
|
+
const resultValues = [];
|
|
112
|
+
for (const [directive, value] of Object.entries(contentSecurityPolicy)) {
|
|
113
|
+
const valueArray = Array.isArray(value) ? value : [value];
|
|
114
|
+
valueArray.forEach((value, i) => {
|
|
115
|
+
if (typeof value === "function") {
|
|
116
|
+
const index = i * 2 + 2 + resultValues.length;
|
|
117
|
+
callbacks.push((ctx, values) => {
|
|
118
|
+
values[index] = value(ctx, directive);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
resultValues.push(directive.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (match, offset) => offset ? "-" + match.toLowerCase() : match.toLowerCase()), ...valueArray.flatMap((value) => [" ", value]), "; ");
|
|
123
|
+
}
|
|
124
|
+
resultValues.pop();
|
|
125
|
+
return callbacks.length === 0 ? [void 0, resultValues.join("")] : [(ctx, headersToSet) => headersToSet.map((values) => {
|
|
126
|
+
if (values[0] === headerName) {
|
|
127
|
+
const clone = values[1].slice();
|
|
128
|
+
callbacks.forEach((cb) => {
|
|
129
|
+
cb(ctx, clone);
|
|
130
|
+
});
|
|
131
|
+
return [values[0], clone.join("")];
|
|
132
|
+
} else return values;
|
|
133
|
+
}), resultValues];
|
|
134
|
+
}
|
|
135
|
+
function getPermissionsPolicyDirectives(policy) {
|
|
136
|
+
return Object.entries(policy).map(([directive, value]) => {
|
|
137
|
+
const kebabDirective = camelToKebab(directive);
|
|
138
|
+
if (typeof value === "boolean") return `${kebabDirective}=${value ? "*" : "()"}`;
|
|
139
|
+
if (Array.isArray(value)) {
|
|
140
|
+
if (value.length === 0) return `${kebabDirective}=()`;
|
|
141
|
+
if (value.length === 1 && value[0] === "*") return `${kebabDirective}=*`;
|
|
142
|
+
if (value.length === 1 && value[0] === "none") return `${kebabDirective}=()`;
|
|
143
|
+
return `${kebabDirective}=(${value.map((item) => ["self", "src"].includes(item) ? item : `"${item}"`).join(" ")})`;
|
|
144
|
+
}
|
|
145
|
+
return "";
|
|
146
|
+
}).filter(Boolean).join(", ");
|
|
147
|
+
}
|
|
148
|
+
function camelToKebab(str) {
|
|
149
|
+
return str.replace(/([a-z\d])([A-Z])/g, "$1-$2").toLowerCase();
|
|
150
|
+
}
|
|
151
|
+
function getReportingEndpoints(reportingEndpoints = []) {
|
|
152
|
+
return reportingEndpoints.map((endpoint) => `${endpoint.name}="${endpoint.url}"`).join(", ");
|
|
153
|
+
}
|
|
154
|
+
function getReportToOptions(reportTo = []) {
|
|
155
|
+
return reportTo.map((option) => JSON.stringify(option)).join(", ");
|
|
156
|
+
}
|
|
157
|
+
function setHeaders(ctx, headersToSet) {
|
|
158
|
+
headersToSet.forEach(([header, value]) => {
|
|
159
|
+
ctx.res.headers.set(header, value);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
export { secureHeaders as n, NONCE as t };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { L as MiddlewareHandler, t as Context } from "./context-Ca3uX_bh.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../../plugins/router/src/core/middleware/secure-headers/permissions-policy.d.ts
|
|
4
|
+
type PermissionsPolicyDirective = StandardizedFeatures | ProposedFeatures | ExperimentalFeatures;
|
|
5
|
+
/**
|
|
6
|
+
* These features have been declared in a published version of the respective specification.
|
|
7
|
+
*/
|
|
8
|
+
type StandardizedFeatures = 'accelerometer' | 'ambientLightSensor' | 'attributionReporting' | 'autoplay' | 'battery' | 'bluetooth' | 'camera' | 'chUa' | 'chUaArch' | 'chUaBitness' | 'chUaFullVersion' | 'chUaFullVersionList' | 'chUaHighEntropyValues' | 'chUaMobile' | 'chUaModel' | 'chUaPlatform' | 'chUaPlatformVersion' | 'chUaWow64' | 'computePressure' | 'crossOriginIsolated' | 'directSockets' | 'displayCapture' | 'encryptedMedia' | 'executionWhileNotRendered' | 'executionWhileOutOfViewport' | 'fullscreen' | 'geolocation' | 'gyroscope' | 'hid' | 'identityCredentialsGet' | 'idleDetection' | 'keyboardMap' | 'magnetometer' | 'mediasession' | 'microphone' | 'midi' | 'navigationOverride' | 'otpCredentials' | 'payment' | 'pictureInPicture' | 'publickeyCredentialsGet' | 'screenWakeLock' | 'serial' | 'storageAccess' | 'syncXhr' | 'tools' | 'usb' | 'webShare' | 'windowManagement' | 'xrSpatialTracking';
|
|
9
|
+
/**
|
|
10
|
+
* These features have been proposed, but the definitions have not yet been integrated into their respective specs.
|
|
11
|
+
*/
|
|
12
|
+
type ProposedFeatures = 'autofill' | 'clipboardRead' | 'clipboardWrite' | 'deferredFetch' | 'gamepad' | 'languageDetector' | 'languageModel' | 'manualText' | 'rewriter' | 'sharedAutofill' | 'speakerSelection' | 'summarizer' | 'translator' | 'writer';
|
|
13
|
+
/**
|
|
14
|
+
* These features generally have an explainer only, but may be available for experimentation by web developers.
|
|
15
|
+
*/
|
|
16
|
+
type ExperimentalFeatures = 'allScreensCapture' | 'browsingTopics' | 'capturedSurfaceControl' | 'conversionMeasurement' | 'digitalCredentialsCreate' | 'digitalCredentialsGet' | 'focusWithoutUserActivation' | 'joinAdInterestGroup' | 'localFonts' | 'monetization' | 'runAdAuction' | 'smartCard' | 'syncScript' | 'trustTokenRedemption' | 'unload' | 'verticalScroll';
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ../../../plugins/router/src/core/middleware/secure-headers/secure-headers.d.ts
|
|
19
|
+
type SecureHeadersVariables = {
|
|
20
|
+
secureHeadersNonce?: string;
|
|
21
|
+
};
|
|
22
|
+
type ContentSecurityPolicyOptionHandler = (ctx: Context, directive: string) => string;
|
|
23
|
+
type ContentSecurityPolicyOptionValue = (string | ContentSecurityPolicyOptionHandler)[];
|
|
24
|
+
interface ContentSecurityPolicyOptions {
|
|
25
|
+
defaultSrc?: ContentSecurityPolicyOptionValue;
|
|
26
|
+
baseUri?: ContentSecurityPolicyOptionValue;
|
|
27
|
+
childSrc?: ContentSecurityPolicyOptionValue;
|
|
28
|
+
connectSrc?: ContentSecurityPolicyOptionValue;
|
|
29
|
+
fontSrc?: ContentSecurityPolicyOptionValue;
|
|
30
|
+
formAction?: ContentSecurityPolicyOptionValue;
|
|
31
|
+
frameAncestors?: ContentSecurityPolicyOptionValue;
|
|
32
|
+
frameSrc?: ContentSecurityPolicyOptionValue;
|
|
33
|
+
imgSrc?: ContentSecurityPolicyOptionValue;
|
|
34
|
+
manifestSrc?: ContentSecurityPolicyOptionValue;
|
|
35
|
+
mediaSrc?: ContentSecurityPolicyOptionValue;
|
|
36
|
+
objectSrc?: ContentSecurityPolicyOptionValue;
|
|
37
|
+
reportTo?: string;
|
|
38
|
+
reportUri?: string | string[];
|
|
39
|
+
sandbox?: ContentSecurityPolicyOptionValue;
|
|
40
|
+
scriptSrc?: ContentSecurityPolicyOptionValue;
|
|
41
|
+
scriptSrcAttr?: ContentSecurityPolicyOptionValue;
|
|
42
|
+
scriptSrcElem?: ContentSecurityPolicyOptionValue;
|
|
43
|
+
styleSrc?: ContentSecurityPolicyOptionValue;
|
|
44
|
+
styleSrcAttr?: ContentSecurityPolicyOptionValue;
|
|
45
|
+
styleSrcElem?: ContentSecurityPolicyOptionValue;
|
|
46
|
+
upgradeInsecureRequests?: ContentSecurityPolicyOptionValue;
|
|
47
|
+
workerSrc?: ContentSecurityPolicyOptionValue;
|
|
48
|
+
requireTrustedTypesFor?: ContentSecurityPolicyOptionValue;
|
|
49
|
+
trustedTypes?: ContentSecurityPolicyOptionValue;
|
|
50
|
+
}
|
|
51
|
+
interface ReportToOptions {
|
|
52
|
+
group: string;
|
|
53
|
+
max_age: number;
|
|
54
|
+
endpoints: ReportToEndpoint[];
|
|
55
|
+
}
|
|
56
|
+
interface ReportToEndpoint {
|
|
57
|
+
url: string;
|
|
58
|
+
}
|
|
59
|
+
interface ReportingEndpointOptions {
|
|
60
|
+
name: string;
|
|
61
|
+
url: string;
|
|
62
|
+
}
|
|
63
|
+
type PermissionsPolicyValue = '*' | 'self' | 'src' | 'none' | string;
|
|
64
|
+
type PermissionsPolicyOptions = Partial<Record<PermissionsPolicyDirective, PermissionsPolicyValue[] | boolean>>;
|
|
65
|
+
type overridableHeader = boolean | string;
|
|
66
|
+
interface SecureHeadersOptions {
|
|
67
|
+
contentSecurityPolicy?: ContentSecurityPolicyOptions;
|
|
68
|
+
contentSecurityPolicyReportOnly?: ContentSecurityPolicyOptions;
|
|
69
|
+
crossOriginEmbedderPolicy?: overridableHeader;
|
|
70
|
+
crossOriginResourcePolicy?: overridableHeader;
|
|
71
|
+
crossOriginOpenerPolicy?: overridableHeader;
|
|
72
|
+
originAgentCluster?: overridableHeader;
|
|
73
|
+
referrerPolicy?: overridableHeader;
|
|
74
|
+
reportingEndpoints?: ReportingEndpointOptions[];
|
|
75
|
+
reportTo?: ReportToOptions[];
|
|
76
|
+
strictTransportSecurity?: overridableHeader;
|
|
77
|
+
xContentTypeOptions?: overridableHeader;
|
|
78
|
+
xDnsPrefetchControl?: overridableHeader;
|
|
79
|
+
xDownloadOptions?: overridableHeader;
|
|
80
|
+
xFrameOptions?: overridableHeader;
|
|
81
|
+
xPermittedCrossDomainPolicies?: overridableHeader;
|
|
82
|
+
xXssProtection?: overridableHeader;
|
|
83
|
+
removePoweredBy?: boolean;
|
|
84
|
+
permissionsPolicy?: PermissionsPolicyOptions;
|
|
85
|
+
}
|
|
86
|
+
declare const NONCE: ContentSecurityPolicyOptionHandler;
|
|
87
|
+
/**
|
|
88
|
+
* Secure Headers Middleware for Acryl.
|
|
89
|
+
*
|
|
90
|
+
*
|
|
91
|
+
* @param {Partial<SecureHeadersOptions>} [customOptions] - The options for the secure headers middleware.
|
|
92
|
+
* @param {ContentSecurityPolicyOptions} [customOptions.contentSecurityPolicy] - Settings for the Content-Security-Policy header.
|
|
93
|
+
* @param {ContentSecurityPolicyOptions} [customOptions.contentSecurityPolicyReportOnly] - Settings for the Content-Security-Policy-Report-Only header.
|
|
94
|
+
* @param {overridableHeader} [customOptions.crossOriginEmbedderPolicy=false] - Settings for the Cross-Origin-Embedder-Policy header.
|
|
95
|
+
* @param {overridableHeader} [customOptions.crossOriginResourcePolicy=true] - Settings for the Cross-Origin-Resource-Policy header.
|
|
96
|
+
* @param {overridableHeader} [customOptions.crossOriginOpenerPolicy=true] - Settings for the Cross-Origin-Opener-Policy header.
|
|
97
|
+
* @param {overridableHeader} [customOptions.originAgentCluster=true] - Settings for the Origin-Agent-Cluster header.
|
|
98
|
+
* @param {overridableHeader} [customOptions.referrerPolicy=true] - Settings for the Referrer-Policy header.
|
|
99
|
+
* @param {ReportingEndpointOptions[]} [customOptions.reportingEndpoints] - Settings for the Reporting-Endpoints header.
|
|
100
|
+
* @param {ReportToOptions[]} [customOptions.reportTo] - Settings for the Report-To header.
|
|
101
|
+
* @param {overridableHeader} [customOptions.strictTransportSecurity=true] - Settings for the Strict-Transport-Security header.
|
|
102
|
+
* @param {overridableHeader} [customOptions.xContentTypeOptions=true] - Settings for the X-Content-Type-Options header.
|
|
103
|
+
* @param {overridableHeader} [customOptions.xDnsPrefetchControl=true] - Settings for the X-DNS-Prefetch-Control header.
|
|
104
|
+
* @param {overridableHeader} [customOptions.xDownloadOptions=true] - Settings for the X-Download-Options header.
|
|
105
|
+
* @param {overridableHeader} [customOptions.xFrameOptions=true] - Settings for the X-Frame-Options header.
|
|
106
|
+
* @param {overridableHeader} [customOptions.xPermittedCrossDomainPolicies=true] - Settings for the X-Permitted-Cross-Domain-Policies header.
|
|
107
|
+
* @param {overridableHeader} [customOptions.xXssProtection=true] - Settings for the X-XSS-Protection header.
|
|
108
|
+
* @param {boolean} [customOptions.removePoweredBy=true] - Settings for remove X-Powered-By header.
|
|
109
|
+
* @param {PermissionsPolicyOptions} [customOptions.permissionsPolicy] - Settings for the Permissions-Policy header.
|
|
110
|
+
* @returns {MiddlewareHandler} The middleware handler function.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* const app = new Acryl()
|
|
115
|
+
* app.use(secureHeaders())
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
declare const secureHeaders: (customOptions?: SecureHeadersOptions) => MiddlewareHandler;
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region ../../../plugins/router/src/core/middleware/secure-headers/index.d.ts
|
|
121
|
+
declare module '../../context.ts' {
|
|
122
|
+
interface ContextVariableMap extends SecureHeadersVariables {}
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
export { type ContentSecurityPolicyOptionHandler, NONCE, type SecureHeadersVariables, secureHeaders };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { L as MiddlewareHandler, t as Context, v as Env } from "./context-Ca3uX_bh.js";
|
|
2
|
+
//#region ../../../plugins/node-server/src/adapter/serve-static.d.ts
|
|
3
|
+
type ServeStaticOptions<E extends Env = Env> = {
|
|
4
|
+
/**
|
|
5
|
+
* Root path. Relative path is based on current working directory from which the app was started.
|
|
6
|
+
*/
|
|
7
|
+
root?: string;
|
|
8
|
+
path?: string;
|
|
9
|
+
index?: string;
|
|
10
|
+
precompressed?: boolean; /** Allow percent signs in the routed request path. Defaults to false. */
|
|
11
|
+
allowPercentInPath?: boolean;
|
|
12
|
+
rewriteRequestPath?: (path: string, c: Context<E>) => string;
|
|
13
|
+
onFound?: (path: string, c: Context<E>) => void | Promise<void>;
|
|
14
|
+
onNotFound?: (path: string, c: Context<E>) => void | Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
declare const serveStatic: <E extends Env = any>(options?: ServeStaticOptions<E>) => MiddlewareHandler<E>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { serveStatic as n, ServeStaticOptions as t };
|