@stacksjs/stx 0.2.416 → 0.2.418

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 (213) hide show
  1. package/dist/chunk-072f6hnz.js +2 -0
  2. package/dist/{chunk-a47yp92z.js → chunk-072mzamc.js} +5 -5
  3. package/dist/{chunk-dd5fa7d6.js → chunk-08p07eq7.js} +2 -2
  4. package/dist/chunk-0x076wz1.js +2 -0
  5. package/dist/{chunk-zyxp0nb3.js → chunk-0xgf3xgy.js} +16 -16
  6. package/dist/chunk-1680nbq4.js +2816 -0
  7. package/dist/{chunk-7tabykst.js → chunk-25n4gmek.js} +2 -2
  8. package/dist/chunk-2gfj59pt.js +2 -0
  9. package/dist/chunk-2gntnw7e.js +2 -0
  10. package/dist/chunk-2hvvwhmv.js +2 -0
  11. package/dist/{chunk-rfdqrv5v.js → chunk-31a8eh0j.js} +4 -4
  12. package/dist/{chunk-vvs75dse.js → chunk-3aqe7wy7.js} +2 -2
  13. package/dist/{chunk-x0mq57pe.js → chunk-3f5td68v.js} +2 -2
  14. package/dist/chunk-3senpdjt.js +3 -0
  15. package/dist/{chunk-jr4dwkvc.js → chunk-3wmxb126.js} +2 -2
  16. package/dist/{chunk-znbay168.js → chunk-47h689h6.js} +2 -2
  17. package/dist/chunk-4bhertga.js +2 -0
  18. package/dist/chunk-4s9dypby.js +2 -0
  19. package/dist/{chunk-rqc4jx2v.js → chunk-5f3k2mke.js} +1 -1
  20. package/dist/{chunk-nj8edn4m.js → chunk-5fwy3xap.js} +3 -3
  21. package/dist/{chunk-zcctf7tx.js → chunk-5vzamjf6.js} +4 -4
  22. package/dist/chunk-5z56g0n4.js +2 -0
  23. package/dist/chunk-68rq2fqt.js +12 -0
  24. package/dist/chunk-6ad0nseq.js +2 -0
  25. package/dist/{chunk-rhw7pqhy.js → chunk-76japd6k.js} +4 -4
  26. package/dist/chunk-7eazcxzf.js +2 -0
  27. package/dist/chunk-7hy29tcy.js +2 -0
  28. package/dist/{chunk-gxrewzhv.js → chunk-7q1yy18q.js} +2 -2
  29. package/dist/{chunk-rp4khnan.js → chunk-85bm5xrm.js} +3 -3
  30. package/dist/{chunk-bfjzfrw3.js → chunk-865xvpp2.js} +2 -2
  31. package/dist/chunk-8fyqbq14.js +2 -0
  32. package/dist/chunk-92xzpt6p.js +2 -0
  33. package/dist/{chunk-sh5c60a2.js → chunk-94ky725r.js} +2 -2
  34. package/dist/{chunk-89xcpdsp.js → chunk-9af8qbwb.js} +5 -5
  35. package/dist/{chunk-m9xdkzm6.js → chunk-9bq4w4d6.js} +3 -3
  36. package/dist/chunk-9kmmafp4.js +2 -0
  37. package/dist/{chunk-gq97zh73.js → chunk-9r5ycpdg.js} +3 -3
  38. package/dist/{chunk-fctjn68q.js → chunk-9yt899e7.js} +6 -6
  39. package/dist/chunk-atgwc7r7.js +2 -0
  40. package/dist/{chunk-a688m6js.js → chunk-ayd5r3se.js} +2 -2
  41. package/dist/{chunk-yzv8n6qw.js → chunk-bk5ndwv3.js} +2 -2
  42. package/dist/chunk-bs6y5wy2.js +2 -0
  43. package/dist/{chunk-j8rxdbe5.js → chunk-bt11a8z4.js} +3 -3
  44. package/dist/{chunk-fkhxz1dx.js → chunk-c8p4v1rd.js} +5 -5
  45. package/dist/chunk-ccg6xjr1.js +2 -0
  46. package/dist/chunk-ckv4aty5.js +2 -0
  47. package/dist/{chunk-1ctvgd7v.js → chunk-d0ynfema.js} +1 -1
  48. package/dist/chunk-d6h9rpm4.js +30 -0
  49. package/dist/chunk-dbh7h0kt.js +2 -0
  50. package/dist/chunk-dhqkg0ph.js +2 -0
  51. package/dist/{chunk-6agy2x1f.js → chunk-dw961rvn.js} +2 -2
  52. package/dist/{chunk-h8wegkb5.js → chunk-dym1eteb.js} +1 -1
  53. package/dist/{chunk-41k0th97.js → chunk-e2m674vf.js} +4 -4
  54. package/dist/{chunk-9t2xx2y4.js → chunk-e83j8xe9.js} +4 -4
  55. package/dist/chunk-ettat5ah.js +2 -0
  56. package/dist/{chunk-cn9hgyh5.js → chunk-ev8bhsc0.js} +2 -2
  57. package/dist/chunk-f4ws0qcd.js +2 -0
  58. package/dist/chunk-f97v10zr.js +2 -0
  59. package/dist/chunk-fe5st320.js +2 -0
  60. package/dist/chunk-fet3hce8.js +2 -0
  61. package/dist/chunk-fq7128p1.js +2 -0
  62. package/dist/{chunk-y5cqkmkf.js → chunk-fr8jq2ys.js} +2 -2
  63. package/dist/chunk-fwy2h1ms.js +2 -0
  64. package/dist/{chunk-ddk6fx5b.js → chunk-fxhvkenf.js} +2 -2
  65. package/dist/{chunk-v096a6fw.js → chunk-g947brd0.js} +6 -6
  66. package/dist/{chunk-wjag92ch.js → chunk-gfm7g98y.js} +85 -85
  67. package/dist/chunk-gtkhykc4.js +2 -0
  68. package/dist/{chunk-vvp4cmfq.js → chunk-h8f18cc5.js} +6 -6
  69. package/dist/chunk-h8pkm7c5.js +2 -0
  70. package/dist/{chunk-yt6h8c6g.js → chunk-hg3tyzn5.js} +11 -11
  71. package/dist/{chunk-std6xw3y.js → chunk-hkxxfzfd.js} +2 -2
  72. package/dist/{chunk-3wrmz1j9.js → chunk-hm2k9a04.js} +7 -7
  73. package/dist/chunk-hneg0155.js +2 -0
  74. package/dist/chunk-hs90en70.js +2 -0
  75. package/dist/{chunk-n5k88y07.js → chunk-jfjym18d.js} +5 -5
  76. package/dist/chunk-jgsgd6rt.js +17 -0
  77. package/dist/chunk-jn3njpxs.js +2 -0
  78. package/dist/chunk-ka8x4sw6.js +18 -0
  79. package/dist/{chunk-9rnh52t2.js → chunk-kds79hq3.js} +11 -11
  80. package/dist/{chunk-rg6csnkw.js → chunk-kkj5x9rp.js} +1 -1
  81. package/dist/chunk-mcqn70v8.js +3 -0
  82. package/dist/chunk-mcs7p3fy.js +2 -0
  83. package/dist/{chunk-wpe72ann.js → chunk-mj6fme15.js} +5 -5
  84. package/dist/{chunk-yk63jd7v.js → chunk-mj9yv1vb.js} +1 -1
  85. package/dist/chunk-mmtg0jxd.js +2 -0
  86. package/dist/chunk-mrsxwd0h.js +2 -0
  87. package/dist/chunk-mscky0ww.js +2 -0
  88. package/dist/chunk-mtphm33a.js +2 -0
  89. package/dist/chunk-p2jbc71s.js +2 -0
  90. package/dist/{chunk-p1tb8kxq.js → chunk-pb0fgdvn.js} +4 -4
  91. package/dist/{chunk-at0ar6t3.js → chunk-psmdbcbc.js} +4 -4
  92. package/dist/chunk-pvd9k3kx.js +2 -0
  93. package/dist/chunk-pz1jc3db.js +2 -0
  94. package/dist/chunk-q8swb7na.js +4 -0
  95. package/dist/{chunk-7mbpjv9e.js → chunk-qmzwhtr2.js} +2 -2
  96. package/dist/chunk-qvr6e2ve.js +3 -0
  97. package/dist/chunk-ra0pkkvd.js +2 -0
  98. package/dist/chunk-rcbtd4w3.js +2 -0
  99. package/dist/chunk-rd2r9jvn.js +2 -0
  100. package/dist/chunk-s8srb8bg.js +2 -0
  101. package/dist/{chunk-3t0yaexe.js → chunk-sjjc670z.js} +9 -9
  102. package/dist/chunk-snf2b68p.js +2 -0
  103. package/dist/chunk-t2bfwr9v.js +2 -0
  104. package/dist/chunk-tbmwdahm.js +2 -0
  105. package/dist/{chunk-388rx71h.js → chunk-v15g9jjh.js} +6 -6
  106. package/dist/{chunk-de2pv6ys.js → chunk-vdqa5gt7.js} +2 -2
  107. package/dist/{chunk-rv5bk83t.js → chunk-vepc9rbt.js} +2 -2
  108. package/dist/{chunk-0es4h5v1.js → chunk-vfdwvt23.js} +2 -2
  109. package/dist/chunk-vpv896zx.js +2 -0
  110. package/dist/{chunk-3g8zzdgs.js → chunk-vyfg2qd2.js} +5 -5
  111. package/dist/{chunk-tfhjbjq5.js → chunk-w5zmvn7b.js} +3 -3
  112. package/dist/chunk-w6h63b48.js +2 -0
  113. package/dist/{chunk-cq408jrm.js → chunk-wgzxmh7w.js} +3 -3
  114. package/dist/{chunk-ppse812s.js → chunk-wpkxbggq.js} +1 -1
  115. package/dist/chunk-wrk3gkgg.js +2 -0
  116. package/dist/chunk-wtd71jsa.js +2 -0
  117. package/dist/{chunk-c4bkj1xw.js → chunk-wweasgq9.js} +18 -18
  118. package/dist/chunk-wymf1ek6.js +2 -0
  119. package/dist/chunk-wz8hyh8h.js +4 -0
  120. package/dist/chunk-x32wpjs0.js +2 -0
  121. package/dist/chunk-x4q2eyt0.js +2 -0
  122. package/dist/chunk-x95ejws0.js +2 -0
  123. package/dist/chunk-xket8ejt.js +2 -0
  124. package/dist/{chunk-t9axxwy9.js → chunk-xt6d3zws.js} +4 -4
  125. package/dist/{chunk-qff4qkx5.js → chunk-xvn3sv3v.js} +3 -3
  126. package/dist/{chunk-tfexmdkt.js → chunk-xwkdv585.js} +2 -2
  127. package/dist/{chunk-ae7j3n39.js → chunk-y9t55tv7.js} +6 -6
  128. package/dist/chunk-ypfzy1mq.js +2 -0
  129. package/dist/{chunk-7zjvsacw.js → chunk-yrbzsrde.js} +2 -2
  130. package/dist/chunk-zg68pwy8.js +2 -0
  131. package/dist/chunk-zs58fnme.js +2 -0
  132. package/dist/chunk-zy3p0vmx.js +3 -0
  133. package/dist/cli.js +21 -21
  134. package/dist/craft-entry.js +2 -2
  135. package/dist/craft.js +2 -2
  136. package/dist/dev-server/ts-css.d.ts +11 -0
  137. package/dist/dev-server/ts-css.js +13 -1
  138. package/dist/pwa.js +3 -3
  139. package/dist/ssg.js +17 -17
  140. package/package.json +5 -5
  141. package/dist/chunk-02k2v1mb.js +0 -2
  142. package/dist/chunk-0dh1rgg8.js +0 -2
  143. package/dist/chunk-0hrqt5c2.js +0 -2
  144. package/dist/chunk-0vtk2rpr.js +0 -2
  145. package/dist/chunk-1rd3jzrq.js +0 -2
  146. package/dist/chunk-26j2q9rq.js +0 -32
  147. package/dist/chunk-2py27bzq.js +0 -2
  148. package/dist/chunk-2qa7hjp2.js +0 -3
  149. package/dist/chunk-35e6zj5x.js +0 -2
  150. package/dist/chunk-3ch40ebr.js +0 -2
  151. package/dist/chunk-49cpqjx2.js +0 -2
  152. package/dist/chunk-4k1nkp9r.js +0 -2
  153. package/dist/chunk-50vq8k55.js +0 -2
  154. package/dist/chunk-56pkjk55.js +0 -2
  155. package/dist/chunk-5hnh00ry.js +0 -2
  156. package/dist/chunk-5j52h3e3.js +0 -2
  157. package/dist/chunk-5y1mekxe.js +0 -2
  158. package/dist/chunk-5zryk911.js +0 -2
  159. package/dist/chunk-72w28vm8.js +0 -2
  160. package/dist/chunk-7s7k94as.js +0 -2
  161. package/dist/chunk-7wb6jf17.js +0 -2
  162. package/dist/chunk-8cbkqckh.js +0 -2
  163. package/dist/chunk-8ycy1b0e.js +0 -2
  164. package/dist/chunk-8ygks6dx.js +0 -3
  165. package/dist/chunk-95165j9c.js +0 -4
  166. package/dist/chunk-9fyss0yk.js +0 -3
  167. package/dist/chunk-aqrnpgn7.js +0 -2
  168. package/dist/chunk-b9rebdtq.js +0 -2
  169. package/dist/chunk-c4thhfx9.js +0 -2
  170. package/dist/chunk-cw6kqb63.js +0 -2
  171. package/dist/chunk-d3vtgnep.js +0 -2
  172. package/dist/chunk-d4ynv4z2.js +0 -2
  173. package/dist/chunk-d7xrewxq.js +0 -2
  174. package/dist/chunk-dg1n3g1d.js +0 -2785
  175. package/dist/chunk-ecr598p7.js +0 -2
  176. package/dist/chunk-eev80mpy.js +0 -2
  177. package/dist/chunk-ef5vz9w5.js +0 -2
  178. package/dist/chunk-et0rr8c7.js +0 -3
  179. package/dist/chunk-f5qd84w8.js +0 -2
  180. package/dist/chunk-g69tnqga.js +0 -2
  181. package/dist/chunk-gacycmb0.js +0 -2
  182. package/dist/chunk-ggywfyzm.js +0 -2
  183. package/dist/chunk-gp1bhn7t.js +0 -2
  184. package/dist/chunk-gr3r9xdh.js +0 -2
  185. package/dist/chunk-gyv1t0f0.js +0 -30
  186. package/dist/chunk-hec0bvvf.js +0 -12
  187. package/dist/chunk-hg1eq72d.js +0 -2
  188. package/dist/chunk-hvyqs5tf.js +0 -2
  189. package/dist/chunk-kbysqxmd.js +0 -2
  190. package/dist/chunk-kjbv8a3m.js +0 -2
  191. package/dist/chunk-kmnsrvrp.js +0 -2
  192. package/dist/chunk-m6fvj7g1.js +0 -2
  193. package/dist/chunk-mgw2cvb7.js +0 -2
  194. package/dist/chunk-mvwt1c8f.js +0 -2
  195. package/dist/chunk-nvh31cxn.js +0 -2
  196. package/dist/chunk-p34gbb4z.js +0 -2
  197. package/dist/chunk-peyt18ce.js +0 -2
  198. package/dist/chunk-qpx8kvd8.js +0 -2
  199. package/dist/chunk-qzkebqm3.js +0 -4
  200. package/dist/chunk-rb272g9d.js +0 -3
  201. package/dist/chunk-rh1dyfsn.js +0 -2
  202. package/dist/chunk-rspc8gn8.js +0 -2
  203. package/dist/chunk-rvs61c88.js +0 -2
  204. package/dist/chunk-sf1vhfrb.js +0 -2
  205. package/dist/chunk-tc274fcv.js +0 -18
  206. package/dist/chunk-ty7t3gp4.js +0 -3
  207. package/dist/chunk-vc9wa97m.js +0 -2
  208. package/dist/chunk-wjzqz3yr.js +0 -2
  209. package/dist/chunk-x7j0krz8.js +0 -2
  210. package/dist/chunk-xkv0evbf.js +0 -2
  211. package/dist/chunk-y6rahx7t.js +0 -17
  212. package/dist/chunk-yt452b4a.js +0 -2
  213. package/dist/chunk-yxfx44fv.js +0 -2
package/dist/pwa.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{Nn,Oe,Di,Fa}from"./chunk-p1tb8kxq.js";import{Mn,Hr,La,ja,Ba}from"./chunk-3wrmz1j9.js";import{Ai,Pi,Ii,Ma,Na}from"./chunk-dd5fa7d6.js";import{ae,ft,Vr}from"./chunk-rp4khnan.js";import{Bc,Fc,zc,Hc,pr,ad}from"./chunk-znbay168.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-49cpqjx2.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{_n,Ae,Ci,Ea}from"./chunk-pb0fgdvn.js";import{Tn,Dr,ka,Ca,$a}from"./chunk-hm2k9a04.js";import{xi,Si,ki,xa,Sa}from"./chunk-08p07eq7.js";import{ie,ut,Or}from"./chunk-85bm5xrm.js";import{Rc,Ac,Pc,Ic,rr,Ju}from"./chunk-47h689h6.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-pvd9k3kx.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=ae(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Nn(n,t);if(a){let s=Oe(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 se(n,t){return Hr(n,t)}function oe(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,Pi as auditBuildOutput,Ai as auditConfig,re as buildPwaAssets,Ii as calculateAuditResult,Na as formatAuditResult,Vr as formatSize,j as generateManifest,_ as generateManifestJson,ja as generateManifestLink,F as generateOfflinePage,ae as generatePrecacheManifest,ft as generatePrecacheManifestJs,M as generatePwaIcons,Mn as generatePwaTags,Nn as generateServiceWorker,Fa as generateServiceWorkerAuto,La as generateSwRegistrationScript,Ba as generateThemeColorMeta,N as getExpectedIconPaths,Oe as getServiceWorkerFileName,Hr as injectPwaTags,oe as isPwaEnabled,I as isSharpAvailable,Di as isWorkboxEnabled,q as mergeManifestConfig,se as processPwaHtml,pr as pwaDirectives,Bc as pwaInstallDirective,zc as pwaOfflineDirective,Hc as pwaPushDirective,Fc as pwaUpdateDirective,ad as registerPwaDirectives,Ma 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=ie(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=_n(n,t);if(a){let s=Ae(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 Dr(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,Si as auditBuildOutput,xi as auditConfig,re as buildPwaAssets,ki as calculateAuditResult,Sa as formatAuditResult,Or as formatSize,j as generateManifest,_ as generateManifestJson,Ca as generateManifestLink,F as generateOfflinePage,ie as generatePrecacheManifest,ut as generatePrecacheManifestJs,M as generatePwaIcons,Tn as generatePwaTags,_n as generateServiceWorker,Ea as generateServiceWorkerAuto,ka as generateSwRegistrationScript,$a as generateThemeColorMeta,N as getExpectedIconPaths,Ae as getServiceWorkerFileName,Dr as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,Ci as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,rr as pwaDirectives,Rc as pwaInstallDirective,Pc as pwaOfflineDirective,Ic as pwaPushDirective,Ac as pwaUpdateDirective,Ju as registerPwaDirectives,xa as runPwaAudit,D as validateManifest};
package/dist/ssg.js CHANGED
@@ -1,17 +1,17 @@
1
1
  // @bun
2
- import"./chunk-c4bkj1xw.js";import"./chunk-ddk6fx5b.js";import{et,tt,nt,rt,st,it}from"./chunk-rhw7pqhy.js";import"./chunk-yzv8n6qw.js";import"./chunk-de2pv6ys.js";import{je,M,X,r,i}from"./chunk-dg1n3g1d.js";import{f}from"./chunk-26j2q9rq.js";import"./chunk-rfdqrv5v.js";import{rr}from"./chunk-zyxp0nb3.js";import"./chunk-gxrewzhv.js";import"./chunk-rv5bk83t.js";import"./chunk-bfjzfrw3.js";import"./chunk-41k0th97.js";import"./chunk-wpe72ann.js";import{ce,gt,mt}from"./chunk-y6rahx7t.js";import{Ti,_i,Ri}from"./chunk-nj8edn4m.js";import{pt,tn,nn}from"./chunk-rb272g9d.js";import"./chunk-qff4qkx5.js";import{o}from"./chunk-ty7t3gp4.js";import x from"fs";import g from"path";import{createHash as Dt}from"crypto";function Rt(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 Ct(t){return Bun.hash(t).toString(16)}function ut(t,s={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let a=new Map,n=t.replace(kt,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(s.minify)h=Rt(h);let S=Ct(h);if(!a.has(S))a.set(S,h);let P=s.integrity?` data-stx-integrity="sha384-${Dt("sha384").update(h).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),c=Array.from(a,([e,l])=>({hash:e,code:l}));return{html:n,chunks:c}}var Et=new Set(["visible","idle"]);function dt(t){if(!t.includes("data-stx-src="))return t;let s=new Map,a=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,n;while((n=a.exec(t))!==null)s.set(n[1],n[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(Et.has(s.get(l[1])||""))c.add(l[2]);let w=t.lastIndexOf("</head>");if(c.size===0||w===-1)return t;let y=Array.from(c).filter((h)=>!t.includes(`rel="prefetch" href="${h}"`)).map((h)=>`<link rel="prefetch" href="${h}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var It=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function q(t){let s=t.trim();if(!s)return null;let a=/^https?:\/\//i.test(s)?s:`https://${s}`;try{return new URL(a).origin+new URL(a).pathname.replace(/\/$/,"")}catch{return null}}function Bt(t){for(let s of It){let a=t[s];if(!a)continue;let n=q(a);if(n)return{url:n,source:"env",via:s}}return null}function ht(t){if(!t||typeof t!=="object")return null;let s=t,a=s.site?.url??s.url??s.app?.url;return typeof a==="string"?q(a):null}async function jt(t){let{existsSync:s}=await import("fs"),a=await import("path");for(let n of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=a.resolve(t,n);if(!s(c))continue;try{let e=await import(c),l=ht(e.default??e);if(l)return l}catch{}}return null}async function ft(t={}){let s=t.cwd??process.cwd(),a=t.env??process.env;if(t.explicit){let l=q(t.explicit);if(l)return{url:l,source:"option"}}let n=ht(t.stxConfig);if(n)return{url:n,source:"stx.config",via:"site.url"};let c=await jt(s);if(c)return{url:c,source:"site.config",via:"url"};let e=Bt(a);if(e)return e;return{url:"http://localhost",source:"fallback"}}function wt(){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
- `)}class yt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,s=""){this.cacheDir=t,this.salt=s}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let s=JSON.parse(await Bun.file(t).text());for(let[a,n]of Object.entries(s))this.cache.set(a,n)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),s={};for(let[a,n]of this.cache)s[a]=n;await Bun.write(t,JSON.stringify(s))}getHash(t,s){let a=x.statSync(t),n=`${this.salt}|${t}:${a.mtimeMs}`;for(let e of s)if(x.existsSync(e)){let l=x.statSync(e);n+=`:${e}:${l.mtimeMs}`}let c=0;for(let e=0;e<n.length;e++){let l=n.charCodeAt(e);c=(c<<5)-c+l,c=c&c}return Math.abs(c).toString(36)}get(t,s){let a=this.cache.get(t);if(!a)return null;let n=this.getHash(s,a.dependencies??[]);if(a.hash!==n)return this.cache.delete(t),null;return a.html}set(t,s,a,n){let c=this.getHash(s,a);this.cache.set(t,{hash:c,html:n,generatedAt:Date.now(),dependencies:a})}}class St{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let s=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",s)}async get(t){let s=this.getFilePath(t);if(!await Bun.file(s).exists())return null;try{return JSON.parse(await Bun.file(s).text())}catch{return null}}async set(t,s){let a=this.getFilePath(t);await x.promises.mkdir(g.dirname(a),{recursive:!0}),await Bun.write(a,JSON.stringify(s))}async invalidate(t){let s=this.getFilePath(t);if(await Bun.file(s).exists())await x.promises.unlink(s)}async invalidatePattern(t){let s=g.join(this.cacheDir,"isr");if(!x.existsSync(s))return;let a=await x.promises.readdir(s);for(let n of a){let c=n.replace(/_/g,"/").replace(".json","");if(t.test(c))await x.promises.unlink(g.join(s,n))}}async needsRevalidation(t){let s=await this.get(t);if(!s)return!0;return Date.now()>s.revalidateAfter}}async function Ft(t){try{let a=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!a)return null;let n=a[1];if(!n.includes("getStaticPaths"))return null;let c=n.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!c)return null;return await Function(`
2
+ import"./chunk-wweasgq9.js";import"./chunk-fxhvkenf.js";import{Ye,Ze,Qe,et,tt,nt}from"./chunk-76japd6k.js";import"./chunk-bk5ndwv3.js";import"./chunk-vdqa5gt7.js";import{f,Ne,M,q,r,i}from"./chunk-1680nbq4.js";import"./chunk-31a8eh0j.js";import{Kn}from"./chunk-0xgf3xgy.js";import"./chunk-7q1yy18q.js";import"./chunk-vepc9rbt.js";import"./chunk-865xvpp2.js";import"./chunk-e2m674vf.js";import"./chunk-mj6fme15.js";import{oe,dt,pt}from"./chunk-jgsgd6rt.js";import{bi,vi,wi}from"./chunk-5fwy3xap.js";import{lt,qt,Xt}from"./chunk-zy3p0vmx.js";import"./chunk-xvn3sv3v.js";import{a}from"./chunk-mcqn70v8.js";import x from"fs";import g from"path";import{createHash as bt}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 $t=/<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,s={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let o=new Map,n=t.replace($t,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(s.minify)h=Pt(h);let S=Dt(h);if(!o.has(S))o.set(S,h);let P=s.integrity?` data-stx-integrity="sha384-${bt("sha384").update(h).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),c=Array.from(o,([e,l])=>({hash:e,code:l}));return{html:n,chunks:c}}var Rt=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let s=new Map,o=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,n;while((n=o.exec(t))!==null)s.set(n[1],n[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(Rt.has(s.get(l[1])||""))c.add(l[2]);let w=t.lastIndexOf("</head>");if(c.size===0||w===-1)return t;let y=Array.from(c).filter((h)=>!t.includes(`rel="prefetch" href="${h}"`)).map((h)=>`<link rel="prefetch" href="${h}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var kt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function J(t){let s=t.trim();if(!s)return null;let o=/^https?:\/\//i.test(s)?s:`https://${s}`;try{return new URL(o).origin+new URL(o).pathname.replace(/\/$/,"")}catch{return null}}function Ct(t){for(let s of kt){let o=t[s];if(!o)continue;let n=J(o);if(n)return{url:n,source:"env",via:s}}return null}function ut(t){if(!t||typeof t!=="object")return null;let s=t,o=s.site?.url??s.url??s.app?.url;return typeof o==="string"?J(o):null}async function Et(t){let{existsSync:s}=await import("fs"),o=await import("path");for(let n of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=o.resolve(t,n);if(!s(c))continue;try{let e=await import(c),l=ut(e.default??e);if(l)return l}catch{}}return null}async function gt(t={}){let s=t.cwd??process.cwd(),o=t.env??process.env;if(t.explicit){let l=J(t.explicit);if(l)return{url:l,source:"option"}}let n=ut(t.stxConfig);if(n)return{url:n,source:"stx.config",via:"site.url"};let c=await Et(s);if(c)return{url:c,source:"site.config",via:"url"};let e=Ct(o);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ht(){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
+ `)}class ft{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,s=""){this.cacheDir=t,this.salt=s}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let s=JSON.parse(await Bun.file(t).text());for(let[o,n]of Object.entries(s))this.cache.set(o,n)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),s={};for(let[o,n]of this.cache)s[o]=n;await Bun.write(t,JSON.stringify(s))}getHash(t,s){let o=x.statSync(t),n=`${this.salt}|${t}:${o.mtimeMs}`;for(let e of s)if(x.existsSync(e)){let l=x.statSync(e);n+=`:${e}:${l.mtimeMs}`}let c=0;for(let e=0;e<n.length;e++){let l=n.charCodeAt(e);c=(c<<5)-c+l,c=c&c}return Math.abs(c).toString(36)}get(t,s){let o=this.cache.get(t);if(!o)return null;let n=this.getHash(s,o.dependencies??[]);if(o.hash!==n)return this.cache.delete(t),null;return o.html}set(t,s,o,n){let c=this.getHash(s,o);this.cache.set(t,{hash:c,html:n,generatedAt:Date.now(),dependencies:o})}}class mt{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let s=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",s)}async get(t){let s=this.getFilePath(t);if(!await Bun.file(s).exists())return null;try{return JSON.parse(await Bun.file(s).text())}catch{return null}}async set(t,s){let o=this.getFilePath(t);await x.promises.mkdir(g.dirname(o),{recursive:!0}),await Bun.write(o,JSON.stringify(s))}async invalidate(t){let s=this.getFilePath(t);if(await Bun.file(s).exists())await x.promises.unlink(s)}async invalidatePattern(t){let s=g.join(this.cacheDir,"isr");if(!x.existsSync(s))return;let o=await x.promises.readdir(s);for(let n of o){let c=n.replace(/_/g,"/").replace(".json","");if(t.test(c))await x.promises.unlink(g.join(s,n))}}async needsRevalidation(t){let s=await this.get(t);if(!s)return!0;return Date.now()>s.revalidateAfter}}async function It(t){try{let o=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let n=o[1];if(!n.includes("getStaticPaths"))return null;let c=n.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!c)return null;return await Function(`
4
4
  return (async function getStaticPaths() {
5
5
  ${c[1]}
6
6
  })()
7
- `)()}catch(s){return console.error(`Error extracting static paths from ${t}:`,s),null}}async function Ot(t){let s=[];if(!t.isDynamic)s.push({url:t.pattern,params:{}});else{let a=await Ft(t.filePath);if(!a||a.paths.length===0)return console.warn(`Warning: Dynamic route ${t.pattern} has no getStaticPaths or returned empty paths`),s;for(let n of a.paths){let c=t.pattern;for(let[e,l]of Object.entries(n.params))c=c.replace(`:${e}`,l).replace(`:${e}*`,l);s.push({url:c,params:n.params,props:n.props,revalidate:n.revalidate})}}return s}async function Tt(t){let s=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let a of s)if(await Bun.file(a).exists())try{let n=await import(a);if(typeof n.default==="function")return await n.default();else if(typeof n.default==="object")return n.default;else if(typeof n.getData==="function")return await n.getData();else{let{default:c,...e}=n;return e}}catch(n){console.error(`Error loading data file ${a}:`,n)}return null}async function At(t,s,a){let n=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!n)return null;let c=n[1];if(!c.includes("getStaticProps"))return null;try{let e=c.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
7
+ `)()}catch(s){return console.error(`Error extracting static paths from ${t}:`,s),null}}async function Bt(t){let s=[];if(!t.isDynamic)s.push({url:t.pattern,params:{}});else{let o=await It(t.filePath);if(!o||o.paths.length===0)return console.warn(`Warning: Dynamic route ${t.pattern} has no getStaticPaths or returned empty paths`),s;for(let n of o.paths){let c=t.pattern;for(let[e,l]of Object.entries(n.params))c=c.replace(`:${e}`,l).replace(`:${e}*`,l);s.push({url:c,params:n.params,props:n.props,revalidate:n.revalidate})}}return s}async function jt(t){let s=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let o of s)if(await Bun.file(o).exists())try{let n=await import(o);if(typeof n.default==="function")return await n.default();else if(typeof n.default==="object")return n.default;else if(typeof n.getData==="function")return await n.getData();else{let{default:c,...e}=n;return e}}catch(n){console.error(`Error loading data file ${o}:`,n)}return null}async function Ft(t,s,o){let n=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!n)return null;let c=n[1];if(!c.includes("getStaticProps"))return null;try{let e=c.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
8
8
  return (async function getStaticProps() {
9
9
  ${e[1]}
10
10
  })()
11
- `)(s)}catch(e){return console.error(`Error executing getStaticProps in ${a}:`,e),null}}function Lt(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 xt(t,s,a={},n,c){let e=await Bun.file(t.filePath).text(),l=await Tt(t.filePath),w=await At(e,s,t.filePath),y={...l||{},...w||{},...a,params:s,$route:{path:t.pattern,params:s}},h=new Set,S=[],P=[],D={...c,...n.partialsDir?{partialsDir:n.partialsDir}:{},...n.componentsDir?{componentsDir:n.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(b)=>{S.push(`${g.relative(process.cwd(),b.templatePath)}: ${b.message}
12
- resolved against partialsDir: ${b.partialsDir}`)},onServerScriptError:(b)=>{P.push(`${g.relative(process.cwd(),b.sourcePath)} (${b.kind}): ${b.message}`)}};if(Lt(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 p=await r(e,y,t.filePath,D,h);for(let b of[t.filePath,...h])for(let B of ce(b))h.add(B);if(Object.keys(s).length>0){let b=`<script>if(window.stx)window.stx._rp=${JSON.stringify(s)};else window.__stx_rp=${JSON.stringify(s)};</script>`;if(p.includes("</head>"))p=p.replace("</head>",`${b}
11
+ `)(s)}catch(e){return console.error(`Error executing getStaticProps in ${o}:`,e),null}}function Ot(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function wt(t,s,o={},n,c){let e=await Bun.file(t.filePath).text(),l=await jt(t.filePath),w=await Ft(e,s,t.filePath),y={...l||{},...w||{},...o,params:s,$route:{path:t.pattern,params:s}},h=new Set,S=[],P=[],D={...c,...n.partialsDir?{partialsDir:n.partialsDir}:{},...n.componentsDir?{componentsDir:n.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(b)=>{S.push(`${g.relative(process.cwd(),b.templatePath)}: ${b.message}
12
+ resolved against partialsDir: ${b.partialsDir}`)},onServerScriptError:(b)=>{P.push(`${g.relative(process.cwd(),b.sourcePath)} (${b.kind}): ${b.message}`)}};if(Ot(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 p=await r(e,y,t.filePath,D,h);for(let b of[t.filePath,...h])for(let B of oe(b))h.add(B);if(Object.keys(s).length>0){let b=`<script>if(window.stx)window.stx._rp=${JSON.stringify(s)};else window.__stx_rp=${JSON.stringify(s)};</script>`;if(p.includes("</head>"))p=p.replace("</head>",`${b}
13
13
  </head>`);else p=`${b}
14
- ${p}`}if(p=await X(p,{router:n.router}),p=await f(p),n.minify!==!1)return{html:Mt(p),dependencies:Array.from(h),includeFailures:S,serverScriptFailures:P};return{html:p,dependencies:Array.from(h),includeFailures:S,serverScriptFailures:P}}function Mt(t){let s=[],a=0,n=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=n.exec(t))!==null){let l=t.slice(a,c.index);s.push(l.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let w=c[1],y=c[2],h=c[3];y=y.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),s.push(w+y+h),a=c.index+c[0].length}let e=t.slice(a);return s.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),s.join("").trim()}function Ut(t){let s=0;for(let a=0;a<t.length;a++){let n=t.charCodeAt(a);s=(s<<5)-s+n,s=s&s}return`"${Math.abs(s).toString(36)}"`}function _t(t,s,a,n){if(a?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(s))return!0;return n.some((c)=>{if(c instanceof RegExp)return c.test(t);return c.endsWith("/")?t===c.slice(0,-1)||t.startsWith(c):t===c})}function Gt(t,s){return`<?xml version="1.0" encoding="UTF-8"?>
14
+ ${p}`}if(p=await q(p,{router:n.router}),p=await f(p),n.minify!==!1)return{html:Tt(p),dependencies:Array.from(h),includeFailures:S,serverScriptFailures:P};return{html:p,dependencies:Array.from(h),includeFailures:S,serverScriptFailures:P}}function Tt(t){let s=[],o=0,n=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=n.exec(t))!==null){let l=t.slice(o,c.index);s.push(l.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let w=c[1],y=c[2],h=c[3];y=y.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),s.push(w+y+h),o=c.index+c[0].length}let e=t.slice(o);return s.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),s.join("").trim()}function At(t){let s=0;for(let o=0;o<t.length;o++){let n=t.charCodeAt(o);s=(s<<5)-s+n,s=s&s}return`"${Math.abs(s).toString(36)}"`}function Lt(t,s,o,n){if(o?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(s))return!0;return n.some((c)=>{if(c instanceof RegExp)return c.test(t);return c.endsWith("/")?t===c.slice(0,-1)||t.startsWith(c):t===c})}function Mt(t,s){return`<?xml version="1.0" encoding="UTF-8"?>
15
15
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
16
16
  ${t.map((n)=>{let c=new URL(n.loc,s).href,e=` <url>
17
17
  <loc>${I(c)}</loc>`;if(n.lastmod)e+=`
@@ -20,7 +20,7 @@ ${t.map((n)=>{let c=new URL(n.loc,s).href,e=` <url>
20
20
  <priority>${n.priority}</priority>`;return e+=`
21
21
  </url>`,e}).join(`
22
22
  `)}
23
- </urlset>`}function I(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Nt(t,s){let a=s.map((n)=>{let c=" <item>";if(c+=`
23
+ </urlset>`}function I(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Ut(t,s){let o=s.map((n)=>{let c=" <item>";if(c+=`
24
24
  <title>${I(n.title)}</title>`,c+=`
25
25
  <link>${I(n.link)}</link>`,n.description)c+=`
26
26
  <description>${I(n.description)}</description>`;if(n.pubDate)c+=`
@@ -38,21 +38,21 @@ ${t.map((n)=>{let c=new URL(n.loc,s).href,e=` <url>
38
38
  ${t.copyright?`<copyright>${I(t.copyright)}</copyright>`:""}
39
39
  <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
40
40
  <atom:link href="${t.link}/rss.xml" rel="self" type="application/rss+xml"/>
41
- ${a.join(`
41
+ ${o.join(`
42
42
  `)}
43
43
  </channel>
44
- </rss>`}async function zt(t={}){let s=Date.now();mt();let a=await i(process.cwd()),n=a.build||{},c=await ft({explicit:t.domain||n.domain,stxConfig:a});if(c.source==="fallback"&&(t.sitemap??n.sitemap??!0))console.warn(wt());let e={router:t.router??a?.router??{},pagesDir:t.pagesDir||n.pagesDir||"pages",outputDir:t.outputDir||n.outputDir||"dist",baseUrl:t.baseUrl||n.baseUrl||"/",domain:c.url,revalidate:t.revalidate??n.revalidate??!1,sitemap:t.sitemap??n.sitemap??!0,sitemapExclude:t.sitemapExclude||n.sitemapExclude||[],robots:t.robots??n.robots??!0,rss:t.rss??n.rss??!1,concurrency:t.concurrency||n.concurrency||10,cache:t.cache??n.cache??!0,cacheDir:t.cacheDir||n.cacheDir||o(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??n.minify??!0,generate404:t.generate404??n.generate404??!0,publicDir:t.publicDir||n.publicDir||"public",trailingSlash:t.trailingSlash??n.trailingSlash??!1,cleanOutput:t.cleanOutput??n.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||a?.partialsDir||"",componentsDir:t.componentsDir||a?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,h={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-1rd3jzrq.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-7wb6jf17.js"),b=await p(e.publicDir,e.outputDir);if(b.count>0)console.log(`Optimized ${b.count} image(s) for responsive delivery`),D=[D,b.fingerprint].filter(Boolean).join(":");let B=new yt(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-1rd3jzrq.js");await u('<div class="bg-black"></div>')}catch{}et();let vt=a?.routeMiddleware?.dir||"middleware";await nt(process.cwd(),vt);let H=tt();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let bt=a?.routeMiddleware?.global||[];Ri(a?.layoutsDir,o(process.cwd()));let V=M(".",{pagesDir:e.pagesDir,pagesDirs:a?._layerPageDirs});console.log(`Found ${V.length} routes`);let G=[];for(let u of V){let m=await Ot(u);for(let v of m)G.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=G.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],K=[];for(let u=0;u<G.length;u+=e.concurrency)K.push(G.slice(u,u+e.concurrency));for(let u of K)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:L,props:Pt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Jt(j),$t=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],at=[...bt,...$t];if(at.length>0){let C=rt(d,L,F||{}),O=st(C,null,void 0,{isServer:!0}),E=await it(at,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,_=Vt(String(R),d),T=Kt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,_),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(_),cached:!1}),A.push({loc:d,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${d} \u2192 redirect to ${R}`);return}if(E.abort){let R=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${d} \u2014 middleware aborted: ${R}`);return}}let ot=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(ot)try{if(!await Function("route",`
45
- const validate = ${ot[1]};
44
+ </rss>`}async function _t(t={}){let s=Date.now();pt();let o=await i(process.cwd()),n=o.build||{},c=await gt({explicit:t.domain||n.domain,stxConfig:o});if(c.source==="fallback"&&(t.sitemap??n.sitemap??!0))console.warn(ht());let e={router:t.router??o?.router??{},pagesDir:t.pagesDir||n.pagesDir||"pages",outputDir:t.outputDir||n.outputDir||"dist",baseUrl:t.baseUrl||n.baseUrl||"/",domain:c.url,revalidate:t.revalidate??n.revalidate??!1,sitemap:t.sitemap??n.sitemap??!0,sitemapExclude:t.sitemapExclude||n.sitemapExclude||[],robots:t.robots??n.robots??!0,rss:t.rss??n.rss??!1,concurrency:t.concurrency||n.concurrency||10,cache:t.cache??n.cache??!0,cacheDir:t.cacheDir||n.cacheDir||a(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??n.minify??!0,generate404:t.generate404??n.generate404??!0,publicDir:t.publicDir||n.publicDir||"public",trailingSlash:t.trailingSlash??n.trailingSlash??!1,cleanOutput:t.cleanOutput??n.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||o?.partialsDir||"",componentsDir:t.componentsDir||o?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,h={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-w6h63b48.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-wrk3gkgg.js"),b=await p(e.publicDir,e.outputDir);if(b.count>0)console.log(`Optimized ${b.count} image(s) for responsive delivery`),D=[D,b.fingerprint].filter(Boolean).join(":");let B=new ft(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-w6h63b48.js");await u('<div class="bg-black"></div>')}catch{}Ye();let yt=o?.routeMiddleware?.dir||"middleware";await Qe(process.cwd(),yt);let H=Ze();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let St=o?.routeMiddleware?.global||[];wi(o?.layoutsDir,a(process.cwd()));let K=M(".",{pagesDir:e.pagesDir,pagesDirs:o?._layerPageDirs});console.log(`Found ${K.length} routes`);let G=[];for(let u of K){let m=await Bt(u);for(let v of m)G.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=G.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],X=[];for(let u=0;u<G.length;u+=e.concurrency)X.push(G.slice(u,u+e.concurrency));for(let u of X)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:L,props:xt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Ht(j),vt=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],rt=[...St,...vt];if(rt.length>0){let C=et(d,L,F||{}),O=tt(C,null,void 0,{isServer:!0}),E=await nt(rt,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,_=Wt(String(R),d),T=Jt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,_),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(_),cached:!1}),A.push({loc:d,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${d} \u2192 redirect to ${R}`);return}if(E.abort){let R=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${d} \u2014 middleware aborted: ${R}`);return}}let it=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(it)try{if(!await Function("route",`
45
+ const validate = ${it[1]};
46
46
  return validate(route);
47
- `)({params:L})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,ct=!1;if(e.cache){if(k=B.get(d,v.filePath),k)ct=!0,l.cachedCount++}if(!k){let C=await xt(v,L,Pt,e,a);if(k=C.html,e.failOnIncludeError&&C.includeFailures.length>0)throw Error(`${C.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
47
+ `)({params:L})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,st=!1;if(e.cache){if(k=B.get(d,v.filePath),k)st=!0,l.cachedCount++}if(!k){let C=await wt(v,L,xt,e,o);if(k=C.html,e.failOnIncludeError&&C.includeFailures.length>0)throw Error(`${C.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
48
48
  ${C.includeFailures.join(`
49
49
  `)}
50
50
  Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&C.serverScriptFailures.length>0)throw Error(`${C.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
51
51
  ${C.serverScriptFailures.join(`
52
52
  `)}
53
- Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)B.set(d,v.filePath,C.dependencies,k)}let U;if(e.trailingSlash)U=g.join(e.outputDir,d,"index.html");else U=d==="/"?g.join(e.outputDir,"index.html"):g.join(e.outputDir,`${d}.html`);if(e.chunkIslands){let{html:C,chunks:O}=ut(k,{integrity:e.integrityIslands,minify:e.minify});if(O.length>0){let E=g.join(e.outputDir,"_stx","islands");await x.promises.mkdir(E,{recursive:!0});for(let R of O){let _=g.join(E,`${R.hash}.js`);if(!await Bun.file(_).exists())await Bun.write(_,R.code);if(!w.has(R.hash)){w.add(R.hash);let T=Buffer.byteLength(R.code,"utf8");y+=T,h[R.hash]={bytes:T,file:`/_stx/islands/${R.hash}.js`}}}if(S[d]=O.map((R)=>R.hash),k=C,e.prefetchIslands)k=dt(k)}}if(await x.promises.mkdir(g.dirname(U),{recursive:!0}),await Bun.write(U,k),!_t(d,k,F,e.sitemapExclude))A.push({loc:d,lastmod:new Date().toISOString().split("T")[0],priority:d==="/"?1:0.8});let lt={route:d,outputPath:U,size:Buffer.byteLength(k,"utf8"),cached:ct};if(Q!==!1)lt.revalidateAt=Date.now()+Q*1000;l.pages.push(lt),l.successCount++,await e.hooks.onPageEnd?.(d,k)}catch(j){l.failedCount++,l.errors.push({route:d,error:j}),await e.hooks.onError?.(j,d),console.error(`Error generating ${d}:`,j)}}));let Y=gt();if(Y.length>0){let u=Y.map((m)=>`${m.filePath}: ${m.message}`).join(`
53
+ Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)B.set(d,v.filePath,C.dependencies,k)}let U;if(e.trailingSlash)U=g.join(e.outputDir,d,"index.html");else U=d==="/"?g.join(e.outputDir,"index.html"):g.join(e.outputDir,`${d}.html`);if(e.chunkIslands){let{html:C,chunks:O}=ot(k,{integrity:e.integrityIslands,minify:e.minify});if(O.length>0){let E=g.join(e.outputDir,"_stx","islands");await x.promises.mkdir(E,{recursive:!0});for(let R of O){let _=g.join(E,`${R.hash}.js`);if(!await Bun.file(_).exists())await Bun.write(_,R.code);if(!w.has(R.hash)){w.add(R.hash);let T=Buffer.byteLength(R.code,"utf8");y+=T,h[R.hash]={bytes:T,file:`/_stx/islands/${R.hash}.js`}}}if(S[d]=O.map((R)=>R.hash),k=C,e.prefetchIslands)k=ct(k)}}if(await x.promises.mkdir(g.dirname(U),{recursive:!0}),await Bun.write(U,k),!Lt(d,k,F,e.sitemapExclude))A.push({loc:d,lastmod:new Date().toISOString().split("T")[0],priority:d==="/"?1:0.8});let at={route:d,outputPath:U,size:Buffer.byteLength(k,"utf8"),cached:st};if(Q!==!1)at.revalidateAt=Date.now()+Q*1000;l.pages.push(at),l.successCount++,await e.hooks.onPageEnd?.(d,k)}catch(j){l.failedCount++,l.errors.push({route:d,error:j}),await e.hooks.onError?.(j,d),console.error(`Error generating ${d}:`,j)}}));let Y=dt();if(Y.length>0){let u=Y.map((m)=>`${m.filePath}: ${m.message}`).join(`
54
54
  `);throw Error(`Client script bundling failed:
55
- ${u}`)}if(e.cache)await B.save();if(e.generate404){let u=g.join(e.pagesDir,"404.stx");if(await Bun.file(u).exists()){let m=new Set,v={...a,debug:!1,cache:!1},d=await r(await Bun.file(u).text(),{},u,v,m);await Bun.write(g.join(e.outputDir,"404.html"),d)}else await Bun.write(g.join(e.outputDir,"404.html"),`<!DOCTYPE html>
55
+ ${u}`)}if(e.cache)await B.save();if(e.generate404){let u=g.join(e.pagesDir,"404.stx");if(await Bun.file(u).exists()){let m=new Set,v={...o,debug:!1,cache:!1},d=await r(await Bun.file(u).text(),{},u,v,m);await Bun.write(g.join(e.outputDir,"404.html"),d)}else await Bun.write(g.join(e.outputDir,"404.html"),`<!DOCTYPE html>
56
56
  <html lang="en">
57
57
  <head>
58
58
  <meta charset="UTF-8">
@@ -73,7 +73,7 @@ ${u}`)}if(e.cache)await B.save();if(e.generate404){let u=g.join(e.pagesDir,"404.
73
73
  <a href="/">Go home</a>
74
74
  </div>
75
75
  </body>
76
- </html>`)}for(let u of[500]){let m=g.join(e.pagesDir,`${u}.stx`);if(await Bun.file(m).exists()){let v=new Set,d={...a,debug:!1,cache:!1},L=await r(await Bun.file(m).text(),{},m,d,v);await Bun.write(g.join(e.outputDir,`${u}.html`),L)}}let W=g.join(e.pagesDir,"error.stx");if(await Bun.file(W).exists()){let u=new Set,m={...a,debug:!1,cache:!1},v=await r(await Bun.file(W).text(),{},W,m,u);await Bun.write(g.join(e.outputDir,"error.html"),v)}if(e.sitemap&&A.length>0){let u=Gt(A,e.domain),m=g.join(e.outputDir,"sitemap.xml");await Bun.write(m,u),l.sitemapPath=m,console.log(`Generated sitemap.xml with ${A.length} URLs`)}if(e.robots!==!1){let u=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((d)=>typeof d==="string"),...u.disallow||[]],v=rr({rules:[{userAgent:u.userAgent||"*",allow:u.allow||["/"],...m.length>0?{disallow:m}:{}}],...u.sitemap!==!1&&l.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(g.join(e.outputDir,"robots.txt"),v),console.log("Generated robots.txt")}if(e.rss){let u=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(u.getItems)m=await u.getItems();let v=Nt(u,m),d=g.join(e.outputDir,"rss.xml");await Bun.write(d,v),l.rssPath=d,console.log(`Generated rss.xml with ${m.length} items`)}let N=Ti(e.outputDir);if(N.assets>0)console.log(`Externalized ${N.assets} asset(s) from ${N.pages} page(s) (${(N.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let z=_i(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} repeated asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&x.existsSync(e.publicDir))await J(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let Z=nn();if(Z)await J(Z,g.join(e.outputDir,tn)),console.log(`Copied assets from ${pt}`)}catch(D){throw await e.hooks.onError?.(D),D}if(l.buildTime=Date.now()-s,w.size>0){l.islandChunks={count:w.size,totalBytes:y};let D={generatedChunks:w.size,totalBytes:y,chunks:h,pages:S};await Bun.write(g.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(D,null,2))}await e.hooks.onBuildEnd?.(l);let P=l.islandChunks?`
76
+ </html>`)}for(let u of[500]){let m=g.join(e.pagesDir,`${u}.stx`);if(await Bun.file(m).exists()){let v=new Set,d={...o,debug:!1,cache:!1},L=await r(await Bun.file(m).text(),{},m,d,v);await Bun.write(g.join(e.outputDir,`${u}.html`),L)}}let W=g.join(e.pagesDir,"error.stx");if(await Bun.file(W).exists()){let u=new Set,m={...o,debug:!1,cache:!1},v=await r(await Bun.file(W).text(),{},W,m,u);await Bun.write(g.join(e.outputDir,"error.html"),v)}if(e.sitemap&&A.length>0){let u=Mt(A,e.domain),m=g.join(e.outputDir,"sitemap.xml");await Bun.write(m,u),l.sitemapPath=m,console.log(`Generated sitemap.xml with ${A.length} URLs`)}if(e.robots!==!1){let u=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((d)=>typeof d==="string"),...u.disallow||[]],v=Kn({rules:[{userAgent:u.userAgent||"*",allow:u.allow||["/"],...m.length>0?{disallow:m}:{}}],...u.sitemap!==!1&&l.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(g.join(e.outputDir,"robots.txt"),v),console.log("Generated robots.txt")}if(e.rss){let u=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(u.getItems)m=await u.getItems();let v=Ut(u,m),d=g.join(e.outputDir,"rss.xml");await Bun.write(d,v),l.rssPath=d,console.log(`Generated rss.xml with ${m.length} items`)}let N=bi(e.outputDir);if(N.assets>0)console.log(`Externalized ${N.assets} asset(s) from ${N.pages} page(s) (${(N.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let z=vi(e.outputDir);if(z.assets>0)console.log(`Externalized ${z.assets} repeated asset(s) from ${z.pages} page(s) (${(z.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&x.existsSync(e.publicDir))await V(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let Z=Xt();if(Z)await V(Z,g.join(e.outputDir,qt)),console.log(`Copied assets from ${lt}`)}catch(D){throw await e.hooks.onError?.(D),D}if(l.buildTime=Date.now()-s,w.size>0){l.islandChunks={count:w.size,totalBytes:y};let D={generatedChunks:w.size,totalBytes:y,chunks:h,pages:S};await Bun.write(g.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(D,null,2))}await e.hooks.onBuildEnd?.(l);let P=l.islandChunks?`
77
77
  Island chunks: ${l.islandChunks.count} (${(l.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
78
78
  Build complete!
79
79
  Total: ${l.totalPages} pages
@@ -81,8 +81,8 @@ Build complete!
81
81
  Cached: ${l.cachedCount}
82
82
  Failed: ${l.failedCount}
83
83
  Time: ${l.buildTime}ms${P}
84
- `),l}async function J(t,s){await x.promises.mkdir(s,{recursive:!0});let a=await x.promises.readdir(t,{withFileTypes:!0});for(let n of a){let c=g.join(t,n.name),e=g.join(s,n.name);if(n.isDirectory())await x.promises.mkdir(e,{recursive:!0}),await J(c,e);else await x.promises.copyFile(c,e)}}function Ht(t={}){let s=t.cacheDir||o(process.cwd(),"ssg-cache"),a=new St(s),n=t.revalidate||3600;return{async get(c){let e=await a.get(c);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(c).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${n}, stale-while-revalidate=${n*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(c){let l=M(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>c.match(P.regex)!==null);if(!l){console.warn(`Route not found for revalidation: ${c}`);return}let w=c.match(l.regex),y={};if(w)l.params.forEach((P,D)=>{y[P]=w[D+1]});let h=await i(),{html:S}=await xt(l,y,{},t,h);await a.set(c,{html:S,generatedAt:Date.now(),revalidateAfter:Date.now()+n*1000,etag:Ut(S)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await a.invalidate(c);else await a.invalidatePattern(c)}}}function Wt(t){return async()=>({paths:await t(),fallback:!1})}function qt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let s=await Bun.file(t).text(),a=s.match(/^---\n([\s\S]*?)\n---/),n={},c=s;if(a){let h=a[1];c=s.slice(a[0].length).trim();for(let S of h.split(`
85
- `)){let P=S.indexOf(":");if(P>0){let D=S.slice(0,P).trim(),p=S.slice(P+1).trim();if(p==="true")p=!0;else if(p==="false")p=!1;else if(/^\d+$/.test(p))p=parseInt(p,10);else if(/^\d+\.\d+$/.test(p))p=parseFloat(p);else if(p.startsWith("[")&&p.endsWith("]"))p=p.slice(1,-1).split(",").map((b)=>b.trim().replace(/^['"]|['"]$/g,""));n[D]=p}}}let e=c.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),l=[],w=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,y;while((y=w.exec(e))!==null){let h=parseInt(y[1],10),S=y[2],P=S.toLowerCase().replace(/[^a-z0-9]+/g,"-");l.push({id:P,text:S,level:h})}return{content:e,data:n,toc:l}}}}function Jt(t){return je(t)}function Vt(t,s){return`<!DOCTYPE html>
84
+ `),l}async function V(t,s){await x.promises.mkdir(s,{recursive:!0});let o=await x.promises.readdir(t,{withFileTypes:!0});for(let n of o){let c=g.join(t,n.name),e=g.join(s,n.name);if(n.isDirectory())await x.promises.mkdir(e,{recursive:!0}),await V(c,e);else await x.promises.copyFile(c,e)}}function Gt(t={}){let s=t.cacheDir||a(process.cwd(),"ssg-cache"),o=new mt(s),n=t.revalidate||3600;return{async get(c){let e=await o.get(c);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(c).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${n}, stale-while-revalidate=${n*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(c){let l=M(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>c.match(P.regex)!==null);if(!l){console.warn(`Route not found for revalidation: ${c}`);return}let w=c.match(l.regex),y={};if(w)l.params.forEach((P,D)=>{y[P]=w[D+1]});let h=await i(),{html:S}=await wt(l,y,{},t,h);await o.set(c,{html:S,generatedAt:Date.now(),revalidateAfter:Date.now()+n*1000,etag:At(S)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await o.invalidate(c);else await o.invalidatePattern(c)}}}function Nt(t){return async()=>({paths:await t(),fallback:!1})}function zt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let s=await Bun.file(t).text(),o=s.match(/^---\n([\s\S]*?)\n---/),n={},c=s;if(o){let h=o[1];c=s.slice(o[0].length).trim();for(let S of h.split(`
85
+ `)){let P=S.indexOf(":");if(P>0){let D=S.slice(0,P).trim(),p=S.slice(P+1).trim();if(p==="true")p=!0;else if(p==="false")p=!1;else if(/^\d+$/.test(p))p=parseInt(p,10);else if(/^\d+\.\d+$/.test(p))p=parseFloat(p);else if(p.startsWith("[")&&p.endsWith("]"))p=p.slice(1,-1).split(",").map((b)=>b.trim().replace(/^['"]|['"]$/g,""));n[D]=p}}}let e=c.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),l=[],w=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,y;while((y=w.exec(e))!==null){let h=parseInt(y[1],10),S=y[2],P=S.toLowerCase().replace(/[^a-z0-9]+/g,"-");l.push({id:P,text:S,level:h})}return{content:e,data:n,toc:l}}}}function Ht(t){return Ne(t)}function Wt(t,s){return`<!DOCTYPE html>
86
86
  <html>
87
87
  <head>
88
88
  <meta charset="utf-8">
@@ -94,4 +94,4 @@ Build complete!
94
94
  <p>Redirecting to <a href="${t}">${t}</a>...</p>
95
95
  <script>window.location.replace('${t}')</script>
96
96
  </body>
97
- </html>`}function Kt(t,s){if(t==="/"||t==="")return g.join(s.outputDir,"index.html");let a=t.replace(/^\/|\/$/g,"");if(s.trailingSlash)return g.join(s.outputDir,a,"index.html");return g.join(s.outputDir,`${a}.html`)}var ye={generateStaticSite:zt,createISRHandler:Ht,defineStaticPaths:Wt,createMarkdownLoader:qt};export{Ht as createISRHandler,qt as createMarkdownLoader,Lt as declaresPageAction,ye as default,Wt as defineStaticPaths,zt as generateStaticSite,_t as isExcludedFromSitemap};
97
+ </html>`}function Jt(t,s){if(t==="/"||t==="")return g.join(s.outputDir,"index.html");let o=t.replace(/^\/|\/$/g,"");if(s.trailingSlash)return g.join(s.outputDir,o,"index.html");return g.join(s.outputDir,`${o}.html`)}var we={generateStaticSite:_t,createISRHandler:Gt,defineStaticPaths:Nt,createMarkdownLoader:zt};export{Gt as createISRHandler,zt as createMarkdownLoader,Ot as declaresPageAction,we as default,Nt as defineStaticPaths,_t as generateStaticSite,Lt as isExcludedFromSitemap};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.416",
4
+ "version": "0.2.418",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -122,12 +122,12 @@
122
122
  "dependencies": {
123
123
  "@stacksjs/ts-css": "^0.3.2",
124
124
  "@stacksjs/clapp": "^0.2.16",
125
- "@stacksjs/desktop": "0.2.416",
126
- "@stacksjs/sanitizer": "0.2.416",
125
+ "@stacksjs/desktop": "0.2.418",
126
+ "@stacksjs/sanitizer": "0.2.418",
127
127
  "@stacksjs/ts-i18n": "^0.1.11",
128
- "bun-plugin-stx": "0.2.416",
128
+ "bun-plugin-stx": "0.2.418",
129
129
  "bunfig": "^0.15.19",
130
- "stx-router": "0.2.416",
130
+ "stx-router": "0.2.418",
131
131
  "ts-broadcasting": "^0.0.11",
132
132
  "ts-images": "^0.2.22",
133
133
  "ts-syntax-highlighter": "^0.2.1"
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{de,At,er,ks,S,Ke}from"./chunk-gxrewzhv.js";export{At as currentRuntimeConfig,Ke as injectRuntimeConfig,S as resolveRuntimeConfig,ks as useRuntimeConfig,er as useServerRuntimeConfig,de as withRuntimeConfig};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Fl,zl,Hl,Vl,Ul,Wl,ql}from"./chunk-fkhxz1dx.js";export{zl as createKeepAliveCache,Vl as generateKeepAliveCSS,Ul as generateKeepAliveRuntime,Wl as onActivated,ql as onDeactivated,Fl as processKeepAliveDirectives,Hl as shouldCacheComponent};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{mi,Ca,Xt,yl,$a,Ea,Ta,bl}from"./chunk-gq97zh73.js";export{Xt as Validator,Ca as defineForm,$a as processErrorDirective,Ea as processErrorsDirective,bl as processFormValidationDirectives,Ta as processHasErrorsDirective,mi as useForm,yl as v};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Cs,$s,Es,Ts,tr,nr,Wu,qu,Xu,Ku,rr,Gu}from"./chunk-zyxp0nb3.js";import"./chunk-rfdqrv5v.js";import"./chunk-c4bkj1xw.js";export{Gu as generateDefaultRobotsTxt,rr as generateRobotsTxt,qu as generateSitemap,Xu as generateSitemapIndex,Ts as injectSeoTags,tr as metaDirective,Cs as processMetaDirectives,Es as processSeoDirective,$s as processStructuredData,Wu as registerSeoDirectives,Ku as scanForSitemapEntries,nr as structuredDataDirective};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Hu,wo,Vu,xo,$c,Ec,_t,un,Uu,Tc,_c,f}from"./chunk-26j2q9rq.js";export{_t as buildCss,Tc as extractClassNames,Ec as fingerprintConfig,_c as generateCss,Uu as getCachedCSS,Hu as getCssServeAsset,f as injectCss,wo as loadCssEngine,xo as loadCssEngineConfig,un as rebuildCss,Vu as resetCssCache,$c as resolveUserCssConfig};
@@ -1,32 +0,0 @@
1
- // @bun
2
- import{o}from"./chunk-ty7t3gp4.js";import h from"path";import{hasLocalConfig as Ae}from"bunfig";var ue={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function N(t){return`--stx-${t}`}function W(t,n){let r=n.lastIndexOf("-");if(r===-1)return typeof t[n]==="string"?t[n]:void 0;let s=t[n.slice(0,r)];if(!s||typeof s!=="object")return;let i=s[n.slice(r+1)];return typeof i==="string"?i:void 0}function de(t){let n={};for(let[r,s]of Object.entries(ue)){let i=W(t,s.light);if(i===void 0)continue;n[r]=`var(${N(r)}, ${i})`}return n}function ge(t){let n=[],r=[];for(let[s,i]of Object.entries(ue)){let a=W(t,i.light),c=W(t,i.dark);if(a===void 0)continue;if(n.push(` ${N(s)}: ${a};`),c!==void 0)r.push(` ${N(s)}: ${c};`)}if(n.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...n,"}",".dark {",...r,"}",""].join(`
3
- `)}var fe={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function pe(t){return`--stx-radius-${t}`}function he(){let t={};for(let[n,r]of Object.entries(fe))t[n]=`var(${pe(n)}, ${r.value})`;return t}function me(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(fe).map(([t,n])=>` ${pe(t)}: ${n.value};`),"}",""].join(`
4
- `)}function ye(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}function F(t,n){let r={...t};for(let[s,i]of Object.entries(n))r[s]=ye(i)&&ye(r[s])?F(r[s],i):i;return r}function be(t={},n={}){let r=t.theme||{},s=n.theme||{},{extend:i,...a}=s,{extend:c,...d}=r,l=d.colors||{};d.colors={...l,...de(l)};let u=d.borderRadius||{};d.borderRadius={...u,...he()};let g=F(d,a),p=F(c||{},i||{});if(Object.keys(p).length>0)g.extend=p;let m=[...t.safelist||[],...n.safelist||[]],S={...t.shortcuts||{},...n.shortcuts||{}},C=[...t.preflights||[],...n.preflights||[]];return{config:{...t,...n,theme:g,safelist:m,shortcuts:S,...C.length>0?{preflights:C}:{},content:[],output:""},safelist:m,shortcuts:S,includePreflight:n.preflight!==!1,minify:n.minify===!0,tokenCSS:ge(l)+me()}}var _=/<script\b[^>]*>/iy,q=/<\/script\s*>/ig,M=/<style\b[^>]*>/iy,Q=/<\/style\s*>/ig;function Se(t,n,r,s){r.lastIndex=n;let i=r.exec(t);if(!i||i.index!==n)return-1;s.lastIndex=r.lastIndex;let a=s.exec(t);if(!a)return-1;return a.index+a[0].length}function G(t,n){return Se(t,n,_,q)}function $t(t,n){return Se(t,n,M,Q)}function xe(t,n){if(!t.startsWith("<!--",n))return-1;let r=t.indexOf("-->",n+4);if(r===-1)return-1;return r+3}function Ce(t,n){if(t.startsWith("<!--",n)){let i=xe(t,n);return i===-1?t.length:i}if(_.lastIndex=n,_.exec(t)?.index===n){q.lastIndex=_.lastIndex;let i=q.exec(t);return i?i.index+i[0].length:t.length}if(M.lastIndex=n,M.exec(t)?.index===n){Q.lastIndex=M.lastIndex;let i=Q.exec(t);return i?i.index+i[0].length:t.length}return-1}function Et(t,n){let r=[],s=0,i=t.length,a=!1,c=null;while(s<i){let d=t[s];if(a){if(c){if(d===c)c=null}else if(d==='"'||d==="'")c=d;else if(d===">")a=!1;s++;continue}if(d!=="<"){let p=t.indexOf("<",s+1);if(p===-1)break;s=p;continue}let l=n(t,s);if(l>s){r.push({start:s,end:l,token:t.slice(s,l)}),s=l;continue}let u=Ce(t,s);if(u>s){s=u;continue}let g=t.charCodeAt(s+1);if(g>=65&&g<=90||g>=97&&g<=122)a=!0;s++}return r}function vo(t){let n=0,r=0,s=0,i=!1,a=null;while(s<t.length){if(i){let p=t[s];if(a){if(p===a)a=null}else if(p==='"'||p==="'")a=p;else if(p===">")i=!1;s++;continue}let c=t.indexOf("<",s),d=c===-1?t.length:c;while(s<d){let p=t[s++];if(p==="{")n++;else if(p==="}")r++;if(n>=2&&r>=2)return!0}if(c===-1)break;let l=Ce(t,c);if(l>c){s=l;continue}let u=t.charCodeAt(c+1),g=u===47?t.charCodeAt(c+2):u;if(g>=65&&g<=90||g>=97&&g<=122)i=!0;s=c+1}return!1}function Zn(t,n){while(t.size>=n){let r=t.keys().next();if(r.done)return;t.delete(r.value)}}var Ve=65536,He=12,U=new Map;function ne(t,n,r,s){let i=s!==void 0&&t.length>=Ve,a=i?`${s}\x00${t}`:"";if(i){let g=U.get(a);if(g)return{output:g.output,tokens:g.tokens.slice()}}let c=Et(t,n);if(c.length===0)return{output:t,tokens:[]};let d=c.map((g)=>g.token),l="",u=0;for(let g=0;g<c.length;g++){let p=c[g];l+=t.slice(u,p.start),l+=r(p.token,g),u=p.end}if(l+=t.slice(u),i)return Zn(U,He),U.set(a,{output:l,tokens:d}),{output:l,tokens:d.slice()};return{output:l,tokens:d}}var Ke=65536,Ne=4,Y=new Map;function X(t,n,r){return{output:n,scripts:r,restore:(s)=>s===n?t:Tt(s,r)}}function V(t){let n=t.length>=Ke;if(n){let i=Y.get(t);if(i)return X(t,i.output,i.scripts.slice())}let{output:r,tokens:s}=ne(t,G,(i,a)=>`\x00STX_SCRIPT_${a}\x00`);if(n)return Zn(Y,Ne),Y.set(t,{output:r,scripts:s}),X(t,r,s.slice());return X(t,r,s)}function Tt(t,n){if(n.length===0)return t;return t.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(r,s)=>n[+s]??"")}function ke(t,n=""){let r=`${t}${n}`,s=0;for(let i=0;i<r.length;i++){let a=r.charCodeAt(i);s=(s<<5)-s+a,s=s&s}return`stx-${Math.abs(s).toString(36)}`}function we(t,n,r={}){let{prefix:s="",preserveHost:i=!0,scopeKeyframes:a=!0,scopeCustomProperties:c=!1}=r;if(!t.trim())return"";let d=J(t),l=[],u=new Map;if(a)for(let g of d){let p=g.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(p){let m=p[1],S=`${n}_${m}`;u.set(m,S)}}for(let g of d){let p=Te(g,n,s,i,u,c);l.push(p)}return l.join(`
5
-
6
- `)}function J(t){let n=[],r=t.replace(/\/\*[\s\S]*?\*\//g,""),s=0,i="",a=!1,c="";for(let d=0;d<r.length;d++){let l=r[d];if(l==="@"&&s===0)a=!0;if(l==="{")s++;else if(l==="}"){if(s--,s===0){if(a){c+=l;let u=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(u){let[,g,p,m]=u;if(g==="keyframes")n.push({selector:`@keyframes ${p.trim()}`,declarations:m.trim()});else if(g==="media"||g==="supports"||g==="container"){let S=J(m);n.push({selector:`@${g} ${p.trim()}`,declarations:S.map((C)=>`${C.selector} { ${C.declarations} }`).join(`
7
- `)})}else n.push({selector:`@${g} ${p.trim()}`,declarations:m.trim()})}c="",a=!1}else if(i.trim()){i+=l;let u=i.match(/([^{]+)\{([^}]*)\}/);if(u)n.push({selector:u[1].trim(),declarations:u[2].trim()});i=""}continue}}if(a)c+=l;else i+=l}return n}function Te(t,n,r,s,i,a){let{selector:c,declarations:d}=t;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let g=c.replace("@keyframes ","").trim();return`@keyframes ${i.get(g)||g} { ${d} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let p=J(`x { ${d} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((m)=>Te(m,n,r,s,i,a)).join(`
8
- `);return`${c} {
9
- ${p}
10
- }`}return`${c} { ${d} }`}let l=We(c,n,r,s),u=d;for(let[g,p]of i)u=u.replace(new RegExp(`\\b${g}\\b`,"g"),p);if(a)u=u.replace(/--([a-z-]+)/gi,`--${n}-$1`);return`${l} { ${u} }`}function We(t,n,r,s){let i=t.split(",").map((c)=>c.trim()),a=[];for(let c of i){if(c.startsWith(":host")){if(s)a.push(c);else{let u=c.replace(/:host(\([^)]*\))?/,`.${n}$1`);a.push(u)}continue}if(c.includes("::slotted")){a.push(c);continue}if(c===":root"){a.push(`:root .${n}`);continue}let d=r?`${r} .${n}`:`.${n}`;a.push(`${d} ${c}`);let l=Fe(c,n);if(l)a.push(r?`${r} ${l}`:l)}return a.join(", ")}function Fe(t,n){let r=0,s=t.length;for(let l=0;l<t.length;l++){let u=t[l];if(u==="["||u==="(")r++;else if(u==="]"||u===")")r--;else if(r===0&&(u===" "||u===">"||u==="+"||u==="~")){s=l;break}}let i=t.slice(0,s),a=t.slice(s);if(!i)return"";let c=i.length,d=0;for(let l=0;l<i.length;l++){let u=i[l];if(u==="["||u==="(")d++;else if(u==="]"||u===")")d--;else if(r===0&&d===0&&u===":"){c=l;break}}return`${i.slice(0,c)}.${n}${i.slice(c)}${a}`}var Ee=String.raw`(?<![\w-])scoped(?![\w-])`,Z=/<style\s+([^>]*)>/gi,ve=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Re=new RegExp(Ee,"i"),Ue=new RegExp(Ee,"gi"),ee=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Ge(t){Z.lastIndex=0;let n=Z.exec(t);while(n!==null){if(Re.test(n[1]))return!0;n=Z.exec(t)}return!1}function te(t){let n=new Set,r=[];ee.lastIndex=0;let s=ee.exec(t);while(s!==null){let i=s[0].trim();if(n.has(i))r.push({start:s.index,end:s.index+s[0].length});else n.add(i);s=ee.exec(t)}return r}function ln(t){let n=te(t);if(n.length===0)return t;let r=Array(n.length+1),s=0;for(let i=0;i<n.length;i++){let a=n[i];r[i]=t.slice(s,a.start),s=a.end}return r[n.length]=t.slice(s),r.join("")}function Qn(t,n){if(!Ge(t))return{html:t,hasScoped:!1};let r=ke(n),s=`data-v-${r}`,i=t,a=!1;if(ve.lastIndex=0,i=i.replace(ve,(c,d,l)=>{if(!Re.test(d))return c;a=!0;let u=Ye(l,s),g=d.replace(Ue,"").trim(),p=g?` ${g}`:"";return`<style data-stx-scoped="${r}"${p}>${u}</style>`}),!a)return{html:t,hasScoped:!1};return i=Qe(i,s),{html:i,hasScoped:!0}}function Ye(t,n){return we(t,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${n}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${n}]`)}var qe=(t)=>`\x00stx-scope-mask-${t}\x00`,$e=/\u0000stx-scope-mask-(\d+)\u0000/g;function Qe(t,n){let r=ne(t,(i,a)=>{let c=G(i,a);return c>a?c:$t(i,a)},(i,a)=>qe(a)),s=Je(r.output,n);return $e.lastIndex=0,s.replace($e,(i,a)=>r.tokens[Number(a)])}function Je(t,n){let r=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return t.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(s,i,a)=>{if(r.has(i.toLowerCase()))return s;if(s.includes(n))return s;if(i.toLowerCase()==="style"||i.toLowerCase()==="script")return s;if(a)return s.replace(`<${i}${a}`,`<${i} ${n}${a}`);if(s.endsWith("/>"))return`<${i} ${n} />`;return`<${i} ${n}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};import _e from"fs";class z{cache=new Map;maxSize;options;sizes;bytes=0;constructor(t=100,n){this.maxSize=t,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(t){if(!this.options)return;this.options={...this.options,maxBytes:t};while(this.bytes>t&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(t){if(!this.cache.has(t))return;let n=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,n),n}set(t,n){if(this.cache.has(t))this.delete(t);let r=this.options?this.options.sizeOf(n):0;if(this.options&&r>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+r>this.options.maxBytes)){let s=this.cache.keys().next().value;if(s===void 0)break;this.delete(s)}if(this.cache.set(t,n),this.sizes)this.sizes.set(t,r),this.bytes+=r}has(t){return this.cache.has(t)}delete(t){if(this.sizes){let n=this.sizes.get(t);if(n!==void 0)this.bytes-=n,this.sizes.delete(t)}return this.cache.delete(t)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var T=new Map,Ze=500;function Xe(t,n){if(n?.includes("g"))return new RegExp(t,n);let r=`${t}:${n||""}`;if(!T.has(r)){if(T.size>=Ze){let s=T.keys().next().value;if(s)T.delete(s)}T.set(r,new RegExp(t,n))}return T.get(r)}class Pe{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(t){let n=Array.from(new Set(t)),r=n.sort().join(","),s=this.pool.find((d)=>d.context.join(",")===r);if(s)return s.func;let i=this.fnCache,a=this.fnCacheMaxSize,c=(...d)=>(l)=>{try{let u=`${r}:${l}`,g=i.get(u);if(!g){if(i.size>=a){let p=i.keys().next().value;if(p)i.delete(p)}g=Function(...n,`
11
- 'use strict';
12
- try {
13
- return ${l};
14
- }
15
- catch (e) {
16
- if (e instanceof ReferenceError || e instanceof TypeError) {
17
- return undefined;
18
- }
19
- throw e;
20
- }
21
- `),i.set(u,g)}return g(...d)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:c,context:n.slice()});return c}clear(){this.pool.length=0,this.fnCache.clear()}}var St=new Pe;class Be{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(t){this.enabled=t}isEnabled(){return this.enabled}setBudget(t,n){this.budgets.set(t,{warnThreshold:0.8,action:"warn",...n})}setBudgets(t){for(let[n,r]of Object.entries(t))this.setBudget(n,r)}removeBudget(t){this.budgets.delete(t)}getBudgets(){let t={};for(let[n,r]of this.budgets.entries())t[n]=r;return t}onViolation(t){this.violationHandlers.push(t)}offViolation(t){let n=this.violationHandlers.indexOf(t);if(n!==-1)this.violationHandlers.splice(n,1)}time(t,n){if(!this.enabled)return n();let r=performance.now(),s=n(),i=performance.now()-r;return this.recordTime(t,i),this.checkBudget(t,i),s}async timeAsync(t,n){if(!this.enabled)return n();let r=performance.now(),s=await n(),i=performance.now()-r;return this.recordTime(t,i),this.checkBudget(t,i),s}checkBudget(t,n){let r=this.budgets.get(t);if(!r)return;let s=n/r.maxTime*100,i=r.warnThreshold!==void 0?n>=r.maxTime*r.warnThreshold&&n<r.maxTime:!1,a=n>=r.maxTime;if(!i&&!a)return;let c={label:t,actualTime:n,budgetTime:r.maxTime,exceedancePercent:s,timestamp:new Date,isWarning:i};this.violations.push(c);while(this.violations.length>this.maxViolations)this.violations.shift();for(let l of this.violationHandlers)try{l(c)}catch{}let d=i?`[Performance Warning] "${t}" took ${n.toFixed(2)}ms (${s.toFixed(1)}% of ${r.maxTime}ms budget)`:`[Performance Budget Exceeded] "${t}" took ${n.toFixed(2)}ms (exceeded ${r.maxTime}ms budget by ${(s-100).toFixed(1)}%)`;switch(r.action){case"log":console.log(d);break;case"warn":console.warn(d);break;case"error":console.error(d);break;case"throw":if(a)throw Error(d);else console.warn(d);break}}recordTime(t,n){let r=this.metrics.get(t);if(r)r.count++,r.totalTime+=n,r.maxTime=Math.max(r.maxTime,n),r.minTime=Math.min(r.minTime,n);else this.metrics.set(t,{count:1,totalTime:n,maxTime:n,minTime:n})}getStats(t){if(t){let r=this.metrics.get(t);if(!r)return{};let s=this.budgets.get(t);return{count:r.count,avgTime:r.totalTime/r.count,totalTime:r.totalTime,maxTime:r.maxTime,minTime:r.minTime,budget:s?.maxTime,budgetUtilization:s?r.totalTime/r.count/s.maxTime*100:void 0}}let n={};for(let[r,s]of this.metrics.entries()){let i=this.budgets.get(r);n[r]={count:s.count,avgTime:s.totalTime/s.count,totalTime:s.totalTime,maxTime:s.maxTime,minTime:s.minTime,budget:i?.maxTime,budgetUtilization:i?s.totalTime/s.count/i.maxTime*100:void 0}}return n}getViolations(t){if(t)return this.violations.filter((n)=>n.label===t);return[...this.violations]}getViolationStats(){let t={},n=0,r=0;for(let s of this.violations)if(t[s.label]=(t[s.label]||0)+1,s.isWarning)n++;else r++;return{total:this.violations.length,byLabel:t,warnings:n,errors:r}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var se=null;function et(){if(!se)se=new Be;return se}var H=new Proxy({},{get(t,n){return et()[n]}});var Me=[];function P(t){let n=new z(t);return Me.push(n),n}function yo(){for(let t of Me)t.clear()}function D(t,...n){return`${n.map((r)=>String(r??"")).join("\x00")}\x00${t.length}\x00${Bun.hash(t)}`}function bo(t){let n=[];for(let r of new Set(t))try{n.push({path:r,mtimeMs:_e.statSync(r).mtimeMs})}catch{}return n}function Ct(t){for(let n of t)try{if(_e.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var y=null,ie=!1,w=null,B="",v=!1,De=256,k=new Map,b=new Map,A=null,ze=null,O=new Map;function j(t){return Bun.hash(t).toString(16).padStart(16,"0").slice(0,16)}function re(t,n){if(k.has(t))k.delete(t);else if(k.size>=De)k.delete(k.keys().next().value);k.set(t,n)}function tt(t){let n=j(t);if(b.has(n))b.delete(n);else if(b.size>=De)b.delete(b.keys().next().value);return b.set(n,t),n}function Hu(t){let n=b.get(t);if(n===void 0)return;return b.delete(t),b.set(t,n),n}async function nt(t,n=A){if(!n)return null;try{let r=Bun.file(h.join(n,`cw-${j(t)}.css`));if(!await r.exists())return null;return await r.text()}catch{return null}}async function st(t,n,r=A){if(!r)return;try{if(!fs.existsSync(r))fs.mkdirSync(r,{recursive:!0});await Bun.write(h.join(r,`cw-${j(t)}.css`),n)}catch{}}async function Oe(t){try{let n=await import(t);if(n&&n.CSSGenerator)return{CSSGenerator:n.CSSGenerator,config:n.config,build:n.build,defaultConfig:n.defaultConfig,extractClasses:n.extractClasses}}catch{}return null}var rt=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],it=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function ot(){let t=[],n=process.cwd();while(n!==h.dirname(n)){for(let r of["node_modules","pantry"])for(let s of rt)t.push(h.join(n,r,...s));n=h.dirname(n)}return t}function at(){let t=[],n=process.env.HOME||process.env.USERPROFILE||"",r=[n&&h.join(n,"Code","Tools","ts-css"),n&&h.join(n,"Code","Tools","crosswind"),n&&h.join(n,"repos","stacks-org","ts-css"),n&&h.join(n,"repos","stacks-org","crosswind"),h.join(process.cwd(),"..","ts-css"),h.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let s of r)t.push(h.join(s,"packages","toolkit","dist","engine","index.js")),t.push(h.join(s,"packages","toolkit","src","engine","index.ts"));if(n)t.push(h.join(n,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return t}async function wo(){if(ie)return y;ie=!0;try{let t=async(i)=>{for(let a of i){if(!await Bun.file(a).exists())continue;let c=await Oe(a);if(c){if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${h.dirname(h.dirname(a))}`);return c}}return null};if(process.env.CROSSWIND_SRC){let i=h.resolve(process.env.CROSSWIND_SRC),a=await t([i]);if(!a)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return y=a,y}let n=await t(ot());if(n)return y=n,y;let r=it;for(let i of r){let a=await Oe(i);if(a){if(y=a,!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return y}}let s=await t(at());if(s)return y=s,y;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Vu(){oe.clear(),y=null,ie=!1,w=null,B="",k.clear(),b.clear(),ze=null,O.clear()}var je=!1;async function xo(t){try{let n=Ae({name:"css",cwd:t})?"css":Ae({name:"crosswind",cwd:t})?"crosswind":null;if(!n)return null;if(n==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!je)je=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:r}=await import("bunfig"),s=await r({name:n,cwd:t,defaultConfig:{},checkEnv:!1,verbose:!1});if(!s?.path||!s.config||Object.keys(s.config).length===0)return null;let i=h.relative(t,s.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||s.path}`);return s.config}catch(n){if(n instanceof Error&&n.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,n instanceof Error?n.message:n),null}}async function $c(t){let n=null;try{let{loadStxConfig:r}=await import("./chunk-5hnh00ry.js"),s=await r(t);if(s.css)if(typeof s.css==="string"){let i=h.isAbsolute(s.css)?s.css:h.resolve(t,s.css);if(await Bun.file(i).exists()){let a=await import(i);n=a.default||a,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${s.css}`)}}else{if(n={...s.css,content:s.css.content||[],preflight:s.css.preflight??!0,minify:s.css.minify??!1},s.css.config){let i=h.isAbsolute(s.css.config)?s.css.config:h.resolve(t,s.css.config);if(await Bun.file(i).exists()){let a=await import(i);n={...a.default||a,...n}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return n||await xo(t)}function Ec(t){try{let n=new WeakSet;return j(JSON.stringify(t??{},(r,s)=>{if(typeof s==="function")return`[fn]${String(s)}`;if(typeof s==="object"&&s!==null){if(n.has(s))return"[circular]";n.add(s)}return s})??"")}catch{return"unhashable"}}async function _t(t){if(v)return B;v=!0;try{let n=await wo();if(!n||!n.build)return v=!1,"";if(!w)w=await xo(t);if(!w)return v=!1,"";let r=n.defaultConfig?.theme||{},s=w.theme||{},i={...n.defaultConfig,...w,theme:{...r,...s,extend:{...r.extend||{},...s.extend||{}}}},a=performance.now(),c=await n.build(i),d=performance.now()-a;if(B=c.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${c.classes.size} classes in ${d.toFixed(1)}ms`),i.output){let l=h.isAbsolute(i.output)?i.output:h.join(t,i.output),u=h.dirname(l);if(!fs.existsSync(u))fs.mkdirSync(u,{recursive:!0});await Bun.write(l,c.css)}return v=!1,c.css}catch(n){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,n),v=!1,B}}async function un(t){w=null,await _t(t)}function Uu(){return B}function Tc(t){let n=new Set,r=/class\s*=\s*["']([^"']+)["']/gi,s=r.exec(t);while(s!==null){for(let c of s[1].split(/\s+/))if(c.trim())n.add(c.trim());s=r.exec(t)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,a=i.exec(t);while(a!==null){let c=a[1].match(/'([^']+)'/g);if(c){for(let d of c)for(let l of d.slice(1,-1).split(/\s+/))if(l.trim())n.add(l.trim())}a=i.exec(t)}return n}var oe=P(64);async function _c(t,n){let r=()=>O.get(n?h.resolve(n):process.cwd())?.fingerprint??null,s=oe.get(D(t,n,r()));if(s!==void 0)return s;let i=await ct(t,n);if(i)oe.set(D(t,n,r()),i);return i}async function ct(t,n){try{let r=await wo();if(!r)return"";let s=typeof r.extractClasses==="function"?r.extractClasses(t):Tc(t);if(s.size===0)return"";let i=n?h.resolve(n):process.cwd(),a=o(i,"cache");if(!A)A=a;let c=O.get(i);if(!c){let x=await $c(i);c={config:x,fingerprint:Ec(x)},O.set(i,c),ze=c.fingerprint}let d=[...s].sort().join(" "),l=`${c.fingerprint||"default"}::${d}`,u=k.get(l);if(u!==void 0)return re(l,u),u;let g=await nt(l,a);if(g!==null)return re(l,g),g;let p=r.defaultConfig||r.config,m=c.config||{},S=be(p,m),{safelist:C,includePreflight:ae,minify:ce,tokenCSS:Ie}=S,I=S.config,L=new r.CSSGenerator(I),K=I.shortcuts||m.shortcuts||{},le=Object.keys(K).filter((x)=>s.has(x)||C.includes(x));for(let x of C)if(!K[x])L.generate(x);for(let x of s)if(!K[x])L.generate(x);let E="";if(le.length>0){let x=new r.CSSGenerator(I);for(let Le of le)x.generate(Le);if(E=x.toCSS(!1,ce),E&&!E.endsWith(`
22
- `))E+=`
23
- `}let R=E+L.toCSS(ae,ce);return R=Ie+R,re(l,R),st(l,R,a),R}catch(r){return console.warn("Failed to generate Css CSS:",r),""}}async function f(t,n,r=!1,s=!1){let i=await _c(t,n);if(!i)return s?ln(t):t;let a=r?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${tt(i)}.css">`:`<style data-css="generated">
24
- ${i}
25
- </style>`;if(s)return lt(t,a);let c=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(c.test(t)){let d=!1;return t.replace(c,()=>{if(d)return"";return d=!0,a})}if(t.includes("</head>"))return t.replace("</head>",`${a}
26
- </head>`);if(t.includes("<body"))return t.replace(/<body([^>]*)>/,`<body$1>
27
- ${a}`);return a+t}function lt(t,n){let r=te(t).map((l)=>({...l,replacement:""})),s=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,i=s.exec(t);if(i!==null){let l=!0;while(i!==null)r.push({start:i.index,end:i.index+i[0].length,replacement:l?n:""}),l=!1,i=s.exec(t)}else{let l=t.indexOf("</head>");if(l!==-1)r.push({start:l,end:l,replacement:`${n}
28
- `});else{let u=t.match(/<body([^>]*)>/);if(u?.index!==void 0)r.push({start:u.index,end:u.index+u[0].length,replacement:`${u[0]}
29
- ${n}`});else r.push({start:0,end:0,replacement:n})}}r.sort((l,u)=>l.start-u.start||l.end-u.end);for(let l=1;l<r.length;l++)if(r[l].start<r[l-1].end)return ut(ln(t),n);let a=Array(r.length*2+1),c=0,d=0;for(let l of r)a[d++]=t.slice(c,l.start),a[d++]=l.replacement,c=l.end;return a[d]=t.slice(c),a.join("")}function ut(t,n){let r=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(r.test(t)){let s=!1;return t.replace(r,()=>{if(s)return"";return s=!0,n})}if(t.includes("</head>"))return t.replace("</head>",`${n}
30
- </head>`);if(t.includes("<body"))return t.replace(/<body([^>]*)>/,`<body$1>
31
- ${n}`);return n+t}
32
- export{z,Xe,H,P,yo,D,bo,Ct,G,$t,xe,Et,vo,Zn,ne,V,Tt,ln,Qn,e,Hu,wo,Vu,xo,$c,Ec,_t,un,Uu,Tc,_c,f};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{br,Gs,Cn,vr,wr,Ot,ut,Js,$n,En,xr,Sr,Vc,Uc,Ae}from"./chunk-3t0yaexe.js";export{Ae as DeployError,Gs as calculateSha1,Cn as collectDeployFiles,En as createDefaultNetlifyConfig,vr as createFileManifest,br as createNetlifyClient,Vc as deploy,$n as detectProjectConfig,wr as filterRequiredFiles,Ot as formatSize,Js as generateNetlifyToml,ut as getTotalSize,Sr as hasNetlifyConfig,Uc as initNetlify,xr as writeNetlifyConfig};
@@ -1,3 +0,0 @@
1
- // @bun
2
- function ge(){let{NODE_ENV:o}=process.env;return o==="production"}function O(){let{STX_DEBUG:o}=process.env;return!ge()||o==="true"}function hn(){let{NODE_ENV:o}=process.env;return o==="test"}
3
- export{ge,O,hn};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Er,Tr,_r,na,ra,sa,di,ia,oa}from"./chunk-1ctvgd7v.js";export{Er as ImageProcessorCache,di as applyTransformations,na as clearImageCache,ia as generateResponsiveVariants,oa as generateSrcset,Tr as getCachedImageResult,sa as optimizeImage,ra as processImage,_r as setCachedImageResult};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Rr,Ar,Pr,aa,Ir,Dr,ca,Or,Mr,pi,la}from"./chunk-cq408jrm.js";export{Rr as VideoProcessorCache,pi as analyzeVideo,aa as clearVideoCache,Mr as generateDASHManifest,Or as generateHLSManifest,Ir as generatePoster,ca as generateSpriteSheet,Dr as generateThumbnails,Ar as getCachedVideoResult,la as processVideo,Pr as setCachedVideoResult};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{X,gs,ms,hs,r}from"./chunk-dg1n3g1d.js";import"./chunk-qff4qkx5.js";import"./chunk-ddk6fx5b.js";import"./chunk-41k0th97.js";import"./chunk-rv5bk83t.js";import"./chunk-26j2q9rq.js";import"./chunk-gxrewzhv.js";import"./chunk-zyxp0nb3.js";import"./chunk-rfdqrv5v.js";import"./chunk-c4bkj1xw.js";import"./chunk-de2pv6ys.js";import"./chunk-bfjzfrw3.js";import"./chunk-yzv8n6qw.js";import"./chunk-rhw7pqhy.js";export{X as injectRouterScript,r as processDirectives,gs as processJsonDirective,ms as processOnceDirective,hs as validateClientScript};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Cc,ws}from"./chunk-ddk6fx5b.js";export{Cc as looksLikeGlob,ws as resolveStxTargets};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{_a}from"./chunk-vvs75dse.js";export{_a as rewriteImagesWithSiblings};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ul}from"./chunk-8ygks6dx.js";import"./chunk-gyv1t0f0.js";import"./chunk-wpe72ann.js";import"./chunk-dg1n3g1d.js";import"./chunk-qff4qkx5.js";import"./chunk-ddk6fx5b.js";import"./chunk-41k0th97.js";import"./chunk-rv5bk83t.js";import"./chunk-26j2q9rq.js";import"./chunk-gxrewzhv.js";import"./chunk-zyxp0nb3.js";import"./chunk-rfdqrv5v.js";import"./chunk-c4bkj1xw.js";import"./chunk-de2pv6ys.js";import"./chunk-bfjzfrw3.js";import"./chunk-yzv8n6qw.js";import"./chunk-rhw7pqhy.js";export{ul as startProductionServer};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{A,kc,i,T,Fu,zu}from"./chunk-dg1n3g1d.js";import"./chunk-qff4qkx5.js";import"./chunk-ddk6fx5b.js";import"./chunk-41k0th97.js";import"./chunk-rv5bk83t.js";import"./chunk-26j2q9rq.js";import"./chunk-gxrewzhv.js";import"./chunk-zyxp0nb3.js";import"./chunk-rfdqrv5v.js";import"./chunk-c4bkj1xw.js";import"./chunk-de2pv6ys.js";import"./chunk-bfjzfrw3.js";import"./chunk-yzv8n6qw.js";import"./chunk-rhw7pqhy.js";export{T as config,A as defaultConfig,Fu as defineStxConfig,i as loadStxConfig,kc as resolveStxDirectories,zu as validateConfig};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Ia,uu,du,pu,fu,Da,Oa,gu,mu,hu,yu,Qt,en,On}from"./chunk-9fyss0yk.js";import{he}from"./chunk-et0rr8c7.js";import"./chunk-dg1n3g1d.js";import"./chunk-qff4qkx5.js";import"./chunk-ddk6fx5b.js";import"./chunk-41k0th97.js";import"./chunk-rv5bk83t.js";import"./chunk-26j2q9rq.js";import"./chunk-gxrewzhv.js";import"./chunk-zyxp0nb3.js";import"./chunk-rfdqrv5v.js";import"./chunk-c4bkj1xw.js";import"./chunk-de2pv6ys.js";import"./chunk-bfjzfrw3.js";import"./chunk-yzv8n6qw.js";import"./chunk-rhw7pqhy.js";export{fu as __setSignalsGeneratorsForTest,he as cacheEngineFingerprint,en as cacheTemplate,Qt as checkCache,yu as clearDevCaches,Oa as getCachedRouterScript,Da as getCachedSignalsRuntime,gu as getServeClientAsset,hu as getServeModuleBundle,On as hashFilePath,du as invalidateFileCache,pu as invalidateFileCacheByDir,uu as readFileCached,mu as registerServeModuleBundle,Ia as templateCache};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{jn,Ka,Ru,Ga,Au,Ja,Bn,h,wt,be,Ya,Zr,Za,Pu,q,Qa,Iu,b,Du}from"./chunk-dg1n3g1d.js";import"./chunk-qff4qkx5.js";import"./chunk-ddk6fx5b.js";import"./chunk-41k0th97.js";import"./chunk-rv5bk83t.js";import"./chunk-26j2q9rq.js";import"./chunk-gxrewzhv.js";import"./chunk-zyxp0nb3.js";import"./chunk-rfdqrv5v.js";import"./chunk-c4bkj1xw.js";import"./chunk-de2pv6ys.js";import"./chunk-bfjzfrw3.js";import"./chunk-yzv8n6qw.js";import"./chunk-rhw7pqhy.js";export{Qa as applyFilters,Au as clearCustomFilters,Ya as clientLoopScopes,jn as defaultFilters,h as escapeHtml,wt as escapeHtmlValue,b as evaluateExpression,Ja as findMustacheEnd,Ga as getAllFilters,Za as interpolateScriptAttributes,Zr as interpolateScriptExpressions,Pu as interpolateScriptsInTemplate,q as processExpressions,Ka as registerFilter,Ru as registerFilters,Bn as replaceInterpolations,Iu as resetRejectedExpressionWarnings,Du as unescapeHtml,be as usesSignalsInScript};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Sl,kl}from"./chunk-tfhjbjq5.js";export{kl as ensureTeleportTargets,Sl as processTeleportDirectives};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{zr,Ci,$i,$u}from"./chunk-m9xdkzm6.js";export{zr as NATIVE_COMPONENTS,Ci as compileToNative,$i as createHotReloadServer,$u as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Al,Pl,Il,Dl,Ol}from"./chunk-89xcpdsp.js";export{Pl as createSSRSuspense,Dl as generateSuspenseCSS,Ol as generateSuspenseRuntime,Al as processSuspenseDirectives,Il as renderSSRSuspense};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Qr,es,ts,Ou,zn,Mu}from"./chunk-dg1n3g1d.js";export{zn as clearImageDeliveryCatalog,Ou as deliveredImage,ts as efficientDeliverySources,Qr as getImageDelivery,es as isTransparentImage,Mu as prepareImageDelivery};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{qo,ei,qc,Xo,Ko,Xc,Kc}from"./chunk-9rnh52t2.js";import"./chunk-zcctf7tx.js";import"./chunk-y6rahx7t.js";import"./chunk-wpe72ann.js";import{He,fc}from"./chunk-dg1n3g1d.js";import"./chunk-qff4qkx5.js";import"./chunk-ddk6fx5b.js";import"./chunk-41k0th97.js";import"./chunk-rv5bk83t.js";import"./chunk-26j2q9rq.js";import"./chunk-gxrewzhv.js";import"./chunk-zyxp0nb3.js";import"./chunk-rfdqrv5v.js";import"./chunk-c4bkj1xw.js";import"./chunk-de2pv6ys.js";import"./chunk-bfjzfrw3.js";import"./chunk-yzv8n6qw.js";import"./chunk-rhw7pqhy.js";export{qo as buildVirtualSource,He as extractScriptBlocks,fc as extractTemplateExpressions,Xo as findRuntimeTypeDeclarations,Ko as findStxModuleDeclarations,Kc as formatTypecheckDiagnostics,qc as sourcePathFor,Xc as typecheckStxFiles,ei as virtualPathFor};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{An,Gt,iu}from"./chunk-ae7j3n39.js";import{U,Pn,Jt,Lr,jr,In,ou,au,cu,Yt,Zt,Br,Dn,lu}from"./chunk-cn9hgyh5.js";import"./chunk-yzv8n6qw.js";export{Lr as batch,iu as default,Pn as derived,Jt as effect,An as generateSignalsRuntime,Gt as generateSignalsRuntimeDev,Zt as isDerived,Yt as isSignal,In as onDestroy,jr as onMount,Dn as peek,cu as pendingLifecycleCounts,au as runDestroyCallbacks,ou as runMountCallbacks,U as state,Br as untrack,lu as useOptimistic};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{le}from"./chunk-dg1n3g1d.js";import{de,S,Ke}from"./chunk-gxrewzhv.js";import{z}from"./chunk-26j2q9rq.js";import{Qe,Y,Ce}from"./chunk-rhw7pqhy.js";import{Pe,se,C,ie,ci,Cr,li,Nt}from"./chunk-gyv1t0f0.js";import{qr}from"./chunk-wpe72ann.js";import{Lt}from"./chunk-7tabykst.js";import J from"fs";import M from"path";var{serve:ae}=globalThis.Bun;import k from"zlib";import{promisify as q}from"util";var Q=q(k.brotliCompress),Z=q(k.gzip),K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((i)=>e.startsWith(i)))return!1;return K.some((i)=>e.startsWith(i))}function re(t){let e=new Map;for(let i of t.split(",")){let[s,...c]=i.trim().split(";"),l=s.trim().toLowerCase();if(!l)continue;let m=1;for(let f of c){let x=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(f);if(!x)continue;let g=Number.parseFloat(x[1]);if(Number.isFinite(g))m=g}e.set(l,m)}return e}function oe(t){if(!t)return null;let e=re(t),i=e.get("*"),s=(c)=>e.get(c)??i??0;if(s("br")>0)return"br";if(s("gzip")>0)return"gzip";return null}async function Mt(t,e,i={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let s=oe(t.headers.get("accept-encoding"));if(!s)return e;let c;try{c=new Uint8Array(await e.arrayBuffer())}catch{return e}let l=()=>new Response(c,{status:e.status,statusText:e.statusText,headers:W(e.headers)});if(c.length<(i.threshold??te))return l();try{let m=s==="br"?await Q(c,{params:{[k.constants.BROTLI_PARAM_QUALITY]:i.quality??5,[k.constants.BROTLI_PARAM_SIZE_HINT]:c.length}}):await Z(c);if(m.length>=c.length)return l();let f=W(e.headers);return f.set("Content-Encoding",s),f.set("Content-Length",String(m.length)),new Response(m,{status:e.status,statusText:e.statusText,headers:f})}catch{return l()}}function W(t){let e=new Headers(t),i=e.get("Vary");if(!i)return e.set("Vary","Accept-Encoding"),e;if(!i.split(",").some((c)=>c.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${i}, Accept-Encoding`);return e}class D{now;entries=new z(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,i){let s,c=async()=>{let r=s??await i();return r.headers.set("Cache-Control","private, no-store"),r.headers.set("Vary",C(r.headers.get("Vary")).Vary),r};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return c();let l=new URL(t.url),m=`${l.origin}${l.pathname}${l.search}|${se(t)?"fragment":"document"}`,f=this.entries.get(m),x=(r)=>{let T=new Headers(r.headers);return T.set("Cache-Control","private, no-store"),T.set("Age",String(Math.max(0,Math.floor((this.now()-r.created)/1000)))),new Response(r.body.slice(0),{headers:T})},g=f?(this.now()-f.created)/1000:1/0;if(f&&g<e.maxAge)return x(f);let b=this.generation,B=async()=>{let r=await i();s=r;let T=(r.headers.get("Vary")??"").toLowerCase().split(",").map((R)=>R.trim()).filter(Boolean);if(r.status!==200||r.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(r.headers.get("Cache-Control")??"")||T.some((R)=>R!=="x-stx-router"&&R!=="accept-encoding"))return null;let L=await r.clone().arrayBuffer();if(L.byteLength>1048576)return null;r.headers.set("Vary",C(r.headers.get("Vary")).Vary);let n={body:L,headers:Array.from(r.headers.entries()),created:this.now(),path:l.pathname};if(this.generation===b)this.entries.set(m,n);return n},v=this.pending.get(m);if(!v){if(this.pending.size>=1000)return c();v=B().finally(()=>{if(this.pending.get(m)===v)this.pending.delete(m)}),this.pending.set(m,v)}if(f&&g<e.maxAge+(e.swr??0))return v.catch(()=>{}),x(f);let E=await v;return E?x(E):c()}}var ce={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function ul(t={}){let e=M.resolve(t.outputDir||".output"),i=t.port??3000,s=ci(e);if(!s)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${s.routes.length} routes...`);let c=Lt(s.routeRules),l=new D,m=qr(e,s.apiRoutes??[]),f=Bun.file(M.join(e,"server/runtime-config.json")),x=t.runtimeConfig??(await f.exists()?await f.json():void 0),g=x?S(x):void 0,b=new Map,B=new Map,v=new Map,E=new Map;for(let n of s.routes)try{let R=M.join(e,n.compiledPath),o=JSON.parse(await Bun.file(R).text());if(g)o.html=Ke(o.html,g);b.set(n.pattern,o),v.set(n.pattern,Ce(o.html)),E.set(n.pattern,le(o.html));let N=M.join(e,n.fragmentPath);if(await Bun.file(N).exists()){let A=await Bun.file(N).text();B.set(n.pattern,g?Ke(A,g):A)}}catch(R){console.warn(`[stx] Failed to load route ${n.pattern}:`,R)}let r=new Map,T=[];for(let n of s.routes)if(n.hasParams){let{regex:R,params:o}=Y(n.pattern,{page:!0});T.push({regex:R,route:n,paramNames:o})}else r.set(n.pattern,n);let L=ae({port:i,async fetch(n){return Mt(n,await de(g??S(),async()=>{let o=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[o])return t.apiRoutes[o](n);let N=await m(n);if(N)return N;if((n.method==="GET"||n.method==="HEAD")&&o!=="/"){let p=M.resolve(e,"public"),d;try{d=decodeURIComponent(o)}catch{d=o}if(!d.includes("\x00")){let u=M.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${M.sep}`))try{if(J.existsSync(u)&&J.statSync(u).isFile()){let h=M.extname(u).toLowerCase(),j=ce[h]||"application/octet-stream",_=o.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(o);return new Response(Bun.file(u),{headers:{"Content-Type":j,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=se(n),y=null,G={};if(y=r.get(o)||null,!y)for(let{regex:p,route:d,paramNames:u}of T){let a=o.match(p);if(a){y=d,u.forEach((h,j)=>{G[h]=a[j+1]});break}}if(!y){let p=Qe(o)?null:r.get("/404")||null;if(p){let d=b.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=c(o),U=Object.keys(O).length>0;return l.respond(n,O.cache,async()=>{let p=b.get(y.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let a=B.get(y.pattern);if(a){let h=v.get(y.pattern);return new Response(a,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...E.has(y.pattern)?{"X-STX-Runtime":E.get(y.pattern)?"true":"false"}:{},...h?{"X-STX-Layout":h.layout,"X-STX-Layout-Group":h.group}:{},...C(),...O.cache?{}:{"Cache-Control":Pe}}})}}let d=Cr(n.method),u=b.get(y.pattern);if(!u){let a=r.get("/500")||null;if(a){let h=b.get(a.pattern);if(h)return new Response(h.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(y.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...C(),"Cache-Control":"public, max-age=60"}});try{let{html:a,boundaries:h,redirect:j,cookies:_,status:F,headers:H}=await Nt(u,{params:G,request:n,method:n.method,__stx_strict_hydration:U,__stx_runtime_config:g});if(j)return li(j,_,H);if(h&&h.length>0){let{renderStreamingPage:P,streamToResponse:I}=await import("./chunk-ecr598p7.js"),X=new Headers({...C(),...H,"Cache-Control":"private, no-store"});for(let V of _??[])X.append("Set-Cookie",V);if(A&&!d){let V=Ce(a);X.set("X-STX-Fragment","true"),X.set("X-STX-Runtime",le(a)?"true":"false"),X.set("X-STX-Layout",V.layout),X.set("X-STX-Layout-Group",V.group)}return I(P(A&&!d?ie(a,s.routerContainer||"main"):a,h,{timeoutMs:30000}),{status:F??u.status??200,headers:X})}let w=new Headers({"Content-Type":"text/html",...C(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let P of _??[])w.append("Set-Cookie",P);for(let[P,I]of Object.entries(H??{}))w.set(P,I);if(w.set("Vary",C(w.get("Vary")).Vary),A&&!d){let P=Ce(a);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",le(a)?"true":"false"),w.set("X-STX-Layout",P.layout),w.set("X-STX-Layout-Group",P.group),new Response(ie(a,s.routerContainer||"main"),{status:F??u.status??200,headers:w})}return new Response(a,{status:F??u.status??200,headers:w})}catch(a){if(console.error(`[stx] Hydration error for ${o}:`,a),U)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${L.port}`),console.log(`[stx] Serving ${s.routes.length} routes (${b.size} pre-loaded)`),{port:L.port,stop:()=>{l.invalidate(),L.stop()},invalidate:(n)=>l.invalidate(n)}}
3
- export{Mt,ul};
@@ -1,4 +0,0 @@
1
- // @bun
2
- import{$e}from"./chunk-rhw7pqhy.js";import{An,Gt}from"./chunk-ae7j3n39.js";import{f}from"./chunk-26j2q9rq.js";import{Bi,Fi,xt,M,Vn,Un,Wn,r,te,A,i}from"./chunk-dg1n3g1d.js";import{S}from"./chunk-gxrewzhv.js";import{Ss}from"./chunk-rv5bk83t.js";import{ho}from"./chunk-41k0th97.js";import{me,ie,oi,ai,Nt}from"./chunk-gyv1t0f0.js";import{bt,Wr}from"./chunk-wpe72ann.js";import{Lt}from"./chunk-7tabykst.js";import{pt,tn,nn}from"./chunk-rb272g9d.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function J(o){return Y("sha256").update(o).digest("hex").slice(0,8)}function U(o=!1){let l=o?Gt():An(),a=J(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let o=$e(),l=J(o);return{content:o,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function re(o={}){let l=new Set;return{context:new Proxy(o,{get(s,e){if(e in s)return s[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(s,e){if(e in s)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(o,l,a={}){let s=q.resolve(o),e=await Bun.file(s).text(),_=ee("sha256").update(e).digest("hex").slice(0,16);Bi();let R={};try{R=await i(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let v=g[1];if(/\bserver\b/.test(v))y.push(g[2])}let u=new Set(y.flatMap((v)=>te(v))),{context:w}=re({__filename:s,__dirname:q.dirname(s),__stx_serverDeclared:u}),C=new Set,P={...A,...R,...a,buildMode:"compile",strict:!1},b=await r(e,w,s,P,C),T=me(b),B=Fi();return{route:l,sourceFile:o,html:b,fragment:T,placeholders:B,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(C),contentHash:_,status:xt(e),streamTemplates:w.__streamTemplates}}var se=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(o,l){let a=0,s=0;if(!m.existsSync(o))return{copied:a,bytes:s};m.mkdirSync(l,{recursive:!0});function e(_,R){let y=m.readdirSync(_,{withFileTypes:!0});for(let d of y){if(se.has(d.name))continue;let g=c.join(_,d.name),u=c.join(R,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),a++,s+=m.statSync(u).size}}}return e(o,l),{copied:a,bytes:s}}async function Yc(o={}){let l=Date.now(),a=c.resolve(o.root||process.cwd()),s=c.resolve(a,o.outputDir||".output");console.log("[stx build] Starting production build...");let e=await i(a),_=c.resolve(a,o.componentsDir??e.componentsDir??"components"),R=c.resolve(a,o.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,o.layoutsDir??e.layoutsDir??"layouts"),d=o.publicDir??e.publicDir??"public",g=e.app?.head||{},u=e.app?.colorMode,w=e.router?.container||"main",C=o.routeRules??e.routeRules??{},P=Lt(C),b=o.serverApi??e.serverApi,T=typeof b==="object"?b:{};if(b)bt(a,T);if(e.runtimeConfig)S(e.runtimeConfig,{});if(m.existsSync(s))m.rmSync(s,{recursive:!0});let B=[c.join(s,"public","__stx"),c.join(s,"public","assets"),c.join(s,"server","pages"),c.join(s,"server","fragments")];for(let n of B)m.mkdirSync(n,{recursive:!0});console.log("[stx build] Discovering routes...");let v=M(a,{pagesDirs:e._layerPageDirs}),Q=["components","layouts","partials"],O=v.filter((n)=>!Q.some((h)=>n.pattern.startsWith(`/${h}/`)||n.pattern===`/${h}`));console.log(`[stx build] Found ${O.length} page routes (${v.length-O.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let D=U(o.debug),x=V();await Bun.write(c.join(s,"public","__stx",D.filename),D.content),await Bun.write(c.join(s,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${D.filename} (${(D.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let k=[],F=[];for(let n of O){let h=P(n.pattern),E=h.rendering==="prerender";if(E&&(n.pattern.includes(":")||n.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${n.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(n.filePath,n.pattern,{configDir:a,componentsDir:_,partialsDir:R,layoutsDir:y,debug:o.debug});if(k.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,D.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Wn(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Vn(t.html,u);if(g.htmlAttrs)t.html=Un(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let z=p[1];t.html=t.html.replace(" "+z,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${z}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await f(t.html),E){let p=await Nt(t,{params:{},request:new Request(`http://stx.build${n.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${n.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=ie(t.html,w);let G=n.pattern==="/"?"index":n.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),I=c.join("server","pages",`${G}.compiled.json`),W=c.join("server","fragments",`${G}.html`);await Bun.write(c.join(s,I),JSON.stringify(t,null,2)),await Bun.write(c.join(s,W),t.fragment),F.push({pattern:n.pattern,compiledPath:I,fragmentPath:W,isDynamic:t.hasServerScripts,hasParams:n.pattern.includes(":")||n.pattern.includes("["),prerendered:E}),console.log(`[stx build] \u2713 ${n.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${n.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(a,d);if(m.existsSync(H)){let{copied:n,bytes:h}=Z(H,c.join(s,"public"));if(n>0)console.log(`[stx build] Copied ${n} public asset${n===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let N=nn(a);if(N){let{copied:n,bytes:h}=Z(N,c.join(s,"public",tn));if(n>0)console.log(`[stx build] Copied ${n} asset${n===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${pt}/`)}let K={runtime:D.filename,router:x.filename},j=oi(F,K,s);if(j.routeRules=C,j.routerContainer=w,b)j.apiRoutes=await Wr(a,s,T);if(e.runtimeConfig)await Bun.write(c.join(s,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Ss(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(s,"server/layers.json"),JSON.stringify(ho(e._layerGraph),null,2));ai(j,s);let L=Date.now()-l;return console.log(`
3
- [stx build] Done in ${L}ms \u2014 ${k.length} pages compiled`),{pageCount:k.length,assets:K,outputDir:s,duration:L}}
4
- export{Yc};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{n,K}from"./chunk-dg1n3g1d.js";import{yo}from"./chunk-26j2q9rq.js";import{he}from"./chunk-et0rr8c7.js";import{o}from"./chunk-ty7t3gp4.js";import c from"fs";import l from"path";var Ia=new Map,m=new Map;async function uu(e){let r;for(let s=0;s<3;s++)try{let g=(await c.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),S=(await c.promises.stat(e)).mtime.getTime();if(S!==g)continue;return m.set(e,{content:h,mtime:S}),h}catch(i){r=i;break}throw m.delete(e),Error(`File not found: ${e}${r?` (${r.message})`:""}`)}function du(e){m.delete(e)}function pu(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var d=null,v=null,y=null;function fu(e){y=e}async function Da(e=!1){let t=y??await import("./chunk-8ycy1b0e.js");if(e)return t.generateSignalsRuntimeDev();if(d===null)d=t.generateSignalsRuntime();return d}var f=null;async function Oa(){if(f===null){let{getRouterScript:e}=await import("./chunk-x7j0krz8.js");f=e()}return f}var w={};async function gu(e,t=!1){let r=e==="runtime"?await Da(t):await Oa(),s=e==="runtime"&&t?"runtime-debug":e,i=w[s];if(!i||i.content!==r)i={content:r,hash:Bun.hash(r).toString(16).padStart(16,"0").slice(0,16)},w[s]=i;return{content:r,hash:i.hash,url:`/_stx/${e}.${i.hash}.js`}}var T=500,u=new Map;function x(e){return o(process.cwd(),"module-bundles",`${e}.js`)}function mu(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),r=u.has(t);if(r)u.delete(t);u.set(t,e);while(u.size>T)u.delete(u.keys().next().value);if(!r)try{let s=x(t);if(!c.existsSync(s))c.mkdirSync(l.dirname(s),{recursive:!0}),c.writeFileSync(s,e)}catch{}return`/_stx/modules.${t}.js`}function hu(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=u.get(e);if(t!==void 0)return t;try{return c.readFileSync(x(e),"utf8")}catch{return}}function yu(){m.clear(),K(),yo(),d=null,v=null,f=null}function C(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((r)=>({name:r.name,timing:r.timing,handler:String(r.handler)})),customDirectives:(e.customDirectives??[]).map((r)=>({name:r.name,hasEndTag:r.hasEndTag===!0,rawParams:r.rawParams===!0,handler:String(r.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function Qt(e,t){try{if(!t.cachePath)return null;let r=l.resolve(t.cachePath),s=l.join(r,`${On(e)}.html`),i=l.join(r,`${On(e)}.meta.json`);if(!await n(s)||!await n(i))return null;let g=await Bun.file(i).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==he())return null;if(a.optionsSignature!==C(t))return null;if((await c.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let p of a.dependencies)if(await n(p)){if((await c.promises.stat(p)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(s).text()}catch(r){return console.warn(`Cache error for ${e}:`,r),null}}async function en(e,t,r,s){try{if(!s.cachePath)return;let i=l.resolve(s.cachePath);await c.promises.mkdir(i,{recursive:!0});let g=l.join(i,`${On(e)}.html`),a=l.join(i,`${On(e)}.meta.json`),h=await c.promises.stat(e);await Bun.write(g,t);let p={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(r),cacheVersion:s.cacheVersion,engine:he(),optionsSignature:C(s),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(p,null,2)),Ia.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:r})}catch(i){console.warn(`Failed to cache template ${e}:`,i)}}var E=16;function On(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,E)}
3
- export{Ia,uu,du,pu,fu,Da,Oa,gu,mu,hu,yu,Qt,en,On};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Nr,vl,wl}from"./chunk-zcctf7tx.js";import"./chunk-y6rahx7t.js";import"./chunk-wpe72ann.js";import"./chunk-dg1n3g1d.js";import"./chunk-qff4qkx5.js";import"./chunk-ddk6fx5b.js";import"./chunk-41k0th97.js";import"./chunk-rv5bk83t.js";import"./chunk-26j2q9rq.js";import"./chunk-gxrewzhv.js";import"./chunk-zyxp0nb3.js";import"./chunk-rfdqrv5v.js";import"./chunk-c4bkj1xw.js";import"./chunk-de2pv6ys.js";import"./chunk-bfjzfrw3.js";import"./chunk-yzv8n6qw.js";import"./chunk-rhw7pqhy.js";export{wl as clearComposableCache,vl as getComposableScript,Nr as listComposableModules};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Go,Gc}from"./chunk-7mbpjv9e.js";export{Go as captureScreenshot,Gc as captureScreenshots};