@stacksjs/stx 0.2.633 → 0.2.635

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 (223) hide show
  1. package/dist/chunk-0d7dqt4d.js +2 -0
  2. package/dist/chunk-0grt24vd.js +2 -0
  3. package/dist/{chunk-7q55jxf5.js → chunk-0tm9ep8b.js} +2 -2
  4. package/dist/{chunk-7gq7w95h.js → chunk-14yjt309.js} +3 -3
  5. package/dist/{chunk-ygpa12ez.js → chunk-1d25z8q2.js} +3 -3
  6. package/dist/{chunk-6bhaa9g7.js → chunk-1wb98s7b.js} +13 -13
  7. package/dist/{chunk-nh7bcc4h.js → chunk-2efrxnnt.js} +2 -2
  8. package/dist/chunk-2vzfn6vy.js +2 -0
  9. package/dist/chunk-3bsz101e.js +2 -0
  10. package/dist/{chunk-w9e17a74.js → chunk-3e2v2fdh.js} +4 -4
  11. package/dist/{chunk-jq7ymh7q.js → chunk-3f4xy76k.js} +6 -6
  12. package/dist/chunk-3jwjesb5.js +2 -0
  13. package/dist/{chunk-968jp303.js → chunk-3td99hnc.js} +3 -3
  14. package/dist/chunk-4b4es5wg.js +2 -0
  15. package/dist/{chunk-phbnrw2h.js → chunk-4n24jbfs.js} +2 -2
  16. package/dist/{chunk-72p9brmx.js → chunk-4vkpgz28.js} +9 -9
  17. package/dist/chunk-4xeafdr6.js +2 -0
  18. package/dist/chunk-4xkqdfqd.js +2 -0
  19. package/dist/chunk-5k989nr4.js +2 -0
  20. package/dist/chunk-5v95x083.js +3 -0
  21. package/dist/chunk-5yf9yzkp.js +2 -0
  22. package/dist/{chunk-923vrf9c.js → chunk-6gwrmn3w.js} +7 -7
  23. package/dist/{chunk-p77g4mhy.js → chunk-6w1ngwsd.js} +2 -2
  24. package/dist/chunk-7m5xrqnj.js +2852 -0
  25. package/dist/chunk-7mtdjjbt.js +2 -0
  26. package/dist/{chunk-94yycjz8.js → chunk-7vdcsr14.js} +2 -2
  27. package/dist/{chunk-k5atee35.js → chunk-839m1t8t.js} +1 -1
  28. package/dist/chunk-88dxeynx.js +2 -0
  29. package/dist/chunk-8er7jc3c.js +2 -0
  30. package/dist/chunk-8phbb8wj.js +2 -0
  31. package/dist/{chunk-p4hmv654.js → chunk-8y3mff5c.js} +2 -2
  32. package/dist/{chunk-gqdh68vx.js → chunk-954tcahb.js} +2 -2
  33. package/dist/{chunk-sg5zgq5v.js → chunk-97zrn4wb.js} +5 -5
  34. package/dist/{chunk-q6evk3a4.js → chunk-9gx5p7zh.js} +2 -2
  35. package/dist/{chunk-g2rxbaah.js → chunk-a6hv03yw.js} +3 -3
  36. package/dist/chunk-a7s1j320.js +127 -0
  37. package/dist/chunk-a83r1xx9.js +2 -0
  38. package/dist/chunk-abpeac2d.js +2 -0
  39. package/dist/chunk-adzsqsjt.js +2 -0
  40. package/dist/{chunk-4fv3jq16.js → chunk-ahyq08mp.js} +2 -2
  41. package/dist/chunk-b1ndskw9.js +2 -0
  42. package/dist/chunk-b7fp3zta.js +2 -0
  43. package/dist/{chunk-pbphq5pj.js → chunk-b7hv69ty.js} +2 -2
  44. package/dist/{chunk-avt9cske.js → chunk-baw176ay.js} +6 -6
  45. package/dist/chunk-bgfkbesj.js +2 -0
  46. package/dist/{chunk-cy1j2zpr.js → chunk-bk9bx2ns.js} +2 -2
  47. package/dist/{chunk-gh34r6qb.js → chunk-bsts9pr5.js} +2 -2
  48. package/dist/{chunk-jzmz66a3.js → chunk-bysyrwfa.js} +3 -3
  49. package/dist/{chunk-y89m80pf.js → chunk-c4ysk7x2.js} +4 -4
  50. package/dist/{chunk-90pe63me.js → chunk-camd8j1q.js} +3 -3
  51. package/dist/{chunk-0qt1887j.js → chunk-cdab66xt.js} +2 -2
  52. package/dist/{chunk-gv15dd41.js → chunk-cjr8cpb7.js} +3 -3
  53. package/dist/{chunk-y8h823cb.js → chunk-cw9pc5yx.js} +41 -41
  54. package/dist/chunk-cy83yfy9.js +2 -0
  55. package/dist/chunk-dbqb1a51.js +2 -0
  56. package/dist/{chunk-pk757m0k.js → chunk-e0nq8g9j.js} +1 -1
  57. package/dist/chunk-e8t64hxk.js +2 -0
  58. package/dist/chunk-e943xk88.js +2 -0
  59. package/dist/{chunk-w8bf4mbw.js → chunk-emcbmr0r.js} +3 -3
  60. package/dist/{chunk-kpxty3pe.js → chunk-f30t1g74.js} +2 -2
  61. package/dist/{chunk-tx4xxpgg.js → chunk-f3agc1a3.js} +3 -3
  62. package/dist/{chunk-27784ceh.js → chunk-fm80xpxn.js} +4 -4
  63. package/dist/{chunk-xrrkf04f.js → chunk-fwawm5r3.js} +2 -2
  64. package/dist/chunk-g039c67x.js +2 -0
  65. package/dist/{chunk-gxpgwpq7.js → chunk-g9dz0mx9.js} +2 -2
  66. package/dist/{chunk-bd5na0h0.js → chunk-g9sdjgfw.js} +5 -5
  67. package/dist/{chunk-k2nrx78c.js → chunk-gcj5jfbv.js} +2 -2
  68. package/dist/chunk-ghfxfcr9.js +2 -0
  69. package/dist/chunk-gvyq9xt6.js +2 -0
  70. package/dist/chunk-h30y9k44.js +2 -0
  71. package/dist/{chunk-236twqn4.js → chunk-hbzk179w.js} +3 -3
  72. package/dist/chunk-hwp3m8a8.js +2 -0
  73. package/dist/{chunk-2bxsc7gf.js → chunk-j79f6syh.js} +4 -4
  74. package/dist/chunk-jarptkbv.js +2 -0
  75. package/dist/{chunk-ftkrsvqp.js → chunk-jtr30kkz.js} +1 -1
  76. package/dist/{chunk-fdy0hka5.js → chunk-kjtvdqb9.js} +13 -13
  77. package/dist/chunk-kk6tq07c.js +3 -0
  78. package/dist/chunk-km4xp898.js +2 -0
  79. package/dist/{chunk-j1rnhv0w.js → chunk-kr14jt4m.js} +3 -3
  80. package/dist/{chunk-az1y9jks.js → chunk-kwwrrasa.js} +2 -2
  81. package/dist/chunk-kxbw0e2f.js +3 -0
  82. package/dist/{chunk-a887js9p.js → chunk-m56ee2tw.js} +5 -5
  83. package/dist/chunk-meze7k8v.js +2 -0
  84. package/dist/chunk-mfwrxz9z.js +2 -0
  85. package/dist/chunk-mmpm1awz.js +2 -0
  86. package/dist/{chunk-0whv8hnp.js → chunk-mn97jhaq.js} +2 -2
  87. package/dist/{chunk-3yh585yv.js → chunk-mpb0ezee.js} +3 -3
  88. package/dist/{chunk-g35zftfn.js → chunk-mvt5n2q4.js} +1 -1
  89. package/dist/chunk-n7vetrt4.js +2 -0
  90. package/dist/chunk-nd716zha.js +2 -0
  91. package/dist/{chunk-0hs8jgw5.js → chunk-npn3h566.js} +2 -2
  92. package/dist/{chunk-5x59qjzs.js → chunk-pak6ngv0.js} +6 -6
  93. package/dist/{chunk-v5500ews.js → chunk-pp6ycfay.js} +2 -2
  94. package/dist/{chunk-vhktd16g.js → chunk-psranzfr.js} +2 -2
  95. package/dist/chunk-ptjz4f2e.js +2 -0
  96. package/dist/{chunk-8qrhz7n7.js → chunk-ptv5f34x.js} +6 -6
  97. package/dist/{chunk-86zj56pf.js → chunk-q0kbn64j.js} +5 -5
  98. package/dist/chunk-q4hmgj72.js +2 -0
  99. package/dist/chunk-q841b6x4.js +2 -0
  100. package/dist/{chunk-v4tmwamd.js → chunk-qa58qdz8.js} +2 -2
  101. package/dist/{chunk-8hjrr8j3.js → chunk-qczse5w4.js} +33 -33
  102. package/dist/{chunk-tn7hgtyn.js → chunk-qjfgdcck.js} +5 -5
  103. package/dist/chunk-qnh5x7vv.js +2 -0
  104. package/dist/chunk-qxjfvkjt.js +2 -0
  105. package/dist/chunk-rhhwz7e9.js +2 -0
  106. package/dist/chunk-rpbe5h6v.js +2 -0
  107. package/dist/chunk-rrdn4qnn.js +2 -0
  108. package/dist/{chunk-xm911f1g.js → chunk-ry1w4ghk.js} +1 -1
  109. package/dist/chunk-s7c9kb53.js +2 -0
  110. package/dist/chunk-sfj84n72.js +2 -0
  111. package/dist/chunk-sgr2hhsc.js +2 -0
  112. package/dist/{chunk-jbmjcs83.js → chunk-shcn4wve.js} +2 -2
  113. package/dist/{chunk-zs7t42b5.js → chunk-sn0a8cjd.js} +5 -5
  114. package/dist/chunk-taztcvv3.js +2 -0
  115. package/dist/chunk-vczt5k2j.js +2 -0
  116. package/dist/chunk-vj5fghnv.js +2 -0
  117. package/dist/{chunk-6dzqjbsz.js → chunk-vyjdzpb8.js} +2 -2
  118. package/dist/chunk-wj4rf7sb.js +2 -0
  119. package/dist/chunk-wn1s8af8.js +2 -0
  120. package/dist/{chunk-t7e9y46s.js → chunk-x7g0946r.js} +1 -1
  121. package/dist/{chunk-rq1c46zb.js → chunk-xdwpbqzz.js} +34 -9
  122. package/dist/chunk-y3jyk5bj.js +2 -0
  123. package/dist/chunk-y51ndrdb.js +2 -0
  124. package/dist/{chunk-xrkechs8.js → chunk-y5b25eks.js} +5 -5
  125. package/dist/{chunk-tc7gm68a.js → chunk-ycz5th6b.js} +2 -2
  126. package/dist/{chunk-3kkf43fv.js → chunk-ym0e374a.js} +2 -2
  127. package/dist/{chunk-pxpmx8vc.js → chunk-ymntav9f.js} +1 -1
  128. package/dist/{chunk-8kc6byaz.js → chunk-yp8tk3v3.js} +5 -5
  129. package/dist/{chunk-bng1ayzm.js → chunk-ytv0k9gy.js} +9 -9
  130. package/dist/chunk-ytxzy6eg.js +2 -0
  131. package/dist/chunk-ywf319rp.js +2 -0
  132. package/dist/chunk-yww6c9we.js +2 -0
  133. package/dist/chunk-yy43hxb7.js +2 -0
  134. package/dist/chunk-z42jb949.js +2 -0
  135. package/dist/{chunk-y04hzz4w.js → chunk-zfrpss8y.js} +4 -4
  136. package/dist/{chunk-8b2452m1.js → chunk-zpzk4wd2.js} +11 -11
  137. package/dist/chunk-zw20a7q4.js +2 -0
  138. package/dist/cli.js +76 -76
  139. package/dist/client/signals-public-api-runtime.js +1 -0
  140. package/dist/client/signals-timer-runtime.js +24 -0
  141. package/dist/craft-entry.js +2 -2
  142. package/dist/craft.js +2 -2
  143. package/dist/lazy-module.js +2 -1
  144. package/dist/menubar.d.ts +2 -0
  145. package/dist/menubar.js +15 -2
  146. package/dist/native/compiler/headwind-to-style.d.ts +6 -3
  147. package/dist/native/compiler/headwind-to-style.js +25 -3
  148. package/dist/native/compiler/html-to-ir.js +4 -4
  149. package/dist/native/prop-names.d.ts +1 -1
  150. package/dist/native/prop-names.js +3 -1
  151. package/dist/native/runtime/native-host.js +66 -7
  152. package/dist/pwa.js +3 -3
  153. package/dist/runtime-globals.js +1 -0
  154. package/dist/ssg.js +9 -9
  155. package/dist/stx-module.d.ts +1 -0
  156. package/package.json +5 -5
  157. package/stx-module.d.ts +1 -0
  158. package/stx.d.ts +7 -0
  159. package/dist/chunk-0mgtrbaa.js +0 -2
  160. package/dist/chunk-0xc6rncm.js +0 -2852
  161. package/dist/chunk-1tpr8d8n.js +0 -2
  162. package/dist/chunk-20kjbf3h.js +0 -2
  163. package/dist/chunk-3gcg3gvy.js +0 -2
  164. package/dist/chunk-3wsrhj0k.js +0 -2
  165. package/dist/chunk-575cqc6z.js +0 -2
  166. package/dist/chunk-5x836mv3.js +0 -2
  167. package/dist/chunk-5yceay9n.js +0 -2
  168. package/dist/chunk-6pg2kxsq.js +0 -2
  169. package/dist/chunk-7nthebqr.js +0 -2
  170. package/dist/chunk-7s5304ae.js +0 -2
  171. package/dist/chunk-8dybd0g5.js +0 -2
  172. package/dist/chunk-8em788gc.js +0 -2
  173. package/dist/chunk-9svygzeg.js +0 -2
  174. package/dist/chunk-9z4qr5w9.js +0 -2
  175. package/dist/chunk-af4ss0p5.js +0 -2
  176. package/dist/chunk-aj34t5h3.js +0 -2
  177. package/dist/chunk-atcy4zq6.js +0 -2
  178. package/dist/chunk-az28kd7f.js +0 -2
  179. package/dist/chunk-cncdgxk3.js +0 -2
  180. package/dist/chunk-d2t2pq1s.js +0 -3
  181. package/dist/chunk-dcx2t3sy.js +0 -2
  182. package/dist/chunk-dn28q0m3.js +0 -2
  183. package/dist/chunk-dn89zg1v.js +0 -2
  184. package/dist/chunk-dwddzp5f.js +0 -2
  185. package/dist/chunk-enchx79c.js +0 -2
  186. package/dist/chunk-ev8ma4ph.js +0 -2
  187. package/dist/chunk-ftrsaag8.js +0 -2
  188. package/dist/chunk-g6efz3ww.js +0 -2
  189. package/dist/chunk-gd59tkhr.js +0 -2
  190. package/dist/chunk-h1g9m148.js +0 -2
  191. package/dist/chunk-h8tew5mz.js +0 -2
  192. package/dist/chunk-hdrcgepx.js +0 -127
  193. package/dist/chunk-hn64343d.js +0 -2
  194. package/dist/chunk-htaed68z.js +0 -2
  195. package/dist/chunk-j5jkh05f.js +0 -2
  196. package/dist/chunk-j90yng9b.js +0 -2
  197. package/dist/chunk-jabb3v4c.js +0 -2
  198. package/dist/chunk-jczvjn7z.js +0 -2
  199. package/dist/chunk-kqkhcbrx.js +0 -2
  200. package/dist/chunk-mgzegkvk.js +0 -2
  201. package/dist/chunk-mk71833d.js +0 -2
  202. package/dist/chunk-n3s3w1f5.js +0 -2
  203. package/dist/chunk-nj0b4ryt.js +0 -2
  204. package/dist/chunk-ny6enm8b.js +0 -3
  205. package/dist/chunk-p8ndfekp.js +0 -2
  206. package/dist/chunk-qhjm9hvz.js +0 -2
  207. package/dist/chunk-qzy34xmt.js +0 -2
  208. package/dist/chunk-ra40trfh.js +0 -2
  209. package/dist/chunk-rjq597cn.js +0 -2
  210. package/dist/chunk-rrdwynz4.js +0 -2
  211. package/dist/chunk-sddytf9n.js +0 -2
  212. package/dist/chunk-shhtbdnj.js +0 -2
  213. package/dist/chunk-t4g97h08.js +0 -2
  214. package/dist/chunk-t7f9zmy8.js +0 -2
  215. package/dist/chunk-tme29zh9.js +0 -3
  216. package/dist/chunk-x1xx8qt0.js +0 -2
  217. package/dist/chunk-xmfhb2v0.js +0 -2
  218. package/dist/chunk-xsw183n7.js +0 -2
  219. package/dist/chunk-xtwe2rnp.js +0 -2
  220. package/dist/chunk-xxnh7gv8.js +0 -2
  221. package/dist/chunk-y84n0dvg.js +0 -2
  222. package/dist/chunk-zr0k9pz5.js +0 -2
  223. package/dist/chunk-zytcxy8p.js +0 -2
package/dist/ssg.js CHANGED
@@ -1,14 +1,14 @@
1
1
  // @bun
2
- import"./chunk-gh34r6qb.js";import"./chunk-8qrhz7n7.js";import"./chunk-kpxty3pe.js";import{pt,ft,gt,mt,ht,yt}from"./chunk-y89m80pf.js";import"./chunk-d2t2pq1s.js";import"./chunk-4fv3jq16.js";import{f,Je,j,Q,n,o}from"./chunk-0xc6rncm.js";import"./chunk-8b2452m1.js";import{Sr}from"./chunk-6bhaa9g7.js";import"./chunk-xrrkf04f.js";import"./chunk-cy1j2zpr.js";import"./chunk-3kkf43fv.js";import"./chunk-2bxsc7gf.js";import"./chunk-8kc6byaz.js";import{pe,Tt,$t}from"./chunk-27784ceh.js";import{ni,ri,si}from"./chunk-3yh585yv.js";import{Ct,gn,mn}from"./chunk-tme29zh9.js";import"./chunk-jzmz66a3.js";import{a}from"./chunk-ny6enm8b.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 Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Rt(t){return Bun.hash(t).toString(16)}function it(t,i={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,r=t.replace(Dt,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(i.minify)h=Pt(h);let S=Rt(h);if(!s.has(S))s.set(S,h);let P=i.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(s,([e,l])=>({hash:e,code:l}));return{html:r,chunks:c}}var kt=new Set(["visible","idle"]);function st(t){if(!t.includes("data-stx-src="))return t;let i=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,r;while((r=s.exec(t))!==null)i.set(r[1],r[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(kt.has(i.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 Et=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function q(t){let i=t.trim();if(!i)return null;let s=/^https?:\/\//i.test(i)?i:`https://${i}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function It(t){for(let i of Et){let s=t[i];if(!s)continue;let r=q(s);if(r)return{url:r,source:"env",via:i}}return null}function at(t){if(!t||typeof t!=="object")return null;let i=t,s=i.site?.url??i.url??i.app?.url;return typeof s==="string"?q(s):null}async function Bt(t){let{existsSync:i}=await import("fs"),s=await import("path");for(let r of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(t,r);if(!i(c))continue;try{let e=await import(c),l=at(e.default??e);if(l)return l}catch{}}return null}async function ot(t={}){let i=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let l=q(t.explicit);if(l)return{url:l,source:"option"}}let r=at(t.stxConfig);if(r)return{url:r,source:"stx.config",via:"site.url"};let c=await Bt(i);if(c)return{url:c,source:"site.config",via:"url"};let e=It(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ct(){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 lt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,i=""){this.cacheDir=t,this.salt=i}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let i=JSON.parse(await Bun.file(t).text());for(let[s,r]of Object.entries(i))this.cache.set(s,r)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),i={};for(let[s,r]of this.cache)i[s]=r;await Bun.write(t,JSON.stringify(i))}getHash(t,i){let s=x.statSync(t),r=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of i)if(x.existsSync(e)){let l=x.statSync(e);r+=`:${e}:${l.mtimeMs}`}let c=0;for(let e=0;e<r.length;e++){let l=r.charCodeAt(e);c=(c<<5)-c+l,c=c&c}return Math.abs(c).toString(36)}get(t,i){let s=this.cache.get(t);if(!s)return null;let r=this.getHash(i,s.dependencies??[]);if(s.hash!==r)return this.cache.delete(t),null;return s.html}set(t,i,s,r){let c=this.getHash(i,s);this.cache.set(t,{hash:c,html:r,generatedAt:Date.now(),dependencies:s})}}class ut{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let i=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",i)}async get(t){let i=this.getFilePath(t);if(!await Bun.file(i).exists())return null;try{return JSON.parse(await Bun.file(i).text())}catch{return null}}async set(t,i){let s=this.getFilePath(t);await x.promises.mkdir(g.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(i))}async invalidate(t){let i=this.getFilePath(t);if(await Bun.file(i).exists())await x.promises.unlink(i)}async invalidatePattern(t){let i=g.join(this.cacheDir,"isr");if(!x.existsSync(i))return;let s=await x.promises.readdir(i);for(let r of s){let c=r.replace(/_/g,"/").replace(".json","");if(t.test(c))await x.promises.unlink(g.join(i,r))}}async needsRevalidation(t){let i=await this.get(t);if(!i)return!0;return Date.now()>i.revalidateAfter}}async function jt(t){try{let s=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!s)return null;let r=s[1];if(!r.includes("getStaticPaths"))return null;let c=r.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!c)return null;return await Function(`
2
+ import"./chunk-bsts9pr5.js";import"./chunk-ptv5f34x.js";import"./chunk-f30t1g74.js";import{ft,gt,mt,ht,yt,bt}from"./chunk-c4ysk7x2.js";import"./chunk-kk6tq07c.js";import"./chunk-ahyq08mp.js";import{f,Ye,j,Q,n,o}from"./chunk-7m5xrqnj.js";import"./chunk-zpzk4wd2.js";import{kr}from"./chunk-1wb98s7b.js";import"./chunk-fwawm5r3.js";import"./chunk-bk9bx2ns.js";import"./chunk-ym0e374a.js";import"./chunk-j79f6syh.js";import"./chunk-yp8tk3v3.js";import{pe,$t,Rt}from"./chunk-fm80xpxn.js";import{ri,si,oi}from"./chunk-mpb0ezee.js";import{Et,mn,hn}from"./chunk-kxbw0e2f.js";import"./chunk-bysyrwfa.js";import{a}from"./chunk-5v95x083.js";import x from"fs";import g from"path";import{createHash as vt}from"crypto";function Pt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var Dt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function kt(t){return Bun.hash(t).toString(16)}function it(t,i={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,r=t.replace(Dt,(e,l,w,y)=>{let h=y.trim();if(!h)return e;if(/\bdata-stx-src=/.test(w))return e;if(i.minify)h=Pt(h);let S=kt(h);if(!s.has(S))s.set(S,h);let P=i.integrity?` data-stx-integrity="sha384-${vt("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(s,([e,l])=>({hash:e,code:l}));return{html:r,chunks:c}}var Ct=new Set(["visible","idle"]);function st(t){if(!t.includes("data-stx-src="))return t;let i=new Map,s=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,r;while((r=s.exec(t))!==null)i.set(r[1],r[2]);let c=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(Ct.has(i.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 i=t.trim();if(!i)return null;let s=/^https?:\/\//i.test(i)?i:`https://${i}`;try{return new URL(s).origin+new URL(s).pathname.replace(/\/$/,"")}catch{return null}}function Bt(t){for(let i of It){let s=t[i];if(!s)continue;let r=q(s);if(r)return{url:r,source:"env",via:i}}return null}function at(t){if(!t||typeof t!=="object")return null;let i=t,s=i.site?.url??i.url??i.app?.url;return typeof s==="string"?q(s):null}async function jt(t){let{existsSync:i}=await import("fs"),s=await import("path");for(let r of["site.config.ts","site.config.js",".config/site.config.ts"]){let c=s.resolve(t,r);if(!i(c))continue;try{let e=await import(c),l=at(e.default??e);if(l)return l}catch{}}return null}async function ot(t={}){let i=t.cwd??process.cwd(),s=t.env??process.env;if(t.explicit){let l=q(t.explicit);if(l)return{url:l,source:"option"}}let r=at(t.stxConfig);if(r)return{url:r,source:"stx.config",via:"site.url"};let c=await jt(i);if(c)return{url:c,source:"site.config",via:"url"};let e=Bt(s);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ct(){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 lt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,i=""){this.cacheDir=t,this.salt=i}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let i=JSON.parse(await Bun.file(t).text());for(let[s,r]of Object.entries(i))this.cache.set(s,r)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),i={};for(let[s,r]of this.cache)i[s]=r;await Bun.write(t,JSON.stringify(i))}getHash(t,i){let s=x.statSync(t),r=`${this.salt}|${t}:${s.mtimeMs}`;for(let e of i)if(x.existsSync(e)){let l=x.statSync(e);r+=`:${e}:${l.mtimeMs}`}let c=0;for(let e=0;e<r.length;e++){let l=r.charCodeAt(e);c=(c<<5)-c+l,c=c&c}return Math.abs(c).toString(36)}get(t,i){let s=this.cache.get(t);if(!s)return null;let r=this.getHash(i,s.dependencies??[]);if(s.hash!==r)return this.cache.delete(t),null;return s.html}set(t,i,s,r){let c=this.getHash(i,s);this.cache.set(t,{hash:c,html:r,generatedAt:Date.now(),dependencies:s})}}class ut{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let i=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",i)}async get(t){let i=this.getFilePath(t);if(!await Bun.file(i).exists())return null;try{return JSON.parse(await Bun.file(i).text())}catch{return null}}async set(t,i){let s=this.getFilePath(t);await x.promises.mkdir(g.dirname(s),{recursive:!0}),await Bun.write(s,JSON.stringify(i))}async invalidate(t){let i=this.getFilePath(t);if(await Bun.file(i).exists())await x.promises.unlink(i)}async invalidatePattern(t){let i=g.join(this.cacheDir,"isr");if(!x.existsSync(i))return;let s=await x.promises.readdir(i);for(let r of s){let c=r.replace(/_/g,"/").replace(".json","");if(t.test(c))await x.promises.unlink(g.join(i,r))}}async needsRevalidation(t){let i=await this.get(t);if(!i)return!0;return Date.now()>i.revalidateAfter}}async function Ft(t){try{let s=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!s)return null;let r=s[1];if(!r.includes("getStaticPaths"))return null;let c=r.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(i){return console.error(`Error extracting static paths from ${t}:`,i),null}}async function Ft(t){let i=[];if(!t.isDynamic)i.push({url:t.pattern,params:{}});else{let s=await jt(t.filePath);if(!s||s.paths.length===0)return console.warn(`Warning: Dynamic route ${t.pattern} has no getStaticPaths or returned empty paths`),i;for(let r of s.paths){let c=t.pattern;for(let[e,l]of Object.entries(r.params))c=c.replace(`:${e}`,l).replace(`:${e}*`,l);i.push({url:c,params:r.params,props:r.props,revalidate:r.revalidate})}}return i}async function Ot(t){let i=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let s of i)if(await Bun.file(s).exists())try{let r=await import(s);if(typeof r.default==="function")return await r.default();else if(typeof r.default==="object")return r.default;else if(typeof r.getData==="function")return await r.getData();else{let{default:c,...e}=r;return e}}catch(r){console.error(`Error loading data file ${s}:`,r)}return null}async function At(t,i,s){let r=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!r)return null;let c=r[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(i){return console.error(`Error extracting static paths from ${t}:`,i),null}}async function Ot(t){let i=[];if(!t.isDynamic)i.push({url:t.pattern,params:{}});else{let s=await Ft(t.filePath);if(!s||s.paths.length===0)return console.warn(`Warning: Dynamic route ${t.pattern} has no getStaticPaths or returned empty paths`),i;for(let r of s.paths){let c=t.pattern;for(let[e,l]of Object.entries(r.params))c=c.replace(`:${e}`,l).replace(`:${e}*`,l);i.push({url:c,params:r.params,props:r.props,revalidate:r.revalidate})}}return i}async function Tt(t){let i=[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"];for(let s of i)if(await Bun.file(s).exists())try{let r=await import(s);if(typeof r.default==="function")return await r.default();else if(typeof r.default==="object")return r.default;else if(typeof r.getData==="function")return await r.getData();else{let{default:c,...e}=r;return e}}catch(r){console.error(`Error loading data file ${s}:`,r)}return null}async function At(t,i,s){let r=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!r)return null;let c=r[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
- `)(i)}catch(e){return console.error(`Error executing getStaticProps in ${s}:`,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 dt(t,i,s={},r,c){let e=await Bun.file(t.filePath).text(),l=await Ot(t.filePath),w=await At(e,i,t.filePath),y={...l||{},...w||{},...s,params:i,$route:{path:t.pattern,params:i}},h=new Set,S=[],P=[],D={...c,...r.partialsDir?{partialsDir:r.partialsDir}:{},...r.componentsDir?{componentsDir:r.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(b)=>{S.push(`${g.relative(process.cwd(),b.templatePath)}: ${b.message}
11
+ `)(i)}catch(e){return console.error(`Error executing getStaticProps in ${s}:`,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 dt(t,i,s={},r,c){let e=await Bun.file(t.filePath).text(),l=await Tt(t.filePath),w=await At(e,i,t.filePath),y={...l||{},...w||{},...s,params:i,$route:{path:t.pattern,params:i}},h=new Set,S=[],P=[],D={...c,...r.partialsDir?{partialsDir:r.partialsDir}:{},...r.componentsDir?{componentsDir:r.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(b)=>{S.push(`${g.relative(process.cwd(),b.templatePath)}: ${b.message}
12
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 n(e,y,t.filePath,D,h);for(let b of[t.filePath,...h])for(let B of pe(b))h.add(B);if(Object.keys(i).length>0){let b=`<script>if(window.stx)window.stx._rp=${JSON.stringify(i)};else window.__stx_rp=${JSON.stringify(i)};</script>`;if(p.includes("</head>"))p=p.replace("</head>",`${b}
13
13
  </head>`);else p=`${b}
14
14
  ${p}`}if(p=await Q(p,{router:r.router}),p=await f(p),r.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 i=[],s=0,r=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,c;while((c=r.exec(t))!==null){let l=t.slice(s,c.index);i.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"),i.push(w+y+h),s=c.index+c[0].length}let e=t.slice(s);return i.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),i.join("").trim()}function Ut(t){let i=0;for(let s=0;s<t.length;s++){let r=t.charCodeAt(s);i=(i<<5)-i+r,i=i&i}return`"${Math.abs(i).toString(36)}"`}function _t(t,i,s,r){if(s?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(i))return!0;return r.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,i){return`<?xml version="1.0" encoding="UTF-8"?>
@@ -41,16 +41,16 @@ ${t.map((r)=>{let c=new URL(r.loc,i).href,e=` <url>
41
41
  ${s.join(`
42
42
  `)}
43
43
  </channel>
44
- </rss>`}async function zt(t={}){let i=Date.now();$t();let s=await o(process.cwd()),r=s.build||{},c=await ot({explicit:t.domain||r.domain,stxConfig:s});if(c.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(ct());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||r.pagesDir||"pages",outputDir:t.outputDir||r.outputDir||"dist",baseUrl:t.baseUrl||r.baseUrl||"/",domain:c.url,revalidate:t.revalidate??r.revalidate??!1,sitemap:t.sitemap??r.sitemap??!0,sitemapExclude:t.sitemapExclude||r.sitemapExclude||[],robots:t.robots??r.robots??!0,rss:t.rss??r.rss??!1,concurrency:t.concurrency||r.concurrency||10,cache:t.cache??r.cache??!0,cacheDir:t.cacheDir||r.cacheDir||a(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??r.minify??!0,generate404:t.generate404??r.generate404??!0,publicDir:t.publicDir||r.publicDir||"public",trailingSlash:t.trailingSlash??r.trailingSlash??!1,cleanOutput:t.cleanOutput??r.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},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-dwddzp5f.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-dn89zg1v.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 lt(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-dwddzp5f.js");await u('<div class="bg-black"></div>')}catch{}pt();let wt=s?.routeMiddleware?.dir||"middleware";await gt(process.cwd(),wt);let H=ft();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let St=s?.routeMiddleware?.global||[];si(s?.layoutsDir,a(process.cwd()));let V=j(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${V.length} routes`);let G=[];for(let u of V){let m=await Ft(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 L=[],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:M,props:xt,revalidate:Z}=m;try{await e.hooks.onPageStart?.(d);let F=await Bun.file(v.filePath).text(),O=Jt(F),vt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],tt=[...St,...vt];if(tt.length>0){let C=mt(d,M,O||{}),T=ht(C,null,void 0,{isServer:!0}),E=await yt(tt,T);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,_=Vt(String(R),d),A=Kt(d,e);await x.promises.mkdir(g.dirname(A),{recursive:!0}),await Bun.write(A,_),l.successCount++,l.pages.push({route:d,outputPath:A,size:Buffer.byteLength(_),cached:!1}),L.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 et=F.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(et)try{if(!await Function("route",`
44
+ </rss>`}async function zt(t={}){let i=Date.now();Rt();let s=await o(process.cwd()),r=s.build||{},c=await ot({explicit:t.domain||r.domain,stxConfig:s});if(c.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(ct());let e={router:t.router??s?.router??{},pagesDir:t.pagesDir||r.pagesDir||"pages",outputDir:t.outputDir||r.outputDir||"dist",baseUrl:t.baseUrl||r.baseUrl||"/",domain:c.url,revalidate:t.revalidate??r.revalidate??!1,sitemap:t.sitemap??r.sitemap??!0,sitemapExclude:t.sitemapExclude||r.sitemapExclude||[],robots:t.robots??r.robots??!0,rss:t.rss??r.rss??!1,concurrency:t.concurrency||r.concurrency||10,cache:t.cache??r.cache??!0,cacheDir:t.cacheDir||r.cacheDir||a(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??r.minify??!0,generate404:t.generate404??r.generate404??!0,publicDir:t.publicDir||r.publicDir||"public",trailingSlash:t.trailingSlash??r.trailingSlash??!1,cleanOutput:t.cleanOutput??r.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||s?.partialsDir||"",componentsDir:t.componentsDir||s?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},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-meze7k8v.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-wn1s8af8.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 lt(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-meze7k8v.js");await u('<div class="bg-black"></div>')}catch{}ft();let pt=s?.routeMiddleware?.dir||"middleware";await mt(process.cwd(),pt);let H=gt();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let wt=s?.routeMiddleware?.global||[];oi(s?.layoutsDir,a(process.cwd()));let V=j(".",{pagesDir:e.pagesDir,pagesDirs:s?._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 L=[],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:M,props:St,revalidate:Z}=m;try{await e.hooks.onPageStart?.(d);let F=await Bun.file(v.filePath).text(),O=Jt(F),xt=O?.middleware?Array.isArray(O.middleware)?O.middleware:[O.middleware]:[],tt=[...wt,...xt];if(tt.length>0){let C=ht(d,M,O||{}),T=yt(C,null,void 0,{isServer:!0}),E=await bt(tt,T);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,_=Vt(String(R),d),A=Kt(d,e);await x.promises.mkdir(g.dirname(A),{recursive:!0}),await Bun.write(A,_),l.successCount++,l.pages.push({route:d,outputPath:A,size:Buffer.byteLength(_),cached:!1}),L.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 et=F.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(et)try{if(!await Function("route",`
45
45
  const validate = ${et[1]};
46
46
  return validate(route);
47
- `)({params:M})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,rt=!1;if(e.cache){if(k=B.get(d,v.filePath),k)rt=!0,l.cachedCount++}if(!k){let C=await dt(v,M,xt,e,s);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:M})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,rt=!1;if(e.cache){if(k=B.get(d,v.filePath),k)rt=!0,l.cachedCount++}if(!k){let C=await dt(v,M,St,e,s);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:T}=it(k,{integrity:e.integrityIslands,minify:e.minify});if(T.length>0){let E=g.join(e.outputDir,"_stx","islands");await x.promises.mkdir(E,{recursive:!0});for(let R of T){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 A=Buffer.byteLength(R.code,"utf8");y+=A,h[R.hash]={bytes:A,file:`/_stx/islands/${R.hash}.js`}}}if(S[d]=T.map((R)=>R.hash),k=C,e.prefetchIslands)k=st(k)}}if(await x.promises.mkdir(g.dirname(U),{recursive:!0}),await Bun.write(U,k),!_t(d,k,O,e.sitemapExclude))L.push({loc:d,lastmod:new Date().toISOString().split("T")[0],priority:d==="/"?1:0.8});let nt={route:d,outputPath:U,size:Buffer.byteLength(k,"utf8"),cached:rt};if(Z!==!1)nt.revalidateAt=Date.now()+Z*1000;l.pages.push(nt),l.successCount++,await e.hooks.onPageEnd?.(d,k)}catch(F){l.failedCount++,l.errors.push({route:d,error:F}),await e.hooks.onError?.(F,d),console.error(`Error generating ${d}:`,F)}}));let X=Tt();if(X.length>0){let u=X.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:T}=it(k,{integrity:e.integrityIslands,minify:e.minify});if(T.length>0){let E=g.join(e.outputDir,"_stx","islands");await x.promises.mkdir(E,{recursive:!0});for(let R of T){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 A=Buffer.byteLength(R.code,"utf8");y+=A,h[R.hash]={bytes:A,file:`/_stx/islands/${R.hash}.js`}}}if(S[d]=T.map((R)=>R.hash),k=C,e.prefetchIslands)k=st(k)}}if(await x.promises.mkdir(g.dirname(U),{recursive:!0}),await Bun.write(U,k),!_t(d,k,O,e.sitemapExclude))L.push({loc:d,lastmod:new Date().toISOString().split("T")[0],priority:d==="/"?1:0.8});let nt={route:d,outputPath:U,size:Buffer.byteLength(k,"utf8"),cached:rt};if(Z!==!1)nt.revalidateAt=Date.now()+Z*1000;l.pages.push(nt),l.successCount++,await e.hooks.onPageEnd?.(d,k)}catch(F){l.failedCount++,l.errors.push({route:d,error:F}),await e.hooks.onError?.(F,d),console.error(`Error generating ${d}:`,F)}}));let X=$t();if(X.length>0){let u=X.map((m)=>`${m.filePath}: ${m.message}`).join(`
54
54
  `);throw Error(`Client script bundling failed:
55
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={...s,debug:!1,cache:!1},d=await n(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">
@@ -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={...s,debug:!1,cache:!1},M=await n(await Bun.file(m).text(),{},m,d,v);await Bun.write(g.join(e.outputDir,`${u}.html`),M)}}let W=g.join(e.pagesDir,"error.stx");if(await Bun.file(W).exists()){let u=new Set,m={...s,debug:!1,cache:!1},v=await n(await Bun.file(W).text(),{},W,m,u);await Bun.write(g.join(e.outputDir,"error.html"),v)}if(e.sitemap&&L.length>0){let u=Gt(L,e.domain),m=g.join(e.outputDir,"sitemap.xml");await Bun.write(m,u),l.sitemapPath=m,console.log(`Generated sitemap.xml with ${L.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=Sr({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=ni(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=ri(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 Y=mn();if(Y)await J(Y,g.join(e.outputDir,gn)),console.log(`Copied assets from ${Ct}`)}catch(D){throw await e.hooks.onError?.(D),D}if(l.buildTime=Date.now()-i,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={...s,debug:!1,cache:!1},M=await n(await Bun.file(m).text(),{},m,d,v);await Bun.write(g.join(e.outputDir,`${u}.html`),M)}}let W=g.join(e.pagesDir,"error.stx");if(await Bun.file(W).exists()){let u=new Set,m={...s,debug:!1,cache:!1},v=await n(await Bun.file(W).text(),{},W,m,u);await Bun.write(g.join(e.outputDir,"error.html"),v)}if(e.sitemap&&L.length>0){let u=Gt(L,e.domain),m=g.join(e.outputDir,"sitemap.xml");await Bun.write(m,u),l.sitemapPath=m,console.log(`Generated sitemap.xml with ${L.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=kr({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=ri(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=si(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 Y=hn();if(Y)await J(Y,g.join(e.outputDir,mn)),console.log(`Copied assets from ${Et}`)}catch(D){throw await e.hooks.onError?.(D),D}if(l.buildTime=Date.now()-i,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
@@ -82,7 +82,7 @@ Build complete!
82
82
  Failed: ${l.failedCount}
83
83
  Time: ${l.buildTime}ms${P}
84
84
  `),l}async function J(t,i){await x.promises.mkdir(i,{recursive:!0});let s=await x.promises.readdir(t,{withFileTypes:!0});for(let r of s){let c=g.join(t,r.name),e=g.join(i,r.name);if(r.isDirectory())await x.promises.mkdir(e,{recursive:!0}),await J(c,e);else await x.promises.copyFile(c,e)}}function Ht(t={}){let i=t.cacheDir||a(process.cwd(),"ssg-cache"),s=new ut(i),r=t.revalidate||3600;return{async get(c){let e=await s.get(c);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(c).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${r}, stale-while-revalidate=${r*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(c){let l=j(".",{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 o(),{html:S}=await dt(l,y,{},t,h);await s.set(c,{html:S,generatedAt:Date.now(),revalidateAfter:Date.now()+r*1000,etag:Ut(S)}),console.log(`Revalidated: ${c}`)},async invalidate(c){if(typeof c==="string")await s.invalidate(c);else await s.invalidatePattern(c)}}}function Wt(t){return async()=>({paths:await t(),fallback:!1})}function qt(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let i=await Bun.file(t).text(),s=i.match(/^---\n([\s\S]*?)\n---/),r={},c=i;if(s){let h=s[1];c=i.slice(s[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,""));r[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:r,toc:l}}}}function Jt(t){return Je(t)}function Vt(t,i){return`<!DOCTYPE html>
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,""));r[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:r,toc:l}}}}function Jt(t){return Ye(t)}function Vt(t,i){return`<!DOCTYPE html>
86
86
  <html>
87
87
  <head>
88
88
  <meta charset="utf-8">
@@ -93,6 +93,7 @@ declare module 'stx' {
93
93
  export const useLocalStorage: typeof globalThis.useLocalStorage
94
94
  export const useMediaQuery: typeof globalThis.useMediaQuery
95
95
  export const useModel: typeof globalThis.useModel
96
+ export const useNativeDesktop: typeof globalThis.useNativeDesktop
96
97
  export const useMutation: typeof globalThis.useMutation
97
98
  export const useOptimistic: typeof globalThis.useOptimistic
98
99
  export const usePreferredContrast: typeof globalThis.usePreferredContrast
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.633",
4
+ "version": "0.2.635",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -128,12 +128,12 @@
128
128
  "dependencies": {
129
129
  "@stacksjs/ts-css": "^0.3.11",
130
130
  "@stacksjs/clapp": "^0.2.16",
131
- "@stacksjs/desktop": "0.2.633",
132
- "@stacksjs/sanitizer": "0.2.633",
131
+ "@stacksjs/desktop": "0.2.635",
132
+ "@stacksjs/sanitizer": "0.2.635",
133
133
  "@stacksjs/ts-i18n": "^0.1.11",
134
- "bun-plugin-stx": "0.2.633",
134
+ "bun-plugin-stx": "0.2.635",
135
135
  "bunfig": "^0.15.21",
136
- "stx-router": "0.2.633",
136
+ "stx-router": "0.2.635",
137
137
  "ts-broadcasting": "^0.0.11",
138
138
  "ts-images": "^0.2.22",
139
139
  "ts-syntax-highlighter": "^0.2.1"
package/stx-module.d.ts CHANGED
@@ -93,6 +93,7 @@ declare module 'stx' {
93
93
  export const useLocalStorage: typeof globalThis.useLocalStorage
94
94
  export const useMediaQuery: typeof globalThis.useMediaQuery
95
95
  export const useModel: typeof globalThis.useModel
96
+ export const useNativeDesktop: typeof globalThis.useNativeDesktop
96
97
  export const useMutation: typeof globalThis.useMutation
97
98
  export const useOptimistic: typeof globalThis.useOptimistic
98
99
  export const usePreferredContrast: typeof globalThis.usePreferredContrast
package/stx.d.ts CHANGED
@@ -1013,6 +1013,7 @@ interface StxRuntimeRegistry {
1013
1013
  refDebounced: typeof refDebounced
1014
1014
  useThrottle: typeof useThrottle
1015
1015
  useThrottleFn: typeof useThrottleFn
1016
+ useNativeDesktop: typeof useNativeDesktop
1016
1017
  useInterval: typeof useInterval
1017
1018
  useTimeout: typeof useTimeout
1018
1019
  useTimeoutFn: typeof useTimeoutFn
@@ -1078,3 +1079,9 @@ interface Window {
1078
1079
  __stxRouter?: boolean
1079
1080
  __stxRouterConfig?: Record<string, any>
1080
1081
  }
1082
+
1083
+ /** Native bridge accessor with mount-aware, exactly-once readiness and teardown. */
1084
+ declare function useNativeDesktop(): {
1085
+ (): import('craft-native').CraftBridgeAPI | null
1086
+ onReady(callback: (bridge: import('craft-native').CraftBridgeAPI) => void): () => void
1087
+ }
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Sl}from"./chunk-0hs8jgw5.js";import"./chunk-tn7hgtyn.js";import"./chunk-8kc6byaz.js";import"./chunk-0xc6rncm.js";import"./chunk-jzmz66a3.js";import"./chunk-kpxty3pe.js";import"./chunk-2bxsc7gf.js";import"./chunk-cy1j2zpr.js";import"./chunk-xrrkf04f.js";import"./chunk-6bhaa9g7.js";import"./chunk-8b2452m1.js";import"./chunk-8qrhz7n7.js";import"./chunk-4fv3jq16.js";import"./chunk-d2t2pq1s.js";import"./chunk-y89m80pf.js";import"./chunk-3kkf43fv.js";export{Sl as startProductionServer};