@stacksjs/stx 0.2.705 → 0.2.707

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 (263) hide show
  1. package/dist/app-shell.d.ts +2 -1
  2. package/dist/app-shell.js +5 -2
  3. package/dist/{chunk-e3yhx053.js → chunk-029qng4p.js} +5 -5
  4. package/dist/chunk-0dve54ne.js +3 -0
  5. package/dist/chunk-0f12mv0z.js +2 -0
  6. package/dist/{chunk-m4j9gedb.js → chunk-0myrwz84.js} +48 -8
  7. package/dist/{chunk-613reww3.js → chunk-0v5nfhwg.js} +3 -3
  8. package/dist/chunk-12vjp2gr.js +2 -0
  9. package/dist/chunk-18fr730w.js +2 -0
  10. package/dist/{chunk-k59yexav.js → chunk-1f4e06c2.js} +2 -2
  11. package/dist/{chunk-n2ema4wf.js → chunk-1xjv71dw.js} +2 -2
  12. package/dist/chunk-29sapda2.js +2 -0
  13. package/dist/{chunk-d597d0dp.js → chunk-2aarvd3a.js} +6 -6
  14. package/dist/chunk-2dgbme86.js +2 -0
  15. package/dist/{chunk-ah5ch04j.js → chunk-2gny5jdt.js} +2 -2
  16. package/dist/chunk-2qf6kd9r.js +2 -0
  17. package/dist/chunk-2snfd93r.js +2 -0
  18. package/dist/chunk-2tqekz3d.js +3 -0
  19. package/dist/{chunk-y91rz3rq.js → chunk-3457kk19.js} +7 -7
  20. package/dist/chunk-3hhcea1p.js +54 -0
  21. package/dist/chunk-3t3p2c1t.js +65 -0
  22. package/dist/{chunk-3850m7ab.js → chunk-3wkgd883.js} +1 -1
  23. package/dist/chunk-42t97n9v.js +2 -0
  24. package/dist/{chunk-t27fecet.js → chunk-42w6snem.js} +4 -4
  25. package/dist/chunk-46s9ma3t.js +2 -0
  26. package/dist/chunk-4c1fbthr.js +2 -0
  27. package/dist/{chunk-zggdhtmn.js → chunk-4ckxs446.js} +3 -3
  28. package/dist/chunk-4fxg20je.js +2 -0
  29. package/dist/chunk-4m9qn8ps.js +4 -0
  30. package/dist/chunk-4y73c35z.js +33 -0
  31. package/dist/{chunk-jkywbfb0.js → chunk-533g1b9b.js} +2 -2
  32. package/dist/chunk-58v34kba.js +2 -0
  33. package/dist/{chunk-rpfzk6yg.js → chunk-59g266vc.js} +114 -114
  34. package/dist/{chunk-2gzrx4ma.js → chunk-59k5ntkt.js} +56 -56
  35. package/dist/chunk-5n4qg8za.js +3 -0
  36. package/dist/{chunk-1kr1mpft.js → chunk-67abad76.js} +1 -1
  37. package/dist/{chunk-7smgebdq.js → chunk-6cz1sbb1.js} +3 -3
  38. package/dist/{chunk-x0espnry.js → chunk-6ms7rtqt.js} +1 -1
  39. package/dist/{chunk-4sesw88b.js → chunk-6n11z33h.js} +5 -5
  40. package/dist/chunk-6ndeycxk.js +2 -0
  41. package/dist/{chunk-tp4eqfxq.js → chunk-6ts3sthp.js} +2 -2
  42. package/dist/{chunk-8w4y3dx3.js → chunk-768evhvm.js} +2 -2
  43. package/dist/{chunk-1d2xbwhm.js → chunk-79p5580k.js} +4 -4
  44. package/dist/chunk-79vj1txq.js +4 -0
  45. package/dist/chunk-7c7jnph2.js +20 -0
  46. package/dist/chunk-7dc3n69c.js +3 -0
  47. package/dist/chunk-7hpwcwwh.js +2 -0
  48. package/dist/chunk-7ppbv5bc.js +14 -0
  49. package/dist/{chunk-ccqe741j.js → chunk-83p5k4eb.js} +2 -2
  50. package/dist/{chunk-w71189qh.js → chunk-89s38bat.js} +2 -2
  51. package/dist/chunk-8s4rxgs8.js +2 -0
  52. package/dist/chunk-8ss2v7sw.js +2 -0
  53. package/dist/chunk-8t9em8md.js +2 -0
  54. package/dist/{chunk-vfjenjez.js → chunk-8v2vbc4y.js} +1 -1
  55. package/dist/chunk-921gb49g.js +2 -0
  56. package/dist/chunk-9736003n.js +2 -0
  57. package/dist/chunk-97r557ws.js +2 -0
  58. package/dist/{chunk-x7rtrdqq.js → chunk-998zvkzr.js} +3 -3
  59. package/dist/{chunk-5w1erc2m.js → chunk-9dg5ja4w.js} +1 -1
  60. package/dist/chunk-9frqh3bj.js +2 -0
  61. package/dist/{chunk-w7j88qkc.js → chunk-9v1t47d2.js} +2 -2
  62. package/dist/chunk-a35m0g7z.js +2 -0
  63. package/dist/{chunk-3hxd5td3.js → chunk-am4wadh7.js} +2 -2
  64. package/dist/{chunk-wqe98032.js → chunk-an387127.js} +2 -2
  65. package/dist/{chunk-bsr9wnq4.js → chunk-ap30qs8p.js} +2 -2
  66. package/dist/chunk-avr65xra.js +2 -0
  67. package/dist/chunk-b2ajtmvk.js +2 -0
  68. package/dist/chunk-b6318vv3.js +2 -0
  69. package/dist/{chunk-7kn0d1f1.js → chunk-b7j48bq9.js} +2 -2
  70. package/dist/chunk-bcr8sq50.js +2 -0
  71. package/dist/chunk-bd9p1xmr.js +2 -0
  72. package/dist/chunk-c5tky2vf.js +32 -0
  73. package/dist/{chunk-gj95952w.js → chunk-cam9je83.js} +105 -105
  74. package/dist/{chunk-njhd845r.js → chunk-ckrmrdjp.js} +5 -5
  75. package/dist/{chunk-9g0hyvhv.js → chunk-cm8m2ygc.js} +11 -11
  76. package/dist/{chunk-k296qq0p.js → chunk-cwhzk2n3.js} +2 -2
  77. package/dist/{chunk-g92jvafk.js → chunk-czy6hs6g.js} +5 -5
  78. package/dist/{chunk-rabmqfzr.js → chunk-d21twmm2.js} +1 -1
  79. package/dist/chunk-d22sgyg2.js +3 -0
  80. package/dist/chunk-dhdt7e54.js +2 -0
  81. package/dist/chunk-dmcjap96.js +20 -0
  82. package/dist/chunk-dxqvv686.js +3 -0
  83. package/dist/chunk-dzkg6cy5.js +3 -0
  84. package/dist/{chunk-b3sw5ykg.js → chunk-edka95zp.js} +3 -3
  85. package/dist/chunk-enssxcpa.js +2 -0
  86. package/dist/chunk-eqz0g5c5.js +25 -0
  87. package/dist/chunk-f7a6nzx6.js +2 -0
  88. package/dist/{chunk-44c1mbye.js → chunk-fcbd7kwj.js} +3 -3
  89. package/dist/chunk-fen5nnc4.js +2 -0
  90. package/dist/chunk-fvk1xr5a.js +2 -0
  91. package/dist/chunk-g03tkxds.js +2 -0
  92. package/dist/{chunk-b2j7s1a2.js → chunk-g1tq4xdb.js} +2 -2
  93. package/dist/chunk-g6wd49b5.js +2 -0
  94. package/dist/chunk-gbkcc96c.js +2 -0
  95. package/dist/chunk-gk0nq2ky.js +2 -0
  96. package/dist/chunk-h8kbcz9t.js +2 -0
  97. package/dist/chunk-hs2sbkvk.js +2 -0
  98. package/dist/{chunk-yn9kvsk1.js → chunk-j2mpqa4p.js} +2 -2
  99. package/dist/chunk-j3emvkjb.js +2 -0
  100. package/dist/{chunk-5gkxpcex.js → chunk-j9mpwt71.js} +3 -3
  101. package/dist/{chunk-gp9k0t3g.js → chunk-jb5sftzz.js} +2 -2
  102. package/dist/chunk-jef9mn1h.js +2 -0
  103. package/dist/chunk-jx7q5cnv.js +11 -0
  104. package/dist/chunk-jztsks2y.js +2 -0
  105. package/dist/{chunk-t8d33x9w.js → chunk-khrckvwn.js} +4 -4
  106. package/dist/{chunk-n5wgst66.js → chunk-km5dpg5v.js} +171 -171
  107. package/dist/chunk-kqdzjgm6.js +421 -0
  108. package/dist/chunk-ktf42hmd.js +2 -0
  109. package/dist/{chunk-4x2gnvz1.js → chunk-kxf8z7vp.js} +2 -2
  110. package/dist/chunk-mzwa2478.js +2 -0
  111. package/dist/chunk-n6carvxa.js +2 -0
  112. package/dist/chunk-ncs2j5kc.js +3 -0
  113. package/dist/chunk-nzyr320e.js +2 -0
  114. package/dist/{chunk-z9csfarm.js → chunk-p4s8hq38.js} +11 -11
  115. package/dist/chunk-pank9g6n.js +2 -0
  116. package/dist/chunk-pf427myt.js +2 -0
  117. package/dist/chunk-pfjsyvmj.js +21 -0
  118. package/dist/chunk-pgjqx3kg.js +42 -0
  119. package/dist/{chunk-3ys3sa08.js → chunk-qa9t9k6z.js} +1 -1
  120. package/dist/chunk-qf0bs4a5.js +2 -0
  121. package/dist/chunk-qprjkz11.js +18 -0
  122. package/dist/{chunk-j76w5rnm.js → chunk-qy1ss1en.js} +2 -2
  123. package/dist/chunk-r6bc2q44.js +2 -0
  124. package/dist/{chunk-bymqr1bt.js → chunk-r96wcqs6.js} +2 -2
  125. package/dist/{chunk-sxf17xfc.js → chunk-rb2a1qxb.js} +6 -6
  126. package/dist/chunk-rwjgpmrw.js +2 -0
  127. package/dist/{chunk-416jy1m5.js → chunk-s9b6abkb.js} +2 -2
  128. package/dist/chunk-sdpzaase.js +2 -0
  129. package/dist/{chunk-2p34qf9c.js → chunk-stvw8y3c.js} +2 -2
  130. package/dist/chunk-sy1btryy.js +2 -0
  131. package/dist/{chunk-d635e7b5.js → chunk-t21ae4rx.js} +5 -5
  132. package/dist/{chunk-9ra3ne11.js → chunk-t63f15yh.js} +3 -3
  133. package/dist/{chunk-2v7t87n8.js → chunk-t6ayy0t5.js} +2 -2
  134. package/dist/{chunk-gxd737m5.js → chunk-t7ezw8cj.js} +45 -45
  135. package/dist/chunk-t7mbaf69.js +2 -0
  136. package/dist/chunk-taste5sr.js +2 -0
  137. package/dist/chunk-txjx2xd6.js +2 -0
  138. package/dist/chunk-txr51pkd.js +2 -0
  139. package/dist/chunk-vjyrwvz0.js +24 -0
  140. package/dist/chunk-vstvadc2.js +12 -0
  141. package/dist/chunk-w2h6nn70.js +2 -0
  142. package/dist/chunk-w4vxhedk.js +2 -0
  143. package/dist/{chunk-ktkmv1j8.js → chunk-wbfg7p3k.js} +4 -4
  144. package/dist/{chunk-4afwn4yj.js → chunk-wevcmbn6.js} +10 -10
  145. package/dist/chunk-wj235n59.js +130 -0
  146. package/dist/{chunk-3392k9vm.js → chunk-wp6q0geg.js} +2 -2
  147. package/dist/chunk-x8zekavj.js +2 -0
  148. package/dist/{chunk-xc03cdet.js → chunk-xyyt8v1r.js} +28 -28
  149. package/dist/chunk-ykmcnk3x.js +2 -0
  150. package/dist/chunk-yw66yks2.js +43 -0
  151. package/dist/chunk-z05dbey1.js +2 -0
  152. package/dist/{chunk-w7e28p74.js → chunk-zav8yrtp.js} +9 -9
  153. package/dist/{chunk-2nqt1m3m.js → chunk-zdpd29xd.js} +2 -2
  154. package/dist/{chunk-ywzh979k.js → chunk-zecgd1wz.js} +4 -4
  155. package/dist/{chunk-c3hr5mm2.js → chunk-zjaw79zp.js} +2 -2
  156. package/dist/{chunk-fgr56q3w.js → chunk-zjw6j2x0.js} +4 -4
  157. package/dist/{chunk-k7pmzreg.js → chunk-zn3c0ew5.js} +3 -3
  158. package/dist/cli.js +46 -46
  159. package/dist/craft-entry.js +2 -2
  160. package/dist/craft.js +2 -2
  161. package/dist/dev-server/serve-app.js +1 -1
  162. package/dist/expressions.js +6 -2
  163. package/dist/index.d.ts +1 -0
  164. package/dist/index.js +1 -0
  165. package/dist/island-chunking.js +5 -1
  166. package/dist/native/compiler/icons.d.ts +8 -0
  167. package/dist/native/compiler/icons.js +8 -0
  168. package/dist/page-head.d.ts +2 -0
  169. package/dist/page-head.js +35 -0
  170. package/dist/production-builder.js +1 -1
  171. package/dist/production-server.js +2 -2
  172. package/dist/pwa.js +3 -3
  173. package/dist/site-builder/i18n.js +1 -1
  174. package/dist/ssg.js +36 -36
  175. package/dist/template-compiler.js +2 -1
  176. package/package.json +5 -5
  177. package/dist/chunk-0mzbm86d.js +0 -2
  178. package/dist/chunk-11dpedh5.js +0 -2
  179. package/dist/chunk-1e79xcc8.js +0 -2
  180. package/dist/chunk-2fg2es95.js +0 -4
  181. package/dist/chunk-2r7j8q2q.js +0 -2
  182. package/dist/chunk-2whqx2c0.js +0 -2
  183. package/dist/chunk-2xtzzx00.js +0 -2
  184. package/dist/chunk-44efrzry.js +0 -2
  185. package/dist/chunk-4t9cggwf.js +0 -2
  186. package/dist/chunk-5h1ahj7m.js +0 -2
  187. package/dist/chunk-5zqxzyxk.js +0 -2
  188. package/dist/chunk-62q6f4vy.js +0 -2
  189. package/dist/chunk-68wezwr7.js +0 -2
  190. package/dist/chunk-7gw96jpj.js +0 -2
  191. package/dist/chunk-7w2mrg3s.js +0 -2
  192. package/dist/chunk-8hhyp9p6.js +0 -2
  193. package/dist/chunk-905azzfg.js +0 -2
  194. package/dist/chunk-926fs6g7.js +0 -2
  195. package/dist/chunk-93ft5jea.js +0 -3
  196. package/dist/chunk-983zpa57.js +0 -3
  197. package/dist/chunk-98yf0aq9.js +0 -4
  198. package/dist/chunk-99k1wbcw.js +0 -2
  199. package/dist/chunk-b378jpbp.js +0 -2
  200. package/dist/chunk-b7e07ybq.js +0 -3
  201. package/dist/chunk-bfhks7zf.js +0 -43
  202. package/dist/chunk-cbdyns7r.js +0 -3
  203. package/dist/chunk-csx3zne1.js +0 -3
  204. package/dist/chunk-d499mwtq.js +0 -3
  205. package/dist/chunk-d7vmzkjy.js +0 -2
  206. package/dist/chunk-d7whccsw.js +0 -2
  207. package/dist/chunk-djwat8vn.js +0 -2
  208. package/dist/chunk-dpjs0ajs.js +0 -2
  209. package/dist/chunk-ezna88p6.js +0 -2
  210. package/dist/chunk-fazw6sxz.js +0 -2
  211. package/dist/chunk-ffmtqtkf.js +0 -2
  212. package/dist/chunk-fhhx61qk.js +0 -18
  213. package/dist/chunk-g1bed7se.js +0 -2
  214. package/dist/chunk-g7mbb5kc.js +0 -2
  215. package/dist/chunk-gbgbhpms.js +0 -2
  216. package/dist/chunk-gcgvac2h.js +0 -2
  217. package/dist/chunk-gsj7yve0.js +0 -130
  218. package/dist/chunk-gvf7akv0.js +0 -2
  219. package/dist/chunk-gvggrhpq.js +0 -2
  220. package/dist/chunk-ha4vb9a6.js +0 -2
  221. package/dist/chunk-hadbgke6.js +0 -2
  222. package/dist/chunk-hkmewh5h.js +0 -12
  223. package/dist/chunk-hrc3wj8r.js +0 -421
  224. package/dist/chunk-hzszdz02.js +0 -2
  225. package/dist/chunk-j6rgdnkg.js +0 -2
  226. package/dist/chunk-jkpcrf4z.js +0 -11
  227. package/dist/chunk-jv7gdt4t.js +0 -2
  228. package/dist/chunk-jxwnk094.js +0 -2
  229. package/dist/chunk-k3yw4tha.js +0 -2
  230. package/dist/chunk-khhx6m7x.js +0 -2
  231. package/dist/chunk-kjc1f6af.js +0 -2
  232. package/dist/chunk-mv4wfsc5.js +0 -2
  233. package/dist/chunk-nhv3jt0d.js +0 -2
  234. package/dist/chunk-nmcgyxcg.js +0 -2
  235. package/dist/chunk-p4e7x4f6.js +0 -2
  236. package/dist/chunk-p6sdrq1y.js +0 -2
  237. package/dist/chunk-p78v88ng.js +0 -65
  238. package/dist/chunk-ptkr6m3a.js +0 -2
  239. package/dist/chunk-qdw0y8gw.js +0 -33
  240. package/dist/chunk-rb8g9nnc.js +0 -2
  241. package/dist/chunk-rhm7wg6p.js +0 -2
  242. package/dist/chunk-rkk14e9h.js +0 -14
  243. package/dist/chunk-t5qsaq1q.js +0 -21
  244. package/dist/chunk-tg5m9xn3.js +0 -31
  245. package/dist/chunk-tmzp0ght.js +0 -20
  246. package/dist/chunk-tqavwhja.js +0 -25
  247. package/dist/chunk-twcb0wp6.js +0 -42
  248. package/dist/chunk-v4x3ckcr.js +0 -54
  249. package/dist/chunk-w9kak6aj.js +0 -2
  250. package/dist/chunk-wta3e3q2.js +0 -2
  251. package/dist/chunk-xbn2p5m8.js +0 -2
  252. package/dist/chunk-xf7b2s2z.js +0 -2
  253. package/dist/chunk-xhzqswq2.js +0 -2
  254. package/dist/chunk-xj5e6nbn.js +0 -24
  255. package/dist/chunk-xvz9b1ht.js +0 -20
  256. package/dist/chunk-yfppczrm.js +0 -2
  257. package/dist/chunk-yr6qxp88.js +0 -2
  258. package/dist/chunk-yyx89zxs.js +0 -2
  259. package/dist/chunk-z0x54ynx.js +0 -3
  260. package/dist/chunk-z9e2a3mv.js +0 -2
  261. package/dist/chunk-za6teyn1.js +0 -2
  262. package/dist/chunk-zgyw04pj.js +0 -2
  263. package/dist/chunk-zw924mfr.js +0 -2
package/dist/ssg.js CHANGED
@@ -1,54 +1,54 @@
1
1
  // @bun
2
- import"./chunk-n2ema4wf.js";import{y,Lc}from"./chunk-xc03cdet.js";import"./chunk-2nqt1m3m.js";import"./chunk-k7pmzreg.js";import{Et}from"./chunk-hrc3wj8r.js";import"./chunk-3392k9vm.js";import"./chunk-k59yexav.js";import"./chunk-2p34qf9c.js";import{wt,xt,St,kt,_t,Ct}from"./chunk-m4j9gedb.js";import{i}from"./chunk-rpfzk6yg.js";import{us}from"./chunk-p78v88ng.js";import"./chunk-fgr56q3w.js";import"./chunk-d635e7b5.js";import{Ee,Jt,Yt}from"./chunk-tmzp0ght.js";import"./chunk-d499mwtq.js";import{h}from"./chunk-9g0hyvhv.js";import{gt,o}from"./chunk-gj95952w.js";import"./chunk-twcb0wp6.js";import"./chunk-v4x3ckcr.js";import"./chunk-t5qsaq1q.js";import"./chunk-tqavwhja.js";import"./chunk-bsr9wnq4.js";import{Oa,Na,Da}from"./chunk-b3sw5ykg.js";import{Kt,Wn,qn}from"./chunk-z0x54ynx.js";import{Xt}from"./chunk-j76w5rnm.js";import"./chunk-cbdyns7r.js";import{q,ye}from"./chunk-rkk14e9h.js";import"./chunk-vfjenjez.js";import"./chunk-5gkxpcex.js";import{c}from"./chunk-93ft5jea.js";import{r,fe}from"./chunk-hkmewh5h.js";import k from"fs";import p from"path";import{createHash as Pt}from"crypto";function $t(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Rt(t){return Bun.hash(t).toString(16)}function at(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let a=new Map,s=t.replace(Dt,(e,u,f,x)=>{let m=x.trim();if(!m)return e;if(/\bdata-stx-src=/.test(f))return e;if(n.minify)m=$t(m);let b=Rt(m);if(!a.has(b))a.set(b,m);let v=n.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(m).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${b}.js"${v}${f}></script>`}),l=Array.from(a,([e,u])=>({hash:e,code:u}));return{html:s,chunks:l}}var It=new Set(["visible","idle"]);function ot(t){if(!t.includes("data-stx-src="))return t;let n=new Map,a=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,s;while((s=a.exec(t))!==null)n.set(s[1],s[2]);let l=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(It.has(n.get(u[1])||""))l.add(u[2]);let f=t.lastIndexOf("</head>");if(l.size===0||f===-1)return t;let x=Array.from(l).filter((m)=>!t.includes(`rel="prefetch" href="${m}"`)).map((m)=>`<link rel="prefetch" href="${m}" as="script">`).join("");if(!x)return t;return t.slice(0,f)+x+t.slice(f)}var Bt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function K(t){let n=t.trim();if(!n)return null;let a=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(a).origin+new URL(a).pathname.replace(/\/$/,"")}catch{return null}}function jt(t){for(let n of Bt){let a=t[n];if(!a)continue;let s=K(a);if(s)return{url:s,source:"env",via:n}}return null}function ct(t){if(!t||typeof t!=="object")return null;let n=t,a=n.site?.url??n.url??n.app?.url;return typeof a==="string"?K(a):null}async function Ft(t){let{existsSync:n}=await import("fs"),a=await import("path");for(let s of["site.config.ts","site.config.js",".config/site.config.ts"]){let l=a.resolve(t,s);if(!n(l))continue;try{let e=await import(l),u=ct(e.default??e);if(u)return u}catch{}}return null}async function lt(t={}){let n=t.cwd??process.cwd(),a=t.env??process.env;if(t.explicit){let u=K(t.explicit);if(u)return{url:u,source:"option"}}let s=ct(t.stxConfig);if(s)return{url:s,source:"stx.config",via:"site.url"};let l=await Ft(n);if(l)return{url:l,source:"site.config",via:"url"};let e=jt(a);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ut(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
3
- `)}function W(t){return async()=>({paths:await t(),fallback:!1})}var Tt;function Ot(t){let n=r(t),{depths:a}=fe(n),s=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,l;while((l=s.exec(n))!==null){if(a[l.index]!==0)continue;let u=y(n,"(",")",s.lastIndex-1),f=n.indexOf("{",u+1),x=y(n,"{","}",f);if(u<0||f<0||x<0)break;return t.slice(l.index,x+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((l=e.exec(n))!==null){if(a[l.index]!==0)continue;let u=Lc(n,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function dt(t){let n="read";try{let a=await Bun.file(t).text();n="parse";let s=Xt(a),l=[...s.server,...s.client,...s.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(r(e.attrs))).sort((e,u)=>a.indexOf(e.fullTag)-a.indexOf(u.fullTag));for(let e of l){if(!/\bgetStaticPaths\b/.test(r(e.content)))continue;let u=(Tt??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(r(u)))continue;let f=Ot(u);if(/\bdefineStaticPaths\b/.test(r(f))&&Et(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let x=Function("defineStaticPaths",`return (${f})`)(W);if(typeof x!=="function")throw TypeError("getStaticPaths must be a function");let m=await x();n="result";let b=Array.isArray(m)?{paths:m}:m;if(!b||typeof b!=="object"||!("paths"in b)||!Array.isArray(b.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let v of b.paths)if(!v||typeof v!=="object"||!v.params||typeof v.params!=="object"||Array.isArray(v.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:b}}return{kind:"absent"}}catch(a){return{kind:"error",phase:n,error:a instanceof Error?a:Error(String(a))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,n=""){this.cacheDir=t,this.salt=n}async load(){if(this.loaded)return;let t=p.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let n=JSON.parse(await Bun.file(t).text());for(let[a,s]of Object.entries(n))this.cache.set(a,s)}catch{}this.loaded=!0}async save(){await k.promises.mkdir(this.cacheDir,{recursive:!0});let t=p.join(this.cacheDir,"build-cache.json"),n={};for(let[a,s]of this.cache)n[a]=s;await Bun.write(t,JSON.stringify(n))}getHash(t,n){let a=k.statSync(t),s=`${this.salt}|${t}:${a.mtimeMs}`;for(let e of n)if(k.existsSync(e)){let u=k.statSync(e);s+=`:${e}:${u.mtimeMs}`}let l=0;for(let e=0;e<s.length;e++){let u=s.charCodeAt(e);l=(l<<5)-l+u,l=l&l}return Math.abs(l).toString(36)}get(t,n){let a=this.cache.get(t);if(!a)return null;let s=this.getHash(n,a.dependencies??[]);if(a.hash!==s)return this.cache.delete(t),null;return a.html}set(t,n,a,s){let l=this.getHash(n,a);this.cache.set(t,{hash:l,html:s,generatedAt:Date.now(),dependencies:a})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let n=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return p.join(this.cacheDir,"isr",n)}async get(t){let n=this.getFilePath(t);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(t,n){let a=this.getFilePath(t);await k.promises.mkdir(p.dirname(a),{recursive:!0}),await Bun.write(a,JSON.stringify(n))}async invalidate(t){let n=this.getFilePath(t);if(await Bun.file(n).exists())await k.promises.unlink(n)}async invalidatePattern(t){let n=p.join(this.cacheDir,"isr");if(!k.existsSync(n))return;let a=await k.promises.readdir(n);for(let s of a){let l=s.replace(/_/g,"/").replace(".json","");if(t.test(l))await k.promises.unlink(p.join(n,s))}}async needsRevalidation(t){let n=await this.get(t);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function At(t){let n=[];if(!t.isDynamic)n.push({url:t.pattern,params:{}});else{let a=await dt(t.filePath);if(a.kind==="error")throw Error(`getStaticPaths ${a.phase} failed for ${t.pattern} (${t.filePath}): ${a.error.message}`,{cause:a.error});if(a.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),n;let s=a.value;if(s.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),n;for(let l of s.paths){let e=t.pattern;for(let[u,f]of Object.entries(l.params))e=e.replace(`:${u}`,f).replace(`:${u}*`,f);n.push({url:e,params:l.params,props:l.props,revalidate:l.revalidate})}}return n}async function Lt(t){let n=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let a of n)if(await Bun.file(a).exists())try{let s=await import(a);if(typeof s.default==="function")return await s.default();else if(typeof s.default==="object")return s.default;else if(typeof s.getData==="function")return await s.getData();else{let{default:l,...e}=s;return e}}catch(s){console.error(`Error loading data file ${a}:`,s)}return null}async function Ut(t,n,a){let s=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!s)return null;let l=s[1];if(!l.includes("getStaticProps"))return null;try{let e=l.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
2
+ import"./chunk-1xjv71dw.js";import{b,Bc}from"./chunk-xyyt8v1r.js";import"./chunk-zdpd29xd.js";import"./chunk-zn3c0ew5.js";import{Tt,C}from"./chunk-kqdzjgm6.js";import"./chunk-wp6q0geg.js";import"./chunk-1f4e06c2.js";import"./chunk-stvw8y3c.js";import{xt,St,kt,_t,Ct,Et}from"./chunk-0myrwz84.js";import{a}from"./chunk-59g266vc.js";import{gs}from"./chunk-3t3p2c1t.js";import"./chunk-zjw6j2x0.js";import"./chunk-t21ae4rx.js";import{Te,Yt,Zt}from"./chunk-dmcjap96.js";import"./chunk-dzkg6cy5.js";import{y}from"./chunk-cm8m2ygc.js";import{mt,i}from"./chunk-cam9je83.js";import"./chunk-pgjqx3kg.js";import"./chunk-3hhcea1p.js";import"./chunk-pfjsyvmj.js";import"./chunk-eqz0g5c5.js";import"./chunk-ap30qs8p.js";import{Da,Ma,La}from"./chunk-edka95zp.js";import{Xt,Kn,Xn}from"./chunk-2tqekz3d.js";import{Jt}from"./chunk-qy1ss1en.js";import"./chunk-d22sgyg2.js";import"./chunk-7dc3n69c.js";import{G,be}from"./chunk-7ppbv5bc.js";import"./chunk-8v2vbc4y.js";import"./chunk-j9mpwt71.js";import{l}from"./chunk-5n4qg8za.js";import{s,ge}from"./chunk-vstvadc2.js";import k from"fs";import h from"path";import{createHash as Pt}from"crypto";function $t(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Rt(t){return Bun.hash(t).toString(16)}function ot(t,r={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let o=new Map,n=t.replace(Dt,(e,u,f,x)=>{let w=x.trim();if(!w)return e;if(/\bdata-stx-src=/.test(f))return e;if(r.minify)w=$t(w);let g=Rt(w);if(!o.has(g))o.set(g,w);let v=r.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(w).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${g}.js"${v}${f}></script>`}),c=Array.from(o,([e,u])=>({hash:e,code:u}));return{html:n,chunks:c}}var It=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let r=new Map,o=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,n;while((n=o.exec(t))!==null)r.set(n[1],n[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(It.has(r.get(u[1])||""))c.add(u[2]);let f=/<\/head\s*>/iy,x=C(t,(g,v)=>(f.lastIndex=v,f.exec(g)?f.lastIndex:-1))[0]?.start??-1;if(c.size===0||x===-1)return t;let w=Array.from(c).filter((g)=>!t.includes(`rel="prefetch" href="${g}"`)).map((g)=>`<link rel="prefetch" href="${g}" as="script">`).join("");if(!w)return t;return t.slice(0,x)+w+t.slice(x)}var Bt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function X(t){let r=t.trim();if(!r)return null;let o=/^https?:\/\//i.test(r)?r:`https://${r}`;try{return new URL(o).origin+new URL(o).pathname.replace(/\/$/,"")}catch{return null}}function jt(t){for(let r of Bt){let o=t[r];if(!o)continue;let n=X(o);if(n)return{url:n,source:"env",via:r}}return null}function lt(t){if(!t||typeof t!=="object")return null;let r=t,o=r.site?.url??r.url??r.app?.url;return typeof o==="string"?X(o):null}async function Ft(t){let{existsSync:r}=await import("fs"),o=await import("path");for(let n of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=o.resolve(t,n);if(!r(c))continue;try{let e=await import(c),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let r=t.cwd??process.cwd(),o=t.env??process.env;if(t.explicit){let u=X(t.explicit);if(u)return{url:u,source:"option"}}let n=lt(t.stxConfig);if(n)return{url:n,source:"stx.config",via:"site.url"};let c=await Ft(r);if(c)return{url:c,source:"site.config",via:"url"};let e=jt(o);if(e)return e;return{url:"http://localhost",source:"fallback"}}function dt(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
3
+ `)}function J(t){return async()=>({paths:await t(),fallback:!1})}var At;function Ot(t){let r=s(t),{depths:o}=ge(r),n=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,c;while((c=n.exec(r))!==null){if(o[c.index]!==0)continue;let u=b(r,"(",")",n.lastIndex-1),f=r.indexOf("{",u+1),x=b(r,"{","}",f);if(u<0||f<0||x<0)break;return t.slice(c.index,x+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((c=e.exec(r))!==null){if(o[c.index]!==0)continue;let u=Bc(r,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function gt(t){let r="read";try{let o=await Bun.file(t).text();r="parse";let n=Jt(o),c=[...n.server,...n.client,...n.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(s(e.attrs))).sort((e,u)=>o.indexOf(e.fullTag)-o.indexOf(u.fullTag));for(let e of c){if(!/\bgetStaticPaths\b/.test(s(e.content)))continue;let u=(At??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(s(u)))continue;let f=Ot(u);if(/\bdefineStaticPaths\b/.test(s(f))&&Tt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");r="execute";let x=Function("defineStaticPaths",`return (${f})`)(J);if(typeof x!=="function")throw TypeError("getStaticPaths must be a function");let w=await x();r="result";let g=Array.isArray(w)?{paths:w}:w;if(!g||typeof g!=="object"||!("paths"in g)||!Array.isArray(g.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let v of g.paths)if(!v||typeof v!=="object"||!v.params||typeof v.params!=="object"||Array.isArray(v.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:g}}return{kind:"absent"}}catch(o){return{kind:"error",phase:r,error:o instanceof Error?o:Error(String(o))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,r=""){this.cacheDir=t,this.salt=r}async load(){if(this.loaded)return;let t=h.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let r=JSON.parse(await Bun.file(t).text());for(let[o,n]of Object.entries(r))this.cache.set(o,n)}catch{}this.loaded=!0}async save(){await k.promises.mkdir(this.cacheDir,{recursive:!0});let t=h.join(this.cacheDir,"build-cache.json"),r={};for(let[o,n]of this.cache)r[o]=n;await Bun.write(t,JSON.stringify(r))}getHash(t,r){let o=k.statSync(t),n=`${this.salt}|${t}:${o.mtimeMs}`;for(let e of r)if(k.existsSync(e)){let u=k.statSync(e);n+=`:${e}:${u.mtimeMs}`}let c=0;for(let e=0;e<n.length;e++){let u=n.charCodeAt(e);c=(c<<5)-c+u,c=c&c}return Math.abs(c).toString(36)}get(t,r){let o=this.cache.get(t);if(!o)return null;let n=this.getHash(r,o.dependencies??[]);if(o.hash!==n)return this.cache.delete(t),null;return o.html}set(t,r,o,n){let c=this.getHash(r,o);this.cache.set(t,{hash:c,html:n,generatedAt:Date.now(),dependencies:o})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let r=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return h.join(this.cacheDir,"isr",r)}async get(t){let r=this.getFilePath(t);if(!await Bun.file(r).exists())return null;try{return JSON.parse(await Bun.file(r).text())}catch{return null}}async set(t,r){let o=this.getFilePath(t);await k.promises.mkdir(h.dirname(o),{recursive:!0}),await Bun.write(o,JSON.stringify(r))}async invalidate(t){let r=this.getFilePath(t);if(await Bun.file(r).exists())await k.promises.unlink(r)}async invalidatePattern(t){let r=h.join(this.cacheDir,"isr");if(!k.existsSync(r))return;let o=await k.promises.readdir(r);for(let n of o){let c=n.replace(/_/g,"/").replace(".json","");if(t.test(c))await k.promises.unlink(h.join(r,n))}}async needsRevalidation(t){let r=await this.get(t);if(!r)return!0;return Date.now()>r.revalidateAfter}}async function Lt(t){let r=[];if(!t.isDynamic)r.push({url:t.pattern,params:{}});else{let o=await gt(t.filePath);if(o.kind==="error")throw Error(`getStaticPaths ${o.phase} failed for ${t.pattern} (${t.filePath}): ${o.error.message}`,{cause:o.error});if(o.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),r;let n=o.value;if(n.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),r;for(let c of n.paths){let e=t.pattern;for(let[u,f]of Object.entries(c.params))e=e.replace(`:${u}`,f).replace(`:${u}*`,f);r.push({url:e,params:c.params,props:c.props,revalidate:c.revalidate})}}return r}async function Ut(t){let r=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let o of r)if(await Bun.file(o).exists())try{let n=await import(o);if(typeof n.default==="function")return await n.default();else if(typeof n.default==="object")return n.default;else if(typeof n.getData==="function")return await n.getData();else{let{default:c,...e}=n;return e}}catch(n){console.error(`Error loading data file ${o}:`,n)}return null}async function Mt(t,r,o){let n=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!n)return null;let c=n[1];if(!c.includes("getStaticProps"))return null;try{let e=c.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
4
4
  return (async function getStaticProps() {
5
5
  ${e[1]}
6
6
  })()
7
- `)(n)}catch(e){return console.error(`Error executing getStaticProps in ${a}:`,e),null}}function Mt(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function ft(t,n,a={},s,l){let e=await Bun.file(t.filePath).text(),u=await Lt(t.filePath),f=await Ut(e,n,t.filePath),x={...u||{},...f||{},...a,params:n,$route:{path:t.pattern,params:n}},m=new Set,b=[],v=[],R={...l,minifyClient:!0,...s.partialsDir?{partialsDir:s.partialsDir}:{},...s.componentsDir?{componentsDir:s.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(D)=>{b.push(`${p.relative(process.cwd(),D.templatePath)}: ${D.message}
8
- resolved against partialsDir: ${D.partialsDir}`)},onServerScriptError:(D)=>{v.push(`${p.relative(process.cwd(),D.sourcePath)} (${D.kind}): ${D.message}`)}};if(Mt(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let S=await o(e,x,t.filePath,R,m);for(let D of[t.filePath,...m])for(let F of Ee(D))m.add(F);if(Object.keys(n).length>0){let D=`<script>if(window.stx)window.stx._rp=${JSON.stringify(n)};else window.__stx_rp=${JSON.stringify(n)};</script>`;if(S.includes("</head>"))S=S.replace("</head>",`${D}
7
+ `)(r)}catch(e){return console.error(`Error executing getStaticProps in ${o}:`,e),null}}function Gt(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function ft(t,r,o={},n,c){let e=await Bun.file(t.filePath).text(),u=await Ut(t.filePath),f=await Mt(e,r,t.filePath),x={...u||{},...f||{},...o,params:r,$route:{path:t.pattern,params:r}},w=new Set,g=[],v=[],R={...c,minifyClient:!0,...n.partialsDir?{partialsDir:n.partialsDir}:{},...n.componentsDir?{componentsDir:n.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(D)=>{g.push(`${h.relative(process.cwd(),D.templatePath)}: ${D.message}
8
+ resolved against partialsDir: ${D.partialsDir}`)},onServerScriptError:(D)=>{v.push(`${h.relative(process.cwd(),D.sourcePath)} (${D.kind}): ${D.message}`)}};if(Gt(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let S=await i(e,x,t.filePath,R,w);for(let D of[t.filePath,...w])for(let T of Te(D))w.add(T);if(Object.keys(r).length>0){let D=`<script>if(window.stx)window.stx._rp=${JSON.stringify(r)};else window.__stx_rp=${JSON.stringify(r)};</script>`;if(S.includes("</head>"))S=S.replace("</head>",`${D}
9
9
  </head>`);else S=`${D}
10
- ${S}`}if(S=await ye(S,{router:s.router}),S=await h(S),s.minify!==!1)return{html:Gt(S),dependencies:Array.from(m),includeFailures:b,serverScriptFailures:v};return{html:S,dependencies:Array.from(m),includeFailures:b,serverScriptFailures:v}}function Gt(t){let n=[],a=0,s=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,l;while((l=s.exec(t))!==null){let u=t.slice(a,l.index);n.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let f=l[1],x=l[2],m=l[3];x=x.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),n.push(f+x+m),a=l.index+l[0].length}let e=t.slice(a);return n.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),n.join("").trim()}function Nt(t){let n=0;for(let a=0;a<t.length;a++){let s=t.charCodeAt(a);n=(n<<5)-n+s,n=n&n}return`"${Math.abs(n).toString(36)}"`}function zt(t,n,a,s){if(a?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(n))return!0;return s.some((l)=>{if(l instanceof RegExp)return l.test(t);return l.endsWith("/")?t===l.slice(0,-1)||t.startsWith(l):t===l})}function Ht(t,n){return`<?xml version="1.0" encoding="UTF-8"?>
10
+ ${S}`}if(S=await be(S,{router:n.router}),S=await y(S),n.minify!==!1)return{html:Nt(S),dependencies:Array.from(w),includeFailures:g,serverScriptFailures:v};return{html:S,dependencies:Array.from(w),includeFailures:g,serverScriptFailures:v}}function Nt(t){let r=[],o=0,n=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=n.exec(t))!==null){let u=t.slice(o,c.index);r.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let f=c[1],x=c[2],w=c[3];x=x.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),r.push(f+x+w),o=c.index+c[0].length}let e=t.slice(o);return r.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),r.join("").trim()}function Ht(t){let r=0;for(let o=0;o<t.length;o++){let n=t.charCodeAt(o);r=(r<<5)-r+n,r=r&r}return`"${Math.abs(r).toString(36)}"`}function zt(t,r,o,n){if(o?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(r))return!0;return n.some((c)=>{if(c instanceof RegExp)return c.test(t);return c.endsWith("/")?t===c.slice(0,-1)||t.startsWith(c):t===c})}function Wt(t,r){return`<?xml version="1.0" encoding="UTF-8"?>
11
11
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
12
- ${t.map((s)=>{let l=new URL(s.loc,n).href,e=` <url>
13
- <loc>${j(l)}</loc>`;if(s.lastmod)e+=`
14
- <lastmod>${s.lastmod}</lastmod>`;if(s.changefreq)e+=`
15
- <changefreq>${s.changefreq}</changefreq>`;if(s.priority!==void 0)e+=`
16
- <priority>${s.priority}</priority>`;return e+=`
12
+ ${t.map((n)=>{let c=new URL(n.loc,r).href,e=` <url>
13
+ <loc>${F(c)}</loc>`;if(n.lastmod)e+=`
14
+ <lastmod>${n.lastmod}</lastmod>`;if(n.changefreq)e+=`
15
+ <changefreq>${n.changefreq}</changefreq>`;if(n.priority!==void 0)e+=`
16
+ <priority>${n.priority}</priority>`;return e+=`
17
17
  </url>`,e}).join(`
18
18
  `)}
19
- </urlset>`}function j(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Wt(t,n){let a=n.map((s)=>{let l=" <item>";if(l+=`
20
- <title>${j(s.title)}</title>`,l+=`
21
- <link>${j(s.link)}</link>`,s.description)l+=`
22
- <description>${j(s.description)}</description>`;if(s.pubDate)l+=`
23
- <pubDate>${s.pubDate.toUTCString()}</pubDate>`;if(s.author)l+=`
24
- <author>${j(s.author)}</author>`;if(s.categories)for(let e of s.categories)l+=`
25
- <category>${j(e)}</category>`;if(s.guid)l+=`
26
- <guid>${j(s.guid)}</guid>`;return l+=`
27
- </item>`,l});return`<?xml version="1.0" encoding="UTF-8"?>
19
+ </urlset>`}function F(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function qt(t,r){let o=r.map((n)=>{let c=" <item>";if(c+=`
20
+ <title>${F(n.title)}</title>`,c+=`
21
+ <link>${F(n.link)}</link>`,n.description)c+=`
22
+ <description>${F(n.description)}</description>`;if(n.pubDate)c+=`
23
+ <pubDate>${n.pubDate.toUTCString()}</pubDate>`;if(n.author)c+=`
24
+ <author>${F(n.author)}</author>`;if(n.categories)for(let e of n.categories)c+=`
25
+ <category>${F(e)}</category>`;if(n.guid)c+=`
26
+ <guid>${F(n.guid)}</guid>`;return c+=`
27
+ </item>`,c});return`<?xml version="1.0" encoding="UTF-8"?>
28
28
  <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
29
29
  <channel>
30
- <title>${j(t.title)}</title>
31
- <link>${j(t.link)}</link>
32
- <description>${j(t.description)}</description>
30
+ <title>${F(t.title)}</title>
31
+ <link>${F(t.link)}</link>
32
+ <description>${F(t.description)}</description>
33
33
  ${t.language?`<language>${t.language}</language>`:""}
34
- ${t.copyright?`<copyright>${j(t.copyright)}</copyright>`:""}
34
+ ${t.copyright?`<copyright>${F(t.copyright)}</copyright>`:""}
35
35
  <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
36
36
  <atom:link href="${t.link}/rss.xml" rel="self" type="application/rss+xml"/>
37
- ${a.join(`
37
+ ${o.join(`
38
38
  `)}
39
39
  </channel>
40
- </rss>`}async function qt(t={}){let n=Date.now();Yt();let a=await i(process.cwd()),s=a.build||{},l=await lt({explicit:t.domain||s.domain,stxConfig:a});if(l.source==="fallback"&&(t.sitemap??s.sitemap??!0))console.warn(ut());let e={router:t.router??a?.router??{},pagesDir:t.pagesDir||s.pagesDir||"pages",outputDir:t.outputDir||s.outputDir||"dist",baseUrl:t.baseUrl||s.baseUrl||"/",domain:l.url,revalidate:t.revalidate??s.revalidate??!1,sitemap:t.sitemap??s.sitemap??!0,sitemapExclude:t.sitemapExclude||s.sitemapExclude||[],robots:t.robots??s.robots??!0,rss:t.rss??s.rss??!1,concurrency:t.concurrency||s.concurrency||10,cache:t.cache??s.cache??!0,cacheDir:t.cacheDir||s.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??s.minify??!0,generate404:t.generate404??s.generate404??!0,publicDir:t.publicDir||s.publicDir||"public",trailingSlash:t.trailingSlash??s.trailingSlash??!1,cleanOutput:t.cleanOutput??s.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||a?.partialsDir||"",componentsDir:t.componentsDir||a?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},f=new Set,x=0,m={},b={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&k.existsSync(e.outputDir))await k.promises.rm(e.outputDir,{recursive:!0});await k.promises.mkdir(e.outputDir,{recursive:!0});let R=e.cacheSalt;if(!R){let{resolveUserCssConfig:d,fingerprintConfig:w}=await import("./chunk-g7mbb5kc.js");try{R=w(await d(process.cwd()))}catch{}}let{prepareImageDelivery:S}=await import("./chunk-khhx6m7x.js"),D=await S(e.publicDir,e.outputDir);if(D.count>0)console.log(`Optimized ${D.count} image(s) for responsive delivery`),R=[R,D.fingerprint].filter(Boolean).join(":");let F=new pt(e.cacheDir,R);if(e.cache)await F.load();try{let{generateCss:d}=await import("./chunk-g7mbb5kc.js");await d('<div class="bg-black"></div>')}catch{}wt();let mt=a?.routeMiddleware?.dir||"middleware";await St(process.cwd(),mt);let J=xt();if(J.length>0)console.log(`Loaded ${J.length} middleware: ${J.join(", ")}`);let yt=a?.routeMiddleware?.global||[];Da(a?.layoutsDir,c(process.cwd()));let Y=q(".",{pagesDir:e.pagesDir,pagesDirs:a?._layerPageDirs});console.log(`Found ${Y.length} routes`);let U=[];for(let d of Y)try{let w=await At(d);for(let P of w)U.push({route:d,url:P.url,params:P.params,props:P.props,revalidate:P.revalidate??e.revalidate})}catch(w){let P=w instanceof Error?w:Error(String(w));u.failedCount++,u.errors.push({route:d.pattern,error:P}),await e.hooks.onError?.(P,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,P)}u.totalPages=U.length+u.failedCount,console.log(`Generating ${U.length} pages...`);let M=[],Z=[];for(let d=0;d<U.length;d+=e.concurrency)Z.push(U.slice(d,d+e.concurrency));for(let d of Z)await Promise.all(d.map(async(w)=>{let{route:P,url:g,params:_,props:bt,revalidate:et}=w;try{await e.hooks.onPageStart?.(g);let T=await Bun.file(P.filePath).text(),O=Qt(T),vt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],rt=[...yt,...vt];if(rt.length>0){let I=kt(g,_,O||{}),A=_t(I,null,void 0,{isServer:!0}),B=await Ct(rt,A);if(B.redirect){let E=typeof B.redirect==="string"?B.redirect:B.redirect.path||B.redirect,N=te(String(E),g),L=ee(g,e);await k.promises.mkdir(p.dirname(L),{recursive:!0}),await Bun.write(L,N),u.successCount++,u.pages.push({route:g,outputPath:L,size:Buffer.byteLength(N),cached:!1}),M.push({loc:g,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${g} \u2192 redirect to ${E}`);return}if(B.abort){let E=typeof B.abort==="string"?B.abort:B.abort?.error?.message||"aborted";console.warn(` \u21B3 ${g} \u2014 middleware aborted: ${E}`);return}}let nt=T.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(nt)try{if(!await Function("route",`
41
- const validate = ${nt[1]};
40
+ </rss>`}async function Vt(t={}){let r=Date.now();Zt();let o=await a(process.cwd()),n=o.build||{},c=await ut({explicit:t.domain||n.domain,stxConfig:o});if(c.source==="fallback"&&(t.sitemap??n.sitemap??!0))console.warn(dt());let e={router:t.router??o?.router??{},pagesDir:t.pagesDir||n.pagesDir||"pages",outputDir:t.outputDir||n.outputDir||"dist",baseUrl:t.baseUrl||n.baseUrl||"/",domain:c.url,revalidate:t.revalidate??n.revalidate??!1,sitemap:t.sitemap??n.sitemap??!0,sitemapExclude:t.sitemapExclude||n.sitemapExclude||[],robots:t.robots??n.robots??!0,rss:t.rss??n.rss??!1,concurrency:t.concurrency||n.concurrency||10,cache:t.cache??n.cache??!0,cacheDir:t.cacheDir||n.cacheDir||l(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??n.minify??!0,generate404:t.generate404??n.generate404??!0,publicDir:t.publicDir||n.publicDir||"public",trailingSlash:t.trailingSlash??n.trailingSlash??!1,cleanOutput:t.cleanOutput??n.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||o?.partialsDir||"",componentsDir:t.componentsDir||o?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},f=new Set,x=0,w={},g={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&k.existsSync(e.outputDir))await k.promises.rm(e.outputDir,{recursive:!0});await k.promises.mkdir(e.outputDir,{recursive:!0});let R=e.cacheSalt;if(!R){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-pank9g6n.js");try{R=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:S}=await import("./chunk-jztsks2y.js"),D=await S(e.publicDir,e.outputDir);if(D.count>0)console.log(`Optimized ${D.count} image(s) for responsive delivery`),R=[R,D.fingerprint].filter(Boolean).join(":");let T=new pt(e.cacheDir,R);if(e.cache)await T.load();try{let{generateCss:d}=await import("./chunk-pank9g6n.js");await d('<div class="bg-black"></div>')}catch{}xt();let wt=o?.routeMiddleware?.dir||"middleware";await kt(process.cwd(),wt);let V=St();if(V.length>0)console.log(`Loaded ${V.length} middleware: ${V.join(", ")}`);let yt=o?.routeMiddleware?.global||[];La(o?.layoutsDir,l(process.cwd()));let Z=G(".",{pagesDir:e.pagesDir,pagesDirs:o?._layerPageDirs});console.log(`Found ${Z.length} routes`);let M=[];for(let d of Z)try{let m=await Lt(d);for(let P of m)M.push({route:d,url:P.url,params:P.params,props:P.props,revalidate:P.revalidate??e.revalidate})}catch(m){let P=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:P}),await e.hooks.onError?.(P,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,P)}u.totalPages=M.length+u.failedCount,console.log(`Generating ${M.length} pages...`);let _=[],Q=[];for(let d=0;d<M.length;d+=e.concurrency)Q.push(M.slice(d,d+e.concurrency));for(let d of Q)await Promise.all(d.map(async(m)=>{let{route:P,url:p,params:N,props:bt,revalidate:rt}=m;try{await e.hooks.onPageStart?.(p);let A=await Bun.file(P.filePath).text(),O=te(A),vt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],nt=[...yt,...vt];if(nt.length>0){let B=_t(p,N,O||{}),L=Ct(B,null,void 0,{isServer:!0}),j=await Et(nt,L);if(j.redirect){let E=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,z=ee(String(E),p),U=re(p,e);await k.promises.mkdir(h.dirname(U),{recursive:!0}),await Bun.write(U,z),u.successCount++,u.pages.push({route:p,outputPath:U,size:Buffer.byteLength(z),cached:!1}),_.push({loc:p,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${p} \u2192 redirect to ${E}`);return}if(j.abort){let E=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${p} \u2014 middleware aborted: ${E}`);return}}let it=A.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(it)try{if(!await Function("route",`
41
+ const validate = ${it[1]};
42
42
  return validate(route);
43
- `)({params:_})){console.warn(`Validation failed for ${g}, skipping...`);return}}catch{}let C=null,it=!1;if(e.cache){if(C=F.get(g,P.filePath),C)it=!0,u.cachedCount++}if(!C){let I=await ft(P,_,bt,e,a);if(C=I.html,e.failOnIncludeError&&I.includeFailures.length>0)throw Error(`${I.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
44
- ${I.includeFailures.join(`
43
+ `)({params:N})){console.warn(`Validation failed for ${p}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=T.get(p,P.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await ft(P,N,bt,e,o);if(I=B.html,e.failOnIncludeError&&B.includeFailures.length>0)throw Error(`${B.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
44
+ ${B.includeFailures.join(`
45
45
  `)}
46
- Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&I.serverScriptFailures.length>0)throw Error(`${I.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
47
- ${I.serverScriptFailures.join(`
46
+ Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&B.serverScriptFailures.length>0)throw Error(`${B.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
47
+ ${B.serverScriptFailures.join(`
48
48
  `)}
49
- Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)F.set(g,P.filePath,I.dependencies,C)}let G;if(e.trailingSlash)G=p.join(e.outputDir,g,"index.html");else G=g==="/"?p.join(e.outputDir,"index.html"):p.join(e.outputDir,`${g}.html`);if(e.chunkIslands){let{html:I,chunks:A}=at(C,{integrity:e.integrityIslands,minify:e.minify});if(A.length>0){let B=p.join(e.outputDir,"_stx","islands");await k.promises.mkdir(B,{recursive:!0});for(let E of A){let N=p.join(B,`${E.hash}.js`);if(!await Bun.file(N).exists())await Bun.write(N,E.code);if(!f.has(E.hash)){f.add(E.hash);let L=Buffer.byteLength(E.code,"utf8");x+=L,m[E.hash]={bytes:L,file:`/_stx/islands/${E.hash}.js`}}}if(b[g]=A.map((E)=>E.hash),C=I,e.prefetchIslands)C=ot(C)}}if(await k.promises.mkdir(p.dirname(G),{recursive:!0}),await Bun.write(G,C),!zt(g,C,O,e.sitemapExclude))M.push({loc:g,lastmod:new Date().toISOString().split("T")[0],priority:g==="/"?1:0.8});let st={route:g,outputPath:G,size:Buffer.byteLength(C,"utf8"),cached:it};if(et!==!1)st.revalidateAt=Date.now()+et*1000;u.pages.push(st),u.successCount++,await e.hooks.onPageEnd?.(g,C)}catch(T){u.failedCount++,u.errors.push({route:g,error:T}),await e.hooks.onError?.(T,g),console.error(`Error generating ${g}:`,T)}}));let Q=Jt();if(Q.length>0){let d=Q.map((w)=>`${w.filePath}: ${w.message}`).join(`
49
+ Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)T.set(p,P.filePath,B.dependencies,I)}let H;if(e.trailingSlash)H=h.join(e.outputDir,p,"index.html");else H=p==="/"?h.join(e.outputDir,"index.html"):h.join(e.outputDir,`${p}.html`);if(e.chunkIslands){let{html:B,chunks:L}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(L.length>0){let j=h.join(e.outputDir,"_stx","islands");await k.promises.mkdir(j,{recursive:!0});for(let E of L){let z=h.join(j,`${E.hash}.js`);if(!await Bun.file(z).exists())await Bun.write(z,E.code);if(!f.has(E.hash)){f.add(E.hash);let U=Buffer.byteLength(E.code,"utf8");x+=U,w[E.hash]={bytes:U,file:`/_stx/islands/${E.hash}.js`}}}if(g[p]=L.map((E)=>E.hash),I=B,e.prefetchIslands)I=ct(I)}}if(await k.promises.mkdir(h.dirname(H),{recursive:!0}),await Bun.write(H,I),!zt(p,I,O,e.sitemapExclude))_.push({loc:p,lastmod:new Date().toISOString().split("T")[0],priority:p==="/"?1:0.8});let at={route:p,outputPath:H,size:Buffer.byteLength(I,"utf8"),cached:st};if(rt!==!1)at.revalidateAt=Date.now()+rt*1000;u.pages.push(at),u.successCount++,await e.hooks.onPageEnd?.(p,I)}catch(A){u.failedCount++,u.errors.push({route:p,error:A}),await e.hooks.onError?.(A,p),console.error(`Error generating ${p}:`,A)}}));let tt=Yt();if(tt.length>0){let d=tt.map((m)=>`${m.filePath}: ${m.message}`).join(`
50
50
  `);throw Error(`Client script bundling failed:
51
- ${d}`)}if(e.cache)await F.save();if(e.generate404){let d=p.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let w=new Set,P={...a,minifyClient:!0,debug:!1,cache:!1},g=await o(await Bun.file(d).text(),{},d,P,w);await Bun.write(p.join(e.outputDir,"404.html"),g)}else await Bun.write(p.join(e.outputDir,"404.html"),`<!DOCTYPE html>
51
+ ${d}`)}if(e.cache)await T.save();if(e.generate404){let d=h.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let m=new Set,P={...o,minifyClient:!0,debug:!1,cache:!1},p=await i(await Bun.file(d).text(),{},d,P,m);await Bun.write(h.join(e.outputDir,"404.html"),p)}else await Bun.write(h.join(e.outputDir,"404.html"),`<!DOCTYPE html>
52
52
  <html lang="en">
53
53
  <head>
54
54
  <meta charset="UTF-8">
@@ -69,7 +69,7 @@ ${d}`)}if(e.cache)await F.save();if(e.generate404){let d=p.join(e.pagesDir,"404.
69
69
  <a href="/">Go home</a>
70
70
  </div>
71
71
  </body>
72
- </html>`)}for(let d of[500]){let w=p.join(e.pagesDir,`${d}.stx`);if(await Bun.file(w).exists()){let P=new Set,g={...a,minifyClient:!0,debug:!1,cache:!1},_=await o(await Bun.file(w).text(),{},w,g,P);await Bun.write(p.join(e.outputDir,`${d}.html`),_)}}let V=p.join(e.pagesDir,"error.stx");if(await Bun.file(V).exists()){let d=new Set,w={...a,minifyClient:!0,debug:!1,cache:!1},P=await o(await Bun.file(V).text(),{},V,w,d);await Bun.write(p.join(e.outputDir,"error.html"),P)}if(e.sitemap&&M.length>0){let d=Ht(M,e.domain),w=p.join(e.outputDir,"sitemap.xml");await Bun.write(w,d),u.sitemapPath=w,console.log(`Generated sitemap.xml with ${M.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},w=[...e.sitemapExclude.filter((g)=>typeof g==="string"),...d.disallow||[]],P=us({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...w.length>0?{disallow:w}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(p.join(e.outputDir,"robots.txt"),P),console.log("Generated robots.txt")}if(e.rss){let d=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},w=[];if(d.getItems)w=await d.getItems();let P=Wt(d,w),g=p.join(e.outputDir,"rss.xml");await Bun.write(g,P),u.rssPath=g,console.log(`Generated rss.xml with ${w.length} items`)}let z=Oa(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let H=Na(e.outputDir);if(H.assets>0)console.log(`Externalized ${H.assets} repeated asset(s) from ${H.pages} page(s) (${(H.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&k.existsSync(e.publicDir))await X(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let tt=qn();if(tt)await X(tt,p.join(e.outputDir,Wn)),console.log(`Copied assets from ${Kt}`)}catch(R){throw await e.hooks.onError?.(R),R}if(u.buildTime=Date.now()-n,f.size>0){u.islandChunks={count:f.size,totalBytes:x};let R={generatedChunks:f.size,totalBytes:x,chunks:m,pages:b};await Bun.write(p.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(R,null,2))}await e.hooks.onBuildEnd?.(u);let v=u.islandChunks?`
72
+ </html>`)}for(let d of[500]){let m=h.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let P=new Set,p={...o,minifyClient:!0,debug:!1,cache:!1},N=await i(await Bun.file(m).text(),{},m,p,P);await Bun.write(h.join(e.outputDir,`${d}.html`),N)}}let K=h.join(e.pagesDir,"error.stx");if(await Bun.file(K).exists()){let d=new Set,m={...o,minifyClient:!0,debug:!1,cache:!1},P=await i(await Bun.file(K).text(),{},K,m,d);await Bun.write(h.join(e.outputDir,"error.html"),P)}if(e.sitemap&&_.length>0){let d=Wt(_,e.domain),m=h.join(e.outputDir,"sitemap.xml");await Bun.write(m,d),u.sitemapPath=m,console.log(`Generated sitemap.xml with ${_.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((p)=>typeof p==="string"),...d.disallow||[]],P=gs({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...m.length>0?{disallow:m}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(h.join(e.outputDir,"robots.txt"),P),console.log("Generated robots.txt")}if(e.rss){let d=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(d.getItems)m=await d.getItems();let P=qt(d,m),p=h.join(e.outputDir,"rss.xml");await Bun.write(p,P),u.rssPath=p,console.log(`Generated rss.xml with ${m.length} items`)}let W=Da(e.outputDir);if(W.assets>0)console.log(`Externalized ${W.assets} asset(s) from ${W.pages} page(s) (${(W.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let q=Ma(e.outputDir);if(q.assets>0)console.log(`Externalized ${q.assets} repeated asset(s) from ${q.pages} page(s) (${(q.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&k.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=Xn();if(et)await Y(et,h.join(e.outputDir,Kn)),console.log(`Copied assets from ${Xt}`)}catch(R){throw await e.hooks.onError?.(R),R}if(u.buildTime=Date.now()-r,f.size>0){u.islandChunks={count:f.size,totalBytes:x};let R={generatedChunks:f.size,totalBytes:x,chunks:w,pages:g};await Bun.write(h.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(R,null,2))}await e.hooks.onBuildEnd?.(u);let v=u.islandChunks?`
73
73
  Island chunks: ${u.islandChunks.count} (${(u.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
74
74
  Build complete!
75
75
  Total: ${u.totalPages} pages
@@ -77,8 +77,8 @@ Build complete!
77
77
  Cached: ${u.cachedCount}
78
78
  Failed: ${u.failedCount}
79
79
  Time: ${u.buildTime}ms${v}
80
- `),u}async function X(t,n){await k.promises.mkdir(n,{recursive:!0});let a=await k.promises.readdir(t,{withFileTypes:!0});for(let s of a){let l=p.join(t,s.name),e=p.join(n,s.name);if(s.isDirectory())await k.promises.mkdir(e,{recursive:!0}),await X(l,e);else await k.promises.copyFile(l,e)}}function Vt(t={}){let n=t.cacheDir||c(process.cwd(),"ssg-cache"),a=new ht(n),s=t.revalidate||3600;return{async get(l){let e=await a.get(l);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(l).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${s}, stale-while-revalidate=${s*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(l){let u=q(".",{pagesDir:t.pagesDir||"pages"}).find((v)=>l.match(v.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${l}`);return}let f=l.match(u.regex),x={};if(f)u.params.forEach((v,R)=>{x[v]=f[R+1]});let m=await i(),{html:b}=await ft(u,x,{},t,m);await a.set(l,{html:b,generatedAt:Date.now(),revalidateAfter:Date.now()+s*1000,etag:Nt(b)}),console.log(`Revalidated: ${l}`)},async invalidate(l){if(typeof l==="string")await a.invalidate(l);else await a.invalidatePattern(l)}}}function Zt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let n=await Bun.file(t).text(),a=n.match(/^---\n([\s\S]*?)\n---/),s={},l=n;if(a){let m=a[1];l=n.slice(a[0].length).trim();for(let b of m.split(`
81
- `)){let v=b.indexOf(":");if(v>0){let R=b.slice(0,v).trim(),S=b.slice(v+1).trim();if(S==="true")S=!0;else if(S==="false")S=!1;else if(/^\d+$/.test(S))S=parseInt(S,10);else if(/^\d+\.\d+$/.test(S))S=parseFloat(S);else if(S.startsWith("[")&&S.endsWith("]"))S=S.slice(1,-1).split(",").map((D)=>D.trim().replace(/^['"]|['"]$/g,""));s[R]=S}}}let e=l.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),u=[],f=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,x;while((x=f.exec(e))!==null){let m=parseInt(x[1],10),b=x[2],v=b.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:v,text:b,level:m})}return{content:e,data:s,toc:u}}}}function Qt(t){return gt(t)}function te(t,n){return`<!DOCTYPE html>
80
+ `),u}async function Y(t,r){await k.promises.mkdir(r,{recursive:!0});let o=await k.promises.readdir(t,{withFileTypes:!0});for(let n of o){let c=h.join(t,n.name),e=h.join(r,n.name);if(n.isDirectory())await k.promises.mkdir(e,{recursive:!0}),await Y(c,e);else await k.promises.copyFile(c,e)}}function Kt(t={}){let r=t.cacheDir||l(process.cwd(),"ssg-cache"),o=new ht(r),n=t.revalidate||3600;return{async get(c){let e=await o.get(c);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(c).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${n}, stale-while-revalidate=${n*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(c){let u=G(".",{pagesDir:t.pagesDir||"pages"}).find((v)=>c.match(v.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${c}`);return}let f=c.match(u.regex),x={};if(f)u.params.forEach((v,R)=>{x[v]=f[R+1]});let w=await a(),{html:g}=await ft(u,x,{},t,w);await o.set(c,{html:g,generatedAt:Date.now(),revalidateAfter:Date.now()+n*1000,etag:Ht(g)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await o.invalidate(c);else await o.invalidatePattern(c)}}}function Qt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let r=await Bun.file(t).text(),o=r.match(/^---\n([\s\S]*?)\n---/),n={},c=r;if(o){let w=o[1];c=r.slice(o[0].length).trim();for(let g of w.split(`
81
+ `)){let v=g.indexOf(":");if(v>0){let R=g.slice(0,v).trim(),S=g.slice(v+1).trim();if(S==="true")S=!0;else if(S==="false")S=!1;else if(/^\d+$/.test(S))S=parseInt(S,10);else if(/^\d+\.\d+$/.test(S))S=parseFloat(S);else if(S.startsWith("[")&&S.endsWith("]"))S=S.slice(1,-1).split(",").map((D)=>D.trim().replace(/^['"]|['"]$/g,""));n[R]=S}}}let e=c.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),u=[],f=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,x;while((x=f.exec(e))!==null){let w=parseInt(x[1],10),g=x[2],v=g.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:v,text:g,level:w})}return{content:e,data:n,toc:u}}}}function te(t){return mt(t)}function ee(t,r){return`<!DOCTYPE html>
82
82
  <html>
83
83
  <head>
84
84
  <meta charset="utf-8">
@@ -90,4 +90,4 @@ Build complete!
90
90
  <p>Redirecting to <a href="${t}">${t}</a>...</p>
91
91
  <script>window.location.replace('${t}')</script>
92
92
  </body>
93
- </html>`}function ee(t,n){if(t==="/"||t==="")return p.join(n.outputDir,"index.html");let a=t.replace(/^\/|\/$/g,"");if(n.trailingSlash)return p.join(n.outputDir,a,"index.html");return p.join(n.outputDir,`${a}.html`)}var je={generateStaticSite:qt,createISRHandler:Vt,defineStaticPaths:W,createMarkdownLoader:Zt};export{Vt as createISRHandler,Zt as createMarkdownLoader,Mt as declaresPageAction,je as default,W as defineStaticPaths,qt as generateStaticSite,zt as isExcludedFromSitemap};
93
+ </html>`}function re(t,r){if(t==="/"||t==="")return h.join(r.outputDir,"index.html");let o=t.replace(/^\/|\/$/g,"");if(r.trailingSlash)return h.join(r.outputDir,o,"index.html");return h.join(r.outputDir,`${o}.html`)}var Fe={generateStaticSite:Vt,createISRHandler:Kt,defineStaticPaths:J,createMarkdownLoader:Qt};export{Kt as createISRHandler,Qt as createMarkdownLoader,Gt as declaresPageAction,Fe as default,J as defineStaticPaths,Vt as generateStaticSite,zt as isExcludedFromSitemap};
@@ -7,6 +7,7 @@ import { stripDocumentWrapper } from "./app-shell.js";
7
7
  import { createHash } from "node:crypto";
8
8
  import { collectBlockDeclarations } from "./stx-virtual-ts.js";
9
9
  import { extractPageResponseStatus } from "./page-response.js";
10
+ import { pageHeadFragment } from "./page-head.js";
10
11
  function createRecordingContext(baseContext = {}) {
11
12
  const accessedKeys = new Set;
12
13
  return { context: new Proxy(baseContext, {
@@ -50,7 +51,7 @@ export async function compileTemplate(filePath, route, options = {}) {
50
51
  ...options,
51
52
  buildMode: "compile",
52
53
  strict: !1
53
- }, html = await processDirectives(content, context, absolutePath, opts, dependencies), fragment = stripDocumentWrapper(html), placeholders = getPlaceholderRegistry();
54
+ }, html = await processDirectives(content, context, absolutePath, opts, dependencies), fragment = pageHeadFragment(html) + stripDocumentWrapper(html), placeholders = getPlaceholderRegistry();
54
55
  return {
55
56
  route,
56
57
  sourceFile: filePath,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.705",
4
+ "version": "0.2.707",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -128,12 +128,12 @@
128
128
  "dependencies": {
129
129
  "@stacksjs/ts-css": "^0.3.11",
130
130
  "@stacksjs/clapp": "^0.2.16",
131
- "@stacksjs/desktop": "0.2.705",
132
- "@stacksjs/sanitizer": "0.2.705",
131
+ "@stacksjs/desktop": "0.2.707",
132
+ "@stacksjs/sanitizer": "0.2.707",
133
133
  "@stacksjs/ts-i18n": "^0.1.11",
134
- "bun-plugin-stx": "0.2.705",
134
+ "bun-plugin-stx": "0.2.707",
135
135
  "bunfig": "^0.15.21",
136
- "stx-router": "0.2.705",
136
+ "stx-router": "0.2.707",
137
137
  "ts-broadcasting": "^0.0.11",
138
138
  "ts-images": "^0.2.22",
139
139
  "ts-syntax-highlighter": "^0.2.1"
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{xl,Bg,Sl,kl,Fg,zg}from"./chunk-w7j88qkc.js";import"./chunk-hrc3wj8r.js";import"./chunk-k59yexav.js";import"./chunk-3392k9vm.js";import"./chunk-xc03cdet.js";import"./chunk-k7pmzreg.js";import"./chunk-2nqt1m3m.js";export{zg as applySlots,Fg as extractSlotContent,Bg as parseSlotElement,xl as parseSlots,kl as processSlots,Sl as renderSlot};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ia,aa,ca,la,Um}from"./chunk-gxd737m5.js";import"./chunk-2gzrx4ma.js";import"./chunk-fhhx61qk.js";import"./chunk-9ra3ne11.js";import"./chunk-gj95952w.js";import"./chunk-9g0hyvhv.js";import"./chunk-bsr9wnq4.js";import"./chunk-tqavwhja.js";import"./chunk-v4x3ckcr.js";import"./chunk-twcb0wp6.js";import"./chunk-cbdyns7r.js";import"./chunk-t5qsaq1q.js";import"./chunk-rkk14e9h.js";import"./chunk-vfjenjez.js";import"./chunk-d499mwtq.js";import"./chunk-rpfzk6yg.js";import"./chunk-5gkxpcex.js";import"./chunk-2p34qf9c.js";import"./chunk-fgr56q3w.js";import"./chunk-p78v88ng.js";import"./chunk-m4j9gedb.js";import"./chunk-hrc3wj8r.js";import"./chunk-k59yexav.js";import"./chunk-3392k9vm.js";import"./chunk-xc03cdet.js";import"./chunk-k7pmzreg.js";import"./chunk-2nqt1m3m.js";export{ia as buildNative,Um as default,aa as findCraftBinary,la as getAvailableFormats,ca as getAvailableTargets};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{it,at,ct}from"./chunk-tp4eqfxq.js";export{it as createContext,at as updateContextStoryFiles,ct as updateContextTree};
@@ -1,4 +0,0 @@
1
- // @bun
2
- import{Ze}from"./chunk-m4j9gedb.js";import{ft,Mn}from"./chunk-z9csfarm.js";import{Oe,dn,Ic,Oc}from"./chunk-hrc3wj8r.js";import{wr,xr,Sr,_r,Se}from"./chunk-xc03cdet.js";import{A}from"./chunk-3392k9vm.js";import{ri}from"./chunk-k59yexav.js";import{h}from"./chunk-9g0hyvhv.js";import{o}from"./chunk-gj95952w.js";import{N,i}from"./chunk-rpfzk6yg.js";import{rc}from"./chunk-fgr56q3w.js";import{Ve,_e,qi,Gi,En}from"./chunk-tg5m9xn3.js";import{tn,fo}from"./chunk-d635e7b5.js";import{Tn}from"./chunk-7kn0d1f1.js";import{Kt,Wn,qn}from"./chunk-z0x54ynx.js";import{q}from"./chunk-rkk14e9h.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function W(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function J(n=!1){let l=n?Mn():ft(),a=W(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function U(){let n=Ze(),l=W(n);return{content:n,filename:`router.${l}.js`,hash:l}}import V from"path";import{createHash as ee}from"crypto";function te(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 X(n,l,a={}){let r=V.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Ic();let _={};try{_=await i(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,f;while((f=d.exec(e))!==null){let R=f[1];if(/\bserver\b/.test(R))y.push(f[2])}let u=new Set(y.flatMap((R)=>Oe(R))),{context:D}=te({__filename:r,__dirname:V.dirname(r),__stx_serverDeclared:u}),w=new Set,j={...N,..._,...a,buildMode:"compile",strict:!1},b=await o(e,D,r,j,w),C=Ve(b),P=Oc();return{route:l,sourceFile:n,html:b,fragment:C,placeholders:P,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:dn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let a=0,r=0;if(!m.existsSync(n))return{copied:a,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let f=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(f,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(f,u),a++,r+=m.statSync(u).size}}}return e(n,l),{copied:a,bytes:r}}async function Cg(n={}){let l=Date.now(),a=c.resolve(n.root||process.cwd()),r=c.resolve(a,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await i(a),S=c.resolve(a,n.componentsDir??e.componentsDir??"components"),_=c.resolve(a,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",f=Se(e.app?.head,{known:_r,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",w=n.routeRules??e.routeRules??{},j=Tn(w),b=n.serverApi??e.serverApi,C=typeof b==="object"?b:{};if(b)tn(a,C);if(e.runtimeConfig)A(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=q(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((g)=>s.pattern.startsWith(`/${g}/`)||s.pattern===`/${g}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=J(n.debug),x=U();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],k=[];for(let s of B){let g=j(s.pattern),O=g.rendering==="prerender";if(O&&(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 X(s.filePath,s.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Sr(t.html,f,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=wr(t.html,u);if(f.htmlAttrs)t.html=xr(t.html,f.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 I=p[1];t.html=t.html.replace(" "+I,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${I}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await h(t.html),O){let p=await En(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=_e(t.html,D);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),k.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(g).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let E=c.resolve(a,d);if(m.existsSync(E)){let{copied:s,bytes:g}=Z(E,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${d}/`)}let H=qn(a);if(H){let{copied:s,bytes:g}=Z(H,c.join(r,"public",Wn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${Kt}/`)}let F={runtime:v.filename,router:x.filename},T=qi(k,F,r);if(T.routeRules=w,T.routerContainer=D,b)T.apiRoutes=await fo(a,r,C);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await ri(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(rc(e._layerGraph),null,2));Gi(T,r);let K=Date.now()-l;return console.log(`
3
- [stx build] Done in ${K}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:F,outputDir:r,duration:K}}
4
- export{Cg};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Yp,Zp,Ee,Qp,Ma,Jt,Yt,qm,La,Zt,Gn,ef,tf,nf,uo,Qt,rf,en,sf}from"./chunk-tmzp0ght.js";import"./chunk-d635e7b5.js";import"./chunk-n2ema4wf.js";import"./chunk-rpfzk6yg.js";import"./chunk-5gkxpcex.js";import"./chunk-2p34qf9c.js";import"./chunk-fgr56q3w.js";import"./chunk-p78v88ng.js";import"./chunk-m4j9gedb.js";import"./chunk-hrc3wj8r.js";import"./chunk-k59yexav.js";import"./chunk-3392k9vm.js";import"./chunk-xc03cdet.js";import"./chunk-k7pmzreg.js";import"./chunk-2nqt1m3m.js";export{Gn as MODULE_SPECIFIER_PREFIX,Yp as bundleCacheDir,Zp as bundleCacheEntryLimit,en as bundleClientScript,Yt as clearBundleFailures,Ee as clientBundleDependencies,Jt as getBundleFailures,Zt as hasUserImports,Qt as moduleSubstitutionKey,tf as normalizeRegistrySpecifiers,rf as queueClientBundleBuild,Ma as recordBundleFailure,ef as registryIdForPath,La as resolveBundlerFallback,nf as rewriteRegistryImports,qm as setBundlerFallbackMode,Qp as shouldLogBundlerDiagnostics,sf as tempBuildName,uo as withModuleSubstitutes};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Zi,Qi,Cl,El,Tl,$l,Hg}from"./chunk-d597d0dp.js";export{Zi as createVirtualList,Hg as default,Cl as generateVirtualListCSS,Tl as processInfiniteListDirectives,$l as processVirtualGridDirectives,Qi as processVirtualListDirectives,El as useVirtualList};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Gl,oo,zn,Kl,Xl,Jl,Yl,Zl,Ql,eu,tu,nu,ru,su,ou,iu,au,cu,lu,uu,du,pu,fu,gu,mu,hu,yu,bu,vu,wu,xu,Su,ku,_u,Cu,Eu,Tu,$u,Ru,Au,Pu,Iu,Ou,Nu,Du,Mu,Lu,ju,Gt,pa,Bu,Fu,zu,fa,Hu,Vu,Uu,Wu,qu,Gu,ga,Ku,Xu,Ju,Yu,Zu,Qu,ed,td,nd,Hn,rd,sd,od,id,ad,cd,ld,ud,dd,pd,fd,gd,io,md,hd,yd,bd,vd,Hr,wd,xd,Sd,kd,_d,ma,Cd,Ed,Td,ha,ao,$d,Rd,ya,ba,va,wa,Ad,Vr,Pd,xa,Sa,Id,Od,co,Nd,Dd,Md,Ld,jd,Bd,Fd,ka,zd,Hd,_a,Vd,Ud,Wd,qd,Gd,Kd,Xd,Jd,Yd,Zd,Qd,ep,tp,np,rp,sp,op,ip,ap,cp,lp,up,dp,pp,Ca,fp,gp,mp,hp,yp,bp,vp,wp,xp,Sp,kp,Vn,Ea,Ta,_p,Un,Cp,Ep,Tp,$a,Ra,Ur,Wr,$p,lo,Rp,Ap,Pp,Ip,Op,Np,Dp,Mp,Lp,jp,Bp,Fp,zp,Hp,Vp,Up,Wp,qp,Gp,Kp,Aa,Xp,Jp}from"./chunk-2gzrx4ma.js";export{Lu as AVAILABLE_COMPONENTS,ma as AutoUpdater,ju as COMPONENT_STYLES,Ur as DEFAULT_WATCH_INTERVAL_MS,Ra as MAX_WATCH_INTERVAL_MS,$a as MIN_WATCH_INTERVAL_MS,Gu as MODAL_STYLES,nu as TOAST_STYLES,ed as TRAY_MENU_STYLES,ya as UPDATE_MANIFEST_ASSET,Vu as alert,lp as appInfo,Np as appleScript,Op as audio,Jp as backgroundDelay,op as battery,Ip as biometric,Sp as bluetooth,Bp as bonjour,Vr as bundlePathForExecutable,Od as caffeinate,Cd as canReplaceBundle,Ed as clearQuarantine,Jd as clipboard,qu as closeAllModals,gd as closeAllWindows,Hu as confirm,pp as contextMenu,Wp as continuityCamera,Up as coreml,kd as craftBinaryNotFoundMessage,io as craftWindowArguments,Vn as crashReporter,Cu as createAccordion,bu as createAutocomplete,lu as createAvatar,cu as createBadge,ru as createButton,uu as createCard,Iu as createChart,ou as createCheckbox,xu as createChip,Ou as createCodeEditor,mu as createColorPicker,Pu as createDataGrid,hu as createDatePicker,pu as createDropdown,Du as createFileExplorer,Ad as createGitHubUpdateManifest,wa as createGitHubUpdater,wu as createImageView,qd as createInterval,vu as createLabel,$u as createListView,Nu as createMediaPlayer,Ku as createMenubar,Tu as createModalComponent,jd as createPreferences,au as createProgressBar,gu as createRadioButton,fu as createRating,ku as createScrollView,Id as createSelfUpdater,iu as createSlider,_u as createSplitView,Eu as createStepper,ga as createSystemTray,Ru as createTable,du as createTabs,su as createTextInput,yu as createTimePicker,Wd as createTimer,Su as createTooltip,Au as createTreeView,Mu as createWebView,md as createWindow,yd as createWindowWithHTML,co as decaffeinate,sp as deepLinks,Gd as delay,Ql as dismissAlertById,eu as dismissAllAlerts,np as dragOut,Td as extractBundle,Dp as fileAssociations,lo as focus,Ap as focusShortcutsReady,Xd as formatCompact,Ld as formatDuration,Md as formatRemainingTime,zd as formatShortcut,Kd as formatTime,Zd as fs,ha as generateUpdateManifest,tu as getActiveAlertCount,Wu as getActiveModalCount,Xu as getActiveTrayInstances,pd as getActiveWindowIds,Dd as getCaffeinateStatus,Kp as getCapabilities,Aa as getCapability,ud as getDesktopConfig,cd as getDialogBridgeScript,Ud as getRegisteredHotkeys,Zu as getSimulatedTrayHTML,Qu as getTrayBridgeScript,Ju as getTrayInstance,fd as getWindow,vd as getWindowBridgeScript,ba as githubLatestAssetUrl,va as githubReleaseAssetUrl,ep as globalShortcuts,Un as handoff,Rp as hasFocusShortcuts,_p as iap,Fd as isAutoLaunchEnabled,Xp as isAvailable,Nd as isCaffeinated,rp as isDragOutAvailable,bd as isWebviewAvailable,mp as keychain,Cp as liveActivities,Pp as localServer,Ep as location,jp as log,wd as macOSRuntimeExecutablePath,dp as menu,Vp as midi,bp as nativeAutoLaunch,vp as nativeTray,wp as nativeWindow,ip as network,Yd as notifications,Zl as notify,hd as openDevWindow,xd as pack,Sd as packageApp,ka as parseShortcut,Lp as pdf,hp as permissions,yp as printing,Uu as prompt,xa as quitLauncher,ao as readBundleIdentity,Ea as redactPII,Hd as registerHotkey,Sa as relaunchBundle,Gl as requestNotificationPermission,dd as resetDesktopConfig,_d as resolveCraftBinary,Hr as resolveCraftExecutablePath,Pd as runningBundleTeamId,gp as screen,Tp as screenCapture,Wr as screenSharing,Gp as serial,qp as serviceMenu,Bd as setAutoLaunch,ld as setDesktopConfig,Qd as shell,oo as showAlert,sd as showAlertDialog,rd as showColorPicker,od as showConfirmDialog,id as showErrorDialog,Fu as showErrorModal,Yl as showErrorToast,pa as showInfoModal,Kl as showInfoToast,Hn as showMessageBox,Gt as showModal,td as showOpenDialog,fa as showQuestionModal,nd as showSaveDialog,zu as showSuccessModal,Xl as showSuccessToast,zn as showToast,ad as showWarningDialog,Bu as showWarningModal,Jl as showWarningToast,Ca as sidebar,Ta as signPayload,kp as speech,zp as speechRecognition,Fp as spotlight,up as standardMenus,$d as swapBundle,fp as system,Mp as tags,tp as theme,xp as touchbar,Yu as triggerTrayAction,Vd as unregisterAllHotkeys,_a as unregisterHotkey,ap as updater,Rd as verifyBundleTrust,Hp as vision,$p as watchScreenSharing,cp as windowEvents};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{g,Jo,Ec,Tc,jf,Bf,Ff,zf,Hf,$s,Vf,Me,J,Le,Uf,yr,Wf,Ac,ei,je,n,mn,Pc,m,pe,bh}from"./chunk-hrc3wj8r.js";import"./chunk-k59yexav.js";import"./chunk-3392k9vm.js";import"./chunk-xc03cdet.js";import"./chunk-k7pmzreg.js";import"./chunk-2nqt1m3m.js";export{pe as clearComponentCache,ei as componentClientSignalNames,Jo as convertToCommonJS,m as createDetailedErrorMessage,Hf as extractDirectiveNames,Ec as extractScriptFromTemplate,g as extractVariables,n as fileExists,bh as getComponentCacheStats,Bf as getPositionInfo,J as getSharedTranspiler,Pc as getSourceLineInfo,zf as hasDirectives,Tc as hasVariables,Wf as isHydrateTrigger,Vf as isJavaScriptScript,je as renderComponentWithSlot,mn as resolveTemplatePath,Uf as scopeOnRootElement,$s as scopeSequenceKey,Me as shouldTranspileTypeScript,Ac as slotContentHasExpressions,Le as transpileTypeScript,yr as userComponentFileExists,Ff as validateDirective,jf as validateTemplate};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ft,Mn,Im}from"./chunk-z9csfarm.js";import{ce,Ln,Om,jn,to,Br,Fr,Nm,Dm,Mm,Bn,Fn,no,zr,Lm}from"./chunk-gp9k0t3g.js";import"./chunk-2nqt1m3m.js";export{to as batch,Im as default,Ln as derived,jn as effect,ft as generateSignalsRuntime,Mn as generateSignalsRuntimeDev,Fn as isDerived,Bn as isSignal,Om as memo,Fr as onDestroy,Br as onMount,zr as peek,Mm as pendingLifecycleCounts,Dm as runDestroyCallbacks,Nm as runMountCallbacks,ce as state,no as untrack,Lm as useOptimistic};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Eg,Tg,$g,Rg,vl,Ag,Pg,Ig,Og,Ng,Dg,Mg}from"./chunk-k296qq0p.js";export{Dg as Broadcast,Mg as BroadcastServer,vl as broadcast,Og as broadcastPresence,Ig as broadcastPrivate,Ng as channel,Eg as getBroadcastServer,Rg as loadChannels,Tg as startBroadcasting,$g as stopBroadcasting,Ag as toUser,Pg as toUsers};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{T,Sn}from"./chunk-k7pmzreg.js";export{Sn as stripModuleImports,T as transformStoreImports};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{hg}from"./chunk-xj5e6nbn.js";import"./chunk-gj95952w.js";import"./chunk-9g0hyvhv.js";import"./chunk-bsr9wnq4.js";import"./chunk-tqavwhja.js";import"./chunk-v4x3ckcr.js";import"./chunk-twcb0wp6.js";import"./chunk-cbdyns7r.js";import"./chunk-t5qsaq1q.js";import"./chunk-rkk14e9h.js";import"./chunk-vfjenjez.js";import"./chunk-d499mwtq.js";import"./chunk-rpfzk6yg.js";import"./chunk-5gkxpcex.js";import"./chunk-2p34qf9c.js";import"./chunk-fgr56q3w.js";import"./chunk-p78v88ng.js";import"./chunk-m4j9gedb.js";import"./chunk-hrc3wj8r.js";import"./chunk-k59yexav.js";import"./chunk-3392k9vm.js";import"./chunk-xc03cdet.js";import"./chunk-k7pmzreg.js";import"./chunk-2nqt1m3m.js";export{hg as startInteractive};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Be,bn,As,si,A,Nt}from"./chunk-3392k9vm.js";export{bn as currentRuntimeConfig,Nt as injectRuntimeConfig,A as resolveRuntimeConfig,si as useRuntimeConfig,As as useServerRuntimeConfig,Be as withRuntimeConfig};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{xm,Sm,km,_m,Cm,Em,Tm}from"./chunk-4sesw88b.js";export{Sm as createKeepAliveCache,_m as generateKeepAliveCSS,Cm as generateKeepAliveRuntime,Em as onActivated,Tm as onDeactivated,xm as processKeepAliveDirectives,km as shouldCacheComponent};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{bl,_g}from"./chunk-8w4y3dx3.js";export{bl as captureScreenshot,_g as captureScreenshots};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{om,im,am,cm,lm,um}from"./chunk-e3yhx053.js";export{cm as generateTransitionCSS,lm as generateTransitionRuntime,om as performEnter,im as performLeave,um as processTransitionAttributes,am as processTransitionDirectives};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ol,il}from"./chunk-n5wgst66.js";import"./chunk-xj5e6nbn.js";import"./chunk-bymqr1bt.js";import"./chunk-w7e28p74.js";import"./chunk-bfhks7zf.js";import"./chunk-xvz9b1ht.js";import"./chunk-8w4y3dx3.js";import"./chunk-2fg2es95.js";import"./chunk-tg5m9xn3.js";import"./chunk-k296qq0p.js";import"./chunk-b2j7s1a2.js";import"./chunk-w71189qh.js";import"./chunk-1kr1mpft.js";import"./chunk-w7j88qkc.js";import"./chunk-983zpa57.js";import"./chunk-d597d0dp.js";import"./chunk-sxf17xfc.js";import"./chunk-613reww3.js";import"./chunk-416jy1m5.js";import"./chunk-4afwn4yj.js";import"./chunk-2v7t87n8.js";import"./chunk-zggdhtmn.js";import"./chunk-e3yhx053.js";import"./chunk-njhd845r.js";import"./chunk-t27fecet.js";import"./chunk-4sesw88b.js";import"./chunk-jkpcrf4z.js";import"./chunk-qdw0y8gw.js";import"./chunk-z9csfarm.js";import"./chunk-fhhx61qk.js";import"./chunk-9ra3ne11.js";import"./chunk-b3sw5ykg.js";import{Xt}from"./chunk-j76w5rnm.js";import"./chunk-tmzp0ght.js";import"./chunk-d635e7b5.js";import"./chunk-n2ema4wf.js";import{$e,o}from"./chunk-gj95952w.js";import"./chunk-9g0hyvhv.js";import"./chunk-bsr9wnq4.js";import"./chunk-tqavwhja.js";import"./chunk-v4x3ckcr.js";import"./chunk-twcb0wp6.js";import"./chunk-cbdyns7r.js";import"./chunk-t5qsaq1q.js";import{ye}from"./chunk-rkk14e9h.js";import"./chunk-vfjenjez.js";import{rr,sr}from"./chunk-d499mwtq.js";import{os,N,i}from"./chunk-rpfzk6yg.js";import"./chunk-5gkxpcex.js";import"./chunk-2p34qf9c.js";import"./chunk-fgr56q3w.js";import"./chunk-p78v88ng.js";import"./chunk-m4j9gedb.js";import{g,De}from"./chunk-hrc3wj8r.js";import"./chunk-k59yexav.js";import"./chunk-3392k9vm.js";import"./chunk-xc03cdet.js";import"./chunk-k7pmzreg.js";import"./chunk-2nqt1m3m.js";import"./chunk-3ys3sa08.js";import"./chunk-7smgebdq.js";export{os as buildWebComponents,sr as cacheTemplate,rr as checkCache,Xt as classifyAllScripts,ol as createMiddleware,il as createRoute,N as defaultConfig,g as extractVariables,ye as injectRouterScript,i as loadStxConfig,De as processClientScript,o as processDirectives,$e as readMarkdownFile};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Bs,Bt,nl,rg}from"./chunk-ywzh979k.js";export{Bs as generateServiceWorker,rg as generateServiceWorkerAuto,Bt as getServiceWorkerFileName,nl as isWorkboxEnabled};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import i from"path";var on=".stx",o="STX_DIR",e=null;function cc(t){e=t?.trim()||null}function lr(){return process.env[o]?.trim()||e||on}function c(t=process.cwd(),...n){let r=lr();return i.isAbsolute(r)?i.join(r,...n):i.join(t,r,...n)}function ur(t){if(!t||i.isAbsolute(t))return t;let n=t.replace(/\\/g,"/");if(n!==on&&!n.startsWith(`${on}/`))return t;let r=n.slice(on.length+1);return r?i.join(lr(),r):lr()}
3
- export{on,cc,lr,c,ur};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{Ue,ne,Ia}from"./chunk-9ra3ne11.js";import v from"fs";import g from"path";import V from"crypto";import{generatePlaceholder as T,processImage as L}from"ts-images";var Z=[320,640,768,1024,1280,1536,1920],Q=["webp","jpeg"],ee=80,D=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],U={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},I=null,M=!1;async function d(){if(M)return I;M=!0;try{let t=await import("sharp");return I=t.default||t,I}catch{return null}}async function $n(){return await d()!==null}async function ge(){return!0}async function Ce(t,e={}){let{widths:a=Z,formats:r=Q,quality:n=ee,fit:c="cover",placeholder:i="none",outputDir:m=".stx/images",baseUrl:s="/images"}=e,h,l;if(typeof t==="string"){if(l=t,!await Bun.file(t).exists())throw new jr(`Image not found: ${t}`,"NOT_FOUND");h=await Bun.file(t).arrayBuffer().then((o)=>Buffer.from(o))}else l="buffer-input",h=t;let b=V.createHash("sha256").update(h).digest("hex").slice(0,12),j=await Lr(h),{width:u,height:x}=j,F=u/x;await v.promises.mkdir(m,{recursive:!0});let B=[],A=g.basename(l,g.extname(l)),f=a.filter((o)=>o<=u);if(!f.includes(u)&&u<=Math.max(...a))f.push(u);f.sort((o,p)=>o-p);for(let o of f){let p=Math.round(o/F);for(let w of r){let S=`${A}-${o}w-${b}.${w}`,P=g.join(m,S),q=`${s}/${S}`,E=await _l(h,{width:o,height:p,format:w,quality:n,fit:c});await Bun.write(P,E),B.push({path:P,url:q,width:o,height:p,format:w,size:E.length})}}let y;if(i!=="none")y=await k(h,i);return{src:l,variants:B,placeholder:y,width:u,height:x,aspectRatio:F,hash:b}}async function Lr(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await d();if(a){let n=await a(e).metadata();return{width:n.width||0,height:n.height||0,format:n.format||"unknown",hasAlpha:n.hasAlpha}}return R(e)}function R(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let n=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:n,format:"jpeg",hasAlpha:!1}}let r=t.readUInt16BE(e+2);e+=2+r}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,r=t.readUInt16LE(28)&16383;return{width:a,height:r,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),r=(a&16383)+1,n=(a>>14&16383)+1;return{width:r,height:n,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new jr("Unable to parse image dimensions","PARSE_ERROR")}async function _l(t,e){let a=await d();if(a){let r=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":r=r.webp({quality:e.quality});break;case"avif":r=r.avif({quality:e.quality});break;case"jpeg":r=r.jpeg({quality:e.quality});break;case"png":r=r.png({quality:e.quality});break}return r.toBuffer()}return await Ia("img",async(r)=>{let n=g.join(r,`out.${e.format}`);return await L({input:t,output:n,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(n).arrayBuffer())})}async function k(t,e){let a=await d();if(e==="blur"&&a){let m=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),s=await Lr(t);return`data:${U[s.format]||"image/jpeg"};base64,${m}`}if(e==="dominant-color"&&a){let{dominant:i}=await a(t).resize(1,1).toBuffer().then(async(m)=>{let s=await a(m).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${i.r}, ${i.g}, ${i.b})`}let r=await Lr(t),n=Ue("ph"),c=g.join(n,`in.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(c,t);let i=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",s=await T(c,{strategy:i,width:i==="thumbhash"?void 0:32});if(e==="dominant-color"&&s.dominantColor)return s.dominantColor;if(s.dataURL)return s.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{ne(n)}}function dt(t,e){return(e?t.filter((r)=>r.format===e):t).sort((r,n)=>r.width-n.width).map((r)=>`${r.url} ${r.width}w`).join(", ")}function Wt(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,r)=>{let n=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(r[0].replace(/\D/g,""))||0)-n}).map(([a,r])=>`(max-width: ${a}) ${r}`).join(", ")+", 100vw"}function Rn(t){let e=t.filter((r)=>r.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((r,n)=>r.width-n.width);return a[Math.floor(a.length/2)]}function An(t){let e=new Map;for(let a of t){let r=e.get(a.format)||[];r.push(a),e.set(a.format,r)}return e}function Pn(t){let e=g.extname(t).toLowerCase();return D.includes(e)}function te(t){return U[t]||"application/octet-stream"}function In(t){return t.reduce((e,a)=>e+a.size,0)}function On(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class jr extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
3
- export{Z,Q,ee,$n,ge,Ce,Lr,_l,dt,Wt,Rn,An,Pn,te,In,On,jr};
@@ -1,4 +0,0 @@
1
- // @bun
2
- import a from"fs";function pt(r){return o(r)}var g=1000,i=new Map;function Dn(){i.clear()}function o(r){return[...r].sort().map((n)=>{try{let t=a.statSync(n);return`${n}:${t.size}:${t.mtimeMs}`}catch{return`${n}:missing`}}).join(`
3
- `)}function qt(r,n,t){let e=r.get(n);return e!==void 0&&e.signature===t?e.value:void 0}function ae(r,n,t,e){return r.set(n,{signature:t,value:e}),e}
4
- export{pt,Dn,qt,ae};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Lg}from"./chunk-w71189qh.js";import"./chunk-rpfzk6yg.js";import"./chunk-5gkxpcex.js";import"./chunk-2p34qf9c.js";import"./chunk-fgr56q3w.js";import"./chunk-p78v88ng.js";import"./chunk-m4j9gedb.js";import"./chunk-hrc3wj8r.js";import"./chunk-k59yexav.js";import"./chunk-3392k9vm.js";import"./chunk-xc03cdet.js";import"./chunk-k7pmzreg.js";import"./chunk-2nqt1m3m.js";export{Lg as buildApp};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{hi,yi,bi,cg,lg,ug,rl,dg,pg}from"./chunk-3ys3sa08.js";export{hi as ImageProcessorCache,rl as applyTransformations,cg as clearImageCache,dg as generateResponsiveVariants,pg as generateSrcset,yi as getCachedImageResult,ug as optimizeImage,lg as processImage,bi as setCachedImageResult};
@@ -1,3 +0,0 @@
1
- // @bun
2
- var f=import.meta.require;
3
- export{f};
@@ -1,43 +0,0 @@
1
- // @bun
2
- import{Z,Q,ee,$n,ge,Ce,dt,Wt,Rn,An,Pn,te,In,On}from"./chunk-983zpa57.js";import{bt}from"./chunk-3hxd5td3.js";function al(s,r={}){let{src:e,alt:t,width:n,height:a,sizes:i="100vw",loading:m="lazy",priority:o=!1,quality:u=ee,placeholder:l="none",formats:f=Q,widths:y=Z,decoding:c="async",fetchpriority:h,objectFit:d,objectPosition:g}=s,{class:p,style:v}=s,{processedImage:w,variants:I,optimize:b=!0,isDev:A=!1}=r;if(I&&I.length>0)return K(s,I,w);if(A||!b)return G(s);return X(s)}function K(s,r,e){let{src:t,alt:n,width:a,height:i,sizes:m="100vw",loading:o="lazy",priority:u=!1,decoding:l="async",fetchpriority:f,objectFit:y,objectPosition:c,placeholder:h="none"}=s,{class:d,style:g}=s,p=An(r),v=Rn(r),w=typeof m==="object"?Wt(m):m,I=e?e.aspectRatio:a&&i?Number(a)/Number(i):void 0,b=[];if(I)b.push(`aspect-ratio: ${I}`);if(y)b.push(`object-fit: ${y}`);if(c)b.push(`object-position: ${c}`);if(g)b.push(g);let A=b.length>0?` style="${b.join("; ")}"`:"",S=d?` class="${d}"`:"",F=u?"":` loading="${o}"`,R=` decoding="${l}"`,C=f?` fetchpriority="${f}"`:u?' fetchpriority="high"':"",E=["avif","webp","jpeg","png"],M=[];for(let k of E){let z=p.get(k);if(z&&z.length>0){let O=dt(z),J=te(k);M.push(` <source type="${J}" srcset="${O}" sizes="${w}" />`)}}let U="",L="",T;if(h!=="none"&&e?.placeholder){let k=`img-${Math.random().toString(36).slice(2,8)}`;if(U=`<div class="stx-image-wrapper" id="${k}">`,L="</div>",h==="blur")T=`
3
- #${k} {
4
- position: relative;
5
- background-image: url('${e.placeholder}');
6
- background-size: cover;
7
- background-position: center;
8
- }
9
- #${k} img {
10
- transition: opacity 0.3s ease;
11
- }
12
- #${k}.loaded img {
13
- opacity: 1;
14
- }
15
- `.trim();else if(h==="color")T=`
16
- #${k} {
17
- background-color: ${e.placeholder};
18
- }
19
- `.trim()}let _=a?` width="${a}"`:e?` width="${e.width}"`:"",H=i?` height="${i}"`:e?` height="${e.height}"`:"",Y=`${U}<picture>
20
- ${M.join(`
21
- `)}
22
- <img
23
- src="${v?.url||t}"
24
- alt="${B(n)}"${_}${H}${S}${A}${F}${R}${C}
25
- />
26
- </picture>${L}`,V;if(u&&v){let k=p.get("webp"),z=k?.[Math.floor(k.length/2)]||v,O=te(z.format);V=`<link rel="preload" as="image" href="${z.url}" type="${O}" />`}return{html:Y,preloadLink:V,placeholderCss:T}}function G(s){let{src:r,alt:e,width:t,height:n,loading:a="lazy",decoding:i="async",priority:m=!1,fetchpriority:o,objectFit:u,objectPosition:l}=s,{class:f,style:y}=s,c=[];if(u)c.push(`object-fit: ${u}`);if(l)c.push(`object-position: ${l}`);if(y)c.push(y);let h=c.length>0?` style="${c.join("; ")}"`:"",d=f?` class="${f}"`:"",g=t?` width="${t}"`:"",p=n?` height="${n}"`:"",v=m?"":` loading="${a}"`,w=` decoding="${i}"`,I=o?` fetchpriority="${o}"`:m?' fetchpriority="high"':"";return{html:`<img src="${r}" alt="${B(e)}"${g}${p}${d}${h}${v}${w}${I} />`}}function X(s){let{src:r,alt:e,width:t,height:n,sizes:a="100vw",loading:i="lazy",priority:m=!1,quality:o=ee,formats:u=Q,widths:l=Z,decoding:f="async",fetchpriority:y,objectFit:c,objectPosition:h}=s,{class:d,style:g}=s,p=[];if(c)p.push(`object-fit: ${c}`);if(h)p.push(`object-position: ${h}`);if(g)p.push(g);let v=p.length>0?` style="${p.join("; ")}"`:"",w=d?` class="${d}"`:"",I=t?` width="${t}"`:"",b=n?` height="${n}"`:"",A=m?"":` loading="${i}"`,S=` decoding="${f}"`,F=y?` fetchpriority="${y}"`:m?' fetchpriority="high"':"",R=typeof a==="object"?Wt(a):a,C=`
27
- data-stx-image
28
- data-src="${r}"
29
- data-sizes="${R}"
30
- data-quality="${o}"
31
- data-formats="${u.join(",")}"
32
- data-widths="${l.join(",")}"
33
- `.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${B(e)}"${I}${b}${w}${v}${A}${S}${F} ${C} />`}}function Bi(s){let r=s.match(/<Image\s+([^>]*?)\/?>/);if(!r)return null;let e=r[1],t={},n=/(\w+)(?:=(?:"([^"]*)"|'([^']*)'|(\{[^}]+\})))?/g,a;while((a=n.exec(e))!==null){let[,i,m,o,u]=a,l=m??o??u??!0;switch(i){case"src":t.src=String(l);break;case"alt":t.alt=String(l);break;case"width":t.width=Number(l)||l;break;case"height":t.height=Number(l)||l;break;case"sizes":t.sizes=String(l);break;case"loading":t.loading=l;break;case"priority":t.priority=l===!0||l==="true";break;case"quality":t.quality=Number(l);break;case"placeholder":t.placeholder=l;break;case"class":t.class=String(l);break;case"style":t.style=String(l);break;case"decoding":t.decoding=l;break;case"fetchpriority":t.fetchpriority=l;break;case"objectFit":t.objectFit=l;break;case"objectPosition":t.objectPosition=String(l);break}}if(!t.src||!t.alt)return null;return t}async function cl(s,r){let e=/<Image\s+[^>]*?\/?>/g,t=[],n=[],a=s,i,m=[];while((i=e.exec(s))!==null)m.push({match:i[0],index:i.index});for(let o=m.length-1;o>=0;o--){let{match:u}=m[o],l=Bi(u);if(l){let f=await r(l);if(a=a.replace(u,f.html),f.preloadLink)t.push(f.preloadLink);if(f.placeholderCss)n.push(f.placeholderCss)}}return{html:a,preloadLinks:t,styles:n}}function B(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var D=new Map;function ll(){D.clear()}async function se(s,r){let e=`${s}:${JSON.stringify(r)}`;if(D.has(e))return D.get(e);try{let t=await Ce(s,r);return D.set(e,t),t}catch{return null}}function Fi(){return bt({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async(s,r,e)=>{let{src:t,alt:n,options:a}=re(s,r,e);if(!t)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let i={widths:a.widths||(a.width?[a.width]:Z),formats:a.formats||Q,quality:a.quality||ee,placeholder:(a.placeholder==="color"?"dominant-color":a.placeholder)||"none"};if(!await ge())return q(t,n||"",a);let o=await se(t,i);if(!o)return q(t,n||"",a);return ie(o,n||"",a)}})}function re(s,r,e){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let n=s.trim();if(n.startsWith("@image(")||n.startsWith("("))n=n.replace(/^@image\(/,"").replace(/^\(/,"").replace(/\)$/,"");let a=ae(n),i=a[0]||"",m=a[1]||"",o={};if(i&&!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")){let u=e[i];if(typeof u==="string")i=u}if(a[2])try{if(typeof a[2]==="string")o=JSON.parse(a[2]);else o=a[2]}catch{}return{src:i,alt:m,options:o}}function ae(s){let r=[],e="",t=!1,n="",a=0,i=0;for(let m=0;m<s.length;m++){let o=s[m],u=m>0?s[m-1]:"";if((o==='"'||o==="'")&&u!=="\\"){if(!t)t=!0,n=o;else if(o===n)t=!1,n="";else e+=o;continue}if(!t){if(o==="{")a++;if(o==="}")a--;if(o==="[")i++;if(o==="]")i--;if(o===","&&a===0&&i===0){r.push(e.trim()),e="";continue}}e+=o}if(e.trim())r.push(e.trim());return r}function q(s,r,e){let t=[`src="${x(s)}"`];if(r)t.push(`alt="${x(r)}"`);if(e.width)t.push(`width="${e.width}"`);if(e.height)t.push(`height="${e.height}"`);if(e.class)t.push(`class="${x(e.class)}"`);if(e.style)t.push(`style="${x(e.style)}"`);if(e.lazy!==!1)t.push('loading="lazy"');return t.push('decoding="async"'),`<img ${t.join(" ")} />`}function ie(s,r,e){let{variants:t,placeholder:n,width:a,height:i,aspectRatio:m}=s,o=new Map;for(let g of t){let p=o.get(g.format)||[];p.push(g),o.set(g.format,p)}let u=["avif","webp","jpeg","png"],l=[];for(let g of u){let p=o.get(g);if(p&&p.length>0){let v=dt(p),w=te(g),I=e.sizes||"100vw";l.push(` <source type="${w}" srcset="${x(v)}" sizes="${x(I)}" />`)}}let f=o.get("jpeg")||[],y=f.length>0?f[Math.floor(f.length/2)]:t[Math.floor(t.length/2)],c=[`src="${y?.url||s.src}"`,`alt="${x(r)}"`];if(e.width||a)c.push(`width="${e.width||a}"`);if(e.height||i)c.push(`height="${e.height||i}"`);if(e.class)c.push(`class="${x(e.class)}"`);let h=[];if(m)h.push(`aspect-ratio: ${m.toFixed(4)}`);if(e.style)h.push(e.style);if(h.length>0)c.push(`style="${h.join("; ")}"`);if(e.lazy!==!1&&!e.priority)c.push('loading="lazy"');if(c.push('decoding="async"'),e.priority)c.push('fetchpriority="high"');let d=`<picture>
34
- `;if(d+=l.join(`
35
- `)+`
36
- `,d+=` <img ${c.join(" ")} />
37
- `,d+="</picture>",e.placeholder&&n){let g=`stx-img-${Math.random().toString(36).slice(2,8)}`;if(e.placeholder==="blur"||e.placeholder==="thumbhash"){let p=n.replace(/'/g,"%27").replace(/"/g,"%22");d=`<div id="${g}" class="stx-image-placeholder" style="background-image: url('${p}'); background-size: cover;">
38
- ${d}
39
- </div>`}else if(e.placeholder==="color"){let p=n.replace(/[^a-zA-Z0-9#(),.\s%-]/g,"");d=`<div id="${g}" class="stx-image-placeholder" style="background-color: ${p};">
40
- ${d}
41
- </div>`}}if(e.priority&&y){let g=te(y.format);d=`<link rel="preload" as="image" href="${x(y.url)}" type="${g}" />
42
- `+d}return d}function x(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var ul=Fi();import P from"fs";import j from"path";function dl(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=Q,widths:a=Z,quality:i=ee,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await ge()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await P.promises.mkdir(l,{recursive:!0});if(y){let g=await $n();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=ne(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ce(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await ge())return;await P.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!P.existsSync(w))continue;let I=await N(w);g.push(...I)}let p=f?g.filter((w)=>oe(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=W(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await Ce(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=P.statSync(I).size,S=In(b.variants);if(c.stats.savedBytes+=Math.max(0,A-S/b.variants.length),y)console.log(` \u2713 ${j.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${On(c.stats.savedBytes)}`)}}}function ne(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function oe(s,r){let e=j.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ce(s,r){return s}async function N(s){let r=[];async function e(t){let n=await P.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=j.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&Pn(i))r.push(i)}}return await e(s),r}function W(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function pl(s,r,e={}){if(!await ge())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return Ce(s,{...e,outputDir:r})}async function fl(s,r,e={}){let{formats:t=Q,widths:n=Z,quality:a=ee,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await ge())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await P.promises.mkdir(r,{recursive:!0});let l=await N(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=W(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await Ce(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${j.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function zi(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function gl(s,r){let e=zi(s);await Bun.write(r,JSON.stringify(e,null,2))}var wg={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
43
- export{al,Bi,cl,ll,Fi,ul,dl,pl,fl,zi,gl,wg};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{l,p,Mc,u,t,a}from"./chunk-xc03cdet.js";import{Xe,yt,sn,Ro}from"./chunk-vfjenjez.js";function L(w,e){try{let f=w.trim();if(p(f))return u(f,Object.keys(e))(...Object.values(e));else return l(f,e)}catch{return!1}}function Q(w,e,f){let n=w,v=!0;while(v){v=!1;let h=n.match(/@switch\s*\(/);if(!h||h.index===void 0)break;let b=h.index,s=Ro(n,b);if(!s)break;try{let o;if(p(s.expression))o=u(s.expression,Object.keys(e))(...Object.values(e));else o=l(s.expression,e);let r="",g=!1;for(let i of s.cases)if(i.type==="default"){if(!g)r=i.content.trim()}else try{let y;if(i.value&&p(i.value))y=u(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=l(i.value,e);if(o===y){r=i.content.trim(),g=!0;break}}catch{continue}n=n.substring(0,b)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),g=a("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,b)+g+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(f,n)=>e[Number(n)]??f)}function re(w,e,f){let{masked:n,scripts:v}=H(w);return J(K(n,e,f),v)}function K(w,e,f){let n=w;n=Q(n,e,f);{let h=!0;while(h){h=!1;let b=n.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=Xe(n,s+7);if(!o)break;let r=o.endPos,g=yt(n,"unless","endunless",r);if(g===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,g),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,d=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=d.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){m=P.pos;break}}let c;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);c=`@if (${y})${k}@else ${x}@endif`}else c=`@if (!(${y}))${i}@endif`;n=n.substring(0,s)+c+n.substring(g+10),h=!0}}n=ko(n,e,f),n=_o(n,e,f),n=So(n,e);let v=()=>{let h=sn(n);if(h.length===0)return!1;let b=Array(h.length);for(let r=h.length-1;r>=0;r--){let g=h[r];try{let i="",y=!1;for(let m of g.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?Mc(m.condition,e):!1)i=m.content,y=!0}catch(c){i=a(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${c instanceof Error?c.message:String(c)}`,t.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=a("If",`Error processing @if block: ${y}`,t.EVALUATION_ERROR)}}let s=Array(h.length*2+1),o=0;for(let r=0;r<h.length;r++){let g=h[r];s[r*2]=n.slice(o,g.start),s[r*2+1]=b[r],o=g.end}return s[h.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let h=n;if(!v())break;if(n===h)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let f=w[e];if(f!=="'"&&f!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===f){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function So(w,e){let f=w;function n(s,o,r,g){let i=1,y=g,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),c=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,c.lastIndex=y;let x=m.exec(s),k=c.exec(s),d=x?x.index:1/0,E=k?k.index:1/0;if(d<E)i++,y=d+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let g=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,c=[],x;while((x=i.exec(s))!==null)c.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)c.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)c.push({pos:x.index,type:"else"});c.sort((k,d)=>k.pos-d.pos);for(let k of c)if(k.type==="open")g++;else if(k.type==="close")g--;else if(k.type==="else"&&g===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=f.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,g,i,y=f.slice(r+5),m=q(y);if(m)g=m.value,i=r+5+m.consumed;else i=r+5;let c=n(f,"auth","endauth",i);if(c===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=f.slice(i,c),k=v(x,"auth","endauth"),d;if(!e.auth)d=!1;else d=g?L(`auth?.check && auth?.user?.[${g}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=d?S:C}else E=d?x:"";f=f.substring(0,r)+E+f.substring(c+8),s=!0}}{let s=!0;while(s){s=!1;let o=f.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,g,i,y=f.slice(r+6),m=q(y);if(m)g=m.value,i=r+6+m.consumed;else i=r+6;let c=n(f,"guest","endguest",i);if(c===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=f.slice(i,c),k=v(x,"guest","endguest"),d;if(!e.auth)d=!0;else d=g?L(`!auth?.check || !auth?.user?.[${g}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=d?S:C}else E=d?x:"";f=f.substring(0,r)+E+f.substring(c+9),s=!0}}function h(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let g=[s];if(o)g.push(o);if(r){let i=L(r,e);g.push(i)}return e.permissions.check(...g)}catch{return!1}return!1}function b(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",g=!0;while(g){g=!1;let i=f.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=f.slice(y+`@${s}`.length),c=b(m);if(!c)break;let x=y+`@${s}`.length+c.paramsEnd,k=n(f,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let d=f.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(d))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(d))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(d))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(d))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:d.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=d.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:d.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:d.length;I.push({content:d.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<d.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:d.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:d.slice(F)})}let O=h(c.ability,c.type,c.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=h(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}f=f.substring(0,y)+V+f.substring(k+`@${o}`.length),g=!0}}return f}function ko(w,e,f){let n=w;function v(h,b,s,o,r){let g=!0;while(g){g=!1;let i=new RegExp(`@${b}\\s*\\(`),y=h.match(i);if(!y||y.index===void 0)break;let m=y.index,c=Xe(h,m+`@${b}`.length);if(!c)break;let x=c.endPos,k=yt(h,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let d=h.slice(x,k),E=c.expression,S=-1,C=0,P=0;while(P<d.length){let R=d.indexOf("@",P);if(R===-1)break;let T=d.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=d.slice(0,S),M=d.slice(S+5);T=R?_:M}else T=R?d:"";h=h.substring(0,m)+T+h.substring(k+`@${s}`.length),g=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=a(r,`Error processing @${b} directive: ${T}`,t.EVALUATION_ERROR);h=h.substring(0,m)+_+h.substring(k+`@${s}`.length);break}}return h}return n=v(n,"isset","endisset",(h)=>{let b=L(h,e);return b!==void 0&&b!==null},"Isset"),n=v(n,"empty","endempty",(h)=>{let b=L(h,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),n}function _o(w,e,f){let n=w,v="development";function h(b,s,o,r){let g=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),c=b,x=!0;while(x){x=!1,g.lastIndex=0;let k=g.exec(c);if(!k)break;let d=k.index,E=d+k[0].length;if(s==="env"){let O=c.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<c.length){g.lastIndex=C,i.lastIndex=C;let O=g.exec(c),j=i.exec(c),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${d} has no matching @${o} \u2014 the block was skipped.`);break}let R=c.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(y.test(j)){_++,M=O+1;continue}if(m.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;c=c.substring(0,d)+I+c.substring(P+F),x=!0}return c}return n=h(n,"env","endenv",!1),n=h(n,"production","endproduction",v==="production"),n=h(n,"development","enddevelopment",v==="development"),n=h(n,"staging","endstaging",v==="staging"),n=h(n,"testing","endtesting",v==="testing"),n}
3
- export{re,So,ko,_o};