@stacksjs/stx 0.2.760 → 0.2.761

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 (241) hide show
  1. package/dist/chunk-00nz3pas.js +2 -0
  2. package/dist/{chunk-3nxe5xmy.js → chunk-0fs9kx0h.js} +3 -3
  3. package/dist/{chunk-42hcspws.js → chunk-0kq0k4pg.js} +2 -2
  4. package/dist/chunk-0nynnmya.js +2 -0
  5. package/dist/{chunk-qw9kgzb3.js → chunk-0q5dm9r2.js} +5 -5
  6. package/dist/{chunk-f4gqzg1y.js → chunk-0wj31pqy.js} +2 -2
  7. package/dist/chunk-13v3vgb6.js +2 -0
  8. package/dist/chunk-18gazs55.js +2 -0
  9. package/dist/chunk-1a9h6r9f.js +2 -0
  10. package/dist/chunk-1p8t2ekg.js +2 -0
  11. package/dist/chunk-1rcntvgx.js +2 -0
  12. package/dist/chunk-1w5gtkd6.js +2 -0
  13. package/dist/{chunk-0y2zzqsq.js → chunk-23t9anc0.js} +76 -76
  14. package/dist/chunk-298gj90a.js +2 -0
  15. package/dist/{chunk-0ggwm837.js → chunk-2cbd1ew6.js} +101 -101
  16. package/dist/{chunk-h692k9xn.js → chunk-2typf9dh.js} +4 -4
  17. package/dist/chunk-2wnfqrv5.js +26 -0
  18. package/dist/chunk-2wq0h5ye.js +2 -0
  19. package/dist/{chunk-prej5pk6.js → chunk-2zd51tj4.js} +2 -2
  20. package/dist/chunk-2zg3jmy7.js +2 -0
  21. package/dist/{chunk-ztdjdxjt.js → chunk-319aez2f.js} +3 -3
  22. package/dist/{chunk-7g9vd5fv.js → chunk-37y8sg48.js} +2 -2
  23. package/dist/{chunk-j2mpqa4p.js → chunk-3csfmhg0.js} +2 -2
  24. package/dist/{chunk-jb1dk0w7.js → chunk-3mz088mb.js} +2 -2
  25. package/dist/chunk-3wxb7mfb.js +2 -0
  26. package/dist/{chunk-cehjp06v.js → chunk-42zqmcnc.js} +3 -3
  27. package/dist/{chunk-y8srg0q3.js → chunk-45g1w1ct.js} +3 -3
  28. package/dist/{chunk-89h4snzd.js → chunk-4833k99b.js} +2 -2
  29. package/dist/{chunk-jevd16gq.js → chunk-48g9wez2.js} +30 -30
  30. package/dist/{chunk-vtv7165t.js → chunk-4c0qcjac.js} +2 -2
  31. package/dist/{chunk-wz5m7ybz.js → chunk-4rxmxc1p.js} +2 -2
  32. package/dist/chunk-4tgn1frg.js +3 -0
  33. package/dist/chunk-5fg8hqq0.js +2 -0
  34. package/dist/chunk-5x0g7e9y.js +2 -0
  35. package/dist/{chunk-83ezv8yz.js → chunk-5yhv5eqq.js} +3 -3
  36. package/dist/{chunk-afj19nsj.js → chunk-61qh74q1.js} +5 -5
  37. package/dist/chunk-64pdwfef.js +177 -0
  38. package/dist/{chunk-94ymndc5.js → chunk-6fz2n9w6.js} +43 -43
  39. package/dist/chunk-72ns4q88.js +2 -0
  40. package/dist/chunk-7fwcnech.js +2 -0
  41. package/dist/{chunk-g4e6egrr.js → chunk-7y1rpd4g.js} +8 -8
  42. package/dist/chunk-7z2mebp5.js +2 -0
  43. package/dist/chunk-803qm5tk.js +2 -0
  44. package/dist/chunk-86cg9qqm.js +2 -0
  45. package/dist/{chunk-gs6wc7sr.js → chunk-89801pjp.js} +5 -5
  46. package/dist/chunk-8h5mqs28.js +2 -0
  47. package/dist/chunk-8jh2b5k2.js +2 -0
  48. package/dist/{chunk-yp6w740k.js → chunk-8rk79ha1.js} +2 -2
  49. package/dist/{chunk-hfbzfrpv.js → chunk-8vs5y4h7.js} +14 -14
  50. package/dist/{chunk-kpr09x3g.js → chunk-8y54tpbr.js} +7 -7
  51. package/dist/{chunk-s4y26fk6.js → chunk-8yyq3nfg.js} +2 -2
  52. package/dist/chunk-927ta2dn.js +2 -0
  53. package/dist/chunk-940wny2b.js +2 -0
  54. package/dist/{chunk-m220n98m.js → chunk-98t1cv8x.js} +2 -2
  55. package/dist/{chunk-sgm6tg8h.js → chunk-9k8ztdcc.js} +2 -2
  56. package/dist/{chunk-n7s4n62j.js → chunk-9nhyq39s.js} +3 -3
  57. package/dist/{chunk-n8s5301s.js → chunk-aa1y9j3p.js} +2 -2
  58. package/dist/chunk-ad9dt9rk.js +2 -0
  59. package/dist/chunk-ak4w2emd.js +2 -0
  60. package/dist/{chunk-tb56j1zt.js → chunk-ak93e1zz.js} +5 -5
  61. package/dist/{chunk-jt28zh50.js → chunk-b0z2n941.js} +2 -2
  62. package/dist/{chunk-xgegyttg.js → chunk-b51p56k5.js} +2 -2
  63. package/dist/{chunk-r4sawwmp.js → chunk-b7x8b83z.js} +1 -1
  64. package/dist/chunk-b8dtz3v8.js +2 -0
  65. package/dist/{chunk-q9npggak.js → chunk-bjhesw78.js} +8 -8
  66. package/dist/{chunk-w8p1y4c0.js → chunk-bvctccab.js} +4 -4
  67. package/dist/chunk-c5tkxjb0.js +2 -0
  68. package/dist/{chunk-hk98vptc.js → chunk-cdcrd33m.js} +2 -2
  69. package/dist/chunk-cgh0k52q.js +2 -0
  70. package/dist/chunk-ctdw7fh4.js +2 -0
  71. package/dist/{chunk-asp7ett1.js → chunk-dnsf934e.js} +9 -9
  72. package/dist/{chunk-7r7j7vwt.js → chunk-ds6mbfdq.js} +3 -3
  73. package/dist/chunk-e2q79dfs.js +2 -0
  74. package/dist/chunk-e5vn76f5.js +2 -0
  75. package/dist/{chunk-9s1qnf90.js → chunk-eb6p3p62.js} +2 -2
  76. package/dist/chunk-emhbj3xd.js +2 -0
  77. package/dist/{chunk-3cn9y08d.js → chunk-evxp3wmv.js} +7 -7
  78. package/dist/{chunk-z8k3fx4r.js → chunk-f8p8ggvw.js} +4 -4
  79. package/dist/chunk-fjfrgef4.js +2 -0
  80. package/dist/chunk-fke4s0kk.js +33 -0
  81. package/dist/{chunk-30j6mbrf.js → chunk-frybxj35.js} +7 -7
  82. package/dist/{chunk-4s9kytdz.js → chunk-fxmc5006.js} +2 -2
  83. package/dist/chunk-fxnk5ee8.js +2 -0
  84. package/dist/chunk-fys1patf.js +2 -0
  85. package/dist/{chunk-6ts3sthp.js → chunk-g4k0svq6.js} +2 -2
  86. package/dist/chunk-g9efdc5v.js +2 -0
  87. package/dist/chunk-gpvfswgj.js +2 -0
  88. package/dist/chunk-hnen9b45.js +2 -0
  89. package/dist/chunk-jacb7aw1.js +2 -0
  90. package/dist/{chunk-4zw118tn.js → chunk-jgk5j35w.js} +4 -4
  91. package/dist/{chunk-7v2srnpv.js → chunk-jn78c13y.js} +10 -10
  92. package/dist/chunk-jq1698j4.js +2 -0
  93. package/dist/{chunk-pwmkhs7z.js → chunk-jyp2mmts.js} +2 -2
  94. package/dist/{chunk-eazvp48w.js → chunk-jzajpmke.js} +7 -7
  95. package/dist/chunk-k0jkpw0q.js +2 -0
  96. package/dist/{chunk-3kfbs0mw.js → chunk-k2ex94n8.js} +1 -1
  97. package/dist/{chunk-m00c7sh0.js → chunk-k9247v28.js} +1 -1
  98. package/dist/chunk-kdqnest3.js +2 -0
  99. package/dist/{chunk-xsf7ax50.js → chunk-kj9m0vc6.js} +3 -3
  100. package/dist/chunk-krsg6dgz.js +3 -0
  101. package/dist/chunk-m5740sd3.js +2 -0
  102. package/dist/{chunk-myynywry.js → chunk-mdvtermb.js} +2 -2
  103. package/dist/chunk-mebf9vwb.js +2 -0
  104. package/dist/chunk-nm2r4se1.js +2 -0
  105. package/dist/chunk-p2j38381.js +2 -0
  106. package/dist/{chunk-5vmbycy5.js → chunk-p88yh4wt.js} +2 -2
  107. package/dist/{chunk-fjxhga6w.js → chunk-pqbxa0r7.js} +2 -2
  108. package/dist/chunk-q245q8z1.js +2 -0
  109. package/dist/{chunk-5q9ss7ty.js → chunk-q3azy64b.js} +4 -4
  110. package/dist/chunk-qm3jbse5.js +2 -0
  111. package/dist/{chunk-rcfmwx8r.js → chunk-qx0np0hy.js} +2 -2
  112. package/dist/{chunk-qwsgc5rc.js → chunk-qystt1qc.js} +1 -1
  113. package/dist/{chunk-ej1jkt9a.js → chunk-qyzjkvme.js} +6 -6
  114. package/dist/chunk-r13fwtas.js +2 -0
  115. package/dist/{chunk-dh9aagwm.js → chunk-r1tp2gnr.js} +1 -1
  116. package/dist/chunk-r5tsewzd.js +2 -0
  117. package/dist/{chunk-vvc39v6p.js → chunk-r6yb0540.js} +5 -5
  118. package/dist/{chunk-pes27snj.js → chunk-r8zhed35.js} +3 -3
  119. package/dist/{chunk-hmydy949.js → chunk-rh2qth8r.js} +5 -5
  120. package/dist/chunk-rha8sv1h.js +3 -0
  121. package/dist/{chunk-vh1d5eqk.js → chunk-t2cq4bpe.js} +6 -6
  122. package/dist/chunk-tfy1m821.js +2 -0
  123. package/dist/{chunk-465resq9.js → chunk-tpfxvw4q.js} +17 -17
  124. package/dist/{chunk-t6qn1374.js → chunk-tshpcvcy.js} +2 -2
  125. package/dist/{chunk-xabs41cv.js → chunk-ttqs99jj.js} +2 -2
  126. package/dist/chunk-v1ff2dfp.js +7 -0
  127. package/dist/chunk-vc3ppphz.js +2 -0
  128. package/dist/{chunk-q49ykyq9.js → chunk-vv8dn70r.js} +14 -14
  129. package/dist/{chunk-3m9vrhja.js → chunk-vvs28yqw.js} +8 -8
  130. package/dist/chunk-w2pch5xn.js +4 -0
  131. package/dist/chunk-w512gnft.js +2 -0
  132. package/dist/{chunk-j4snweyz.js → chunk-wby7qzha.js} +3 -3
  133. package/dist/{chunk-bsgg8zzk.js → chunk-wghtdgwj.js} +2 -2
  134. package/dist/chunk-wk8y89q2.js +25 -0
  135. package/dist/{chunk-19safa6y.js → chunk-wmnzapn8.js} +2 -2
  136. package/dist/chunk-wmxsaxt0.js +2 -0
  137. package/dist/chunk-wq1vs94k.js +2 -0
  138. package/dist/chunk-wwnqbv9j.js +3 -0
  139. package/dist/{chunk-rprewgyj.js → chunk-wycrtkw4.js} +6 -6
  140. package/dist/chunk-x1q7b7jg.js +2 -0
  141. package/dist/chunk-x1x69g3s.js +2 -0
  142. package/dist/{chunk-gs373714.js → chunk-x5seqmrv.js} +2 -2
  143. package/dist/{chunk-frk6rzrq.js → chunk-x7q4tp3f.js} +4 -4
  144. package/dist/{chunk-bsq9zg9j.js → chunk-xt034729.js} +6 -6
  145. package/dist/chunk-y5emxzbt.js +2 -0
  146. package/dist/chunk-y6mqq78g.js +2 -0
  147. package/dist/{chunk-v5afjcy3.js → chunk-yh5658q8.js} +1 -1
  148. package/dist/{chunk-2qz891k4.js → chunk-yhbsvf65.js} +10 -10
  149. package/dist/{chunk-se28p2xy.js → chunk-yjzk7rwt.js} +6 -6
  150. package/dist/chunk-yn3kff5k.js +2 -0
  151. package/dist/chunk-ynjm2tm0.js +2 -0
  152. package/dist/chunk-yp80rx17.js +2 -0
  153. package/dist/chunk-z5xermzg.js +2 -0
  154. package/dist/{chunk-j04v4rgf.js → chunk-zhrz4zvw.js} +5 -5
  155. package/dist/cli.js +20 -20
  156. package/dist/composable-loader.d.ts +1 -1
  157. package/dist/composable-loader.js +47 -10
  158. package/dist/craft-entry.js +2 -2
  159. package/dist/craft.js +2 -2
  160. package/dist/message-catalogs.d.ts +39 -0
  161. package/dist/message-catalogs.js +128 -0
  162. package/dist/native/compiler/bundle.js +3 -33
  163. package/dist/process.d.ts +1 -1
  164. package/dist/process.js +87 -22
  165. package/dist/pwa.js +3 -3
  166. package/dist/ssg.js +14 -14
  167. package/dist/store-loader.d.ts +27 -3
  168. package/dist/store-loader.js +115 -10
  169. package/dist/types/config-types.d.ts +1 -0
  170. package/package.json +5 -5
  171. package/dist/chunk-0b7f2mby.js +0 -2
  172. package/dist/chunk-0j7e56zm.js +0 -2
  173. package/dist/chunk-1khg5vjs.js +0 -2
  174. package/dist/chunk-3h2yz805.js +0 -2
  175. package/dist/chunk-3kmwgpm1.js +0 -2
  176. package/dist/chunk-3wfewscj.js +0 -2
  177. package/dist/chunk-4tz00fkp.js +0 -2
  178. package/dist/chunk-52q8184e.js +0 -2
  179. package/dist/chunk-59ytzyp1.js +0 -2
  180. package/dist/chunk-5e2ez5n0.js +0 -2
  181. package/dist/chunk-6ndeycxk.js +0 -2
  182. package/dist/chunk-75r09rqt.js +0 -2
  183. package/dist/chunk-76679dw7.js +0 -33
  184. package/dist/chunk-7h5d35bf.js +0 -2
  185. package/dist/chunk-7kac7hdw.js +0 -2
  186. package/dist/chunk-7nz28a6c.js +0 -16
  187. package/dist/chunk-82ybmdqk.js +0 -2
  188. package/dist/chunk-8av44gw2.js +0 -2
  189. package/dist/chunk-8frs2dtp.js +0 -2
  190. package/dist/chunk-8prq9t3b.js +0 -2
  191. package/dist/chunk-8sxngenk.js +0 -2
  192. package/dist/chunk-9epeb4sn.js +0 -2
  193. package/dist/chunk-9zmb7dcv.js +0 -2
  194. package/dist/chunk-abs1k04e.js +0 -2
  195. package/dist/chunk-akgt21vw.js +0 -2
  196. package/dist/chunk-b561wv5x.js +0 -2
  197. package/dist/chunk-bfdd0nmc.js +0 -2
  198. package/dist/chunk-c05r0rzw.js +0 -3
  199. package/dist/chunk-c7yjhjr2.js +0 -2
  200. package/dist/chunk-c9xq89nt.js +0 -2
  201. package/dist/chunk-cpep999n.js +0 -2
  202. package/dist/chunk-cr7mn65s.js +0 -2
  203. package/dist/chunk-dqs4bgec.js +0 -2
  204. package/dist/chunk-e30kgg28.js +0 -2
  205. package/dist/chunk-e3fkq9gb.js +0 -2
  206. package/dist/chunk-e9kajy9a.js +0 -2
  207. package/dist/chunk-eab8na0z.js +0 -2
  208. package/dist/chunk-ec5q50ve.js +0 -2
  209. package/dist/chunk-ec8gn2m0.js +0 -2
  210. package/dist/chunk-ex2397dc.js +0 -2
  211. package/dist/chunk-exg7ry7b.js +0 -2
  212. package/dist/chunk-f4j42tsg.js +0 -2
  213. package/dist/chunk-fj105fff.js +0 -2
  214. package/dist/chunk-gk775pcy.js +0 -177
  215. package/dist/chunk-ha6tr22a.js +0 -2
  216. package/dist/chunk-htc7pasb.js +0 -2
  217. package/dist/chunk-jfvr1135.js +0 -2
  218. package/dist/chunk-k3wnmpt3.js +0 -2
  219. package/dist/chunk-kb8654dp.js +0 -4
  220. package/dist/chunk-kfqdx75m.js +0 -2
  221. package/dist/chunk-mmdfjmgk.js +0 -25
  222. package/dist/chunk-mreh1t5x.js +0 -2
  223. package/dist/chunk-n839v6az.js +0 -2
  224. package/dist/chunk-ptzzpf97.js +0 -2
  225. package/dist/chunk-py7g5hxd.js +0 -2
  226. package/dist/chunk-qgsrxyh9.js +0 -2
  227. package/dist/chunk-qmxcs806.js +0 -2
  228. package/dist/chunk-qvcs4f4v.js +0 -2
  229. package/dist/chunk-qz9fzz5k.js +0 -2
  230. package/dist/chunk-rh90yh1c.js +0 -2
  231. package/dist/chunk-s0wst4wj.js +0 -2
  232. package/dist/chunk-sj5t0tnv.js +0 -2
  233. package/dist/chunk-stddpecv.js +0 -2
  234. package/dist/chunk-t4mpq6t0.js +0 -3
  235. package/dist/chunk-tb6jcr2v.js +0 -2
  236. package/dist/chunk-tdjw105v.js +0 -2
  237. package/dist/chunk-tn40nh9e.js +0 -3
  238. package/dist/chunk-tp2g09ca.js +0 -3
  239. package/dist/chunk-wpgq0tq4.js +0 -2
  240. package/dist/chunk-yme43vbp.js +0 -2
  241. package/dist/chunk-zg5xh20b.js +0 -2
package/dist/ssg.js CHANGED
@@ -1,13 +1,13 @@
1
1
  // @bun
2
- import"./chunk-19safa6y.js";import{b,Jc}from"./chunk-465resq9.js";import"./chunk-xgegyttg.js";import"./chunk-89h4snzd.js";import{Tt,S}from"./chunk-0ggwm837.js";import"./chunk-gs373714.js";import"./chunk-bsgg8zzk.js";import"./chunk-yp6w740k.js";import{xt,St,kt,_t,Ct,Et}from"./chunk-z8k3fx4r.js";import{a}from"./chunk-q49ykyq9.js";import{ws}from"./chunk-3cn9y08d.js";import"./chunk-5q9ss7ty.js";import"./chunk-afj19nsj.js";import{Te,Zt,Qt}from"./chunk-frk6rzrq.js";import"./chunk-wz5m7ybz.js";import{y}from"./chunk-g4e6egrr.js";import{mt,i}from"./chunk-0y2zzqsq.js";import"./chunk-q9npggak.js";import"./chunk-2qz891k4.js";import{as}from"./chunk-3m9vrhja.js";import"./chunk-mmdfjmgk.js";import"./chunk-jt28zh50.js";import{Wa,qa,Ka}from"./chunk-3nxe5xmy.js";import{Jt,Xn,Jn}from"./chunk-tn40nh9e.js";import{Yt}from"./chunk-vtv7165t.js";import"./chunk-tp2g09ca.js";import"./chunk-sgm6tg8h.js";import{G,be}from"./chunk-30j6mbrf.js";import"./chunk-3kfbs0mw.js";import"./chunk-xsf7ax50.js";import{l}from"./chunk-c05r0rzw.js";import{s,ge}from"./chunk-cehjp06v.js";import D from"fs";import f from"path";import{createHash as $t}from"crypto";function Dt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Rt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function It(t){return Bun.hash(t).toString(16)}function ot(t,r={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let n=new Map,o=t.replace(Rt,(e,u,g,v)=>{let w=v.trim();if(!w)return e;if(/\bdata-stx-src=/.test(g))return e;if(r.minify)w=Dt(w);let p=It(w);if(!n.has(p))n.set(p,w);let P=r.integrity?` data-stx-integrity="sha384-${$t("sha384").update(w).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),c=Array.from(n,([e,u])=>({hash:e,code:u}));return{html:o,chunks:c}}var Bt=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let r=new Map,n=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=n.exec(t))!==null)r.set(o[1],o[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(Bt.has(r.get(u[1])||""))c.add(u[2]);let g=/<\/head\s*>/iy,v=S(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(c.size===0||v===-1)return t;let w=Array.from(c).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!w)return t;return t.slice(0,v)+w+t.slice(v)}var jt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function X(t){let r=t.trim();if(!r)return null;let n=/^https?:\/\//i.test(r)?r:`https://${r}`;try{return new URL(n).origin+new URL(n).pathname.replace(/\/$/,"")}catch{return null}}function Ft(t){for(let r of jt){let n=t[r];if(!n)continue;let o=X(n);if(o)return{url:o,source:"env",via:r}}return null}function lt(t){if(!t||typeof t!=="object")return null;let r=t,n=r.site?.url??r.url??r.app?.url;return typeof n==="string"?X(n):null}async function At(t){let{existsSync:r}=await import("fs"),n=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=n.resolve(t,o);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(),n=t.env??process.env;if(t.explicit){let u=X(t.explicit);if(u)return{url:u,source:"option"}}let o=lt(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let c=await At(r);if(c)return{url:c,source:"site.config",via:"url"};let e=Ft(n);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 Ot;function Lt(t){let r=s(t),{depths:n}=ge(r),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,c;while((c=o.exec(r))!==null){if(n[c.index]!==0)continue;let u=b(r,"(",")",o.lastIndex-1),g=r.indexOf("{",u+1),v=b(r,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(c.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((c=e.exec(r))!==null){if(n[c.index]!==0)continue;let u=Jc(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 n=await Bun.file(t).text();r="parse";let o=Yt(n),c=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(s(e.attrs))).sort((e,u)=>n.indexOf(e.fullTag)-n.indexOf(u.fullTag));for(let e of c){if(!/\bgetStaticPaths\b/.test(s(e.content)))continue;let u=(Ot??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(s(u)))continue;let g=Lt(u);if(/\bdefineStaticPaths\b/.test(s(g))&&Tt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");r="execute";let v=Function("defineStaticPaths",`return (${g})`)(J);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let w=await v();r="result";let p=Array.isArray(w)?{paths:w}:w;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(n){return{kind:"error",phase:r,error:n instanceof Error?n:Error(String(n))}}}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=f.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let r=JSON.parse(await Bun.file(t).text());for(let[n,o]of Object.entries(r))this.cache.set(n,o)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=f.join(this.cacheDir,"build-cache.json"),r={};for(let[n,o]of this.cache)r[n]=o;await Bun.write(t,JSON.stringify(r))}getHash(t,r){let n=D.statSync(t),o=`${this.salt}|${t}:${n.mtimeMs}`;for(let e of r)if(D.existsSync(e)){let u=D.statSync(e);o+=`:${e}:${u.mtimeMs}`}let c=0;for(let e=0;e<o.length;e++){let u=o.charCodeAt(e);c=(c<<5)-c+u,c=c&c}return Math.abs(c).toString(36)}get(t,r){let n=this.cache.get(t);if(!n)return null;let o=ft(r).some((u)=>D.existsSync(u)),c=[r,...n.dependencies??[]].some((u)=>u.endsWith(".stx")&&D.existsSync(u)&&as(D.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||c)return this.cache.delete(t),null;let e=this.getHash(r,n.dependencies??[]);if(n.hash!==e)return this.cache.delete(t),null;return n.html}set(t,r,n,o){let c=this.getHash(r,n);this.cache.set(t,{hash:c,html:o,generatedAt:Date.now(),dependencies:n})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let r=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return f.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 n=this.getFilePath(t);await D.promises.mkdir(f.dirname(n),{recursive:!0}),await Bun.write(n,JSON.stringify(r))}async invalidate(t){let r=this.getFilePath(t);if(await Bun.file(r).exists())await D.promises.unlink(r)}async invalidatePattern(t){let r=f.join(this.cacheDir,"isr");if(!D.existsSync(r))return;let n=await D.promises.readdir(r);for(let o of n){let c=o.replace(/_/g,"/").replace(".json","");if(t.test(c))await D.promises.unlink(f.join(r,o))}}async needsRevalidation(t){let r=await this.get(t);if(!r)return!0;return Date.now()>r.revalidateAfter}}async function Ut(t){let r=[];if(!t.isDynamic)r.push({url:t.pattern,params:{}});else{let n=await gt(t.filePath);if(n.kind==="error")throw Error(`getStaticPaths ${n.phase} failed for ${t.pattern} (${t.filePath}): ${n.error.message}`,{cause:n.error});if(n.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),r;let o=n.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),r;for(let c of o.paths){let e=t.pattern;for(let[u,g]of Object.entries(c.params))e=e.replace(`:${u}`,g).replace(`:${u}*`,g);r.push({url:e,params:c.params,props:c.props,revalidate:c.revalidate})}}return r}function ft(t){return[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"]}async function Mt(t){for(let r of ft(t))if(await Bun.file(r).exists())try{let n=await import(r);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:o,...c}=n;return c}}catch(n){console.error(`Error loading data file ${r}:`,n)}return null}async function Gt(t,r,n){let o=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let c=o[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",`
2
+ import"./chunk-wmnzapn8.js";import{w,Yc}from"./chunk-tpfxvw4q.js";import"./chunk-b51p56k5.js";import"./chunk-4833k99b.js";import{$t,S}from"./chunk-2cbd1ew6.js";import"./chunk-x5seqmrv.js";import"./chunk-wghtdgwj.js";import"./chunk-8rk79ha1.js";import{St,kt,_t,Ct,Et,Tt}from"./chunk-f8p8ggvw.js";import{a}from"./chunk-vv8dn70r.js";import{xs}from"./chunk-evxp3wmv.js";import"./chunk-q3azy64b.js";import"./chunk-61qh74q1.js";import{he,Qt,en}from"./chunk-x7q4tp3f.js";import"./chunk-4rxmxc1p.js";import{y}from"./chunk-7y1rpd4g.js";import{ht,i}from"./chunk-23t9anc0.js";import"./chunk-bjhesw78.js";import"./chunk-yhbsvf65.js";import{cs}from"./chunk-vvs28yqw.js";import"./chunk-wk8y89q2.js";import"./chunk-b0z2n941.js";import{qa,Ka,Ga}from"./chunk-0fs9kx0h.js";import{Yt,Jn,Yn}from"./chunk-wwnqbv9j.js";import{Zt}from"./chunk-4c0qcjac.js";import"./chunk-krsg6dgz.js";import"./chunk-9k8ztdcc.js";import{G,we}from"./chunk-frybxj35.js";import"./chunk-k2ex94n8.js";import"./chunk-kj9m0vc6.js";import{l}from"./chunk-4tgn1frg.js";import{s,ge}from"./chunk-42zqmcnc.js";import D from"fs";import f from"path";import{createHash as Pt}from"crypto";function Dt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Rt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function It(t){return Bun.hash(t).toString(16)}function ot(t,r={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let n=new Map,o=t.replace(Rt,(e,u,g,v)=>{let x=v.trim();if(!x)return e;if(/\bdata-stx-src=/.test(g))return e;if(r.minify)x=Dt(x);let p=It(x);if(!n.has(p))n.set(p,x);let P=r.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(x).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),c=Array.from(n,([e,u])=>({hash:e,code:u}));return{html:o,chunks:c}}var Bt=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let r=new Map,n=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=n.exec(t))!==null)r.set(o[1],o[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(Bt.has(r.get(u[1])||""))c.add(u[2]);let g=/<\/head\s*>/iy,v=S(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(c.size===0||v===-1)return t;let x=Array.from(c).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!x)return t;return t.slice(0,v)+x+t.slice(v)}var jt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function X(t){let r=t.trim();if(!r)return null;let n=/^https?:\/\//i.test(r)?r:`https://${r}`;try{return new URL(n).origin+new URL(n).pathname.replace(/\/$/,"")}catch{return null}}function Ft(t){for(let r of jt){let n=t[r];if(!n)continue;let o=X(n);if(o)return{url:o,source:"env",via:r}}return null}function lt(t){if(!t||typeof t!=="object")return null;let r=t,n=r.site?.url??r.url??r.app?.url;return typeof n==="string"?X(n):null}async function At(t){let{existsSync:r}=await import("fs"),n=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=n.resolve(t,o);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(),n=t.env??process.env;if(t.explicit){let u=X(t.explicit);if(u)return{url:u,source:"option"}}let o=lt(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let c=await At(r);if(c)return{url:c,source:"site.config",via:"url"};let e=Ft(n);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 Ot;function Lt(t){let r=s(t),{depths:n}=ge(r),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,c;while((c=o.exec(r))!==null){if(n[c.index]!==0)continue;let u=w(r,"(",")",o.lastIndex-1),g=r.indexOf("{",u+1),v=w(r,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(c.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((c=e.exec(r))!==null){if(n[c.index]!==0)continue;let u=Yc(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 n=await Bun.file(t).text();r="parse";let o=Zt(n),c=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(s(e.attrs))).sort((e,u)=>n.indexOf(e.fullTag)-n.indexOf(u.fullTag));for(let e of c){if(!/\bgetStaticPaths\b/.test(s(e.content)))continue;let u=(Ot??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(s(u)))continue;let g=Lt(u);if(/\bdefineStaticPaths\b/.test(s(g))&&$t(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");r="execute";let v=Function("defineStaticPaths",`return (${g})`)(J);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let x=await v();r="result";let p=Array.isArray(x)?{paths:x}:x;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(n){return{kind:"error",phase:r,error:n instanceof Error?n:Error(String(n))}}}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=f.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let r=JSON.parse(await Bun.file(t).text());for(let[n,o]of Object.entries(r))this.cache.set(n,o)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=f.join(this.cacheDir,"build-cache.json"),r={};for(let[n,o]of this.cache)r[n]=o;await Bun.write(t,JSON.stringify(r))}getHash(t,r){let n=D.statSync(t),o=`${this.salt}|${t}:${n.mtimeMs}`;for(let e of r)if(D.existsSync(e)){let u=D.statSync(e);o+=`:${e}:${u.mtimeMs}`}let c=0;for(let e=0;e<o.length;e++){let u=o.charCodeAt(e);c=(c<<5)-c+u,c=c&c}return Math.abs(c).toString(36)}get(t,r){let n=this.cache.get(t);if(!n)return null;let o=mt(r).some((u)=>D.existsSync(u)),c=[r,...n.dependencies??[]].some((u)=>u.endsWith(".stx")&&D.existsSync(u)&&cs(D.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||c)return this.cache.delete(t),null;let e=this.getHash(r,n.dependencies??[]);if(n.hash!==e)return this.cache.delete(t),null;return n.html}set(t,r,n,o){let c=this.getHash(r,n);this.cache.set(t,{hash:c,html:o,generatedAt:Date.now(),dependencies:n})}}class ft{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let r=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return f.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 n=this.getFilePath(t);await D.promises.mkdir(f.dirname(n),{recursive:!0}),await Bun.write(n,JSON.stringify(r))}async invalidate(t){let r=this.getFilePath(t);if(await Bun.file(r).exists())await D.promises.unlink(r)}async invalidatePattern(t){let r=f.join(this.cacheDir,"isr");if(!D.existsSync(r))return;let n=await D.promises.readdir(r);for(let o of n){let c=o.replace(/_/g,"/").replace(".json","");if(t.test(c))await D.promises.unlink(f.join(r,o))}}async needsRevalidation(t){let r=await this.get(t);if(!r)return!0;return Date.now()>r.revalidateAfter}}async function Ut(t){let r=[];if(!t.isDynamic)r.push({url:t.pattern,params:{}});else{let n=await gt(t.filePath);if(n.kind==="error")throw Error(`getStaticPaths ${n.phase} failed for ${t.pattern} (${t.filePath}): ${n.error.message}`,{cause:n.error});if(n.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),r;let o=n.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),r;for(let c of o.paths){let e=t.pattern;for(let[u,g]of Object.entries(c.params))e=e.replace(`:${u}`,g).replace(`:${u}*`,g);r.push({url:e,params:c.params,props:c.props,revalidate:c.revalidate})}}return r}function mt(t){return[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"]}async function Mt(t){for(let r of mt(t))if(await Bun.file(r).exists())try{let n=await import(r);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:o,...c}=n;return c}}catch(n){console.error(`Error loading data file ${r}:`,n)}return null}async function Gt(t,r,n){let o=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let c=o[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
- `)(r)}catch(e){return console.error(`Error executing getStaticProps in ${n}:`,e),null}}function Nt(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 wt(t,r,n={},o,c){let e=await Bun.file(t.filePath).text(),u=await Mt(t.filePath),g=await Gt(e,r,t.filePath),v={...u||{},...g||{},...n,params:r,$route:{path:t.pattern,params:r}},w=new Set,p=[],P=[],E={...c,minifyClient:!0,...o.partialsDir?{partialsDir:o.partialsDir}:{},...o.componentsDir?{componentsDir:o.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(R)=>{p.push(`${f.relative(process.cwd(),R.templatePath)}: ${R.message}
8
- resolved against partialsDir: ${R.partialsDir}`)},onServerScriptError:(R)=>{P.push(`${f.relative(process.cwd(),R.sourcePath)} (${R.kind}): ${R.message}`)}};if(Nt(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 x=await i(e,v,t.filePath,E,w);for(let R of[t.filePath,...w])for(let T of Te(R))w.add(T);if(Object.keys(r).length>0){let R=`<script>if(window.stx)window.stx._rp=${JSON.stringify(r)};else window.__stx_rp=${JSON.stringify(r)};</script>`;if(x.includes("</head>"))x=x.replace("</head>",`${R}
9
- </head>`);else x=`${R}
10
- ${x}`}if(x=await be(x,{router:o.router}),x=await y(x),o.minify!==!1)return{html:Ht(x),dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P};return{html:x,dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P}}function Ht(t){let r=[],n=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=o.exec(t))!==null){let u=t.slice(n,c.index);r.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=c[1],v=c[2],w=c[3];v=v.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),r.push(g+v+w),n=c.index+c[0].length}let e=t.slice(n);return r.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),r.join("").trim()}function zt(t){let r=0;for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);r=(r<<5)-r+o,r=r&r}return`"${Math.abs(r).toString(36)}"`}function Wt(t,r,n,o){if(n?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(r))return!0;return o.some((c)=>{if(c instanceof RegExp)return c.test(t);return c.endsWith("/")?t===c.slice(0,-1)||t.startsWith(c):t===c})}function qt(t,r){return`<?xml version="1.0" encoding="UTF-8"?>
7
+ `)(r)}catch(e){return console.error(`Error executing getStaticProps in ${n}:`,e),null}}function Nt(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 wt(t,r,n={},o,c){let e=await Bun.file(t.filePath).text(),u=await Mt(t.filePath),g=await Gt(e,r,t.filePath),v={...u||{},...g||{},...n,params:r,$route:{path:t.pattern,params:r}},x=new Set,p=[],P=[],E={...c,minifyClient:!0,...o.partialsDir?{partialsDir:o.partialsDir}:{},...o.componentsDir?{componentsDir:o.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(R)=>{p.push(`${f.relative(process.cwd(),R.templatePath)}: ${R.message}
8
+ resolved against partialsDir: ${R.partialsDir}`)},onServerScriptError:(R)=>{P.push(`${f.relative(process.cwd(),R.sourcePath)} (${R.kind}): ${R.message}`)}};if(Nt(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 b=await i(e,v,t.filePath,E,x);for(let R of[t.filePath,...x])for(let T of he(R))x.add(T);if(Object.keys(r).length>0){let R=`<script>if(window.stx)window.stx._rp=${JSON.stringify(r)};else window.__stx_rp=${JSON.stringify(r)};</script>`;if(b.includes("</head>"))b=b.replace("</head>",`${R}
9
+ </head>`);else b=`${R}
10
+ ${b}`}if(b=await we(b,{router:o.router}),b=await y(b),o.minify!==!1)return{html:Ht(b),dependencies:Array.from(x),includeFailures:p,serverScriptFailures:P};return{html:b,dependencies:Array.from(x),includeFailures:p,serverScriptFailures:P}}function Ht(t){let r=[],n=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=o.exec(t))!==null){let u=t.slice(n,c.index);r.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=c[1],v=c[2],x=c[3];v=v.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),r.push(g+v+x),n=c.index+c[0].length}let e=t.slice(n);return r.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),r.join("").trim()}function zt(t){let r=0;for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);r=(r<<5)-r+o,r=r&r}return`"${Math.abs(r).toString(36)}"`}function Wt(t,r,n,o){if(n?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(r))return!0;return o.some((c)=>{if(c instanceof RegExp)return c.test(t);return c.endsWith("/")?t===c.slice(0,-1)||t.startsWith(c):t===c})}function qt(t,r){return`<?xml version="1.0" encoding="UTF-8"?>
11
11
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
12
12
  ${t.map((o)=>{let c=new URL(o.loc,r).href,e=` <url>
13
13
  <loc>${F(c)}</loc>`;if(o.lastmod)e+=`
@@ -16,7 +16,7 @@ ${t.map((o)=>{let c=new URL(o.loc,r).href,e=` <url>
16
16
  <priority>${o.priority}</priority>`;return e+=`
17
17
  </url>`,e}).join(`
18
18
  `)}
19
- </urlset>`}function F(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Vt(t,r){let n=r.map((o)=>{let c=" <item>";if(c+=`
19
+ </urlset>`}function F(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Jt(t,r){let n=r.map((o)=>{let c=" <item>";if(c+=`
20
20
  <title>${F(o.title)}</title>`,c+=`
21
21
  <link>${F(o.link)}</link>`,o.description)c+=`
22
22
  <description>${F(o.description)}</description>`;if(o.pubDate)c+=`
@@ -37,16 +37,16 @@ ${t.map((o)=>{let c=new URL(o.loc,r).href,e=` <url>
37
37
  ${n.join(`
38
38
  `)}
39
39
  </channel>
40
- </rss>`}async function Kt(t={}){let r=Date.now();Qt();let n=await a(process.cwd()),o=n.build||{},c=await ut({explicit:t.domain||o.domain,stxConfig:n});if(c.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(dt());let e={router:t.router??n?.router??{},pagesDir:t.pagesDir||o.pagesDir||"pages",outputDir:t.outputDir||o.outputDir||"dist",baseUrl:t.baseUrl||o.baseUrl||"/",domain:c.url,revalidate:t.revalidate??o.revalidate??!1,sitemap:t.sitemap??o.sitemap??!0,sitemapExclude:t.sitemapExclude||o.sitemapExclude||[],robots:t.robots??o.robots??!0,rss:t.rss??o.rss??!1,concurrency:t.concurrency||o.concurrency||10,cache:t.cache??o.cache??!0,cacheDir:t.cacheDir||o.cacheDir||l(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??o.minify??!0,generate404:t.generate404??o.generate404??!0,publicDir:t.publicDir||o.publicDir||"public",trailingSlash:t.trailingSlash??o.trailingSlash??!1,cleanOutput:t.cleanOutput??o.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||n?.partialsDir||"",componentsDir:t.componentsDir||n?.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:[]},g=new Set,v=0,w={},p={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&D.existsSync(e.outputDir))await D.promises.rm(e.outputDir,{recursive:!0});await D.promises.mkdir(e.outputDir,{recursive:!0});let E=e.cacheSalt;if(!E){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-1khg5vjs.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:x}=await import("./chunk-ex2397dc.js"),R=await x(e.publicDir,e.outputDir);if(R.count>0)console.log(`Optimized ${R.count} image(s) for responsive delivery`),E=[E,R.fingerprint].filter(Boolean).join(":");let T=new pt(e.cacheDir,E);if(e.cache)await T.load();try{let{generateCss:d}=await import("./chunk-1khg5vjs.js");await d('<div class="bg-black"></div>')}catch{}xt();let yt=n?.routeMiddleware?.dir||"middleware";await kt(process.cwd(),yt);let V=St();if(V.length>0)console.log(`Loaded ${V.length} middleware: ${V.join(", ")}`);let bt=n?.routeMiddleware?.global||[];Ka(n?.layoutsDir,l(process.cwd()));let Z=G(".",{pagesDir:e.pagesDir,pagesDirs:n?._layerPageDirs});console.log(`Found ${Z.length} routes`);let M=[];for(let d of Z)try{let m=await Ut(d);for(let k of m)M.push({route:d,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??e.revalidate})}catch(m){let k=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:k}),await e.hooks.onError?.(k,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,k)}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:k,url:h,params:N,props:vt,revalidate:rt}=m;try{await e.hooks.onPageStart?.(h);let A=await Bun.file(k.filePath).text(),O=ee(A),Pt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],nt=[...bt,...Pt];if(nt.length>0){let B=_t(h,N,O||{}),L=Ct(B,null,void 0,{isServer:!0}),j=await Et(nt,L);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,z=re(String(C),h),U=ne(h,e);await D.promises.mkdir(f.dirname(U),{recursive:!0}),await Bun.write(U,z),u.successCount++,u.pages.push({route:h,outputPath:U,size:Buffer.byteLength(z),cached:!1}),_.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${C}`);return}}let it=A.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(it)try{if(!await Function("route",`
40
+ </rss>`}async function Vt(t={}){let r=Date.now();en();let n=await a(process.cwd()),o=n.build||{},c=await ut({explicit:t.domain||o.domain,stxConfig:n});if(c.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(dt());let e={router:t.router??n?.router??{},pagesDir:t.pagesDir||o.pagesDir||"pages",outputDir:t.outputDir||o.outputDir||"dist",baseUrl:t.baseUrl||o.baseUrl||"/",domain:c.url,revalidate:t.revalidate??o.revalidate??!1,sitemap:t.sitemap??o.sitemap??!0,sitemapExclude:t.sitemapExclude||o.sitemapExclude||[],robots:t.robots??o.robots??!0,rss:t.rss??o.rss??!1,concurrency:t.concurrency||o.concurrency||10,cache:t.cache??o.cache??!0,cacheDir:t.cacheDir||o.cacheDir||l(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??o.minify??!0,generate404:t.generate404??o.generate404??!0,publicDir:t.publicDir||o.publicDir||"public",trailingSlash:t.trailingSlash??o.trailingSlash??!1,cleanOutput:t.cleanOutput??o.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||n?.partialsDir||"",componentsDir:t.componentsDir||n?.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:[]},g=new Set,v=0,x={},p={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&D.existsSync(e.outputDir))await D.promises.rm(e.outputDir,{recursive:!0});await D.promises.mkdir(e.outputDir,{recursive:!0});let E=e.cacheSalt;if(!E){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-wq1vs94k.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:b}=await import("./chunk-yp80rx17.js"),R=await b(e.publicDir,e.outputDir);if(R.count>0)console.log(`Optimized ${R.count} image(s) for responsive delivery`),E=[E,R.fingerprint].filter(Boolean).join(":");let T=new pt(e.cacheDir,E);if(e.cache)await T.load();try{let{generateCss:d}=await import("./chunk-wq1vs94k.js");await d('<div class="bg-black"></div>')}catch{}St();let yt=n?.routeMiddleware?.dir||"middleware";await _t(process.cwd(),yt);let V=kt();if(V.length>0)console.log(`Loaded ${V.length} middleware: ${V.join(", ")}`);let xt=n?.routeMiddleware?.global||[];Ga(n?.layoutsDir,l(process.cwd()));let Z=G(".",{pagesDir:e.pagesDir,pagesDirs:n?._layerPageDirs});console.log(`Found ${Z.length} routes`);let M=[];for(let d of Z)try{let m=await Ut(d);for(let k of m)M.push({route:d,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??e.revalidate})}catch(m){let k=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:k}),await e.hooks.onError?.(k,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,k)}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:k,url:h,params:N,props:bt,revalidate:rt}=m;try{await e.hooks.onPageStart?.(h);let A=await Bun.file(k.filePath).text(),O=te(A),vt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],nt=[...xt,...vt];if(nt.length>0){let B=Ct(h,N,O||{}),L=Et(B,null,void 0,{isServer:!0}),j=await Tt(nt,L);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,z=ee(String(C),h),U=re(h,e);await D.promises.mkdir(f.dirname(U),{recursive:!0}),await Bun.write(U,z),u.successCount++,u.pages.push({route:h,outputPath:U,size:Buffer.byteLength(z),cached:!1}),_.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${C}`);return}}let it=A.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(it)try{if(!await Function("route",`
41
41
  const validate = ${it[1]};
42
42
  return validate(route);
43
- `)({params:N})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=T.get(h,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await wt(k,N,vt,e,n);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:
43
+ `)({params:N})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=T.get(h,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await wt(k,N,bt,e,n);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
44
  ${B.includeFailures.join(`
45
45
  `)}
46
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
47
  ${B.serverScriptFailures.join(`
48
48
  `)}
49
- Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)T.set(h,k.filePath,B.dependencies,I)}let H;if(e.trailingSlash)H=f.join(e.outputDir,h,"index.html");else H=h==="/"?f.join(e.outputDir,"index.html"):f.join(e.outputDir,`${h}.html`);if(e.chunkIslands){let{html:B,chunks:L}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(L.length>0){let j=f.join(e.outputDir,"_stx","islands");await D.promises.mkdir(j,{recursive:!0});for(let C of L){let z=f.join(j,`${C.hash}.js`);if(!await Bun.file(z).exists())await Bun.write(z,C.code);if(!g.has(C.hash)){g.add(C.hash);let U=Buffer.byteLength(C.code,"utf8");v+=U,w[C.hash]={bytes:U,file:`/_stx/islands/${C.hash}.js`}}}if(p[h]=L.map((C)=>C.hash),I=B,e.prefetchIslands)I=ct(I)}}if(await D.promises.mkdir(f.dirname(H),{recursive:!0}),await Bun.write(H,I),!Wt(h,I,O,e.sitemapExclude))_.push({loc:h,lastmod:new Date().toISOString().split("T")[0],priority:h==="/"?1:0.8});let at={route:h,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?.(h,I)}catch(A){u.failedCount++,u.errors.push({route:h,error:A}),await e.hooks.onError?.(A,h),console.error(`Error generating ${h}:`,A)}}));let tt=Zt();if(tt.length>0){let d=tt.map((m)=>`${m.filePath}: ${m.message}`).join(`
49
+ Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)T.set(h,k.filePath,B.dependencies,I)}let H;if(e.trailingSlash)H=f.join(e.outputDir,h,"index.html");else H=h==="/"?f.join(e.outputDir,"index.html"):f.join(e.outputDir,`${h}.html`);if(e.chunkIslands){let{html:B,chunks:L}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(L.length>0){let j=f.join(e.outputDir,"_stx","islands");await D.promises.mkdir(j,{recursive:!0});for(let C of L){let z=f.join(j,`${C.hash}.js`);if(!await Bun.file(z).exists())await Bun.write(z,C.code);if(!g.has(C.hash)){g.add(C.hash);let U=Buffer.byteLength(C.code,"utf8");v+=U,x[C.hash]={bytes:U,file:`/_stx/islands/${C.hash}.js`}}}if(p[h]=L.map((C)=>C.hash),I=B,e.prefetchIslands)I=ct(I)}}if(await D.promises.mkdir(f.dirname(H),{recursive:!0}),await Bun.write(H,I),!Wt(h,I,O,e.sitemapExclude))_.push({loc:h,lastmod:new Date().toISOString().split("T")[0],priority:h==="/"?1:0.8});let at={route:h,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?.(h,I)}catch(A){u.failedCount++,u.errors.push({route:h,error:A}),await e.hooks.onError?.(A,h),console.error(`Error generating ${h}:`,A)}}));let tt=Qt();if(tt.length>0){let d=tt.map((m)=>`${m.filePath}: ${m.message}`).join(`
50
50
  `);throw Error(`Client script bundling failed:
51
51
  ${d}`)}if(e.cache)await T.save();if(e.generate404){let d=f.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let m=new Set,k={...n,minifyClient:!0,debug:!1,cache:!1},h=await i(await Bun.file(d).text(),{},d,k,m);await Bun.write(f.join(e.outputDir,"404.html"),h)}else await Bun.write(f.join(e.outputDir,"404.html"),`<!DOCTYPE html>
52
52
  <html lang="en">
@@ -69,7 +69,7 @@ ${d}`)}if(e.cache)await T.save();if(e.generate404){let d=f.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 m=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...n,minifyClient:!0,debug:!1,cache:!1},N=await i(await Bun.file(m).text(),{},m,h,k);await Bun.write(f.join(e.outputDir,`${d}.html`),N)}}let K=f.join(e.pagesDir,"error.stx");if(await Bun.file(K).exists()){let d=new Set,m={...n,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(K).text(),{},K,m,d);await Bun.write(f.join(e.outputDir,"error.html"),k)}if(e.sitemap&&_.length>0){let d=qt(_,e.domain),m=f.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((h)=>typeof h==="string"),...d.disallow||[]],k=ws({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(f.join(e.outputDir,"robots.txt"),k),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 k=Vt(d,m),h=f.join(e.outputDir,"rss.xml");await Bun.write(h,k),u.rssPath=h,console.log(`Generated rss.xml with ${m.length} items`)}let W=Wa(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=qa(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&&D.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=Jn();if(et)await Y(et,f.join(e.outputDir,Xn)),console.log(`Copied assets from ${Jt}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-r,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let E={generatedChunks:g.size,totalBytes:v,chunks:w,pages:p};await Bun.write(f.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(E,null,2))}await e.hooks.onBuildEnd?.(u);let P=u.islandChunks?`
72
+ </html>`)}for(let d of[500]){let m=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...n,minifyClient:!0,debug:!1,cache:!1},N=await i(await Bun.file(m).text(),{},m,h,k);await Bun.write(f.join(e.outputDir,`${d}.html`),N)}}let K=f.join(e.pagesDir,"error.stx");if(await Bun.file(K).exists()){let d=new Set,m={...n,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(K).text(),{},K,m,d);await Bun.write(f.join(e.outputDir,"error.html"),k)}if(e.sitemap&&_.length>0){let d=qt(_,e.domain),m=f.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((h)=>typeof h==="string"),...d.disallow||[]],k=xs({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(f.join(e.outputDir,"robots.txt"),k),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 k=Jt(d,m),h=f.join(e.outputDir,"rss.xml");await Bun.write(h,k),u.rssPath=h,console.log(`Generated rss.xml with ${m.length} items`)}let W=qa(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=Ka(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&&D.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=Yn();if(et)await Y(et,f.join(e.outputDir,Jn)),console.log(`Copied assets from ${Yt}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-r,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let E={generatedChunks:g.size,totalBytes:v,chunks:x,pages:p};await Bun.write(f.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(E,null,2))}await e.hooks.onBuildEnd?.(u);let P=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${P}
80
- `),u}async function Y(t,r){await D.promises.mkdir(r,{recursive:!0});let n=await D.promises.readdir(t,{withFileTypes:!0});for(let o of n){let c=f.join(t,o.name),e=f.join(r,o.name);if(o.isDirectory())await D.promises.mkdir(e,{recursive:!0}),await Y(c,e);else await D.promises.copyFile(c,e)}}function Xt(t={}){let r=t.cacheDir||l(process.cwd(),"ssg-cache"),n=new ht(r),o=t.revalidate||3600;return{async get(c){let e=await n.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=${o}, stale-while-revalidate=${o*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((P)=>c.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${c}`);return}let g=c.match(u.regex),v={};if(g)u.params.forEach((P,E)=>{v[P]=g[E+1]});let w=await a(),{html:p}=await wt(u,v,{},t,w);await n.set(c,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:zt(p)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await n.invalidate(c);else await n.invalidatePattern(c)}}}function te(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let r=await Bun.file(t).text(),n=r.match(/^---\n([\s\S]*?)\n---/),o={},c=r;if(n){let w=n[1];c=r.slice(n[0].length).trim();for(let p of w.split(`
81
- `)){let P=p.indexOf(":");if(P>0){let E=p.slice(0,P).trim(),x=p.slice(P+1).trim();if(x==="true")x=!0;else if(x==="false")x=!1;else if(/^\d+$/.test(x))x=parseInt(x,10);else if(/^\d+\.\d+$/.test(x))x=parseFloat(x);else if(x.startsWith("[")&&x.endsWith("]"))x=x.slice(1,-1).split(",").map((R)=>R.trim().replace(/^['"]|['"]$/g,""));o[E]=x}}}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=[],g=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,v;while((v=g.exec(e))!==null){let w=parseInt(v[1],10),p=v[2],P=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:p,level:w})}return{content:e,data:o,toc:u}}}}function ee(t){return mt(t)}function re(t,r){return`<!DOCTYPE html>
80
+ `),u}async function Y(t,r){await D.promises.mkdir(r,{recursive:!0});let n=await D.promises.readdir(t,{withFileTypes:!0});for(let o of n){let c=f.join(t,o.name),e=f.join(r,o.name);if(o.isDirectory())await D.promises.mkdir(e,{recursive:!0}),await Y(c,e);else await D.promises.copyFile(c,e)}}function Kt(t={}){let r=t.cacheDir||l(process.cwd(),"ssg-cache"),n=new ft(r),o=t.revalidate||3600;return{async get(c){let e=await n.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=${o}, stale-while-revalidate=${o*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((P)=>c.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${c}`);return}let g=c.match(u.regex),v={};if(g)u.params.forEach((P,E)=>{v[P]=g[E+1]});let x=await a(),{html:p}=await wt(u,v,{},t,x);await n.set(c,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:zt(p)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await n.invalidate(c);else await n.invalidatePattern(c)}}}function Xt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let r=await Bun.file(t).text(),n=r.match(/^---\n([\s\S]*?)\n---/),o={},c=r;if(n){let x=n[1];c=r.slice(n[0].length).trim();for(let p of x.split(`
81
+ `)){let P=p.indexOf(":");if(P>0){let E=p.slice(0,P).trim(),b=p.slice(P+1).trim();if(b==="true")b=!0;else if(b==="false")b=!1;else if(/^\d+$/.test(b))b=parseInt(b,10);else if(/^\d+\.\d+$/.test(b))b=parseFloat(b);else if(b.startsWith("[")&&b.endsWith("]"))b=b.slice(1,-1).split(",").map((R)=>R.trim().replace(/^['"]|['"]$/g,""));o[E]=b}}}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=[],g=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,v;while((v=g.exec(e))!==null){let x=parseInt(v[1],10),p=v[2],P=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:p,level:x})}return{content:e,data:o,toc:u}}}}function te(t){return ht(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 ne(t,r){if(t==="/"||t==="")return f.join(r.outputDir,"index.html");let n=t.replace(/^\/|\/$/g,"");if(r.trailingSlash)return f.join(r.outputDir,n,"index.html");return f.join(r.outputDir,`${n}.html`)}var Oe={generateStaticSite:Kt,createISRHandler:Xt,defineStaticPaths:J,createMarkdownLoader:te};export{Xt as createISRHandler,te as createMarkdownLoader,Nt as declaresPageAction,Oe as default,J as defineStaticPaths,Kt as generateStaticSite,Wt as isExcludedFromSitemap};
93
+ </html>`}function re(t,r){if(t==="/"||t==="")return f.join(r.outputDir,"index.html");let n=t.replace(/^\/|\/$/g,"");if(r.trailingSlash)return f.join(r.outputDir,n,"index.html");return f.join(r.outputDir,`${n}.html`)}var Ae={generateStaticSite:Vt,createISRHandler:Kt,defineStaticPaths:J,createMarkdownLoader:Xt};export{Kt as createISRHandler,Xt as createMarkdownLoader,Nt as declaresPageAction,Ae as default,J as defineStaticPaths,Vt as generateStaticSite,Wt as isExcludedFromSitemap};
@@ -2,10 +2,26 @@ export declare function getStoreScript(storesDir?: string): Promise<string | nul
2
2
  /**
3
3
  * Every store a piece of code reads by name: `useStore("auth")`.
4
4
  *
5
- * `all` is set when it cannot tell: a call whose name is not a literal, or a
6
- * look into the registry itself. Such code may read any store.
5
+ * `all` is set when it cannot tell: a call whose name is not a literal,
6
+ * `useStore` taken as a value (an alias the calls then go through), or a look
7
+ * into the registry itself. Such code may read any store.
7
8
  */
8
9
  export declare function storesRead(...sources: Array<string | null | undefined>): { names: Set<string>, all: boolean };
10
+ /**
11
+ * The stores the files read (`storesRead`), each file read once per version.
12
+ * For the sources a page's bundles were built from: the built bundles may be
13
+ * minified, where `useStore` can be an alias the scan cannot follow, while
14
+ * the sources still say which stores they read. A file that cannot be read
15
+ * makes the answer `all`.
16
+ */
17
+ export declare function storesReadInFiles(files: Iterable<string>): { names: Set<string>, all: boolean };
18
+ /**
19
+ * Whether a page ships only the stores it reads (the default) or every store.
20
+ * `STX_PAGE_STORES=all` ships every store on every page, as stx did before
21
+ * 0.2.761: a store whose definition has an effect a page relies on without
22
+ * reading the store would otherwise not run on that page.
23
+ */
24
+ export declare function pageStoresAll(env?: Record<string, string | undefined>): boolean;
9
25
  /**
10
26
  * The store script for code that reads only some of the stores: those it names
11
27
  * with `useStore("…")`, and those the stores it names read in turn. A page
@@ -21,7 +37,15 @@ export declare function storesRead(...sources: Array<string | null | undefined>)
21
37
  * (what production does) instead of inlined in each store. Defaults to
22
38
  * production's.
23
39
  */
24
- export declare function getStoreScriptFor(storesDir: string | undefined, usedBy: Array<string | null | undefined>, options?: { sharedModules?: boolean }): Promise<{ code: string, stores: string[], functions: string[] | null } | null>;
40
+ export declare function getStoreScriptFor(storesDir: string | undefined, usedBy: Array<string | null | undefined>, options?: {
41
+ sharedModules?: boolean
42
+
43
+ reads?: { names: Iterable<string>, all: boolean }
44
+
45
+ runOnce?: boolean
46
+
47
+ all?: boolean
48
+ }): Promise<{ code: string, stores: string[], functions: string[] | null } | null>;
25
49
  /**
26
50
  * Clear the cached store script (for dev mode hot reload).
27
51
  */
@@ -1,4 +1,7 @@
1
+ import fs from "node:fs";
1
2
  import path from "node:path";
3
+ import process from "node:process";
4
+ import { unboundNames } from "./client-parameter-bindings.js";
2
5
  import { bundleClientScript, clientBundleDependencies, hasUserImports, moduleSubstitutionKey } from "./client-script-bundler.js";
3
6
  import { loadStxConfig } from "./config.js";
4
7
  import { isProduction, minifyClassicScript } from "./env.js";
@@ -130,17 +133,26 @@ function topLevelNames(code) {
130
133
  }
131
134
  function storeFunctions(chunks) {
132
135
  const bound = chunks.map((chunk) => topLevelNames(chunk.code));
133
- for (const [index, chunk] of chunks.entries())
136
+ for (const [index, chunk] of chunks.entries()) {
137
+ const others = new Set;
134
138
  for (const [other, names] of bound.entries()) {
135
139
  if (other === index)
136
140
  continue;
137
- for (const name of names) {
138
- if (bound[index].has(name) || chunk.declared.has(name))
139
- continue;
140
- if (new RegExp(`(?<![\\w$.])${name.replace(/\$/g, "\\$")}(?![\\w$])`).test(chunk.code))
141
- return null;
142
- }
141
+ for (const name of names)
142
+ if (!bound[index].has(name) && !chunk.declared.has(name))
143
+ others.add(name);
144
+ }
145
+ if (others.size === 0)
146
+ continue;
147
+ let reads;
148
+ try {
149
+ reads = unboundNames(chunk.code, others);
150
+ } catch {
151
+ reads = new Set([...others].filter((name) => new RegExp(`(?<![\\w$.])${name.replace(/\$/g, "\\$")}(?![\\w$])`).test(chunk.code)));
143
152
  }
153
+ if (reads.size > 0)
154
+ return null;
155
+ }
144
156
  return chunks.map((chunk, index) => {
145
157
  const own = new Set([...chunk.declared, ...bound[index]]);
146
158
  return `function() {
@@ -163,6 +175,29 @@ export async function getStoreScript(storesDir) {
163
175
  }
164
176
  return code;
165
177
  }
178
+ function takesUseStoreAsValue(source) {
179
+ if (!/\buseStore\b/.test(source))
180
+ return !1;
181
+ if (/\buseStore\s+as\s+[A-Za-z_$]/.test(source))
182
+ return !0;
183
+ if (/\{[^{}]*\buseStore\s*:\s*[A-Za-z_$[{][^{}]*\}\s*=(?!=)/.test(source))
184
+ return !0;
185
+ if (/\[\s*(['"`])useStore\1\s*\]/.test(source.replace(/\b(?:var|let|const)\s+useStore\s*=\s*[\w$.]*\[\s*(['"`])useStore\1\s*\]/g, " ")))
186
+ return !0;
187
+ const text = source.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:\\'"`])\/\/[^\n]*/g, "$1 ").replace(/\b(?:var|let|const)\s+useStore\s*=\s*[\w$.]*\[\s*(['"`])useStore\1\s*\]/g, " ").replace(/\b(?:const|let|var)\s*\{[^{}]*\}\s*=/g, " ").replace(/\bimport\s*(?:type\s+)?\{[^{}]*\}\s*from\b/g, " ").replace(/\bexport\s*(?:type\s+)?\{[^{}]*\}/g, " ").replace(/\btypeof\s+useStore\b/g, " ").replace(/(['"`])useStore\1/g, " ");
188
+ for (const match of text.matchAll(/\buseStore\b/g)) {
189
+ const before = text.slice(Math.max(0, match.index - 9), match.index);
190
+ if (/\bfunction\s*$/.test(before))
191
+ continue;
192
+ const after = text.slice(match.index + 8).trimStart();
193
+ if (after.startsWith("(") || after.startsWith("<") || after.startsWith("?.("))
194
+ continue;
195
+ if (/^=(?![=>])/.test(after))
196
+ continue;
197
+ return !0;
198
+ }
199
+ return !1;
200
+ }
166
201
  export function storesRead(...sources) {
167
202
  const names = new Set;
168
203
  let all = !1;
@@ -171,11 +206,13 @@ export function storesRead(...sources) {
171
206
  continue;
172
207
  if (/__STX_STORES__|\b_stores\b/.test(source))
173
208
  all = !0;
174
- const calls = source.match(/\buseStore\s*(?:<[^>()]*>)?\(/g)?.length ?? 0;
209
+ if (takesUseStoreAsValue(source))
210
+ all = !0;
211
+ const calls = source.match(/\buseStore\s*(?:<[^>()]*>)?\s*(?:\?\.\s*)?\(/g)?.length ?? 0;
175
212
  if (calls === 0)
176
213
  continue;
177
214
  let literal = 0;
178
- for (const match of source.matchAll(/\buseStore\s*(?:<[^>()]*>)?\(\s*(['"`])([^'"`$\\]+)\1\s*[,)]/g)) {
215
+ for (const match of source.matchAll(/\buseStore\s*(?:<[^>()]*>)?\s*(?:\?\.\s*)?\(\s*(['"`])([^'"`$\\]+)\1\s*[,)]/g)) {
179
216
  names.add(match[2]);
180
217
  literal++;
181
218
  }
@@ -184,13 +221,49 @@ export function storesRead(...sources) {
184
221
  }
185
222
  return { names, all };
186
223
  }
224
+ const _storesReadByFile = new Map;
225
+ export function storesReadInFiles(files) {
226
+ const names = new Set;
227
+ let all = !1;
228
+ for (const file of files) {
229
+ if (/\.(?:css|json|svg|wasm|png|jpe?g|gif|webp|avif|woff2?|ttf|txt|md)$/i.test(file))
230
+ continue;
231
+ let read;
232
+ try {
233
+ const stat = fs.statSync(file), cached = _storesReadByFile.get(file);
234
+ if (cached && cached.mtimeMs === stat.mtimeMs && cached.size === stat.size)
235
+ read = cached.read;
236
+ else {
237
+ read = storesRead(fs.readFileSync(file, "utf8"));
238
+ _storesReadByFile.set(file, { mtimeMs: stat.mtimeMs, size: stat.size, read });
239
+ }
240
+ } catch {
241
+ read = { names: new Set, all: !0 };
242
+ }
243
+ if (read.all)
244
+ all = !0;
245
+ for (const name of read.names)
246
+ names.add(name);
247
+ }
248
+ return { names, all };
249
+ }
250
+ export function pageStoresAll(env = process.env) {
251
+ return env.STX_PAGE_STORES === "all";
252
+ }
187
253
  export async function getStoreScriptFor(storesDir, usedBy, options = {}) {
188
254
  const built = await loadStoreChunks(storesDir, options.sharedModules);
189
255
  if (!built)
190
256
  return null;
191
257
  const { chunks } = built, wanted = storesRead(...usedBy);
258
+ if (options.reads) {
259
+ if (options.reads.all)
260
+ wanted.all = !0;
261
+ for (const name of options.reads.names)
262
+ wanted.names.add(name);
263
+ }
264
+ const apart = options.runOnce ? runOnceFunctions(built) : void 0;
192
265
  let kept;
193
- if (wanted.all || chunks.some((chunk) => chunk.ids.length === 0))
266
+ if (options.all || wanted.all || chunks.some((chunk) => chunk.ids.length === 0) || apart === null)
194
267
  kept = chunks;
195
268
  else {
196
269
  const byId = new Map;
@@ -214,8 +287,40 @@ export async function getStoreScriptFor(storesDir, usedBy, options = {}) {
214
287
  }
215
288
  if (kept.length === 0)
216
289
  return null;
290
+ if (apart) {
291
+ const functions = kept.map((chunk) => apart.get(chunk)), names = kept.map((chunk) => chunk.name);
292
+ let scripts = _runOnceScripts.get(built);
293
+ if (!scripts)
294
+ _runOnceScripts.set(built, scripts = new Map);
295
+ let code = scripts.get(names.join("\x00"));
296
+ if (code === void 0)
297
+ scripts.set(names.join("\x00"), code = runOnceStoreScript(names, functions));
298
+ return { code, stores: names, functions };
299
+ }
217
300
  return { code: assembleStoreScript(kept), stores: kept.map((chunk) => chunk.name), functions: storeFunctions(kept) };
218
301
  }
302
+ const _runOnceScripts = new WeakMap, _runOnceFunctions = new WeakMap;
303
+ function runOnceFunctions(built) {
304
+ if (_runOnceFunctions.has(built))
305
+ return _runOnceFunctions.get(built);
306
+ const functions = storeFunctions(built.chunks), byChunk = functions ? new Map(built.chunks.map((chunk, index) => [chunk, functions[index]])) : null;
307
+ _runOnceFunctions.set(built, byChunk);
308
+ return byChunk;
309
+ }
310
+ function runOnceStoreScript(names, functions) {
311
+ const assembled = `;(function(){
312
+ var ran = window.__stxStoreFiles || (window.__stxStoreFiles = {});
313
+ function run(name, define) {
314
+ if (ran[name]) return;
315
+ ran[name] = 1;
316
+ try { define(); }
317
+ catch (error) { console.error('[stx] store ' + name + ' failed to load:', error); }
318
+ }
319
+ ${names.map((name, index) => `run(${JSON.stringify(name)}, ${functions[index]})`).join(`;
320
+ `)};
321
+ })();`;
322
+ return isProduction() ? minifyClassicScript(assembled) : assembled;
323
+ }
219
324
  export function clearStoreCache() {
220
325
  _cachedStoreChunks.clear();
221
326
  clearSourceSignatures();
@@ -345,6 +345,7 @@ export declare interface StxConfig {
345
345
  story?: Partial<import('../story/types').StoryConfig>
346
346
  pwa?: Partial<PwaConfig>
347
347
  offline?: import('../offline/app-service-worker').OfflineAppConfig
348
+ messages?: import('../message-catalogs').PageMessagesOptions
348
349
  components?: Partial<ComponentConfig>
349
350
  routeMiddleware?: Partial<RouteMiddlewareConfig>
350
351
  heatmap?: Partial<HeatmapConfig>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.760",
4
+ "version": "0.2.761",
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.760",
132
- "@stacksjs/sanitizer": "0.2.760",
131
+ "@stacksjs/desktop": "0.2.761",
132
+ "@stacksjs/sanitizer": "0.2.761",
133
133
  "@stacksjs/ts-i18n": "^0.1.11",
134
- "bun-plugin-stx": "0.2.760",
134
+ "bun-plugin-stx": "0.2.761",
135
135
  "bunfig": "^0.15.21",
136
- "stx-router": "0.2.760",
136
+ "stx-router": "0.2.761",
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{Zn,$e}from"./chunk-19safa6y.js";export{Zn as describeBuildFailure,$e as formatBuildFailure};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Pm,Im,Om,Nm,Dm}from"./chunk-w8p1y4c0.js";export{Im as defineAsyncComponent,Nm as generateAsyncComponentCSS,Dm as generateAsyncComponentRuntime,Om as isAsyncComponent,Pm as processAsyncDirectives};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{lh,Za,uh,Qa,xf,Sf,on,nr,dh,kf,_f,ph,y}from"./chunk-g4e6egrr.js";import"./chunk-wz5m7ybz.js";import"./chunk-0ggwm837.js";import"./chunk-bsgg8zzk.js";import"./chunk-gs373714.js";import"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-xgegyttg.js";export{on as buildCss,kf as extractClassNames,Sf as fingerprintConfig,_f as generateCss,dh as getCachedCSS,lh as getCssServeAsset,y as injectCss,Za as loadCssEngine,Qa as loadCssEngineConfig,nr as rebuildCss,uh as resetCssCache,xf as resolveUserCssConfig,ph as withLinkedModuleBundles};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Vl,Ul,Wl,ql,Kl,Gl,Xl,Jl,Yl,Zl,sm}from"./chunk-bsq9zg9j.js";export{Vl as createIslandRegistry,sm as default,Zl as generateIslandManifest,Wl as generatePartialHydrationCSS,Gl as hydrateAll,Kl as hydrateByStrategy,ql as hydrateIsland,Xl as isHydrated,Jl as onHydrated,Ul as processPartialHydrationDirectives,Yl as processStaticDirectives};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{rn,ko,_o,Co,ch,Eo}from"./chunk-afj19nsj.js";import"./chunk-5q9ss7ty.js";import"./chunk-z8k3fx4r.js";import"./chunk-gs373714.js";export{_o as buildServerApi,ch as createServerApi,rn as discoverServerApi,ko as generateApiTypes,Eo as isServerApiSource,Co as productionApiDispatcher};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{m,ai,Bc,Fc,Zf,Qf,eg,tg,ng,Ls,rg,Le,Y,je,sg,Sr,og,Vc,di,Be,r,yn,Uc,h,fe,Oh}from"./chunk-0ggwm837.js";import"./chunk-bsgg8zzk.js";import"./chunk-gs373714.js";import"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-xgegyttg.js";export{fe as clearComponentCache,di as componentClientSignalNames,ai as convertToCommonJS,h as createDetailedErrorMessage,ng as extractDirectiveNames,Bc as extractScriptFromTemplate,m as extractVariables,r as fileExists,Oh as getComponentCacheStats,Qf as getPositionInfo,Y as getSharedTranspiler,Uc as getSourceLineInfo,tg as hasDirectives,Fc as hasVariables,og as isHydrateTrigger,rg as isJavaScriptScript,Be as renderComponentWithSlot,yn as resolveTemplatePath,sg as scopeOnRootElement,Ls as scopeSequenceKey,Le as shouldTranspileTypeScript,Vc as slotContentHasExpressions,je as transpileTypeScript,Sr as userComponentFileExists,eg as validateDirective,Zf as validateTemplate};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Gs,Ft,ml,yg}from"./chunk-4zw118tn.js";export{Gs as generateServiceWorker,yg as generateServiceWorkerAuto,Ft as getServiceWorkerFileName,ml as isWorkboxEnabled};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ro,Gi,Br,so,oo,Tn,Wt,Xi,Fr,zr,io,ao,Og,Ng,ut}from"./chunk-asp7ett1.js";export{ut as DeployError,Gi as calculateSha1,Br as collectDeployFiles,zr as createDefaultNetlifyConfig,so as createFileManifest,ro as createNetlifyClient,Og as deploy,Fr as detectProjectConfig,oo as filterRequiredFiles,Tn as formatSize,Xi as generateNetlifyToml,Wt as getTotalSize,ao as hasNetlifyConfig,Ng as initNetlify,io as writeNetlifyConfig};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ca,la,Bl,Fl,zl,Hl,rm}from"./chunk-vh1d5eqk.js";export{ca as createVirtualList,rm as default,Bl as generateVirtualListCSS,zl as processInfiniteListDirectives,Hl as processVirtualGridDirectives,la as processVirtualListDirectives,Fl as useVirtualList};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{vl,wl}from"./chunk-94ymndc5.js";import"./chunk-y8srg0q3.js";import"./chunk-5vmbycy5.js";import"./chunk-asp7ett1.js";import"./chunk-j04v4rgf.js";import"./chunk-7v2srnpv.js";import"./chunk-s4y26fk6.js";import"./chunk-rcfmwx8r.js";import"./chunk-se28p2xy.js";import"./chunk-t6qn1374.js";import"./chunk-prej5pk6.js";import"./chunk-m220n98m.js";import"./chunk-r4sawwmp.js";import"./chunk-n8s5301s.js";import"./chunk-myynywry.js";import"./chunk-vh1d5eqk.js";import"./chunk-bsq9zg9j.js";import"./chunk-n7s4n62j.js";import"./chunk-hk98vptc.js";import"./chunk-rprewgyj.js";import"./chunk-7g9vd5fv.js";import"./chunk-7r7j7vwt.js";import"./chunk-hmydy949.js";import"./chunk-gs6wc7sr.js";import"./chunk-w8p1y4c0.js";import"./chunk-tb56j1zt.js";import"./chunk-7nz28a6c.js";import"./chunk-76679dw7.js";import"./chunk-eazvp48w.js";import"./chunk-qw9kgzb3.js";import"./chunk-pes27snj.js";import"./chunk-3nxe5xmy.js";import{Yt}from"./chunk-vtv7165t.js";import"./chunk-frk6rzrq.js";import"./chunk-afj19nsj.js";import"./chunk-19safa6y.js";import{Re,i}from"./chunk-0y2zzqsq.js";import"./chunk-g4e6egrr.js";import"./chunk-jt28zh50.js";import"./chunk-mmdfjmgk.js";import"./chunk-2qz891k4.js";import"./chunk-q9npggak.js";import"./chunk-tp2g09ca.js";import"./chunk-sgm6tg8h.js";import"./chunk-3m9vrhja.js";import{be}from"./chunk-30j6mbrf.js";import"./chunk-3kfbs0mw.js";import{ar,cr}from"./chunk-wz5m7ybz.js";import{ms,j,a}from"./chunk-q49ykyq9.js";import"./chunk-xsf7ax50.js";import"./chunk-yp6w740k.js";import"./chunk-5q9ss7ty.js";import"./chunk-3cn9y08d.js";import"./chunk-z8k3fx4r.js";import{m,Me}from"./chunk-0ggwm837.js";import"./chunk-bsgg8zzk.js";import"./chunk-gs373714.js";import"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-xgegyttg.js";import"./chunk-dh9aagwm.js";import"./chunk-j4snweyz.js";export{ms as buildWebComponents,cr as cacheTemplate,ar as checkCache,Yt as classifyAllScripts,vl as createMiddleware,wl as createRoute,j as defaultConfig,m as extractVariables,be as injectRouterScript,a as loadStxConfig,Me as processClientScript,i as processDirectives,Re as readMarkdownFile};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{at,ct,lt}from"./chunk-6ts3sthp.js";export{at as createContext,ct as updateContextStoryFiles,lt as updateContextTree};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{pl,fl,gl,pg,fg}from"./chunk-9s1qnf90.js";export{fl as auditBuildOutput,pl as auditConfig,gl as calculateAuditResult,fg as formatAuditResult,pg as runPwaAudit};
@@ -1,33 +0,0 @@
1
- // @bun
2
- import{k}from"./chunk-xgegyttg.js";import{A,_n}from"./chunk-89h4snzd.js";import{ln,w,x,C,Y}from"./chunk-0ggwm837.js";import{a}from"./chunk-q49ykyq9.js";import{Te,en,tn,nn}from"./chunk-frk6rzrq.js";import{yt}from"./chunk-3m9vrhja.js";import{ft,Bn,Kt,ce}from"./chunk-kb8654dp.js";import{T,Ar}from"./chunk-t4mpq6t0.js";import b from"path";var y=new Map,N=new Map,D=w(64),E=new Map,X=["composables","functions"];function z(t){let n=b.basename(t,".ts");return n==="index"||n==="types"||t.endsWith(".d.ts")}async function Z(t){if(t)return b.resolve(t);let n=`<default>:${process.cwd()}`,i=E.get(n);if(i!==void 0)return i;let e=await q();if(e!==null)E.set(n,e);return e}async function q(){let t=await a(),n=t.root||process.cwd(),i=t.composablesDir;if(i)return b.resolve(n,i);for(let e of X){let s=b.resolve(n,e);try{let d=new Bun.Glob("**/*.ts");for await(let c of d.scan({cwd:s,absolute:!0}))if(!z(c))return s}catch{}}return null}async function G(t){let n=Array.isArray(t)?t:t?[b.resolve(t)]:(await a())._layerComposableDirs??[await Z()].filter((e)=>!!e),i=new Map;for(let e of n){let s=new Bun.Glob("**/*.ts");try{for await(let d of s.scan({cwd:e,absolute:!0})){let c=b.relative(e,d);if(!z(d)&&!i.has(c))i.set(c,d)}}catch{}}return{key:n.join("\x00"),files:[...i.values()].sort()}}async function po(t){let{files:n}=await G(t),i=Y({loader:"ts",target:"browser",define:C()}),e=[];for(let s of n)try{let d=await Bun.file(s).text(),c=i.scan(d).exports.filter((m)=>m!=="default");if(c.length>0)e.push({file:s,names:c})}catch{}return e}function Q(t,n){return new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function J(t,n){let i=new Set(t.match(/\w+/g)),e=new Set;for(let s of n)if(/^\w+$/.test(s)?i.has(s):Q(t,s))e.add(s);return e}var U=w(64);function V(t,n){let i=x(t,n.size),e=U.get(i);if(e)return e;let s;try{s=ln(t,n)}catch{s=J(t,n)}let d=[...t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...t.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let c of d)for(let m of c[1].split(",")){let p=m.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(p&&n.has(p))s.add(p)}return U.set(i,s),s}function ee(t,n,i){let e=new Map;for(let{file:u,names:l}of t)for(let f of l)if(!e.has(f))e.set(f,u);let s=(u)=>{let l=[];for(let f of J(u,e.keys()))l.push(e.get(f));return l},d=new Set(e.keys()),c=(u)=>{let l=[];for(let f of V(u,d))l.push(e.get(f));return l},m=new Set,p=i.flatMap((u,l)=>l===0?s(u):c(u));while(p.length>0){let u=[];for(let l of p){if(m.has(l))continue;m.add(l);for(let f of c(n.get(l)??""))if(!m.has(f))u.push(f)}p=u}return m}async function qm(t,n,i){let{key:e,files:s}=await G(t);if(!e)return null;let d=()=>[...new Set([...s,...s.flatMap((o)=>Te(o))])],c=ft(d());if(s.length===0)return ce(y,e,c,""),null;s.sort();let m=Y({loader:"ts",target:"browser",define:C()}),p=Kt(N,e,c);if(!p){let o=new Map,r=[];for(let g of s)try{let h=await Bun.file(g).text();o.set(g,h);let _=m.scan(h).exports.filter((W)=>W!=="default");if(_.length>0)r.push({file:g,names:_})}catch{o.set(g,"")}p=ce(N,e,c,{codeByFile:o,modules:r})}let{codeByFile:u,modules:l}=p,f;if(n===void 0)f=new Set(s);else{let o=i?[n,...i]:[n],r=x(o.join("\x00"),e,o.length,c),g=D.get(r);if(f=g??ee(l,u,o),!g)D.set(r,f)}if(f.size===0)return null;let I=s.filter((o)=>f.has(o)),v=`${e}\x00${I.join("\x00")}\x00${tn()}`,F=Kt(y,v,c);if(F!==void 0)return F||null;let B=[],S=new Set,R=new Set;for(let o of I)try{let r=u.get(o)??await Bun.file(o).text(),g=b.basename(o,".ts");for(let _ of r.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(_[1])R.add(_[1]);let h=[];try{for(let _ of m.scan(r).exports)if(_!=="default")S.add(_),h.push(_)}catch{}if(r=A(r),en(r))r=await nn(r,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:h}),r=yt(r);r=_n(r),r=r.replace(/^export\s+(default\s+)?/gm,""),r=m.transformSync(r),B.push(`// Composable: ${g}
3
- ${r.trim()}`)}catch(r){console.warn(`[stx] Failed to load composable ${o}:`,r)}if(B.length===0||S.size===0)return ce(y,v,c,""),null;let L=[...S].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
4
- `),j=JSON.stringify([...S]),M=B.join(`
5
-
6
- `),H=k.filter((o)=>!R.has(o)&&new RegExp(`\\b${o}\\b`).test(M)).map((o)=>`var ${o} = __stx[${JSON.stringify(o)}];`).join(`
7
- `),P=JSON.stringify(new Bun.CryptoHasher("md5").update(`${j}\x00${M}`).digest("hex").slice(0,12)),K=`;(function(){
8
- var __bundles = window.__stxComposableBundles || (window.__stxComposableBundles = {});
9
- if (__bundles[${P}]) return;
10
- __bundles[${P}] = true;
11
- var __published = window.__stxComposableGlobals || (window.__stxComposableGlobals = {});
12
- window.__composables = window.__composables || {};
13
- var __c = window.__composables;
14
- var __stx = window.stx || {};
15
- ${H}
16
- ${M}
17
- ${L}
18
- var __names = ${j};
19
- for (var __i = 0; __i < __names.length; __i++) {
20
- var __n = __names[__i];
21
- if (!(__n in __c) || __published[__n]) continue;
22
- var __takenByBuiltin = !!(window.stx && __n in window.stx);
23
- if (__takenByBuiltin || __n in window) {
24
- console.warn('[stx] composable "' + __n + '" is not available as a bare identifier: '
25
- + (__takenByBuiltin ? 'a built-in of that name already exists' : 'window already defines that property')
26
- + '. Rename it, or use: import { ' + __n + ' } from "@composables"');
27
- continue;
28
- }
29
- window[__n] = __c[__n];
30
- __published[__n] = true;
31
- }
32
- })();`,O=T()?Ar(K):K;return c=ft(d()),ce(y,v,c,O),O}function Km(){y.clear(),Bn(),N.clear(),D.clear(),E.clear()}
33
- export{po,qm,Km};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Ti,$i,Ri,Sg,kg,_g,hl,Cg,Eg}from"./chunk-dh9aagwm.js";export{Ti as ImageProcessorCache,hl as applyTransformations,Sg as clearImageCache,Cg as generateResponsiveVariants,Eg as generateSrcset,$i as getCachedImageResult,_g as optimizeImage,kg as processImage,Ri as setCachedImageResult};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Ig}from"./chunk-5vmbycy5.js";import"./chunk-se28p2xy.js";import"./chunk-vtv7165t.js";import"./chunk-afj19nsj.js";import"./chunk-tp2g09ca.js";import"./chunk-30j6mbrf.js";import"./chunk-q49ykyq9.js";import"./chunk-xsf7ax50.js";import"./chunk-yp6w740k.js";import"./chunk-5q9ss7ty.js";import"./chunk-3cn9y08d.js";import"./chunk-z8k3fx4r.js";import"./chunk-0ggwm837.js";import"./chunk-bsgg8zzk.js";import"./chunk-gs373714.js";import"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-xgegyttg.js";export{Ig as startProductionServer};
@@ -1,16 +0,0 @@
1
- // @bun
2
- import{k}from"./chunk-xgegyttg.js";import{A,_n}from"./chunk-89h4snzd.js";import{C,Y}from"./chunk-0ggwm837.js";import{a}from"./chunk-q49ykyq9.js";import{Te,en,tn,nn}from"./chunk-frk6rzrq.js";import{yt}from"./chunk-3m9vrhja.js";import{ft,Bn,Kt,ce}from"./chunk-kb8654dp.js";import{T,Ar}from"./chunk-t4mpq6t0.js";import S from"path";function U(c,n){for(let t of c.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(t[1])n.add(t[1]);for(let t of c.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let e of(t[1]??"").split(",")){let s=((e.includes(":")?e.split(":").pop():e)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(s))n.add(s)}for(let t of c.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let e of(t[1]??"").split(",")){let r=e.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}}var h=new Map;async function v(c,n=T()){let t;if(c)t=S.resolve(c);else{let l=await a();t=S.resolve(l.root||process.cwd(),l.storesDir||"stores")}let e=`${t}\x00${tn()}\x00${n?"shared":"inline"}`,r=new Bun.Glob("*.ts"),s=[];try{for await(let l of r.scan({cwd:t,absolute:!0})){let o=S.basename(l,".ts");if(["index","types"].includes(o))continue;if(l.includes(".d.ts"))continue;s.push(l)}}catch{return ce(h,e,"",{chunks:[]}),null}let i=()=>[...new Set([...s,...s.flatMap((l)=>Te(l))])],f=ft(i()),d=Kt(h,e,f);if(d!==void 0)return d.chunks.length>0?d:null;if(s.length===0)return ce(h,e,f,{chunks:[]}),null;let m=[];for(let l of s){let o=await Bun.file(l).text();m.push({file:l,hasUseStore:/useStore\s*\(/.test(o)})}m.sort((l,o)=>{if(l.hasUseStore===o.hasUseStore)return 0;return l.hasUseStore?1:-1});let g=m.map((l)=>l.file),u=[],p=Y({loader:"ts",target:"browser",define:C()});for(let l of g)try{let o=await Bun.file(l).text(),b=S.basename(l,".ts"),x=new Set;U(o,x);let _=[...o.matchAll(/\bdefineStore\s*(?:<[^>()]*>)?\(\s*(['"`])([^'"`$\\]+)\1/g)].map((R)=>R[2]),M=o.match(/\bdefineStore\s*(?:<[^>()]*>)?\(/g)?.length??0;if(en(o))o=await nn(o,l,{projectRoot:process.cwd(),externalizeUserModules:n});o=yt(o),o=A(o),o=_n(o),o=o.replace(/^export\s+(default\s+)?/gm,""),o=p.transformSync(o),u.push({name:b,ids:_.length===M?_:[],declared:x,code:`// Store: ${b}
3
- ${o.trim()}`})}catch(o){console.warn(`[stx] Failed to load store ${l}:`,o)}if(u.length===0)return ce(h,e,f,{chunks:[]}),null;f=ft(i());let w={chunks:u};return ce(h,e,f,w),w}function E(c){let n=new Set;for(let s of c)for(let i of s.declared)n.add(i);let t=c.map((s)=>s.code).join(`
4
-
5
- `),r=`;(function(){
6
- var __stx = window.stx || {};
7
- ${k.filter((s)=>!n.has(s)&&new RegExp(`\\b${s}\\b`).test(t)).map((s)=>`var ${s} = __stx[${JSON.stringify(s)}];`).join(`
8
- `)}
9
- ${t}
10
- })();`;return T()?Ar(r):r}function B(c){let n=new Set;for(let t of c.matchAll(/^(?:export\s+)?(?:async\s+)?(?:const|let|var|function\*?|class)\s+([A-Z_a-z$][\w$]*)/gm))n.add(t[1]);for(let t of c.matchAll(/^(?:const|let|var)\s*[{[]([^=]*)[}\]]\s*=/gm))for(let e of(t[1]??"").split(",")){let r=(e.includes(":")?e.split(":").pop():e).replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}return n}function I(c){let n=c.map((t)=>B(t.code));for(let[t,e]of c.entries())for(let[r,s]of n.entries()){if(r===t)continue;for(let i of s){if(n[t].has(i)||e.declared.has(i))continue;if(new RegExp(`(?<![\\w$.])${i.replace(/\$/g,"\\$")}(?![\\w$])`).test(e.code))return null}}return c.map((t,e)=>{let r=new Set([...t.declared,...n[e]]);return`function() {
11
- var __stx = window.stx || {};
12
- ${k.filter((i)=>!r.has(i)&&new RegExp(`\\b${i}\\b`).test(t.code)).map((i)=>`var ${i} = __stx[${JSON.stringify(i)}];`).join(`
13
- `)}
14
- ${t.code}
15
- }`})}var y=new WeakMap;async function Vm(c){let n=await v(c);if(!n)return null;let t=y.get(n);if(t===void 0)t=E(n.chunks),y.set(n,t);return t}function pa(...c){let n=new Set,t=!1;for(let e of c){if(!e)continue;if(/__STX_STORES__|\b_stores\b/.test(e))t=!0;let r=e.match(/\buseStore\s*(?:<[^>()]*>)?\(/g)?.length??0;if(r===0)continue;let s=0;for(let i of e.matchAll(/\buseStore\s*(?:<[^>()]*>)?\(\s*(['"`])([^'"`$\\]+)\1\s*[,)]/g))n.add(i[2]),s++;if(s!==r)t=!0}return{names:n,all:t}}async function Um(c,n,t={}){let e=await v(c,t.sharedModules);if(!e)return null;let{chunks:r}=e,s=pa(...n),i;if(s.all||r.some((f)=>f.ids.length===0))i=r;else{let f=new Map;for(let u of r)for(let p of u.ids)f.set(p,u);let d=new Set,m=[...s.names],g=!1;while(m.length>0&&!g){let u=f.get(m.pop());if(!u||d.has(u))continue;d.add(u);let p=pa(u.code);if(p.all)g=!0;else m.push(...p.names)}i=g?r:r.filter((u)=>d.has(u))}if(i.length===0)return null;return{code:E(i),stores:i.map((f)=>f.name),functions:I(i)}}function Wm(){h.clear(),Bn()}
16
- export{Vm,pa,Um,Wm};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Em,Tm,$m,Rm,Am}from"./chunk-gs6wc7sr.js";export{Tm as createSSRSuspense,Rm as generateSuspenseCSS,Am as generateSuspenseRuntime,Em as processSuspenseDirectives,$m as renderSSRSuspense};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Fg}from"./chunk-rcfmwx8r.js";import"./chunk-se28p2xy.js";import"./chunk-eazvp48w.js";import"./chunk-vtv7165t.js";import"./chunk-afj19nsj.js";import"./chunk-0y2zzqsq.js";import"./chunk-g4e6egrr.js";import"./chunk-jt28zh50.js";import"./chunk-mmdfjmgk.js";import"./chunk-2qz891k4.js";import"./chunk-q9npggak.js";import"./chunk-tp2g09ca.js";import"./chunk-sgm6tg8h.js";import"./chunk-3m9vrhja.js";import"./chunk-30j6mbrf.js";import"./chunk-3kfbs0mw.js";import"./chunk-wz5m7ybz.js";import"./chunk-q49ykyq9.js";import"./chunk-xsf7ax50.js";import"./chunk-yp6w740k.js";import"./chunk-5q9ss7ty.js";import"./chunk-3cn9y08d.js";import"./chunk-z8k3fx4r.js";import"./chunk-0ggwm837.js";import"./chunk-bsgg8zzk.js";import"./chunk-gs373714.js";import"./chunk-465resq9.js";import"./chunk-89h4snzd.js";import"./chunk-xgegyttg.js";export{Fg as buildForProduction};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ho,xa,Sa,oh}from"./chunk-ztdjdxjt.js";export{ho as NATIVE_COMPONENTS,xa as compileToNative,Sa as createHotReloadServer,oh as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Ro}from"./chunk-jt28zh50.js";export{Ro as warnUnbalancedTags};