@stacksjs/stx 0.2.573 → 0.2.574

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 (176) hide show
  1. package/dist/{chunk-a6jq7hex.js → chunk-06hx32h4.js} +3 -3
  2. package/dist/{chunk-zz7tw07b.js → chunk-0gt7e1ns.js} +1 -1
  3. package/dist/{chunk-15g5sc0p.js → chunk-0ppzstqj.js} +2 -2
  4. package/dist/{chunk-qcymqscj.js → chunk-0px2ab3m.js} +9 -9
  5. package/dist/chunk-0q5s55km.js +2 -0
  6. package/dist/{chunk-7t3ykgsm.js → chunk-1c8sdf9a.js} +3 -3
  7. package/dist/chunk-1m5pagp3.js +2 -0
  8. package/dist/{chunk-cf97xdqa.js → chunk-1n9bxdnh.js} +3 -3
  9. package/dist/{chunk-58tz7tmf.js → chunk-1swmxkdt.js} +2 -2
  10. package/dist/{chunk-4easd8da.js → chunk-1x2x3xgc.js} +4 -4
  11. package/dist/chunk-27ja2rpd.js +2 -0
  12. package/dist/chunk-2b0p7am3.js +2 -0
  13. package/dist/{chunk-qj4j547f.js → chunk-30acme5g.js} +2 -2
  14. package/dist/{chunk-74ew8ajw.js → chunk-32pxa1r0.js} +1 -1
  15. package/dist/{chunk-g66m3g2r.js → chunk-37d52q0d.js} +1 -1
  16. package/dist/{chunk-sfwprq8q.js → chunk-3dr757vb.js} +9 -9
  17. package/dist/chunk-3k6q1481.js +2 -0
  18. package/dist/{chunk-2z0trbbm.js → chunk-3kc7af8c.js} +2 -2
  19. package/dist/chunk-3pr388w5.js +2 -0
  20. package/dist/chunk-42h0kvng.js +2 -0
  21. package/dist/chunk-4eff1v2p.js +2 -0
  22. package/dist/{chunk-g8757f97.js → chunk-4k6cb5fg.js} +5 -5
  23. package/dist/{chunk-s12b57m9.js → chunk-4xvbc0mb.js} +2 -2
  24. package/dist/{chunk-824cnbac.js → chunk-501h1mer.js} +4 -4
  25. package/dist/{chunk-tv784gv0.js → chunk-550q827h.js} +2 -2
  26. package/dist/chunk-5n2v9g2c.js +2 -0
  27. package/dist/{chunk-q79kmad5.js → chunk-5xwmkxkk.js} +1 -1
  28. package/dist/chunk-68ygpbta.js +2 -0
  29. package/dist/{chunk-j9qy9t3t.js → chunk-69k5t6pj.js} +52 -52
  30. package/dist/{chunk-232jswfm.js → chunk-6c2y9h5h.js} +1 -1
  31. package/dist/chunk-6gjfres0.js +2 -0
  32. package/dist/chunk-6z57saf5.js +2 -0
  33. package/dist/chunk-71zwgxws.js +2 -0
  34. package/dist/{chunk-b9r88ysg.js → chunk-76437eb4.js} +2 -2
  35. package/dist/{chunk-beqkrwt1.js → chunk-7a0ewpz0.js} +2 -2
  36. package/dist/chunk-7debnvz9.js +2 -0
  37. package/dist/{chunk-t3dnak1j.js → chunk-7gxn7mvd.js} +2 -2
  38. package/dist/{chunk-vp31ff54.js → chunk-7hr63cp5.js} +2 -2
  39. package/dist/{chunk-5t1whxxt.js → chunk-825m59jr.js} +5 -5
  40. package/dist/{chunk-74xwzxwz.js → chunk-8efe5vpm.js} +2 -2
  41. package/dist/{chunk-78d6yyxz.js → chunk-8hp6722y.js} +5 -5
  42. package/dist/{chunk-kgj852hx.js → chunk-9yht5n7g.js} +2 -2
  43. package/dist/{chunk-a3gvw1q2.js → chunk-a3w3jc0t.js} +6 -6
  44. package/dist/chunk-a77gbp9x.js +2 -0
  45. package/dist/chunk-ampr3fpv.js +2 -0
  46. package/dist/{chunk-2ads8rw5.js → chunk-b10n7cpe.js} +2 -2
  47. package/dist/{chunk-0q6n3by0.js → chunk-bb5a8adb.js} +3 -3
  48. package/dist/chunk-bgbz0wzq.js +2 -0
  49. package/dist/chunk-bgr7fqhs.js +2 -0
  50. package/dist/chunk-bjfrwcfh.js +2 -0
  51. package/dist/{chunk-9k7bq97t.js → chunk-byhsfnkc.js} +1 -1
  52. package/dist/{chunk-zyk12484.js → chunk-c0ewddb3.js} +2 -2
  53. package/dist/{chunk-b2q8bk8p.js → chunk-c6jyp7ss.js} +2 -2
  54. package/dist/chunk-cdt5pg28.js +2 -0
  55. package/dist/chunk-cfh798k7.js +2 -0
  56. package/dist/{chunk-pnag11c4.js → chunk-cp5903cg.js} +2 -2
  57. package/dist/{chunk-ev8t5cxk.js → chunk-crj0yqc6.js} +1 -1
  58. package/dist/chunk-dax3zkmm.js +2 -0
  59. package/dist/chunk-dn676tdp.js +2 -0
  60. package/dist/chunk-dtbj816p.js +2 -0
  61. package/dist/chunk-e23cg45k.js +2 -0
  62. package/dist/{chunk-6tsnz28m.js → chunk-e27njk86.js} +12 -12
  63. package/dist/{chunk-58vrf6kh.js → chunk-e40qpeg5.js} +2 -2
  64. package/dist/{chunk-q83w8edy.js → chunk-e7pjsrfc.js} +2 -2
  65. package/dist/chunk-ecwpsjpd.js +2 -0
  66. package/dist/{chunk-amtrg7pn.js → chunk-f0mbj8w9.js} +1 -1
  67. package/dist/chunk-f1zyc84x.js +2 -0
  68. package/dist/{chunk-0s647d0b.js → chunk-g8dx2jew.js} +244 -241
  69. package/dist/{chunk-phzs239m.js → chunk-gdxhe7ae.js} +4 -4
  70. package/dist/{chunk-5dmkkvs7.js → chunk-gh0q6jrm.js} +2 -2
  71. package/dist/chunk-h8vk3q9n.js +2 -0
  72. package/dist/{chunk-k7ht6tqe.js → chunk-hq8vxds5.js} +2 -2
  73. package/dist/{chunk-zd01r00t.js → chunk-hqda3vcw.js} +1 -1
  74. package/dist/chunk-j8pamkbh.js +2 -0
  75. package/dist/{chunk-nj488tj2.js → chunk-jwe7yq8m.js} +5 -5
  76. package/dist/chunk-k5rrp1bt.js +2 -0
  77. package/dist/{chunk-yk3wh2xv.js → chunk-kcq2ed1d.js} +2 -2
  78. package/dist/{chunk-9yar9rfq.js → chunk-ktc1ecsm.js} +1 -1
  79. package/dist/chunk-mfm7ezh6.js +2 -0
  80. package/dist/chunk-mp16jxcg.js +2 -0
  81. package/dist/chunk-myhh1zsm.js +2 -0
  82. package/dist/chunk-n1c9j5qv.js +2 -0
  83. package/dist/{chunk-q9chv68c.js → chunk-n8hnrgen.js} +6 -6
  84. package/dist/{chunk-36agnyhe.js → chunk-nc0ba89b.js} +6 -6
  85. package/dist/chunk-nf63pk4s.js +2 -0
  86. package/dist/{chunk-1edvsndv.js → chunk-nxw03sy9.js} +2 -2
  87. package/dist/{chunk-jze68d0z.js → chunk-p3xkj7pm.js} +2 -2
  88. package/dist/chunk-p5cry5s7.js +2 -0
  89. package/dist/{chunk-0dz1b6a1.js → chunk-pxk0tpw2.js} +3 -3
  90. package/dist/chunk-qd4snptd.js +2 -0
  91. package/dist/{chunk-h4k3hyny.js → chunk-r5ce7mkg.js} +2 -2
  92. package/dist/chunk-r8qhex33.js +2 -0
  93. package/dist/chunk-rqvn1s52.js +2 -0
  94. package/dist/{chunk-kns5m52j.js → chunk-sej3ng5k.js} +5 -5
  95. package/dist/chunk-sjsant53.js +2 -0
  96. package/dist/chunk-snzh9z3g.js +3 -0
  97. package/dist/{chunk-sjcstv33.js → chunk-ss4h5ch3.js} +1 -1
  98. package/dist/{chunk-2crxkm7j.js → chunk-svvavwp2.js} +4 -4
  99. package/dist/{chunk-qt3x1sh3.js → chunk-t79xnvzr.js} +3 -3
  100. package/dist/{chunk-2hg2bqtj.js → chunk-ta50ym5j.js} +2 -2
  101. package/dist/chunk-ty8g61y9.js +2 -0
  102. package/dist/chunk-v1k6w4z5.js +2 -0
  103. package/dist/{chunk-rfnr4xz6.js → chunk-vde4mtfr.js} +2 -2
  104. package/dist/chunk-vm7zv0gc.js +2 -0
  105. package/dist/{chunk-4f0fh2a9.js → chunk-vnh550b5.js} +1 -1
  106. package/dist/chunk-vnxc48en.js +2 -0
  107. package/dist/chunk-y7vbwhh7.js +2 -0
  108. package/dist/{chunk-ydx3mfpp.js → chunk-yf90vn5t.js} +6 -6
  109. package/dist/{chunk-6wc2t6cd.js → chunk-yhqhv8mp.js} +13 -13
  110. package/dist/{chunk-fynh3bkq.js → chunk-ytf3qkaw.js} +3 -3
  111. package/dist/chunk-yvyypd92.js +2 -0
  112. package/dist/{chunk-c4zpzxex.js → chunk-z33z3rr4.js} +4 -4
  113. package/dist/chunk-zfw39q56.js +2 -0
  114. package/dist/chunk-zpm02e15.js +2 -0
  115. package/dist/chunk-zzr0p4bb.js +2 -0
  116. package/dist/cli.js +18 -18
  117. package/dist/client-parameter-bindings.d.ts +3 -5
  118. package/dist/client-parameter-bindings.js +30 -10
  119. package/dist/client-script.js +4 -7
  120. package/dist/craft-entry.js +2 -2
  121. package/dist/craft.js +2 -2
  122. package/dist/pwa.js +3 -3
  123. package/dist/ssg.js +4 -4
  124. package/dist/stx-virtual-ts.js +5 -4
  125. package/dist/utils.js +6 -2
  126. package/package.json +5 -5
  127. package/dist/chunk-0g2ybnht.js +0 -3
  128. package/dist/chunk-15erabm6.js +0 -2
  129. package/dist/chunk-1bsafdnt.js +0 -2
  130. package/dist/chunk-1btr5tme.js +0 -2
  131. package/dist/chunk-1z6c6dyk.js +0 -2
  132. package/dist/chunk-1zfg1kd5.js +0 -2
  133. package/dist/chunk-279jv0yf.js +0 -2
  134. package/dist/chunk-2g6wcnna.js +0 -2
  135. package/dist/chunk-557wtdps.js +0 -2
  136. package/dist/chunk-5fv4g4et.js +0 -2
  137. package/dist/chunk-604rs9sq.js +0 -2
  138. package/dist/chunk-636sfxyj.js +0 -2
  139. package/dist/chunk-6x8cwscv.js +0 -2
  140. package/dist/chunk-864xm0jy.js +0 -2
  141. package/dist/chunk-8k61b4ae.js +0 -2
  142. package/dist/chunk-9fbkdrm8.js +0 -2
  143. package/dist/chunk-asbq9cgs.js +0 -2
  144. package/dist/chunk-b5fpsp5n.js +0 -2
  145. package/dist/chunk-b7t8jejd.js +0 -2
  146. package/dist/chunk-b894fxfc.js +0 -2
  147. package/dist/chunk-bcjr3fw7.js +0 -2
  148. package/dist/chunk-bkj0j5se.js +0 -2
  149. package/dist/chunk-cr67dpx4.js +0 -2
  150. package/dist/chunk-d8206zbp.js +0 -2
  151. package/dist/chunk-dpqvacd1.js +0 -2
  152. package/dist/chunk-et8726at.js +0 -2
  153. package/dist/chunk-f10299sf.js +0 -2
  154. package/dist/chunk-g6zeqvvb.js +0 -2
  155. package/dist/chunk-hm4j4d8q.js +0 -2
  156. package/dist/chunk-jhc47xzj.js +0 -2
  157. package/dist/chunk-jw33eys8.js +0 -2
  158. package/dist/chunk-k6wgh598.js +0 -2
  159. package/dist/chunk-mjpewk4r.js +0 -2
  160. package/dist/chunk-nw4axkpx.js +0 -2
  161. package/dist/chunk-p5chk3s9.js +0 -2
  162. package/dist/chunk-qm280dp3.js +0 -2
  163. package/dist/chunk-t0zdz8kd.js +0 -2
  164. package/dist/chunk-t64nnmmj.js +0 -2
  165. package/dist/chunk-ts80ktq7.js +0 -2
  166. package/dist/chunk-tvb8p7c0.js +0 -2
  167. package/dist/chunk-tyhgq6rw.js +0 -2
  168. package/dist/chunk-vn7tc8hm.js +0 -2
  169. package/dist/chunk-vyg8bvkt.js +0 -2
  170. package/dist/chunk-xy6g8zb9.js +0 -2
  171. package/dist/chunk-ya7xks9t.js +0 -2
  172. package/dist/chunk-zgxj1q7w.js +0 -2
  173. package/dist/chunk-zpz6q2fh.js +0 -2
  174. package/dist/chunk-zs7qhh40.js +0 -2
  175. package/dist/chunk-zxt94g45.js +0 -2
  176. package/dist/chunk-zzcxacjf.js +0 -2
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Fe,gc,Ud,Vd,Wd,qd,mc,hc,Gd,Xd,ti,Kd,cn,ln,Gn}from"./chunk-g8dx2jew.js";import"./chunk-cp5903cg.js";import"./chunk-7hr63cp5.js";import"./chunk-550q827h.js";import"./chunk-ta50ym5j.js";import"./chunk-vde4mtfr.js";import"./chunk-nc0ba89b.js";import"./chunk-3dr757vb.js";import"./chunk-yf90vn5t.js";import"./chunk-4xvbc0mb.js";import"./chunk-hq8vxds5.js";import"./chunk-gdxhe7ae.js";import"./chunk-nxw03sy9.js";export{qd as __setSignalsGeneratorsForTest,Fe as cacheEngineFingerprint,ln as cacheTemplate,cn as checkCache,Kd as clearDevCaches,hc as getCachedRouterScript,mc as getCachedSignalsRuntime,Gd as getServeClientAsset,ti as getServeModuleBundle,Gn as hashFilePath,Vd as invalidateFileCache,Wd as invalidateFileCacheByDir,Ud as readFileCached,Xd as registerServeModuleBundle,gc as templateCache};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Jd,ni,Yd,ri,yc,bc,Tt,dn,Zd,wc,vc,Qd,f}from"./chunk-g8dx2jew.js";import"./chunk-cp5903cg.js";import"./chunk-7hr63cp5.js";import"./chunk-550q827h.js";import"./chunk-ta50ym5j.js";import"./chunk-vde4mtfr.js";import"./chunk-nc0ba89b.js";import"./chunk-3dr757vb.js";import"./chunk-yf90vn5t.js";import"./chunk-4xvbc0mb.js";import"./chunk-hq8vxds5.js";import"./chunk-gdxhe7ae.js";import"./chunk-nxw03sy9.js";export{Tt as buildCss,wc as extractClassNames,bc as fingerprintConfig,vc as generateCss,Zd as getCachedCSS,Jd as getCssServeAsset,f as injectCss,ni as loadCssEngine,ri as loadCssEngineConfig,dn as rebuildCss,Yd as resetCssCache,yc as resolveUserCssConfig,Qd as withLinkedModuleBundles};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Hn,je,Fe,be,si,Gn,te,J,dn,d,n,A}from"./chunk-0s647d0b.js";function h(o){return o.endsWith(".md")||o.endsWith(".markdown")}function _(o){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(s,p){let u;while((u=s.exec(o))!==null){let t=u.index,i=t+u[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return o;e.sort((s,p)=>s.start-p.start);let a="",c=0;for(let s of e){if(s.start<c)continue;a+=o.slice(c,s.start),a+=`@raw${o.slice(s.start,s.end)}@endraw`,c=s.end}return a+=o.slice(c),a}async function b(o,e={}){let{data:r,content:m}=Hn(o),c=await(e.renderer??((s)=>je(s)))(m);return{html:_(c),frontmatter:r??{}}}import{dirname as C,resolve as R}from"path";function k(o){let e=o,r=te(o);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,a=[],c=[],s=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),u;while((u=m.exec(o))!==null){let i=u[1],l=u[2],f=u[0],g=i.includes("server");if(p(l))s.push(f);else if(g)c.push(l);else a.push(f)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,f=[];while((l=i.exec(t))!==null){let g=l.index+l[0].length,x=t.indexOf("</script>",g);if(x===-1)continue;f.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let g=f.length-1;g>=0;g--)t=t.substring(0,f[g].start)+t.substring(f[g].end)}for(let i of a)t=t.replace(i,"");return{templateContent:t,serverScripts:c,clientScripts:a,signalsScripts:s}}function v(o,e){return`<!DOCTYPE html>
2
+ import{Vn,Be,be,we,si,Kn,te,J,pn,d,n,A}from"./chunk-g8dx2jew.js";function h(o){return o.endsWith(".md")||o.endsWith(".markdown")}function _(o){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(s,p){let u;while((u=s.exec(o))!==null){let t=u.index,i=t+u[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return o;e.sort((s,p)=>s.start-p.start);let a="",c=0;for(let s of e){if(s.start<c)continue;a+=o.slice(c,s.start),a+=`@raw${o.slice(s.start,s.end)}@endraw`,c=s.end}return a+=o.slice(c),a}async function b(o,e={}){let{data:r,content:m}=Vn(o),c=await(e.renderer??((s)=>Be(s)))(m);return{html:_(c),frontmatter:r??{}}}import{dirname as C,resolve as R}from"path";function k(o){let e=o,r=te(o);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,a=[],c=[],s=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),u;while((u=m.exec(o))!==null){let i=u[1],l=u[2],f=u[0],g=i.includes("server");if(p(l))s.push(f);else if(g)c.push(l);else a.push(f)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,f=[];while((l=i.exec(t))!==null){let g=l.index+l[0].length,x=t.indexOf("</script>",g);if(x===-1)continue;f.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let g=f.length-1;g>=0;g--)t=t.substring(0,f[g].start)+t.substring(f[g].end)}for(let i of a)t=t.replace(i,"");return{templateContent:t,serverScripts:c,clientScripts:a,signalsScripts:s}}function v(o,e){return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -9,10 +9,10 @@ import{Hn,je,Fe,be,si,Gn,te,J,dn,d,n,A}from"./chunk-0s647d0b.js";function h(o){r
9
9
  <body>
10
10
  ${o}
11
11
  </body>
12
- </html>`}async function jo(o,e={}){let r=R(o),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let a=await m.text(),c=null;if(h(r)){let s=await b(a,{renderer:e.markdownRenderer});a=s.html,c=s.frontmatter}if(c)e={...e,context:{...c,...e.context||{}}};if(e.layout){let s=R(e.layout),p=Bun.file(s);if(!await p.exists())throw Error(`Layout template not found: ${s}`);let{layout:u,injectCSS:t,...i}=e,l={...e.context||{}};dn(l);let f=await S(a,r,{...i,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),g=await p.text(),x={...l,content:f},w={...i,context:x,injectCSS:t};return S(g,s,w)}return S(a,r,e)}async function S(o,e,r={}){let{templateContent:m,serverScripts:a,clientScripts:c}=k(o),s={...A,...r.options},p={__filename:e,__dirname:C(e),__stx:{},__stx_options:s,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...Gn(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let i of a)await d(i,p,e);let u=new Set,t=m;if(t=await n(t,p,e,s,u),si(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),c.length>0)t+=`
12
+ </html>`}async function Bo(o,e={}){let r=R(o),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let a=await m.text(),c=null;if(h(r)){let s=await b(a,{renderer:e.markdownRenderer});a=s.html,c=s.frontmatter}if(c)e={...e,context:{...c,...e.context||{}}};if(e.layout){let s=R(e.layout),p=Bun.file(s);if(!await p.exists())throw Error(`Layout template not found: ${s}`);let{layout:u,injectCSS:t,...i}=e,l={...e.context||{}};pn(l);let f=await S(a,r,{...i,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),g=await p.text(),x={...l,content:f},w={...i,context:x,injectCSS:t};return S(g,s,w)}return S(a,r,e)}async function S(o,e,r={}){let{templateContent:m,serverScripts:a,clientScripts:c}=k(o),s={...A,...r.options},p={__filename:e,__dirname:C(e),__stx:{},__stx_options:s,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...Kn(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let i of a)await d(i,p,e);let u=new Set,t=m;if(t=await n(t,p,e,s,u),si(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),c.length>0)t+=`
13
13
  ${c.join(`
14
- `)}`}else{if(r.processClientScripts!==!1&&c.length>0){let i=p.__stx_event_bindings||[],l=Fe(p),g=(await Promise.all(c.map(async(w)=>{let y=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!y)return w;return await be(y[1],{eventBindings:i,templateContent:t,serverData:l,filePath:e})}))).join(`
14
+ `)}`}else{if(r.processClientScripts!==!1&&c.length>0){let i=p.__stx_event_bindings||[],l=be(p),g=(await Promise.all(c.map(async(w)=>{let y=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!y)return w;return await we(y[1],{eventBindings:i,templateContent:t,serverData:l,filePath:e})}))).join(`
15
15
  `);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${g}
16
16
  $1`);else t+=`
17
- ${g}`}t=await J(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=v(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-jhc47xzj.js");t=await i(t)}catch{}return t}
18
- export{jo};
17
+ ${g}`}t=await J(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=v(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-4eff1v2p.js");t=await i(t)}catch{}return t}
18
+ export{Bo};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
2
  function O(s){let o=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;s=s.replace(o,(e,t)=>`const { ${t.split(",").map((r)=>r.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
3
3
  `);let n=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return s=s.replace(n,(e,t)=>`const { ${t.split(",").map((r)=>r.trim()).filter(Boolean).join(", ")} } = window.__composables
4
- `),s}function Ot(s){return s.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}
5
- export{O,Ot};
4
+ `),s}function Dt(s){return s.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}
5
+ export{O,Dt};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{b,d,n,g,A}from"./chunk-0s647d0b.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,s;M.lastIndex=0;while((s=M.exec(e))!==null){if(s.index>o){let a=e.slice(o,s.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let r=s[1],i=s[2];t.push({type:"suspense",name:r,content:i}),o=s.index+s[0].length}if(o<e.length){let r=e.slice(o);if(r.trim())t.push({type:t.length===0?"shell":"content",content:r})}if(t.length===0)t.push({type:"shell",content:e});return t}async function yd(e,t={},o={}){let s={...A,...o,streaming:{...q,...o.streaming}},r=s.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),m=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(m.trim())await d(m,y,e);let E=H(c),u=new Set;if(!E.some((h)=>h.type==="suspense")){let h=s.streaming?.strategy||"auto",S=new RegExp(T.source,"g");if(!(h!=="manual"&&S.test(c))){let p=await n(c,y,e,s,u);for(let x=0;x<p.length;x+=r)i.enqueue(p.slice(x,x+r)),await new Promise((f)=>setTimeout(f,0))}else{let p=[],x=new RegExp(T.source,"g"),f;while((f=x.exec(c))!==null)p.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of p){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await n(I,y,e,s,u);i.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await n(_.content,y,e,s,u);i.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await n(_,y,e,s,u);i.enqueue(C)}}}}else{let h=new Map;for(let l of E)if(l.type==="shell"||l.type==="content"){let p=await n(l.content,y,e,s,u);i.enqueue(p)}else if(l.type==="suspense"&&l.name){let p=`stx-suspense-${l.name}`;i.enqueue(`<div id="${p}" data-suspense="${l.name}" style="display:contents;">
2
+ import{b,d,n,g,A}from"./chunk-g8dx2jew.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,s;M.lastIndex=0;while((s=M.exec(e))!==null){if(s.index>o){let a=e.slice(o,s.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let r=s[1],i=s[2];t.push({type:"suspense",name:r,content:i}),o=s.index+s[0].length}if(o<e.length){let r=e.slice(o);if(r.trim())t.push({type:t.length===0?"shell":"content",content:r})}if(t.length===0)t.push({type:"shell",content:e});return t}async function yd(e,t={},o={}){let s={...A,...o,streaming:{...q,...o.streaming}},r=s.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),m=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(m.trim())await d(m,y,e);let E=H(c),u=new Set;if(!E.some((h)=>h.type==="suspense")){let h=s.streaming?.strategy||"auto",S=new RegExp(T.source,"g");if(!(h!=="manual"&&S.test(c))){let p=await n(c,y,e,s,u);for(let x=0;x<p.length;x+=r)i.enqueue(p.slice(x,x+r)),await new Promise((f)=>setTimeout(f,0))}else{let p=[],x=new RegExp(T.source,"g"),f;while((f=x.exec(c))!==null)p.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of p){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await n(I,y,e,s,u);i.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await n(_.content,y,e,s,u);i.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await n(_,y,e,s,u);i.enqueue(C)}}}}else{let h=new Map;for(let l of E)if(l.type==="shell"||l.type==="content"){let p=await n(l.content,y,e,s,u);i.enqueue(p)}else if(l.type==="suspense"&&l.name){let p=`stx-suspense-${l.name}`;i.enqueue(`<div id="${p}" data-suspense="${l.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),h.set(l.name,n(l.content,y,e,s,u))}i.enqueue(`
5
5
  <script>
@@ -17,7 +17,7 @@ import{b,d,n,g,A}from"./chunk-0s647d0b.js";import k from"path";var q={enabled:!0
17
17
  }
18
18
  };
19
19
  })();
20
- </script>`);let S=Array.from(h.entries()).map(async([l,p])=>{i.enqueue(await $o(l,p))});await Promise.all(S)}i.close()}catch(a){i.error(a)}}})}async function $o(e,t){try{let s=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
20
+ </script>`);let S=Array.from(h.entries()).map(async([l,p])=>{i.enqueue(await Ro(l,p))});await Promise.all(S)}i.close()}catch(a){i.error(a)}}})}async function Ro(e,t){try{let s=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
21
21
  <script>
22
22
  window.__stxSuspense.resolve('${e}', \`${s}\`);
23
23
  </script>`}catch(o){let s=o instanceof Error?o.message:String(o);return`
@@ -43,7 +43,7 @@ window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading conte
43
43
  }
44
44
  };
45
45
  })();
46
- </script>`;function z(e,t,o){if(!t||t<=0)return e;let s,r=new Promise((i,a)=>{s=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,r]).finally(()=>clearTimeout(s))}function bd(e,t=[],o={}){let s=o.timeoutMs??0;return new ReadableStream({async start(r){try{if(r.enqueue(e),t.length>0)r.enqueue(qa),await Promise.all(t.map(async(i)=>{let a=z(i.render(),s,i.id);r.enqueue(await $o(i.id,a))}));r.close()}catch(i){r.error(i)}}})}var B=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function wd(e,t){return e.replace(B,(o,s,r)=>{let i=s.trim(),a=r.split(/@fallback/i),w=a[0].trim(),m=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[i]=w,`<div data-suspense="${i}">${m}</div>`})}function vd(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,s])=>typeof s==="function");return o.length>0?o.map(([s,r])=>({id:s,render:r})):void 0}async function xd(e,t={},o={}){let s={...A,...o,streaming:{...q,...o.streaming}},r=s.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),m=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(m.trim())await d(m,y,e);let E=new Set,u=s.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(u!=="manual"&&R.test(c))){let S=await n(c,y,e,s,E);for(let l=0;l<S.length;l+=r)i.enqueue(S.slice(l,l+r))}else{let S=[],l=new RegExp(T.source,"g"),p;while((p=l.exec(c))!==null)S.push({name:p[1],content:p[2],start:p.index,end:p.index+p[0].length});let x=0;for(let f of S){if(f.start>x){let _=c.slice(x,f.start);if(_.trim()){let C=await n(_,y,e,s,E);i.enqueue(C)}}let v=await n(f.content,y,e,s,E);i.enqueue(v),x=f.end}if(x<c.length){let f=c.slice(x);if(f.trim()){let v=await n(f,y,e,s,E);i.enqueue(v)}}}i.close()}catch(a){i.error(a)}}})}async function Sd(e,t={}){let o={...A,...t,streaming:{...q,...t.streaming}},s=await Bun.file(e).text(),r=s.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),i=r?r[1]:"",a=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=a,m={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let u=c[1],R=c[2];m[u]=R}let y=a.replace(T,"");return{renderShell:async(u={})=>{let R={...u,__filename:e,__dirname:k.dirname(e)};return await d(i,R,e),n(y,R,e,o,new Set)},renderSection:async(u,R={})=>{try{if(!m[u])return`<div class="error-message">Section "${b(u)}" not found in template "${b(e)}"</div>`;let h={...R,__filename:e,__dirname:k.dirname(e)};await d(i,h,e);let S=new Set;return await n(m[u],h,e,o,S)}catch(h){let S=h instanceof Error?h.message:String(h);return g("Expression",S,e,m[u]||"",0,m[u]||"")}},getSections:()=>Object.keys(m),getTemplate:()=>w}}var Ga={name:"suspense",hasEndTag:!0,handler:(e,t,o,s)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let r=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${r} -->${e}<!-- @endsuspense:${r} -->`}},Xa={name:"island",hasEndTag:!0,handler:(e,t,o,s)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let r=t[0].replace(/['"`]/g,""),i=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${r}-${Math.random().toString(36).substring(2,9)}`,w=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),m=w?w[1].trim():"",c=w?e.replace(w[0],""):e;return`<div data-island="${r}" data-island-id="${a}" data-priority="${i}">
46
+ </script>`;function z(e,t,o){if(!t||t<=0)return e;let s,r=new Promise((i,a)=>{s=setTimeout(()=>a(Error(`streaming boundary "${o}" timed out after ${t}ms`)),t)});return Promise.race([e,r]).finally(()=>clearTimeout(s))}function bd(e,t=[],o={}){let s=o.timeoutMs??0;return new ReadableStream({async start(r){try{if(r.enqueue(e),t.length>0)r.enqueue(qa),await Promise.all(t.map(async(i)=>{let a=z(i.render(),s,i.id);r.enqueue(await Ro(i.id,a))}));r.close()}catch(i){r.error(i)}}})}var B=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function wd(e,t){return e.replace(B,(o,s,r)=>{let i=s.trim(),a=r.split(/@fallback/i),w=a[0].trim(),m=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[i]=w,`<div data-suspense="${i}">${m}</div>`})}function vd(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let o=Object.entries(t).filter(([,s])=>typeof s==="function");return o.length>0?o.map(([s,r])=>({id:s,render:r})):void 0}async function xd(e,t={},o={}){let s={...A,...o,streaming:{...q,...o.streaming}},r=s.streaming?.bufferSize||16384;return new ReadableStream({async start(i){try{let a=await Bun.file(e).text(),w=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),m=w?w[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(m.trim())await d(m,y,e);let E=new Set,u=s.streaming?.strategy||"auto",R=new RegExp(T.source,"g");if(!(u!=="manual"&&R.test(c))){let S=await n(c,y,e,s,E);for(let l=0;l<S.length;l+=r)i.enqueue(S.slice(l,l+r))}else{let S=[],l=new RegExp(T.source,"g"),p;while((p=l.exec(c))!==null)S.push({name:p[1],content:p[2],start:p.index,end:p.index+p[0].length});let x=0;for(let f of S){if(f.start>x){let _=c.slice(x,f.start);if(_.trim()){let C=await n(_,y,e,s,E);i.enqueue(C)}}let v=await n(f.content,y,e,s,E);i.enqueue(v),x=f.end}if(x<c.length){let f=c.slice(x);if(f.trim()){let v=await n(f,y,e,s,E);i.enqueue(v)}}}i.close()}catch(a){i.error(a)}}})}async function Sd(e,t={}){let o={...A,...t,streaming:{...q,...t.streaming}},s=await Bun.file(e).text(),r=s.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),i=r?r[1]:"",a=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=a,m={},c;T.lastIndex=0;while((c=T.exec(a))!==null){let u=c[1],R=c[2];m[u]=R}let y=a.replace(T,"");return{renderShell:async(u={})=>{let R={...u,__filename:e,__dirname:k.dirname(e)};return await d(i,R,e),n(y,R,e,o,new Set)},renderSection:async(u,R={})=>{try{if(!m[u])return`<div class="error-message">Section "${b(u)}" not found in template "${b(e)}"</div>`;let h={...R,__filename:e,__dirname:k.dirname(e)};await d(i,h,e);let S=new Set;return await n(m[u],h,e,o,S)}catch(h){let S=h instanceof Error?h.message:String(h);return g("Expression",S,e,m[u]||"",0,m[u]||"")}},getSections:()=>Object.keys(m),getTemplate:()=>w}}var Ga={name:"suspense",hasEndTag:!0,handler:(e,t,o,s)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let r=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${r} -->${e}<!-- @endsuspense:${r} -->`}},Xa={name:"island",hasEndTag:!0,handler:(e,t,o,s)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let r=t[0].replace(/['"`]/g,""),i=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${r}-${Math.random().toString(36).substring(2,9)}`,w=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),m=w?w[1].trim():"",c=w?e.replace(w[0],""):e;return`<div data-island="${r}" data-island-id="${a}" data-priority="${i}">
47
47
  ${c}
48
48
  <script type="application/json" data-island-props="${a}">
49
49
  ${m?`{${m}}`:"{}"}
@@ -191,4 +191,4 @@ else {
191
191
  stx.hydrate();
192
192
  }
193
193
  })();`}
194
- export{yd,$o,qa,bd,wd,vd,xd,Sd,Ga,Xa,kd,Cd,_d,Ed};
194
+ export{yd,Ro,qa,bd,wd,vd,xd,Sd,Ga,Xa,kd,Cd,_d,Ed};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
2
  import c from"fs";import i from"path";import{createHash as k}from"crypto";var j=["pages","components","layouts","partials","composables"],w=new Set;function Ri(e){try{return w.has(c.realpathSync(e))}catch{return w.has(i.resolve(e))}}var _=new Set(["extends","root",...j.map((e)=>`${e}Dir`),"publicDir","stateDir","cachePath"]),x=(e)=>e!==null&&typeof e==="object"&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null);function b(e,n,r=""){if(Array.isArray(n))return["middleware","plugins"].includes(r)?[...Array.isArray(e)?e:[],...n]:[...n];if(!x(n))return n;let o={...x(e)?e:{}};for(let[s,a]of Object.entries(n)){if(["__proto__","constructor","prototype"].includes(s))throw Error(`Invalid layer config key: ${s}`);o[s]=b(o[s],a,s)}return o}function v(e){for(let n of["stx.config.ts","stx.config.js","stx.config.mjs",".config/stx.config.ts",".config/stx.ts","ui.config.ts"]){let r=i.join(e,n);if(c.existsSync(r))return c.realpathSync(r)}throw Error(`Application layer has no stx.config.ts: ${e}`)}function E(e,n,r){if(typeof e!=="string"||!e||/^(?:https?:|git[+:])/.test(e))throw Error(`Invalid application layer ${JSON.stringify(e)} in ${n}; use a local path or installed package`);if(e.startsWith(".")||i.isAbsolute(e)){let s=i.resolve(n,e);return c.statSync(s).isDirectory()?v(s):c.realpathSync(s)}let o=n;while(!0){let s=i.join(o,"node_modules",e),a=i.join(s,"package.json");if(c.existsSync(a)){r.add(c.realpathSync(a));let g=JSON.parse(c.readFileSync(a,"utf8"));return g.stx?.layer?c.realpathSync(i.resolve(s,g.stx.layer)):v(s)}let p=i.dirname(o);if(p===o)break;o=p}throw Error(`Cannot resolve application layer ${JSON.stringify(e)} from ${n}`)}async function C(e,n){let r=await Bun.build({entrypoints:[e],target:"bun",format:"esm",splitting:!1,plugins:[{name:"stx-layer-config",setup(a){a.onResolve({filter:/^[^./]/},(p)=>{if(p.path.startsWith("node:"))return{path:p.path,external:!0};return{path:Bun.resolveSync(p.path,p.resolveDir),external:!0}}),a.onLoad({filter:/./},(p)=>{let g=c.realpathSync(p.path);n.add(g),w.add(g);return})}}]});if(!r.success)throw Error(`Cannot load layer ${e}: ${r.logs.join(`
3
- `)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function Ai(e,n){let r=new Set,o=[],s=[],a=new Set,p=[];async function g(t,l){if(t=c.realpathSync(t),p.includes(t))throw Error(`Application layer cycle: ${[...p,t].join(" -> ")}`);if(a.has(t))return;a.add(t),p.push(t);let d=await C(t,r);l??=i.basename(i.dirname(t))===".config"?i.dirname(i.dirname(t)):i.dirname(t),l=c.realpathSync(l);let D=i.resolve(l,d.root??"."),L=Object.fromEntries(j.map((y)=>[y,i.resolve(D,d[`${y}Dir`]??(y==="composables"?"functions":y))]));o.push({root:l,configFile:t,resources:L});let u={...d};if(u.plugins)u.plugins=u.plugins.map((y)=>{let h=typeof y==="string"?y:y[0],S=h.startsWith(".")?i.resolve(l,h):i.isAbsolute(h)?h:Bun.resolveSync(h,l);return r.add(c.realpathSync(S)),typeof y==="string"?S:[S,y[1]]});if(typeof u.css==="string")u.css=i.resolve(l,u.css);if(u.serverApi)u.serverApi={...typeof u.serverApi==="object"?u.serverApi:{},dir:i.resolve(l,typeof u.serverApi==="object"?u.serverApi.dir??"server/api":"server/api")};if(s.push(u),d.extends!==void 0&&!Array.isArray(d.extends))throw Error(`extends in ${t} must be an array`);for(let y of d.extends??[])await g(E(y,l,r));p.pop()}await g(v(e),e);for(let t of["package.json","bun.lock","package-lock.json","pnpm-lock.yaml"]){let l=i.join(e,t);if(c.existsSync(l))r.add(c.realpathSync(l))}let f=b({},n);for(let t=s.length-1;t>=0;t--){let l=t===0?s[t]:Object.fromEntries(Object.entries(s[t]).filter(([d])=>!_.has(d)));f=b(f,l)}let m={layers:o,configDependencies:[...r].sort()};return f._layerGraph=m,f._layerPageDirs=o.map((t)=>t.resources.pages),f._layerComponentDirs=o.map((t)=>t.resources.components),f._layerLayoutDirs=o.map((t)=>t.resources.layouts),f._layerPartialDirs=o.map((t)=>t.resources.partials),f._layerComposableDirs=o.map((t)=>t.resources.composables),await Rs(m,e),{config:f,graph:m}}async function Rs(e,n){let r=new Map,o=[];for(let s of e.layers)for(let[a,p]of Object.entries(s.resources)){if(!c.existsSync(p))continue;let g=new Bun.Glob(a==="composables"?"**/*.ts":"**/*.stx");for(let f of[...g.scanSync({cwd:p})].sort()){let m=`${a}/${f}`,t=i.join(p,f),l=r.get(m);if(l)o.push({resource:m,winner:l,shadowed:t});else r.set(m,t)}}Object.assign(e,{overrides:o}),await Bun.write(i.join(n,".stx/layers.json"),JSON.stringify(e,null,2))}function A(e){let n=new Set(e.configDependencies);function r(o){if(!c.existsSync(o))return;n.add(o);for(let s of c.readdirSync(o,{withFileTypes:!0}).sort((a,p)=>a.name.localeCompare(p.name))){if(s.name.startsWith(".")||s.name==="node_modules")continue;let a=i.join(o,s.name);if(s.isDirectory())r(a);else if(s.isFile())n.add(a)}}for(let o of e.layers)for(let s of Object.values(o.resources))r(s);return[...n].sort()}function tr(e){return O(A(e))}function nr(e){return O(e.configDependencies)}function O(e){return e.map((n)=>{try{let r=c.statSync(n);return`${n}:${r.mtimeMs}:${r.size}`}catch{return`${n}:missing`}}).join(`
3
+ `)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function Ai(e,n){let r=new Set,o=[],s=[],a=new Set,p=[];async function g(t,l){if(t=c.realpathSync(t),p.includes(t))throw Error(`Application layer cycle: ${[...p,t].join(" -> ")}`);if(a.has(t))return;a.add(t),p.push(t);let d=await C(t,r);l??=i.basename(i.dirname(t))===".config"?i.dirname(i.dirname(t)):i.dirname(t),l=c.realpathSync(l);let D=i.resolve(l,d.root??"."),L=Object.fromEntries(j.map((y)=>[y,i.resolve(D,d[`${y}Dir`]??(y==="composables"?"functions":y))]));o.push({root:l,configFile:t,resources:L});let u={...d};if(u.plugins)u.plugins=u.plugins.map((y)=>{let h=typeof y==="string"?y:y[0],S=h.startsWith(".")?i.resolve(l,h):i.isAbsolute(h)?h:Bun.resolveSync(h,l);return r.add(c.realpathSync(S)),typeof y==="string"?S:[S,y[1]]});if(typeof u.css==="string")u.css=i.resolve(l,u.css);if(u.serverApi)u.serverApi={...typeof u.serverApi==="object"?u.serverApi:{},dir:i.resolve(l,typeof u.serverApi==="object"?u.serverApi.dir??"server/api":"server/api")};if(s.push(u),d.extends!==void 0&&!Array.isArray(d.extends))throw Error(`extends in ${t} must be an array`);for(let y of d.extends??[])await g(E(y,l,r));p.pop()}await g(v(e),e);for(let t of["package.json","bun.lock","package-lock.json","pnpm-lock.yaml"]){let l=i.join(e,t);if(c.existsSync(l))r.add(c.realpathSync(l))}let f=b({},n);for(let t=s.length-1;t>=0;t--){let l=t===0?s[t]:Object.fromEntries(Object.entries(s[t]).filter(([d])=>!_.has(d)));f=b(f,l)}let m={layers:o,configDependencies:[...r].sort()};return f._layerGraph=m,f._layerPageDirs=o.map((t)=>t.resources.pages),f._layerComponentDirs=o.map((t)=>t.resources.components),f._layerLayoutDirs=o.map((t)=>t.resources.layouts),f._layerPartialDirs=o.map((t)=>t.resources.partials),f._layerComposableDirs=o.map((t)=>t.resources.composables),await As(m,e),{config:f,graph:m}}async function As(e,n){let r=new Map,o=[];for(let s of e.layers)for(let[a,p]of Object.entries(s.resources)){if(!c.existsSync(p))continue;let g=new Bun.Glob(a==="composables"?"**/*.ts":"**/*.stx");for(let f of[...g.scanSync({cwd:p})].sort()){let m=`${a}/${f}`,t=i.join(p,f),l=r.get(m);if(l)o.push({resource:m,winner:l,shadowed:t});else r.set(m,t)}}Object.assign(e,{overrides:o}),await Bun.write(i.join(n,".stx/layers.json"),JSON.stringify(e,null,2))}function A(e){let n=new Set(e.configDependencies);function r(o){if(!c.existsSync(o))return;n.add(o);for(let s of c.readdirSync(o,{withFileTypes:!0}).sort((a,p)=>a.name.localeCompare(p.name))){if(s.name.startsWith(".")||s.name==="node_modules")continue;let a=i.join(o,s.name);if(s.isDirectory())r(a);else if(s.isFile())n.add(a)}}for(let o of e.layers)for(let s of Object.values(o.resources))r(s);return[...n].sort()}function rr(e){return O(A(e))}function sr(e){return O(e.configDependencies)}function O(e){return e.map((n)=>{try{let r=c.statSync(n);return`${n}:${r.mtimeMs}:${r.size}`}catch{return`${n}:missing`}}).join(`
4
4
  `)}function Pi(e){return e.layers.map((n)=>({config:i.relative(n.root,n.configFile),files:A({layers:[n],configDependencies:e.configDependencies.filter((r)=>r.startsWith(`${n.root}${i.sep}`))}).filter((r)=>c.statSync(r).isFile()).map((r)=>({path:i.relative(n.root,r).replaceAll(i.sep,"/"),sha256:k("sha256").update(c.readFileSync(r)).digest("hex")}))}))}
5
- export{Ri,Ai,Rs,tr,nr,Pi};
5
+ export{Ri,Ai,As,rr,sr,Pi};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{sn,le}from"./chunk-3kc7af8c.js";export{sn as describeBuildFailure,le as formatBuildFailure};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$e,Re,Ae}from"./chunk-qj4j547f.js";import{lt,dt,Te,Ys,ut,pt}from"./chunk-beqkrwt1.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();lt();let t=await $e({mode:"build"});if(!t.config.enabled){Te("Story feature is disabled in config.");return}let n=await ut(t);Re(t,n);let l=pt(t.config,n);Ae(t,l),dt(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;Ys(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
2
+ import{Re,Ae,Pe}from"./chunk-30acme5g.js";import{lt,dt,$e,Zs,ut,pt}from"./chunk-7a0ewpz0.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();lt();let t=await Re({mode:"build"});if(!t.config.enabled){$e("Story feature is disabled in config.");return}let n=await ut(t);Ae(t,n);let l=pt(t.config,n);Pe(t,l),dt(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;Zs(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Kr,Lo,jo,Dd}from"./chunk-bb5a8adb.js";export{Kr as NATIVE_COMPONENTS,Lo as compileToNative,jo as createHotReloadServer,Dd as default};