@stacksjs/stx 0.2.607 → 0.2.612

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 (236) hide show
  1. package/dist/chunk-07rryvyt.js +2 -0
  2. package/dist/chunk-0dkd5z22.js +2 -0
  3. package/dist/chunk-0fgp13q4.js +2 -0
  4. package/dist/chunk-0hpng9by.js +2 -0
  5. package/dist/chunk-0nfysn6e.js +2 -0
  6. package/dist/{chunk-dxqwm8tr.js → chunk-0s6shhb3.js} +5 -5
  7. package/dist/chunk-0vmwp37n.js +2 -0
  8. package/dist/chunk-0x72g1jn.js +2 -0
  9. package/dist/{chunk-6xsm53pz.js → chunk-0zx1400y.js} +4 -4
  10. package/dist/{chunk-5j29466h.js → chunk-13xvn7vh.js} +2 -2
  11. package/dist/chunk-15wmzj8j.js +2 -0
  12. package/dist/{chunk-azpkje69.js → chunk-1c0zvjt3.js} +34 -10
  13. package/dist/chunk-1p7v0ytv.js +2 -0
  14. package/dist/{chunk-6by8dtan.js → chunk-1q06tw66.js} +2 -2
  15. package/dist/{chunk-sswjv8p9.js → chunk-2bcp699b.js} +2 -2
  16. package/dist/chunk-32y8adx3.js +2 -0
  17. package/dist/chunk-34a1jdhq.js +3 -0
  18. package/dist/{chunk-tydv84gj.js → chunk-34tbh570.js} +2 -2
  19. package/dist/chunk-3fb3m640.js +2 -0
  20. package/dist/chunk-3njhzgqa.js +2 -0
  21. package/dist/{chunk-jsktg3ab.js → chunk-45gz1yff.js} +5 -5
  22. package/dist/{chunk-r69jfs59.js → chunk-4h62y8dn.js} +1 -1
  23. package/dist/{chunk-y54fz9rk.js → chunk-4rtxkqwh.js} +2 -2
  24. package/dist/{chunk-bspryr4a.js → chunk-4x5zryhk.js} +9 -9
  25. package/dist/chunk-5003ncbh.js +2 -0
  26. package/dist/chunk-514ykzna.js +2 -0
  27. package/dist/{chunk-dmdhbwmn.js → chunk-58s20ceb.js} +3 -3
  28. package/dist/chunk-5fa9g7x1.js +2850 -0
  29. package/dist/{chunk-td30jg06.js → chunk-5fxh7fc3.js} +2 -2
  30. package/dist/{chunk-s4pjf2pc.js → chunk-5rtatjwq.js} +2 -2
  31. package/dist/{chunk-1jxdkp8x.js → chunk-5vs12p6m.js} +6 -6
  32. package/dist/{chunk-bsy8v1xj.js → chunk-66e4ga0z.js} +3 -3
  33. package/dist/chunk-6fmcs19t.js +18 -0
  34. package/dist/chunk-6jjbmfy0.js +2 -0
  35. package/dist/chunk-6pg74bkj.js +2 -0
  36. package/dist/{chunk-20k77e2a.js → chunk-6rd762vj.js} +4 -4
  37. package/dist/chunk-6ta850w8.js +3 -0
  38. package/dist/{chunk-81qmj3sd.js → chunk-6w0h6vpd.js} +7 -7
  39. package/dist/chunk-6yn7pc5s.js +2 -0
  40. package/dist/{chunk-y8h823cb.js → chunk-74j18qk0.js} +28 -28
  41. package/dist/chunk-792sscsk.js +2 -0
  42. package/dist/chunk-7ed685cs.js +2 -0
  43. package/dist/chunk-7mee8bte.js +2 -0
  44. package/dist/chunk-7mgbh13b.js +2 -0
  45. package/dist/chunk-7yjyzzcp.js +2 -0
  46. package/dist/{chunk-qh07a85k.js → chunk-83h5ydvw.js} +3 -3
  47. package/dist/chunk-851cd8sc.js +2 -0
  48. package/dist/{chunk-td5100fz.js → chunk-8dq3r6xw.js} +7 -7
  49. package/dist/{chunk-t9t66sz4.js → chunk-8jqdb1qr.js} +6 -6
  50. package/dist/{chunk-60wedefh.js → chunk-8n306p92.js} +2 -2
  51. package/dist/chunk-8vdsewsa.js +43 -0
  52. package/dist/chunk-8xp2r8s0.js +2 -0
  53. package/dist/{chunk-tbsjg23k.js → chunk-970j89r5.js} +4 -4
  54. package/dist/chunk-97ht3bw3.js +2 -0
  55. package/dist/{chunk-wzjf33es.js → chunk-99rfdydy.js} +2 -2
  56. package/dist/{chunk-1dd4qefr.js → chunk-adn5r0r4.js} +2 -2
  57. package/dist/{chunk-efy3038a.js → chunk-azj2cj8h.js} +2 -2
  58. package/dist/chunk-be89da2e.js +2 -0
  59. package/dist/chunk-bemx44n4.js +2 -0
  60. package/dist/{chunk-53y4z4p2.js → chunk-bgcn01mr.js} +3 -3
  61. package/dist/{chunk-vntpfbwy.js → chunk-bm632aaj.js} +1 -1
  62. package/dist/{chunk-0cb00ys2.js → chunk-btcc95hq.js} +5 -5
  63. package/dist/{chunk-x8q5przn.js → chunk-c9jav70j.js} +11 -11
  64. package/dist/chunk-cg8hg6cs.js +3 -0
  65. package/dist/chunk-cxv6mhky.js +2 -0
  66. package/dist/{chunk-cfpenvc7.js → chunk-d16jgsyv.js} +3 -3
  67. package/dist/{chunk-z2xrwmjr.js → chunk-d5nxsg1p.js} +11 -11
  68. package/dist/{chunk-yzj55rfs.js → chunk-dcs87qta.js} +3 -3
  69. package/dist/{chunk-vp3fzjsc.js → chunk-det49x62.js} +2 -2
  70. package/dist/{chunk-8fq6bvnw.js → chunk-ej2ka6g6.js} +33 -33
  71. package/dist/chunk-ejqt0kh2.js +2 -0
  72. package/dist/chunk-ekd11w9t.js +2 -0
  73. package/dist/chunk-ekfmad19.js +2 -0
  74. package/dist/{chunk-m9h7pmkh.js → chunk-ewmpbxhv.js} +5 -5
  75. package/dist/{chunk-jpxekhdh.js → chunk-f6pjf3tb.js} +3 -3
  76. package/dist/chunk-f8kh3s0k.js +2 -0
  77. package/dist/chunk-fdkr055a.js +2 -0
  78. package/dist/{chunk-aestp72s.js → chunk-frvn6psn.js} +2 -2
  79. package/dist/{chunk-ev6w9c69.js → chunk-g18pwk0t.js} +1 -1
  80. package/dist/chunk-g8hwrejy.js +2 -0
  81. package/dist/chunk-gmqr7v81.js +2 -0
  82. package/dist/chunk-h476qqq9.js +2 -0
  83. package/dist/chunk-h94znyac.js +2 -0
  84. package/dist/chunk-hjp38m0w.js +3 -0
  85. package/dist/{chunk-z8fhtym2.js → chunk-hw97qw4k.js} +2 -2
  86. package/dist/{chunk-tcd2zez3.js → chunk-j18z5nxq.js} +2 -2
  87. package/dist/chunk-j2gvr4n6.js +2 -0
  88. package/dist/{chunk-mvwcf4xy.js → chunk-j4smj8cr.js} +4 -4
  89. package/dist/{chunk-r4h8fg1x.js → chunk-j6nn0c5r.js} +1 -1
  90. package/dist/chunk-j7vjfzjx.js +2 -0
  91. package/dist/chunk-j9pcvc0z.js +2 -0
  92. package/dist/chunk-jahkmmhh.js +2 -0
  93. package/dist/{chunk-vw62fjpv.js → chunk-jbaedjyk.js} +3 -3
  94. package/dist/{chunk-79edpvb2.js → chunk-jskaacqy.js} +7 -7
  95. package/dist/chunk-jx1p2eza.js +2 -0
  96. package/dist/chunk-k1hpxgzq.js +40 -0
  97. package/dist/{chunk-c65q0svd.js → chunk-ktg9khmj.js} +5 -5
  98. package/dist/{chunk-w8g2ppnr.js → chunk-kwfwc32d.js} +2 -2
  99. package/dist/chunk-m4k7f63m.js +2 -0
  100. package/dist/chunk-mfh61qdr.js +127 -0
  101. package/dist/chunk-mg9931y0.js +2 -0
  102. package/dist/{chunk-rmv35cx0.js → chunk-mm8jdb4p.js} +2 -2
  103. package/dist/chunk-mtm39290.js +2 -0
  104. package/dist/{chunk-0v89nfz1.js → chunk-n1zyt21h.js} +2 -2
  105. package/dist/chunk-n4z6evey.js +2 -0
  106. package/dist/{chunk-bhf9yt2w.js → chunk-nmh4pn44.js} +2 -2
  107. package/dist/chunk-pjh4kftn.js +2 -0
  108. package/dist/chunk-pjqrcbtt.js +2 -0
  109. package/dist/{chunk-vehtypx0.js → chunk-q3a13hvc.js} +2 -2
  110. package/dist/{chunk-dnqq1ze0.js → chunk-q4t49t6z.js} +3 -3
  111. package/dist/{chunk-g63ye3fe.js → chunk-qh3b1w7q.js} +2 -2
  112. package/dist/{chunk-77kpsnf6.js → chunk-qkczk53w.js} +87 -87
  113. package/dist/{chunk-kxjd6e2h.js → chunk-qxr7e0y2.js} +2 -2
  114. package/dist/{chunk-67tpacz0.js → chunk-qzfq8342.js} +1 -1
  115. package/dist/chunk-rbwhdwa9.js +2 -0
  116. package/dist/{chunk-4tj0ap61.js → chunk-s43pj9n6.js} +5 -5
  117. package/dist/chunk-spkwmfbm.js +2 -0
  118. package/dist/chunk-swv69q75.js +4 -0
  119. package/dist/chunk-t535swnv.js +2 -0
  120. package/dist/{chunk-ktvr45qg.js → chunk-t61vdbje.js} +6 -6
  121. package/dist/chunk-t9pnkbg6.js +2 -0
  122. package/dist/{chunk-cp901m61.js → chunk-tawfv519.js} +1 -1
  123. package/dist/{chunk-xjxc4q3w.js → chunk-th4x1wbc.js} +21 -21
  124. package/dist/chunk-trah2z70.js +2 -0
  125. package/dist/{chunk-k3f4044e.js → chunk-twmq5m6r.js} +2 -2
  126. package/dist/{chunk-wqmm1qsz.js → chunk-vbzpc1yz.js} +5 -5
  127. package/dist/chunk-vrnb2xat.js +2 -0
  128. package/dist/{chunk-ghdyqt98.js → chunk-wn3d4gd6.js} +2 -2
  129. package/dist/{chunk-tfjcs55e.js → chunk-wy93yhce.js} +12 -12
  130. package/dist/{chunk-7095f0hb.js → chunk-x7jmchd5.js} +9 -9
  131. package/dist/chunk-xncqjkjm.js +2 -0
  132. package/dist/chunk-xq9f9ftz.js +2 -0
  133. package/dist/chunk-xv9qre1x.js +2 -0
  134. package/dist/{chunk-5e182xqt.js → chunk-xz7h73ra.js} +1 -1
  135. package/dist/{chunk-g04y5wyn.js → chunk-z83p4bme.js} +4 -4
  136. package/dist/chunk-zar7fhqr.js +2 -0
  137. package/dist/chunk-zhe35k6k.js +2 -0
  138. package/dist/{chunk-5s47qfp6.js → chunk-zsqfvwwf.js} +2 -2
  139. package/dist/chunk-zy266h8p.js +2 -0
  140. package/dist/cli.js +46 -46
  141. package/dist/craft-entry.js +2 -2
  142. package/dist/craft.js +2 -2
  143. package/dist/expressions.d.ts +0 -23
  144. package/dist/expressions.js +14 -11
  145. package/dist/includes.js +6 -0
  146. package/dist/loops.js +4 -3
  147. package/dist/native/compiler/component-mapping.js +1 -0
  148. package/dist/native/compiler/headwind-to-style.js +17 -0
  149. package/dist/native/compiler/html-to-ir.js +1 -0
  150. package/dist/native/compiler/inline-style.js +2 -0
  151. package/dist/native/compiler/ir.d.ts +2 -0
  152. package/dist/native/components/primitives.d.ts +33 -9
  153. package/dist/native/components/primitives.js +1 -0
  154. package/dist/native/primitives/MapPolygon.stx +2 -0
  155. package/dist/native/prop-names.js +1 -3
  156. package/dist/native/runtime/craft-bridge.js +22 -1
  157. package/dist/native/runtime/craft.d.ts +10 -0
  158. package/dist/process.js +3 -2
  159. package/dist/pwa.js +3 -3
  160. package/dist/safe-evaluator.d.ts +16 -0
  161. package/dist/safe-evaluator.js +10 -4
  162. package/dist/script-validation.js +4 -4
  163. package/dist/serve.js +5 -1
  164. package/dist/ssg.js +13 -13
  165. package/dist/utils.js +15 -2
  166. package/package.json +5 -5
  167. package/dist/chunk-06wv8qwy.js +0 -40
  168. package/dist/chunk-0d6b3eeb.js +0 -2
  169. package/dist/chunk-0mgth7cm.js +0 -2
  170. package/dist/chunk-1fdrhfc0.js +0 -2
  171. package/dist/chunk-2n59ahd9.js +0 -2
  172. package/dist/chunk-2pwjnydp.js +0 -2
  173. package/dist/chunk-2r4an7bh.js +0 -2
  174. package/dist/chunk-304vaxnk.js +0 -2
  175. package/dist/chunk-32hr3qq7.js +0 -2
  176. package/dist/chunk-36n8yz6t.js +0 -2
  177. package/dist/chunk-39pgf5z3.js +0 -2
  178. package/dist/chunk-3xwzd9wp.js +0 -2845
  179. package/dist/chunk-3yttgk0s.js +0 -2
  180. package/dist/chunk-4ck2xc8m.js +0 -2
  181. package/dist/chunk-4jasfhh6.js +0 -2
  182. package/dist/chunk-4szajb1z.js +0 -2
  183. package/dist/chunk-61ztfana.js +0 -127
  184. package/dist/chunk-7f63z4xx.js +0 -2
  185. package/dist/chunk-7renf4zp.js +0 -2
  186. package/dist/chunk-8bzx0r0x.js +0 -2
  187. package/dist/chunk-974dxazw.js +0 -2
  188. package/dist/chunk-9fpnnfr3.js +0 -2
  189. package/dist/chunk-9sgt7v77.js +0 -2
  190. package/dist/chunk-9zzhpp2a.js +0 -2
  191. package/dist/chunk-aan7601v.js +0 -2
  192. package/dist/chunk-b4tbqz8r.js +0 -2
  193. package/dist/chunk-bakxqwnz.js +0 -2
  194. package/dist/chunk-be2kmw0p.js +0 -2
  195. package/dist/chunk-bnpb6ez9.js +0 -2
  196. package/dist/chunk-c48mh4d6.js +0 -18
  197. package/dist/chunk-dzbkgsv8.js +0 -4
  198. package/dist/chunk-ewkza45r.js +0 -2
  199. package/dist/chunk-exd1h9sd.js +0 -2
  200. package/dist/chunk-fcgf8d5k.js +0 -2
  201. package/dist/chunk-gw2dvp35.js +0 -2
  202. package/dist/chunk-h9drxwva.js +0 -2
  203. package/dist/chunk-hrr7k1qc.js +0 -2
  204. package/dist/chunk-j04brkj0.js +0 -2
  205. package/dist/chunk-jbvwg4gs.js +0 -2
  206. package/dist/chunk-jshj69dy.js +0 -2
  207. package/dist/chunk-k4wkfhvz.js +0 -2
  208. package/dist/chunk-km9a5gp4.js +0 -2
  209. package/dist/chunk-m95zjk91.js +0 -3
  210. package/dist/chunk-mgj0ngyq.js +0 -2
  211. package/dist/chunk-myqhdz1w.js +0 -2
  212. package/dist/chunk-n35yc890.js +0 -3
  213. package/dist/chunk-n39ezmxz.js +0 -2
  214. package/dist/chunk-n8eavnxf.js +0 -2
  215. package/dist/chunk-p8sv5fqs.js +0 -2
  216. package/dist/chunk-pghtgep5.js +0 -2
  217. package/dist/chunk-pt7e0be5.js +0 -2
  218. package/dist/chunk-q40ahbjs.js +0 -2
  219. package/dist/chunk-qjxxhdv7.js +0 -2
  220. package/dist/chunk-rp93n4z7.js +0 -3
  221. package/dist/chunk-rrw2jg26.js +0 -2
  222. package/dist/chunk-rxja040z.js +0 -2
  223. package/dist/chunk-sx0qbekt.js +0 -2
  224. package/dist/chunk-t83acmv2.js +0 -2
  225. package/dist/chunk-tc176d93.js +0 -2
  226. package/dist/chunk-wjhhb6dn.js +0 -2
  227. package/dist/chunk-wm8w2721.js +0 -2
  228. package/dist/chunk-wtax276j.js +0 -2
  229. package/dist/chunk-wy53pys4.js +0 -43
  230. package/dist/chunk-x49qdt4c.js +0 -2
  231. package/dist/chunk-y0zyzbjf.js +0 -2
  232. package/dist/chunk-yn2d8x8m.js +0 -3
  233. package/dist/chunk-z8mdsjzw.js +0 -2
  234. package/dist/chunk-zg87pybq.js +0 -2
  235. package/dist/chunk-zq345s76.js +0 -2
  236. package/dist/chunk-zs3ezqy3.js +0 -2
package/dist/serve.js CHANGED
@@ -8,6 +8,7 @@ import { extractVariables } from "./utils.js";
8
8
  import { compressResponse } from "./compression.js";
9
9
  import { readResponseHeaders, readResponseStatus } from "./page-response.js";
10
10
  import { createServerApi, isServerApiSource } from "./server-api.js";
11
+ import { validateClientScript } from "./script-validation.js";
11
12
  export function htmlResponse(html, status = 200, headers = {}) {
12
13
  return new Response(html, {
13
14
  status,
@@ -49,8 +50,11 @@ export async function serve(options = {}) {
49
50
  const attrs = scriptMatch[1], scriptContent = scriptMatch[2], fullScript = scriptMatch[0];
50
51
  if (attrs.includes("server"))
51
52
  serverScripts.push(scriptContent);
52
- else
53
+ else {
54
+ if (!/\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(attrs))
55
+ validateClientScript(scriptContent, filePath, stxOptions.strict);
53
56
  clientScripts.push(fullScript);
57
+ }
54
58
  }
55
59
  const styleMatches = content.match(/<style\b[^>]*>[\s\S]*?<\/style>/gi) || [];
56
60
  let templateContent = workingContent.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, "");
package/dist/ssg.js CHANGED
@@ -1,17 +1,17 @@
1
1
  // @bun
2
- import"./chunk-s4pjf2pc.js";import"./chunk-06wv8qwy.js";import"./chunk-wzjf33es.js";import{lt,ut,dt,pt,ft,gt}from"./chunk-azpkje69.js";import"./chunk-sswjv8p9.js";import"./chunk-bsy8v1xj.js";import{f,Ke,L,J,n,o}from"./chunk-3xwzd9wp.js";import"./chunk-x8q5przn.js";import{br}from"./chunk-td5100fz.js";import"./chunk-bhf9yt2w.js";import"./chunk-1dd4qefr.js";import"./chunk-rmv35cx0.js";import"./chunk-6xsm53pz.js";import"./chunk-c65q0svd.js";import{ue,Ct,_t}from"./chunk-0cb00ys2.js";import{Yo,Zo,Qo}from"./chunk-cfpenvc7.js";import{St,dn,pn}from"./chunk-rp93n4z7.js";import"./chunk-dnqq1ze0.js";import{a}from"./chunk-n35yc890.js";import x from"fs";import g from"path";import{createHash as Pt}from"crypto";function $t(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var 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=$t(h);let S=Rt(h);if(!s.has(S))s.set(S,h);let P=i.integrity?` data-stx-integrity="sha384-${Pt("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 ht{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 mt{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-5rtatjwq.js";import"./chunk-k1hpxgzq.js";import"./chunk-99rfdydy.js";import{ut,pt,ft,gt,mt,ht}from"./chunk-1c0zvjt3.js";import"./chunk-2bcp699b.js";import"./chunk-66e4ga0z.js";import{f,Xe,L,Z,n,o}from"./chunk-5fa9g7x1.js";import"./chunk-c9jav70j.js";import{wr}from"./chunk-8dq3r6xw.js";import"./chunk-nmh4pn44.js";import"./chunk-adn5r0r4.js";import"./chunk-mm8jdb4p.js";import"./chunk-0zx1400y.js";import"./chunk-ktg9khmj.js";import{ue,Et,Tt}from"./chunk-btcc95hq.js";import{Qo,ei,ti}from"./chunk-d16jgsyv.js";import{Ct,fn,gn}from"./chunk-hjp38m0w.js";import"./chunk-q4t49t6z.js";import{a}from"./chunk-6ta850w8.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 it(t,i={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let s=new Map,r=t.replace($t,(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=Dt(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 Rt=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(Rt.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 kt=["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 kt){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 dt{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(`
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 Tt(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 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",`
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 At(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,i,s={},r,c){let e=await Bun.file(t.filePath).text(),l=await Ot(t.filePath),w=await Tt(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
- resolved against partialsDir: ${b.partialsDir}`)},onServerScriptError:(b)=>{P.push(`${g.relative(process.cwd(),b.sourcePath)} (${b.kind}): ${b.message}`)}};if(At(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 ue(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}
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 wt(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}
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 ue(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
- ${p}`}if(p=await J(p,{router:r.router}),p=await f(p),r.minify!==!1)return{html:Lt(p),dependencies:Array.from(h),includeFailures:S,serverScriptFailures:P};return{html:p,dependencies:Array.from(h),includeFailures:S,serverScriptFailures:P}}function Lt(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 Mt(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 Ut(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"?>
14
+ ${p}`}if(p=await Z(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"?>
15
15
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
16
16
  ${t.map((r)=>{let c=new URL(r.loc,i).href,e=` <url>
17
17
  <loc>${I(c)}</loc>`;if(r.lastmod)e+=`
@@ -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-4szajb1z.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-k4wkfhvz.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 ht(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-4szajb1z.js");await u('<div class="bg-black"></div>')}catch{}lt();let yt=s?.routeMiddleware?.dir||"middleware";await dt(process.cwd(),yt);let H=ut();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let xt=s?.routeMiddleware?.global||[];Qo(s?.layoutsDir,a(process.cwd()));let K=L(".",{pagesDir:e.pagesDir,pagesDirs:s?._layerPageDirs});console.log(`Found ${K.length} routes`);let G=[];for(let u of K){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 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:M,props:vt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Jt(j),bt=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],tt=[...xt,...bt];if(tt.length>0){let C=pt(d,M,F||{}),O=ft(C,null,void 0,{isServer:!0}),E=await gt(tt,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 et=j.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();Tt();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-5003ncbh.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-15wmzj8j.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-5003ncbh.js");await u('<div class="bg-black"></div>')}catch{}ut();let yt=s?.routeMiddleware?.dir||"middleware";await ft(process.cwd(),yt);let H=pt();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let St=s?.routeMiddleware?.global||[];ti(s?.layoutsDir,a(process.cwd()));let V=L(".",{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 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:M,props:xt,revalidate:Q}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Jt(j),vt=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],tt=[...St,...vt];if(tt.length>0){let C=gt(d,M,F||{}),O=mt(C,null,void 0,{isServer:!0}),E=await ht(tt,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 et=j.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 wt(v,M,vt,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 wt(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:
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}=it(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=st(k)}}if(await x.promises.mkdir(g.dirname(U),{recursive:!0}),await Bun.write(U,k),!Ut(d,k,F,e.sitemapExclude))A.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(Q!==!1)nt.revalidateAt=Date.now()+Q*1000;l.pages.push(nt),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=Ct();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}=it(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=st(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 nt={route:d,outputPath:U,size:Buffer.byteLength(k,"utf8"),cached:rt};if(Q!==!1)nt.revalidateAt=Date.now()+Q*1000;l.pages.push(nt),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 X=Et();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&&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=br({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=Yo(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=Zo(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=pn();if(Z)await V(Z,g.join(e.outputDir,dn)),console.log(`Copied assets from ${St}`)}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&&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=wr({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=Qo(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=ei(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=gn();if(Y)await J(Y,g.join(e.outputDir,fn)),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?`
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 V(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 V(c,e);else await x.promises.copyFile(c,e)}}function Ht(t={}){let i=t.cacheDir||a(process.cwd(),"ssg-cache"),s=new mt(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=L(".",{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 wt(l,y,{},t,h);await s.set(c,{html:S,generatedAt:Date.now(),revalidateAfter:Date.now()+r*1000,etag:Mt(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 Ke(t)}function Vt(t,i){return`<!DOCTYPE html>
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 dt(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=L(".",{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 wt(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 Xe(t)}function Vt(t,i){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,i){if(t==="/"||t==="")return g.join(i.outputDir,"index.html");let s=t.replace(/^\/|\/$/g,"");if(i.trailingSlash)return g.join(i.outputDir,s,"index.html");return g.join(i.outputDir,`${s}.html`)}var ye={generateStaticSite:zt,createISRHandler:Ht,defineStaticPaths:Wt,createMarkdownLoader:qt};export{Ht as createISRHandler,qt as createMarkdownLoader,At as declaresPageAction,ye as default,Wt as defineStaticPaths,zt as generateStaticSite,Ut as isExcludedFromSitemap};
97
+ </html>`}function Kt(t,i){if(t==="/"||t==="")return g.join(i.outputDir,"index.html");let s=t.replace(/^\/|\/$/g,"");if(i.trailingSlash)return g.join(i.outputDir,s,"index.html");return g.join(i.outputDir,`${s}.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};
package/dist/utils.js CHANGED
@@ -25,6 +25,8 @@ import { markProjectedRefs } from "./misc-directives.js";
25
25
  import { collectBlockDeclarations } from "./stx-virtual-ts.js";
26
26
  import { CLIENT_LOOP_NAMES_KEY, inheritedClientLoopNames } from "./loop-binding.js";
27
27
  import { isFallthroughAttribute } from "./builtins/attrs.js";
28
+ import { StxValidationError } from "./errors/types.js";
29
+ import { validateClientScript } from "./script-validation.js";
28
30
  export {
29
31
  extractDirectiveNames,
30
32
  getPositionInfo,
@@ -828,7 +830,11 @@ export async function renderComponentWithSlot(componentPath, props, slotContent,
828
830
  const templateBlock = findSfcTemplateBlock(workingContent);
829
831
  if (templateBlock)
830
832
  workingContent = templateBlock.content.trim();
831
- const scriptRegex = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi, scriptMatches = [...componentContent.matchAll(scriptRegex)], clientScripts = [];
833
+ const scriptRegex = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi, scriptMatches = [...componentContent.matchAll(scriptRegex)];
834
+ for (const [, attrs, content] of scriptMatches)
835
+ if (!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(attrs))
836
+ validateClientScript(content, componentFilePath, options.strict);
837
+ const clientScripts = [];
832
838
  let serverScriptFailure = null;
833
839
  const cacheableServerComponent = scriptMatches.some((match) => /\bserver\b/.test(match[1] || "") && /\bcache\b/.test(match[1] || ""));
834
840
  let componentRenderCacheKey = null, dependencyBaseline = null, clientFactoryBaseline = null, uidBaseline = 0, preservedExpressionBaseline = null;
@@ -953,7 +959,7 @@ export async function renderComponentWithSlot(componentPath, props, slotContent,
953
959
  try {
954
960
  propsJson = ` data-stx-props="${escapeAttr(JSON.stringify(props))}"`;
955
961
  } catch {}
956
- const hydrateJson = hydrateTrigger ? ` stx-hydrate="${escapeAttr(hydrateTrigger)}"` : "", scopeAttrs = ` data-stx-scope="${scopeId}"${propsJson}${hydrateJson}`, inlineRoot = /^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(result), wrapperTag = inlineRoot ? "span" : "div";
962
+ const hydrateJson = hydrateTrigger ? ` stx-hydrate="${escapeAttr(hydrateTrigger)}"` : "", slotPresence = Object.fromEntries(Object.entries($slots).map(([name, content]) => [name, Boolean(content)])), slotsJson = Object.keys(slotPresence).length > 0 ? ` data-stx-slots="${escapeAttr(JSON.stringify(slotPresence))}"` : "", scopeAttrs = ` data-stx-scope="${scopeId}"${propsJson}${slotsJson}${hydrateJson}`, inlineRoot = /^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(result), wrapperTag = inlineRoot ? "span" : "div";
957
963
  output = scopeOnRootElement(result, scopeAttrs) ?? `<${wrapperTag}${scopeAttrs} data-stx-component-wrapper${inlineRoot ? ' style="display:contents"' : ""}>${result}</${wrapperTag}>`;
958
964
  const scopedScripts = await Promise.all(clientScripts.map(async (script) => {
959
965
  const scriptMatch = script.match(/<script([^>]*)>([\s\S]*)<\/script>/i);
@@ -1011,6 +1017,8 @@ return (${island.factoryBody})(__scopeId);
1011
1017
  ${callerClientScripts.join(`
1012
1018
  `)}` : output;
1013
1019
  } catch (error) {
1020
+ if (error instanceof StxValidationError)
1021
+ throw error;
1014
1022
  return `[Error processing component: ${error instanceof Error ? error.message : String(error)}]`;
1015
1023
  } finally {
1016
1024
  components.delete(componentPath);
@@ -1341,6 +1349,11 @@ async function buildComponentIsland(rawContent, componentFilePath, minify) {
1341
1349
  // runtime hands its root over in __STX_SETUP_ROOT__ (signals.ts).
1342
1350
  const __setupRoot = window.__STX_SETUP_ROOT__;
1343
1351
  const __componentElement = (__setupRoot && __setupRoot.getAttribute('data-stx-scope') === __scopeId && __setupRoot) || document.querySelector('[data-stx-scope="' + __scopeId + '"]');
1352
+ __scopeVars.$slots = Object.create(null);
1353
+ if (__componentElement) {
1354
+ try { Object.assign(__scopeVars.$slots, JSON.parse(__componentElement.getAttribute('data-stx-slots') || '{}')); }
1355
+ catch {}
1356
+ }
1344
1357
  window.__STX_CURRENT_ELEMENT__ = __componentElement;
1345
1358
  let __componentProps = __componentElement && __componentElement.__stx_props;
1346
1359
  if (!__componentProps && __componentElement) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.607",
4
+ "version": "0.2.612",
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.607",
132
- "@stacksjs/sanitizer": "0.2.607",
131
+ "@stacksjs/desktop": "0.2.612",
132
+ "@stacksjs/sanitizer": "0.2.612",
133
133
  "@stacksjs/ts-i18n": "^0.1.11",
134
- "bun-plugin-stx": "0.2.607",
134
+ "bun-plugin-stx": "0.2.612",
135
135
  "bunfig": "^0.15.21",
136
- "stx-router": "0.2.607",
136
+ "stx-router": "0.2.612",
137
137
  "ts-broadcasting": "^0.0.11",
138
138
  "ts-images": "^0.2.22",
139
139
  "ts-syntax-highlighter": "^0.2.1"
@@ -1,40 +0,0 @@
1
- // @bun
2
- import{N}from"./chunk-k3f4044e.js";var t={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function L(e){for(let[r,n]of Object.entries(t))if(n===e)return r;return}import le from"path";var ue={showRelativePaths:!1,enableAutoRecovery:N(),logRecoveryWarnings:!0},A={...ue};function k(){return{...A}}function _(e){if(!A.showRelativePaths||!e)return e;let r=A.baseDir||process.cwd();try{let n=le.relative(r,e);return n.startsWith("..")?e:n}catch{return e}}class R extends Error{code;filePath;line;column;context;numericCode;constructor(e,r,n,o,s,a,g){super(e);this.code=r;this.filePath=n;this.line=o;this.column=s;this.context=a;if(this.name="StxError",this.numericCode=g||t.EVALUATION_ERROR,this.filePath)this.filePath=_(this.filePath)}}class Y extends R{constructor(e,r,n,o,s,a){super(e,"stx_RUNTIME_ERROR",r,n,o,s,a||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class On extends R{constructor(e,r,n,o,s,a){super(e,"stx_FILE_ERROR",r,n,o,s,a||t.FILE_NOT_FOUND);this.name="StxFileError"}}class Sr extends R{isFatal=!0;constructor(e,r,n,o,s,a){super(e,"stx_VALIDATION_ERROR",r,n,o,s,a||t.DOM_API_VIOLATION);this.name="StxValidationError"}}function G(e){let{type:r,message:n,code:o,filePath:s,line:a,column:g,template:u,offset:h,snippet:m,suggestion:d,format:f="text"}=e,E=a,x=g;if(!E&&u&&h!==void 0){let V=he(u,h);E=V.line,x=V.column}let w=s?_(s):void 0,y=o?L(o):void 0,S={type:r,code:o,codeName:y,message:n,filePath:w,line:E,column:x,snippet:m,suggestion:d,timestamp:new Date().toISOString()},v;switch(f){case"html":v=fe(S);break;case"json":v=JSON.stringify(S,null,2);break;case"console":v=me(S,u,h);break;case"text":default:v=ge(S,u,h);break}return{formatted:v,data:S}}function ge(e,r,n){let o=[],s=e.code?` [${e.codeName||e.code}]`:"";if(o.push(`[${e.type} Error${s}]`),e.filePath){let a=e.filePath;if(e.line){if(a+=`:${e.line}`,e.column)a+=`:${e.column}`}o.push(`at ${a}`)}if(o.push(`
3
- ${e.message}`),r&&e.line){let a=pe(r,e.line,2);if(a)o.push(`
4
- ${a}`)}if(e.snippet)o.push(`
5
- Snippet: ${e.snippet}`);if(e.suggestion)o.push(`
6
- Suggestion: ${e.suggestion}`);return o.join(" ")}function fe(e){let r=e.code?` [${e.code}]`:"",n=e.filePath?` in ${e.filePath}${e.line?`:${e.line}`:""}`:"",o=`<!-- [${e.type} Error${r}]${n}: ${X(e.message)}`;if(e.suggestion)o+=` | Suggestion: ${X(e.suggestion)}`;return o+=" -->",o}function me(e,r,n){let m=[],d=e.code?` [${e.codeName||e.code}]`:"";if(m.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${e.type} Error${d} \u2501\u2501\u2501${"\x1B[0m"}`),e.filePath){let f=`\x1B[36m${e.filePath}\x1B[0m`;if(e.line){if(f+=`\x1B[90m:${e.line}\x1B[0m`,e.column)f+=`\x1B[90m:${e.column}\x1B[0m`}m.push(`
7
- \x1B[90mat\x1B[0m ${f}`)}if(m.push(`
8
-
9
- ${e.message}`),r&&e.line){let f=de(r,e.line,2);if(f)m.push(`
10
-
11
- \x1B[90mContext:\x1B[0m
12
- ${f}`)}if(e.suggestion)m.push(`
13
-
14
- \x1B[33mSuggestion:\x1B[0m ${e.suggestion}`);return m.push(`
15
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),m.join("")}function pe(e,r,n){let o=e.split(`
16
- `),s=Math.max(0,r-n-1),a=Math.min(o.length-1,r+n-1),g=[];for(let u=s;u<=a;u++){let h=(u+1).toString().padStart(4),m=u===r-1?">":" ";g.push(`${m}${h} | ${o[u]}`)}return g.join(`
17
- `)}function de(e,r,n){let o=e.split(`
18
- `),s=Math.max(0,r-n-1),a=Math.min(o.length-1,r+n-1),g="\x1B[90m",u="\x1B[31m",h="\x1B[0m",m=[];for(let d=s;d<=a;d++){let f=(d+1).toString().padStart(4),E=d===r-1,x=E?"\x1B[31m>\x1B[0m":" ",w=E?`\x1B[31m${o[d]}\x1B[0m`:`\x1B[90m${o[d]}\x1B[0m`;m.push(`${x}\x1B[90m${f}\x1B[0m | ${w}`)}return m.join(`
19
- `)}function X(e){return e.replace(/--/g,"- -").replace(/>/g,"&gt;")}function he(e,r){let o=e.substring(0,r).split(`
20
- `);return{line:o.length,column:o[o.length-1].length}}function i(e,r,n){return G({type:e,message:r,code:n,format:"html"}).formatted}async function oe(e,r,n){try{return await e()}catch(o){if(n&&o instanceof Error)n(o);return r}}var Ys={isEnabled(){return k().enableAutoRecovery},fixCommonSyntaxErrors(e){let r=k();if(!r.enableAutoRecovery)return{fixed:e,fixes:[]};let n=e,o=[],s=(n.match(/\{\{/g)||[]).length,a=(n.match(/\}\}/g)||[]).length;if(s>a){let u=s-a;n+="}}".repeat(u),o.push(`Added ${u} missing closing braces '}}'`)}let g=["if","foreach","for","switch","section"];for(let u of g){let h=(n.match(new RegExp(`@${u}\\b`,"g"))||[]).length,m=(n.match(new RegExp(`@end${u}\\b`,"g"))||[]).length;if(h>m){let d=h-m;for(let f=0;f<d;f++)n+=`
21
- @end${u}`;o.push(`Added ${d} missing @end${u}`)}}if(o.length>0&&r.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),o.forEach((u)=>console.warn(` - ${u}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:n,fixes:o}},createFallbackContent(e,r){if(N())return`<!-- ${e} failed: ${r.message} -->`;return"<!-- stx rendering error -->"}};class P{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(e={}){this.maxErrors=e.maxErrors??1000,this.enableFileLogging=e.enableFileLogging??!1,this.logFilePath=e.logFilePath??".stx/errors.log",this.logFormat=e.logFormat??"json",this.maxFileSize=e.maxFileSize??10485760,this.maxLogFiles=e.maxLogFiles??5,this.minLevel=e.minLevel??"all"}configure(e){if(e.maxErrors!==void 0)this.maxErrors=e.maxErrors;if(e.enableFileLogging!==void 0)this.enableFileLogging=e.enableFileLogging;if(e.logFilePath!==void 0)this.logFilePath=e.logFilePath;if(e.logFormat!==void 0)this.logFormat=e.logFormat;if(e.maxFileSize!==void 0)this.maxFileSize=e.maxFileSize;if(e.maxLogFiles!==void 0)this.maxLogFiles=e.maxLogFiles;if(e.minLevel!==void 0)this.minLevel=e.minLevel}log(e,r,n="error"){let o={timestamp:new Date,error:e,context:r,level:n};if(this.errors.push(o),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(n))this.writeToFile(o)}shouldLog(e){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return e==="error"||e==="warning";if(this.minLevel==="error")return e==="error";return!0}formatEntry(e){if(this.logFormat==="json")return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level||"error",type:e.error.constructor.name,message:e.error.message,stack:e.error.stack,context:e.context});let r=[`[${e.timestamp.toISOString()}] [${(e.level||"error").toUpperCase()}] ${e.error.constructor.name}: ${e.error.message}`];if(e.error.stack)r.push(` Stack: ${e.error.stack.split(`
22
- `).slice(1).join(`
23
- `)}`);if(e.context)r.push(` Context: ${JSON.stringify(e.context)}`);return r.join(`
24
- `)}writeToFile(e){this.writeQueue=this.writeQueue.then(async()=>{try{let r=await import("fs"),n=await import("path"),o=n.dirname(this.logFilePath);if(!r.existsSync(o))r.mkdirSync(o,{recursive:!0});await this.rotateIfNeeded(r);let s=`${this.formatEntry(e)}
25
- `;r.appendFileSync(this.logFilePath,s,"utf-8")}catch(r){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",r)}})}async rotateIfNeeded(e){try{if(!e.existsSync(this.logFilePath))return;if(e.statSync(this.logFilePath).size<this.maxFileSize)return;for(let n=this.maxLogFiles-1;n>=1;n--){let o=`${this.logFilePath}.${n}`,s=`${this.logFilePath}.${n+1}`;if(e.existsSync(o))if(n>=this.maxLogFiles-1)e.unlinkSync(o);else e.renameSync(o,s)}if(this.maxLogFiles<=1)e.writeFileSync(this.logFilePath,"");else e.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(r){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",r)}}getRecentErrors(e=10){return this.errors.slice(-e)}getErrorsByType(e){return this.errors.filter((r)=>r.error.constructor.name===e)}getErrorsByLevel(e){return this.errors.filter((r)=>r.level===e)}clear(){this.errors.length=0}async clearLogFile(){try{let e=await import("fs");if(e.existsSync(this.logFilePath))e.writeFileSync(this.logFilePath,"","utf-8")}catch(e){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",e)}}getStats(){let e={},r={error:0,warning:0,info:0};for(let n of this.errors){let o=n.error.constructor.name;e[o]=(e[o]||0)+1;let s=n.level||"error";r[s]=(r[s]||0)+1}return{total:this.errors.length,byType:e,byLevel:r}}async exportToFile(e,r="json"){let n=await import("fs"),o=await import("path"),s=o.dirname(e);if(!n.existsSync(s))n.mkdirSync(s,{recursive:!0});if(r==="json"){let a=this.errors.map((g)=>({timestamp:g.timestamp.toISOString(),level:g.level||"error",type:g.error.constructor.name,message:g.error.message,stack:g.error.stack,context:g.context}));n.writeFileSync(e,JSON.stringify(a,null,2),"utf-8")}else{let a=this.errors.map((g)=>this.formatEntry(g));n.writeFileSync(e,a.join(`
26
-
27
- `),"utf-8")}}async flush(){await this.writeQueue}}var I=new P,zt={isDevelopment(){return N()},logDetailedError(e,r){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),r)console.error("Context:",r);console.error("========================")},createErrorReport(e,r){let n=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(r)n.push(`Context: ${JSON.stringify(r,null,2)}`);return n.push("========================"),n.join(`
28
- `)}};var Ee={maxSanitizeDepth:10,allowBracketNotation:!1},K={...Ee};var O=/\bnew\s+/,F="__stx_safe_ctors",ee=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],T=[...ee,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],H=T.map(()=>{return}),M=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),j=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,O,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],U=new Set([...ee,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",F]),B=new Set(["__proto__","constructor","prototype"]);function te(e){let r="",n=[],o=null,s=!1;for(let a=0;a<e.length;a++){let g=e[a];if(s){s=!1;continue}if(g==="\\"&&o){s=!0;continue}if(o){if(o==="`"&&g==="$"&&a+1<e.length&&e[a+1]==="{"){let u=1;a+=2;while(a<e.length&&u>0){if(e[a]==="{")u++;else if(e[a]==="}")u--;if(u>0)r+=e[a],n.push(a),a++}continue}if(g===o)o=null;continue}if(g==='"'||g==="'"||g==="`"){o=g;continue}r+=g,n.push(a)}return{text:r,map:n}}function re(e){return te(e).text}var ne=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],se=(()=>{let e={Date,URL,URLSearchParams},r=Intl;for(let n of ne)if(typeof r[n]==="function")e[`Intl_${n}`]=r[n];return Object.freeze(Object.assign(Object.create(null),e))})(),xe=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,q=/(?<![\w$])new(?![\w$])/g,J=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${ne.join(",")}}() are allowed`;function be(e){let{text:r,map:n}=te(e),o=[];q.lastIndex=0;let s;while((s=q.exec(r))!==null){let g=s.index;if(/(?<!\.)\.\s*$/.test(r.slice(0,g)))continue;let u=xe.exec(r.slice(g)),h=u?.[3],m=!u?null:h?`Intl_${h}`:u[2];if(!u||!m||!(m in se))throw new b(`matched /${O.source}/; ${J}`,e);let d=g+u[0].length,f=n[g],E=n[d-1]+1;if(e.slice(f,E)!==r.slice(g,d))throw new b(`matched /${O.source}/; ${J}`,e);let x=f+3+u[1].length;o.push({start:x,end:x+u[2].length,key:m})}let a=e;for(let g=o.length-1;g>=0;g--){let u=o[g];a=`${a.slice(0,u.start)}${F}.${u.key}${a.slice(u.end)}`}return{source:a,usesSafeConstructors:o.length>0}}class b extends Error{rule;expression;constructor(e,r,n){super(n??`Potentially unsafe expression (${e}): ${r}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=r}}function Dn(e){try{return W(e),null}catch(r){return r instanceof b?r.rule:r instanceof Error?r.message:String(r)}}function ie(e,r){let n=/[$A-Z_a-z][$\w]*/g,o;while((o=n.exec(e))!==null){let s=o[0],a=e[o.index-1];if(U.has(s))throw new b(`matched /\\b${s}\\b/; identifier ${s}`,r);if(a==="."&&B.has(s))throw new b(`matched /.${s}/; property ${s}`,r)}}function ae(e,r=!0){let n=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,o=new Set,s;while((s=n.exec(e))!==null){let a=s.index+s[0].indexOf("["),g=e.slice(0,a);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(g))continue;let u=s[1].trim(),h=/^'(?:[^'\\]|\\.)*'$/.test(u),m=/^"(?:[^"\\]|\\.)*"$/.test(u);if(/^\d+$/.test(u))continue;if(h||m){let f=u.slice(1,-1);if(B.has(f))throw new b(`bracket key ${f}`,e);if(!K.allowBracketNotation)throw new b("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(r&&/^[$A-Z_a-z][$\w]*$/.test(u)){o.add(u);continue}throw new b("dynamic bracket notation is not allowed",e)}return[...o]}function W(e){let r=e.trim(),n=re(r);ie(n,r);let o=ae(r);for(let s of j){if(s===O)continue;if(s.test(n))throw new b(`matched /${s.source}/`,r)}return{...be(r),dynamicKeys:o}}function Zs(e){return W(e),e.trim()}function kr(e){let r={};r.Math=Math,r.JSON=JSON,r.Date=Date,r.String=String,r.Number=Number,r.Boolean=Boolean,r.Array=Array,r.Object=M,r.parseInt=Number.parseInt,r.parseFloat=Number.parseFloat,r.isNaN=Number.isNaN,r.isFinite=Number.isFinite,r.encodeURIComponent=encodeURIComponent,r.decodeURIComponent=decodeURIComponent;for(let[n,o]of Object.entries(e)){if(n.startsWith("__")||j.some((s)=>s.test(n)))continue;if(o&&typeof o==="object"&&!Array.isArray(o))r[n]=z(o);else r[n]=o}return r}function z(e,r=0){if(r>=K.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((o)=>z(o,r+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let n={};for(let[o,s]of Object.entries(e)){if(o.startsWith("__")||o==="constructor"||o==="prototype")continue;if(s&&typeof s==="object")n[o]=z(s,r+1);else n[o]=s}return n}function l(e,r){try{let n=kr(r),o=Object.keys(n),s=Object.values(n);return c(e,o)(...s)}catch{return}}function p(e){try{return Zs(e),!0}catch{return!1}}function Xi(e,r){try{let n=kr(r),o=Object.keys(n),s=Object.values(n),a=!1,u=c(e,o,()=>{a=!0})(...s);return!a&&Boolean(u)}catch{return!1}}function D(e,r){try{let n=l(e,r);if(n&&typeof n==="object"&&!Array.isArray(n))return n;return{}}catch{return{}}}var ce=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),ye=2000,C=new Map;function Q(e,r){let n=`${e.join(",")}\x00${r}`,o=C.get(n);if(o)return o;let s=Function(...e,r);if(C.size>=ye)C.clear();return C.set(n,s),s}function Ae(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var we=/^[A-Za-z_$][\w$]*$/;function at(e){return we.test(e)&&!ce.has(e)}function c(e,r,n){let{source:o,usesSafeConstructors:s,dynamicKeys:a}=W(e),g=[];for(let f=0;f<r.length;f++){if(!at(r[f]))continue;if(r[f]===F||r[f]==="Object"||U.has(r[f]))continue;g.push({key:r[f],index:f})}g.sort((f,E)=>f.key.localeCompare(E.key));let u=g.map((f)=>f.key),h=g.map((f)=>f.index),m=`
29
- 'use strict';
30
- try {
31
- return ${o};
32
- }
33
- catch (e) {
34
- if (e instanceof TypeError) {
35
- return undefined;
36
- }
37
- throw e;
38
- }
39
- `;return Se(ve(s?(f)=>{let E=Q([F,"Object",...T,...u,...f],m);return(...x)=>E(se,M,...H,...x)}:(f)=>{let E=Q(["Object",...T,...u,...f],m);return(...x)=>E(M,...H,...x)},u,r,g,h,n),r,a)}function Se(e,r,n){if(n.length===0)return e;let o=n.map((s)=>r.indexOf(s));return(...s)=>{for(let a of o){if(a<0)continue;let g=s[a];if(typeof g==="string"&&B.has(g))return}return e(...s)}}function ve(e,r,n,o,s,a){let g=e([]),u=o.every((m,d)=>m.index===d);if(r.length===n.length&&u)return Z(g,r,e,void 0,a);return Z((...m)=>{let d=Array(s.length);for(let f=0;f<s.length;f++)d[f]=m[s[f]];return g(...d)},r,e,(m)=>{g=e(m)},a)}function Z(e,r,n,o,s){let g=/^(\w+) is not defined$/,u=e,h=[],m=new Set(r);return(...d)=>{for(let f=0;f<=8;f++)try{return u(...d)}catch(E){let x=E instanceof Error?E.message:"",w=g.exec(x);if(!(E instanceof ReferenceError)||!w)return;let y=w[1];if(m.has(y)||ce.has(y)||U.has(y))return;if(s?.(y),m.add(y),h.push(y),o)o(h);else u=n(h)}return}}function Cr(e){let r=e.trim();try{let n=re(r);if(/\b(?:eval|function|import|require|process|globalthis|window|document|fetch|bun|deno|buffer|console|reflect|proxy|prototype|constructor|this)\b/i.test(n))return!1;ie(n,r),ae(r);for(let o of j)if(o.test(n))return!1}catch{return!1}return!0}
40
- export{t,Y,On,Sr,i,oe,Ys,I,zt,Dn,Zs,kr,l,p,Xi,D,Ae,at,c,Cr};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Ur,Wr,qr,Ra,Aa,Pa,Do,Ia,Oa}from"./chunk-67tpacz0.js";export{Ur as ImageProcessorCache,Do as applyTransformations,Ra as clearImageCache,Ia as generateResponsiveVariants,Oa as generateSrcset,Wr as getCachedImageResult,Pa as optimizeImage,Aa as processImage,qr as setCachedImageResult};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{yl}from"./chunk-5j29466h.js";import"./chunk-bspryr4a.js";import"./chunk-c65q0svd.js";import"./chunk-3xwzd9wp.js";import"./chunk-dnqq1ze0.js";import"./chunk-wzjf33es.js";import"./chunk-6xsm53pz.js";import"./chunk-1dd4qefr.js";import"./chunk-bhf9yt2w.js";import"./chunk-td5100fz.js";import"./chunk-x8q5przn.js";import"./chunk-06wv8qwy.js";import"./chunk-bsy8v1xj.js";import"./chunk-sswjv8p9.js";import"./chunk-azpkje69.js";import"./chunk-rmv35cx0.js";export{yl as startProductionServer};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{da,wo,pa,fa,xo,ga,ma,ha,ya,So,ba,wl}from"./chunk-wy53pys4.js";import{Io,Ca}from"./chunk-td30jg06.js";import{B,F,z,Kt,Q,ce,Kn,Be,wt,Xt,Jt,Yt,H,Zt,Qt,Xn}from"./chunk-m95zjk91.js";import{tc}from"./chunk-efy3038a.js";import"./chunk-yzj55rfs.js";export{F as DEFAULT_FORMATS,z as DEFAULT_QUALITY,B as DEFAULT_WIDTHS,Xn as ImageProcessingError,fa as clearImageCache,xo as createImageDirective,Ca as createImageHandler,ma as createImagePlugin,wl as defaultImageConfig,Qt as formatSize,So as generateImageManifest,wt as generateSizes,Be as generateSrcSet,Xt as getFallbackVariant,Kn as getImageMetadata,H as getMimeType,Zt as getTotalSize,Jt as groupVariantsByFormat,Io as handleImageRequest,ga as imageDirective,Q as isImageBackendAvailable,Yt as isImageFile,Kt as isSharpAvailable,ya as optimizeDirectory,ha as optimizeImage,wo as parseImageComponent,ce as processImage,pa as processImageComponents,da as renderImageComponent,tc as rewriteImagesWithSiblings,ba as writeImageManifest};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Lt,Mc,Lc,jc,Bc,Fc,u,zc,Rs,Hc,Ei,Ti}from"./chunk-3xwzd9wp.js";import"./chunk-dnqq1ze0.js";import"./chunk-wzjf33es.js";import"./chunk-6xsm53pz.js";import"./chunk-1dd4qefr.js";import"./chunk-bhf9yt2w.js";import"./chunk-td5100fz.js";import"./chunk-x8q5przn.js";import"./chunk-06wv8qwy.js";import"./chunk-bsy8v1xj.js";import"./chunk-sswjv8p9.js";import"./chunk-azpkje69.js";import"./chunk-rmv35cx0.js";export{Lt as STX_ENGINE_BINDING_NAMES,Rs as convertToCommonJS,Ei as extractScriptFromTemplate,u as extractVariables,Ti as hasVariables,zc as isCompleteImport,Fc as isMissingBindingFailure,jc as isModuleResolutionFailure,Bc as isSyntaxFailure,Hc as splitDeclaration,Mc as stripTypeScript,Lc as withoutStxReferrer};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{nr,bc,Xu,vc,Ju,wc,rr,b,Ot,ke,xc,ys,Sc,Yu,X,kc,Zu,x,Qu}from"./chunk-3xwzd9wp.js";import"./chunk-dnqq1ze0.js";import"./chunk-wzjf33es.js";import"./chunk-6xsm53pz.js";import"./chunk-1dd4qefr.js";import"./chunk-bhf9yt2w.js";import"./chunk-td5100fz.js";import"./chunk-x8q5przn.js";import"./chunk-06wv8qwy.js";import"./chunk-bsy8v1xj.js";import"./chunk-sswjv8p9.js";import"./chunk-azpkje69.js";import"./chunk-rmv35cx0.js";export{kc as applyFilters,Ju as clearCustomFilters,xc as clientLoopScopes,nr as defaultFilters,b as escapeHtml,Ot as escapeHtmlValue,x as evaluateExpression,wc as findMustacheEnd,vc as getAllFilters,Sc as interpolateScriptAttributes,ys as interpolateScriptExpressions,Yu as interpolateScriptsInTemplate,X as processExpressions,bc as registerFilter,Xu as registerFilters,rr as replaceInterpolations,Zu as resetRejectedExpressionWarnings,Qu as unescapeHtml,ke as usesSignalsInScript};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{nu,ru}from"./chunk-vw62fjpv.js";export{ru as ensureTeleportTargets,nu as processTeleportDirectives};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ei,ti,ni,oc,ic}from"./chunk-tydv84gj.js";export{ti as auditBuildOutput,ei as auditConfig,ni as calculateAuditResult,ic as formatAuditResult,oc as runPwaAudit};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{la,ua}from"./chunk-77kpsnf6.js";import"./chunk-dxqwm8tr.js";import"./chunk-5j29466h.js";import"./chunk-7095f0hb.js";import"./chunk-wy53pys4.js";import"./chunk-z2xrwmjr.js";import"./chunk-kxjd6e2h.js";import"./chunk-aestp72s.js";import{Co}from"./chunk-bspryr4a.js";import"./chunk-vehtypx0.js";import"./chunk-td30jg06.js";import"./chunk-60wedefh.js";import"./chunk-r69jfs59.js";import"./chunk-m95zjk91.js";import"./chunk-g63ye3fe.js";import"./chunk-67tpacz0.js";import"./chunk-qh07a85k.js";import"./chunk-jsktg3ab.js";import"./chunk-t9t66sz4.js";import"./chunk-1jxdkp8x.js";import"./chunk-jpxekhdh.js";import"./chunk-efy3038a.js";import"./chunk-tfjcs55e.js";import"./chunk-z8fhtym2.js";import"./chunk-vw62fjpv.js";import"./chunk-4tj0ap61.js";import"./chunk-m9h7pmkh.js";import"./chunk-mvwcf4xy.js";import"./chunk-g04y5wyn.js";import"./chunk-xjxc4q3w.js";import"./chunk-79edpvb2.js";import"./chunk-c48mh4d6.js";import"./chunk-yzj55rfs.js";import"./chunk-cfpenvc7.js";import"./chunk-0cb00ys2.js";import"./chunk-c65q0svd.js";import"./chunk-s4pjf2pc.js";import{Se,yn,bn,J,u,n,pr,A,o,me}from"./chunk-3xwzd9wp.js";import"./chunk-dnqq1ze0.js";import"./chunk-wzjf33es.js";import"./chunk-6xsm53pz.js";import"./chunk-1dd4qefr.js";import"./chunk-bhf9yt2w.js";import"./chunk-td5100fz.js";import"./chunk-x8q5przn.js";import"./chunk-06wv8qwy.js";import"./chunk-bsy8v1xj.js";import"./chunk-sswjv8p9.js";import"./chunk-azpkje69.js";import"./chunk-rmv35cx0.js";export{pr as buildWebComponents,bn as cacheTemplate,yn as checkCache,Co as classifyAllScripts,la as createMiddleware,ua as createRoute,A as defaultConfig,u as extractVariables,J as injectRouterScript,o as loadStxConfig,Se as processClientScript,n as processDirectives,me as readMarkdownFile};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{tc}from"./chunk-efy3038a.js";export{tc as rewriteImagesWithSiblings};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{gd,Uc,Ee,Ri,md,Ps,Is,Os}from"./chunk-3xwzd9wp.js";import"./chunk-dnqq1ze0.js";import"./chunk-wzjf33es.js";import"./chunk-6xsm53pz.js";import"./chunk-1dd4qefr.js";import"./chunk-bhf9yt2w.js";import"./chunk-td5100fz.js";import"./chunk-x8q5przn.js";import"./chunk-06wv8qwy.js";import"./chunk-bsy8v1xj.js";import"./chunk-sswjv8p9.js";import"./chunk-azpkje69.js";import"./chunk-rmv35cx0.js";export{md as clearOnceStore,Ri as onceStore,Ee as partialsCache,Ps as processIncludes,Is as processStackPushDirectives,Os as processStackReplacements,gd as resetUnscopedSignalWarnings,Uc as topLevelElements};