@stacksjs/stx 0.2.904 → 0.2.907

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/dist/app-shell.d.ts +1 -1
  2. package/dist/app-shell.js +1 -1
  3. package/dist/{chunk-n3fgrsva.js → chunk-0d3pkkrv.js} +2 -2
  4. package/dist/{chunk-9y83pdcb.js → chunk-0vyytd9v.js} +3 -3
  5. package/dist/{chunk-v5y66rwr.js → chunk-13awnyq0.js} +1 -1
  6. package/dist/chunk-1dc6h93m.js +2 -0
  7. package/dist/{chunk-ffytbb4x.js → chunk-1ezcxbpg.js} +5 -5
  8. package/dist/{chunk-eb5v9npc.js → chunk-1hx6dyy9.js} +2 -2
  9. package/dist/{chunk-a7bqrjm5.js → chunk-1jxkc6d0.js} +2 -2
  10. package/dist/chunk-20hy5p3p.js +2 -0
  11. package/dist/chunk-20zx1msx.js +2 -0
  12. package/dist/chunk-218pnbaf.js +2 -0
  13. package/dist/chunk-257msenj.js +3 -0
  14. package/dist/chunk-291860br.js +2 -0
  15. package/dist/chunk-2fyey6pn.js +2 -0
  16. package/dist/chunk-2jkq15je.js +2 -0
  17. package/dist/{chunk-eb5cma4b.js → chunk-2m4d8jkv.js} +2 -2
  18. package/dist/{chunk-p89rpak1.js → chunk-2qk2ppgm.js} +1 -1
  19. package/dist/{chunk-arfpzf17.js → chunk-357qjcj1.js} +2 -2
  20. package/dist/chunk-3611xczp.js +3 -0
  21. package/dist/chunk-3dy3hr8r.js +2 -0
  22. package/dist/{chunk-edpsk4bg.js → chunk-3m457a9q.js} +9 -9
  23. package/dist/{chunk-nc5d3a5r.js → chunk-3syagjd7.js} +5 -5
  24. package/dist/{chunk-9fcanx7q.js → chunk-3yr0wyc9.js} +2 -2
  25. package/dist/{chunk-n9axtmxs.js → chunk-42z7zv92.js} +5 -5
  26. package/dist/chunk-4345d8s9.js +2 -0
  27. package/dist/chunk-43kz6rx9.js +2 -0
  28. package/dist/chunk-47ver0g7.js +2 -0
  29. package/dist/chunk-4a6mptfc.js +2 -0
  30. package/dist/{chunk-hdfhaddy.js → chunk-4b110x6r.js} +2 -2
  31. package/dist/chunk-4b9jx2c1.js +2 -0
  32. package/dist/chunk-4dh1b9yr.js +2 -0
  33. package/dist/chunk-4nc8vdef.js +2 -0
  34. package/dist/{chunk-pwpge9bj.js → chunk-5jc9hmwg.js} +2 -2
  35. package/dist/{chunk-ern5hyvr.js → chunk-5jn2qyv7.js} +1 -1
  36. package/dist/{chunk-fcqc9yws.js → chunk-5m4zgt4m.js} +14 -14
  37. package/dist/{chunk-0hcek8nq.js → chunk-6bgerbgh.js} +1 -1
  38. package/dist/{chunk-n1wn4wvm.js → chunk-6qgrr453.js} +3 -3
  39. package/dist/{chunk-ayady5ws.js → chunk-6w9av0n9.js} +2 -2
  40. package/dist/{chunk-hnjeqxqy.js → chunk-6yketqa1.js} +2 -2
  41. package/dist/{chunk-5yvgzh6n.js → chunk-72pbhpq8.js} +2 -2
  42. package/dist/chunk-7k1thytm.js +2 -0
  43. package/dist/{chunk-jwvv842z.js → chunk-83g4169y.js} +19 -19
  44. package/dist/chunk-8f5x16ht.js +2 -0
  45. package/dist/{chunk-vfctk20v.js → chunk-8n42epb6.js} +3 -3
  46. package/dist/{chunk-k3ytyhkr.js → chunk-8p3vqt2q.js} +3 -3
  47. package/dist/{chunk-p92272k0.js → chunk-8tfpv6zf.js} +2 -2
  48. package/dist/chunk-94r6mkcy.js +2 -0
  49. package/dist/chunk-96wdxfn4.js +2 -0
  50. package/dist/{chunk-rdrstnn9.js → chunk-9atdw0p8.js} +2 -2
  51. package/dist/chunk-9bc23bv2.js +2 -0
  52. package/dist/{chunk-5jrpzepc.js → chunk-9bexzgws.js} +2 -2
  53. package/dist/{chunk-0gc1hez6.js → chunk-9tj16d70.js} +3 -3
  54. package/dist/chunk-9xzej52j.js +2 -0
  55. package/dist/{chunk-rzmk73fz.js → chunk-ab1z38gj.js} +2 -2
  56. package/dist/chunk-abxwggen.js +2 -0
  57. package/dist/{chunk-n642g6n0.js → chunk-afmmrqee.js} +15 -15
  58. package/dist/{chunk-68r2zs20.js → chunk-ahf9j8wb.js} +4 -4
  59. package/dist/chunk-asewbsct.js +2 -0
  60. package/dist/{chunk-0b57fgpn.js → chunk-b234w3mf.js} +30 -10
  61. package/dist/chunk-bcspywrd.js +2 -0
  62. package/dist/chunk-bprjp80g.js +2 -0
  63. package/dist/{chunk-n7rwbccm.js → chunk-bpx9cys7.js} +6 -6
  64. package/dist/{chunk-945zygwa.js → chunk-c08jvjqt.js} +27 -27
  65. package/dist/{chunk-gyqg3xjp.js → chunk-c5cxpkfy.js} +5 -5
  66. package/dist/chunk-c60egpe6.js +2 -0
  67. package/dist/chunk-cjq455ve.js +2 -0
  68. package/dist/chunk-ck4ypzet.js +3 -0
  69. package/dist/{chunk-46khhke2.js → chunk-cpt9sg6d.js} +1 -1
  70. package/dist/{chunk-73ebyhqq.js → chunk-cq4cwfqf.js} +2 -2
  71. package/dist/chunk-cqq68aw8.js +2 -0
  72. package/dist/{chunk-qs0zk04y.js → chunk-cwcmmgvz.js} +2 -2
  73. package/dist/{chunk-5gnt3qtn.js → chunk-d4hnj3ct.js} +3 -3
  74. package/dist/{chunk-6c8s1pax.js → chunk-e4tbq8a0.js} +9 -9
  75. package/dist/{chunk-qykbjg3z.js → chunk-e5rag6rh.js} +2 -2
  76. package/dist/{chunk-150cz8qq.js → chunk-eca022er.js} +7 -7
  77. package/dist/{chunk-fksmr50h.js → chunk-ekyx5z50.js} +6 -6
  78. package/dist/{chunk-xr1s56k5.js → chunk-eptzpvn0.js} +3 -3
  79. package/dist/chunk-exc8y30f.js +42 -0
  80. package/dist/{chunk-ty5frr9t.js → chunk-fds6vvq0.js} +150 -149
  81. package/dist/{chunk-de61k0ab.js → chunk-fs43342z.js} +2 -2
  82. package/dist/{chunk-essmq8yb.js → chunk-fwffn130.js} +9 -9
  83. package/dist/{chunk-54x7h3sb.js → chunk-fycxc75p.js} +1 -1
  84. package/dist/chunk-fzh73jtc.js +2 -0
  85. package/dist/{chunk-gnf1e5q7.js → chunk-fznjm7qt.js} +2 -2
  86. package/dist/{chunk-r0az4z6d.js → chunk-gfp39bzr.js} +2 -2
  87. package/dist/{chunk-8xb09hnn.js → chunk-gg31th5s.js} +4 -4
  88. package/dist/chunk-gjnxnfrg.js +2 -0
  89. package/dist/chunk-gjzs6p2v.js +2 -0
  90. package/dist/chunk-gmczbe3j.js +2 -0
  91. package/dist/{chunk-7nf7mp27.js → chunk-gyv2bsmn.js} +2 -2
  92. package/dist/chunk-h7xqba9k.js +2 -0
  93. package/dist/{chunk-9w7whtbx.js → chunk-hhspwfva.js} +2 -2
  94. package/dist/chunk-hpxhxwda.js +2 -0
  95. package/dist/chunk-j661q889.js +2 -0
  96. package/dist/chunk-j90sfypd.js +2 -0
  97. package/dist/{chunk-4hk1mjtv.js → chunk-jhegz7az.js} +5 -5
  98. package/dist/{chunk-tqm66mh3.js → chunk-jj78m9k1.js} +132 -51
  99. package/dist/chunk-jnk3nk5k.js +2 -0
  100. package/dist/{chunk-mry67rsk.js → chunk-jttzrv0w.js} +6 -6
  101. package/dist/{chunk-5tm1pvt3.js → chunk-jz37h2z0.js} +2 -2
  102. package/dist/chunk-jzbte09f.js +2 -0
  103. package/dist/chunk-k5v22gn4.js +2 -0
  104. package/dist/{chunk-e3svj8ex.js → chunk-kcphqn2k.js} +1 -1
  105. package/dist/{chunk-50wjk5ap.js → chunk-kmy34he2.js} +2 -2
  106. package/dist/{chunk-bx5y6qsg.js → chunk-m9cye9t8.js} +43 -43
  107. package/dist/chunk-mgcakk1m.js +2 -0
  108. package/dist/chunk-mkm9drk3.js +2 -0
  109. package/dist/{chunk-vw7crz0z.js → chunk-mpfm5ctr.js} +4 -4
  110. package/dist/chunk-n3bt1sv5.js +2 -0
  111. package/dist/chunk-n62nqhey.js +2 -0
  112. package/dist/{chunk-k3566kgd.js → chunk-nan0ysys.js} +2 -2
  113. package/dist/{chunk-w96jck0a.js → chunk-nmywrw6v.js} +1 -1
  114. package/dist/chunk-nrap20qt.js +2 -0
  115. package/dist/{chunk-4z926gay.js → chunk-nzqr3w35.js} +7 -7
  116. package/dist/{chunk-g5nts6e0.js → chunk-p3et6xjr.js} +5 -5
  117. package/dist/{chunk-9hwg13ec.js → chunk-pc89t52s.js} +5 -5
  118. package/dist/{chunk-7b3dqeyr.js → chunk-phzhmnnm.js} +2 -2
  119. package/dist/chunk-pp89n1et.js +2 -0
  120. package/dist/chunk-ptrz5xwt.js +2 -0
  121. package/dist/chunk-q2jag6wt.js +2 -0
  122. package/dist/chunk-q9yahsww.js +2 -0
  123. package/dist/chunk-qgc59a7d.js +2 -0
  124. package/dist/chunk-qjkpwjg6.js +2 -0
  125. package/dist/chunk-qq31bcsq.js +2 -0
  126. package/dist/{chunk-8vbx58s6.js → chunk-qvj0bzw5.js} +10 -10
  127. package/dist/chunk-r5xt6vdq.js +2 -0
  128. package/dist/{chunk-5mrt1enm.js → chunk-razwegar.js} +2 -2
  129. package/dist/chunk-rt6fn071.js +2 -0
  130. package/dist/{chunk-67pq803s.js → chunk-sdf4c754.js} +2 -2
  131. package/dist/chunk-se0pjx71.js +2 -0
  132. package/dist/chunk-senrtnx2.js +2 -0
  133. package/dist/chunk-sjrx0dj8.js +2 -0
  134. package/dist/chunk-ta5fpj2a.js +2 -0
  135. package/dist/{chunk-bgkj0rxe.js → chunk-ta7cwykn.js} +4 -4
  136. package/dist/{chunk-jj1f1v1r.js → chunk-tszhkmny.js} +7 -7
  137. package/dist/{chunk-vbmvft7g.js → chunk-v0yay1kw.js} +1 -1
  138. package/dist/{chunk-2sz1kh9m.js → chunk-va4xam1q.js} +1 -1
  139. package/dist/chunk-vbh5tknp.js +2 -0
  140. package/dist/{chunk-q33x40dg.js → chunk-vmphrcaa.js} +2 -2
  141. package/dist/{chunk-s8v6dxhg.js → chunk-w1pga3s6.js} +4 -4
  142. package/dist/{chunk-bzd387yx.js → chunk-w3y8408q.js} +4 -4
  143. package/dist/chunk-w4177qn3.js +3 -0
  144. package/dist/{chunk-esm0pnpz.js → chunk-w98yt4d4.js} +2 -2
  145. package/dist/{chunk-7nn5s0c3.js → chunk-wbsbrm6n.js} +30 -30
  146. package/dist/chunk-wchz1sye.js +2 -0
  147. package/dist/{chunk-9ze3xvsr.js → chunk-wk6g0b9h.js} +4 -4
  148. package/dist/{chunk-m0p328a3.js → chunk-wna2herj.js} +3 -3
  149. package/dist/{chunk-71d353be.js → chunk-wxk0t61p.js} +3 -3
  150. package/dist/chunk-x1svtz8k.js +2 -0
  151. package/dist/{chunk-qt2mr3f0.js → chunk-x39v2ch2.js} +5 -5
  152. package/dist/chunk-xahn0h9f.js +2 -0
  153. package/dist/{chunk-65c11t6g.js → chunk-xfjp5q2m.js} +15 -15
  154. package/dist/{chunk-27qkwvbe.js → chunk-xpcqyzdc.js} +2 -2
  155. package/dist/chunk-ykx4zt07.js +2 -0
  156. package/dist/{chunk-w10vj4rc.js → chunk-yqs88qj4.js} +6 -6
  157. package/dist/chunk-yt8k715e.js +2 -0
  158. package/dist/{chunk-g32hc78c.js → chunk-yzgtsrjb.js} +2 -2
  159. package/dist/{chunk-btyb4bfz.js → chunk-z0d1asbw.js} +2 -2
  160. package/dist/{chunk-tx27trcp.js → chunk-zcwx8z8z.js} +5 -5
  161. package/dist/{chunk-t14bn66j.js → chunk-zk1c6tg7.js} +3 -3
  162. package/dist/{chunk-9rxxm68c.js → chunk-zrsrhdxw.js} +3 -3
  163. package/dist/cli.js +21 -21
  164. package/dist/client-parameter-bindings.js +12 -5
  165. package/dist/component-renderer.js +2 -24
  166. package/dist/craft-entry.js +2 -2
  167. package/dist/craft.js +2 -2
  168. package/dist/native/runtime/craft-bridge.js +5 -1
  169. package/dist/native/runtime/craft.d.ts +4 -0
  170. package/dist/offline/app-service-worker.d.ts +1 -0
  171. package/dist/offline/app-service-worker.js +99 -17
  172. package/dist/production-server.d.ts +0 -9
  173. package/dist/production-server.js +26 -11
  174. package/dist/pwa.js +3 -3
  175. package/dist/route-response-cache.js +4 -3
  176. package/dist/server-bindings.js +3 -1
  177. package/dist/spa-nav.d.ts +6 -0
  178. package/dist/spa-nav.js +5 -1
  179. package/dist/ssg.js +10 -10
  180. package/dist/stx-virtual-ts.d.ts +4 -0
  181. package/dist/stx-virtual-ts.js +22 -0
  182. package/dist/utils.js +22 -2
  183. package/package.json +5 -5
  184. package/dist/chunk-0ht6exrv.js +0 -2
  185. package/dist/chunk-1pbghytr.js +0 -2
  186. package/dist/chunk-31r1tk86.js +0 -2
  187. package/dist/chunk-3ahvypx3.js +0 -2
  188. package/dist/chunk-576wtm6d.js +0 -2
  189. package/dist/chunk-5astk182.js +0 -2
  190. package/dist/chunk-5g5khx0m.js +0 -3
  191. package/dist/chunk-5tvse0vw.js +0 -2
  192. package/dist/chunk-5zcjcyys.js +0 -2
  193. package/dist/chunk-6h6aahc8.js +0 -2
  194. package/dist/chunk-726w7fm2.js +0 -2
  195. package/dist/chunk-7r294vc9.js +0 -2
  196. package/dist/chunk-7rn7w53f.js +0 -2
  197. package/dist/chunk-81qvg3yd.js +0 -2
  198. package/dist/chunk-96jntfwp.js +0 -3
  199. package/dist/chunk-9pjzj75t.js +0 -2
  200. package/dist/chunk-a1k0aj2r.js +0 -2
  201. package/dist/chunk-am2v9pqa.js +0 -2
  202. package/dist/chunk-cb9h2wwq.js +0 -2
  203. package/dist/chunk-cp82351f.js +0 -2
  204. package/dist/chunk-cvxg2rc1.js +0 -2
  205. package/dist/chunk-dmc91qke.js +0 -2
  206. package/dist/chunk-dpgc8wmw.js +0 -2
  207. package/dist/chunk-dw23nre3.js +0 -2
  208. package/dist/chunk-dyz7cmf4.js +0 -2
  209. package/dist/chunk-fznzn35q.js +0 -2
  210. package/dist/chunk-gyzebnpx.js +0 -2
  211. package/dist/chunk-hc8ks7y3.js +0 -2
  212. package/dist/chunk-hs2a040z.js +0 -2
  213. package/dist/chunk-jr3fmkq7.js +0 -2
  214. package/dist/chunk-k2fw6paw.js +0 -2
  215. package/dist/chunk-k79dvx67.js +0 -2
  216. package/dist/chunk-kf6j1ht4.js +0 -2
  217. package/dist/chunk-km1k3c4e.js +0 -2
  218. package/dist/chunk-kvjbpbmw.js +0 -2
  219. package/dist/chunk-m2dgf6pt.js +0 -2
  220. package/dist/chunk-mhv84p0x.js +0 -2
  221. package/dist/chunk-mmk5xqhr.js +0 -2
  222. package/dist/chunk-pd8ck9p3.js +0 -2
  223. package/dist/chunk-pjpy86c3.js +0 -3
  224. package/dist/chunk-q3ztpbz4.js +0 -2
  225. package/dist/chunk-qchmvwds.js +0 -2
  226. package/dist/chunk-qx4wkt90.js +0 -2
  227. package/dist/chunk-qzx6h6af.js +0 -2
  228. package/dist/chunk-r9rwdg9k.js +0 -3
  229. package/dist/chunk-s0sxq6ap.js +0 -2
  230. package/dist/chunk-scdkctdb.js +0 -2
  231. package/dist/chunk-sxqq3tft.js +0 -2
  232. package/dist/chunk-tf0feafg.js +0 -2
  233. package/dist/chunk-tgwwa872.js +0 -2
  234. package/dist/chunk-tspqdt8e.js +0 -2
  235. package/dist/chunk-tzebte8p.js +0 -2
  236. package/dist/chunk-v0r6zb87.js +0 -2
  237. package/dist/chunk-vbq6vt0e.js +0 -2
  238. package/dist/chunk-vh9yx344.js +0 -2
  239. package/dist/chunk-vxtna1b1.js +0 -2
  240. package/dist/chunk-wh07jf0t.js +0 -2
  241. package/dist/chunk-x43x2c6v.js +0 -2
  242. package/dist/chunk-xqx8t9w5.js +0 -2
  243. package/dist/chunk-xzmsfrez.js +0 -2
  244. package/dist/chunk-ymeemdg9.js +0 -42
  245. package/dist/chunk-z33r3pzy.js +0 -2
  246. package/dist/chunk-z43xcwnk.js +0 -2
  247. package/dist/chunk-zb6fa26w.js +0 -2
  248. package/dist/chunk-zkr42285.js +0 -2
  249. package/dist/chunk-zrs22j09.js +0 -2
  250. package/dist/chunk-zve1xqvs.js +0 -2
  251. package/dist/chunk-zw6tgr0s.js +0 -2
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{rl,s,Ce}from"./chunk-ty5frr9t.js";import{gt}from"./chunk-zkwkhesc.js";import{l}from"./chunk-pjpy86c3.js";import o from"fs";import u from"path";var hg=new Map,m=new Map;async function gy(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(r){n=r;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function my(e){m.delete(e)}function hy(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function yy(e){x=e}async function yg(e=!1){let t=x??await import("./chunk-zrs22j09.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function bg(){if(S===null){let{getRouterScript:e}=await import("./chunk-hs2a040z.js");S=e()}return S}var y={};async function by(e,t=!1){let n=e==="runtime"?await yg(t):await bg(),i=e==="runtime"&&t?"runtime-debug":e,r=y[i];if(!r||r.content!==n)r={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=r;return{content:n,hash:r.hash,url:`/_stx/${e}.${r.hash}.js`}}var E=500,T=33554432,c=new Map,p=0;function C(e){return l(process.cwd(),"module-bundles",`${e}.js`)}function wy(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=c.get(t),i=n!==void 0;if(i)c.delete(t),p-=n.length*2;c.set(t,e),p+=e.length*2;while(c.size>1&&(c.size>E||p>T)){let r=c.keys().next().value;p-=c.get(r).length*2,c.delete(r)}if(!i)try{let r=C(t);if(!o.existsSync(r))o.mkdirSync(u.dirname(r),{recursive:!0}),o.writeFileSync(r,e)}catch{}return`/_stx/modules.${t}.js`}function yi(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=c.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function vy(){m.clear(),Ce(),rl(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function Cr(e,t){try{if(!t.cachePath)return null;let n=u.resolve(t.cachePath),i=u.join(n,`${Ls(e)}.html`),r=u.join(n,`${Ls(e)}.meta.json`);if(!await s(i)||!await s(r))return null;let g=await Bun.file(r).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==gt())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await s(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function Er(e,t,n,i){try{if(!i.cachePath)return;let r=u.resolve(i.cachePath);await o.promises.mkdir(r,{recursive:!0});let g=u.join(r,`${Ls(e)}.html`),a=u.join(r,`${Ls(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:gt(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),hg.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(r){console.warn(`Failed to cache template ${e}:`,r)}}var _=16;function Ls(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
3
- export{hg,gy,my,hy,yy,yg,bg,by,wy,yi,vy,Cr,Er,Ls};
2
+ import{il,s,Ce}from"./chunk-fds6vvq0.js";import{gt}from"./chunk-zkwkhesc.js";import{l}from"./chunk-w4177qn3.js";import o from"fs";import u from"path";var wg=new Map,m=new Map;async function yy(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(r){n=r;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function by(e){m.delete(e)}function wy(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function vy(e){x=e}async function vg(e=!1){let t=x??await import("./chunk-rt6fn071.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function xg(){if(S===null){let{getRouterScript:e}=await import("./chunk-pp89n1et.js");S=e()}return S}var y={};async function xy(e,t=!1){let n=e==="runtime"?await vg(t):await xg(),i=e==="runtime"&&t?"runtime-debug":e,r=y[i];if(!r||r.content!==n)r={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=r;return{content:n,hash:r.hash,url:`/_stx/${e}.${r.hash}.js`}}var E=500,T=33554432,c=new Map,p=0;function C(e){return l(process.cwd(),"module-bundles",`${e}.js`)}function Sy(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=c.get(t),i=n!==void 0;if(i)c.delete(t),p-=n.length*2;c.set(t,e),p+=e.length*2;while(c.size>1&&(c.size>E||p>T)){let r=c.keys().next().value;p-=c.get(r).length*2,c.delete(r)}if(!i)try{let r=C(t);if(!o.existsSync(r))o.mkdirSync(u.dirname(r),{recursive:!0}),o.writeFileSync(r,e)}catch{}return`/_stx/modules.${t}.js`}function wi(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=c.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function ky(){m.clear(),Ce(),il(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function Er(e,t){try{if(!t.cachePath)return null;let n=u.resolve(t.cachePath),i=u.join(n,`${Bs(e)}.html`),r=u.join(n,`${Bs(e)}.meta.json`);if(!await s(i)||!await s(r))return null;let g=await Bun.file(r).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==gt())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await s(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function Tr(e,t,n,i){try{if(!i.cachePath)return;let r=u.resolve(i.cachePath);await o.promises.mkdir(r,{recursive:!0});let g=u.join(r,`${Bs(e)}.html`),a=u.join(r,`${Bs(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:gt(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),wg.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(r){console.warn(`Failed to cache template ${e}:`,r)}}var _=16;function Bs(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
3
+ export{wg,yy,by,wy,vy,vg,xg,xy,Sy,wi,ky,Er,Tr,Bs};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{cu,Ia,lu,uu,Oa,du,pu,fu,gu,Na,mu,Im}from"./chunk-ta7cwykn.js";import{Ha,wu}from"./chunk-9atdw0p8.js";import{le,ue,de,Yn,Te,ze,gs,$t,ln,Zn,Qn,er,pe,tr,nr,ms}from"./chunk-gyv2bsmn.js";import{_u}from"./chunk-2m4d8jkv.js";import"./chunk-0vyytd9v.js";export{ue as DEFAULT_FORMATS,de as DEFAULT_QUALITY,le as DEFAULT_WIDTHS,ms as ImageProcessingError,uu as clearImageCache,Oa as createImageDirective,wu as createImageHandler,pu as createImagePlugin,Im as defaultImageConfig,nr as formatSize,Na as generateImageManifest,ln as generateSizes,$t as generateSrcSet,Zn as getFallbackVariant,gs as getImageMetadata,pe as getMimeType,tr as getTotalSize,Qn as groupVariantsByFormat,Ha as handleImageRequest,du as imageDirective,Te as isImageBackendAvailable,er as isImageFile,Yn as isSharpAvailable,gu as optimizeDirectory,fu as optimizeImage,Ia as parseImageComponent,ze as processImage,lu as processImageComponents,cu as renderImageComponent,_u as rewriteImagesWithSiblings,mu as writeImageManifest};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{y,b,g}from"./chunk-ty5frr9t.js";import{q}from"./chunk-65c11t6g.js";import{i}from"./chunk-tqm66mh3.js";import k from"path";var M={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var O=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function z(e){let t=[],o=0,n;O.lastIndex=0;while((n=O.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function ph(e,t={},o={}){let n={...q,...o,streaming:{...M,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),p=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f={...t,__filename:e,__dirname:k.dirname(e)};if(p.trim())await y(p,f,e);let E=z(c),l=new Set;if(!E.some((h)=>h.type==="suspense")){let h=n.streaming?.strategy||"auto",S=new RegExp(T.source,"g");if(!(h!=="manual"&&S.test(c))){let u=await i(c,f,e,n,l);for(let x=0;x<u.length;x+=s)r.enqueue(u.slice(x,x+s)),await new Promise((m)=>setTimeout(m,0))}else{let u=[],x=new RegExp(T.source,"g"),m;while((m=x.exec(c))!==null)u.push({name:m[1],content:m[2],start:m.index,end:m.index+m[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let D=await i(I,f,e,n,l);r.enqueue(D),await new Promise((H)=>setTimeout(H,0))}}let C=await i(_.content,f,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,f,e,n,l);r.enqueue(C)}}}}else{let h=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,f,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
2
+ import{y,b,g}from"./chunk-fds6vvq0.js";import{q}from"./chunk-xfjp5q2m.js";import{i}from"./chunk-jj78m9k1.js";import k from"path";var M={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var O=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function z(e){let t=[],o=0,n;O.lastIndex=0;while((n=O.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function mh(e,t={},o={}){let n={...q,...o,streaming:{...M,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),p=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f={...t,__filename:e,__dirname:k.dirname(e)};if(p.trim())await y(p,f,e);let E=z(c),l=new Set;if(!E.some((h)=>h.type==="suspense")){let h=n.streaming?.strategy||"auto",S=new RegExp(T.source,"g");if(!(h!=="manual"&&S.test(c))){let u=await i(c,f,e,n,l);for(let x=0;x<u.length;x+=s)r.enqueue(u.slice(x,x+s)),await new Promise((m)=>setTimeout(m,0))}else{let u=[],x=new RegExp(T.source,"g"),m;while((m=x.exec(c))!==null)u.push({name:m[1],content:m[2],start:m.index,end:m.index+m[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let D=await i(I,f,e,n,l);r.enqueue(D),await new Promise((H)=>setTimeout(H,0))}}let C=await i(_.content,f,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,f,e,n,l);r.enqueue(C)}}}}else{let h=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,f,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),h.set(d.name,i(d.content,f,e,n,l))}r.enqueue(`
5
5
  <script>
@@ -17,13 +17,13 @@ import{y,b,g}from"./chunk-ty5frr9t.js";import{q}from"./chunk-65c11t6g.js";import
17
17
  }
18
18
  };
19
19
  })();
20
- </script>`);let S=Array.from(h.entries()).map(async([d,u])=>{r.enqueue(await Ua(d,u))});await Promise.all(S)}r.close()}catch(a){r.error(a)}}})}async function Ua(e,t){try{let n=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
20
+ </script>`);let S=Array.from(h.entries()).map(async([d,u])=>{r.enqueue(await Ka(d,u))});await Promise.all(S)}r.close()}catch(a){r.error(a)}}})}async function Ka(e,t){try{let n=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
21
21
  <script>
22
22
  window.__stxSuspense.resolve('${e}', \`${n}\`);
23
23
  </script>`}catch(o){let n=o instanceof Error?o.message:String(o);return`
24
24
  <script>
25
25
  window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${g(n)}</div>');
26
- </script>`}}var Fu=`
26
+ </script>`}}var Uu=`
27
27
  <script>
28
28
  (function(){
29
29
  window.__stxSuspense = window.__stxSuspense || {
@@ -43,12 +43,12 @@ window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading conte
43
43
  }
44
44
  };
45
45
  })();
46
- </script>`;function A(e,t,o){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function fh(e,t=[],o={}){let n=o.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(Fu),await Promise.all(t.map(async(r)=>{let a=A(r.render(),n,r.id);s.enqueue(await Ua(r.id,a))}));s.close()}catch(r){s.error(r)}}})}var B=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function gh(e,t){return e.replace(B,(o,n,s)=>{let r=n.trim(),a=s.split(/@fallback/i),w=a[0].trim(),p=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[r]=w,`<div data-suspense="${r}">${p}</div>`})}function mh(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,n])=>typeof n==="function");return o.length>0?o.map(([n,s])=>({id:n,render:s})):void 0}async function hh(e,t={},o={}){let n={...q,...o,streaming:{...M,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),p=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f={...t,__filename:e,__dirname:k.dirname(e)};if(p.trim())await y(p,f,e);let E=new Set,l=n.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(l!=="manual"&&R.test(c))){let S=await i(c,f,e,n,E);for(let d=0;d<S.length;d+=s)r.enqueue(S.slice(d,d+s))}else{let S=[],d=new RegExp(T.source,"g"),u;while((u=d.exec(c))!==null)S.push({name:u[1],content:u[2],start:u.index,end:u.index+u[0].length});let x=0;for(let m of S){if(m.start>x){let _=c.slice(x,m.start);if(_.trim()){let C=await i(_,f,e,n,E);r.enqueue(C)}}let v=await i(m.content,f,e,n,E);r.enqueue(v),x=m.end}if(x<c.length){let m=c.slice(x);if(m.trim()){let v=await i(m,f,e,n,E);r.enqueue(v)}}}r.close()}catch(a){r.error(a)}}})}async function yh(e,t={}){let o={...q,...t,streaming:{...M,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),r=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=a,p={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let l=c[1],R=c[2];p[l]=R}let f=a.replace(T,"");return{renderShell:async(l={})=>{let R={...l,__filename:e,__dirname:k.dirname(e)};return await y(r,R,e),i(f,R,e,o,new Set)},renderSection:async(l,R={})=>{try{if(!p[l])return`<div class="error-message">Section "${g(l)}" not found in template "${g(e)}"</div>`;let h={...R,__filename:e,__dirname:k.dirname(e)};await y(r,h,e);let S=new Set;return await i(p[l],h,e,o,S)}catch(h){let S=h instanceof Error?h.message:String(h);return b("Expression",S,e,p[l]||"",0,p[l]||"")}},getSections:()=>Object.keys(p),getTemplate:()=>w}}var zu={name:"suspense",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let s=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${s} -->${e}<!-- @endsuspense:${s} -->`}},Hu={name:"island",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),r=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${s}-${Math.random().toString(36).substring(2,9)}`,w=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),p=w?w[1].trim():"",c=w?e.replace(w[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${r}">
46
+ </script>`;function A(e,t,o){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function hh(e,t=[],o={}){let n=o.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(Uu),await Promise.all(t.map(async(r)=>{let a=A(r.render(),n,r.id);s.enqueue(await Ka(r.id,a))}));s.close()}catch(r){s.error(r)}}})}var B=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function yh(e,t){return e.replace(B,(o,n,s)=>{let r=n.trim(),a=s.split(/@fallback/i),w=a[0].trim(),p=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[r]=w,`<div data-suspense="${r}">${p}</div>`})}function bh(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,n])=>typeof n==="function");return o.length>0?o.map(([n,s])=>({id:n,render:s})):void 0}async function wh(e,t={},o={}){let n={...q,...o,streaming:{...M,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),p=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),f={...t,__filename:e,__dirname:k.dirname(e)};if(p.trim())await y(p,f,e);let E=new Set,l=n.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(l!=="manual"&&R.test(c))){let S=await i(c,f,e,n,E);for(let d=0;d<S.length;d+=s)r.enqueue(S.slice(d,d+s))}else{let S=[],d=new RegExp(T.source,"g"),u;while((u=d.exec(c))!==null)S.push({name:u[1],content:u[2],start:u.index,end:u.index+u[0].length});let x=0;for(let m of S){if(m.start>x){let _=c.slice(x,m.start);if(_.trim()){let C=await i(_,f,e,n,E);r.enqueue(C)}}let v=await i(m.content,f,e,n,E);r.enqueue(v),x=m.end}if(x<c.length){let m=c.slice(x);if(m.trim()){let v=await i(m,f,e,n,E);r.enqueue(v)}}}r.close()}catch(a){r.error(a)}}})}async function vh(e,t={}){let o={...q,...t,streaming:{...M,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),r=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=a,p={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let l=c[1],R=c[2];p[l]=R}let f=a.replace(T,"");return{renderShell:async(l={})=>{let R={...l,__filename:e,__dirname:k.dirname(e)};return await y(r,R,e),i(f,R,e,o,new Set)},renderSection:async(l,R={})=>{try{if(!p[l])return`<div class="error-message">Section "${g(l)}" not found in template "${g(e)}"</div>`;let h={...R,__filename:e,__dirname:k.dirname(e)};await y(r,h,e);let S=new Set;return await i(p[l],h,e,o,S)}catch(h){let S=h instanceof Error?h.message:String(h);return b("Expression",S,e,p[l]||"",0,p[l]||"")}},getSections:()=>Object.keys(p),getTemplate:()=>w}}var Vu={name:"suspense",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let s=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${s} -->${e}<!-- @endsuspense:${s} -->`}},Wu={name:"island",hasEndTag:!0,handler:(e,t,o,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),r=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${s}-${Math.random().toString(36).substring(2,9)}`,w=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),p=w?w[1].trim():"",c=w?e.replace(w[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${r}">
47
47
  ${c}
48
48
  <script type="application/json" data-island-props="${a}">
49
49
  ${p?`{${p}}`:"{}"}
50
50
  </script>
51
- </div>`}};function bh(e={}){let t=[];if(e.streaming?.enabled)t.push(zu);if(e.hydration?.enabled)t.push(Hu);return t}async function wh(e,t,o,n={}){return e}function vh(e,t={}){let o=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(r,a){a.enqueue(o.encode(r))}})),s=new Headers(t.headers);if(!s.has("Content-Type"))s.set("Content-Type","text/html; charset=utf-8");if(!s.has("Transfer-Encoding"))s.set("Transfer-Encoding","chunked");if(!s.has("X-Content-Type-Options"))s.set("X-Content-Type-Options","nosniff");if(!s.has("X-Accel-Buffering"))s.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:s})}function xh(e={mode:"full"}){let{mode:t,components:o={},dynamicImports:n=!0}=e,s=Object.entries(o).map(([r,a])=>`'${r}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
51
+ </div>`}};function xh(e={}){let t=[];if(e.streaming?.enabled)t.push(Vu);if(e.hydration?.enabled)t.push(Wu);return t}async function Sh(e,t,o,n={}){return e}function kh(e,t={}){let o=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(r,a){a.enqueue(o.encode(r))}})),s=new Headers(t.headers);if(!s.has("Content-Type"))s.set("Content-Type","text/html; charset=utf-8");if(!s.has("Transfer-Encoding"))s.set("Transfer-Encoding","chunked");if(!s.has("X-Content-Type-Options"))s.set("X-Content-Type-Options","nosniff");if(!s.has("X-Accel-Buffering"))s.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:s})}function _h(e={mode:"full"}){let{mode:t,components:o={},dynamicImports:n=!0}=e,s=Object.entries(o).map(([r,a])=>`'${r}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
52
52
  `);if(t==="loader")return`
53
53
  (function() {
54
54
  window.__stx = window.__stx || {};
@@ -191,4 +191,4 @@ else {
191
191
  stx.hydrate();
192
192
  }
193
193
  })();`}
194
- export{ph,Ua,Fu,fh,gh,mh,hh,yh,zu,Hu,bh,wh,vh,xh};
194
+ export{mh,Ka,Uu,hh,yh,bh,wh,vh,Vu,Wu,xh,Sh,kh,_h};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{vn,ei,ti,ni,iy,ri}from"./chunk-p3et6xjr.js";import"./chunk-mpfm5ctr.js";import"./chunk-b234w3mf.js";import"./chunk-w98yt4d4.js";export{ti as buildServerApi,iy as createServerApi,vn as discoverServerApi,ei as generateApiTypes,ri as isServerApiSource,ni as productionApiDispatcher};
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- import d from"fs";import l from"path";function Xl(n){let s=[],e=n.pwa;if(s.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:e?.enabled===!0,message:e?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!e?.enabled)return s;s.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(e.manifest?.name),message:e.manifest?.name?`App name: "${e.manifest.name}"`:"Missing required manifest name"}),s.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(e.manifest?.shortName),message:e.manifest?.shortName?`Short name: "${e.manifest.shortName}"`:"Short name not set (will use full name)"}),s.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(e.manifest?.description),message:e.manifest?.description?"Description is set":"App description not provided"}),s.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(e.manifest?.themeColor),message:e.manifest?.themeColor?`Theme color: ${e.manifest.themeColor}`:"Theme color not set"}),s.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(e.manifest?.backgroundColor),message:e.manifest?.backgroundColor?`Background color: ${e.manifest.backgroundColor}`:"Background color not set"}),s.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(e.manifest?.display||""),message:e.manifest?.display?`Display mode: ${e.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),s.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(e.manifest?.startUrl),message:e.manifest?.startUrl?`Start URL: ${e.manifest.startUrl}`:"Start URL not set"}),s.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(e.icons?.src),message:e.icons?.src?`Icon source: ${e.icons.src}`:"No icon source configured"});let a=e.icons?.sizes||[];s.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:a.includes(192),message:a.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),s.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:a.includes(512),message:a.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),s.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:e.icons?.purpose?.includes("maskable")||!1,message:e.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),s.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(e.serviceWorker),message:e.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),s.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(e.serviceWorker?.cacheVersion),message:e.serviceWorker?.cacheVersion?`Cache version: ${e.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),s.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:e.offline?.enabled===!0,message:e.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let t=e.routes||[];return s.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:t.length>0,message:t.length>0?`${t.length} route caching strategies configured`:"No custom caching strategies defined"}),s.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!e.push?.enabled||Boolean(e.push?.vapidPublicKey),message:e.push?.enabled?e.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),s.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:e.shareTarget?.enabled?`Share target enabled at ${e.shareTarget.action}`:"Share target not enabled"}),s.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:e.autoInject!==!1,message:e.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),s}function Jl(n){let s=[],e=l.join(n,"manifest.json"),a=d.existsSync(e);if(s.push({id:"build-manifest",name:"Manifest File",category:"required",passed:a,message:a?"manifest.json exists":"manifest.json not found in build output"}),a)try{let r=JSON.parse(d.readFileSync(e,"utf-8"));s.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),s.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(r.icons)&&r.icons.length>0,message:r.icons?.length?`${r.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{s.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let t=l.join(n,"sw.js"),c=d.existsSync(t);s.push({id:"build-sw",name:"Service Worker File",category:"required",passed:c,message:c?"Service worker (sw.js) exists":"Service worker not found in build output"});let o=l.join(n,"offline.html"),u=d.existsSync(o);s.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:u,message:u?"Offline page exists":"No offline.html found"});let i=l.join(n,"pwa-icons");if(d.existsSync(i)){let r=d.readdirSync(i).filter((m)=>m.endsWith(".png")||m.endsWith(".webp"));s.push({id:"build-icons",name:"Generated Icons",category:"required",passed:r.length>0,message:r.length>0?`${r.length} icon files generated`:"No icon files found"})}else s.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return s}function Yl(n){let s=n.filter((i)=>i.category==="required"),e=n.filter((i)=>i.category==="recommended"),a=s.filter((i)=>i.passed).length,t=e.filter((i)=>i.passed).length,c=s.length>0?a/s.length*70:70,o=e.length>0?t/e.length*30:30;return{score:Math.round(c+o),passed:n.filter((i)=>i.passed).length,failed:n.filter((i)=>!i.passed&&i.category==="required").length,warnings:n.filter((i)=>!i.passed&&i.category!=="required").length,checks:n}}function Qg(n,s){let e=Xl(n),a=s&&d.existsSync(s)?Jl(s):[];return Yl([...e,...a])}function em(n){let s=[];s.push(`
2
+ import d from"fs";import l from"path";function Zl(n){let s=[],e=n.pwa;if(s.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:e?.enabled===!0,message:e?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!e?.enabled)return s;s.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(e.manifest?.name),message:e.manifest?.name?`App name: "${e.manifest.name}"`:"Missing required manifest name"}),s.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(e.manifest?.shortName),message:e.manifest?.shortName?`Short name: "${e.manifest.shortName}"`:"Short name not set (will use full name)"}),s.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(e.manifest?.description),message:e.manifest?.description?"Description is set":"App description not provided"}),s.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(e.manifest?.themeColor),message:e.manifest?.themeColor?`Theme color: ${e.manifest.themeColor}`:"Theme color not set"}),s.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(e.manifest?.backgroundColor),message:e.manifest?.backgroundColor?`Background color: ${e.manifest.backgroundColor}`:"Background color not set"}),s.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(e.manifest?.display||""),message:e.manifest?.display?`Display mode: ${e.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),s.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(e.manifest?.startUrl),message:e.manifest?.startUrl?`Start URL: ${e.manifest.startUrl}`:"Start URL not set"}),s.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(e.icons?.src),message:e.icons?.src?`Icon source: ${e.icons.src}`:"No icon source configured"});let a=e.icons?.sizes||[];s.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:a.includes(192),message:a.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),s.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:a.includes(512),message:a.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),s.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:e.icons?.purpose?.includes("maskable")||!1,message:e.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),s.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(e.serviceWorker),message:e.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),s.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(e.serviceWorker?.cacheVersion),message:e.serviceWorker?.cacheVersion?`Cache version: ${e.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),s.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:e.offline?.enabled===!0,message:e.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let t=e.routes||[];return s.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:t.length>0,message:t.length>0?`${t.length} route caching strategies configured`:"No custom caching strategies defined"}),s.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!e.push?.enabled||Boolean(e.push?.vapidPublicKey),message:e.push?.enabled?e.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),s.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:e.shareTarget?.enabled?`Share target enabled at ${e.shareTarget.action}`:"Share target not enabled"}),s.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:e.autoInject!==!1,message:e.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),s}function Ql(n){let s=[],e=l.join(n,"manifest.json"),a=d.existsSync(e);if(s.push({id:"build-manifest",name:"Manifest File",category:"required",passed:a,message:a?"manifest.json exists":"manifest.json not found in build output"}),a)try{let r=JSON.parse(d.readFileSync(e,"utf-8"));s.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),s.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(r.icons)&&r.icons.length>0,message:r.icons?.length?`${r.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{s.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let t=l.join(n,"sw.js"),c=d.existsSync(t);s.push({id:"build-sw",name:"Service Worker File",category:"required",passed:c,message:c?"Service worker (sw.js) exists":"Service worker not found in build output"});let o=l.join(n,"offline.html"),u=d.existsSync(o);s.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:u,message:u?"Offline page exists":"No offline.html found"});let i=l.join(n,"pwa-icons");if(d.existsSync(i)){let r=d.readdirSync(i).filter((m)=>m.endsWith(".png")||m.endsWith(".webp"));s.push({id:"build-icons",name:"Generated Icons",category:"required",passed:r.length>0,message:r.length>0?`${r.length} icon files generated`:"No icon files found"})}else s.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return s}function eu(n){let s=n.filter((i)=>i.category==="required"),e=n.filter((i)=>i.category==="recommended"),a=s.filter((i)=>i.passed).length,t=e.filter((i)=>i.passed).length,c=s.length>0?a/s.length*70:70,o=e.length>0?t/e.length*30:30;return{score:Math.round(c+o),passed:n.filter((i)=>i.passed).length,failed:n.filter((i)=>!i.passed&&i.category==="required").length,warnings:n.filter((i)=>!i.passed&&i.category!=="required").length,checks:n}}function nm(n,s){let e=Zl(n),a=s&&d.existsSync(s)?Ql(s):[];return eu([...e,...a])}function rm(n){let s=[];s.push(`
3
3
  === PWA Audit Report ===
4
4
  `);let e=n.score>=90?"32":n.score>=70?"33":"31";s.push(`Score: \x1B[${e}m${n.score}/100\x1B[0m`),s.push(`Passed: ${n.passed} | Failed: ${n.failed} | Warnings: ${n.warnings}
5
5
  `);let a=["required","recommended","optional"];for(let t of a){let c=n.checks.filter((o)=>o.category===t);if(c.length===0)continue;s.push(`
6
6
  ${t.toUpperCase()}:`);for(let o of c){let u=o.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if(s.push(` ${u} ${o.name}: ${o.message}`),o.details)s.push(` ${o.details}`)}}return s.push(""),s.join(`
7
7
  `)}
8
- export{Xl,Jl,Yl,Qg,em};
8
+ export{Zl,Ql,eu,nm,rm};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{ft}from"./chunk-0b57fgpn.js";import{At,sr}from"./chunk-qt2mr3f0.js";import{ye,Rn,El,Tl}from"./chunk-ty5frr9t.js";import{Wr,qr,Kr,Xr,De}from"./chunk-945zygwa.js";import{z}from"./chunk-esm0pnpz.js";import{Ki}from"./chunk-rzmk73fz.js";import{S}from"./chunk-6c8s1pax.js";import{i}from"./chunk-tqm66mh3.js";import{q,a}from"./chunk-65c11t6g.js";import{Jc}from"./chunk-vw7crz0z.js";import{qn,Kn,rt,Be,Ma,Da,Gn}from"./chunk-jj1f1v1r.js";import{vn,Qo}from"./chunk-g5nts6e0.js";import{Xn}from"./chunk-gnf1e5q7.js";import{fn,fr,gr}from"./chunk-arfpzf17.js";import{re}from"./chunk-4z926gay.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function W(n=!1){let l=n?sr():At(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function J(){let n=ft(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import U from"path";import{createHash as Q}from"crypto";function ee(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function V(n,l,o={}){let r=U.resolve(n),e=await Bun.file(r).text(),x=Q("sha256").update(e).digest("hex").slice(0,16);El();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>ye(R))),{context:D}=ee({__filename:r,__dirname:U.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...q,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=qn(f)+Kn(f)+rt(f),j=Tl();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:x,status:Rn(e),streamTemplates:D.__streamTemplates}}var te=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(x,_){let y=m.readdirSync(x,{withFileTypes:!0});for(let d of y){if(te.has(d.name))continue;let g=c.join(x,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Nm(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),x=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=De(e.app?.head,{known:Xr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Xn(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)vn(o,w);if(e.runtimeConfig)z(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=re(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=W(n.debug),b=J();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],O=[];for(let s of P){let h=T(s.pattern),M=h.rendering==="prerender";if(M&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await V(s.filePath,s.pattern,{configDir:o,componentsDir:x,partialsDir:_,layoutsDir:y,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,b.filename),t.html=Kr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Wr(t.html,u);if(g.htmlAttrs)t.html=qr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await S(t.html),M){let p=await Gn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Be(t.html,D,!0);let N=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),K=c.join("server","pages",`${N}.compiled.json`),L=c.join("server","fragments",`${N}.html`);await Bun.write(c.join(r,K),JSON.stringify(t,null,2)),await Bun.write(c.join(r,L),t.fragment),O.push({pattern:s.pattern,compiledPath:K,fragmentPath:L,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(o,d);if(m.existsSync(H)){let{copied:s,bytes:h}=X(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let k=gr(o);if(k){let{copied:s,bytes:h}=X(k,c.join(r,"public",fr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${fn}/`)}let E={runtime:v.filename,router:b.filename},C=Ma(O,E,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await Qo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Ki(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Jc(e._layerGraph),null,2));Da(C,r);let F=Date.now()-l;return console.log(`
2
+ import{ft}from"./chunk-b234w3mf.js";import{At,or}from"./chunk-x39v2ch2.js";import{ye,An,Rl,Al}from"./chunk-fds6vvq0.js";import{qr,Kr,Xr,Jr,Le}from"./chunk-c08jvjqt.js";import{z}from"./chunk-w98yt4d4.js";import{Ji}from"./chunk-ab1z38gj.js";import{S}from"./chunk-e4tbq8a0.js";import{i}from"./chunk-jj78m9k1.js";import{q,a}from"./chunk-xfjp5q2m.js";import{Qc}from"./chunk-mpfm5ctr.js";import{Kn,Xn,ot,Fe,ja,Ba,Gn}from"./chunk-tszhkmny.js";import{vn,ti}from"./chunk-p3et6xjr.js";import{Jn}from"./chunk-fznjm7qt.js";import{fn,gr,mr}from"./chunk-357qjcj1.js";import{re}from"./chunk-nzqr3w35.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function W(n=!1){let l=n?or():At(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function J(){let n=ft(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import U from"path";import{createHash as Q}from"crypto";function ee(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function V(n,l,o={}){let r=U.resolve(n),e=await Bun.file(r).text(),x=Q("sha256").update(e).digest("hex").slice(0,16);Rl();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>ye(R))),{context:D}=ee({__filename:r,__dirname:U.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...q,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Kn(f)+Xn(f)+ot(f),j=Al();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:x,status:An(e),streamTemplates:D.__streamTemplates}}var te=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(x,_){let y=m.readdirSync(x,{withFileTypes:!0});for(let d of y){if(te.has(d.name))continue;let g=c.join(x,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Lm(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),x=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Le(e.app?.head,{known:Jr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Jn(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)vn(o,w);if(e.runtimeConfig)z(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=re(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=W(n.debug),b=J();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],O=[];for(let s of P){let h=T(s.pattern),M=h.rendering==="prerender";if(M&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await V(s.filePath,s.pattern,{configDir:o,componentsDir:x,partialsDir:_,layoutsDir:y,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,b.filename),t.html=Xr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=qr(t.html,u);if(g.htmlAttrs)t.html=Kr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await S(t.html),M){let p=await Gn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Fe(t.html,D,!0);let N=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),K=c.join("server","pages",`${N}.compiled.json`),L=c.join("server","fragments",`${N}.html`);await Bun.write(c.join(r,K),JSON.stringify(t,null,2)),await Bun.write(c.join(r,L),t.fragment),O.push({pattern:s.pattern,compiledPath:K,fragmentPath:L,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(o,d);if(m.existsSync(H)){let{copied:s,bytes:h}=X(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let k=mr(o);if(k){let{copied:s,bytes:h}=X(k,c.join(r,"public",gr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${fn}/`)}let E={runtime:v.filename,router:b.filename},C=ja(O,E,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await ti(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Ji(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Qc(e._layerGraph),null,2));Ba(C,r);let F=Date.now()-l;return console.log(`
3
3
  [stx build] Done in ${F}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:E,outputDir:r,duration:F}}
4
- export{Nm};
4
+ export{Lm};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{B,dl,io,An,y,Ke,Ge}from"./chunk-ty5frr9t.js";import{Tr,dt,q}from"./chunk-65c11t6g.js";import{yr,i}from"./chunk-tqm66mh3.js";import{Ae}from"./chunk-4z926gay.js";import{ia}from"./chunk-p92272k0.js";function h(s){return s.endsWith(".md")||s.endsWith(".markdown")}function C(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let g;while((g=n.exec(s))!==null){let t=g.index,o=t+g[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function b(s,e={}){let{data:r,content:m}=Tr(s),a=await(e.renderer??((n)=>dt(n)))(m);return{html:C(a),frontmatter:r??{}}}import{dirname as k,resolve as R}from"path";function v(s){let e=s,r=B(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),g;while((g=m.exec(s))!==null){let o=g[1],l=g[2],d=g[0],u=o.includes("server");if(p(l))n.push(d);else if(u)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let u=l.index+l[0].length,f=t.indexOf("</script>",u);if(f===-1)continue;d.push({start:l.index,end:f+9}),o.lastIndex=f+9}for(let u=d.length-1;u>=0;u--)t=t.substring(0,d[u].start)+t.substring(d[u].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function M(s,e){return`<!DOCTYPE html>
2
+ import{B,gl,co,Pn,y,Ge,Je}from"./chunk-fds6vvq0.js";import{$r,pt,q}from"./chunk-xfjp5q2m.js";import{br,i}from"./chunk-jj78m9k1.js";import{Pe}from"./chunk-nzqr3w35.js";import{la}from"./chunk-8tfpv6zf.js";function h(s){return s.endsWith(".md")||s.endsWith(".markdown")}function C(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let g;while((g=n.exec(s))!==null){let t=g.index,o=t+g[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function b(s,e={}){let{data:r,content:m}=$r(s),a=await(e.renderer??((n)=>pt(n)))(m);return{html:C(a),frontmatter:r??{}}}import{dirname as k,resolve as R}from"path";function v(s){let e=s,r=B(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),g;while((g=m.exec(s))!==null){let o=g[1],l=g[2],d=g[0],u=o.includes("server");if(p(l))n.push(d);else if(u)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let u=l.index+l[0].length,f=t.indexOf("</script>",u);if(f===-1)continue;d.push({start:l.index,end:f+9}),o.lastIndex=f+9}for(let u=d.length-1;u>=0;u--)t=t.substring(0,d[u].start)+t.substring(d[u].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function M(s,e){return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -9,8 +9,8 @@ import{B,dl,io,An,y,Ke,Ge}from"./chunk-ty5frr9t.js";import{Tr,dt,q}from"./chunk-
9
9
  <body>
10
10
  ${s}
11
11
  </body>
12
- </html>`}async function xc(s,e={}){let r=R(s),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let c=await m.text(),a=null;if(h(r)){let n=await b(c,{renderer:e.markdownRenderer});c=n.html,a=n.frontmatter}if(a)e={...e,context:{...a,...e.context||{}}};if(e.layout){let n=R(e.layout),p=Bun.file(n);if(!await p.exists())throw Error(`Layout template not found: ${n}`);let{layout:g,injectCSS:t,...o}=e,l={...e.context||{}};An(l);let d=await w(c,r,{...o,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),u=await p.text(),f={...l,content:d},x={...o,context:f,injectCSS:t};return w(u,n,x)}return w(c,r,e)}async function w(s,e,r={}){let{templateContent:m,serverScripts:c,clientScripts:a}=v(s),n={...q,...r.options},p={__filename:e,__dirname:k(e),__stx:{},__stx_options:n,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...io(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let o of c)await y(o,p,e);let g=new Set,t=m;if(t=await i(t,p,e,n,g),dl(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),a.length>0)t+=`
12
+ </html>`}async function _c(s,e={}){let r=R(s),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let c=await m.text(),a=null;if(h(r)){let n=await b(c,{renderer:e.markdownRenderer});c=n.html,a=n.frontmatter}if(a)e={...e,context:{...a,...e.context||{}}};if(e.layout){let n=R(e.layout),p=Bun.file(n);if(!await p.exists())throw Error(`Layout template not found: ${n}`);let{layout:g,injectCSS:t,...o}=e,l={...e.context||{}};Pn(l);let d=await w(c,r,{...o,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),u=await p.text(),f={...l,content:d},x={...o,context:f,injectCSS:t};return w(u,n,x)}return w(c,r,e)}async function w(s,e,r={}){let{templateContent:m,serverScripts:c,clientScripts:a}=v(s),n={...q,...r.options},p={__filename:e,__dirname:k(e),__stx:{},__stx_options:n,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...co(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let o of c)await y(o,p,e);let g=new Set,t=m;if(t=await i(t,p,e,n,g),gl(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),a.length>0)t+=`
13
13
  ${a.join(`
14
- `)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=Ke(p),d=await Promise.all(a.map(async(x)=>{let _=x.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(_))return x;let S=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!S)return x;return await Ge(S[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),f=[await yr(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
15
- `);t=ia(t,f)}t=await Ae(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-q3ztpbz4.js");t=await o(t)}catch{}return t}
16
- export{xc};
14
+ `)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=Ge(p),d=await Promise.all(a.map(async(x)=>{let _=x.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(_))return x;let S=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!S)return x;return await Je(S[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),f=[await br(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
15
+ `);t=la(t,f)}t=await Pe(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-xahn0h9f.js");t=await o(t)}catch{}return t}
16
+ export{_c};
@@ -45,12 +45,12 @@ var p=0;function f(){return`stx-teleport-${++p}`}function g(t){let e=t.split(","
45
45
  });
46
46
  })();
47
47
  </script>
48
- `}function kh(t,e,l){p=0;let o=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return t.replace(o,(r,s,d)=>{let a=f(),{target:u,disabled:n}=g(s),c=d.trim();if(n)try{let i=!1;if(n==="true")i=!0;else if(n==="false")i=!1;else if(n in e)i=Boolean(e[n]);if(i)return`<div class="stx-teleport-inline" data-teleport-disabled>${c}</div>`}catch{}let m=h(a,u);return`
48
+ `}function Eh(t,e,l){p=0;let o=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return t.replace(o,(r,s,d)=>{let a=f(),{target:u,disabled:n}=g(s),c=d.trim();if(n)try{let i=!1;if(n==="true")i=!0;else if(n==="false")i=!1;else if(n in e)i=Boolean(e[n]);if(i)return`<div class="stx-teleport-inline" data-teleport-disabled>${c}</div>`}catch{}let m=h(a,u);return`
49
49
  <div id="${a}" class="stx-teleport-source" style="display: none;">
50
50
  <template>${c}</template>
51
51
  </div>
52
52
  ${m}
53
- `})}function _h(){return`
53
+ `})}function Th(){return`
54
54
  <script>
55
55
  (function() {
56
56
  // Common teleport targets
@@ -68,4 +68,4 @@ var p=0;function f(){return`stx-teleport-${++p}`}function g(t){let e=t.split(","
68
68
  })();
69
69
  </script>
70
70
  `}
71
- export{kh,_h};
71
+ export{Eh,Th};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{P}from"./chunk-ty5frr9t.js";import{i}from"./chunk-tqm66mh3.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
2
+ import{P}from"./chunk-fds6vvq0.js";import{i}from"./chunk-jj78m9k1.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
3
3
  ${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
4
4
  `)}else{console.log(`
5
5
  ${e.bold}Available Commands:${e.reset}
@@ -16,9 +16,9 @@ ${e.bold}Markdown:${e.reset}`),a.forEach((c)=>console.log(` ${e.blue}${c}${e.re
16
16
  ${e.bold}Other:${e.reset}`),d.forEach((c)=>console.log(` ${e.dim}${c}${e.reset}`));console.log()}},cat:{description:"Show file contents",usage:"cat <file>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a file${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);if(!await Bun.file(n).exists()){console.log(`${e.red}Error: File not found: ${n}${e.reset}`);return}let s=(await Bun.file(n).text()).split(`
17
17
  `);console.log(),s.forEach((l,a)=>{let d=String(a+1).padStart(3," ");console.log(`${e.dim}${d}${e.reset} ${l}`)}),console.log()}},load:{description:"Load context from JSON file",usage:"load <file.json>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a JSON file${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);if(!await Bun.file(n).exists()){console.log(`${e.red}Error: File not found: ${n}${e.reset}`);return}try{let r=await Bun.file(n).text(),s=JSON.parse(r);o.context={...o.context,...s},console.log(`${e.green}\u2713${e.reset} Loaded ${Object.keys(s).length} variables from ${t[0]}`)}catch(r){console.log(`${e.red}Error parsing JSON:${e.reset}`,r)}}},save:{description:"Save context to JSON file",usage:"save <file.json>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a file name${e.reset}`);return}let n=g.resolve(o.cwd,t[0]);try{await Bun.write(n,JSON.stringify(o.context,null,2)),console.log(`${e.green}\u2713${e.reset} Context saved to ${t[0]}`)}catch(r){console.log(`${e.red}Error saving file:${e.reset}`,r)}}},history:{description:"Show command history",usage:"history [count]",handler:async(t,o)=>{let n=t[0]?Number.parseInt(t[0],10):20,r=o.history.slice(-n);if(r.length===0){console.log(`${e.dim}No history${e.reset}`);return}console.log(),r.forEach((s,l)=>{let a=String(o.history.length-r.length+l+1).padStart(3," ");console.log(`${e.dim}${a}${e.reset} ${s}`)}),console.log()}},exit:{description:"Exit interactive mode",usage:"exit",handler:async(t,o)=>{o.running=!1,console.log(`
18
18
  ${e.dim}Goodbye!${e.reset}
19
- `)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async(t,o)=>u.exit.handler(t,o)}};function h(t,o){let n=t.split(" "),r=n[0];if(n.length===1)return Object.keys(u).filter((s)=>s.startsWith(r));if(["render","cat","load","cd"].includes(r)){let s=n.slice(1).join(" "),l=g.dirname(s)||".",a=g.basename(s),d=g.resolve(o.cwd,l);if(p.existsSync(d)&&p.statSync(d).isDirectory())try{return p.readdirSync(d).filter((f)=>f.startsWith(a)).map((f)=>`${r} ${l==="."?"":`${l}/`}${f}`)}catch{return[]}}if(["unset","eval","set"].includes(r)){let s=n[1]||"";return Object.keys(o.context).filter((l)=>l.startsWith(s)).map((l)=>`${r} ${l}`)}return[]}async function _m(t={}){let o={context:t.context||{},cwd:t.cwd||process.cwd(),history:[],running:!0,lastResult:null},n=y.createInterface({input:process.stdin,output:process.stdout,completer:(s)=>[h(s,o),s],historySize:t.maxHistory||100});console.log(`
19
+ `)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async(t,o)=>u.exit.handler(t,o)}};function h(t,o){let n=t.split(" "),r=n[0];if(n.length===1)return Object.keys(u).filter((s)=>s.startsWith(r));if(["render","cat","load","cd"].includes(r)){let s=n.slice(1).join(" "),l=g.dirname(s)||".",a=g.basename(s),d=g.resolve(o.cwd,l);if(p.existsSync(d)&&p.statSync(d).isDirectory())try{return p.readdirSync(d).filter((f)=>f.startsWith(a)).map((f)=>`${r} ${l==="."?"":`${l}/`}${f}`)}catch{return[]}}if(["unset","eval","set"].includes(r)){let s=n[1]||"";return Object.keys(o.context).filter((l)=>l.startsWith(s)).map((l)=>`${r} ${l}`)}return[]}async function Tm(t={}){let o={context:t.context||{},cwd:t.cwd||process.cwd(),history:[],running:!0,lastResult:null},n=y.createInterface({input:process.stdin,output:process.stdout,completer:(s)=>[h(s,o),s],historySize:t.maxHistory||100});console.log(`
20
20
  ${e.bold}${e.blue}stx Interactive Mode${e.reset}
21
21
  ${e.dim}Type 'help' for available commands, 'exit' to quit${e.reset}
22
22
  `);let r=()=>{let s=o.cwd.replace(process.env.HOME||"","~");n.question(`${e.cyan}stx${e.reset} ${e.dim}${s}${e.reset} ${e.green}>${e.reset} `,async(l)=>{let a=l.trim();if(!a){if(o.running)r();return}o.history.push(a);let d=a.match(/(?:[^\s"]|"[^"]*")+/g)||[],c=d[0]?.toLowerCase(),f=d.slice(1).map((m)=>m.replace(/^"|"$/g,""));if(c&&u[c])try{await u[c].handler(f,o)}catch(m){console.log(`${e.red}Error:${e.reset}`,m)}else if(c)if(a.includes("{{")||a.includes("}}"))try{let m=await P(a,o.context,"eval");console.log(`${e.green}\u2192${e.reset} ${m}`)}catch{console.log(`${e.red}Unknown command: ${c}${e.reset}`),console.log(`${e.dim}Type 'help' for available commands${e.reset}`)}else console.log(`${e.red}Unknown command: ${c}${e.reset}`),console.log(`${e.dim}Type 'help' for available commands${e.reset}`);if(o.running)r();else n.close()})};n.on("SIGINT",()=>{console.log(`
23
23
  ${e.dim}(Use 'exit' to quit)${e.reset}`),r()}),r()}
24
- export{_m};
24
+ export{Tm};