theokit 0.48.13 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{actions-virtual-module-YQXRSSMW.js → actions-virtual-module-5WBVSDOM.js} +22 -12
- package/dist/actions-virtual-module-5WBVSDOM.js.map +1 -0
- package/dist/{actions-virtual-module-LB4NGONI.js → actions-virtual-module-ZYLMNW6K.js} +13 -8
- package/dist/{actions-virtual-module-LB4NGONI.js.map → actions-virtual-module-ZYLMNW6K.js.map} +1 -1
- package/dist/adapters/agent-mount.d.ts +127 -0
- package/dist/adapters/agent-mount.js +24 -0
- package/dist/adapters/security-headers.d.ts +132 -0
- package/dist/adapters/security-headers.js +64 -0
- package/dist/adapters/security-headers.js.map +1 -0
- package/dist/adapters/web-shim.d.ts +100 -13
- package/dist/adapters/web-shim.js +158 -54
- package/dist/adapters/web-shim.js.map +1 -1
- package/dist/agent-GKUEL6OH.js +15 -0
- package/dist/agent-scan-BZa-pagG.d.ts +16 -0
- package/dist/{app-typed-client-GHO3EWZK.js → app-typed-client-4LAIEGFX.js} +23 -13
- package/dist/app-typed-client-4LAIEGFX.js.map +1 -0
- package/dist/{app-typed-client-G3J5G7E5.js → app-typed-client-DQM3Y6YY.js} +14 -9
- package/dist/app-typed-client-DQM3Y6YY.js.map +1 -0
- package/dist/aws-lambda-VKMYUMP2.js +261 -0
- package/dist/aws-lambda-VKMYUMP2.js.map +1 -0
- package/dist/{build-WU6AKKIB.js → build-FLX6VF7Q.js} +71 -26
- package/dist/build-FLX6VF7Q.js.map +1 -0
- package/dist/{bun-33RD6K7O.js → bun-L7PP6ID5.js} +105 -13
- package/dist/bun-L7PP6ID5.js.map +1 -0
- package/dist/{check-45NKUVSQ.js → check-GIPZBFTX.js} +2 -2
- package/dist/{chunk-KD5G3YXI.js → chunk-2AMLGJJA.js} +35 -9
- package/dist/chunk-2AMLGJJA.js.map +1 -0
- package/dist/chunk-3PBAN2YE.js +146 -0
- package/dist/chunk-3PBAN2YE.js.map +1 -0
- package/dist/{chunk-HBU2GIMZ.js → chunk-3QPVEJ7D.js} +15 -9
- package/dist/chunk-3QPVEJ7D.js.map +1 -0
- package/dist/{chunk-47CINLWF.js → chunk-44J2ANQC.js} +2 -2
- package/dist/{chunk-IEES3CHD.js → chunk-47MM2JUK.js} +8 -2
- package/dist/chunk-47MM2JUK.js.map +1 -0
- package/dist/chunk-4X6H2BXP.js +108 -0
- package/dist/chunk-4X6H2BXP.js.map +1 -0
- package/dist/{chunk-A7JBF5FO.js → chunk-5K4TDLRG.js} +8 -5
- package/dist/chunk-5K4TDLRG.js.map +1 -0
- package/dist/chunk-5YPXXSYY.js +181 -0
- package/dist/chunk-5YPXXSYY.js.map +1 -0
- package/dist/{chunk-YGAXV5HR.js → chunk-6J4JWHDJ.js} +191 -112
- package/dist/chunk-6J4JWHDJ.js.map +1 -0
- package/dist/chunk-72DMJBXI.js +424 -0
- package/dist/chunk-72DMJBXI.js.map +1 -0
- package/dist/chunk-7PM6K5EV.js +513 -0
- package/dist/chunk-7PM6K5EV.js.map +1 -0
- package/dist/{chunk-MTEWLGVY.js → chunk-BPYMC7SU.js} +4 -48
- package/dist/chunk-BPYMC7SU.js.map +1 -0
- package/dist/chunk-BU6RJPPJ.js +421 -0
- package/dist/chunk-BU6RJPPJ.js.map +1 -0
- package/dist/{chunk-FB2HBNIC.js → chunk-BX6EUYHU.js} +6 -2
- package/dist/chunk-BX6EUYHU.js.map +1 -0
- package/dist/{chunk-BIVCP6X5.js → chunk-C62IZEJI.js} +465 -202
- package/dist/chunk-C62IZEJI.js.map +1 -0
- package/dist/chunk-D4VP2QPR.js +16 -0
- package/dist/chunk-D4VP2QPR.js.map +1 -0
- package/dist/{chunk-J5MXCGKA.js → chunk-DHAD2O3S.js} +6 -6
- package/dist/chunk-DHAD2O3S.js.map +1 -0
- package/dist/chunk-E43VJ3E5.js +188 -0
- package/dist/chunk-E43VJ3E5.js.map +1 -0
- package/dist/chunk-EVZKNA2W.js +110 -0
- package/dist/chunk-EVZKNA2W.js.map +1 -0
- package/dist/chunk-FD4ZDTQ6.js +181 -0
- package/dist/chunk-FD4ZDTQ6.js.map +1 -0
- package/dist/chunk-FDOOBTXJ.js +17 -0
- package/dist/chunk-FDOOBTXJ.js.map +1 -0
- package/dist/chunk-FH3SQR6P.js +275 -0
- package/dist/chunk-FH3SQR6P.js.map +1 -0
- package/dist/chunk-HJHGTFEJ.js +23 -0
- package/dist/chunk-HJHGTFEJ.js.map +1 -0
- package/dist/{chunk-LXAESF4Y.js → chunk-HK4AZBKX.js} +7 -4
- package/dist/chunk-HK4AZBKX.js.map +1 -0
- package/dist/{chunk-T5C46IIU.js → chunk-HWBRS4DZ.js} +28 -269
- package/dist/chunk-HWBRS4DZ.js.map +1 -0
- package/dist/chunk-IRQGAC4L.js +52 -0
- package/dist/chunk-IRQGAC4L.js.map +1 -0
- package/dist/{chunk-FNTLKHZ7.js → chunk-JDN5SAAD.js} +7 -4
- package/dist/chunk-JDN5SAAD.js.map +1 -0
- package/dist/{chunk-GXEX4CBH.js → chunk-JIKNR5LX.js} +673 -484
- package/dist/chunk-JIKNR5LX.js.map +1 -0
- package/dist/{chunk-GRI4XHBJ.js → chunk-JWRCZIA4.js} +266 -108
- package/dist/chunk-JWRCZIA4.js.map +1 -0
- package/dist/{chunk-E576KYYT.js → chunk-KI4DOTN4.js} +25 -2
- package/dist/chunk-KI4DOTN4.js.map +1 -0
- package/dist/{chunk-ZB7D62OA.js → chunk-KUZVRJ7M.js} +3 -3
- package/dist/chunk-L4VFNFDL.js +248 -0
- package/dist/chunk-L4VFNFDL.js.map +1 -0
- package/dist/chunk-M2WC5MF7.js +127 -0
- package/dist/chunk-M2WC5MF7.js.map +1 -0
- package/dist/{chunk-O3JIAU3V.js → chunk-MCTC6HSE.js} +157 -103
- package/dist/chunk-MCTC6HSE.js.map +1 -0
- package/dist/{chunk-PXFXSFJL.js → chunk-NZ5JU6D3.js} +9 -9
- package/dist/{chunk-YRBR424R.js → chunk-OAUI273L.js} +338 -165
- package/dist/chunk-OAUI273L.js.map +1 -0
- package/dist/chunk-OGLS76RN.js +43 -0
- package/dist/chunk-OGLS76RN.js.map +1 -0
- package/dist/{chunk-7LVM22VG.js → chunk-OQCRCXCP.js} +6 -6
- package/dist/chunk-OQCRCXCP.js.map +1 -0
- package/dist/{chunk-OLGPYOLO.js → chunk-P6OS7652.js} +5 -2
- package/dist/chunk-P6OS7652.js.map +1 -0
- package/dist/chunk-Q5L5EGWZ.js +26 -0
- package/dist/chunk-Q5L5EGWZ.js.map +1 -0
- package/dist/{chunk-S433N3CT.js → chunk-QTHVHNJJ.js} +6 -36
- package/dist/chunk-QTHVHNJJ.js.map +1 -0
- package/dist/chunk-RPET332G.js +84 -0
- package/dist/chunk-RPET332G.js.map +1 -0
- package/dist/{chunk-646CA6RV.js → chunk-RQW5YMH7.js} +12 -4
- package/dist/chunk-RQW5YMH7.js.map +1 -0
- package/dist/{chunk-XALU5LCU.js → chunk-RWNYIU6A.js} +550 -146
- package/dist/chunk-RWNYIU6A.js.map +1 -0
- package/dist/chunk-SL7YUHPV.js +111 -0
- package/dist/chunk-SL7YUHPV.js.map +1 -0
- package/dist/chunk-U5PWXS3J.js +39 -0
- package/dist/chunk-U5PWXS3J.js.map +1 -0
- package/dist/chunk-ULDCFL2O.js +273 -0
- package/dist/chunk-ULDCFL2O.js.map +1 -0
- package/dist/{chunk-RWNSW4FM.js → chunk-UMNXCU3K.js} +12 -6
- package/dist/{chunk-RWNSW4FM.js.map → chunk-UMNXCU3K.js.map} +1 -1
- package/dist/chunk-VI7ZANB3.js +193 -0
- package/dist/chunk-VI7ZANB3.js.map +1 -0
- package/dist/chunk-VQPHPQ5L.js +14 -0
- package/dist/chunk-VQPHPQ5L.js.map +1 -0
- package/dist/chunk-WNJTJRM6.js +147 -0
- package/dist/chunk-WNJTJRM6.js.map +1 -0
- package/dist/chunk-WOBSEO75.js +790 -0
- package/dist/chunk-WOBSEO75.js.map +1 -0
- package/dist/{chunk-BMHS4WAN.js → chunk-XS7EX55U.js} +156 -42
- package/dist/chunk-XS7EX55U.js.map +1 -0
- package/dist/chunk-YN4W7LCX.js +31 -0
- package/dist/chunk-YN4W7LCX.js.map +1 -0
- package/dist/chunk-YSJOZEI6.js +1 -0
- package/dist/{chunk-JA2ZAT5Q.js → chunk-Z4PJMZLM.js} +2 -2
- package/dist/chunk-Z4PJMZLM.js.map +1 -0
- package/dist/{chunk-7VPQHEAJ.js → chunk-ZNZISJDZ.js} +6 -2
- package/dist/chunk-ZNZISJDZ.js.map +1 -0
- package/dist/chunk-ZWN3AODA.js +11 -0
- package/dist/chunk-ZWN3AODA.js.map +1 -0
- package/dist/cli/index.js +25 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/client/core.d.ts +1 -1
- package/dist/client/core.js +2 -0
- package/dist/client/core.js.map +1 -1
- package/dist/client/index.d.ts +44 -10
- package/dist/client/index.js +35 -0
- package/dist/client/index.js.map +1 -1
- package/dist/cloudflare-SIG42OIW.js +335 -0
- package/dist/cloudflare-SIG42OIW.js.map +1 -0
- package/dist/config-support-WQHQIJTA.js +104 -0
- package/dist/config-support-WQHQIJTA.js.map +1 -0
- package/dist/{csrf-BBrEZSBW.d.ts → csrf-Dgot9qSM.d.ts} +1 -1
- package/dist/deno-deploy-LQAYOOPW.js +196 -0
- package/dist/deno-deploy-LQAYOOPW.js.map +1 -0
- package/dist/{dev-MUWJAZRD.js → dev-ANDSEVLB.js} +28 -18
- package/dist/dev-ANDSEVLB.js.map +1 -0
- package/dist/{dev-emit-GWD6IXV7.js → dev-emit-BFNMDCPB.js} +5 -5
- package/dist/{dev-emit-NBT6JD7R.js → dev-emit-MVAJAFGX.js} +5 -3
- package/dist/dev-emit-MVAJAFGX.js.map +1 -0
- package/dist/engine-singleton-X4R7AZBJ.js +315 -0
- package/dist/engine-singleton-X4R7AZBJ.js.map +1 -0
- package/dist/{generate-Y3GWM57K.js → generate-EN6EDITF.js} +43 -4
- package/dist/generate-EN6EDITF.js.map +1 -0
- package/dist/index-CzxtQcnp.d.ts +1058 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +24 -13
- package/dist/index.js.map +1 -1
- package/dist/{info-XW7HGUPH.js → info-Y55RWS42.js} +8 -6
- package/dist/{info-XW7HGUPH.js.map → info-Y55RWS42.js.map} +1 -1
- package/dist/{internal-api-V5L65YSJ.js → internal-api-IP35YU3G.js} +22 -12
- package/dist/{internal-api-WEOSTMSN.js → internal-api-OPU456AT.js} +30 -16
- package/dist/internal-api-OPU456AT.js.map +1 -0
- package/dist/load-config-4ATXQUN3.js +16 -0
- package/dist/match-DmGgxjIU.d.ts +44 -0
- package/dist/{mcp-ULUFJNSZ.js → mcp-5LLNAGKA.js} +7 -7
- package/dist/netlify-C2IRCZKI.js +245 -0
- package/dist/netlify-C2IRCZKI.js.map +1 -0
- package/dist/node-OSVPYQ3D.js +10 -0
- package/dist/nonce-BXt7Qu_C.d.ts +31 -0
- package/dist/observability-bootstrap-MZMSOE66.js +15 -0
- package/dist/{openapi-HZXR335W.js → openapi-VFPEZSRI.js} +13 -11
- package/dist/{openapi-HZXR335W.js.map → openapi-VFPEZSRI.js.map} +1 -1
- package/dist/{plugin-runner-BFEcgtmJ.d.ts → plugin-runner-BVMOSxvb.d.ts} +1 -1
- package/dist/{plugin-types-D69-lJZ9.d.ts → plugin-types-BUVfUQ0V.d.ts} +13 -1
- package/dist/preview-GHPT2EQ5.js +23 -0
- package/dist/preview-GHPT2EQ5.js.map +1 -0
- package/dist/provider-resolver-Dx6QuWrw.d.ts +128 -0
- package/dist/registry-KBZDCFVQ.js +23 -0
- package/dist/route-config-Cm_ZMA1C.d.ts +72 -0
- package/dist/route-policy-BxOycCDq.d.ts +65 -0
- package/dist/router/element-scroll-restoration.d.ts +28 -0
- package/dist/router/element-scroll-restoration.js +96 -0
- package/dist/router/element-scroll-restoration.js.map +1 -0
- package/dist/{routes-OLNQX7CT.js → routes-BPLU3ISV.js} +11 -9
- package/dist/{routes-OLNQX7CT.js.map → routes-BPLU3ISV.js.map} +1 -1
- package/dist/{scan-7MJC6PYU.js → scan-YJEE4KQK.js} +2 -2
- package/dist/{schema-ZO3OSWVG.js → schema-SOAD43RQ.js} +7 -5
- package/dist/schemas-4AXHQMV3.js +25 -0
- package/dist/schemas-4AXHQMV3.js.map +1 -0
- package/dist/security-headers-Ccj7ncNx.d.ts +129 -0
- package/dist/server/agent/index.d.ts +2 -90
- package/dist/server/agent/index.js +1 -1
- package/dist/server/auth/index.d.ts +2 -21
- package/dist/server/auth/index.js +3 -2
- package/dist/server/cron/index.js +4 -3
- package/dist/server/define/index.d.ts +51 -57
- package/dist/server/define/index.js +10 -1
- package/dist/server/http/index.d.ts +7 -5
- package/dist/server/http/index.js +56 -12
- package/dist/server/index.d.ts +47 -439
- package/dist/server/index.js +119 -201
- package/dist/server/index.js.map +1 -1
- package/dist/server/jobs/index.js +4 -3
- package/dist/server/observability/index.d.ts +109 -35
- package/dist/server/observability/index.js +10 -7
- package/dist/server/plugins/index.d.ts +3 -3
- package/dist/server/scan/index.d.ts +47 -12
- package/dist/server/scan/index.js +13 -4
- package/dist/server/security/index.d.ts +61 -103
- package/dist/server/security/index.js +15 -6
- package/dist/server/webhook/index.d.ts +90 -3
- package/dist/server/webhook/index.js +12 -2
- package/dist/server-boundary-6B4ZQUY7.js +148 -0
- package/dist/server-boundary-6B4ZQUY7.js.map +1 -0
- package/dist/server-boundary-7VZQRPPX.js +133 -0
- package/dist/server-boundary-7VZQRPPX.js.map +1 -0
- package/dist/{services-typed-client-PSAGRPFF.js → services-typed-client-XGT5SUUN.js} +2 -2
- package/dist/{start-KR2JJR7K.js → start-UZDMOT7I.js} +342 -111
- package/dist/start-UZDMOT7I.js.map +1 -0
- package/dist/{static-M2W4HUWS.js → static-SVDWIOXJ.js} +24 -13
- package/dist/static-SVDWIOXJ.js.map +1 -0
- package/dist/{theo-cloud-XAHWOUFK.js → theo-cloud-3ET4G5T6.js} +9 -2
- package/dist/theo-cloud-3ET4G5T6.js.map +1 -0
- package/dist/vercel-BMCQKCWE.js +277 -0
- package/dist/vercel-BMCQKCWE.js.map +1 -0
- package/dist/vite-plugin/index.js +24 -13
- package/dist/vite-plugin-VKCT2LF2.js +42 -0
- package/dist/vite-plugin-VKCT2LF2.js.map +1 -0
- package/package.json +19 -6
- package/dist/actions-virtual-module-YQXRSSMW.js.map +0 -1
- package/dist/agent-7JJW3TPB.js +0 -15
- package/dist/app-typed-client-G3J5G7E5.js.map +0 -1
- package/dist/app-typed-client-GHO3EWZK.js.map +0 -1
- package/dist/aws-lambda-CYNDGU5O.js +0 -172
- package/dist/aws-lambda-CYNDGU5O.js.map +0 -1
- package/dist/build-WU6AKKIB.js.map +0 -1
- package/dist/bun-33RD6K7O.js.map +0 -1
- package/dist/chunk-646CA6RV.js.map +0 -1
- package/dist/chunk-6E5WKMDS.js +0 -67
- package/dist/chunk-6E5WKMDS.js.map +0 -1
- package/dist/chunk-6GGWS7J3.js +0 -91
- package/dist/chunk-6GGWS7J3.js.map +0 -1
- package/dist/chunk-7LVM22VG.js.map +0 -1
- package/dist/chunk-7VPQHEAJ.js.map +0 -1
- package/dist/chunk-A7JBF5FO.js.map +0 -1
- package/dist/chunk-AM3QABW5.js +0 -161
- package/dist/chunk-AM3QABW5.js.map +0 -1
- package/dist/chunk-BIVCP6X5.js.map +0 -1
- package/dist/chunk-BMHS4WAN.js.map +0 -1
- package/dist/chunk-E576KYYT.js.map +0 -1
- package/dist/chunk-FB2HBNIC.js.map +0 -1
- package/dist/chunk-FNTLKHZ7.js.map +0 -1
- package/dist/chunk-GRI4XHBJ.js.map +0 -1
- package/dist/chunk-GVW5EKEU.js +0 -422
- package/dist/chunk-GVW5EKEU.js.map +0 -1
- package/dist/chunk-GXEX4CBH.js.map +0 -1
- package/dist/chunk-HBU2GIMZ.js.map +0 -1
- package/dist/chunk-IEES3CHD.js.map +0 -1
- package/dist/chunk-J5MXCGKA.js.map +0 -1
- package/dist/chunk-JA2ZAT5Q.js.map +0 -1
- package/dist/chunk-KD5G3YXI.js.map +0 -1
- package/dist/chunk-LNVMHQ2Z.js +0 -54
- package/dist/chunk-LNVMHQ2Z.js.map +0 -1
- package/dist/chunk-LXAESF4Y.js.map +0 -1
- package/dist/chunk-MTEWLGVY.js.map +0 -1
- package/dist/chunk-O3JIAU3V.js.map +0 -1
- package/dist/chunk-OJLL4YD6.js +0 -403
- package/dist/chunk-OJLL4YD6.js.map +0 -1
- package/dist/chunk-OLGPYOLO.js.map +0 -1
- package/dist/chunk-S433N3CT.js.map +0 -1
- package/dist/chunk-T5C46IIU.js.map +0 -1
- package/dist/chunk-U267AOWS.js +0 -28
- package/dist/chunk-U267AOWS.js.map +0 -1
- package/dist/chunk-UW2TEAGR.js +0 -77
- package/dist/chunk-UW2TEAGR.js.map +0 -1
- package/dist/chunk-WPJOTQA5.js +0 -1
- package/dist/chunk-XALU5LCU.js.map +0 -1
- package/dist/chunk-XR74JD4M.js +0 -457
- package/dist/chunk-XR74JD4M.js.map +0 -1
- package/dist/chunk-YGAXV5HR.js.map +0 -1
- package/dist/chunk-YRBR424R.js.map +0 -1
- package/dist/cloudflare-KYUWCEPL.js +0 -122
- package/dist/cloudflare-KYUWCEPL.js.map +0 -1
- package/dist/deno-deploy-CCTB7HGS.js +0 -107
- package/dist/deno-deploy-CCTB7HGS.js.map +0 -1
- package/dist/dev-MUWJAZRD.js.map +0 -1
- package/dist/dev-emit-NBT6JD7R.js.map +0 -1
- package/dist/generate-Y3GWM57K.js.map +0 -1
- package/dist/index-BEtEv6ZH.d.ts +0 -575
- package/dist/load-config-VKD6LKWU.js +0 -14
- package/dist/match-CfbEFRG4.d.ts +0 -26
- package/dist/netlify-AFMDNKT4.js +0 -150
- package/dist/netlify-AFMDNKT4.js.map +0 -1
- package/dist/node-ZJQEJSP3.js +0 -10
- package/dist/registry-GKR3EWRW.js +0 -23
- package/dist/start-KR2JJR7K.js.map +0 -1
- package/dist/static-M2W4HUWS.js.map +0 -1
- package/dist/theo-cloud-XAHWOUFK.js.map +0 -1
- package/dist/vercel-SRS2DH6O.js +0 -133
- package/dist/vercel-SRS2DH6O.js.map +0 -1
- package/dist/vite-plugin-VPJFD4HK.js +0 -36
- /package/dist/{chunk-WPJOTQA5.js.map → adapters/agent-mount.js.map} +0 -0
- /package/dist/{agent-7JJW3TPB.js.map → agent-GKUEL6OH.js.map} +0 -0
- /package/dist/{check-45NKUVSQ.js.map → check-GIPZBFTX.js.map} +0 -0
- /package/dist/{chunk-47CINLWF.js.map → chunk-44J2ANQC.js.map} +0 -0
- /package/dist/{chunk-ZB7D62OA.js.map → chunk-KUZVRJ7M.js.map} +0 -0
- /package/dist/{chunk-PXFXSFJL.js.map → chunk-NZ5JU6D3.js.map} +0 -0
- /package/dist/{internal-api-WEOSTMSN.js.map → chunk-YSJOZEI6.js.map} +0 -0
- /package/dist/{dev-emit-GWD6IXV7.js.map → dev-emit-BFNMDCPB.js.map} +0 -0
- /package/dist/{internal-api-V5L65YSJ.js.map → internal-api-IP35YU3G.js.map} +0 -0
- /package/dist/{load-config-VKD6LKWU.js.map → load-config-4ATXQUN3.js.map} +0 -0
- /package/dist/{mcp-ULUFJNSZ.js.map → mcp-5LLNAGKA.js.map} +0 -0
- /package/dist/{node-ZJQEJSP3.js.map → node-OSVPYQ3D.js.map} +0 -0
- /package/dist/{scan-7MJC6PYU.js.map → observability-bootstrap-MZMSOE66.js.map} +0 -0
- /package/dist/{registry-GKR3EWRW.js.map → registry-KBZDCFVQ.js.map} +0 -0
- /package/dist/{schema-ZO3OSWVG.js.map → scan-YJEE4KQK.js.map} +0 -0
- /package/dist/{vite-plugin-VPJFD4HK.js.map → schema-SOAD43RQ.js.map} +0 -0
- /package/dist/{services-typed-client-PSAGRPFF.js.map → services-typed-client-XGT5SUUN.js.map} +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import { S as SecurityHeadersConfig, c as SecurityEnv, d as SecurityHeadersOptions } from '../../security-headers-Ccj7ncNx.js';
|
|
3
|
+
export { C as CspMode, D as DEFAULT_CSP, a as DEFAULT_PERMISSIONS_POLICY, b as buildSecurityHeaders } from '../../security-headers-Ccj7ncNx.js';
|
|
2
4
|
import { A as AuditLogger } from '../../audit-log-BQWM5YLG.js';
|
|
3
|
-
export {
|
|
5
|
+
export { a as CSRF_WARN_CODE, b as CSRF_WARN_DOCS_URL, c as CsrfLogger, C as CsrfMode, d as CsrfWarnPayload, D as DisallowedConfig, e as enforceCsrf, m as matchDisallowed, v as validateCsrf, f as validateCsrfRequest } from '../../csrf-Dgot9qSM.js';
|
|
4
6
|
import { C as CsrfReadinessStore } from '../../csrf-readiness-store-CjIoub3U.js';
|
|
5
7
|
export { a as CsrfReadinessRouteSummary, b as CsrfReadinessSummary, c as CsrfWarnRecord } from '../../csrf-readiness-store-CjIoub3U.js';
|
|
6
8
|
|
|
@@ -73,121 +75,77 @@ declare function handleCsrfReadiness(req: IncomingMessage, res: ServerResponse,
|
|
|
73
75
|
declare function handleCsrfReadinessRequest(request: Request, store: CsrfReadinessStore): Promise<Response | null>;
|
|
74
76
|
|
|
75
77
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* route handler runs so a handler can still override via `res.setHeader`.
|
|
80
|
-
*
|
|
81
|
-
* EC-2 backward-compatibility: CSP ships in `report-only` mode by default
|
|
82
|
-
* for 0.2.0. Existing apps with inline scripts or third-party CDN scripts
|
|
83
|
-
* keep working but consumers see violation reports via their CSP report
|
|
84
|
-
* collector (or browser DevTools). 0.3.0 will flip the default to
|
|
85
|
-
* `enforce` after a release of visibility.
|
|
86
|
-
*/
|
|
87
|
-
/**
|
|
88
|
-
* Default Content-Security-Policy. Conservative-but-not-paralyzing:
|
|
89
|
-
*
|
|
90
|
-
* - default-src 'self' — every fetch falls back to same-origin
|
|
91
|
-
* - script-src 'self' — T6.1 (0.3.0): `'unsafe-inline'`
|
|
92
|
-
* dropped. The SSR pipeline issues a
|
|
93
|
-
* per-request nonce that REPLACES
|
|
94
|
-
* this directive at runtime
|
|
95
|
-
* (`'nonce-<token>'`). For static /
|
|
96
|
-
* non-SSR contexts where no nonce is
|
|
97
|
-
* available, the policy is strict-
|
|
98
|
-
* no-inline — user inline scripts
|
|
99
|
-
* must be migrated to external
|
|
100
|
-
* `<script src="...">` or threaded
|
|
101
|
-
* through `ctx.nonce`.
|
|
102
|
-
* - style-src 'self' 'unsafe-inline' — Tailwind + TheoUI use style attrs
|
|
103
|
-
* in animation directives
|
|
104
|
-
* - img-src 'self' data: blob: — supports inline data URIs, blobs
|
|
105
|
-
* from canvas exports
|
|
106
|
-
* - font-src 'self' data: — Geist fonts inline-base64
|
|
107
|
-
* - connect-src 'self' ws: wss: — WebSocket dev HMR + agent streams
|
|
108
|
-
* - frame-ancestors 'none' — clickjacking defense
|
|
109
|
-
*/
|
|
110
|
-
/**
|
|
111
|
-
* T5.1 — default CSP includes the built-in report endpoint so violations
|
|
112
|
-
* are visible without extra config. Apps that ship a custom `csp` string
|
|
113
|
-
* override the report-uri.
|
|
114
|
-
*/
|
|
115
|
-
declare const DEFAULT_CSP: string;
|
|
116
|
-
/**
|
|
117
|
-
* T1.1 — Default Permissions-Policy header (default-deny stance).
|
|
118
|
-
*
|
|
119
|
-
* Disables sensitive Web APIs that the vast majority of apps don't use.
|
|
120
|
-
* Apps that DO need any of these opt in by overriding `permissionsPolicy`
|
|
121
|
-
* in `config.security.headers`.
|
|
122
|
-
*
|
|
123
|
-
* The seven features listed are the most-abused for: tracking
|
|
124
|
-
* (geolocation, accelerometer, gyroscope), spyware (camera, microphone),
|
|
125
|
-
* fraud (payment), and hardware exfiltration (usb).
|
|
126
|
-
*
|
|
127
|
-
* Aligns with Mozilla baseline + OWASP Secure Headers + Lighthouse PWA.
|
|
78
|
+
* Apply security headers to a Node ServerResponse. Called by the
|
|
79
|
+
* api-middleware before the route handler runs. The handler can override
|
|
80
|
+
* any header via `res.setHeader()` — last write wins by Node convention.
|
|
128
81
|
*/
|
|
129
|
-
declare
|
|
130
|
-
|
|
131
|
-
interface
|
|
132
|
-
/**
|
|
133
|
-
* Custom CSP policy string. When set, replaces the default verbatim.
|
|
134
|
-
* Pass `false` to disable CSP entirely (alias for `cspMode: 'off'`).
|
|
135
|
-
*/
|
|
136
|
-
csp?: string | false;
|
|
82
|
+
declare function applySecurityHeaders(res: ServerResponse, config: SecurityHeadersConfig, env: SecurityEnv, options?: SecurityHeadersOptions): void;
|
|
83
|
+
|
|
84
|
+
interface CsrfMultiHeaderOptions {
|
|
137
85
|
/**
|
|
138
|
-
*
|
|
139
|
-
*
|
|
86
|
+
* Wildcard-aware allowlist of additional origins (beyond same-origin).
|
|
87
|
+
* Example: `['app.example.com', '*.staging.example.com']`.
|
|
140
88
|
*/
|
|
141
|
-
|
|
89
|
+
allowedOrigins?: readonly string[];
|
|
142
90
|
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
91
|
+
* Whether to trust `x-forwarded-host`/`x-forwarded-proto` headers when
|
|
92
|
+
* deriving the request's own origin. Default `false` (EC-5). Set to
|
|
93
|
+
* `true` only when running behind a reverse proxy that strips untrusted
|
|
94
|
+
* forwarded headers from inbound requests.
|
|
146
95
|
*/
|
|
147
|
-
|
|
148
|
-
/** X-Frame-Options. Default DENY. */
|
|
149
|
-
frameOptions?: 'DENY' | 'SAMEORIGIN';
|
|
150
|
-
/** X-Content-Type-Options. Default `nosniff`. */
|
|
151
|
-
contentTypeOptions?: 'nosniff';
|
|
152
|
-
/** Referrer-Policy. Default `strict-origin-when-cross-origin`. */
|
|
153
|
-
referrerPolicy?: string;
|
|
96
|
+
trustForwardedHeaders?: boolean;
|
|
154
97
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* containing CR/LF (EC-3 — CWE-113 HTTP Response Splitting mitigation).
|
|
98
|
+
* Allow requests when none of Sec-Fetch-Site / Origin / Referer are
|
|
99
|
+
* present (e.g., handcrafted curl). Default `false`. Strict mode rejects
|
|
100
|
+
* such requests because cookies/sessions can still be sent.
|
|
159
101
|
*/
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
interface SecurityEnv {
|
|
163
|
-
production: boolean;
|
|
102
|
+
allowRequestsWithoutOriginCheck?: boolean;
|
|
164
103
|
}
|
|
104
|
+
type CsrfDecision = {
|
|
105
|
+
allow: true;
|
|
106
|
+
signal: 'sec-fetch-site' | 'origin' | 'referer' | 'no-headers-allowed';
|
|
107
|
+
} | {
|
|
108
|
+
allow: false;
|
|
109
|
+
signal: 'sec-fetch-site' | 'origin' | 'referer' | 'no-headers';
|
|
110
|
+
reason: string;
|
|
111
|
+
};
|
|
165
112
|
/**
|
|
166
|
-
*
|
|
113
|
+
* T5a.2 Phase B slice 2/6 — Web-Standards multi-header CSRF evaluator.
|
|
114
|
+
* Consumes `request.headers.get(name)` (native Headers API).
|
|
167
115
|
*
|
|
168
|
-
* - `
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
116
|
+
* **EC-10 note:** the Web `Headers` API collapses multi-value headers into a
|
|
117
|
+
* single comma-separated string at parse time, and that string fails to parse
|
|
118
|
+
* as a URL — so a repeated Origin is rejected by the Origin branch rather than
|
|
119
|
+
* by a signal of its own. (`headers.getSetCookie()` — `Set-Cookie` is the only
|
|
120
|
+
* multi-value header the Web spec exposes; all others are single-valued at the
|
|
121
|
+
* API layer.)
|
|
122
|
+
*
|
|
123
|
+
* Available to `executeWebRequest` consumers who want an origin-based policy
|
|
124
|
+
* alongside the custom-header `validateCsrfRequest`.
|
|
176
125
|
*/
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
prerender?: boolean;
|
|
180
|
-
}
|
|
126
|
+
declare function evaluateCsrfMultiHeaderRequest(request: Request, options?: CsrfMultiHeaderOptions): CsrfDecision;
|
|
127
|
+
|
|
181
128
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
129
|
+
* Wildcard origin matching for CSRF allowlist.
|
|
130
|
+
*
|
|
131
|
+
* Per plan g3-server-actions-and-useaction v1.2 § Phase 2 / T2.1 + ADR D3.
|
|
132
|
+
* Port of Next.js csrf-protection.ts:6-94 — DNS case-insensitive matching
|
|
133
|
+
* with single (`*.example.com`) and double (`**.example.com`) asterisk
|
|
134
|
+
* subdomain wildcards.
|
|
135
|
+
*
|
|
136
|
+
* Single asterisk matches exactly one subdomain segment; double asterisk
|
|
137
|
+
* matches one or more (recursive). Bare `*` or `**` alone (no domain suffix)
|
|
138
|
+
* are rejected as invalid patterns — prevents `*` matching everything.
|
|
184
139
|
*/
|
|
185
|
-
declare function buildSecurityHeaders(config: SecurityHeadersConfig, env: SecurityEnv, options?: SecurityHeadersOptions): Record<string, string>;
|
|
186
140
|
/**
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* any header via `res.setHeader()` — last write wins by Node convention.
|
|
141
|
+
* Match a domain against a wildcard pattern. DNS-spec case-insensitive
|
|
142
|
+
* (RFC 1035) via ASCII-only lowercasing (avoids Unicode quirks).
|
|
190
143
|
*/
|
|
191
|
-
declare function
|
|
144
|
+
declare function matchWildcardDomain(domain: string, pattern: string): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Check whether `originDomain` is in `allowedOrigins`, with wildcard support.
|
|
147
|
+
* Returns `true` if any allowlist entry matches.
|
|
148
|
+
*/
|
|
149
|
+
declare function isCsrfOriginAllowed(originDomain: string, allowedOrigins?: readonly string[]): boolean;
|
|
192
150
|
|
|
193
|
-
export { CSP_REPORT_PATH, CSRF_READINESS_PATH, CSRF_READINESS_RESET_PATH, type
|
|
151
|
+
export { CSP_REPORT_PATH, CSRF_READINESS_PATH, CSRF_READINESS_RESET_PATH, type CspReportHandlerOptions, type CspViolation, type CsrfDecision, type CsrfMultiHeaderOptions, CsrfReadinessStore, SecurityEnv, SecurityHeadersConfig, SecurityHeadersOptions, applySecurityHeaders, evaluateCsrfMultiHeaderRequest, handleCspReport, handleCspReportRequest, handleCsrfReadiness, handleCsrfReadinessRequest, isCsrfOriginAllowed, matchWildcardDomain, normalizeLegacy, normalizeNew };
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
evaluateCsrfMultiHeaderRequest,
|
|
3
|
+
isCsrfOriginAllowed,
|
|
4
|
+
matchWildcardDomain
|
|
5
|
+
} from "../../chunk-WNJTJRM6.js";
|
|
2
6
|
import {
|
|
3
7
|
CSP_REPORT_PATH,
|
|
4
8
|
CSRF_READINESS_PATH,
|
|
5
9
|
CSRF_READINESS_RESET_PATH,
|
|
6
10
|
CsrfReadinessStore,
|
|
7
|
-
DEFAULT_CSP,
|
|
8
|
-
DEFAULT_PERMISSIONS_POLICY,
|
|
9
11
|
applySecurityHeaders,
|
|
10
|
-
buildSecurityHeaders,
|
|
11
12
|
handleCspReport,
|
|
12
13
|
handleCspReportRequest,
|
|
13
14
|
handleCsrfReadiness,
|
|
14
15
|
handleCsrfReadinessRequest,
|
|
15
16
|
normalizeLegacy,
|
|
16
17
|
normalizeNew
|
|
17
|
-
} from "../../chunk-
|
|
18
|
+
} from "../../chunk-BPYMC7SU.js";
|
|
19
|
+
import {
|
|
20
|
+
DEFAULT_CSP,
|
|
21
|
+
DEFAULT_PERMISSIONS_POLICY,
|
|
22
|
+
buildSecurityHeaders
|
|
23
|
+
} from "../../chunk-IRQGAC4L.js";
|
|
18
24
|
import {
|
|
19
25
|
CSRF_WARN_CODE,
|
|
20
26
|
CSRF_WARN_DOCS_URL,
|
|
@@ -22,7 +28,7 @@ import {
|
|
|
22
28
|
matchDisallowed,
|
|
23
29
|
validateCsrf,
|
|
24
30
|
validateCsrfRequest
|
|
25
|
-
} from "../../chunk-
|
|
31
|
+
} from "../../chunk-P6OS7652.js";
|
|
26
32
|
import "../../chunk-AVQU5CQF.js";
|
|
27
33
|
import "../../chunk-XTHN6JBX.js";
|
|
28
34
|
export {
|
|
@@ -37,11 +43,14 @@ export {
|
|
|
37
43
|
applySecurityHeaders,
|
|
38
44
|
buildSecurityHeaders,
|
|
39
45
|
enforceCsrf,
|
|
46
|
+
evaluateCsrfMultiHeaderRequest,
|
|
40
47
|
handleCspReport,
|
|
41
48
|
handleCspReportRequest,
|
|
42
49
|
handleCsrfReadiness,
|
|
43
50
|
handleCsrfReadinessRequest,
|
|
51
|
+
isCsrfOriginAllowed,
|
|
44
52
|
matchDisallowed,
|
|
53
|
+
matchWildcardDomain,
|
|
45
54
|
normalizeLegacy,
|
|
46
55
|
normalizeNew,
|
|
47
56
|
validateCsrf,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DefineWebhookOptions, b as WebhookDefinition } from '../../webhook-types-DGIjjcaI.js';
|
|
2
|
-
export {
|
|
1
|
+
import { D as DefineWebhookOptions, b as WebhookDefinition, V as VerifyFn } from '../../webhook-types-DGIjjcaI.js';
|
|
2
|
+
export { a as VerifyResult, W as WebhookContext } from '../../webhook-types-DGIjjcaI.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Constant-time byte comparison.
|
|
@@ -104,4 +104,91 @@ declare function defineWebhook(opts: DefineWebhookOptions): WebhookDefinition;
|
|
|
104
104
|
*/
|
|
105
105
|
declare function dispatchWebhook(def: WebhookDefinition, request: Request): Promise<Response>;
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Stripe webhook signature verification per official spec.
|
|
109
|
+
*
|
|
110
|
+
* Header format: `stripe-signature: t=<ts>, v1=<sig1>[, v1=<sig2>]...`
|
|
111
|
+
* Basestring: `${t}.${rawBody}`
|
|
112
|
+
* Algorithm: HMAC-SHA256(secret, basestring) → hex
|
|
113
|
+
*
|
|
114
|
+
* Multi-key (rotation): pass `secret` as `string[]` — verifier tries each
|
|
115
|
+
* until one matches (or all fail).
|
|
116
|
+
*
|
|
117
|
+
* Replay window: `toleranceSeconds` (default 300 = 5 min, matching
|
|
118
|
+
* stripe-node defaults). Requests outside the window return `{ ok: false,
|
|
119
|
+
* reason: 'timestamp out of tolerance' }`.
|
|
120
|
+
*
|
|
121
|
+
* @see https://docs.stripe.com/webhooks/signatures
|
|
122
|
+
*/
|
|
123
|
+
interface StripeWebhookOptions {
|
|
124
|
+
/** Webhook signing secret (`whsec_...`). Pass array for key rotation. */
|
|
125
|
+
secret: string | readonly string[];
|
|
126
|
+
/** Replay window in seconds. Default 300 (5 minutes). */
|
|
127
|
+
toleranceSeconds?: number;
|
|
128
|
+
}
|
|
129
|
+
declare function stripe(opts: StripeWebhookOptions): VerifyFn;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* GitHub webhook signature verification per official spec.
|
|
133
|
+
*
|
|
134
|
+
* Header: `X-Hub-Signature-256: sha256=<hex>`
|
|
135
|
+
* Algorithm: HMAC-SHA256(secret, rawBody) → hex
|
|
136
|
+
*
|
|
137
|
+
* No timestamp → no replay window. Replay protection is the caller's
|
|
138
|
+
* responsibility (idempotent handler).
|
|
139
|
+
*
|
|
140
|
+
* @see https://docs.github.com/en/webhooks/using-webhooks/validating-webhook-deliveries
|
|
141
|
+
*/
|
|
142
|
+
interface GitHubWebhookOptions {
|
|
143
|
+
/** Webhook secret. Pass array for key rotation. */
|
|
144
|
+
secret: string | readonly string[];
|
|
145
|
+
}
|
|
146
|
+
declare function github(opts: GitHubWebhookOptions): VerifyFn;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Slack webhook signature verification per official spec.
|
|
150
|
+
*
|
|
151
|
+
* Headers: `X-Slack-Request-Timestamp: <ts>` + `X-Slack-Signature: v0=<hex>`
|
|
152
|
+
* Basestring: `v0:${ts}:${rawBody}`
|
|
153
|
+
* Algorithm: HMAC-SHA256(signingSecret, basestring) → hex → `v0=<hex>`
|
|
154
|
+
*
|
|
155
|
+
* Replay window: `toleranceSeconds` (default 300 = 5 min, matching
|
|
156
|
+
* bolt-js + Slack official guidance).
|
|
157
|
+
*
|
|
158
|
+
* No multi-key rotation (Slack doesn't support it natively — each app
|
|
159
|
+
* has one signing secret).
|
|
160
|
+
*
|
|
161
|
+
* @see https://api.slack.com/authentication/verifying-requests-from-slack
|
|
162
|
+
*/
|
|
163
|
+
interface SlackWebhookOptions {
|
|
164
|
+
/** Slack app's Signing Secret. */
|
|
165
|
+
signingSecret: string;
|
|
166
|
+
/** Replay window in seconds. Default 300 (5 minutes). */
|
|
167
|
+
toleranceSeconds?: number;
|
|
168
|
+
}
|
|
169
|
+
declare function slack(opts: SlackWebhookOptions): VerifyFn;
|
|
170
|
+
|
|
171
|
+
interface TelegramWebhookOptions {
|
|
172
|
+
/** The `secret_token` configured on `setWebhook` (1–256 chars). */
|
|
173
|
+
secretToken: string;
|
|
174
|
+
}
|
|
175
|
+
declare function telegram(opts: TelegramWebhookOptions): VerifyFn;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* M27 — Discord interaction webhook verification.
|
|
179
|
+
*
|
|
180
|
+
* Discord signs each request with Ed25519. Headers: `X-Signature-Ed25519` (hex signature) and
|
|
181
|
+
* `X-Signature-Timestamp`. The signed message is `timestamp + rawBody`; verify against the app's
|
|
182
|
+
* public key (hex). Uses Web Crypto Ed25519 (Node ≥ 22) — no third-party crypto (Rule 9 / Web
|
|
183
|
+
* Standards G8).
|
|
184
|
+
*
|
|
185
|
+
* @see https://discord.com/developers/docs/interactions/overview#setting-up-an-endpoint-validating-security-request-headers
|
|
186
|
+
*/
|
|
187
|
+
|
|
188
|
+
interface DiscordWebhookOptions {
|
|
189
|
+
/** The Discord application's public key (hex). */
|
|
190
|
+
publicKey: string;
|
|
191
|
+
}
|
|
192
|
+
declare function discord(opts: DiscordWebhookOptions): VerifyFn;
|
|
193
|
+
|
|
194
|
+
export { BodyTooLargeError, DEFAULT_MAX_BODY_BYTES, DefineWebhookOptions, type DiscordWebhookOptions, type GitHubWebhookOptions, type RawBodyResult, type ReadRawBodyOptions, type SlackWebhookOptions, type StripeWebhookOptions, type TelegramWebhookOptions, VerifyFn, WebhookDefinition, defineWebhook, discord, dispatchWebhook, github, readRawBody, slack, stripe, telegram, timingSafeEqual };
|
|
@@ -2,18 +2,28 @@ import {
|
|
|
2
2
|
BodyTooLargeError,
|
|
3
3
|
DEFAULT_MAX_BODY_BYTES,
|
|
4
4
|
defineWebhook,
|
|
5
|
+
discord,
|
|
5
6
|
dispatchWebhook,
|
|
7
|
+
github,
|
|
6
8
|
readRawBody,
|
|
9
|
+
slack,
|
|
10
|
+
stripe,
|
|
11
|
+
telegram,
|
|
7
12
|
timingSafeEqual
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
13
|
+
} from "../../chunk-BU6RJPPJ.js";
|
|
14
|
+
import "../../chunk-UMNXCU3K.js";
|
|
10
15
|
import "../../chunk-XTHN6JBX.js";
|
|
11
16
|
export {
|
|
12
17
|
BodyTooLargeError,
|
|
13
18
|
DEFAULT_MAX_BODY_BYTES,
|
|
14
19
|
defineWebhook,
|
|
20
|
+
discord,
|
|
15
21
|
dispatchWebhook,
|
|
22
|
+
github,
|
|
16
23
|
readRawBody,
|
|
24
|
+
slack,
|
|
25
|
+
stripe,
|
|
26
|
+
telegram,
|
|
17
27
|
timingSafeEqual
|
|
18
28
|
};
|
|
19
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveTheoRootDir
|
|
3
|
+
} from "./chunk-VQPHPQ5L.js";
|
|
4
|
+
import "./chunk-SL7YUHPV.js";
|
|
5
|
+
import "./chunk-WOBSEO75.js";
|
|
6
|
+
import "./chunk-RWNYIU6A.js";
|
|
7
|
+
import "./chunk-47FFT43U.js";
|
|
8
|
+
import "./chunk-NTDN54XO.js";
|
|
9
|
+
import "./chunk-MCTC6HSE.js";
|
|
10
|
+
import "./chunk-72DMJBXI.js";
|
|
11
|
+
import "./chunk-VSLTKX5L.js";
|
|
12
|
+
import "./chunk-TNI4MARH.js";
|
|
13
|
+
import "./chunk-OQCRCXCP.js";
|
|
14
|
+
import {
|
|
15
|
+
ACTION_SCHEMAS_DIR
|
|
16
|
+
} from "./chunk-6J4JWHDJ.js";
|
|
17
|
+
import "./chunk-DV34VG3N.js";
|
|
18
|
+
import "./chunk-L4VFNFDL.js";
|
|
19
|
+
import "./chunk-BX6EUYHU.js";
|
|
20
|
+
import "./chunk-BPYMC7SU.js";
|
|
21
|
+
import "./chunk-IRQGAC4L.js";
|
|
22
|
+
import "./chunk-P6OS7652.js";
|
|
23
|
+
import "./chunk-AVQU5CQF.js";
|
|
24
|
+
import "./chunk-ACKBVBUI.js";
|
|
25
|
+
import "./chunk-IZ3TIL6K.js";
|
|
26
|
+
import "./chunk-3PBAN2YE.js";
|
|
27
|
+
import "./chunk-YSJOZEI6.js";
|
|
28
|
+
import "./chunk-Z4PJMZLM.js";
|
|
29
|
+
import "./chunk-UMNXCU3K.js";
|
|
30
|
+
import "./chunk-52PDWL5S.js";
|
|
31
|
+
import "./chunk-5K4TDLRG.js";
|
|
32
|
+
import "./chunk-ZWN3AODA.js";
|
|
33
|
+
import "./chunk-D4VP2QPR.js";
|
|
34
|
+
import "./chunk-YN4W7LCX.js";
|
|
35
|
+
import "./chunk-XTHN6JBX.js";
|
|
36
|
+
|
|
37
|
+
// src/vite-plugin/server-boundary.ts
|
|
38
|
+
import { existsSync, statSync } from "fs";
|
|
39
|
+
import { dirname, isAbsolute, join, relative, resolve } from "path";
|
|
40
|
+
import { fileURLToPath } from "url";
|
|
41
|
+
var THEO_SERVER_SPECIFIER = "theokit/server";
|
|
42
|
+
var SOURCE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs", ".cts", ".cjs"];
|
|
43
|
+
var ServerOnlyImportError = class extends Error {
|
|
44
|
+
name = "ServerOnlyImportError";
|
|
45
|
+
/** The server-only module, as named in the message. */
|
|
46
|
+
module;
|
|
47
|
+
/** The importing file, as named in the message. */
|
|
48
|
+
importer;
|
|
49
|
+
constructor(opts) {
|
|
50
|
+
const wroteSomethingElse = opts.specifier !== void 0 && opts.specifier !== opts.module;
|
|
51
|
+
const message = [
|
|
52
|
+
`Server-only import in the client bundle: ${opts.module} cannot be imported from client code.`,
|
|
53
|
+
``,
|
|
54
|
+
` Imported: ${opts.module}`,
|
|
55
|
+
...wroteSomethingElse ? [` Written: ${String(opts.specifier)}`] : [],
|
|
56
|
+
` From: ${opts.importer}`,
|
|
57
|
+
``,
|
|
58
|
+
`That module runs on the server. It reads the file system, opens the database and holds`,
|
|
59
|
+
`your secrets, so a browser bundle containing it ships all three to every visitor.`,
|
|
60
|
+
``,
|
|
61
|
+
`Call the server from client code instead:`,
|
|
62
|
+
``,
|
|
63
|
+
// Both bindings are the ones the virtual modules actually export — `client` from
|
|
64
|
+
// `app-typed-client.ts` and `actions` from `actions-virtual-module.ts`. A remedy naming a
|
|
65
|
+
// symbol nobody exports reads as actionable and is not, so
|
|
66
|
+
// `tests/unit/server-boundary-rule.test.ts` asserts both against the emitters — the same
|
|
67
|
+
// discipline `tests/unit/policy-gate-remedy-is-importable.test.ts` applies to the policy gate.
|
|
68
|
+
` import { client } from '@theo/client' // typed from your server/routes/**`,
|
|
69
|
+
` import { actions } from '@theo/actions' // typed from your server/actions/**`,
|
|
70
|
+
``,
|
|
71
|
+
`Need only the TYPES? Add \`type\` to the import \u2014 a type-only import is erased before the`,
|
|
72
|
+
`bundler ever sees it:`,
|
|
73
|
+
``,
|
|
74
|
+
` import type { ... } from '${opts.specifier ?? opts.module}'`,
|
|
75
|
+
``,
|
|
76
|
+
`And if this file is itself server code, move it under your server directory, so the client`,
|
|
77
|
+
`graph has no way to reach it.`
|
|
78
|
+
].join("\n");
|
|
79
|
+
super(message);
|
|
80
|
+
this.module = opts.module;
|
|
81
|
+
this.importer = opts.importer;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
function isUnder(child, parent) {
|
|
85
|
+
const rel = relative(parent, child);
|
|
86
|
+
return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
|
|
87
|
+
}
|
|
88
|
+
function nameSourceFile(target) {
|
|
89
|
+
if (existsSync(target) && statSync(target).isFile()) return target;
|
|
90
|
+
const stem = target.replace(/\.[cm]?[jt]sx?$/, "");
|
|
91
|
+
for (const ext of SOURCE_EXTENSIONS) {
|
|
92
|
+
if (existsSync(`${stem}${ext}`)) return `${stem}${ext}`;
|
|
93
|
+
}
|
|
94
|
+
for (const ext of SOURCE_EXTENSIONS) {
|
|
95
|
+
if (existsSync(join(target, `index${ext}`))) return join(target, `index${ext}`);
|
|
96
|
+
}
|
|
97
|
+
return target;
|
|
98
|
+
}
|
|
99
|
+
function forHumans(path, projectRoot) {
|
|
100
|
+
return isUnder(path, projectRoot) ? relative(projectRoot, path) : path;
|
|
101
|
+
}
|
|
102
|
+
function frameworkServerSpecifier(target, theoServerDir) {
|
|
103
|
+
const demangled = target.replace(/[\\/]index\.[cm]?[jt]sx?(?=[\\/])/, "");
|
|
104
|
+
const subpath = relative(theoServerDir, demangled).replace(/\\/g, "/").replace(/(^|\/)index\.[cm]?[jt]sx?$/, "");
|
|
105
|
+
return subpath === "" ? THEO_SERVER_SPECIFIER : `${THEO_SERVER_SPECIFIER}/${subpath}`;
|
|
106
|
+
}
|
|
107
|
+
function serverOnlyImportBoundary(opts) {
|
|
108
|
+
const projectRoot = opts.projectRoot;
|
|
109
|
+
const serverDir = opts.serverDir;
|
|
110
|
+
const isomorphicSchemasDir = join(serverDir, "actions", ACTION_SCHEMAS_DIR);
|
|
111
|
+
const theoServerDir = join(resolveTheoRootDir(dirname(fileURLToPath(import.meta.url))), "server");
|
|
112
|
+
return {
|
|
113
|
+
name: "theo:server-only-import-boundary",
|
|
114
|
+
enforce: "pre",
|
|
115
|
+
resolveId(source, importer, options) {
|
|
116
|
+
if (options.ssr === true) return void 0;
|
|
117
|
+
if (importer === void 0) return void 0;
|
|
118
|
+
if (source === THEO_SERVER_SPECIFIER || source.startsWith(`${THEO_SERVER_SPECIFIER}/`)) {
|
|
119
|
+
throw new ServerOnlyImportError({
|
|
120
|
+
module: source,
|
|
121
|
+
importer: forHumans(importer, projectRoot)
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
if (source.startsWith(".") || isAbsolute(source)) {
|
|
125
|
+
const target = isAbsolute(source) ? source : resolve(dirname(importer), source);
|
|
126
|
+
if (isUnder(target, theoServerDir)) {
|
|
127
|
+
throw new ServerOnlyImportError({
|
|
128
|
+
module: frameworkServerSpecifier(target, theoServerDir),
|
|
129
|
+
importer: forHumans(importer, projectRoot)
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
if (isUnder(target, serverDir) && !isUnder(target, isomorphicSchemasDir)) {
|
|
133
|
+
throw new ServerOnlyImportError({
|
|
134
|
+
module: forHumans(nameSourceFile(target), projectRoot),
|
|
135
|
+
importer: forHumans(importer, projectRoot),
|
|
136
|
+
specifier: source
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return void 0;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
ServerOnlyImportError,
|
|
146
|
+
serverOnlyImportBoundary
|
|
147
|
+
};
|
|
148
|
+
//# sourceMappingURL=server-boundary-6B4ZQUY7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vite-plugin/server-boundary.ts"],"mappings":"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","names":[]}
|