@stacksjs/stx 0.2.849 → 0.2.850

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 (225) hide show
  1. package/dist/{chunk-rqjskxpw.js → chunk-0dnetjh8.js} +31 -31
  2. package/dist/{chunk-09412heg.js → chunk-0rszcb0m.js} +13 -13
  3. package/dist/chunk-1qdhwjs4.js +2 -0
  4. package/dist/{chunk-z57xq46m.js → chunk-2d7e5g92.js} +4 -4
  5. package/dist/{chunk-wp14sf2j.js → chunk-2j2qzv8g.js} +1 -1
  6. package/dist/{chunk-nws4zm4k.js → chunk-2rg9pqmh.js} +4 -4
  7. package/dist/chunk-3gyq9rjx.js +2 -0
  8. package/dist/chunk-3w9xhs7k.js +2 -0
  9. package/dist/chunk-3wt0nh3p.js +2 -0
  10. package/dist/{chunk-jh36gqcq.js → chunk-422r7zkx.js} +2 -2
  11. package/dist/chunk-4e6wkjtx.js +2 -0
  12. package/dist/chunk-4pbrszgz.js +2 -0
  13. package/dist/chunk-5be6p256.js +2 -0
  14. package/dist/{chunk-83dxfhkw.js → chunk-5jqz5qff.js} +7 -7
  15. package/dist/chunk-5m4txcry.js +2 -0
  16. package/dist/chunk-5p6vpvmz.js +2 -0
  17. package/dist/chunk-5wk40kjd.js +2 -0
  18. package/dist/{chunk-ct54e34a.js → chunk-62k66qj9.js} +1 -1
  19. package/dist/chunk-660g9vjn.js +2 -0
  20. package/dist/chunk-67bn31a3.js +2 -0
  21. package/dist/{chunk-y1cneng3.js → chunk-6p62jjzm.js} +2 -2
  22. package/dist/{chunk-9mbyhepc.js → chunk-6q6atv4g.js} +5 -5
  23. package/dist/chunk-6rd4phe3.js +2 -0
  24. package/dist/chunk-7hnt9a2e.js +2 -0
  25. package/dist/{chunk-88a7qaw8.js → chunk-7zxce1yw.js} +3 -3
  26. package/dist/chunk-80bb89fh.js +2 -0
  27. package/dist/{chunk-he9dzchk.js → chunk-833y1ndd.js} +1 -1
  28. package/dist/{chunk-93c08def.js → chunk-88392kaj.js} +5 -5
  29. package/dist/{chunk-t4dkcf28.js → chunk-8cvgm13s.js} +2 -2
  30. package/dist/{chunk-v929r67j.js → chunk-8hkgycpm.js} +1 -1
  31. package/dist/chunk-8k6cd1e0.js +2 -0
  32. package/dist/{chunk-2ts9pb6s.js → chunk-8vjr3atq.js} +2 -2
  33. package/dist/{chunk-ke76eaat.js → chunk-918ws1g7.js} +6 -6
  34. package/dist/{chunk-tj533808.js → chunk-98qgcmxr.js} +2 -2
  35. package/dist/chunk-9bkgbyrs.js +2 -0
  36. package/dist/{chunk-rtsshvpt.js → chunk-9mryv01z.js} +52 -52
  37. package/dist/{chunk-bsw6hd14.js → chunk-9yp0t7zc.js} +2 -2
  38. package/dist/{chunk-yrmppd8r.js → chunk-a2fngjfx.js} +1 -1
  39. package/dist/chunk-a2shk93y.js +3 -0
  40. package/dist/chunk-a7v1j7td.js +2 -0
  41. package/dist/{chunk-zfb2wnha.js → chunk-aas25pac.js} +3 -3
  42. package/dist/{chunk-90mm5bf8.js → chunk-ab1vk7jv.js} +4 -4
  43. package/dist/chunk-acbx3jn5.js +2 -0
  44. package/dist/{chunk-0wms5teg.js → chunk-agbkv9ab.js} +2 -2
  45. package/dist/{chunk-wdwx2aa6.js → chunk-amerebya.js} +2 -2
  46. package/dist/{chunk-b1q40vq4.js → chunk-anva219c.js} +2 -2
  47. package/dist/chunk-apq33h4w.js +2 -0
  48. package/dist/{chunk-8vkywnpx.js → chunk-ar1prdev.js} +7 -7
  49. package/dist/{chunk-trgbdydw.js → chunk-axga9ebe.js} +2 -2
  50. package/dist/{chunk-mnncq81c.js → chunk-brheng7x.js} +8 -8
  51. package/dist/{chunk-3m5v3ynh.js → chunk-btkazgdb.js} +3 -3
  52. package/dist/chunk-c90qz5w0.js +2 -0
  53. package/dist/{chunk-4fc8zs15.js → chunk-caehra7e.js} +5 -5
  54. package/dist/chunk-cwt26rvt.js +3 -0
  55. package/dist/chunk-d4kystzh.js +2 -0
  56. package/dist/chunk-dx31vsyf.js +2 -0
  57. package/dist/{chunk-jaf44web.js → chunk-e105xsee.js} +1 -1
  58. package/dist/{chunk-1k12cc65.js → chunk-e46n406k.js} +13 -13
  59. package/dist/{chunk-2j3gttzf.js → chunk-e85wsz8y.js} +1 -1
  60. package/dist/{chunk-0zgxxhvs.js → chunk-eh8g8kr1.js} +5 -5
  61. package/dist/chunk-f4x21pqx.js +2 -0
  62. package/dist/{chunk-6xcmeev9.js → chunk-f5n871gp.js} +5 -5
  63. package/dist/{chunk-81ysx0tc.js → chunk-fffjjgnt.js} +2 -2
  64. package/dist/{chunk-wzyc9da7.js → chunk-frhdk0p9.js} +2 -2
  65. package/dist/chunk-frhh6jd3.js +2 -0
  66. package/dist/{chunk-b3n1m4m5.js → chunk-g046t3hb.js} +1 -1
  67. package/dist/chunk-g1gqysb4.js +2 -0
  68. package/dist/{chunk-8bxws458.js → chunk-gr8q8xqz.js} +3 -3
  69. package/dist/{chunk-emf6ee94.js → chunk-gsrdjmw9.js} +2 -2
  70. package/dist/{chunk-r96ahk8s.js → chunk-gwdffrz6.js} +9 -9
  71. package/dist/chunk-h7rcb74n.js +2 -0
  72. package/dist/{chunk-jcwtw3hd.js → chunk-h9gjt73q.js} +2 -2
  73. package/dist/chunk-hg9354gt.js +2 -0
  74. package/dist/{chunk-tbcvarvy.js → chunk-hhk46fzp.js} +2 -2
  75. package/dist/chunk-j3x3e353.js +2 -0
  76. package/dist/chunk-j6r964wk.js +2 -0
  77. package/dist/chunk-je8ma636.js +2 -0
  78. package/dist/chunk-jpyk0gtr.js +3 -0
  79. package/dist/{chunk-f2zgh4xr.js → chunk-jqjw00qm.js} +12 -12
  80. package/dist/{chunk-yqjmqndq.js → chunk-jqsn4sgv.js} +6 -6
  81. package/dist/{chunk-b147ejha.js → chunk-jt5cqq09.js} +3 -3
  82. package/dist/chunk-k0pm7p0f.js +2 -0
  83. package/dist/chunk-k1pyzf9e.js +2 -0
  84. package/dist/{chunk-eg2p1cyw.js → chunk-k47addf7.js} +29 -29
  85. package/dist/{chunk-qpz9jrvw.js → chunk-k7dvn2r8.js} +2 -2
  86. package/dist/{chunk-fa3ygt8c.js → chunk-kd06c90f.js} +4 -4
  87. package/dist/{chunk-9sjtph54.js → chunk-krtkxnz6.js} +2 -2
  88. package/dist/chunk-kybes29w.js +2 -0
  89. package/dist/{chunk-25m74mh1.js → chunk-m05pqmcj.js} +5 -5
  90. package/dist/chunk-m276y4f3.js +2 -0
  91. package/dist/{chunk-63sqdcr6.js → chunk-m6nhh5xf.js} +9 -9
  92. package/dist/{chunk-cww1zk8y.js → chunk-m710wkr4.js} +1 -1
  93. package/dist/chunk-nnbr1q94.js +2 -0
  94. package/dist/chunk-nq2z2yrz.js +2 -0
  95. package/dist/chunk-p2chmq36.js +2 -0
  96. package/dist/chunk-p9sbpbhg.js +2 -0
  97. package/dist/{chunk-3qyz80d6.js → chunk-pkq96sqk.js} +6 -6
  98. package/dist/chunk-q2d8x7p1.js +2 -0
  99. package/dist/{chunk-54p27ney.js → chunk-qa1pcm7n.js} +5 -5
  100. package/dist/{chunk-tm5t3hh3.js → chunk-qa4vs1qg.js} +3 -3
  101. package/dist/{chunk-gpkxphqz.js → chunk-qahz3n8z.js} +2 -2
  102. package/dist/{chunk-jm0qsr3s.js → chunk-qev14f76.js} +6 -6
  103. package/dist/{chunk-tb5h85ag.js → chunk-qjc3qjyf.js} +2 -2
  104. package/dist/chunk-r0btg48x.js +2 -0
  105. package/dist/{chunk-qay7pgnq.js → chunk-r0k5jbvk.js} +1 -1
  106. package/dist/{chunk-xr9rf0e6.js → chunk-r2p2nyyq.js} +3 -3
  107. package/dist/chunk-ryb4jesm.js +2 -0
  108. package/dist/{chunk-bttvkzxh.js → chunk-s0pnyd2f.js} +6 -6
  109. package/dist/{chunk-dv9q56r7.js → chunk-s37af6rd.js} +2 -2
  110. package/dist/chunk-sa18tper.js +20 -0
  111. package/dist/{chunk-2xf323h9.js → chunk-scaawv2r.js} +3 -3
  112. package/dist/chunk-sjpya8wm.js +2 -0
  113. package/dist/chunk-sy0jtgmv.js +42 -0
  114. package/dist/chunk-sznk5c66.js +2 -0
  115. package/dist/{chunk-c541s99z.js → chunk-t23jn83r.js} +4 -4
  116. package/dist/{chunk-fez9828r.js → chunk-t74qb5ej.js} +3 -3
  117. package/dist/chunk-t7ws9sth.js +2 -0
  118. package/dist/{chunk-rwc322gq.js → chunk-tbs24vx1.js} +2 -2
  119. package/dist/{chunk-jmshgw0t.js → chunk-td6b41vj.js} +4 -4
  120. package/dist/chunk-tdtwqydq.js +2 -0
  121. package/dist/{chunk-ga650crj.js → chunk-tm1ec751.js} +9 -9
  122. package/dist/{chunk-k7e3e149.js → chunk-tmftv8na.js} +102 -102
  123. package/dist/chunk-tpax2gpz.js +2 -0
  124. package/dist/chunk-ts6sm467.js +2 -0
  125. package/dist/{chunk-46t924aw.js → chunk-v4bqmzj9.js} +2 -2
  126. package/dist/chunk-w005b56n.js +2 -0
  127. package/dist/{chunk-ema1c29k.js → chunk-w032x0zm.js} +2 -2
  128. package/dist/chunk-w8aj3f9v.js +2 -0
  129. package/dist/{chunk-ma9yq04p.js → chunk-wzv7k91a.js} +2 -2
  130. package/dist/chunk-x4077p94.js +2 -0
  131. package/dist/{chunk-y6wbbmp3.js → chunk-x80b12gr.js} +3 -3
  132. package/dist/{chunk-c7qej674.js → chunk-xa1f13nk.js} +56 -56
  133. package/dist/{chunk-ynnd6nnt.js → chunk-xe8m66a3.js} +104 -102
  134. package/dist/{chunk-9qxx2teq.js → chunk-xndr2dx9.js} +6 -6
  135. package/dist/chunk-xrdh4at4.js +2 -0
  136. package/dist/chunk-y8qdpb0p.js +2 -0
  137. package/dist/chunk-ydjy26ch.js +2 -0
  138. package/dist/{chunk-k44qj40k.js → chunk-ym5qgw03.js} +2 -2
  139. package/dist/chunk-yx37mvy7.js +2 -0
  140. package/dist/{chunk-na1x46xm.js → chunk-z0qfspzg.js} +3 -3
  141. package/dist/chunk-z278w3cb.js +2 -0
  142. package/dist/chunk-z33esms3.js +3 -0
  143. package/dist/{chunk-fx8jjasv.js → chunk-z46mk8ym.js} +4 -4
  144. package/dist/chunk-znfzh6fm.js +2 -0
  145. package/dist/chunk-zteccxj9.js +2 -0
  146. package/dist/cli.js +20 -20
  147. package/dist/component-renderer.d.ts +1 -0
  148. package/dist/component-renderer.js +28 -4
  149. package/dist/craft-entry.js +2 -2
  150. package/dist/craft.js +2 -2
  151. package/dist/pwa.js +3 -3
  152. package/dist/safe-evaluator.d.ts +10 -0
  153. package/dist/safe-evaluator.js +24 -5
  154. package/dist/server-bindings.d.ts +11 -0
  155. package/dist/server-bindings.js +27 -0
  156. package/dist/ssg.js +15 -15
  157. package/dist/stx-virtual-ts.d.ts +31 -0
  158. package/dist/stx-virtual-ts.js +49 -2
  159. package/dist/typecheck.d.ts +1 -1
  160. package/dist/typecheck.js +5 -4
  161. package/package.json +5 -5
  162. package/dist/chunk-056rsqc6.js +0 -20
  163. package/dist/chunk-0d4zhbjz.js +0 -2
  164. package/dist/chunk-0ey7kc6t.js +0 -3
  165. package/dist/chunk-11snc6n0.js +0 -2
  166. package/dist/chunk-1menbxwb.js +0 -2
  167. package/dist/chunk-1pf4y2yr.js +0 -2
  168. package/dist/chunk-2sxmmjt1.js +0 -2
  169. package/dist/chunk-34afrhts.js +0 -2
  170. package/dist/chunk-37bzsnr7.js +0 -2
  171. package/dist/chunk-3m6n90sk.js +0 -2
  172. package/dist/chunk-4q4mtrc5.js +0 -2
  173. package/dist/chunk-5bm8hmwd.js +0 -2
  174. package/dist/chunk-5r2z29n8.js +0 -2
  175. package/dist/chunk-660preb9.js +0 -2
  176. package/dist/chunk-6hd83cj4.js +0 -2
  177. package/dist/chunk-740njbwc.js +0 -2
  178. package/dist/chunk-77fs8281.js +0 -2
  179. package/dist/chunk-7c73t536.js +0 -2
  180. package/dist/chunk-84gg2atb.js +0 -2
  181. package/dist/chunk-86z8zrn9.js +0 -3
  182. package/dist/chunk-9c6yvh3p.js +0 -2
  183. package/dist/chunk-9f0pv6sz.js +0 -2
  184. package/dist/chunk-9fxeqf0e.js +0 -2
  185. package/dist/chunk-atsjexk0.js +0 -2
  186. package/dist/chunk-bcefawtc.js +0 -2
  187. package/dist/chunk-bkqqa8aw.js +0 -2
  188. package/dist/chunk-bmds786f.js +0 -2
  189. package/dist/chunk-c0azgkss.js +0 -2
  190. package/dist/chunk-cbz7jtzf.js +0 -2
  191. package/dist/chunk-e1n286mv.js +0 -2
  192. package/dist/chunk-evdskc25.js +0 -2
  193. package/dist/chunk-f8akfzzn.js +0 -2
  194. package/dist/chunk-f8wmxwa3.js +0 -2
  195. package/dist/chunk-fseqwysr.js +0 -2
  196. package/dist/chunk-gg48cgx3.js +0 -2
  197. package/dist/chunk-h8zb6cek.js +0 -2
  198. package/dist/chunk-hc4ydhw0.js +0 -2
  199. package/dist/chunk-j08r18x1.js +0 -2
  200. package/dist/chunk-j539dz72.js +0 -2
  201. package/dist/chunk-jqngvqby.js +0 -2
  202. package/dist/chunk-k33kgf8a.js +0 -2
  203. package/dist/chunk-kz7ha54c.js +0 -2
  204. package/dist/chunk-m7cbkrz6.js +0 -2
  205. package/dist/chunk-md8dj6tb.js +0 -2
  206. package/dist/chunk-na1v2jcy.js +0 -2
  207. package/dist/chunk-p2fkggw4.js +0 -3
  208. package/dist/chunk-pqqyjvq9.js +0 -2
  209. package/dist/chunk-q18508s2.js +0 -2
  210. package/dist/chunk-qczgdzjk.js +0 -2
  211. package/dist/chunk-r40g6785.js +0 -2
  212. package/dist/chunk-r6085mp4.js +0 -2
  213. package/dist/chunk-rke4q3jk.js +0 -2
  214. package/dist/chunk-rrnvbwac.js +0 -2
  215. package/dist/chunk-shnw9geh.js +0 -42
  216. package/dist/chunk-te1wksa0.js +0 -2
  217. package/dist/chunk-v11hvvxc.js +0 -2
  218. package/dist/chunk-vasvns9e.js +0 -2
  219. package/dist/chunk-vdb3p2v3.js +0 -2
  220. package/dist/chunk-vm2y05sr.js +0 -2
  221. package/dist/chunk-x2wn6mpd.js +0 -2
  222. package/dist/chunk-x45mp78q.js +0 -2
  223. package/dist/chunk-xa2qfe51.js +0 -3
  224. package/dist/chunk-xsmyhp5f.js +0 -2
  225. package/dist/chunk-zecffe6a.js +0 -2
package/dist/pwa.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{so,Vt,$l,Og}from"./chunk-c541s99z.js";import{ro,Li,Ag,Pg,Ig}from"./chunk-bttvkzxh.js";import{Cl,El,Tl,$g,Rg}from"./chunk-wzyc9da7.js";import{We,Pn,ji}from"./chunk-9sjtph54.js";import{Ng,Dg,Mg,Lg,oo,vy}from"./chunk-wdwx2aa6.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
3
- Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-zecffe6a.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
2
+ import{so,Ut,Rl,Ng}from"./chunk-t23jn83r.js";import{ro,ji,Pg,Ig,Og}from"./chunk-s0pnyd2f.js";import{El,Tl,$l,Rg,Ag}from"./chunk-frhdk0p9.js";import{We,Pn,Bi}from"./chunk-krtkxnz6.js";import{Mg,Dg,Lg,jg,oo,Sy}from"./chunk-amerebya.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
3
+ Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-w005b56n.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta charset="UTF-8">
@@ -233,4 +233,4 @@ Icon generation requires the sharp package for image processing.`),e.success=!1,
233
233
  }, 5000);
234
234
  </script>
235
235
  </body>
236
- </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=We(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=so(n,t);if(a){let s=Vt(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return Li(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,El as auditBuildOutput,Cl as auditConfig,re as buildPwaAssets,Tl as calculateAuditResult,Rg as formatAuditResult,ji as formatSize,j as generateManifest,_ as generateManifestJson,Pg as generateManifestLink,F as generateOfflinePage,We as generatePrecacheManifest,Pn as generatePrecacheManifestJs,M as generatePwaIcons,ro as generatePwaTags,so as generateServiceWorker,Og as generateServiceWorkerAuto,Ag as generateSwRegistrationScript,Ig as generateThemeColorMeta,N as getExpectedIconPaths,Vt as getServiceWorkerFileName,Li as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,$l as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,oo as pwaDirectives,Ng as pwaInstallDirective,Mg as pwaOfflineDirective,Lg as pwaPushDirective,Dg as pwaUpdateDirective,vy as registerPwaDirectives,$g as runPwaAudit,D as validateManifest};
236
+ </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=We(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=so(n,t);if(a){let s=Ut(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return ji(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,Tl as auditBuildOutput,El as auditConfig,re as buildPwaAssets,$l as calculateAuditResult,Ag as formatAuditResult,Bi as formatSize,j as generateManifest,_ as generateManifestJson,Ig as generateManifestLink,F as generateOfflinePage,We as generatePrecacheManifest,Pn as generatePrecacheManifestJs,M as generatePwaIcons,ro as generatePwaTags,so as generateServiceWorker,Ng as generateServiceWorkerAuto,Pg as generateSwRegistrationScript,Og as generateThemeColorMeta,N as getExpectedIconPaths,Ut as getServiceWorkerFileName,ji as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,Rl as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,oo as pwaDirectives,Mg as pwaInstallDirective,Lg as pwaOfflineDirective,jg as pwaPushDirective,Dg as pwaUpdateDirective,Sy as registerPwaDirectives,Rg as runPwaAudit,D as validateManifest};
@@ -139,6 +139,16 @@ export declare function safeEvaluateArray(expression: string, context: Record<st
139
139
  * @returns Object result, defaults to empty object on error
140
140
  */
141
141
  export declare function safeEvaluateObject(expression: string, context: Record<string, unknown>): Record<string, unknown>;
142
+ /**
143
+ * How many compiles were asked for, and how many came back as someone else's
144
+ * code and had to be retried. Zero mismatches on a correct runtime; a non-zero
145
+ * count is the runtime bug above happening, and being caught.
146
+ */
147
+ export declare function compileVerificationStats(): {
148
+ compiles: number;
149
+ mismatches: number;
150
+ };
151
+ export declare function compileVerified(params: readonly string[], body: string): (...args: unknown[]) => unknown;
142
152
  /**
143
153
  * The variables an expression actually reads from its surrounding scope.
144
154
  *
@@ -467,12 +467,31 @@ const RESERVED_PARAM_NAMES = new Set([
467
467
  "arguments",
468
468
  "eval",
469
469
  "await"
470
- ]), COMPILED_EXPRESSION_LIMIT = 2000, compiledExpressions = new Map;
470
+ ]), COMPILE_PROBE_SECRET = `stx-compile-probe:${globalThis.crypto.randomUUID()}`;
471
+ let compileSequence = 0, compileMismatches = 0;
472
+ export function compileVerificationStats() {
473
+ return { compiles: compileSequence, mismatches: compileMismatches };
474
+ }
475
+ export function compileVerified(params, body) {
476
+ let probeParam = "__stx_compile_probe";
477
+ while (params.includes(probeParam))
478
+ probeParam += "_";
479
+ const probeArgs = Array.from({ length: params.length + 1 });
480
+ probeArgs[params.length] = COMPILE_PROBE_SECRET;
481
+ for (let attempt = 0;attempt < 16; attempt++) {
482
+ const token = `c${++compileSequence}`, guard = `'use strict';if(${probeParam}===${JSON.stringify(COMPILE_PROBE_SECRET)})return ${JSON.stringify(token)};`, compiled = Function(...params, probeParam, guard + body);
483
+ if (compiled(...probeArgs) === token)
484
+ return compiled;
485
+ compileMismatches++;
486
+ }
487
+ throw Error("[stx] the JavaScript runtime repeatedly returned code compiled from a different source; refusing to evaluate with it.");
488
+ }
489
+ const COMPILED_EXPRESSION_LIMIT = 2000, compiledExpressions = new Map;
471
490
  function compileFunctionBody(params, body) {
472
491
  const key = `${params.join(",")}\x00${body}`, cached = compiledExpressions.get(key);
473
492
  if (cached)
474
493
  return cached;
475
- const compiled = Function(...params, body);
494
+ const compiled = compileVerified(params, body);
476
495
  if (compiledExpressions.size >= COMPILED_EXPRESSION_LIMIT)
477
496
  compiledExpressions.clear();
478
497
  compiledExpressions.set(key, compiled);
@@ -606,7 +625,7 @@ export function safeEvaluateCode(code, context) {
606
625
  if (pattern.test(stripped))
607
626
  throw Error("Potentially unsafe code detected");
608
627
  const safeContext = createSafeContext(context), keys = Object.keys(safeContext).filter((key) => key !== "Object" && isUsableParamName(key) && !DANGEROUS_IDENTIFIERS.has(key)), values = keys.map((key) => safeContext[key]);
609
- return Function("Object", ...SHADOWED_GLOBAL_NAMES, ...keys, `
628
+ return compileVerified(["Object", ...SHADOWED_GLOBAL_NAMES, ...keys], `
610
629
  'use strict';
611
630
  ${code}
612
631
  `)(SAFE_OBJECT, ...SHADOWED_GLOBAL_VALUES, ...values);
@@ -656,7 +675,7 @@ export function createSafeLoopFunction(loopType, expression, body, contextKeys,
656
675
  return (...args) => String(guarded(...args) ?? "");
657
676
  };
658
677
  if (loopType === "for") {
659
- const compiled = Function(SAFE_CTOR_PARAM, "Object", ...SHADOWED_GLOBAL_NAMES, "__stx_warn", ...filteredKeys, `
678
+ const compiled = compileVerified([SAFE_CTOR_PARAM, "Object", ...SHADOWED_GLOBAL_NAMES, "__stx_warn", ...filteredKeys], `
660
679
  'use strict';
661
680
  let result = '';
662
681
  for (${expression}) {
@@ -667,7 +686,7 @@ export function createSafeLoopFunction(loopType, expression, body, contextKeys,
667
686
  `);
668
687
  return projectAndBind(compiled);
669
688
  } else {
670
- const compiled = Function(SAFE_CTOR_PARAM, "Object", ...SHADOWED_GLOBAL_NAMES, "__stx_warn", ...filteredKeys, `
689
+ const compiled = compileVerified([SAFE_CTOR_PARAM, "Object", ...SHADOWED_GLOBAL_NAMES, "__stx_warn", ...filteredKeys], `
671
690
  'use strict';
672
691
  let result = '';
673
692
  let __safeCounter = 0;
@@ -16,6 +16,17 @@ export declare function reactiveLoopRanges(template: string): Array<[number, num
16
16
  * which needs the names to keep treating them as the loop's.
17
17
  */
18
18
  export declare function reactiveLoopScopes(template: string): Array<{ start: number, end: number, names: string[], tag: string }>;
19
+ /**
20
+ * Element start offsets that are a LATER child of a sibling-margin stack, with
21
+ * the utility that makes the parent one.
22
+ *
23
+ * `space-y-*` and `space-x-*` put their margin on the parent's direct children
24
+ * after the first. That is the one place a component's scope wrapper is
25
+ * visible: it generates no box, so a margin that lands on it is dropped and the
26
+ * component renders flush against the sibling before it (stacksjs/stx#2178).
27
+ * Only the first child is exempt, because it never receives the margin.
28
+ */
29
+ export declare function siblingMarginChildren(template: string): Map<number, string>;
19
30
  /**
20
31
  * Process server-side `:attr="expr"` bindings in a template.
21
32
  *
@@ -69,6 +69,33 @@ export function reactiveLoopScopes(template) {
69
69
  }
70
70
  return ranges;
71
71
  }
72
+ const SIBLING_MARGIN_UTILITY = /(?:^|\s)((?:[\w-]+:)*-?space-[xy]-(?!reverse(?:\s|$))[\w./[\]-]+)(?=\s|$)/;
73
+ export function siblingMarginChildren(template) {
74
+ const later = new Map, stack = [];
75
+ for (const tag of scanHtmlTags(template)) {
76
+ const tagName = tag.name.toLowerCase();
77
+ if (tag.closing) {
78
+ for (let i = stack.length - 1;i >= 0; i--)
79
+ if (stack[i].name === tagName) {
80
+ stack.length = i;
81
+ break;
82
+ }
83
+ continue;
84
+ }
85
+ const parent = stack.at(-1);
86
+ if (parent) {
87
+ if (parent.utility && parent.children > 0)
88
+ later.set(tag.start, parent.utility);
89
+ if (!/(?:^|\s)hidden(?=[\s=]|$)/.test(tag.attributes))
90
+ parent.children++;
91
+ }
92
+ if (!tag.selfClosing && !VOID_TAGS.has(tagName)) {
93
+ const classes = /(?:^|\s)class\s*=\s*(["'])([\s\S]*?)\1/.exec(tag.attributes)?.[2];
94
+ stack.push({ name: tagName, utility: classes ? SIBLING_MARGIN_UTILITY.exec(classes)?.[1] ?? null : null, children: 0 });
95
+ }
96
+ }
97
+ return later;
98
+ }
72
99
  function resolveClassBinding(value) {
73
100
  if (typeof value === "string")
74
101
  return value;
package/dist/ssg.js CHANGED
@@ -1,22 +1,22 @@
1
1
  // @bun
2
- import"./chunk-hpwtjb4a.js";import{x,ll}from"./chunk-eg2p1cyw.js";import"./chunk-0wms5teg.js";import"./chunk-xppm4cs4.js";import{At,y}from"./chunk-ynnd6nnt.js";import"./chunk-46t924aw.js";import"./chunk-gpkxphqz.js";import"./chunk-jtccqpwa.js";import{_t,Ct,Et,Tt,$t,Rt}from"./chunk-t4dkcf28.js";import{a}from"./chunk-rtsshvpt.js";import{As}from"./chunk-09412heg.js";import"./chunk-nws4zm4k.js";import"./chunk-54p27ney.js";import{ye,nn,rn}from"./chunk-fx8jjasv.js";import"./chunk-0ey7kc6t.js";import{b}from"./chunk-8vkywnpx.js";import{bt,i}from"./chunk-c7qej674.js";import"./chunk-shnw9geh.js";import"./chunk-f2zgh4xr.js";import{ys}from"./chunk-63sqdcr6.js";import"./chunk-88a7qaw8.js";import"./chunk-t5q31st4.js";import{rc,sc,oc}from"./chunk-tm5t3hh3.js";import{en,tr,nr}from"./chunk-86z8zrn9.js";import{tn}from"./chunk-rwc322gq.js";import"./chunk-xa2qfe51.js";import"./chunk-cww1zk8y.js";import{G,ve}from"./chunk-0zgxxhvs.js";import"./chunk-he9dzchk.js";import"./chunk-xr9rf0e6.js";import{c}from"./chunk-p2fkggw4.js";import{s,me}from"./chunk-jm0qsr3s.js";import D from"fs";import f from"path";import{createHash as vt}from"crypto";function Pt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var kt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Dt(t){return Bun.hash(t).toString(16)}function ot(t,r={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let n=new Map,o=t.replace(kt,(e,u,g,v)=>{let w=v.trim();if(!w)return e;if(/\bdata-stx-src=/.test(g))return e;if(r.minify)w=Pt(w);let p=Dt(w);if(!n.has(p))n.set(p,w);let P=r.integrity?` data-stx-integrity="sha384-${vt("sha384").update(w).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),l=Array.from(n,([e,u])=>({hash:e,code:u}));return{html:o,chunks:l}}var It=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let r=new Map,n=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=n.exec(t))!==null)r.set(o[1],o[2]);let l=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(It.has(r.get(u[1])||""))l.add(u[2]);let g=/<\/head\s*>/iy,v=y(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(l.size===0||v===-1)return t;let w=Array.from(l).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!w)return t;return t.slice(0,v)+w+t.slice(v)}var Bt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function X(t){let r=t.trim();if(!r)return null;let n=/^https?:\/\//i.test(r)?r:`https://${r}`;try{return new URL(n).origin+new URL(n).pathname.replace(/\/$/,"")}catch{return null}}function jt(t){for(let r of Bt){let n=t[r];if(!n)continue;let o=X(n);if(o)return{url:o,source:"env",via:r}}return null}function lt(t){if(!t||typeof t!=="object")return null;let r=t,n=r.site?.url??r.url??r.app?.url;return typeof n==="string"?X(n):null}async function Ft(t){let{existsSync:r}=await import("fs"),n=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let l=n.resolve(t,o);if(!r(l))continue;try{let e=await import(l),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let r=t.cwd??process.cwd(),n=t.env??process.env;if(t.explicit){let u=X(t.explicit);if(u)return{url:u,source:"option"}}let o=lt(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let l=await Ft(r);if(l)return{url:l,source:"site.config",via:"url"};let e=jt(n);if(e)return e;return{url:"http://localhost",source:"fallback"}}function dt(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
3
- `)}function J(t){return async()=>({paths:await t(),fallback:!1})}var Ot;function Lt(t){let r=s(t),{depths:n}=me(r),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,l;while((l=o.exec(r))!==null){if(n[l.index]!==0)continue;let u=x(r,"(",")",o.lastIndex-1),g=r.indexOf("{",u+1),v=x(r,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(l.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((l=e.exec(r))!==null){if(n[l.index]!==0)continue;let u=ll(r,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function gt(t){let r="read";try{let n=await Bun.file(t).text();r="parse";let o=tn(n),l=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(s(e.attrs))).sort((e,u)=>n.indexOf(e.fullTag)-n.indexOf(u.fullTag));for(let e of l){if(!/\bgetStaticPaths\b/.test(s(e.content)))continue;let u=(Ot??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(s(u)))continue;let g=Lt(u);if(/\bdefineStaticPaths\b/.test(s(g))&&At(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");r="execute";let v=Function("defineStaticPaths",`return (${g})`)(J);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let w=await v();r="result";let p=Array.isArray(w)?{paths:w}:w;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(n){return{kind:"error",phase:r,error:n instanceof Error?n:Error(String(n))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,r=""){this.cacheDir=t,this.salt=r}async load(){if(this.loaded)return;let t=f.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let r=JSON.parse(await Bun.file(t).text());for(let[n,o]of Object.entries(r))this.cache.set(n,o)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=f.join(this.cacheDir,"build-cache.json"),r={};for(let[n,o]of this.cache)r[n]=o;await Bun.write(t,JSON.stringify(r))}getHash(t,r){let n=D.statSync(t),o=`${this.salt}|${t}:${n.mtimeMs}`;for(let e of r)if(D.existsSync(e)){let u=D.statSync(e);o+=`:${e}:${u.mtimeMs}`}let l=0;for(let e=0;e<o.length;e++){let u=o.charCodeAt(e);l=(l<<5)-l+u,l=l&l}return Math.abs(l).toString(36)}get(t,r){let n=this.cache.get(t);if(!n)return null;let o=ft(r).some((u)=>D.existsSync(u)),l=[r,...n.dependencies??[]].some((u)=>u.endsWith(".stx")&&D.existsSync(u)&&ys(D.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||l)return this.cache.delete(t),null;let e=this.getHash(r,n.dependencies??[]);if(n.hash!==e)return this.cache.delete(t),null;return n.html}set(t,r,n,o){let l=this.getHash(r,n);this.cache.set(t,{hash:l,html:o,generatedAt:Date.now(),dependencies:n})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let r=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return f.join(this.cacheDir,"isr",r)}async get(t){let r=this.getFilePath(t);if(!await Bun.file(r).exists())return null;try{return JSON.parse(await Bun.file(r).text())}catch{return null}}async set(t,r){let n=this.getFilePath(t);await D.promises.mkdir(f.dirname(n),{recursive:!0}),await Bun.write(n,JSON.stringify(r))}async invalidate(t){let r=this.getFilePath(t);if(await Bun.file(r).exists())await D.promises.unlink(r)}async invalidatePattern(t){let r=f.join(this.cacheDir,"isr");if(!D.existsSync(r))return;let n=await D.promises.readdir(r);for(let o of n){let l=o.replace(/_/g,"/").replace(".json","");if(t.test(l))await D.promises.unlink(f.join(r,o))}}async needsRevalidation(t){let r=await this.get(t);if(!r)return!0;return Date.now()>r.revalidateAfter}}async function Ut(t){let r=[];if(!t.isDynamic)r.push({url:t.pattern,params:{}});else{let n=await gt(t.filePath);if(n.kind==="error")throw Error(`getStaticPaths ${n.phase} failed for ${t.pattern} (${t.filePath}): ${n.error.message}`,{cause:n.error});if(n.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),r;let o=n.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),r;for(let l of o.paths){let e=t.pattern;for(let[u,g]of Object.entries(l.params))e=e.replace(`:${u}`,g).replace(`:${u}*`,g);r.push({url:e,params:l.params,props:l.props,revalidate:l.revalidate})}}return r}function ft(t){return[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"]}async function Mt(t){for(let r of ft(t))if(await Bun.file(r).exists())try{let n=await import(r);if(typeof n.default==="function")return await n.default();else if(typeof n.default==="object")return n.default;else if(typeof n.getData==="function")return await n.getData();else{let{default:o,...l}=n;return l}}catch(n){console.error(`Error loading data file ${r}:`,n)}return null}async function Gt(t,r,n){let o=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let l=o[1];if(!l.includes("getStaticProps"))return null;try{let e=l.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
2
+ import"./chunk-hpwtjb4a.js";import{x,ul}from"./chunk-k47addf7.js";import"./chunk-agbkv9ab.js";import"./chunk-xppm4cs4.js";import{Pt,y}from"./chunk-xe8m66a3.js";import"./chunk-v4bqmzj9.js";import"./chunk-qahz3n8z.js";import"./chunk-jtccqpwa.js";import{Ct,Et,Tt,$t,Rt,At}from"./chunk-8cvgm13s.js";import{a}from"./chunk-9mryv01z.js";import{As}from"./chunk-0rszcb0m.js";import"./chunk-2rg9pqmh.js";import"./chunk-qa1pcm7n.js";import{ye,rn,sn}from"./chunk-z46mk8ym.js";import"./chunk-jpyk0gtr.js";import{b}from"./chunk-ar1prdev.js";import{wt,i}from"./chunk-xa1f13nk.js";import"./chunk-sy0jtgmv.js";import"./chunk-jqjw00qm.js";import{ys}from"./chunk-m6nhh5xf.js";import"./chunk-7zxce1yw.js";import"./chunk-t5q31st4.js";import{sc,oc,ic}from"./chunk-qa4vs1qg.js";import{tn,tr,nr}from"./chunk-cwt26rvt.js";import{nn}from"./chunk-tbs24vx1.js";import"./chunk-a2shk93y.js";import"./chunk-m710wkr4.js";import{X,ve}from"./chunk-eh8g8kr1.js";import"./chunk-833y1ndd.js";import"./chunk-r2p2nyyq.js";import{c}from"./chunk-z33esms3.js";import{r,me}from"./chunk-qev14f76.js";import D from"fs";import f from"path";import{createHash as vt}from"crypto";function kt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function It(t){return Bun.hash(t).toString(16)}function ot(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,o=t.replace(Dt,(e,u,g,v)=>{let w=v.trim();if(!w)return e;if(/\bdata-stx-src=/.test(g))return e;if(n.minify)w=kt(w);let p=It(w);if(!s.has(p))s.set(p,w);let P=n.integrity?` data-stx-integrity="sha384-${vt("sha384").update(w).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),l=Array.from(s,([e,u])=>({hash:e,code:u}));return{html:o,chunks:l}}var Bt=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let n=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=s.exec(t))!==null)n.set(o[1],o[2]);let l=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(Bt.has(n.get(u[1])||""))l.add(u[2]);let g=/<\/head\s*>/iy,v=y(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(l.size===0||v===-1)return t;let w=Array.from(l).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!w)return t;return t.slice(0,v)+w+t.slice(v)}var jt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function K(t){let n=t.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 Ft(t){for(let n of jt){let s=t[n];if(!s)continue;let o=K(s);if(o)return{url:o,source:"env",via:n}}return null}function lt(t){if(!t||typeof t!=="object")return null;let n=t,s=n.site?.url??n.url??n.app?.url;return typeof s==="string"?K(s):null}async function Ot(t){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 l=s.resolve(t,o);if(!n(l))continue;try{let e=await import(l),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let n=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let u=K(t.explicit);if(u)return{url:u,source:"option"}}let o=lt(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let l=await Ot(n);if(l)return{url:l,source:"site.config",via:"url"};let e=Ft(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function dt(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
3
+ `)}function q(t){return async()=>({paths:await t(),fallback:!1})}var Lt;function Ut(t){let n=r(t),{depths:s}=me(n),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,l;while((l=o.exec(n))!==null){if(s[l.index]!==0)continue;let u=x(n,"(",")",o.lastIndex-1),g=n.indexOf("{",u+1),v=x(n,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(l.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((l=e.exec(n))!==null){if(s[l.index]!==0)continue;let u=ul(n,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function gt(t){let n="read";try{let s=await Bun.file(t).text();n="parse";let o=nn(s),l=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(r(e.attrs))).sort((e,u)=>s.indexOf(e.fullTag)-s.indexOf(u.fullTag));for(let e of l){if(!/\bgetStaticPaths\b/.test(r(e.content)))continue;let u=(Lt??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(r(u)))continue;let g=Ut(u);if(/\bdefineStaticPaths\b/.test(r(g))&&Pt(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");n="execute";let v=Function("defineStaticPaths",`return (${g})`)(q);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let w=await v();n="result";let p=Array.isArray(w)?{paths:w}:w;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(s){return{kind:"error",phase:n,error:s instanceof Error?s:Error(String(s))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,n=""){this.cacheDir=t,this.salt=n}async load(){if(this.loaded)return;let t=f.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let n=JSON.parse(await Bun.file(t).text());for(let[s,o]of Object.entries(n))this.cache.set(s,o)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=f.join(this.cacheDir,"build-cache.json"),n={};for(let[s,o]of this.cache)n[s]=o;await Bun.write(t,JSON.stringify(n))}getHash(t,n){let s=D.statSync(t),o=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of n)if(D.existsSync(e)){let u=D.statSync(e);o+=`:${e}:${u.mtimeMs}`}let l=0;for(let e=0;e<o.length;e++){let u=o.charCodeAt(e);l=(l<<5)-l+u,l=l&l}return Math.abs(l).toString(36)}get(t,n){let s=this.cache.get(t);if(!s)return null;let o=ft(n).some((u)=>D.existsSync(u)),l=[n,...s.dependencies??[]].some((u)=>u.endsWith(".stx")&&D.existsSync(u)&&ys(D.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||l)return this.cache.delete(t),null;let e=this.getHash(n,s.dependencies??[]);if(s.hash!==e)return this.cache.delete(t),null;return s.html}set(t,n,s,o){let l=this.getHash(n,s);this.cache.set(t,{hash:l,html:o,generatedAt:Date.now(),dependencies:s})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let n=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return f.join(this.cacheDir,"isr",n)}async get(t){let n=this.getFilePath(t);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(t,n){let s=this.getFilePath(t);await D.promises.mkdir(f.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(n))}async invalidate(t){let n=this.getFilePath(t);if(await Bun.file(n).exists())await D.promises.unlink(n)}async invalidatePattern(t){let n=f.join(this.cacheDir,"isr");if(!D.existsSync(n))return;let s=await D.promises.readdir(n);for(let o of s){let l=o.replace(/_/g,"/").replace(".json","");if(t.test(l))await D.promises.unlink(f.join(n,o))}}async needsRevalidation(t){let n=await this.get(t);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function _t(t){let n=[];if(!t.isDynamic)n.push({url:t.pattern,params:{}});else{let s=await gt(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`),n;let o=s.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),n;for(let l of o.paths){let e=t.pattern;for(let[u,g]of Object.entries(l.params))e=e.replace(`:${u}`,g).replace(`:${u}*`,g);n.push({url:e,params:l.params,props:l.props,revalidate:l.revalidate})}}return n}function ft(t){return[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"]}async function Mt(t){for(let n of ft(t))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,...l}=s;return l}}catch(s){console.error(`Error loading data file ${n}:`,s)}return null}async function Gt(t,n,s){let o=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let l=o[1];if(!l.includes("getStaticProps"))return null;try{let e=l.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
4
4
  return (async function getStaticProps() {
5
5
  ${e[1]}
6
6
  })()
7
- `)(r)}catch(e){return console.error(`Error executing getStaticProps in ${n}:`,e),null}}function Nt(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function mt(t,r,n={},o,l){let e=await Bun.file(t.filePath).text(),u=await Mt(t.filePath),g=await Gt(e,r,t.filePath),v={...u||{},...g||{},...n,params:r,$route:{path:t.pattern,params:r}},w=new Set,p=[],P=[],E={...l,minifyClient:!0,...o.partialsDir?{partialsDir:o.partialsDir}:{},...o.componentsDir?{componentsDir:o.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(R)=>{p.push(`${f.relative(process.cwd(),R.templatePath)}: ${R.message}
8
- resolved against partialsDir: ${R.partialsDir}`)},onServerScriptError:(R)=>{P.push(`${f.relative(process.cwd(),R.sourcePath)} (${R.kind}): ${R.message}`)}};if(Nt(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let S=await i(e,v,t.filePath,E,w);for(let R of[t.filePath,...w])for(let A of ye(R))w.add(A);if(Object.keys(r).length>0){let R=`<script>if(window.stx)window.stx._rp=${JSON.stringify(r)};else window.__stx_rp=${JSON.stringify(r)};</script>`;if(S.includes("</head>"))S=S.replace("</head>",`${R}
7
+ `)(n)}catch(e){return console.error(`Error executing getStaticProps in ${s}:`,e),null}}function Nt(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function mt(t,n,s={},o,l){let e=await Bun.file(t.filePath).text(),u=await Mt(t.filePath),g=await Gt(e,n,t.filePath),v={...u||{},...g||{},...s,params:n,$route:{path:t.pattern,params:n}},w=new Set,p=[],P=[],E={...l,minifyClient:!0,...o.partialsDir?{partialsDir:o.partialsDir}:{},...o.componentsDir?{componentsDir:o.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(R)=>{p.push(`${f.relative(process.cwd(),R.templatePath)}: ${R.message}
8
+ resolved against partialsDir: ${R.partialsDir}`)},onServerScriptError:(R)=>{P.push(`${f.relative(process.cwd(),R.sourcePath)} (${R.kind}): ${R.message}`)}};if(Nt(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let S=await i(e,v,t.filePath,E,w);for(let R of[t.filePath,...w])for(let A of ye(R))w.add(A);if(Object.keys(n).length>0){let R=`<script>if(window.stx)window.stx._rp=${JSON.stringify(n)};else window.__stx_rp=${JSON.stringify(n)};</script>`;if(S.includes("</head>"))S=S.replace("</head>",`${R}
9
9
  </head>`);else S=`${R}
10
- ${S}`}if(S=await ve(S,{router:o.router}),S=await b(S),o.minify!==!1)return{html:Ht(S),dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P};return{html:S,dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P}}function Ht(t){let r=[],n=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,l;while((l=o.exec(t))!==null){let u=t.slice(n,l.index);r.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=l[1],v=l[2],w=l[3];v=v.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),r.push(g+v+w),n=l.index+l[0].length}let e=t.slice(n);return r.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),r.join("").trim()}function zt(t){let r=0;for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);r=(r<<5)-r+o,r=r&r}return`"${Math.abs(r).toString(36)}"`}function Wt(t,r,n,o){if(n?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(r))return!0;return o.some((l)=>{if(l instanceof RegExp)return l.test(t);return l.endsWith("/")?t===l.slice(0,-1)||t.startsWith(l):t===l})}function qt(t,r){return`<?xml version="1.0" encoding="UTF-8"?>
10
+ ${S}`}if(S=await ve(S,{router:o.router}),S=await b(S),o.minify!==!1)return{html:Ht(S),dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P};return{html:S,dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P}}function Ht(t){let n=[],s=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,l;while((l=o.exec(t))!==null){let u=t.slice(s,l.index);n.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=l[1],v=l[2],w=l[3];v=v.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),n.push(g+v+w),s=l.index+l[0].length}let e=t.slice(s);return n.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),n.join("").trim()}function zt(t){let n=0;for(let s=0;s<t.length;s++){let o=t.charCodeAt(s);n=(n<<5)-n+o,n=n&n}return`"${Math.abs(n).toString(36)}"`}function Wt(t,n,s,o){if(s?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(n))return!0;return o.some((l)=>{if(l instanceof RegExp)return l.test(t);return l.endsWith("/")?t===l.slice(0,-1)||t.startsWith(l):t===l})}function qt(t,n){return`<?xml version="1.0" encoding="UTF-8"?>
11
11
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
12
- ${t.map((o)=>{let l=new URL(o.loc,r).href,e=` <url>
12
+ ${t.map((o)=>{let l=new URL(o.loc,n).href,e=` <url>
13
13
  <loc>${F(l)}</loc>`;if(o.lastmod)e+=`
14
14
  <lastmod>${o.lastmod}</lastmod>`;if(o.changefreq)e+=`
15
15
  <changefreq>${o.changefreq}</changefreq>`;if(o.priority!==void 0)e+=`
16
16
  <priority>${o.priority}</priority>`;return e+=`
17
17
  </url>`,e}).join(`
18
18
  `)}
19
- </urlset>`}function F(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Jt(t,r){let n=r.map((o)=>{let l=" <item>";if(l+=`
19
+ </urlset>`}function F(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Jt(t,n){let s=n.map((o)=>{let l=" <item>";if(l+=`
20
20
  <title>${F(o.title)}</title>`,l+=`
21
21
  <link>${F(o.link)}</link>`,o.description)l+=`
22
22
  <description>${F(o.description)}</description>`;if(o.pubDate)l+=`
@@ -34,18 +34,18 @@ ${t.map((o)=>{let l=new URL(o.loc,r).href,e=` <url>
34
34
  ${t.copyright?`<copyright>${F(t.copyright)}</copyright>`:""}
35
35
  <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
36
36
  <atom:link href="${t.link}/rss.xml" rel="self" type="application/rss+xml"/>
37
- ${n.join(`
37
+ ${s.join(`
38
38
  `)}
39
39
  </channel>
40
- </rss>`}async function Vt(t={}){let r=Date.now();rn();let n=await a(process.cwd()),o=n.build||{},l=await ut({explicit:t.domain||o.domain,stxConfig:n});if(l.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(dt());let e={router:t.router??n?.router??{},pagesDir:t.pagesDir||o.pagesDir||"pages",outputDir:t.outputDir||o.outputDir||"dist",baseUrl:t.baseUrl||o.baseUrl||"/",domain:l.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||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??o.minify??!0,generate404:t.generate404??o.generate404??!0,publicDir:t.publicDir||o.publicDir||"public",trailingSlash:t.trailingSlash??o.trailingSlash??!1,cleanOutput:t.cleanOutput??o.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||n?.partialsDir||"",componentsDir:t.componentsDir||n?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},g=new Set,v=0,w={},p={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&D.existsSync(e.outputDir))await D.promises.rm(e.outputDir,{recursive:!0});await D.promises.mkdir(e.outputDir,{recursive:!0});let E=e.cacheSalt;if(!E){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-hc4ydhw0.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:S}=await import("./chunk-h8zb6cek.js"),R=await S(e.publicDir,e.outputDir);if(R.count>0)console.log(`Optimized ${R.count} image(s) for responsive delivery`),E=[E,R.fingerprint].filter(Boolean).join(":");let A=new pt(e.cacheDir,E);if(e.cache)await A.load();try{let{generateCss:d}=await import("./chunk-hc4ydhw0.js");await d('<div class="bg-black"></div>')}catch{}_t();let wt=n?.routeMiddleware?.dir||"middleware";await Et(process.cwd(),wt);let V=Ct();if(V.length>0)console.log(`Loaded ${V.length} middleware: ${V.join(", ")}`);let yt=n?.routeMiddleware?.global||[];oc(n?.layoutsDir,c(process.cwd()));let Z=G(".",{pagesDir:e.pagesDir,pagesDirs:n?._layerPageDirs});console.log(`Found ${Z.length} routes`);let L=[];for(let d of Z)try{let m=await Ut(d);for(let k of m)L.push({route:d,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??e.revalidate})}catch(m){let k=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:k}),await e.hooks.onError?.(k,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,k)}u.totalPages=L.length+u.failedCount,console.log(`Generating ${L.length} pages...`);let U=[],Q=[];for(let d=0;d<L.length;d+=e.concurrency)Q.push(L.slice(d,d+e.concurrency));for(let d of Q)await Promise.all(d.map(async(m)=>{let{route:k,url:h,params:_,props:St,revalidate:rt}=m;try{await e.hooks.onPageStart?.(h);let M=await Bun.file(k.filePath).text(),T=Yt(M),xt=T?.middleware?Array.isArray(T.middleware)?T.middleware:[T.middleware]:[],nt=[...yt,...xt];if(nt.length>0){let B=Tt(h,_,T||{}),H=$t(B,null,void 0,{isServer:!0}),j=await Rt(nt,H);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,z=Zt(String(C),h),O=Qt(h,e);await D.promises.mkdir(f.dirname(O),{recursive:!0}),await Bun.write(O,z),u.successCount++,u.pages.push({route:h,outputPath:O,size:Buffer.byteLength(z),cached:!1}),U.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${C}`);return}}let it=T?.validate;if(typeof it==="function")try{if(!await it({params:_})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=A.get(h,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await mt(k,_,St,e,n);if(I=B.html,e.failOnIncludeError&&B.includeFailures.length>0)throw Error(`${B.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
40
+ </rss>`}async function Vt(t={}){let n=Date.now();sn();let s=await a(process.cwd()),o=s.build||{},l=await ut({explicit:t.domain||o.domain,stxConfig:s});if(l.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(dt());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:l.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||c(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,w={},p={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&D.existsSync(e.outputDir))await D.promises.rm(e.outputDir,{recursive:!0});await D.promises.mkdir(e.outputDir,{recursive:!0});let E=e.cacheSalt;if(!E){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-k0pm7p0f.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:S}=await import("./chunk-j6r964wk.js"),R=await S(e.publicDir,e.outputDir);if(R.count>0)console.log(`Optimized ${R.count} image(s) for responsive delivery`),E=[E,R.fingerprint].filter(Boolean).join(":");let A=new pt(e.cacheDir,E);if(e.cache)await A.load();try{let{generateCss:d}=await import("./chunk-k0pm7p0f.js");await d('<div class="bg-black"></div>')}catch{}Ct();let yt=s?.routeMiddleware?.dir||"middleware";await Tt(process.cwd(),yt);let J=Et();if(J.length>0)console.log(`Loaded ${J.length} middleware: ${J.join(", ")}`);let St=s?.routeMiddleware?.global||[];ic(s?.layoutsDir,c(process.cwd()));let Z=X(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${Z.length} routes`);let L=[];for(let d of Z)try{let m=await _t(d);for(let k of m)L.push({route:d,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??e.revalidate})}catch(m){let k=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:k}),await e.hooks.onError?.(k,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,k)}u.totalPages=L.length+u.failedCount,console.log(`Generating ${L.length} pages...`);let U=[],Q=[];for(let d=0;d<L.length;d+=e.concurrency)Q.push(L.slice(d,d+e.concurrency));for(let d of Q)await Promise.all(d.map(async(m)=>{let{route:k,url:h,params:_,props:xt,revalidate:rt}=m;try{await e.hooks.onPageStart?.(h);let M=await Bun.file(k.filePath).text(),T=Yt(M),bt=T?.middleware?Array.isArray(T.middleware)?T.middleware:[T.middleware]:[],nt=[...St,...bt];if(nt.length>0){let B=$t(h,_,T||{}),N=Rt(B,null,void 0,{isServer:!0}),j=await At(nt,N);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,H=Zt(String(C),h),O=Qt(h,e);await D.promises.mkdir(f.dirname(O),{recursive:!0}),await Bun.write(O,H),u.successCount++,u.pages.push({route:h,outputPath:O,size:Buffer.byteLength(H),cached:!1}),U.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${C}`);return}}let it=T?.validate;if(typeof it==="function")try{if(!await it({params:_})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=A.get(h,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await mt(k,_,xt,e,s);if(I=B.html,e.failOnIncludeError&&B.includeFailures.length>0)throw Error(`${B.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
41
41
  ${B.includeFailures.join(`
42
42
  `)}
43
43
  Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&B.serverScriptFailures.length>0)throw Error(`${B.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
44
44
  ${B.serverScriptFailures.join(`
45
45
  `)}
46
- Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)A.set(h,k.filePath,B.dependencies,I)}let N;if(e.trailingSlash)N=f.join(e.outputDir,h,"index.html");else N=h==="/"?f.join(e.outputDir,"index.html"):f.join(e.outputDir,`${h}.html`);if(e.chunkIslands){let{html:B,chunks:H}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(H.length>0){let j=f.join(e.outputDir,"_stx","islands");await D.promises.mkdir(j,{recursive:!0});for(let C of H){let z=f.join(j,`${C.hash}.js`);if(!await Bun.file(z).exists())await Bun.write(z,C.code);if(!g.has(C.hash)){g.add(C.hash);let O=Buffer.byteLength(C.code,"utf8");v+=O,w[C.hash]={bytes:O,file:`/_stx/islands/${C.hash}.js`}}}if(p[h]=H.map((C)=>C.hash),I=B,e.prefetchIslands)I=ct(I)}}if(await D.promises.mkdir(f.dirname(N),{recursive:!0}),await Bun.write(N,I),!Wt(h,I,T,e.sitemapExclude))U.push({loc:h,lastmod:new Date().toISOString().split("T")[0],priority:h==="/"?1:0.8});let at={route:h,outputPath:N,size:Buffer.byteLength(I,"utf8"),cached:st};if(rt!==!1)at.revalidateAt=Date.now()+rt*1000;u.pages.push(at),u.successCount++,await e.hooks.onPageEnd?.(h,I)}catch(M){u.failedCount++,u.errors.push({route:h,error:M}),await e.hooks.onError?.(M,h),console.error(`Error generating ${h}:`,M)}}));let tt=nn();if(tt.length>0){let d=tt.map((m)=>`${m.filePath}: ${m.message}`).join(`
46
+ Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)A.set(h,k.filePath,B.dependencies,I)}let G;if(e.trailingSlash)G=f.join(e.outputDir,h,"index.html");else G=h==="/"?f.join(e.outputDir,"index.html"):f.join(e.outputDir,`${h}.html`);if(e.chunkIslands){let{html:B,chunks:N}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(N.length>0){let j=f.join(e.outputDir,"_stx","islands");await D.promises.mkdir(j,{recursive:!0});for(let C of N){let H=f.join(j,`${C.hash}.js`);if(!await Bun.file(H).exists())await Bun.write(H,C.code);if(!g.has(C.hash)){g.add(C.hash);let O=Buffer.byteLength(C.code,"utf8");v+=O,w[C.hash]={bytes:O,file:`/_stx/islands/${C.hash}.js`}}}if(p[h]=N.map((C)=>C.hash),I=B,e.prefetchIslands)I=ct(I)}}if(await D.promises.mkdir(f.dirname(G),{recursive:!0}),await Bun.write(G,I),!Wt(h,I,T,e.sitemapExclude))U.push({loc:h,lastmod:new Date().toISOString().split("T")[0],priority:h==="/"?1:0.8});let at={route:h,outputPath:G,size:Buffer.byteLength(I,"utf8"),cached:st};if(rt!==!1)at.revalidateAt=Date.now()+rt*1000;u.pages.push(at),u.successCount++,await e.hooks.onPageEnd?.(h,I)}catch(M){u.failedCount++,u.errors.push({route:h,error:M}),await e.hooks.onError?.(M,h),console.error(`Error generating ${h}:`,M)}}));let tt=rn();if(tt.length>0){let d=tt.map((m)=>`${m.filePath}: ${m.message}`).join(`
47
47
  `);throw Error(`Client script bundling failed:
48
- ${d}`)}if(e.cache)await A.save();if(e.generate404){let d=f.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let m=new Set,k={...n,minifyClient:!0,debug:!1,cache:!1},h=await i(await Bun.file(d).text(),{},d,k,m);await Bun.write(f.join(e.outputDir,"404.html"),h)}else await Bun.write(f.join(e.outputDir,"404.html"),`<!DOCTYPE html>
48
+ ${d}`)}if(e.cache)await A.save();if(e.generate404){let d=f.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let m=new Set,k={...s,minifyClient:!0,debug:!1,cache:!1},h=await i(await Bun.file(d).text(),{},d,k,m);await Bun.write(f.join(e.outputDir,"404.html"),h)}else await Bun.write(f.join(e.outputDir,"404.html"),`<!DOCTYPE html>
49
49
  <html lang="en">
50
50
  <head>
51
51
  <meta charset="UTF-8">
@@ -66,7 +66,7 @@ ${d}`)}if(e.cache)await A.save();if(e.generate404){let d=f.join(e.pagesDir,"404.
66
66
  <a href="/">Go home</a>
67
67
  </div>
68
68
  </body>
69
- </html>`)}for(let d of[500]){let m=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...n,minifyClient:!0,debug:!1,cache:!1},_=await i(await Bun.file(m).text(),{},m,h,k);await Bun.write(f.join(e.outputDir,`${d}.html`),_)}}let K=f.join(e.pagesDir,"error.stx");if(await Bun.file(K).exists()){let d=new Set,m={...n,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(K).text(),{},K,m,d);await Bun.write(f.join(e.outputDir,"error.html"),k)}if(e.sitemap&&U.length>0){let d=qt(U,e.domain),m=f.join(e.outputDir,"sitemap.xml");await Bun.write(m,d),u.sitemapPath=m,console.log(`Generated sitemap.xml with ${U.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((h)=>typeof h==="string"),...d.disallow||[]],k=As({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...m.length>0?{disallow:m}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(f.join(e.outputDir,"robots.txt"),k),console.log("Generated robots.txt")}if(e.rss){let d=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(d.getItems)m=await d.getItems();let k=Jt(d,m),h=f.join(e.outputDir,"rss.xml");await Bun.write(h,k),u.rssPath=h,console.log(`Generated rss.xml with ${m.length} items`)}let W=rc(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=sc(e.outputDir);if(q.assets>0)console.log(`Externalized ${q.assets} repeated asset(s) from ${q.pages} page(s) (${(q.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&D.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=nr();if(et)await Y(et,f.join(e.outputDir,tr)),console.log(`Copied assets from ${en}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-r,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let E={generatedChunks:g.size,totalBytes:v,chunks:w,pages:p};await Bun.write(f.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(E,null,2))}await e.hooks.onBuildEnd?.(u);let P=u.islandChunks?`
69
+ </html>`)}for(let d of[500]){let m=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...s,minifyClient:!0,debug:!1,cache:!1},_=await i(await Bun.file(m).text(),{},m,h,k);await Bun.write(f.join(e.outputDir,`${d}.html`),_)}}let V=f.join(e.pagesDir,"error.stx");if(await Bun.file(V).exists()){let d=new Set,m={...s,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(V).text(),{},V,m,d);await Bun.write(f.join(e.outputDir,"error.html"),k)}if(e.sitemap&&U.length>0){let d=qt(U,e.domain),m=f.join(e.outputDir,"sitemap.xml");await Bun.write(m,d),u.sitemapPath=m,console.log(`Generated sitemap.xml with ${U.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((h)=>typeof h==="string"),...d.disallow||[]],k=As({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...m.length>0?{disallow:m}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(f.join(e.outputDir,"robots.txt"),k),console.log("Generated robots.txt")}if(e.rss){let d=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(d.getItems)m=await d.getItems();let k=Jt(d,m),h=f.join(e.outputDir,"rss.xml");await Bun.write(h,k),u.rssPath=h,console.log(`Generated rss.xml with ${m.length} items`)}let z=sc(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let W=oc(e.outputDir);if(W.assets>0)console.log(`Externalized ${W.assets} repeated asset(s) from ${W.pages} page(s) (${(W.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&D.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=nr();if(et)await Y(et,f.join(e.outputDir,tr)),console.log(`Copied assets from ${tn}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-n,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let E={generatedChunks:g.size,totalBytes:v,chunks:w,pages:p};await Bun.write(f.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(E,null,2))}await e.hooks.onBuildEnd?.(u);let P=u.islandChunks?`
70
70
  Island chunks: ${u.islandChunks.count} (${(u.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
71
71
  Build complete!
72
72
  Total: ${u.totalPages} pages
@@ -74,8 +74,8 @@ Build complete!
74
74
  Cached: ${u.cachedCount}
75
75
  Failed: ${u.failedCount}
76
76
  Time: ${u.buildTime}ms${P}
77
- `),u}async function Y(t,r){await D.promises.mkdir(r,{recursive:!0});let n=await D.promises.readdir(t,{withFileTypes:!0});for(let o of n){let l=f.join(t,o.name),e=f.join(r,o.name);if(o.isDirectory())await D.promises.mkdir(e,{recursive:!0}),await Y(l,e);else await D.promises.copyFile(l,e)}}function Kt(t={}){let r=t.cacheDir||c(process.cwd(),"ssg-cache"),n=new ht(r),o=t.revalidate||3600;return{async get(l){let e=await n.get(l);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(l).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${o}, stale-while-revalidate=${o*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(l){let u=G(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>l.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${l}`);return}let g=l.match(u.regex),v={};if(g)u.params.forEach((P,E)=>{v[P]=g[E+1]});let w=await a(),{html:p}=await mt(u,v,{},t,w);await n.set(l,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:zt(p)}),console.log(`Revalidated: ${l}`)},async invalidate(l){if(typeof l==="string")await n.invalidate(l);else await n.invalidatePattern(l)}}}function Xt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let r=await Bun.file(t).text(),n=r.match(/^---\n([\s\S]*?)\n---/),o={},l=r;if(n){let w=n[1];l=r.slice(n[0].length).trim();for(let p of w.split(`
78
- `)){let P=p.indexOf(":");if(P>0){let E=p.slice(0,P).trim(),S=p.slice(P+1).trim();if(S==="true")S=!0;else if(S==="false")S=!1;else if(/^\d+$/.test(S))S=parseInt(S,10);else if(/^\d+\.\d+$/.test(S))S=parseFloat(S);else if(S.startsWith("[")&&S.endsWith("]"))S=S.slice(1,-1).split(",").map((R)=>R.trim().replace(/^['"]|['"]$/g,""));o[E]=S}}}let e=l.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),u=[],g=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,v;while((v=g.exec(e))!==null){let w=parseInt(v[1],10),p=v[2],P=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:p,level:w})}return{content:e,data:o,toc:u}}}}function Yt(t){return bt(t)}function Zt(t,r){return`<!DOCTYPE html>
77
+ `),u}async function Y(t,n){await D.promises.mkdir(n,{recursive:!0});let s=await D.promises.readdir(t,{withFileTypes:!0});for(let o of s){let l=f.join(t,o.name),e=f.join(n,o.name);if(o.isDirectory())await D.promises.mkdir(e,{recursive:!0}),await Y(l,e);else await D.promises.copyFile(l,e)}}function Kt(t={}){let n=t.cacheDir||c(process.cwd(),"ssg-cache"),s=new ht(n),o=t.revalidate||3600;return{async get(l){let e=await s.get(l);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(l).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${o}, stale-while-revalidate=${o*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(l){let u=X(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>l.match(P.regex)!==null);if(!u){console.warn(`Route not found for revalidation: ${l}`);return}let g=l.match(u.regex),v={};if(g)u.params.forEach((P,E)=>{v[P]=g[E+1]});let w=await a(),{html:p}=await mt(u,v,{},t,w);await s.set(l,{html:p,generatedAt:Date.now(),revalidateAfter:Date.now()+o*1000,etag:zt(p)}),console.log(`Revalidated: ${l}`)},async invalidate(l){if(typeof l==="string")await s.invalidate(l);else await s.invalidatePattern(l)}}}function Xt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let n=await Bun.file(t).text(),s=n.match(/^---\n([\s\S]*?)\n---/),o={},l=n;if(s){let w=s[1];l=n.slice(s[0].length).trim();for(let p of w.split(`
78
+ `)){let P=p.indexOf(":");if(P>0){let E=p.slice(0,P).trim(),S=p.slice(P+1).trim();if(S==="true")S=!0;else if(S==="false")S=!1;else if(/^\d+$/.test(S))S=parseInt(S,10);else if(/^\d+\.\d+$/.test(S))S=parseFloat(S);else if(S.startsWith("[")&&S.endsWith("]"))S=S.slice(1,-1).split(",").map((R)=>R.trim().replace(/^['"]|['"]$/g,""));o[E]=S}}}let e=l.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),u=[],g=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,v;while((v=g.exec(e))!==null){let w=parseInt(v[1],10),p=v[2],P=p.toLowerCase().replace(/[^a-z0-9]+/g,"-");u.push({id:P,text:p,level:w})}return{content:e,data:o,toc:u}}}}function Yt(t){return wt(t)}function Zt(t,n){return`<!DOCTYPE html>
79
79
  <html>
80
80
  <head>
81
81
  <meta charset="utf-8">
@@ -87,4 +87,4 @@ Build complete!
87
87
  <p>Redirecting to <a href="${t}">${t}</a>...</p>
88
88
  <script>window.location.replace('${t}')</script>
89
89
  </body>
90
- </html>`}function Qt(t,r){if(t==="/"||t==="")return f.join(r.outputDir,"index.html");let n=t.replace(/^\/|\/$/g,"");if(r.trailingSlash)return f.join(r.outputDir,n,"index.html");return f.join(r.outputDir,`${n}.html`)}var je={generateStaticSite:Vt,createISRHandler:Kt,defineStaticPaths:J,createMarkdownLoader:Xt};export{Kt as createISRHandler,Xt as createMarkdownLoader,Nt as declaresPageAction,je as default,J as defineStaticPaths,Vt as generateStaticSite,Wt as isExcludedFromSitemap};
90
+ </html>`}function Qt(t,n){if(t==="/"||t==="")return f.join(n.outputDir,"index.html");let s=t.replace(/^\/|\/$/g,"");if(n.trailingSlash)return f.join(n.outputDir,s,"index.html");return f.join(n.outputDir,`${s}.html`)}var je={generateStaticSite:Vt,createISRHandler:Kt,defineStaticPaths:q,createMarkdownLoader:Xt};export{Kt as createISRHandler,Xt as createMarkdownLoader,Nt as declaresPageAction,je as default,q as defineStaticPaths,Vt as generateStaticSite,Wt as isExcludedFromSitemap};
@@ -163,6 +163,37 @@ export declare function splitTopLevelImports(code: string): { imports: string, b
163
163
  * across, not just its name.
164
164
  */
165
165
  export declare function extractTypeDeclarations(code: string): Array<{ name: string, text: string }>;
166
+ /**
167
+ * Top-level statements that bind a component's props: `const { a } =
168
+ * defineProps<Props>()`, with or without `withDefaults(...)` around the call.
169
+ *
170
+ * A prop is a server value as far as a script interpolation is concerned. The
171
+ * renderer resolves `{{ issueId }}` in a `<script client>` block against the
172
+ * component's props and writes the JSON literal in, wherever the props were
173
+ * declared -- and they are usually declared in a bare `<script>`, which is not
174
+ * a server block. Interpolations were inferred in the server block's scope
175
+ * only, so that documented pattern failed the gate with "Cannot find name" on
176
+ * code that renders correctly, and projects answered with a type-only
177
+ * `declare const` beside the mustache (stacksjs/stx#2180).
178
+ *
179
+ * Only the binding statement is carried across, not the block: a bare script
180
+ * is client code, and its signals and helpers are NOT available to an
181
+ * interpolation, so lifting the whole body would turn real "Cannot find name"
182
+ * errors into silence.
183
+ */
184
+ export declare function extractPropsDeclarations(code: string): string[];
185
+ /**
186
+ * The code a script interpolation is inferred against: the server blocks, plus
187
+ * the props a non-server block declares (see extractPropsDeclarations) and the
188
+ * types that declaration names.
189
+ *
190
+ * A server block that binds props itself already has them, and a type it
191
+ * declares under the same name wins, so neither is declared twice in the
192
+ * scope. Kept separate from the server code the payload and bridge checks
193
+ * read: those are about what a server block PUBLISHES, and a prop is not
194
+ * something it publishes.
195
+ */
196
+ export declare function interpolationScopeCode(blocks: readonly ScriptBlock[]): string;
166
197
  export declare function clientPayloadDeclarations(serverCode: string, clientCode?: string): string;
167
198
  /**
168
199
  * Declarations at the TOP LEVEL of a block, ignoring anything nested.
@@ -575,6 +575,54 @@ export function extractTypeDeclarations(code) {
575
575
  }
576
576
  return found;
577
577
  }
578
+ export function extractPropsDeclarations(code) {
579
+ const searchable = stripCommentsAndLiterals(code), found = [], start = /^[ \t]*(?:export[ \t]+)?(?:const|let|var)[ \t]+/gm;
580
+ let match, depth = 0, scanned = 0;
581
+ while ((match = start.exec(searchable)) !== null) {
582
+ for (;scanned < match.index; scanned++) {
583
+ const c = searchable[scanned];
584
+ if (c === "{" || c === "(" || c === "[")
585
+ depth++;
586
+ else if (c === "}" || c === ")" || c === "]")
587
+ depth = Math.max(0, depth - 1);
588
+ }
589
+ if (depth !== 0)
590
+ continue;
591
+ let nesting = 0, end = searchable.length;
592
+ for (let i = match.index + match[0].length;i < searchable.length; i++) {
593
+ const c = searchable[i];
594
+ if (c === "{" || c === "(" || c === "[")
595
+ nesting++;
596
+ else if (c === "}" || c === ")" || c === "]")
597
+ nesting--;
598
+ else if (nesting <= 0 && (c === ";" || c === `
599
+ `)) {
600
+ end = c === ";" ? i + 1 : i;
601
+ break;
602
+ }
603
+ }
604
+ if (/\bdefineProps\s*(?:<|\()/.test(searchable.slice(match.index, end)))
605
+ found.push(code.slice(match.index, end).replace(/^[ \t]*export[ \t]+/, "").trim());
606
+ }
607
+ return found;
608
+ }
609
+ export function interpolationScopeCode(blocks) {
610
+ const serverCode = blocks.filter((block) => block.kind === "server").map((block) => block.code).join(`
611
+ `);
612
+ if (/\bdefineProps\s*(?:<|\()/.test(stripCommentsAndLiterals(serverCode)))
613
+ return serverCode;
614
+ const serverTypes = declaredTypeNames(serverCode), propsScope = blocks.filter((block) => block.kind !== "server").flatMap((block) => {
615
+ const props = extractPropsDeclarations(block.code);
616
+ if (!props.length)
617
+ return [];
618
+ return [
619
+ ...extractTypeDeclarations(block.code).filter((entry) => !serverTypes.has(entry.name)).map((entry) => entry.text),
620
+ ...props
621
+ ];
622
+ });
623
+ return [serverCode, ...propsScope].filter(Boolean).join(`
624
+ `);
625
+ }
578
626
  function declaredTypeNames(code) {
579
627
  return new Set(extractTypeDeclarations(code).map((entry) => entry.name));
580
628
  }
@@ -831,8 +879,7 @@ export function collectImportedNames(code) {
831
879
  }
832
880
  export function buildVirtualTypeScript(source, options = {}) {
833
881
  const blocks = extractScriptBlocks(source), sourceLines = source.split(`
834
- `), lines = Array.from({ length: sourceLines.length }, () => ""), lineMap = new Map, scriptColumns = new Map, importColumns = new Map, scriptDeclarations = [], serverCode = blocks.filter((block) => block.kind === "server").map((block) => block.code).join(`
835
- `), components = options.filePath && options.templateExpressions !== !1 ? componentContractChecks(source, maskNonTemplateRegions(source), {
882
+ `), lines = Array.from({ length: sourceLines.length }, () => ""), lineMap = new Map, scriptColumns = new Map, importColumns = new Map, scriptDeclarations = [], serverCode = interpolationScopeCode(blocks), components = options.filePath && options.templateExpressions !== !1 ? componentContractChecks(source, maskNonTemplateRegions(source), {
836
883
  filePath: options.filePath,
837
884
  componentsDir: options.componentsDir,
838
885
  projectRoot: options.projectRoot,
@@ -20,7 +20,7 @@ export type { ScriptBlock, ScriptKind } from './stx-virtual-ts';
20
20
  * against the file containing it — so without this, `../target` was looked for
21
21
  * next to `.stx/typecheck/` (#1928).
22
22
  */
23
- export declare function buildScriptVirtualFile(block: ScriptBlock, serverCode?: string, originDir?: string): VirtualFile;
23
+ export declare function buildScriptVirtualFile(block: ScriptBlock, serverCode?: string, originDir?: string, interpolationScope?: unknown): VirtualFile;
24
24
  /** Compatibility string surface; checking also retains the source edit map. */
25
25
  export declare function buildVirtualSource(block: ScriptBlock, serverCode?: string, originDir?: string): string;
26
26
  /** Virtual path for a block, stable and traceable back to its origin. */
package/dist/typecheck.js CHANGED
@@ -17,6 +17,7 @@ import {
17
17
  declaredGlobalNames,
18
18
  firstLinePadding,
19
19
  isTemplateArtefact,
20
+ interpolationScopeCode,
20
21
  projectScriptInterpolations
21
22
  } from "./stx-virtual-ts.js";
22
23
  import { stxImportDiagnostics } from "./stx-module-imports.js";
@@ -25,9 +26,9 @@ export {
25
26
  extractScriptBlocks,
26
27
  extractTemplateExpressions
27
28
  } from "./stx-virtual-ts.js";
28
- export function buildScriptVirtualFile(block, serverCode = "", originDir = "") {
29
+ export function buildScriptVirtualFile(block, serverCode = "", originDir = "", interpolationScope = serverCode) {
29
30
  const leadingNewlines = block.startLine > 1 ? `
30
- `.repeat(block.startLine - 1) : "", projection = projectScriptInterpolations(firstLinePadding(block) + block.code, serverCode), code = blankScriptDirectives(projection.code), payload = block.kind === "client" || block.kind === "plain" ? clientPayloadDeclarations(serverCode, block.code) : "", lines = (leadingNewlines + code).split(`
31
+ `.repeat(block.startLine - 1) : "", projection = projectScriptInterpolations(firstLinePadding(block) + block.code, interpolationScope), code = blankScriptDirectives(projection.code), payload = block.kind === "client" || block.kind === "plain" ? clientPayloadDeclarations(serverCode, block.code) : "", lines = (leadingNewlines + code).split(`
31
32
  `), sourceLineCount = lines.length, lineMap = new Map;
32
33
  for (const declaration of projection.declarations)
33
34
  for (const [index, text] of declaration.text.split(`
@@ -220,7 +221,7 @@ export async function typecheckStxFiles(files, options = {}) {
220
221
  return checkServer;
221
222
  return checkClient;
222
223
  }), serverCode = extractScriptBlocks(source).filter((block) => block.kind === "server").map((block) => block.code).join(`
223
- `);
224
+ `), interpolationScope = interpolationScopeCode(extractScriptBlocks(source));
224
225
  for (const d of stxImportDiagnostics(source, blocks))
225
226
  importDiagnostics.push({
226
227
  file,
@@ -243,7 +244,7 @@ export async function typecheckStxFiles(files, options = {}) {
243
244
  blockCount += blocks.length;
244
245
  expressionCount += expressions;
245
246
  blocks.forEach((block, i) => {
246
- const virtual = buildScriptVirtualFile(block, serverCode, originDir);
247
+ const virtual = buildScriptVirtualFile(block, serverCode, originDir, interpolationScope);
247
248
  virtualFiles.set(virtualPathFor(file, block.kind, i), {
248
249
  virtual,
249
250
  source: virtual.text,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.849",
4
+ "version": "0.2.850",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -128,12 +128,12 @@
128
128
  "dependencies": {
129
129
  "@stacksjs/ts-css": "^0.3.21",
130
130
  "@stacksjs/clapp": "^0.2.16",
131
- "@stacksjs/desktop": "0.2.849",
132
- "@stacksjs/sanitizer": "0.2.849",
131
+ "@stacksjs/desktop": "0.2.850",
132
+ "@stacksjs/sanitizer": "0.2.850",
133
133
  "@stacksjs/ts-i18n": "^0.1.11",
134
- "bun-plugin-stx": "0.2.849",
134
+ "bun-plugin-stx": "0.2.850",
135
135
  "bunfig": "^0.15.21",
136
- "stx-router": "0.2.849",
136
+ "stx-router": "0.2.850",
137
137
  "ts-broadcasting": "^0.0.11",
138
138
  "ts-images": "^0.2.22",
139
139
  "ts-syntax-highlighter": "^0.2.1"