@stacksjs/stx 0.2.875 → 0.2.880

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 (276) hide show
  1. package/dist/{chunk-fdjx4vs3.js → chunk-00tq7ghn.js} +2 -2
  2. package/dist/{chunk-nv4c25zj.js → chunk-02qmvcmv.js} +3 -3
  3. package/dist/chunk-08cb7cyw.js +2 -0
  4. package/dist/chunk-0h1dyd38.js +2 -0
  5. package/dist/{chunk-4m11kcxz.js → chunk-0m4c42qt.js} +10 -10
  6. package/dist/{chunk-6ykfy7eh.js → chunk-19k15mfc.js} +2 -2
  7. package/dist/chunk-1avy0p8v.js +2 -0
  8. package/dist/chunk-1jk46ve0.js +2 -0
  9. package/dist/chunk-1r612xxs.js +2 -0
  10. package/dist/chunk-1z6rrqvm.js +2 -0
  11. package/dist/chunk-2d68p12e.js +2 -0
  12. package/dist/chunk-2haf7t5h.js +2 -0
  13. package/dist/{chunk-1q5w3xav.js → chunk-2r0nrvqe.js} +2 -2
  14. package/dist/chunk-3jp5z1qj.js +2 -0
  15. package/dist/{chunk-644ckv6e.js → chunk-3q0w0bzd.js} +10 -10
  16. package/dist/{chunk-eknm4jrm.js → chunk-3sema2js.js} +2 -2
  17. package/dist/{chunk-vznf808n.js → chunk-3wb82rxw.js} +5 -5
  18. package/dist/chunk-3zds0gmd.js +2 -0
  19. package/dist/{chunk-qnwd5bz4.js → chunk-463weehv.js} +1 -1
  20. package/dist/{chunk-wm029dh0.js → chunk-4fkcn6z5.js} +18 -12
  21. package/dist/{chunk-976kgb3r.js → chunk-4n45qa0b.js} +9 -9
  22. package/dist/chunk-4pjqj54a.js +2 -0
  23. package/dist/{chunk-9anqwafq.js → chunk-4r2rfdmr.js} +5 -5
  24. package/dist/{chunk-ft6em3wm.js → chunk-50cnypys.js} +6 -6
  25. package/dist/chunk-53cc06w7.js +2 -0
  26. package/dist/{chunk-y2e2zm6y.js → chunk-57q4nvs9.js} +3 -3
  27. package/dist/{chunk-3mz9bdf7.js → chunk-59er0fc7.js} +3 -3
  28. package/dist/{chunk-dw0ttj6p.js → chunk-5eftxrvv.js} +2 -2
  29. package/dist/chunk-5p3825qw.js +2 -0
  30. package/dist/chunk-5rd0an89.js +2 -0
  31. package/dist/{chunk-pk714ynv.js → chunk-69ezjc8k.js} +4 -4
  32. package/dist/{chunk-75v0yxeh.js → chunk-6c1vm6bs.js} +2 -2
  33. package/dist/{chunk-d3q0cg47.js → chunk-6df3j3qq.js} +3 -3
  34. package/dist/{chunk-kzc2tqzr.js → chunk-6t04tqvh.js} +2 -2
  35. package/dist/chunk-78zgmqhd.js +2 -0
  36. package/dist/chunk-7bsrnpmh.js +33 -0
  37. package/dist/chunk-7dq6ebvp.js +2 -0
  38. package/dist/chunk-7kqgp3p7.js +2 -0
  39. package/dist/{chunk-wzvdr4ta.js → chunk-7mcs59pr.js} +2 -2
  40. package/dist/chunk-83b9k17j.js +2 -0
  41. package/dist/chunk-86nsbxep.js +61 -0
  42. package/dist/{chunk-0g2mg8cw.js → chunk-8e1cv1hh.js} +3 -3
  43. package/dist/chunk-8h5nje66.js +2 -0
  44. package/dist/{chunk-ae8q4gze.js → chunk-8va3fs07.js} +5 -5
  45. package/dist/{chunk-fnjm3xbf.js → chunk-93jhfbeg.js} +6 -6
  46. package/dist/{chunk-xmws1gaf.js → chunk-94ctmp0j.js} +2 -2
  47. package/dist/chunk-97kgrevs.js +4 -0
  48. package/dist/{chunk-qvrew79n.js → chunk-9cbf0seq.js} +2 -2
  49. package/dist/{chunk-mce3g2wb.js → chunk-9f31gs4m.js} +2 -2
  50. package/dist/chunk-9kza7gxd.js +2 -0
  51. package/dist/{chunk-b4d4tjvx.js → chunk-a0q0kb0s.js} +5 -5
  52. package/dist/chunk-a5gnxdfe.js +2 -0
  53. package/dist/chunk-a60ztvnp.js +3 -0
  54. package/dist/{chunk-s7fhpkvf.js → chunk-a7ryj8z8.js} +6 -6
  55. package/dist/{chunk-gqtb53s8.js → chunk-aaea157p.js} +2 -2
  56. package/dist/{chunk-wp0qpa50.js → chunk-agd2b928.js} +59 -27
  57. package/dist/chunk-aqxh80vh.js +2 -0
  58. package/dist/{chunk-az5rh7fs.js → chunk-awp8a3t4.js} +2 -2
  59. package/dist/chunk-axra1yas.js +2 -0
  60. package/dist/chunk-az8b0726.js +21 -0
  61. package/dist/chunk-b7d3n4aw.js +2 -0
  62. package/dist/{chunk-r2bxjna3.js → chunk-c0g30cjs.js} +2 -2
  63. package/dist/{chunk-jt5tzddc.js → chunk-c73c0wf9.js} +2 -2
  64. package/dist/{chunk-88xayf21.js → chunk-cad7e5q1.js} +9 -9
  65. package/dist/{chunk-bjjfr7qt.js → chunk-care745q.js} +2 -2
  66. package/dist/chunk-ce0zbpr5.js +2 -0
  67. package/dist/chunk-cjv89tnb.js +20 -0
  68. package/dist/chunk-cv1vm1w0.js +2 -0
  69. package/dist/{chunk-mw0rb1sf.js → chunk-czcx3nbx.js} +6 -6
  70. package/dist/chunk-d7b30bg6.js +2 -0
  71. package/dist/{chunk-stn7p7f1.js → chunk-dwyhpbpx.js} +2 -2
  72. package/dist/{chunk-y75bds1g.js → chunk-e362e615.js} +30 -30
  73. package/dist/{chunk-ydppkb8y.js → chunk-e41pgmgk.js} +2 -2
  74. package/dist/{chunk-6az66mrc.js → chunk-ec5q4nnw.js} +66 -66
  75. package/dist/{chunk-0h6r7nvn.js → chunk-egjmb32c.js} +126 -71
  76. package/dist/{chunk-q7zc78az.js → chunk-ew3vs3jq.js} +8 -8
  77. package/dist/{chunk-jqxerj6k.js → chunk-ezna4dhj.js} +2 -2
  78. package/dist/chunk-f3j1h3ch.js +2 -0
  79. package/dist/{chunk-vmssv78v.js → chunk-f7znj9xg.js} +3 -3
  80. package/dist/chunk-fz4c5e9m.js +2 -0
  81. package/dist/{chunk-esjr9qhe.js → chunk-g2xy0z0e.js} +2 -2
  82. package/dist/{chunk-fy6ts0n4.js → chunk-g83ph305.js} +2 -2
  83. package/dist/{chunk-kywe0f1v.js → chunk-gbncp2gp.js} +2 -2
  84. package/dist/chunk-gm67jt8p.js +2 -0
  85. package/dist/chunk-gmp10259.js +2 -0
  86. package/dist/{chunk-0sa9gqmc.js → chunk-h2tq6cbr.js} +11 -11
  87. package/dist/chunk-h3fv0q25.js +2 -0
  88. package/dist/{chunk-r09kz9bf.js → chunk-h63ma36g.js} +2 -2
  89. package/dist/chunk-hkx51atf.js +2 -0
  90. package/dist/{chunk-95hbmv7k.js → chunk-hmntqqyd.js} +7 -7
  91. package/dist/{chunk-3w7gacva.js → chunk-hxhmhw23.js} +3 -3
  92. package/dist/chunk-jghpzx5m.js +2 -0
  93. package/dist/chunk-k206d3pn.js +2 -0
  94. package/dist/chunk-k40e0ete.js +4 -0
  95. package/dist/chunk-k6c5t9we.js +38 -0
  96. package/dist/{chunk-f4vgagjb.js → chunk-kee5a3ce.js} +3 -3
  97. package/dist/chunk-kn9tqjgv.js +25 -0
  98. package/dist/chunk-kna1bdm2.js +54 -0
  99. package/dist/{chunk-a5yb8w7s.js → chunk-mygsektn.js} +3 -3
  100. package/dist/chunk-nb6erf75.js +9 -0
  101. package/dist/chunk-ngzyzcrp.js +2 -0
  102. package/dist/{chunk-3f9wctns.js → chunk-nysbdr4r.js} +2 -2
  103. package/dist/chunk-p55a910x.js +1198 -0
  104. package/dist/chunk-p6hcrg3r.js +3 -0
  105. package/dist/chunk-p746twww.js +2 -0
  106. package/dist/chunk-pa2vt2ej.js +2 -0
  107. package/dist/chunk-pa6kgbmw.js +2 -0
  108. package/dist/{chunk-saqzk45g.js → chunk-pdprhg5k.js} +1 -1
  109. package/dist/chunk-pjjrx9pk.js +2 -0
  110. package/dist/{chunk-g7qpnmbm.js → chunk-pm4rpc4a.js} +23 -23
  111. package/dist/chunk-pt3rp3zg.js +2 -0
  112. package/dist/{chunk-4517hny7.js → chunk-q1mb0fbt.js} +2 -2
  113. package/dist/{chunk-k1ew643q.js → chunk-q74affc4.js} +2 -2
  114. package/dist/chunk-qd9v1v8z.js +2 -0
  115. package/dist/chunk-qfwk93fk.js +2 -0
  116. package/dist/chunk-qg1kw5yf.js +2 -0
  117. package/dist/chunk-qn6y5ttj.js +2 -0
  118. package/dist/chunk-qxcc0aar.js +2 -0
  119. package/dist/{chunk-rzd9hyhv.js → chunk-ram5944w.js} +2 -2
  120. package/dist/{chunk-p5m1z6e1.js → chunk-rcxer2km.js} +4 -4
  121. package/dist/chunk-rdxph1tp.js +2 -0
  122. package/dist/chunk-rnrdngnn.js +2 -0
  123. package/dist/{chunk-x2ftkaz3.js → chunk-rsxxajv6.js} +2 -2
  124. package/dist/chunk-rw5sxr5a.js +2 -0
  125. package/dist/chunk-rzcdwybt.js +26 -0
  126. package/dist/chunk-s29hp1qw.js +14 -0
  127. package/dist/chunk-s7xywsqd.js +3 -0
  128. package/dist/{chunk-d6gqh2wv.js → chunk-satrf398.js} +1 -1
  129. package/dist/{chunk-zn6n075d.js → chunk-shcnt6aa.js} +3 -3
  130. package/dist/{chunk-ysfgabpf.js → chunk-sn4ndpd7.js} +3 -3
  131. package/dist/{chunk-zc8a2erc.js → chunk-ssg6ne5b.js} +4 -4
  132. package/dist/{chunk-afxfkb60.js → chunk-sv7fdqmc.js} +6 -6
  133. package/dist/chunk-swz0xprw.js +2 -0
  134. package/dist/chunk-t8r40wgf.js +2 -0
  135. package/dist/{chunk-dbvsa5ya.js → chunk-t94y8g35.js} +2 -2
  136. package/dist/{chunk-g33ycxe3.js → chunk-t9hxyvvc.js} +5 -5
  137. package/dist/{chunk-cmh0bfkb.js → chunk-tgzs1kbj.js} +5 -5
  138. package/dist/chunk-tka73egx.js +2 -0
  139. package/dist/{chunk-xtaq95em.js → chunk-v1s838fe.js} +1 -1
  140. package/dist/chunk-v3747589.js +12 -0
  141. package/dist/chunk-v9h2bbhf.js +2 -0
  142. package/dist/chunk-v9mxhch2.js +2 -0
  143. package/dist/chunk-vm42j29z.js +2 -0
  144. package/dist/chunk-w2kdhm7k.js +2 -0
  145. package/dist/chunk-w5zzwe2f.js +2 -0
  146. package/dist/chunk-wbmx0rge.js +2 -0
  147. package/dist/chunk-wjafpvjv.js +2 -0
  148. package/dist/chunk-ws2h92mm.js +3 -0
  149. package/dist/chunk-ws9kr80x.js +2 -0
  150. package/dist/{chunk-45rzd16g.js → chunk-xf0xacc9.js} +44 -44
  151. package/dist/chunk-xhr35ctb.js +2 -0
  152. package/dist/chunk-xmmr0916.js +2 -0
  153. package/dist/{chunk-yxdhz4ps.js → chunk-xpbakn6t.js} +2 -2
  154. package/dist/chunk-xz4v9tg1.js +3 -0
  155. package/dist/chunk-y7e61pz3.js +3 -0
  156. package/dist/{chunk-v0tdg16k.js → chunk-ybjgnnyf.js} +5 -5
  157. package/dist/chunk-yh2hnt3m.js +12 -0
  158. package/dist/{chunk-w6pzkcjp.js → chunk-ymqm898x.js} +2 -2
  159. package/dist/{chunk-2zaatnnh.js → chunk-yp4tn4zn.js} +4 -4
  160. package/dist/chunk-z7k1xn6k.js +2 -0
  161. package/dist/{chunk-t4g3ka8c.js → chunk-z9ffr9gy.js} +7 -7
  162. package/dist/{chunk-nnp6rf4c.js → chunk-zch65qrd.js} +1 -1
  163. package/dist/{chunk-pbakxcv8.js → chunk-zek9t5za.js} +2 -2
  164. package/dist/cli.js +23 -23
  165. package/dist/client/signals-dom-ready-runtime.js +6 -0
  166. package/dist/client/signals-mount-runtime.js +1 -1
  167. package/dist/client-module-registry.js +10 -4
  168. package/dist/client-parameter-bindings.d.ts +5 -0
  169. package/dist/client-parameter-bindings.js +47 -6
  170. package/dist/client-script-bundler.js +4 -3
  171. package/dist/component-library.d.ts +1 -0
  172. package/dist/component-library.js +42 -14
  173. package/dist/composable-loader.js +19 -9
  174. package/dist/craft-entry.js +2 -2
  175. package/dist/craft.js +2 -2
  176. package/dist/html-masking.d.ts +2 -0
  177. package/dist/html-masking.js +10 -0
  178. package/dist/inherited-context.d.ts +1 -1
  179. package/dist/inherited-context.js +43 -14
  180. package/dist/module-syntax.d.ts +2 -0
  181. package/dist/module-syntax.js +21 -0
  182. package/dist/native-component-context.js +44 -17
  183. package/dist/page-module-order.d.ts +10 -0
  184. package/dist/page-module-order.js +139 -0
  185. package/dist/process.js +6 -4
  186. package/dist/pwa.js +3 -3
  187. package/dist/script-attributes.d.ts +4 -0
  188. package/dist/script-attributes.js +10 -0
  189. package/dist/ssg.js +39 -39
  190. package/dist/strip-literals.d.ts +2 -0
  191. package/dist/strip-literals.js +12 -6
  192. package/dist/stx-virtual-ts.d.ts +1 -0
  193. package/dist/stx-virtual-ts.js +21 -27
  194. package/dist/typecheck.js +8 -0
  195. package/package.json +5 -5
  196. package/dist/chunk-003ph86a.js +0 -2
  197. package/dist/chunk-027meh1k.js +0 -2
  198. package/dist/chunk-0bc3mwqd.js +0 -2
  199. package/dist/chunk-0gv2mmr0.js +0 -2
  200. package/dist/chunk-0j8zre1m.js +0 -2
  201. package/dist/chunk-0qwbhv3f.js +0 -33
  202. package/dist/chunk-1gfg6qmr.js +0 -2
  203. package/dist/chunk-1tqp2s13.js +0 -2
  204. package/dist/chunk-1y7kfp5d.js +0 -2
  205. package/dist/chunk-1ztp5vkh.js +0 -3
  206. package/dist/chunk-24e4dapm.js +0 -2
  207. package/dist/chunk-2qb9kp21.js +0 -25
  208. package/dist/chunk-32wvc376.js +0 -2
  209. package/dist/chunk-3te2y9qf.js +0 -2
  210. package/dist/chunk-447jc6zc.js +0 -2
  211. package/dist/chunk-51ymssz5.js +0 -2
  212. package/dist/chunk-6dz5za5z.js +0 -2
  213. package/dist/chunk-6ezt9kbe.js +0 -54
  214. package/dist/chunk-6grkdknk.js +0 -2
  215. package/dist/chunk-6q9a5bph.js +0 -2
  216. package/dist/chunk-6rqef7wp.js +0 -2
  217. package/dist/chunk-72p5annm.js +0 -33
  218. package/dist/chunk-74x6j229.js +0 -4
  219. package/dist/chunk-7j11vgm1.js +0 -3
  220. package/dist/chunk-7ngfcdv9.js +0 -2
  221. package/dist/chunk-7njy024g.js +0 -2
  222. package/dist/chunk-9e3ggwk7.js +0 -2
  223. package/dist/chunk-9mz2n39m.js +0 -2
  224. package/dist/chunk-a262spx7.js +0 -2
  225. package/dist/chunk-a8wn0snv.js +0 -2
  226. package/dist/chunk-af6m1s2b.js +0 -3
  227. package/dist/chunk-b1tcym2x.js +0 -2
  228. package/dist/chunk-b61dq7pz.js +0 -12
  229. package/dist/chunk-bdh73gxd.js +0 -4
  230. package/dist/chunk-bs7g6jtt.js +0 -2
  231. package/dist/chunk-bspj1rf1.js +0 -2
  232. package/dist/chunk-bx3hpsxn.js +0 -2
  233. package/dist/chunk-byq488g4.js +0 -2
  234. package/dist/chunk-c8pzj57b.js +0 -2
  235. package/dist/chunk-e2b2f502.js +0 -2
  236. package/dist/chunk-ec6mrad6.js +0 -2
  237. package/dist/chunk-eh2gec79.js +0 -2
  238. package/dist/chunk-em31p5pb.js +0 -2
  239. package/dist/chunk-eqfsw6x4.js +0 -2
  240. package/dist/chunk-ey1vwfpc.js +0 -24
  241. package/dist/chunk-fa57bncd.js +0 -2
  242. package/dist/chunk-fk79jbzn.js +0 -2
  243. package/dist/chunk-g97krv0d.js +0 -2
  244. package/dist/chunk-gn16yq49.js +0 -2
  245. package/dist/chunk-gvs61tqn.js +0 -2
  246. package/dist/chunk-h2928108.js +0 -2
  247. package/dist/chunk-hd5bny2c.js +0 -2
  248. package/dist/chunk-j1ytbd6r.js +0 -1184
  249. package/dist/chunk-jm7qa3v3.js +0 -2
  250. package/dist/chunk-jmjgj3nh.js +0 -2
  251. package/dist/chunk-jqtpzzz4.js +0 -12
  252. package/dist/chunk-kq8mffgf.js +0 -2
  253. package/dist/chunk-kx06jzdw.js +0 -2
  254. package/dist/chunk-n344ss97.js +0 -2
  255. package/dist/chunk-n5pvdrkb.js +0 -2
  256. package/dist/chunk-ne8q191s.js +0 -2
  257. package/dist/chunk-np8wgbsa.js +0 -3
  258. package/dist/chunk-p4e8myzj.js +0 -17
  259. package/dist/chunk-pp99rmjm.js +0 -72
  260. package/dist/chunk-pqmjeea6.js +0 -2
  261. package/dist/chunk-q0k2gmva.js +0 -2
  262. package/dist/chunk-qggwr60r.js +0 -2
  263. package/dist/chunk-qm3v4qb7.js +0 -2
  264. package/dist/chunk-qrn1nza9.js +0 -2
  265. package/dist/chunk-qty0t69x.js +0 -2
  266. package/dist/chunk-rzadf7vx.js +0 -20
  267. package/dist/chunk-snz2cxqv.js +0 -2
  268. package/dist/chunk-ts37jw3s.js +0 -2
  269. package/dist/chunk-vnrbjbrw.js +0 -3
  270. package/dist/chunk-wkb7dhp7.js +0 -2
  271. package/dist/chunk-wxyqp6g9.js +0 -2
  272. package/dist/chunk-x76qvq1n.js +0 -2
  273. package/dist/chunk-y4hn1qh0.js +0 -2
  274. package/dist/chunk-yc8ggeh2.js +0 -2
  275. package/dist/chunk-ydy0tfar.js +0 -2
  276. package/dist/chunk-yfed67yc.js +0 -2
package/dist/ssg.js CHANGED
@@ -1,50 +1,50 @@
1
1
  // @bun
2
- import"./chunk-mce3g2wb.js";import{k,vl}from"./chunk-pp99rmjm.js";import"./chunk-fdjx4vs3.js";import"./chunk-3w7gacva.js";import{Dt,w}from"./chunk-j1ytbd6r.js";import"./chunk-kzc2tqzr.js";import"./chunk-6ykfy7eh.js";import"./chunk-r09kz9bf.js";import{Rt,At,Pt,It,Ot,Nt}from"./chunk-wp0qpa50.js";import{a}from"./chunk-6az66mrc.js";import{Ns}from"./chunk-0sa9gqmc.js";import"./chunk-zc8a2erc.js";import"./chunk-cmh0bfkb.js";import{ke,cn,ln}from"./chunk-rzadf7vx.js";import"./chunk-dw0ttj6p.js";import{x}from"./chunk-644ckv6e.js";import{kt,i}from"./chunk-0h6r7nvn.js";import"./chunk-88xayf21.js";import"./chunk-6ezt9kbe.js";import{xs}from"./chunk-4m11kcxz.js";import"./chunk-2qb9kp21.js";import"./chunk-r2bxjna3.js";import{pc,fc,gc}from"./chunk-3mz9bdf7.js";import{on,or,ir}from"./chunk-vnrbjbrw.js";import{an}from"./chunk-qvrew79n.js";import"./chunk-7j11vgm1.js";import"./chunk-dbvsa5ya.js";import{Q,Ee}from"./chunk-95hbmv7k.js";import"./chunk-xtaq95em.js";import"./chunk-a5yb8w7s.js";import{l}from"./chunk-np8wgbsa.js";import{n,se}from"./chunk-jqtpzzz4.js";import{f}from"./chunk-yxdhz4ps.js";import R from"fs";import m from"path";import{createHash as vt}from"crypto";function $t(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Et=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Ct(t){return Bun.hash(t).toString(16)}function ct(t,r={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,o=t.replace(Et,(e,u,g,v)=>{let S=v.trim();if(!S)return e;if(/\bdata-stx-src=/.test(g))return e;if(r.minify)S=$t(S);let p=Ct(S);if(!s.has(p))s.set(p,S);let P=r.integrity?` data-stx-integrity="sha384-${vt("sha384").update(S).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),c=Array.from(s,([e,u])=>({hash:e,code:u}));return{html:o,chunks:c}}var Bt=new Set(["visible","idle"]);function lt(t){if(!t.includes("data-stx-src="))return t;let r=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=s.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=w(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(c.size===0||v===-1)return t;let S=Array.from(c).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!S)return t;return t.slice(0,v)+S+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 s=/^https?:\/\//i.test(r)?r:`https://${r}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function Ft(t){for(let r of jt){let s=t[r];if(!s)continue;let o=X(s);if(o)return{url:o,source:"env",via:r}}return null}function ut(t){if(!t||typeof t!=="object")return null;let r=t,s=r.site?.url??r.url??r.app?.url;return typeof s==="string"?X(s):null}async function Tt(t){let{existsSync:r}=await import("fs"),s=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(t,o);if(!r(c))continue;try{let e=await import(c),u=ut(e.default??e);if(u)return u}catch{}}return null}async function dt(t={}){let r=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let u=X(t.explicit);if(u)return{url:u,source:"option"}}let o=ut(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let c=await Tt(r);if(c)return{url:c,source:"site.config",via:"url"};let e=Ft(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function gt(){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 Lt;function Ut(t){let r=n(t),{depths:s}=se(r),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,c;while((c=o.exec(r))!==null){if(s[c.index]!==0)continue;let u=k(r,"(",")",o.lastIndex-1),g=r.indexOf("{",u+1),v=k(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(s[c.index]!==0)continue;let u=vl(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 pt(t){let r="read";try{let s=await Bun.file(t).text();r="parse";let o=an(s),c=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(n(e.attrs))).sort((e,u)=>s.indexOf(e.fullTag)-s.indexOf(u.fullTag));for(let e of c){if(!/\bgetStaticPaths\b/.test(n(e.content)))continue;let u=(Lt??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(n(u)))continue;let g=Ut(u);if(/\bdefineStaticPaths\b/.test(n(g))&&Dt(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 S=await v();r="result";let p=Array.isArray(S)?{paths:S}:S;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(s){return{kind:"error",phase:r,error:s instanceof Error?s:Error(String(s))}}}class ft{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,r=""){this.cacheDir=t,this.salt=r}async load(){if(this.loaded)return;let t=m.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let r=JSON.parse(await Bun.file(t).text());for(let[s,o]of Object.entries(r))this.cache.set(s,o)}catch{}this.loaded=!0}async save(){await R.promises.mkdir(this.cacheDir,{recursive:!0});let t=m.join(this.cacheDir,"build-cache.json"),r={};for(let[s,o]of this.cache)r[s]=o;await Bun.write(t,JSON.stringify(r))}getHash(t,r){let s=R.statSync(t),o=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of r)if(R.existsSync(e)){let u=R.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 s=this.cache.get(t);if(!s)return null;let o=mt(r).some((u)=>R.existsSync(u)),c=[r,...s.dependencies??[]].some((u)=>u.endsWith(".stx")&&R.existsSync(u)&&xs(R.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||c)return this.cache.delete(t),null;let e=this.getHash(r,s.dependencies??[]);if(s.hash!==e)return this.cache.delete(t),null;return s.html}set(t,r,s,o){let c=this.getHash(r,s);this.cache.set(t,{hash:c,html:o,generatedAt:Date.now(),dependencies:s})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let r=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return m.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 s=this.getFilePath(t);await R.promises.mkdir(m.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(r))}async invalidate(t){let r=this.getFilePath(t);if(await Bun.file(r).exists())await R.promises.unlink(r)}async invalidatePattern(t){let r=m.join(this.cacheDir,"isr");if(!R.existsSync(r))return;let s=await R.promises.readdir(r);for(let o of s){let c=o.replace(/_/g,"/").replace(".json","");if(t.test(c))await R.promises.unlink(m.join(r,o))}}async needsRevalidation(t){let r=await this.get(t);if(!r)return!0;return Date.now()>r.revalidateAfter}}async function _t(t){let r=[];if(!t.isDynamic)r.push({url:t.pattern,params:{}});else{let s=await pt(t.filePath);if(s.kind==="error")throw Error(`getStaticPaths ${s.phase} failed for ${t.pattern} (${t.filePath}): ${s.error.message}`,{cause:s.error});if(s.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),r;let o=s.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 s=await import(r);if(typeof s.default==="function")return await s.default();else if(typeof s.default==="object")return s.default;else if(typeof s.getData==="function")return await s.getData();else{let{default:o,...c}=s;return c}}catch(s){console.error(`Error loading data file ${r}:`,s)}return null}async function Gt(t,r,s){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-s29hp1qw.js";import"./chunk-a60ztvnp.js";import"./chunk-9f31gs4m.js";import{k,Tl}from"./chunk-86nsbxep.js";import"./chunk-00tq7ghn.js";import"./chunk-hxhmhw23.js";import{zt,w}from"./chunk-p55a910x.js";import"./chunk-6t04tqvh.js";import"./chunk-19k15mfc.js";import"./chunk-h63ma36g.js";import{Mt,Dt,Lt,jt,Bt,Ft}from"./chunk-agd2b928.js";import{a}from"./chunk-ec5q4nnw.js";import{Fs}from"./chunk-h2tq6cbr.js";import"./chunk-ssg6ne5b.js";import"./chunk-tgzs1kbj.js";import{Ce,gn,mn}from"./chunk-cjv89tnb.js";import"./chunk-5eftxrvv.js";import{x}from"./chunk-3q0w0bzd.js";import{Rt,i}from"./chunk-egjmb32c.js";import"./chunk-cad7e5q1.js";import"./chunk-kna1bdm2.js";import{Ts}from"./chunk-0m4c42qt.js";import"./chunk-kn9tqjgv.js";import"./chunk-c0g30cjs.js";import{vc,xc,Sc}from"./chunk-59er0fc7.js";import{pn,ur,dr}from"./chunk-p6hcrg3r.js";import{fn}from"./chunk-9cbf0seq.js";import"./chunk-xz4v9tg1.js";import"./chunk-t94y8g35.js";import{ne,$e}from"./chunk-hmntqqyd.js";import"./chunk-v1s838fe.js";import"./chunk-nb6erf75.js";import"./chunk-mygsektn.js";import{l}from"./chunk-s7xywsqd.js";import{et}from"./chunk-ws2h92mm.js";import{t,C}from"./chunk-yh2hnt3m.js";import{f}from"./chunk-xpbakn6t.js";import R from"fs";import m from"path";import{createHash as Pt}from"crypto";function $t(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}var kt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Et(e){return Bun.hash(e).toString(16)}function lt(e,n={}){if(!e.includes('type="stx/island"'))return{html:e,chunks:[]};let s=new Map,o=e.replace(kt,(r,u,g,v)=>{let S=v.trim();if(!S)return r;if(/\bdata-stx-src=/.test(g))return r;if(n.minify)S=$t(S);let p=Et(S);if(!s.has(p))s.set(p,S);let P=n.integrity?` data-stx-integrity="sha384-${Pt("sha384").update(S).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),c=Array.from(s,([r,u])=>({hash:r,code:u}));return{html:o,chunks:c}}var Ct=new Set(["visible","idle"]);function ut(e){if(!e.includes("data-stx-src="))return e;let n=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=s.exec(e))!==null)n.set(o[1],o[2]);let c=new Set,r=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=r.exec(e))!==null)if(Ct.has(n.get(u[1])||""))c.add(u[2]);let g=/<\/head\s*>/iy,v=w(e,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(c.size===0||v===-1)return e;let S=Array.from(c).filter((p)=>!e.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!S)return e;return e.slice(0,v)+S+e.slice(v)}var It=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function Y(e){let n=e.trim();if(!n)return null;let s=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function Tt(e){for(let n of It){let s=e[n];if(!s)continue;let o=Y(s);if(o)return{url:o,source:"env",via:n}}return null}function dt(e){if(!e||typeof e!=="object")return null;let n=e,s=n.site?.url??n.url??n.app?.url;return typeof s==="string"?Y(s):null}async function At(e){let{existsSync:n}=await import("fs"),s=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(e,o);if(!n(c))continue;try{let r=await import(c),u=dt(r.default??r);if(u)return u}catch{}}return null}async function gt(e={}){let n=e.cwd??process.cwd(),s=e.env??process.env;if(e.explicit){let u=Y(e.explicit);if(u)return{url:u,source:"option"}}let o=dt(e.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let c=await At(n);if(c)return{url:c,source:"site.config",via:"url"};let r=Tt(s);if(r)return r;return{url:"http://localhost",source:"fallback"}}function pt(){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 V(e){return async()=>({paths:await e(),fallback:!1})}var Ot;function Ut(e){let n=t(e),{depths:s}=C(n),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,c;while((c=o.exec(n))!==null){if(s[c.index]!==0)continue;let u=k(n,"(",")",o.lastIndex-1),g=n.indexOf("{",u+1),v=k(n,"{","}",g);if(u<0||g<0||v<0)break;return e.slice(c.index,v+1)}let r=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((c=r.exec(n))!==null){if(s[c.index]!==0)continue;let u=Tl(n,r.lastIndex).endPos;return e.slice(r.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function ft(e){let n="read";try{let s=await Bun.file(e).text();n="parse";let o=fn(s),c=[...o.server,...o.client,...o.signals].filter((r)=>/(?:^|\s)server(?:\s|=|$)/i.test(t(r.attrs))).sort((r,u)=>s.indexOf(r.fullTag)-s.indexOf(u.fullTag));for(let r of c){if(!/\bgetStaticPaths\b/.test(t(r.content)))continue;let u=(Ot??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(r.content);if(!/\bgetStaticPaths\b/.test(t(u)))continue;let g=Ut(u);if(/\bdefineStaticPaths\b/.test(t(g))&&zt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let v=Function("defineStaticPaths",`return (${g})`)(V);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let S=await v();n="result";let p=Array.isArray(S)?{paths:S}:S;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(s){return{kind:"error",phase:n,error:s instanceof Error?s:Error(String(s))}}}class ht{cacheDir;cache=new Map;loaded=!1;salt;constructor(e,n=""){this.cacheDir=e,this.salt=n}async load(){if(this.loaded)return;let e=m.join(this.cacheDir,"build-cache.json");if(await Bun.file(e).exists())try{let n=JSON.parse(await Bun.file(e).text());for(let[s,o]of Object.entries(n))this.cache.set(s,o)}catch{}this.loaded=!0}async save(){await R.promises.mkdir(this.cacheDir,{recursive:!0});let e=m.join(this.cacheDir,"build-cache.json"),n={};for(let[s,o]of this.cache)n[s]=o;await Bun.write(e,JSON.stringify(n))}getHash(e,n){let s=R.statSync(e),o=`${this.salt}|${e}:${s.mtimeMs}`;for(let r of n)if(R.existsSync(r)){let u=R.statSync(r);o+=`:${r}:${u.mtimeMs}`}let c=0;for(let r=0;r<o.length;r++){let u=o.charCodeAt(r);c=(c<<5)-c+u,c=c&c}return Math.abs(c).toString(36)}get(e,n){let s=this.cache.get(e);if(!s)return null;let o=wt(n).some((u)=>R.existsSync(u)),c=[n,...s.dependencies??[]].some((u)=>u.endsWith(".stx")&&R.existsSync(u)&&Ts(R.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||c)return this.cache.delete(e),null;let r=this.getHash(n,s.dependencies??[]);if(s.hash!==r)return this.cache.delete(e),null;return s.html}set(e,n,s,o){let c=this.getHash(n,s);this.cache.set(e,{hash:c,html:o,generatedAt:Date.now(),dependencies:s})}}class mt{cacheDir;constructor(e){this.cacheDir=e}getFilePath(e){let n=e.replace(/[^a-zA-Z0-9]/g,"_")+".json";return m.join(this.cacheDir,"isr",n)}async get(e){let n=this.getFilePath(e);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(e,n){let s=this.getFilePath(e);await R.promises.mkdir(m.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(n))}async invalidate(e){let n=this.getFilePath(e);if(await Bun.file(n).exists())await R.promises.unlink(n)}async invalidatePattern(e){let n=m.join(this.cacheDir,"isr");if(!R.existsSync(n))return;let s=await R.promises.readdir(n);for(let o of s){let c=o.replace(/_/g,"/").replace(".json","");if(e.test(c))await R.promises.unlink(m.join(n,o))}}async needsRevalidation(e){let n=await this.get(e);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function _t(e){let n=[];if(!e.isDynamic)n.push({url:e.pattern,params:{}});else{let s=await ft(e.filePath);if(s.kind==="error")throw Error(`getStaticPaths ${s.phase} failed for ${e.pattern} (${e.filePath}): ${s.error.message}`,{cause:s.error});if(s.kind==="absent")return console.warn(`Warning: Dynamic route ${e.pattern} (${e.filePath}) has no getStaticPaths`),n;let o=s.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${e.pattern} (${e.filePath})`),n;for(let c of o.paths){let r=e.pattern;for(let[u,g]of Object.entries(c.params))r=r.replace(`:${u}`,g).replace(`:${u}*`,g);n.push({url:r,params:c.params,props:c.props,revalidate:c.revalidate})}}return n}function wt(e){return[e.replace(/\.stx$/,".data.ts"),e.replace(/\.stx$/,".data.js"),e+".data.ts",e+".data.js"]}async function Gt(e){for(let n of wt(e))if(await Bun.file(n).exists())try{let s=await import(n);if(typeof s.default==="function")return await s.default();else if(typeof s.default==="object")return s.default;else if(typeof s.getData==="function")return await s.getData();else{let{default:o,...c}=s;return c}}catch(s){console.error(`Error loading data file ${n}:`,s)}return null}async function Ht(e,n,s){let o=e.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 r=c.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!r)return null;return await Function("params",`
4
4
  return (async function getStaticProps() {
5
- ${e[1]}
5
+ ${r[1]}
6
6
  })()
7
- `)(r)}catch(e){return console.error(`Error executing getStaticProps in ${s}:`,e),null}}function Ht(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,s={},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||{},...s,params:r,$route:{path:t.pattern,params:r}},S=new Set,p=[],P=[],C={...c,minifyClient:!0,...o.partialsDir?{partialsDir:o.partialsDir}:{},...o.componentsDir?{componentsDir:o.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(E)=>{p.push(`${m.relative(process.cwd(),E.templatePath)}: ${E.message}
8
- resolved against partialsDir: ${E.partialsDir}`)},onServerScriptError:(E)=>{P.push(`${m.relative(process.cwd(),E.sourcePath)} (${E.kind}): ${E.message}`)}};if(Ht(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,C,S);for(let E of[t.filePath,...S])for(let O of ke(E))S.add(O);if(Object.keys(r).length>0){let E=`<script>if(window.stx)window.stx._rp=${JSON.stringify(r)};else window.__stx_rp=${JSON.stringify(r)};</script>`;if(b.includes("</head>"))b=f(b,E);else b=`${E}
9
- ${b}`}if(b=await Ee(b,{router:o.router}),b=await x(b),o.minify!==!1)return{html:zt(b),dependencies:Array.from(S),includeFailures:p,serverScriptFailures:P};return{html:b,dependencies:Array.from(S),includeFailures:p,serverScriptFailures:P}}function zt(t){let r=[],s=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=o.exec(t))!==null){let u=t.slice(s,c.index);r.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=c[1],v=c[2],S=c[3];v=v.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),r.push(g+v+S),s=c.index+c[0].length}let e=t.slice(s);return r.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),r.join("").trim()}function Wt(t){let r=0;for(let s=0;s<t.length;s++){let o=t.charCodeAt(s);r=(r<<5)-r+o,r=r&r}return`"${Math.abs(r).toString(36)}"`}function qt(t,r,s,o){if(s?.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 Jt(t,r){return`<?xml version="1.0" encoding="UTF-8"?>
7
+ `)(n)}catch(r){return console.error(`Error executing getStaticProps in ${s}:`,r),null}}function Nt(e){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(e)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(e)}async function yt(e,n,s={},o,c){let r=await Bun.file(e.filePath).text(),u=await Gt(e.filePath),g=await Ht(r,n,e.filePath),v={...u||{},...g||{},...s,params:n,$route:{path:e.pattern,params:n}},S=new Set,p=[],P=[],I={...c,minifyClient:!0,...o.partialsDir?{partialsDir:o.partialsDir}:{},...o.componentsDir?{componentsDir:o.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(E)=>{p.push(`${m.relative(process.cwd(),E.templatePath)}: ${E.message}
8
+ resolved against partialsDir: ${E.partialsDir}`)},onServerScriptError:(E)=>{P.push(`${m.relative(process.cwd(),E.sourcePath)} (${E.kind}): ${E.message}`)}};if(Nt(r))console.warn(`Warning: ${e.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(r,v,e.filePath,I,S);for(let E of[e.filePath,...S])for(let L of Ce(E))S.add(L);if(Object.keys(n).length>0){let E=`<script>if(window.stx)window.stx._rp=${JSON.stringify(n)};else window.__stx_rp=${JSON.stringify(n)};</script>`;if(b.includes("</head>"))b=f(b,E);else b=`${E}
9
+ ${b}`}if(b=await $e(b,{router:o.router}),b=await x(b),o.minify!==!1)return{html:Wt(b),dependencies:Array.from(S),includeFailures:p,serverScriptFailures:P};return{html:b,dependencies:Array.from(S),includeFailures:p,serverScriptFailures:P}}function Wt(e){let n=[],s=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=o.exec(e))!==null){let u=e.slice(s,c.index);n.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=c[1],v=c[2],S=c[3];v=et(v).replace(/<\/script/gi,"<\\/script"),n.push(g+v+S),s=c.index+c[0].length}let r=e.slice(s);return n.push(r.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),n.join("").trim()}function qt(e){let n=0;for(let s=0;s<e.length;s++){let o=e.charCodeAt(s);n=(n<<5)-n+o,n=n&n}return`"${Math.abs(n).toString(36)}"`}function Jt(e,n,s,o){if(s?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(n))return!0;return o.some((c)=>{if(c instanceof RegExp)return c.test(e);return c.endsWith("/")?e===c.slice(0,-1)||e.startsWith(c):e===c})}function Vt(e,n){return`<?xml version="1.0" encoding="UTF-8"?>
10
10
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
11
- ${t.map((o)=>{let c=new URL(o.loc,r).href,e=` <url>
12
- <loc>${T(c)}</loc>`;if(o.lastmod)e+=`
13
- <lastmod>${o.lastmod}</lastmod>`;if(o.changefreq)e+=`
14
- <changefreq>${o.changefreq}</changefreq>`;if(o.priority!==void 0)e+=`
15
- <priority>${o.priority}</priority>`;return e+=`
16
- </url>`,e}).join(`
11
+ ${e.map((o)=>{let c=new URL(o.loc,n).href,r=` <url>
12
+ <loc>${A(c)}</loc>`;if(o.lastmod)r+=`
13
+ <lastmod>${o.lastmod}</lastmod>`;if(o.changefreq)r+=`
14
+ <changefreq>${o.changefreq}</changefreq>`;if(o.priority!==void 0)r+=`
15
+ <priority>${o.priority}</priority>`;return r+=`
16
+ </url>`,r}).join(`
17
17
  `)}
18
- </urlset>`}function T(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Vt(t,r){let s=r.map((o)=>{let c=" <item>";if(c+=`
19
- <title>${T(o.title)}</title>`,c+=`
20
- <link>${T(o.link)}</link>`,o.description)c+=`
21
- <description>${T(o.description)}</description>`;if(o.pubDate)c+=`
18
+ </urlset>`}function A(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Kt(e,n){let s=n.map((o)=>{let c=" <item>";if(c+=`
19
+ <title>${A(o.title)}</title>`,c+=`
20
+ <link>${A(o.link)}</link>`,o.description)c+=`
21
+ <description>${A(o.description)}</description>`;if(o.pubDate)c+=`
22
22
  <pubDate>${o.pubDate.toUTCString()}</pubDate>`;if(o.author)c+=`
23
- <author>${T(o.author)}</author>`;if(o.categories)for(let e of o.categories)c+=`
24
- <category>${T(e)}</category>`;if(o.guid)c+=`
25
- <guid>${T(o.guid)}</guid>`;return c+=`
23
+ <author>${A(o.author)}</author>`;if(o.categories)for(let r of o.categories)c+=`
24
+ <category>${A(r)}</category>`;if(o.guid)c+=`
25
+ <guid>${A(o.guid)}</guid>`;return c+=`
26
26
  </item>`,c});return`<?xml version="1.0" encoding="UTF-8"?>
27
27
  <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
28
28
  <channel>
29
- <title>${T(t.title)}</title>
30
- <link>${T(t.link)}</link>
31
- <description>${T(t.description)}</description>
32
- ${t.language?`<language>${t.language}</language>`:""}
33
- ${t.copyright?`<copyright>${T(t.copyright)}</copyright>`:""}
29
+ <title>${A(e.title)}</title>
30
+ <link>${A(e.link)}</link>
31
+ <description>${A(e.description)}</description>
32
+ ${e.language?`<language>${e.language}</language>`:""}
33
+ ${e.copyright?`<copyright>${A(e.copyright)}</copyright>`:""}
34
34
  <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
35
- <atom:link href="${t.link}/rss.xml" rel="self" type="application/rss+xml"/>
35
+ <atom:link href="${e.link}/rss.xml" rel="self" type="application/rss+xml"/>
36
36
  ${s.join(`
37
37
  `)}
38
38
  </channel>
39
- </rss>`}async function Kt(t={}){let r=Date.now();ln();let s=await a(process.cwd()),o=s.build||{},c=await dt({explicit:t.domain||o.domain,stxConfig:s});if(c.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(gt());let e={router:t.router??s?.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||s?.partialsDir||"",componentsDir:t.componentsDir||s?.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,S={},p={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&R.existsSync(e.outputDir))await R.promises.rm(e.outputDir,{recursive:!0});await R.promises.mkdir(e.outputDir,{recursive:!0});let C=e.cacheSalt;if(!C){let{resolveUserCssConfig:d,fingerprintConfig:y}=await import("./chunk-c8pzj57b.js");try{C=y(await d(process.cwd()))}catch{}}let{prepareImageDelivery:b}=await import("./chunk-qrn1nza9.js"),E=await b(e.publicDir,e.outputDir);if(E.count>0)console.log(`Optimized ${E.count} image(s) for responsive delivery`),C=[C,E.fingerprint].filter(Boolean).join(":");let O=new ft(e.cacheDir,C);if(e.cache)await O.load();try{let{generateCss:d}=await import("./chunk-c8pzj57b.js");await d('<div class="bg-black"></div>')}catch{}Rt();let yt=s?.routeMiddleware?.dir||"middleware";await Pt(process.cwd(),yt);let V=At();if(V.length>0)console.log(`Loaded ${V.length} middleware: ${V.join(", ")}`);let St=s?.routeMiddleware?.global||[];gc(s?.layoutsDir,l(process.cwd()));let Z=Q(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${Z.length} routes`);let U=[];for(let d of Z)try{let y=await _t(d);for(let D of y)U.push({route:d,url:D.url,params:D.params,props:D.props,revalidate:D.revalidate??e.revalidate})}catch(y){let D=y instanceof Error?y:Error(String(y));u.failedCount++,u.errors.push({route:d.pattern,error:D}),await e.hooks.onError?.(D,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,D)}u.totalPages=U.length+u.failedCount,console.log(`Generating ${U.length} pages...`);let _=[],tt=[];for(let d=0;d<U.length;d+=e.concurrency)tt.push(U.slice(d,d+e.concurrency));for(let d of tt)await Promise.all(d.map(async(y)=>{let{route:D,url:h,params:M,props:xt,revalidate:nt}=y;try{await e.hooks.onPageStart?.(h);let G=await Bun.file(D.filePath).text(),A=Zt(G),bt=A?.middleware?Array.isArray(A.middleware)?A.middleware:[A.middleware]:[],it=[...St,...bt];if(it.length>0){let j=It(h,M,A||{}),N=Ot(j,null,void 0,{isServer:!0}),F=await Nt(it,N);if(F.redirect){let I=typeof F.redirect==="string"?F.redirect:F.redirect.path||F.redirect,z=Qt(String(I),h),L=te(h,e);await R.promises.mkdir(m.dirname(L),{recursive:!0}),await Bun.write(L,z),u.successCount++,u.pages.push({route:h,outputPath:L,size:Buffer.byteLength(z),cached:!1}),_.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${I}`);return}if(F.abort){let I=typeof F.abort==="string"?F.abort:F.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${I}`);return}}let st=A?.validate;if(typeof st==="function")try{if(!await st({params:M})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let B=null,at=!1;if(e.cache){if(B=O.get(h,D.filePath),B)at=!0,u.cachedCount++}if(!B){let j=await wt(D,M,xt,e,s);if(B=j.html,e.failOnIncludeError&&j.includeFailures.length>0)throw Error(`${j.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
40
- ${j.includeFailures.join(`
39
+ </rss>`}async function Xt(e={}){let n=Date.now();mn();let s=await a(process.cwd()),o=s.build||{},c=await gt({explicit:e.domain||o.domain,stxConfig:s});if(c.source==="fallback"&&(e.sitemap??o.sitemap??!0))console.warn(pt());let r={router:e.router??s?.router??{},pagesDir:e.pagesDir||o.pagesDir||"pages",outputDir:e.outputDir||o.outputDir||"dist",baseUrl:e.baseUrl||o.baseUrl||"/",domain:c.url,revalidate:e.revalidate??o.revalidate??!1,sitemap:e.sitemap??o.sitemap??!0,sitemapExclude:e.sitemapExclude||o.sitemapExclude||[],robots:e.robots??o.robots??!0,rss:e.rss??o.rss??!1,concurrency:e.concurrency||o.concurrency||10,cache:e.cache??o.cache??!0,cacheDir:e.cacheDir||o.cacheDir||l(process.cwd(),"ssg-cache"),contentLoaders:e.contentLoaders||[],hooks:e.hooks||{},minify:e.minify??o.minify??!0,generate404:e.generate404??o.generate404??!0,publicDir:e.publicDir||o.publicDir||"public",trailingSlash:e.trailingSlash??o.trailingSlash??!1,cleanOutput:e.cleanOutput??o.cleanOutput??!0,cacheSalt:e.cacheSalt??"",partialsDir:e.partialsDir||s?.partialsDir||"",componentsDir:e.componentsDir||s?.componentsDir||"",failOnIncludeError:e.failOnIncludeError??!0,failOnServerScriptError:e.failOnServerScriptError??!0,chunkIslands:e.chunkIslands===!0,prefetchIslands:e.prefetchIslands===!0,integrityIslands:e.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},g=new Set,v=0,S={},p={};await r.hooks.onBuildStart?.();try{if(r.cleanOutput&&R.existsSync(r.outputDir))await R.promises.rm(r.outputDir,{recursive:!0});await R.promises.mkdir(r.outputDir,{recursive:!0});let I=r.cacheSalt;if(!I){let{resolveUserCssConfig:d,fingerprintConfig:y}=await import("./chunk-rdxph1tp.js");try{I=y(await d(process.cwd()))}catch{}}let{prepareImageDelivery:b}=await import("./chunk-qfwk93fk.js"),E=await b(r.publicDir,r.outputDir);if(E.count>0)console.log(`Optimized ${E.count} image(s) for responsive delivery`),I=[I,E.fingerprint].filter(Boolean).join(":");let L=new ht(r.cacheDir,I);if(r.cache)await L.load();try{let{generateCss:d}=await import("./chunk-rdxph1tp.js");await d('<div class="bg-black"></div>')}catch{}Mt();let St=s?.routeMiddleware?.dir||"middleware";await Lt(process.cwd(),St);let K=Dt();if(K.length>0)console.log(`Loaded ${K.length} middleware: ${K.join(", ")}`);let xt=s?.routeMiddleware?.global||[];Sc(s?.layoutsDir,l(process.cwd()));let Q=ne(".",{pagesDir:r.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${Q.length} routes`);let _=[];for(let d of Q)try{let y=await _t(d);for(let D of y)_.push({route:d,url:D.url,params:D.params,props:D.props,revalidate:D.revalidate??r.revalidate})}catch(y){let D=y instanceof Error?y:Error(String(y));u.failedCount++,u.errors.push({route:d.pattern,error:D}),await r.hooks.onError?.(D,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,D)}u.totalPages=_.length+u.failedCount,console.log(`Generating ${_.length} pages...`);let M=[],tt=[];for(let d=0;d<_.length;d+=r.concurrency)tt.push(_.slice(d,d+r.concurrency));for(let d of tt)await Promise.all(d.map(async(y)=>{let{route:D,url:h,params:G,props:bt,revalidate:it}=y;try{await r.hooks.onPageStart?.(h);let H=await Bun.file(D.filePath).text(),O=Qt(H),vt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],st=[...xt,...vt];if(st.length>0){let F=jt(h,G,O||{}),z=Bt(F,null,void 0,{isServer:!0}),T=await Ft(st,z);if(T.redirect){let B=typeof T.redirect==="string"?T.redirect:T.redirect.path||T.redirect,W=te(String(B),h),U=ee(h,r);await R.promises.mkdir(m.dirname(U),{recursive:!0}),await Bun.write(U,W),u.successCount++,u.pages.push({route:h,outputPath:U,size:Buffer.byteLength(W),cached:!1}),M.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${B}`);return}if(T.abort){let B=typeof T.abort==="string"?T.abort:T.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${B}`);return}}let at=O?.validate;if(typeof at==="function")try{if(!await at({params:G})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let j=null,ot=!1;if(r.cache){if(j=L.get(h,D.filePath),j)ot=!0,u.cachedCount++}if(!j){let F=await yt(D,G,bt,r,s);if(j=F.html,r.failOnIncludeError&&F.includeFailures.length>0)throw Error(`${F.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
40
+ ${F.includeFailures.join(`
41
41
  `)}
42
- Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&j.serverScriptFailures.length>0)throw Error(`${j.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
43
- ${j.serverScriptFailures.join(`
42
+ Set ssg.failOnIncludeError to false to build anyway.`);if(r.failOnServerScriptError&&F.serverScriptFailures.length>0)throw Error(`${F.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
43
+ ${F.serverScriptFailures.join(`
44
44
  `)}
45
- Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)O.set(h,D.filePath,j.dependencies,B)}let H;if(e.trailingSlash)H=m.join(e.outputDir,h,"index.html");else H=h==="/"?m.join(e.outputDir,"index.html"):m.join(e.outputDir,`${h}.html`);if(e.chunkIslands){let{html:j,chunks:N}=ct(B,{integrity:e.integrityIslands,minify:e.minify});if(N.length>0){let F=m.join(e.outputDir,"_stx","islands");await R.promises.mkdir(F,{recursive:!0});for(let I of N){let z=m.join(F,`${I.hash}.js`);if(!await Bun.file(z).exists())await Bun.write(z,I.code);if(!g.has(I.hash)){g.add(I.hash);let L=Buffer.byteLength(I.code,"utf8");v+=L,S[I.hash]={bytes:L,file:`/_stx/islands/${I.hash}.js`}}}if(p[h]=N.map((I)=>I.hash),B=j,e.prefetchIslands)B=lt(B)}}if(await R.promises.mkdir(m.dirname(H),{recursive:!0}),await Bun.write(H,B),!qt(h,B,A,e.sitemapExclude))_.push({loc:h,lastmod:new Date().toISOString().split("T")[0],priority:h==="/"?1:0.8});let ot={route:h,outputPath:H,size:Buffer.byteLength(B,"utf8"),cached:at};if(nt!==!1)ot.revalidateAt=Date.now()+nt*1000;u.pages.push(ot),u.successCount++,await e.hooks.onPageEnd?.(h,B)}catch(G){u.failedCount++,u.errors.push({route:h,error:G}),await e.hooks.onError?.(G,h),console.error(`Error generating ${h}:`,G)}}));let et=cn();if(et.length>0){let d=et.map((y)=>`${y.filePath}: ${y.message}`).join(`
45
+ Set ssg.failOnServerScriptError to false to build anyway.`);if(r.cache)L.set(h,D.filePath,F.dependencies,j)}let N;if(r.trailingSlash)N=m.join(r.outputDir,h,"index.html");else N=h==="/"?m.join(r.outputDir,"index.html"):m.join(r.outputDir,`${h}.html`);if(r.chunkIslands){let{html:F,chunks:z}=lt(j,{integrity:r.integrityIslands,minify:r.minify});if(z.length>0){let T=m.join(r.outputDir,"_stx","islands");await R.promises.mkdir(T,{recursive:!0});for(let B of z){let W=m.join(T,`${B.hash}.js`);if(!await Bun.file(W).exists())await Bun.write(W,B.code);if(!g.has(B.hash)){g.add(B.hash);let U=Buffer.byteLength(B.code,"utf8");v+=U,S[B.hash]={bytes:U,file:`/_stx/islands/${B.hash}.js`}}}if(p[h]=z.map((B)=>B.hash),j=F,r.prefetchIslands)j=ut(j)}}if(await R.promises.mkdir(m.dirname(N),{recursive:!0}),await Bun.write(N,j),!Jt(h,j,O,r.sitemapExclude))M.push({loc:h,lastmod:new Date().toISOString().split("T")[0],priority:h==="/"?1:0.8});let ct={route:h,outputPath:N,size:Buffer.byteLength(j,"utf8"),cached:ot};if(it!==!1)ct.revalidateAt=Date.now()+it*1000;u.pages.push(ct),u.successCount++,await r.hooks.onPageEnd?.(h,j)}catch(H){u.failedCount++,u.errors.push({route:h,error:H}),await r.hooks.onError?.(H,h),console.error(`Error generating ${h}:`,H)}}));let rt=gn();if(rt.length>0){let d=rt.map((y)=>`${y.filePath}: ${y.message}`).join(`
46
46
  `);throw Error(`Client script bundling failed:
47
- ${d}`)}if(e.cache)await O.save();if(e.generate404){let d=m.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let y=new Set,D={...s,minifyClient:!0,debug:!1,cache:!1},h=await i(await Bun.file(d).text(),{},d,D,y);await Bun.write(m.join(e.outputDir,"404.html"),h)}else await Bun.write(m.join(e.outputDir,"404.html"),`<!DOCTYPE html>
47
+ ${d}`)}if(r.cache)await L.save();if(r.generate404){let d=m.join(r.pagesDir,"404.stx");if(await Bun.file(d).exists()){let y=new Set,D={...s,minifyClient:!0,debug:!1,cache:!1},h=await i(await Bun.file(d).text(),{},d,D,y);await Bun.write(m.join(r.outputDir,"404.html"),h)}else await Bun.write(m.join(r.outputDir,"404.html"),`<!DOCTYPE html>
48
48
  <html lang="en">
49
49
  <head>
50
50
  <meta charset="UTF-8">
@@ -65,7 +65,7 @@ ${d}`)}if(e.cache)await O.save();if(e.generate404){let d=m.join(e.pagesDir,"404.
65
65
  <a href="/">Go home</a>
66
66
  </div>
67
67
  </body>
68
- </html>`)}for(let d of[500]){let y=m.join(e.pagesDir,`${d}.stx`);if(await Bun.file(y).exists()){let D=new Set,h={...s,minifyClient:!0,debug:!1,cache:!1},M=await i(await Bun.file(y).text(),{},y,h,D);await Bun.write(m.join(e.outputDir,`${d}.html`),M)}}let K=m.join(e.pagesDir,"error.stx");if(await Bun.file(K).exists()){let d=new Set,y={...s,minifyClient:!0,debug:!1,cache:!1},D=await i(await Bun.file(K).text(),{},K,y,d);await Bun.write(m.join(e.outputDir,"error.html"),D)}if(e.sitemap&&_.length>0){let d=Jt(_,e.domain),y=m.join(e.outputDir,"sitemap.xml");await Bun.write(y,d),u.sitemapPath=y,console.log(`Generated sitemap.xml with ${_.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},y=[...e.sitemapExclude.filter((h)=>typeof h==="string"),...d.disallow||[]],D=Ns({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...y.length>0?{disallow:y}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(m.join(e.outputDir,"robots.txt"),D),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},y=[];if(d.getItems)y=await d.getItems();let D=Vt(d,y),h=m.join(e.outputDir,"rss.xml");await Bun.write(h,D),u.rssPath=h,console.log(`Generated rss.xml with ${y.length} items`)}let W=pc(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=fc(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&&R.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let rt=ir();if(rt)await Y(rt,m.join(e.outputDir,or)),console.log(`Copied assets from ${on}`)}catch(C){throw await e.hooks.onError?.(C),C}if(u.buildTime=Date.now()-r,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let C={generatedChunks:g.size,totalBytes:v,chunks:S,pages:p};await Bun.write(m.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(C,null,2))}await e.hooks.onBuildEnd?.(u);let P=u.islandChunks?`
68
+ </html>`)}for(let d of[500]){let y=m.join(r.pagesDir,`${d}.stx`);if(await Bun.file(y).exists()){let D=new Set,h={...s,minifyClient:!0,debug:!1,cache:!1},G=await i(await Bun.file(y).text(),{},y,h,D);await Bun.write(m.join(r.outputDir,`${d}.html`),G)}}let X=m.join(r.pagesDir,"error.stx");if(await Bun.file(X).exists()){let d=new Set,y={...s,minifyClient:!0,debug:!1,cache:!1},D=await i(await Bun.file(X).text(),{},X,y,d);await Bun.write(m.join(r.outputDir,"error.html"),D)}if(r.sitemap&&M.length>0){let d=Vt(M,r.domain),y=m.join(r.outputDir,"sitemap.xml");await Bun.write(y,d),u.sitemapPath=y,console.log(`Generated sitemap.xml with ${M.length} URLs`)}if(r.robots!==!1){let d=typeof r.robots==="object"?r.robots:{},y=[...r.sitemapExclude.filter((h)=>typeof h==="string"),...d.disallow||[]],D=Fs({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...y.length>0?{disallow:y}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",r.domain).href}:{}});await Bun.write(m.join(r.outputDir,"robots.txt"),D),console.log("Generated robots.txt")}if(r.rss){let d=typeof r.rss==="object"?r.rss:{title:"Site Feed",description:"Latest updates",link:r.domain},y=[];if(d.getItems)y=await d.getItems();let D=Kt(d,y),h=m.join(r.outputDir,"rss.xml");await Bun.write(h,D),u.rssPath=h,console.log(`Generated rss.xml with ${y.length} items`)}let q=vc(r.outputDir);if(q.assets>0)console.log(`Externalized ${q.assets} asset(s) from ${q.pages} page(s) (${(q.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let J=xc(r.outputDir);if(J.assets>0)console.log(`Externalized ${J.assets} repeated asset(s) from ${J.pages} page(s) (${(J.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(r.publicDir&&R.existsSync(r.publicDir))await Z(r.publicDir,r.outputDir),console.log(`Copied public assets from ${r.publicDir}`);let nt=dr();if(nt)await Z(nt,m.join(r.outputDir,ur)),console.log(`Copied assets from ${pn}`)}catch(I){throw await r.hooks.onError?.(I),I}if(u.buildTime=Date.now()-n,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let I={generatedChunks:g.size,totalBytes:v,chunks:S,pages:p};await Bun.write(m.join(r.outputDir,"_stx","islands-manifest.json"),JSON.stringify(I,null,2))}await r.hooks.onBuildEnd?.(u);let P=u.islandChunks?`
69
69
  Island chunks: ${u.islandChunks.count} (${(u.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
70
70
  Build complete!
71
71
  Total: ${u.totalPages} pages
@@ -73,17 +73,17 @@ Build complete!
73
73
  Cached: ${u.cachedCount}
74
74
  Failed: ${u.failedCount}
75
75
  Time: ${u.buildTime}ms${P}
76
- `),u}async function Y(t,r){await R.promises.mkdir(r,{recursive:!0});let s=await R.promises.readdir(t,{withFileTypes:!0});for(let o of s){let c=m.join(t,o.name),e=m.join(r,o.name);if(o.isDirectory())await R.promises.mkdir(e,{recursive:!0}),await Y(c,e);else await R.promises.copyFile(c,e)}}function Xt(t={}){let r=t.cacheDir||l(process.cwd(),"ssg-cache"),s=new ht(r),o=t.revalidate||3600;return{async get(c){let e=await s.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=Q(".",{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,C)=>{v[P]=g[C+1]});let S=await a(),{html:p}=await wt(u,v,{},t,S);await s.set(c,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:Wt(p)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await s.invalidate(c);else await s.invalidatePattern(c)}}}function Yt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let r=await Bun.file(t).text(),s=r.match(/^---\n([\s\S]*?)\n---/),o={},c=r;if(s){let S=s[1];c=r.slice(s[0].length).trim();for(let p of S.split(`
77
- `)){let P=p.indexOf(":");if(P>0){let C=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((E)=>E.trim().replace(/^['"]|['"]$/g,""));o[C]=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 S=parseInt(v[1],10),p=v[2],P=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:p,level:S})}return{content:e,data:o,toc:u}}}}function Zt(t){return kt(t)}function Qt(t,r){return`<!DOCTYPE html>
76
+ `),u}async function Z(e,n){await R.promises.mkdir(n,{recursive:!0});let s=await R.promises.readdir(e,{withFileTypes:!0});for(let o of s){let c=m.join(e,o.name),r=m.join(n,o.name);if(o.isDirectory())await R.promises.mkdir(r,{recursive:!0}),await Z(c,r);else await R.promises.copyFile(c,r)}}function Yt(e={}){let n=e.cacheDir||l(process.cwd(),"ssg-cache"),s=new mt(n),o=e.revalidate||3600;return{async get(c){let r=await s.get(c);if(!r)return null;if(Date.now()>r.revalidateAfter)this.revalidate(c).catch(console.error);return{html:r.html,headers:{"Cache-Control":`public, max-age=${o}, stale-while-revalidate=${o*2}`,ETag:r.etag,"X-ISR-Generated":new Date(r.generatedAt).toISOString(),...r.headers}}},async revalidate(c){let u=ne(".",{pagesDir:e.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,I)=>{v[P]=g[I+1]});let S=await a(),{html:p}=await yt(u,v,{},e,S);await s.set(c,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:qt(p)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await s.invalidate(c);else await s.invalidatePattern(c)}}}function Zt(){return{name:"markdown",extensions:[".md",".mdx"],async load(e){let n=await Bun.file(e).text(),s=n.match(/^---\n([\s\S]*?)\n---/),o={},c=n;if(s){let S=s[1];c=n.slice(s[0].length).trim();for(let p of S.split(`
77
+ `)){let P=p.indexOf(":");if(P>0){let I=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((E)=>E.trim().replace(/^['"]|['"]$/g,""));o[I]=b}}}let r=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(r))!==null){let S=parseInt(v[1],10),p=v[2],P=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:p,level:S})}return{content:r,data:o,toc:u}}}}function Qt(e){return Rt(e)}function te(e,n){return`<!DOCTYPE html>
78
78
  <html>
79
79
  <head>
80
80
  <meta charset="utf-8">
81
- <meta http-equiv="refresh" content="0; url=${t}">
82
- <link rel="canonical" href="${t}">
81
+ <meta http-equiv="refresh" content="0; url=${e}">
82
+ <link rel="canonical" href="${e}">
83
83
  <title>Redirecting...</title>
84
84
  </head>
85
85
  <body>
86
- <p>Redirecting to <a href="${t}">${t}</a>...</p>
87
- <script>window.location.replace('${t}')</script>
86
+ <p>Redirecting to <a href="${e}">${e}</a>...</p>
87
+ <script>window.location.replace('${e}')</script>
88
88
  </body>
89
- </html>`}function te(t,r){if(t==="/"||t==="")return m.join(r.outputDir,"index.html");let s=t.replace(/^\/|\/$/g,"");if(r.trailingSlash)return m.join(r.outputDir,s,"index.html");return m.join(r.outputDir,`${s}.html`)}var Te={generateStaticSite:Kt,createISRHandler:Xt,defineStaticPaths:J,createMarkdownLoader:Yt};export{Xt as createISRHandler,Yt as createMarkdownLoader,Ht as declaresPageAction,Te as default,J as defineStaticPaths,Kt as generateStaticSite,qt as isExcludedFromSitemap};
89
+ </html>`}function ee(e,n){if(e==="/"||e==="")return m.join(n.outputDir,"index.html");let s=e.replace(/^\/|\/$/g,"");if(n.trailingSlash)return m.join(n.outputDir,s,"index.html");return m.join(n.outputDir,`${s}.html`)}var Oe={generateStaticSite:Xt,createISRHandler:Yt,defineStaticPaths:V,createMarkdownLoader:Zt};export{Yt as createISRHandler,Zt as createMarkdownLoader,Nt as declaresPageAction,Oe as default,V as defineStaticPaths,Xt as generateStaticSite,Jt as isExcludedFromSitemap};
@@ -25,6 +25,8 @@ export declare function findInterpolationEnd(code: string, start: number): numbe
25
25
  * undefined name.
26
26
  */
27
27
  export declare function stripCommentsAndLiterals(code: string): string;
28
+ /** Keep a literal terminator and template expression boundaries for binding scopes. */
29
+ export declare function stripBindingLiterals(code: string): string;
28
30
  /**
29
31
  * Bracket nesting at each index of already-stripped source, so a declaration
30
32
  * can be told apart from one nested inside a function, block or loop head.
@@ -124,6 +124,12 @@ function regexEnd(code, start) {
124
124
  return -1;
125
125
  }
126
126
  export function stripCommentsAndLiterals(code) {
127
+ return stripLiterals(code, !1);
128
+ }
129
+ export function stripBindingLiterals(code) {
130
+ return stripLiterals(code, !0);
131
+ }
132
+ function stripLiterals(code, bindingBoundaries) {
127
133
  let out = "", i = 0, lastSig = "", lastWord = "";
128
134
  while (i < code.length) {
129
135
  const two = code.slice(i, i + 2);
@@ -158,7 +164,7 @@ export function stripCommentsAndLiterals(code) {
158
164
  ` : " ";
159
165
  i++;
160
166
  }
161
- out += " ";
167
+ out += bindingBoundaries ? "$" : " ";
162
168
  i++;
163
169
  lastSig = LITERAL_END;
164
170
  lastWord = "";
@@ -175,7 +181,7 @@ export function stripCommentsAndLiterals(code) {
175
181
  }
176
182
  }
177
183
  if (ch === "`") {
178
- out += " ";
184
+ out += bindingBoundaries ? "(" : " ";
179
185
  i++;
180
186
  while (i < code.length && code[i] !== "`") {
181
187
  if (code[i] === "\\") {
@@ -185,10 +191,10 @@ export function stripCommentsAndLiterals(code) {
185
191
  }
186
192
  if (code[i] === "$" && code[i + 1] === "{") {
187
193
  const bodyStart = i + 2, bodyEnd = findInterpolationEnd(code, bodyStart);
188
- out += " ";
189
- out += stripCommentsAndLiterals(code.slice(bodyStart, bodyEnd));
194
+ out += bindingBoundaries ? " {" : " ";
195
+ out += stripLiterals(code.slice(bodyStart, bodyEnd), bindingBoundaries);
190
196
  if (bodyEnd < code.length)
191
- out += " ";
197
+ out += bindingBoundaries ? "}" : " ";
192
198
  i = bodyEnd + 1;
193
199
  continue;
194
200
  }
@@ -197,7 +203,7 @@ export function stripCommentsAndLiterals(code) {
197
203
  ` : " ";
198
204
  i++;
199
205
  }
200
- out += " ";
206
+ out += bindingBoundaries ? ")" : " ";
201
207
  i++;
202
208
  lastSig = LITERAL_END;
203
209
  lastWord = "";
@@ -462,6 +462,7 @@ export declare interface TemplateExpression {
462
462
  }
463
463
  /** A synthetic line's origin, for diagnostics that land outside the source. */
464
464
  export declare interface MappedLine {
465
+ anchor?: boolean
465
466
  diagnosticOrigin?: ScriptKind | 'component'
466
467
  line: number
467
468
  column: number
@@ -1,31 +1,29 @@
1
+ import { scanHtmlScriptElements } from "./html-masking.js";
2
+ import { scriptAttributes, scriptContainsCode } from "./script-attributes.js";
1
3
  import { BROWSER_CORE_IMPORTS } from "./browser-core-imports.js";
2
4
  import path from "node:path";
3
5
  import { declaresClientIdentifier } from "./client-declarations.js";
4
- import { unboundNames } from "./client-parameter-bindings.js";
6
+ import { topLevelDeclaredNames, unboundNames } from "./client-parameter-bindings.js";
5
7
  import { parseLoopBinding } from "./loop-binding.js";
6
8
  import { bracketDepths, stripCommentsAndLiterals } from "./strip-literals.js";
7
9
  import { STX_RUNTIME_GLOBALS } from "./runtime-globals.js";
8
10
  import { componentContractChecks } from "./component-contract-checks.js";
9
- import { inheritedContextBindings, inheritedContextChecks } from "./inherited-context.js";
11
+ import { inheritedContextBindings, inheritedContextChecks, inheritedContextContract } from "./inherited-context.js";
10
12
  import { nativeComponentContext, nativeComponentLoops } from "./native-component-context.js";
11
13
  import { collectSlotScopes } from "./slot-scopes.js";
12
- const SCRIPT_RE = /<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;
13
14
  function blankCommentContents(source) {
14
15
  const blank = (match) => match.replace(/[^\n]/g, " ");
15
16
  return source.replace(/<!--[\s\S]*?-->/g, blank).replace(/\{\{--[\s\S]*?--\}\}/g, blank);
16
17
  }
17
18
  export function extractScriptBlocks(source) {
18
19
  const blocks = [], scannable = blankCommentContents(source);
19
- SCRIPT_RE.lastIndex = 0;
20
- let match;
21
- while ((match = SCRIPT_RE.exec(scannable)) !== null) {
22
- const attrs = (match[1] || "").trim(), openLength = (match[0].match(/^<script(?:\s[^>]*)?>/i)?.[0] ?? "<script>").length, closeLength = (match[0].match(/<\/script\s*>$/i)?.[0] ?? "</script>").length, bodyStart = match.index + openLength, bodyEnd = match.index + match[0].length - closeLength, body = source.slice(bodyStart, bodyEnd);
23
- if (/\bsrc\s*=/.test(attrs) || /\b(?:stx:)?component\b/.test(attrs))
20
+ for (const script of scanHtmlScriptElements(scannable)) {
21
+ const attrs = script.attrs.trim(), attributes = scriptAttributes(attrs), { bodyStart, bodyEnd } = script, body = source.slice(bodyStart, bodyEnd);
22
+ if (attributes.has("src") || attributes.has("component") || attributes.has("stx:component"))
24
23
  continue;
25
- const typeMatch = attrs.match(/\btype\s*=\s*["']([^"']+)["']/i);
26
- if (typeMatch && !/^(?:module|text\/(?:javascript|typescript))$/i.test(typeMatch[1]))
24
+ if (!scriptContainsCode(attributes))
27
25
  continue;
28
- const kind = /\bserver\b/.test(attrs) ? "server" : /\bclient\b/.test(attrs) ? "client" : "plain", startLine = lineAt(source, bodyStart);
26
+ const kind = attributes.has("server") ? "server" : attributes.has("client") ? "client" : "plain", startLine = lineAt(source, bodyStart);
29
27
  blocks.push({ kind, code: body, startLine, startColumn: columnAt(source, bodyStart), offset: bodyStart, attrs });
30
28
  }
31
29
  return blocks;
@@ -431,20 +429,7 @@ export function collectTemplateBindings(source) {
431
429
  return [...bindings.values()].sort((a, b) => a.name.localeCompare(b.name));
432
430
  }
433
431
  export function collectBlockDeclarations(code) {
434
- const names = new Set;
435
- for (const m of code.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))
436
- names.add(m[1]);
437
- for (const m of code.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))
438
- names.add(m[1]);
439
- for (const m of code.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))
440
- names.add(m[1]);
441
- for (const m of code.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))
442
- for (const part of m[1].split(",")) {
443
- const name = part.split(":").pop().split("=")[0].replace(/^\.\.\./, "").trim();
444
- if (/^[A-Z_$][\w$]*$/i.test(name))
445
- names.add(name);
446
- }
447
- return [...names].sort();
432
+ return topLevelDeclaredNames(code);
448
433
  }
449
434
  const IMPORT_LINE_RE = /^\s*import\s[\s\S]*?(?:$|;)/;
450
435
  export function runtimeGlobalDeclarations() {
@@ -1017,6 +1002,15 @@ export function buildVirtualTypeScript(source, options = {}) {
1017
1002
  `));
1018
1003
  if (inheritedBindings)
1019
1004
  append(inheritedBindings);
1005
+ for (const block of blocks.filter((block) => block.kind === "server")) {
1006
+ const contract = inheritedContextContract(block.code);
1007
+ if (!contract?.unsupported)
1008
+ continue;
1009
+ const before = block.code.slice(0, contract.offset), line = block.startLine + before.split(`
1010
+ `).length - 1, column = contract.offset - block.code.lastIndexOf(`
1011
+ `, contract.offset - 1) + (line === block.startLine ? (block.startColumn ?? 1) - 1 : 0);
1012
+ append(`;({})[${JSON.stringify(contract.unsupported)}];`, { line, column, anchor: !0 });
1013
+ }
1020
1014
  if (inherited?.declarations)
1021
1015
  append(inherited.declarations);
1022
1016
  for (const declaration of scriptDeclarations)
@@ -1025,7 +1019,7 @@ export function buildVirtualTypeScript(source, options = {}) {
1025
1019
  append(component.declarations);
1026
1020
  if (options.nativeChecks !== !1)
1027
1021
  for (const check of component.checks)
1028
- append(check.text, { line: check.line, column: check.column, diagnosticOrigin: check.origin });
1022
+ append(check.text, { line: check.line, column: check.column, diagnosticOrigin: check.origin, anchor: !0 });
1029
1023
  }
1030
1024
  if (options.globals !== !1) {
1031
1025
  append("");
@@ -1154,7 +1148,7 @@ export function resolvePosition(virtual, line, column) {
1154
1148
  const mapped = virtual.lineMap.get(line);
1155
1149
  if (!mapped)
1156
1150
  return line <= virtual.sourceLineCount ? { line, column: resolveVirtualColumn(virtual, line, column) } : null;
1157
- const within = mapped.expression?.anchor ? 0 : Math.max(0, column - 1 - (mapped.prefixLength ?? 0));
1151
+ const within = mapped.anchor || mapped.expression?.anchor || mapped.diagnosticOrigin === "component" ? 0 : Math.max(0, column - 1 - (mapped.prefixLength ?? 0));
1158
1152
  return {
1159
1153
  line: mapped.line,
1160
1154
  column: mapped.column + within,
package/dist/typecheck.js CHANGED
@@ -43,6 +43,14 @@ export function buildScriptVirtualFile(block, serverCode = "", originDir = "", i
43
43
  `), ...(component?.declarations ?? "").split(`
44
44
  `), ...(block.kind === "server" ? inheritedContextBindings(block.code) : "").split(`
45
45
  `));
46
+ const inheritedContract = block.kind === "server" ? inheritedContextContract(block.code) : void 0;
47
+ if (inheritedContract?.unsupported) {
48
+ const before = block.code.slice(0, inheritedContract.offset), line = block.startLine + before.split(`
49
+ `).length - 1, column = inheritedContract.offset - block.code.lastIndexOf(`
50
+ `, inheritedContract.offset - 1) + (line === block.startLine ? (block.startColumn ?? 1) - 1 : 0);
51
+ lines.push(`;({})[${JSON.stringify(inheritedContract.unsupported)}];`);
52
+ lineMap.set(lines.length, { line, column, anchor: !0 });
53
+ }
46
54
  lines.push("export {}", "");
47
55
  const rewritten = rewriteRelativeSpecifiers(lines.join(`
48
56
  `), originDir);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.875",
4
+ "version": "0.2.880",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -127,14 +127,14 @@
127
127
  },
128
128
  "dependencies": {
129
129
  "@stacksjs/clapp": "^0.2.17",
130
- "@stacksjs/desktop": "0.2.875",
131
- "@stacksjs/sanitizer": "0.2.875",
130
+ "@stacksjs/desktop": "0.2.880",
131
+ "@stacksjs/sanitizer": "0.2.880",
132
132
  "@stacksjs/ts-css": "^0.3.21",
133
133
  "@stacksjs/ts-i18n": "^0.1.11",
134
134
  "@types/dom-speech-recognition": "^0.0.12",
135
- "bun-plugin-stx": "0.2.875",
135
+ "bun-plugin-stx": "0.2.880",
136
136
  "bunfig": "^0.15.21",
137
- "stx-router": "0.2.875",
137
+ "stx-router": "0.2.880",
138
138
  "ts-broadcasting": "^0.0.13",
139
139
  "ts-images": "^0.2.22",
140
140
  "ts-syntax-highlighter": "^0.2.1"
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{$n,Mi}from"./chunk-6ykfy7eh.js";import"./chunk-kzc2tqzr.js";export{Mi as generateRuntimeConfigTypes,$n as prepareRuntimeConfig};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{gi,mi,$t,be,vr,Ds,xr,Ms,Ls,cg,lg,ug,Sr,dg,pg,fg,gg,Fc,zc,Hc,hi,Vc,mg,Rt,At,Pt,It,Ot,Nt,at,hg}from"./chunk-wp0qpa50.js";export{xr as Router,fg as abortNavigation,Ds as bracketPathToRegex,Rt as clearMiddleware,zc as createClientCookieManager,Ot as createMiddlewareContext,It as createRouteLocation,Fc as createServerCookieManager,Hc as createStorageManager,gg as defineMiddleware,lg as defineRoute,ug as defineRoutes,Ms as findErrorPage,Ls as formatRoutes,mi as generateRouteManifest,gi as generateRouteTypes,Vc as getMiddleware,At as getMiddlewareNames,at as getRouterScript,hg as getRouterScriptDev,mg as hasMiddleware,$t as isFileRequestPath,Pt as loadMiddlewareFromDirectory,vr as matchRoute,pg as navigateTo,be as patternToRegex,hi as registerMiddleware,dg as resetRoutes,Sr as route,Nt as runMiddleware,cg as setAppUrl};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Fa,za,Ha,Va,Hh}from"./chunk-g7qpnmbm.js";import"./chunk-y75bds1g.js";import"./chunk-g33ycxe3.js";import"./chunk-f4vgagjb.js";import"./chunk-0h6r7nvn.js";import"./chunk-644ckv6e.js";import"./chunk-6ezt9kbe.js";import"./chunk-r2bxjna3.js";import"./chunk-88xayf21.js";import"./chunk-7j11vgm1.js";import"./chunk-2qb9kp21.js";import"./chunk-dbvsa5ya.js";import"./chunk-4m11kcxz.js";import"./chunk-95hbmv7k.js";import"./chunk-xtaq95em.js";import"./chunk-dw0ttj6p.js";import"./chunk-6az66mrc.js";import"./chunk-a5yb8w7s.js";import"./chunk-r09kz9bf.js";import"./chunk-zc8a2erc.js";import"./chunk-0sa9gqmc.js";import"./chunk-wp0qpa50.js";import"./chunk-j1ytbd6r.js";import"./chunk-6ykfy7eh.js";import"./chunk-kzc2tqzr.js";import"./chunk-pp99rmjm.js";import"./chunk-3w7gacva.js";import"./chunk-fdjx4vs3.js";export{Fa as buildNative,Hh as default,za as findCraftBinary,Va as getAvailableFormats,Ha as getAvailableTargets};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{kn,bg,wg,vg,xg,Sg,h,kg,Ri,_g,cl,ll}from"./chunk-j1ytbd6r.js";import"./chunk-6ykfy7eh.js";import"./chunk-kzc2tqzr.js";import"./chunk-pp99rmjm.js";import"./chunk-3w7gacva.js";import"./chunk-fdjx4vs3.js";export{kn as STX_ENGINE_BINDING_NAMES,Ri as convertToCommonJS,cl as extractScriptFromTemplate,h as extractVariables,ll as hasVariables,kg as isCompleteImport,Sg as isMissingBindingFailure,vg as isModuleResolutionFailure,xg as isSyntaxFailure,_g as splitDeclaration,bg as stripTypeScript,wg as withoutStxReferrer};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ui,di,pi,fi,Is,Os,dy,py,fy,gy,Ns,my}from"./chunk-0sa9gqmc.js";import"./chunk-pp99rmjm.js";export{my as generateDefaultRobotsTxt,Ns as generateRobotsTxt,py as generateSitemap,fy as generateSitemapIndex,fi as injectSeoTags,Is as metaDirective,ui as processMetaDirectives,pi as processSeoDirective,di as processStructuredData,dy as registerSeoDirectives,gy as scanForSitemapEntries,Os as structuredDataDirective};
@@ -1,33 +0,0 @@
1
- // @bun
2
- import{Pn}from"./chunk-pp99rmjm.js";import{L,J,w,Bt,Ft,Ir,h,yl,Oi,X,I}from"./chunk-j1ytbd6r.js";import{an}from"./chunk-qvrew79n.js";import{r}from"./chunk-7j11vgm1.js";import{Z}from"./chunk-1ztp5vkh.js";import{D,c}from"./chunk-yxdhz4ps.js";var K=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Y(t){let s=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,n;while((n=e.exec(t))!==null)s.push({start:n.index,end:n.index+n[0].length});return s}function N(t,s){return s.some((e)=>t>=e.start&&t<e.end)}function Q(t){let s=(t||"").trim();if(!s)return null;if(/[\s>+~,:]/.test(s))return null;let e={},n=s,i=n.match(/^[a-z][\w-]*/i);if(i)e.tag=i[0].toLowerCase(),n=n.slice(i[0].length);while(n.length>0){let o=n.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(o){if(e.attr=o[1],o[3]!==void 0&&o[3]!=="")e.attrValue=o[3];n=n.slice(o[0].length);continue}let l=n.match(/^#([\w-]+)/);if(l){e.id=l[1],n=n.slice(l[0].length);continue}let a=n.match(/^\.([\w-]+)/);if(a){e.className=a[1],n=n.slice(a[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function tt(t,s){if(s.attr){if(!(s.attrValue===void 0?new RegExp(`\\b${s.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${s.attr}\\s*=\\s*(["'])\\s*${s.attrValue}\\s*\\1`,"i")).test(t))return!1}if(s.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${s.id}\\s*\\1`,"i").test(t))return!1}if(s.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(s.className))return!1}return!0}function P(t,s="main"){let e=Q(s);if(!e)return null;let n=/<([a-z][\w-]*)\b([^>]*)>/gi,i=Y(t),o;while((o=n.exec(t))!==null){if(N(o.index,i))continue;let l=o[1].toLowerCase(),a=o[2]||"";if(a.trimEnd().endsWith("/")||K.has(l))continue;if(e.tag&&e.tag!==l)continue;if(!tt(a,e))continue;let u=o[0],g=o.index+u.length,f=new RegExp(`<(/?)${l}\\b([^>]*)>`,"gi");f.lastIndex=g;let d=1,x;while((x=f.exec(t))!==null){if(N(x.index,i))continue;let y=x[1]==="/";if(!y&&(x[2]||"").trimEnd().endsWith("/"))continue;if(d+=y?-1:1,d===0)return{openTag:u,openIndex:o.index,start:g,end:x.index,tagName:l}}return null}return null}var wt="private, no-store";function en(t){return t.replace(/&#(\d+);/g,(s,e)=>F(Number(e),s)).replace(/&#x([0-9a-f]+);/gi,(s,e)=>F(Number.parseInt(e,16),s)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function F(t,s){if(!Number.isInteger(t)||t<0||t>1114111)return s;try{return String.fromCodePoint(t)}catch{return s}}function Ie(t){return t.headers.get("X-STX-Router")==="true"}function et(t,s){if(!t)return s;return t.split(",").some((n)=>n.trim().toLowerCase()===s.toLowerCase())?t:`${t}, ${s}`}function H(t){return{Vary:et(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function B(t){let s=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy;return w(s,(n,i)=>(e.lastIndex=i,e.exec(n)?e.lastIndex:-1)).map(({token:n})=>n)}function V(t){let s=Object.create(null),e=t.replace(/^<\w+\b|>$/g,"");for(let n of e.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let i=n[1].toLowerCase();if(!(i in s))s[i]=n[2]??n[3]??n[4]??""}return s}function jn(t){let s=[];for(let e of B(t)){if(/^<title\b/i.test(e)){s.push(`<title>${E(e.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let n=V(e);if(/^<meta\b/i.test(e)){let i=n.property?"property":"name",o=en(n[i]??"").toLowerCase();if(o==="description"||/^(?:og|twitter):[\w:]+$/.test(o))s.push(`<meta ${i}="${r(o)}" content="${E(n.content??"")}">`)}else{let i=en(n.rel??"").toLowerCase();if(i==="canonical"||i==="alternate"&&n.hreflang)s.push(`<link rel="${i}" href="${E(n.href??"")}"${i==="alternate"?` hreflang="${E(n.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${s.join("")}</template>
3
- `}var nt=["media","crossorigin","integrity"];function Bn(t){let s=[];for(let e of B(t)){if(!/^<link\b/i.test(e))continue;let n=V(e);if(en(n.rel??"").trim().toLowerCase()!=="stylesheet")continue;if(!n.href||"data-css"in n||"disabled"in n)continue;let i=nt.filter((o)=>(o in n)).map((o)=>` ${o}="${E(n[o])}"`).join("");s.push(`<link rel="stylesheet" href="${E(n.href)}"${i}>`)}return s.length?`<template data-stx-page-css="1">${s.join("")}</template>
4
- `:""}import T from"path";var rt="stx-page-head:",st=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,_={dev:null,prod:null};function it(){let t=Z()?"dev":"prod",s=_[t];if(s!==null)return s;try{let e=import.meta.require("./chunk-027meh1k.js"),n=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;_[t]=`<script>${n()}</script>`}catch{_[t]=""}return _[t]}async function Sa(t,s){if(s===!1)return null;if(s&&typeof s==="string"){let n=T.resolve(t,s);if(await Bun.file(n).exists())return n;return null}let e=T.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function Eo(t,s){try{let e=await Bun.file(t).text(),n=e,i=L(e);if(i)n=i.content.trim();let o=an(e),l=[...o.client.map((p)=>p.fullTag),...o.signals.map((p)=>p.fullTag)],a=[],u=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,g;while((g=u.exec(e))!==null)a.push(g[0]);let f=n;for(let p of o.server)f=f.replace(p.fullTag,"");for(let p of o.client)f=f.replace(p.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let d="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,d).replace(/<slot\s*>\s*<\/slot>/gi,d),!f.includes(d))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:x,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-eqfsw6x4.js"),k=await b(),m={__filename:t,__dirname:T.dirname(t)};for(let p of l){let A=p.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(A&&!p.includes("client")&&!p.includes('type="module"'))await y(A[1],m,t)}let S=await x(f,m,t,{...R,...k,...s},new Set),C=S.indexOf(d);if(C===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:S.substring(0,C),afterSlot:S.substring(C+d.length),filePath:t,shellScripts:l,shellStyles:a}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function es(t,s,e){let n,i="",o=s.match(st);if(o){s=s.replace(o[0],"");try{let f=Buffer.from(o[1],"base64").toString("utf8"),d=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(d)n=d[1].trim();i=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let l=e||n||"stx App",a=it(),u="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
5
- <html lang="en">
6
- <head>
7
- <meta charset="UTF-8">
8
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
- <title>${l}</title>
10
- ${i?` ${i}
11
- `:""} ${t.shellStyles.join(`
12
- `)}
13
- </head>
14
- <body>
15
- ${t.beforeSlot}
16
- <div data-stx-content>${s}</div>
17
- ${t.afterSlot}
18
- ${t.shellScripts.filter((f)=>!f.includes("server")).join(`
19
- `)}
20
- ${u}
21
- ${a}
22
- </body>
23
- </html>`}function Ye(t,s={}){let e=t.trim();if(!Pn(e))return t;let n=[],i=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(i){let u=i[1],g=/<style\b[^>]*>[\s\S]*?<\/style>/gi,f;while((f=g.exec(u))!==null)n.push(f[0]);let d=u.match(/<script\b[^>]*data-stx-server-data[^>]*>[\s\S]*?<\/script>/i);if(d)n.push(d[0]);let x=u.match(/<script\b[^>]*data-stx-runtime-config[^>]*>[\s\S]*?<\/script>/i);if(x)n.push(x[0])}if(s.preserveHead&&i){let u=[],g=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,f;while((f=g.exec(i[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(f[0]))continue;u.push(f[0])}if(u.length>0)n.unshift(`<!--${rt}${Buffer.from(u.join(`
24
- `),"utf8").toString("base64")}-->`)}let o=e.match(/<body\b[^>]*>/i),l=c(e);if(o&&l!==-1){let u=o.index+o[0].length,g=e.slice(u,l).trim();if(n.length>0)return n.join(`
25
- `)+`
26
- `+g;return g}let a=e;if(a=a.replace(/<!DOCTYPE\b[^>]*>/i,""),a=a.replace(/<html\b[^>]*>/i,""),a=a.replace(/<\/html\s*>/i,""),i)a=a.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,n.join(`
27
- `));return a=a.replace(/<body\b[^>]*>/i,""),a=a.replace(/<\/body\s*>/i,""),a.trim()}var q=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function U(t,s,e,n){if(!q.test(s))return!1;let i=s.slice(0,s.indexOf(">")+1),o=/\sdata-stx-owner="([^"]+)"/i.exec(i)?.[1];if(!o)return!0;let l=`data-stx-scope="${o}"`;for(let a=t.indexOf(l);a!==-1;a=t.indexOf(l,a+l.length))if(a>=e&&a<n)return!1;return!0}function ka(t){return Ie(t)}function ot(t,s){let e=[],n=new Set;for(let i of w(t,J)){if(i.start>=s.start&&i.start<s.end)continue;let o=i.token.match(/^<script\b((?:"[^"]*"|'[^']*'|[^'">])*)>/i)?.[1]??"",l=new Map;for(let g of o.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))l.set(g[1].toLowerCase(),g[2]??g[3]??g[4]??"");let a=l.get("src")?.trim(),u=l.get("type")?.trim().toLowerCase();if(!a||l.has("server")||u&&!["module","text/javascript","application/javascript"].includes(u))continue;if(l.has("data-stx-runtime")||l.has("data-stx-router")||/^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(a))continue;if(U(t,i.token,s.start,s.end)||n.has(i.token))continue;n.add(i.token),e.push(i.token)}return e}function Ze(t,s="main"){return!!P(t.trim(),s)}function Oe(t,s="main",e=!1){let n=t.trim(),i=[],o=[],l=n.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(l){let S=l[1],C=/<style\b[^>]*>[\s\S]*?<\/style>/gi,p;while((p=C.exec(S))!==null)i.push(p[0]);let A=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((p=A.exec(S))!==null){if(q.test(p[0])||p[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(p[0]))continue;o.push(p[0])}}let a=P(n,s);if(!a)return(e?jn(t)+Bn(t):"")+Ye(t);let u=ot(n,a),g=new Set(u),{tagName:f,start:d,end:x}=a,y=n.slice(d,x).trim(),R=[],b=n.match(/<body\b[^>]*>/i),k=c(n);if(b&&b.index!==void 0&&k!==-1){let C=[[b.index+b[0].length,a.openIndex],[x+`</${f}>`.length,k]],p=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[A,j]of C){if(A>=j)continue;let W=n.slice(A,j),v;p.lastIndex=0;while((v=p.exec(W))!==null){if(U(n,v[0],d,x))continue;R.push(v[0])}}}let m=[];if(e)m.push(jn(t)+Bn(t));if(i.length>0)m.push(i.join(`
28
- `));if(u.length>0)m.push(u.join(`
29
- `));if(o.length>0)m.push(o.filter((S)=>!g.has(S)).join(`
30
- `));if(R.length>0)m.push(R.filter((S)=>!g.has(S)).join(`
31
- `));return m.push(y),m.join(`
32
- `)}import O from"fs";import z from"path";function _a(t,s,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:s,outputDir:e}}function Ca(t,s){let e=z.join(s,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function Ea(t){let s=z.join(t,"manifest.json");if(!O.existsSync(s))return null;try{let e=O.readFileSync(s,"utf-8"),n=JSON.parse(e);if(n.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${n.version}`),null;return n}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,s,e={}){let n=`${encodeURIComponent(t)}=${encodeURIComponent(s)}`;if(e.maxAge!==void 0)n+=`; Max-Age=${e.maxAge}`;if(e.expires)n+=`; Expires=${e.expires.toUTCString()}`;if(e.path)n+=`; Path=${e.path}`;if(e.domain)n+=`; Domain=${e.domain}`;if(e.secure)n+="; Secure";if(e.httpOnly)n+="; HttpOnly";if(e.sameSite)n+=`; SameSite=${e.sameSite}`;return n}async function at(t){let s=t.headers.get("content-type")||"",e={},n=(i,o)=>{let l=e[i];if(l===void 0)e[i]=o;else if(Array.isArray(l))l.push(o);else e[i]=[l,o]};if(s.includes("multipart/form-data")){let i=await t.formData();for(let[o,l]of i.entries())if(typeof l==="string")n(o,l);return e}if(s.includes("application/x-www-form-urlencoded")){for(let[i,o]of new URLSearchParams(await t.text()).entries())n(i,o);return e}return e}function To(t){if(!t)return!1;let s=t.toUpperCase();return s!=="GET"&&s!=="HEAD"}async function G(t,s={}){let e=s.request,n=s.method??e?.method;if(!e||!To(n))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await at(e)}catch{}let o=await t.action({request:e,form:i,params:s.params??{},query:t.query??{},cookies:s.cookies??{}});if(o&&typeof o==="object"){let l=o,a=ct(l.cookies),u=l.redirect;if(typeof u==="string"&&u)return{redirect:u,ran:!0,...a.length>0?{cookies:a}:{}};let{cookies:g,redirect:f,...d}=l;if(Object.assign(t,d),a.length>0)return{ran:!0,cookies:a}}return{ran:!0}}function ct(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let s=[];for(let[e,n]of Object.entries(t)){if(!e)continue;if(typeof n==="string"){s.push(M(e,n));continue}if(n&&typeof n==="object"){let i=n;if(typeof i.value!=="string")continue;s.push(M(e,i.value,i))}}return s}function Ta(t,s=[],e){let n=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of s)n.append("Set-Cookie",i);for(let[i,o]of Object.entries(e??{}))if(i.toLowerCase()!=="location")n.set(i,o);return new Response(null,{status:303,headers:n})}async function Fn(t,s={}){let{html:e,context:n,redirect:i,cookies:o}=await lt(t,s),l=Bt(n),a=Ft(n);if(i)return{html:e,redirect:i,cookies:o,status:l,headers:a};let{extractStreamBoundaries:u}=await import("./chunk-24e4dapm.js"),g=u(n),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:d}=await import("./chunk-hd5bny2c.js"),{defaultConfig:x}=await import("./chunk-eh2gec79.js"),y=n.streamBoundaries||{},R={...x,autoShell:!1},b=Object.keys(f).map((m)=>({id:m,render:async()=>{let S=typeof y[m]==="function"?await y[m]():void 0;return d(f[m],{...n,$boundary:S},t.sourceFile,R,new Set)}})),k=new Set(b.map((m)=>m.id));g=[...(g||[]).filter((m)=>!k.has(m.id)),...b]}return{html:e,boundaries:g&&g.length>0?g:void 0,cookies:o,status:l,headers:a}}async function lt(t,s){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...s};if(!t.hasServerScripts&&!Oi(t.html))return{html:t.html,context:e};for(let l of t.serverScriptContent)try{await h(l,e,t.sourceFile)}catch(a){if(s.__stx_strict_hydration)throw a;console.warn(`[stx] Server script error in ${t.sourceFile}:`,a)}let n=await G(e,{request:s.request,method:s.method,params:s.params??{},cookies:s.cookies??{}}),i=(l)=>{let a=l.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),u=Ir(e);if(!u)return a;let g=D(a);return g<0?u+a:a.slice(0,g)+u+a.slice(g)};if(n.redirect)return{html:t.html,context:e,redirect:n.redirect,cookies:n.cookies};if(!Oi(t.html))return{html:i(t.html),context:e,cookies:n.cookies};let o=new Map;for(let[l,a]of Object.entries(t.placeholders))if(a.expression)try{let u=I(a.expression,e);if(a.type==="raw")o.set(l,u!==void 0&&u!==null?String(u):"");else o.set(l,u!==void 0&&u!==null?X(String(u)):"")}catch(u){if(s.__stx_strict_hydration)throw u;o.set(l,"")}return{html:i(yl(t.html,o)),context:e,cookies:n.cookies}}
33
- export{wt,en,Ie,H,jn,Bn,Sa,Eo,es,Ye,ka,Ze,Oe,_a,Ca,Ea,To,Ta,Fn};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Wl,dm}from"./chunk-xmws1gaf.js";export{Wl as captureScreenshot,dm as captureScreenshots};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{$e,Ai,Pi,Cg,zt,ul,Eg,dl,hy,He,_n,Ve}from"./chunk-j1ytbd6r.js";import{bl,n}from"./chunk-jqtpzzz4.js";import"./chunk-6ykfy7eh.js";import"./chunk-kzc2tqzr.js";import"./chunk-pp99rmjm.js";import"./chunk-3w7gacva.js";import"./chunk-fdjx4vs3.js";export{$e as BROWSER_CORE_IMPORTS,Cg as STX_AUTO_IMPORTS,Ai as extractAndStripCssImports,He as extractBridgeData,bl as findInterpolationEnd,dl as generateAutoImportDestructuring,hy as generateBrowserAutoImportDestructuring,_n as generateServerDataBridge,zt as injectBrowserCoreAutoImports,Ve as processClientScript,Eg as referencesName,Pi as renderVendorStyleTags,n as stripCommentsAndLiterals,ul as transformAutoImports};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{fm}from"./chunk-fy6ts0n4.js";import"./chunk-6az66mrc.js";import"./chunk-a5yb8w7s.js";import"./chunk-r09kz9bf.js";import"./chunk-zc8a2erc.js";import"./chunk-0sa9gqmc.js";import"./chunk-wp0qpa50.js";import"./chunk-j1ytbd6r.js";import"./chunk-6ykfy7eh.js";import"./chunk-kzc2tqzr.js";import"./chunk-pp99rmjm.js";import"./chunk-3w7gacva.js";import"./chunk-fdjx4vs3.js";export{fm as buildApp};
@@ -1,3 +0,0 @@
1
- // @bun
2
- function A(){let{NODE_ENV:n}=process.env;return n==="production"}function Z(){let{STX_DEBUG:n}=process.env;return!A()||n==="true"}function In(){let{NODE_ENV:n}=process.env;return n==="test"}function Ui(n,t){return t??(n==="compile"||A())}function On(n){if(!n)return n;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(n).trim()}catch{return n}}
3
- export{A,Z,In,Ui,On};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{eh,Oa,Tu,th,nh,rh,sh,oh,$u,Ru,ih,ah,ch,lh}from"./chunk-fnjm3xbf.js";import"./chunk-0h6r7nvn.js";import"./chunk-644ckv6e.js";import"./chunk-6ezt9kbe.js";import"./chunk-r2bxjna3.js";import"./chunk-88xayf21.js";import"./chunk-7j11vgm1.js";import"./chunk-2qb9kp21.js";import"./chunk-dbvsa5ya.js";import"./chunk-4m11kcxz.js";import"./chunk-95hbmv7k.js";import"./chunk-xtaq95em.js";import"./chunk-dw0ttj6p.js";import"./chunk-6az66mrc.js";import"./chunk-a5yb8w7s.js";import"./chunk-r09kz9bf.js";import"./chunk-zc8a2erc.js";import"./chunk-0sa9gqmc.js";import"./chunk-wp0qpa50.js";import"./chunk-j1ytbd6r.js";import"./chunk-6ykfy7eh.js";import"./chunk-kzc2tqzr.js";import"./chunk-pp99rmjm.js";import"./chunk-3w7gacva.js";import"./chunk-fdjx4vs3.js";export{Tu as SUSPENSE_RESOLVER_RUNTIME,Oa as buildSuspenseResolveScript,oh as createStreamRenderer,rh as extractStreamBoundaries,lh as generateHydrationRuntime,Ru as islandDirective,ah as processSectionDirectives,nh as processStreamDirectives,ih as registerStreamingDirectives,th as renderStreamingPage,eh as streamTemplate,sh as streamTemplateSimple,ch as streamToResponse,$u as streamingSuspenseDirective};