@stacksjs/stx 0.2.464 → 0.2.465

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 (116) hide show
  1. package/dist/chunk-0880qx3m.js +2 -0
  2. package/dist/{chunk-krsdcjxk.js → chunk-0avd5kkb.js} +20 -20
  3. package/dist/chunk-0zf49qxk.js +2 -0
  4. package/dist/{chunk-sprx02g0.js → chunk-1bazr47z.js} +1 -1
  5. package/dist/{chunk-2tn3dkcy.js → chunk-1byqqwgm.js} +2 -2
  6. package/dist/chunk-1tsz7v68.js +2 -0
  7. package/dist/{chunk-bp53x03f.js → chunk-27k24mk0.js} +1 -1
  8. package/dist/{chunk-jmhhv817.js → chunk-2e4pegf1.js} +1 -1
  9. package/dist/chunk-2mv3wh0s.js +2 -0
  10. package/dist/{chunk-3ar8gdyd.js → chunk-2nvnd83c.js} +1 -1
  11. package/dist/{chunk-rgwvqmhh.js → chunk-32kk8y2r.js} +1 -1
  12. package/dist/{chunk-skjwh35r.js → chunk-3q3174cn.js} +2 -2
  13. package/dist/{chunk-nwwzf7h1.js → chunk-4acykd9n.js} +1 -1
  14. package/dist/chunk-4wjef6d8.js +18 -0
  15. package/dist/{chunk-raqqq3mm.js → chunk-4xcypfmg.js} +1 -1
  16. package/dist/{chunk-cfk3skk4.js → chunk-5e6p2ndj.js} +1 -1
  17. package/dist/{chunk-wvxj6r2a.js → chunk-5mmqe3hj.js} +1 -1
  18. package/dist/{chunk-5yn0gpcj.js → chunk-5zaj400e.js} +10 -10
  19. package/dist/{chunk-d9360m89.js → chunk-6bwe6vsc.js} +1 -1
  20. package/dist/chunk-6ry01675.js +2 -0
  21. package/dist/{chunk-a35c060g.js → chunk-769t2y70.js} +1 -1
  22. package/dist/{chunk-k9sbgax8.js → chunk-7knc20mz.js} +1 -1
  23. package/dist/{chunk-tsg7bj9p.js → chunk-7xckcy9x.js} +1 -1
  24. package/dist/chunk-97ezbs97.js +2 -0
  25. package/dist/chunk-99qf5fff.js +2 -0
  26. package/dist/{chunk-z80d9dd2.js → chunk-9g339c7b.js} +2 -2
  27. package/dist/chunk-a201b6rx.js +2 -0
  28. package/dist/{chunk-r5gyx7ch.js → chunk-abb9xmdg.js} +1 -1
  29. package/dist/{chunk-dqdggvq4.js → chunk-ag1v2tkm.js} +2101 -2101
  30. package/dist/chunk-aqdkct70.js +2 -0
  31. package/dist/{chunk-627af18j.js → chunk-azcvytqc.js} +1 -1
  32. package/dist/chunk-bb7p822h.js +2 -0
  33. package/dist/chunk-bj31r6sj.js +2 -0
  34. package/dist/chunk-c1gp4xjy.js +2 -0
  35. package/dist/chunk-c8z3fghp.js +2 -0
  36. package/dist/{chunk-y9j2kf3k.js → chunk-cstvhr0r.js} +1297 -1297
  37. package/dist/{chunk-xbm2gcb6.js → chunk-en3e0y6m.js} +1 -1
  38. package/dist/chunk-esc6fahf.js +2 -0
  39. package/dist/chunk-f2rh0zhs.js +2 -0
  40. package/dist/{chunk-39q77svv.js → chunk-gasb5fhy.js} +2 -2
  41. package/dist/{chunk-y36av1ac.js → chunk-gj90pnre.js} +7 -7
  42. package/dist/{chunk-d2zw2e5m.js → chunk-gjrbnzap.js} +3 -3
  43. package/dist/{chunk-8efg91ak.js → chunk-gm6g6gar.js} +2 -2
  44. package/dist/chunk-h5k0c1jp.js +2 -0
  45. package/dist/chunk-hqfgbtsy.js +30 -0
  46. package/dist/chunk-j2pdtq0d.js +2 -0
  47. package/dist/{chunk-ptek61ts.js → chunk-j9y50qt9.js} +1 -1
  48. package/dist/{chunk-ng61wjke.js → chunk-jbdqs7t6.js} +1 -1
  49. package/dist/chunk-kewh1a68.js +2 -0
  50. package/dist/{chunk-t61vdbje.js → chunk-ktvr45qg.js} +6 -6
  51. package/dist/chunk-kvfcm30m.js +2 -0
  52. package/dist/{chunk-1sdtg9np.js → chunk-n003eq8w.js} +2 -2
  53. package/dist/{chunk-etjw0he9.js → chunk-n6p2at6g.js} +1 -1
  54. package/dist/chunk-nahzfs7d.js +2 -0
  55. package/dist/{chunk-hhsynd7c.js → chunk-nmk9en1n.js} +6 -6
  56. package/dist/{chunk-qr15ksz9.js → chunk-nmnbdtsq.js} +6 -6
  57. package/dist/{chunk-v83bpj84.js → chunk-p7j2g8y2.js} +4 -4
  58. package/dist/{chunk-ynvce0q6.js → chunk-pfm6cfph.js} +2 -2
  59. package/dist/{chunk-tesmv3m9.js → chunk-pxmbee61.js} +5 -5
  60. package/dist/{chunk-02e24cym.js → chunk-qc7zybaa.js} +1 -1
  61. package/dist/chunk-s1075erh.js +2 -0
  62. package/dist/chunk-s2fpethy.js +2 -0
  63. package/dist/{chunk-544e2jvd.js → chunk-se9qddyx.js} +4 -4
  64. package/dist/{chunk-0v5dpk7r.js → chunk-sgbgwezf.js} +1 -1
  65. package/dist/chunk-tps20cx5.js +2 -0
  66. package/dist/chunk-ts3jftxq.js +2 -0
  67. package/dist/{chunk-z990jtmx.js → chunk-vvb3wq2p.js} +1 -1
  68. package/dist/chunk-wfmy7a0b.js +2 -0
  69. package/dist/{chunk-e15a8txv.js → chunk-x9a5a282.js} +2 -2
  70. package/dist/{chunk-nkxa7men.js → chunk-xsdj6k6c.js} +1 -1
  71. package/dist/{chunk-ccy6avqe.js → chunk-xt4990k8.js} +1 -1
  72. package/dist/{chunk-74j18qk0.js → chunk-y8h823cb.js} +28 -28
  73. package/dist/{chunk-2cqymwe8.js → chunk-yc4hf2ea.js} +2 -2
  74. package/dist/chunk-yn2d8x8m.js +3 -0
  75. package/dist/{chunk-eegxyqk3.js → chunk-ysptfks9.js} +1 -1
  76. package/dist/chunk-z14y48en.js +17 -0
  77. package/dist/cli.js +43 -43
  78. package/dist/client-script-bundler.d.ts +10 -0
  79. package/dist/client-script-bundler.js +9 -3
  80. package/dist/composable-loader.js +5 -2
  81. package/dist/craft-entry.js +2 -2
  82. package/dist/craft.js +2 -2
  83. package/dist/database.js +2 -2
  84. package/dist/native/runtime/native-host.js +1 -1
  85. package/dist/pwa.js +3 -3
  86. package/dist/ssg.js +2 -2
  87. package/package.json +5 -5
  88. package/dist/chunk-0fvz8wad.js +0 -2
  89. package/dist/chunk-0yba08sr.js +0 -2
  90. package/dist/chunk-1p5ge6fq.js +0 -2
  91. package/dist/chunk-4yjtwjrw.js +0 -2
  92. package/dist/chunk-7fjatz47.js +0 -2
  93. package/dist/chunk-7j1cpa9d.js +0 -2
  94. package/dist/chunk-938g2a3d.js +0 -2
  95. package/dist/chunk-ajqwjevt.js +0 -2
  96. package/dist/chunk-cg8hg6cs.js +0 -3
  97. package/dist/chunk-d1x5r4p6.js +0 -2
  98. package/dist/chunk-dcv6absa.js +0 -2
  99. package/dist/chunk-jr3g08vs.js +0 -2
  100. package/dist/chunk-kdk0jy1h.js +0 -17
  101. package/dist/chunk-kmb9qrdg.js +0 -2
  102. package/dist/chunk-mfxf378k.js +0 -18
  103. package/dist/chunk-mxt11ejx.js +0 -2
  104. package/dist/chunk-mxtah7y5.js +0 -2
  105. package/dist/chunk-q316y302.js +0 -2
  106. package/dist/chunk-qyq7j8hp.js +0 -2
  107. package/dist/chunk-raeyd6e5.js +0 -2
  108. package/dist/chunk-rjm3n62n.js +0 -2
  109. package/dist/chunk-tkakxkbx.js +0 -2
  110. package/dist/chunk-txkfp4v5.js +0 -2
  111. package/dist/chunk-tzjqtweb.js +0 -2
  112. package/dist/chunk-vhdemrec.js +0 -2
  113. package/dist/chunk-xek78ez1.js +0 -2
  114. package/dist/chunk-xjb0yzvq.js +0 -2
  115. package/dist/chunk-y8mx0hab.js +0 -30
  116. package/dist/chunk-zhexga43.js +0 -2
@@ -0,0 +1,18 @@
1
+ // @bun
2
+ import{In,Oe,Ne,me,Wo,Ln,Z,K,rn,u,n,I}from"./chunk-ag1v2tkm.js";function h(o){return o.endsWith(".md")||o.endsWith(".markdown")}function _(o){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(s,p){let m;while((m=s.exec(o))!==null){let t=m.index,i=t+m[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:g}=In(o),c=await(e.renderer??((s)=>Oe(s)))(g);return{html:_(c),frontmatter:r??{}}}import{dirname as C,resolve as R}from"path";function k(o){let e=o,r=Z(o);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,a=[],c=[],s=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),m;while((m=g.exec(o))!==null){let i=m[1],l=m[2],f=m[0],d=i.includes("server");if(p(l))s.push(f);else if(d)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 d=l.index+l[0].length,x=t.indexOf("</script>",d);if(x===-1)continue;f.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let d=f.length-1;d>=0;d--)t=t.substring(0,f[d].start)+t.substring(f[d].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
+ <html lang="en">
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>${(e||"stx").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</title>
8
+ </head>
9
+ <body>
10
+ ${o}
11
+ </body>
12
+ </html>`}async function _o(o,e={}){let r=R(o),g=Bun.file(r);if(!await g.exists())throw Error(`Template file not found: ${r}`);let a=await g.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:m,injectCSS:t,...i}=e,l={...e.context||{}};rn(l);let f=await S(a,r,{...i,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),d=await p.text(),x={...l,content:f},w={...i,context:x,injectCSS:t};return S(d,s,w)}return S(a,r,e)}async function S(o,e,r={}){let{templateContent:g,serverScripts:a,clientScripts:c}=k(o),s={...I,...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,...Ln(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let i of a)await u(i,p,e);let m=new Set,t=g;if(t=await n(t,p,e,s,m),Wo(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
+ ${c.join(`
14
+ `)}`}else{if(r.processClientScripts!==!1&&c.length>0){let i=p.__stx_event_bindings||[],l=Ne(p),d=(await Promise.all(c.map(async(w)=>{let y=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!y)return w;return await me(y[1],{eventBindings:i,templateContent:t,serverData:l,filePath:e})}))).join(`
15
+ `);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${d}
16
+ $1`);else t+=`
17
+ ${d}`}t=await K(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-99qf5fff.js");t=await i(t)}catch{}return t}
18
+ export{_o};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{d,ls,ri,si,yc,bc,wc,vc,xc,Sc,Ve,L,Ue,kc,Wn,Cc,ci,$c,We,r,qn,li,g,ee,Fu}from"./chunk-dqdggvq4.js";import"./chunk-d2zw2e5m.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-ng61wjke.js";import"./chunk-zydg3wgt.js";import"./chunk-y36av1ac.js";import"./chunk-v83bpj84.js";import"./chunk-ynvce0q6.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{ee as clearComponentCache,$c as componentClientSignalNames,ls as convertToCommonJS,g as createDetailedErrorMessage,xc as extractDirectiveNames,ri as extractScriptFromTemplate,d as extractVariables,r as fileExists,Fu as getComponentCacheStats,bc as getPositionInfo,L as getSharedTranspiler,li as getSourceLineInfo,vc as hasDirectives,si as hasVariables,Cc as isHydrateTrigger,Sc as isJavaScriptScript,We as renderComponentWithSlot,qn as resolveTemplatePath,kc as scopeOnRootElement,Ve as shouldTranspileTypeScript,ci as slotContentHasExpressions,Ue as transpileTypeScript,Wn as userComponentFileExists,wc as validateDirective,yc as validateTemplate};
2
+ import{u,ls,ri,si,yc,bc,wc,vc,xc,Sc,Ve,L,Ue,kc,Wn,Cc,ci,$c,We,r,qn,li,g,ee,Fd}from"./chunk-ag1v2tkm.js";import"./chunk-gjrbnzap.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-jbdqs7t6.js";import"./chunk-zydg3wgt.js";import"./chunk-gj90pnre.js";import"./chunk-p7j2g8y2.js";import"./chunk-pfm6cfph.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{ee as clearComponentCache,$c as componentClientSignalNames,ls as convertToCommonJS,g as createDetailedErrorMessage,xc as extractDirectiveNames,ri as extractScriptFromTemplate,u as extractVariables,r as fileExists,Fd as getComponentCacheStats,bc as getPositionInfo,L as getSharedTranspiler,li as getSourceLineInfo,vc as hasDirectives,si as hasVariables,Cc as isHydrateTrigger,Sc as isJavaScriptScript,We as renderComponentWithSlot,qn as resolveTemplatePath,kc as scopeOnRootElement,Ve as shouldTranspileTypeScript,ci as slotContentHasExpressions,Ue as transpileTypeScript,Wn as userComponentFileExists,wc as validateDirective,yc as validateTemplate};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{go,mo,ca,la,ua,da,gl}from"./chunk-544e2jvd.js";export{go as createVirtualList,gl as default,ca as generateVirtualListCSS,ua as processInfiniteListDirectives,da as processVirtualGridDirectives,mo as processVirtualListDirectives,la as useVirtualList};
2
+ import{go,mo,ca,la,da,ua,gl}from"./chunk-se9qddyx.js";export{go as createVirtualList,gl as default,ca as generateVirtualListCSS,da as processInfiniteListDirectives,ua as processVirtualGridDirectives,mo as processVirtualListDirectives,la as useVirtualList};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Pe,Wt,Xl}from"./chunk-hhsynd7c.js";import{V,_n,qt,Mr,Nr,Tn,Gl,Jl,Yl,Kt,Xt,Lr,Rn,Zl}from"./chunk-14vnnx44.js";import"./chunk-2jbyks2t.js";export{Mr as batch,Xl as default,_n as derived,qt as effect,Pe as generateSignalsRuntime,Wt as generateSignalsRuntimeDev,Xt as isDerived,Kt as isSignal,Tn as onDestroy,Nr as onMount,Rn as peek,Yl as pendingLifecycleCounts,Jl as runDestroyCallbacks,Gl as runMountCallbacks,V as state,Lr as untrack,Zl as useOptimistic};
2
+ import{Pe,Wt,Xl}from"./chunk-nmk9en1n.js";import{V,_n,qt,Mr,Nr,Tn,Gl,Jl,Yl,Kt,Xt,Lr,Rn,Zl}from"./chunk-14vnnx44.js";import"./chunk-2jbyks2t.js";export{Mr as batch,Xl as default,_n as derived,qt as effect,Pe as generateSignalsRuntime,Wt as generateSignalsRuntimeDev,Xt as isDerived,Kt as isSignal,Tn as onDestroy,Nr as onMount,Rn as peek,Yl as pendingLifecycleCounts,Jl as runDestroyCallbacks,Gl as runMountCallbacks,V as state,Lr as untrack,Zl as useOptimistic};
@@ -1,21 +1,21 @@
1
1
  // @bun
2
- import{y}from"./chunk-2jbyks2t.js";import{P,Tt}from"./chunk-pf0d8y9n.js";import{m,h,w,He,L,o}from"./chunk-dqdggvq4.js";import{ie,ht,yt}from"./chunk-kdk0jy1h.js";import{Ae,Ut,dt,H}from"./chunk-8efg91ak.js";import _ from"path";var S=new Map,B=new Map,D=m(64),N=new Map,U=["composables","functions"];function O(t){let r=_.basename(t,".ts");return r==="index"||r==="types"||t.endsWith(".d.ts")}async function W(t){if(t)return _.resolve(t);let r=`<default>:${process.cwd()}`,c=N.get(r);if(c!==void 0)return c;let e=await X();if(e!==null)N.set(r,e);return e}async function X(){let t=await o(),r=t.root||process.cwd(),c=t.composablesDir;if(c)return _.resolve(r,c);for(let e of U){let i=_.resolve(r,e);try{let l=new Bun.Glob("**/*.ts");for await(let a of l.scan({cwd:i,absolute:!0}))if(!O(a))return i}catch{}}return null}async function G(t){let r=Array.isArray(t)?t:t?[_.resolve(t)]:(await o())._layerComposableDirs??[await W()].filter((e)=>!!e),c=new Map;for(let e of r){let i=new Bun.Glob("**/*.ts");try{for await(let l of i.scan({cwd:e,absolute:!0})){let a=_.relative(e,l);if(!O(l)&&!c.has(a))c.set(a,l)}}catch{}}return{key:r.join("\x00"),files:[...c.values()].sort()}}async function Or(t){let{files:r}=await G(t),c=L({loader:"ts",target:"browser",define:w()}),e=[];for(let i of r)try{let l=await Bun.file(i).text(),a=c.scan(l).exports.filter((f)=>f!=="default");if(a.length>0)e.push({file:i,names:a})}catch{}return e}function Z(t,r){return new RegExp(`\\b${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function q(t,r){let c=new Set(t.match(/\w+/g)),e=new Set;for(let i of r)if(/^\w+$/.test(i)?c.has(i):Z(t,i))e.add(i);return e}function Q(t,r,c){let e=new Map;for(let{file:f,names:d}of t)for(let u of d)if(!e.has(u))e.set(u,f);let i=(f)=>{let d=[];for(let u of q(f,e.keys()))d.push(e.get(u));return d},l=new Set,a=c.flatMap(i);while(a.length>0){let f=[];for(let d of a){if(l.has(d))continue;l.add(d);for(let u of i(r.get(d)??""))if(!l.has(u))f.push(u)}a=f}return l}async function bl(t,r,c){let{key:e,files:i}=await G(t);if(!e)return null;let l=()=>[...new Set([...i,...i.flatMap((n)=>ie(n))])],a=Ae(l());if(i.length===0)return H(S,e,a,""),null;i.sort();let f=L({loader:"ts",target:"browser",define:w()}),d=dt(B,e,a);if(!d){let n=new Map,s=[];for(let p of i)try{let g=await Bun.file(p).text();n.set(p,g);let R=f.scan(g).exports.filter((z)=>z!=="default");if(R.length>0)s.push({file:p,names:R})}catch{n.set(p,"")}d=H(B,e,a,{codeByFile:n,modules:s})}let{codeByFile:u,modules:J}=d,b;if(r===void 0)b=new Set(i);else{let n=c?[r,...c]:[r],s=h(n.join("\x00"),e,n.length,a),p=D.get(s);if(b=p??Q(J,u,n),!p)D.set(s,b)}if(b.size===0)return null;let k=i.filter((n)=>b.has(n)),C=`${e}\x00${k.join("\x00")}`,I=dt(S,C,a);if(I!==void 0)return I||null;let v=[],x=new Set,E=new Set;for(let n of k)try{let s=u.get(n)??await Bun.file(n).text(),p=_.basename(n,".ts");for(let g of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])E.add(g[1]);try{for(let g of f.scan(s).exports)if(g!=="default")x.add(g)}catch{}if(s=P(s),ht(s))s=await yt(s,n,{projectRoot:process.cwd(),externalizeUserModules:!1}),s=He(s);s=Tt(s),s=s.replace(/^export\s+(default\s+)?/gm,""),s=f.transformSync(s),v.push(`// Composable: ${p}
3
- ${s.trim()}`)}catch(s){console.warn(`[stx] Failed to load composable ${n}:`,s)}if(v.length===0||x.size===0)return H(S,C,a,""),null;let K=[...x].map((n)=>` try { if (!(${JSON.stringify(n)} in __c)) __c[${JSON.stringify(n)}] = ${n}; } catch (e) {}`).join(`
4
- `),F=JSON.stringify([...x]),M=v.join(`
2
+ import{y}from"./chunk-2jbyks2t.js";import{P,Tt}from"./chunk-pf0d8y9n.js";import{m,h,w,He,L,o}from"./chunk-ag1v2tkm.js";import{ie,ht,yt}from"./chunk-z14y48en.js";import{Ae,Ut,ut,H}from"./chunk-gm6g6gar.js";import _ from"path";var x=new Map,D=new Map,N=m(64),k=new Map,U=["composables","functions"];function O(t){let r=_.basename(t,".ts");return r==="index"||r==="types"||t.endsWith(".d.ts")}async function W(t){if(t)return _.resolve(t);let r=`<default>:${process.cwd()}`,c=k.get(r);if(c!==void 0)return c;let e=await X();if(e!==null)k.set(r,e);return e}async function X(){let t=await o(),r=t.root||process.cwd(),c=t.composablesDir;if(c)return _.resolve(r,c);for(let e of U){let i=_.resolve(r,e);try{let l=new Bun.Glob("**/*.ts");for await(let a of l.scan({cwd:i,absolute:!0}))if(!O(a))return i}catch{}}return null}async function G(t){let r=Array.isArray(t)?t:t?[_.resolve(t)]:(await o())._layerComposableDirs??[await W()].filter((e)=>!!e),c=new Map;for(let e of r){let i=new Bun.Glob("**/*.ts");try{for await(let l of i.scan({cwd:e,absolute:!0})){let a=_.relative(e,l);if(!O(l)&&!c.has(a))c.set(a,l)}}catch{}}return{key:r.join("\x00"),files:[...c.values()].sort()}}async function Or(t){let{files:r}=await G(t),c=L({loader:"ts",target:"browser",define:w()}),e=[];for(let i of r)try{let l=await Bun.file(i).text(),a=c.scan(l).exports.filter((f)=>f!=="default");if(a.length>0)e.push({file:i,names:a})}catch{}return e}function Z(t,r){return new RegExp(`\\b${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function q(t,r){let c=new Set(t.match(/\w+/g)),e=new Set;for(let i of r)if(/^\w+$/.test(i)?c.has(i):Z(t,i))e.add(i);return e}function Q(t,r,c){let e=new Map;for(let{file:f,names:d}of t)for(let u of d)if(!e.has(u))e.set(u,f);let i=(f)=>{let d=[];for(let u of q(f,e.keys()))d.push(e.get(u));return d},l=new Set,a=c.flatMap(i);while(a.length>0){let f=[];for(let d of a){if(l.has(d))continue;l.add(d);for(let u of i(r.get(d)??""))if(!l.has(u))f.push(u)}a=f}return l}async function bl(t,r,c){let{key:e,files:i}=await G(t);if(!e)return null;let l=()=>[...new Set([...i,...i.flatMap((n)=>ie(n))])],a=Ae(l());if(i.length===0)return H(x,e,a,""),null;i.sort();let f=L({loader:"ts",target:"browser",define:w()}),d=ut(D,e,a);if(!d){let n=new Map,s=[];for(let p of i)try{let S=await Bun.file(p).text();n.set(p,S);let g=f.scan(S).exports.filter((z)=>z!=="default");if(g.length>0)s.push({file:p,names:g})}catch{n.set(p,"")}d=H(D,e,a,{codeByFile:n,modules:s})}let{codeByFile:u,modules:J}=d,b;if(r===void 0)b=new Set(i);else{let n=c?[r,...c]:[r],s=h(n.join("\x00"),e,n.length,a),p=N.get(s);if(b=p??Q(J,u,n),!p)N.set(s,b)}if(b.size===0)return null;let E=i.filter((n)=>b.has(n)),v=`${e}\x00${E.join("\x00")}`,I=ut(x,v,a);if(I!==void 0)return I||null;let M=[],C=new Set,F=new Set;for(let n of E)try{let s=u.get(n)??await Bun.file(n).text(),p=_.basename(n,".ts");for(let g of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])F.add(g[1]);let S=[];try{for(let g of f.scan(s).exports)if(g!=="default")C.add(g),S.push(g)}catch{}if(s=P(s),ht(s))s=await yt(s,n,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:S}),s=He(s);s=Tt(s),s=s.replace(/^export\s+(default\s+)?/gm,""),s=f.transformSync(s),M.push(`// Composable: ${p}
3
+ ${s.trim()}`)}catch(s){console.warn(`[stx] Failed to load composable ${n}:`,s)}if(M.length===0||C.size===0)return H(x,v,a,""),null;let K=[...C].map((n)=>` try { if (!(${JSON.stringify(n)} in __c)) __c[${JSON.stringify(n)}] = ${n}; } catch (e) {}`).join(`
4
+ `),j=JSON.stringify([...C]),B=M.join(`
5
5
 
6
- `),T=y.filter((n)=>!E.has(n)&&new RegExp(`\\b${n}\\b`).test(M)).map((n)=>`var ${n} = __stx[${JSON.stringify(n)}];`).join(`
7
- `),j=JSON.stringify(new Bun.CryptoHasher("md5").update(`${F}\x00${M}`).digest("hex").slice(0,12)),A=`;(function(){
6
+ `),T=y.filter((n)=>!F.has(n)&&new RegExp(`\\b${n}\\b`).test(B)).map((n)=>`var ${n} = __stx[${JSON.stringify(n)}];`).join(`
7
+ `),A=JSON.stringify(new Bun.CryptoHasher("md5").update(`${j}\x00${B}`).digest("hex").slice(0,12)),R=`;(function(){
8
8
  var __bundles = window.__stxComposableBundles || (window.__stxComposableBundles = {});
9
- if (__bundles[${j}]) return;
10
- __bundles[${j}] = true;
9
+ if (__bundles[${A}]) return;
10
+ __bundles[${A}] = true;
11
11
  var __published = window.__stxComposableGlobals || (window.__stxComposableGlobals = {});
12
12
  window.__composables = window.__composables || {};
13
13
  var __c = window.__composables;
14
14
  var __stx = window.stx || {};
15
15
  ${T}
16
- ${M}
16
+ ${B}
17
17
  ${K}
18
- var __names = ${F};
18
+ var __names = ${j};
19
19
  for (var __i = 0; __i < __names.length; __i++) {
20
20
  var __n = __names[__i];
21
21
  if (!(__n in __c) || __published[__n]) continue;
@@ -29,5 +29,5 @@ ${K}
29
29
  window[__n] = __c[__n];
30
30
  __published[__n] = true;
31
31
  }
32
- })();`;return a=Ae(l()),H(S,C,a,A),A}function wl(){S.clear(),Ut(),B.clear(),D.clear(),N.clear()}
32
+ })();`;return a=Ae(l()),H(x,v,a,R),R}function wl(){x.clear(),Ut(),D.clear(),N.clear(),k.clear()}
33
33
  export{Or,bl,wl};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Lu,oc,os,is,Qo,ei,as,cs,Fn,ic,ti,ni,ac,He}from"./chunk-dqdggvq4.js";import"./chunk-d2zw2e5m.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-ng61wjke.js";import"./chunk-zydg3wgt.js";import"./chunk-y36av1ac.js";import"./chunk-v83bpj84.js";import"./chunk-ynvce0q6.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{Lu as clearScriptScanCache,as as convertServerLoopAttributesToDirectives,Qo as convertSignalDirectivesToAttributes,cs as convertSignalLoopsToAttributes,ic as extractExports,ni as findMarkupIndexOutsideScripts,is as hasSignalsSyntax,os as parseLoopExpression,ei as preEvalLiteralReactiveIfs,Fn as processScriptSetup,ti as processSignals,ac as rewriteStxImportSpecifiers,oc as scanScriptTags,He as stripStxRuntimeImports};
2
+ import{Ld,oc,os,is,Qo,ei,as,cs,Fn,ic,ti,ni,ac,He}from"./chunk-ag1v2tkm.js";import"./chunk-gjrbnzap.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-jbdqs7t6.js";import"./chunk-zydg3wgt.js";import"./chunk-gj90pnre.js";import"./chunk-p7j2g8y2.js";import"./chunk-pfm6cfph.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{Ld as clearScriptScanCache,as as convertServerLoopAttributesToDirectives,Qo as convertSignalDirectivesToAttributes,cs as convertSignalLoopsToAttributes,ic as extractExports,ni as findMarkupIndexOutsideScripts,is as hasSignalsSyntax,os as parseLoopExpression,ei as preEvalLiteralReactiveIfs,Fn as processScriptSetup,ti as processSignals,ac as rewriteStxImportSpecifiers,oc as scanScriptTags,He as stripStxRuntimeImports};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{kt,ds,oi,mc}from"./chunk-ag1v2tkm.js";import"./chunk-gjrbnzap.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-jbdqs7t6.js";import"./chunk-zydg3wgt.js";import"./chunk-gj90pnre.js";import"./chunk-p7j2g8y2.js";import"./chunk-pfm6cfph.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{mc as declareBareLoopHead,kt as parseLoopBinding,oi as processLoops,ds as reportDeferredLoopWarnings};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  import g from"path";var y=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function I(...r){let o=new Set;for(let s of r){if(!s||!s.includes("__stxModules["))continue;for(let e of s.matchAll(y))try{o.add(JSON.parse(`"${e[1]}"`))}catch{}}return[...o].sort()}async function M(r,o={}){if(r.length===0)return null;let s=process.cwd(),e=[],l=[];r.forEach((t,h)=>{let x=t.startsWith("npm:")?t.slice(4):g.resolve(s,t),a=`__stxRegistered${h}`,d=JSON.stringify(t);e.push(`import * as ${a} from ${JSON.stringify(x)};`),l.push(`if (!globalThis.__stxModules[${d}]) globalThis.__stxModules[${d}] = ${a};`)});let u=[...e,"globalThis.__stxModules = globalThis.__stxModules || {};",...l].join(`
3
- `),n;try{let{bundleClientScript:t}=await import("./chunk-bp53x03f.js");n=await t(u,g.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:o.minify,externalizeUserModules:!1,collectInputs:o.collectInputs})}catch(t){return console.warn("[stx] could not build the page module registry (#1957):",t),null}let{transformAutoImports:p,generateAutoImportDestructuring:m}=await import("./chunk-nkxa7men.js"),i=p(n),f=m(i.stxImports,i.browserImports),{transformStoreImports:_}=await import("./chunk-0e1rga0j.js");n=_(i.code);let c=JSON.stringify(new Bun.CryptoHasher("md5").update(u).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${c}]) return;`,` __stxBundles[${c}] = true;`,f,n,"})();"].join(`
3
+ `),n;try{let{bundleClientScript:t}=await import("./chunk-27k24mk0.js");n=await t(u,g.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:o.minify,externalizeUserModules:!1,collectInputs:o.collectInputs})}catch(t){return console.warn("[stx] could not build the page module registry (#1957):",t),null}let{transformAutoImports:p,generateAutoImportDestructuring:m}=await import("./chunk-xsdj6k6c.js"),i=p(n),f=m(i.stxImports,i.browserImports),{transformStoreImports:_}=await import("./chunk-0e1rga0j.js");n=_(i.code);let c=JSON.stringify(new Bun.CryptoHasher("md5").update(u).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${c}]) return;`,` __stxBundles[${c}] = true;`,f,n,"})();"].join(`
4
4
  `)}export{M as buildModuleRegistryScript,I as registeredModuleIdsIn};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- function uo(e){return e}class a{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,i]of this.plugins)if(i.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let n=await s(r);if(n){if(n.template!==void 0)r.template=n.template;if(n.context)r.context={...r.context,...n.context};if(n.metadata)r.metadata={...r.metadata,...n.metadata};if(n.skip)break}}catch(n){console.error(`Error in plugin "${i.name}" ${e} hook:`,n)}}return r}async runDirectiveHooks(e,t,r){let i={...r};for(let s of this.sortedPlugins){let n=s[e];if(n)try{let o=await n(t,i);if(o){if(o.template!==void 0)i.template=o.template;if(o.context)i.context={...i.context,...o.context};if(o.metadata)i.metadata={...i.metadata,...o.metadata};if(o.skip)break}}catch(o){console.error(`Error in plugin "${s.name}" ${e} hook:`,o)}}return i}}var ul=new a;var u=uo({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),l=uo({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}});export{uo,ul};
2
+ function uo(e){return e}class a{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,i]of this.plugins)if(i.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let n=await s(r);if(n){if(n.template!==void 0)r.template=n.template;if(n.context)r.context={...r.context,...n.context};if(n.metadata)r.metadata={...r.metadata,...n.metadata};if(n.skip)break}}catch(n){console.error(`Error in plugin "${i.name}" ${e} hook:`,n)}}return r}async runDirectiveHooks(e,t,r){let i={...r};for(let s of this.sortedPlugins){let n=s[e];if(n)try{let o=await n(t,i);if(o){if(o.template!==void 0)i.template=o.template;if(o.context)i.context={...i.context,...o.context};if(o.metadata)i.metadata={...i.metadata,...o.metadata};if(o.skip)break}}catch(o){console.error(`Error in plugin "${s.name}" ${e} hook:`,o)}}return i}}var dl=new a;var u=uo({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),l=uo({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}});export{uo,dl};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{y}from"./chunk-2jbyks2t.js";import{P,Tt}from"./chunk-pf0d8y9n.js";import{w,He,L,o}from"./chunk-dqdggvq4.js";import{ie,ht,yt}from"./chunk-kdk0jy1h.js";import{Ae,Ut,dt,H}from"./chunk-8efg91ak.js";import f from"path";var l=new Map;function v(a,s){for(let n of a.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(n[1])s.add(n[1]);for(let n of a.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let r of(n[1]??"").split(",")){let i=((r.includes(":")?r.split(":").pop():r)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(i))s.add(i)}for(let n of a.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let r of(n[1]??"").split(",")){let c=r.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(c))s.add(c)}}async function ql(a){let s;if(a)s=f.resolve(a);else{let t=await o();s=f.resolve(t.root||process.cwd(),t.storesDir||"stores")}let n=new Bun.Glob("*.ts"),r=[];try{for await(let t of n.scan({cwd:s,absolute:!0})){let e=f.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return H(l,s,"",""),null}let c=()=>[...new Set([...r,...r.flatMap((t)=>ie(t))])],i=Ae(c()),d=dt(l,s,i);if(d!==void 0)return d||null;if(r.length===0)return H(l,s,i,""),null;let p=[];for(let t of r){let e=await Bun.file(t).text();p.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}p.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let h=p.map((t)=>t.file),u=[],m=new Set,b=L({loader:"ts",target:"browser",define:w()});for(let t of h)try{let e=await Bun.file(t).text(),x=f.basename(t,".ts");if(v(e,m),ht(e))e=await yt(e,t,{projectRoot:process.cwd(),externalizeUserModules:!1});e=He(e),e=P(e),e=Tt(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=b.transformSync(e),u.push(`// Store: ${x}
2
+ import{y}from"./chunk-2jbyks2t.js";import{P,Tt}from"./chunk-pf0d8y9n.js";import{w,He,L,o}from"./chunk-ag1v2tkm.js";import{ie,ht,yt}from"./chunk-z14y48en.js";import{Ae,Ut,ut,H}from"./chunk-gm6g6gar.js";import f from"path";var l=new Map;function v(a,s){for(let n of a.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(n[1])s.add(n[1]);for(let n of a.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let r of(n[1]??"").split(",")){let i=((r.includes(":")?r.split(":").pop():r)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(i))s.add(i)}for(let n of a.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let r of(n[1]??"").split(",")){let c=r.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(c))s.add(c)}}async function ql(a){let s;if(a)s=f.resolve(a);else{let t=await o();s=f.resolve(t.root||process.cwd(),t.storesDir||"stores")}let n=new Bun.Glob("*.ts"),r=[];try{for await(let t of n.scan({cwd:s,absolute:!0})){let e=f.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return H(l,s,"",""),null}let c=()=>[...new Set([...r,...r.flatMap((t)=>ie(t))])],i=Ae(c()),d=ut(l,s,i);if(d!==void 0)return d||null;if(r.length===0)return H(l,s,i,""),null;let p=[];for(let t of r){let e=await Bun.file(t).text();p.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}p.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let h=p.map((t)=>t.file),u=[],m=new Set,b=L({loader:"ts",target:"browser",define:w()});for(let t of h)try{let e=await Bun.file(t).text(),x=f.basename(t,".ts");if(v(e,m),ht(e))e=await yt(e,t,{projectRoot:process.cwd(),externalizeUserModules:!1});e=He(e),e=P(e),e=Tt(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=b.transformSync(e),u.push(`// Store: ${x}
3
3
  ${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(u.length===0)return H(l,s,i,""),null;let g=u.join(`
4
4
 
5
5
  `),S=`;(function(){
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{jd,hc,ye,ii,Bd,us,ps,gs}from"./chunk-ag1v2tkm.js";import"./chunk-gjrbnzap.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-jbdqs7t6.js";import"./chunk-zydg3wgt.js";import"./chunk-gj90pnre.js";import"./chunk-p7j2g8y2.js";import"./chunk-pfm6cfph.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{Bd as clearOnceStore,ii as onceStore,ye as partialsCache,us as processIncludes,ps as processStackPushDirectives,gs as processStackReplacements,jd as resetUnscopedSignalWarnings,hc as topLevelElements};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Id,Vo,Dd,Uo,Za,Qa,xt,tn,Od,ec,tc,nc,f}from"./chunk-ag1v2tkm.js";import"./chunk-gjrbnzap.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-jbdqs7t6.js";import"./chunk-zydg3wgt.js";import"./chunk-gj90pnre.js";import"./chunk-p7j2g8y2.js";import"./chunk-pfm6cfph.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{xt as buildCss,ec as extractClassNames,Qa as fingerprintConfig,tc as generateCss,Od as getCachedCSS,Id as getCssServeAsset,f as injectCss,Vo as loadCssEngine,Uo as loadCssEngineConfig,tn as rebuildCss,Dd as resetCssCache,Za as resolveUserCssConfig,nc as withLinkedModuleBundles};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import I from"fs";import u from"path";import V from"os";import x from"crypto";import{generatePlaceholder as C,processImage as D}from"ts-images";var j=[320,640,768,1024,1280,1536,1920],B=["webp","jpeg"],F=80,O=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],L={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},w=null,v=!1;async function p(){if(v)return w;v=!0;try{let t=await import("sharp");return w=t.default||t,w}catch{return null}}async function Ot(){return await p()!==null}async function J(){return!0}async function se(t,e={}){let{widths:a=j,formats:r=B,quality:n=F,fit:i="cover",placeholder:m="none",outputDir:o=".stx/images",baseUrl:b="/images"}=e,h,g;if(typeof t==="string"){if(g=t,!await Bun.file(t).exists())throw new En(`Image not found: ${t}`,"NOT_FOUND");h=await Bun.file(t).arrayBuffer().then((s)=>Buffer.from(s))}else g="buffer-input",h=t;let y=x.createHash("sha256").update(h).digest("hex").slice(0,12),k=await $n(h),{width:c,height:S}=k,P=c/S;await I.promises.mkdir(o,{recursive:!0});let E=[],R=u.basename(g,u.extname(g)),l=a.filter((s)=>s<=c);if(!l.includes(c)&&c<=Math.max(...a))l.push(c);l.sort((s,f)=>s-f);for(let s of l){let f=Math.round(s/P);for(let d of r){let U=`${R}-${s}w-${y}.${d}`,A=u.join(o,U),T=`${b}/${U}`,q=await Ji(h,{width:s,height:f,format:d,quality:n,fit:i});await Bun.write(A,q),E.push({path:A,url:T,width:s,height:f,format:d,size:q.length})}}let M;if(m!=="none")M=await _(h,m);return{src:g,variants:E,placeholder:M,width:c,height:S,aspectRatio:P,hash:y}}async function $n(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await p();if(a){let n=await a(e).metadata();return{width:n.width||0,height:n.height||0,format:n.format||"unknown",hasAlpha:n.hasAlpha}}return N(e)}function N(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let n=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:n,format:"jpeg",hasAlpha:!1}}let r=t.readUInt16BE(e+2);e+=2+r}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,r=t.readUInt16LE(28)&16383;return{width:a,height:r,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),r=(a&16383)+1,n=(a>>14&16383)+1;return{width:r,height:n,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new En("Unable to parse image dimensions","PARSE_ERROR")}async function Ji(t,e){let a=await p();if(a){let n=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":n=n.webp({quality:e.quality});break;case"avif":n=n.avif({quality:e.quality});break;case"jpeg":n=n.jpeg({quality:e.quality});break;case"png":n=n.png({quality:e.quality});break}return n.toBuffer()}let r=u.join(V.tmpdir(),`stx-img-${x.randomBytes(8).toString("hex")}.${e.format}`);try{return await D({input:t,output:r,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(r).arrayBuffer())}finally{await I.promises.unlink(r).catch(()=>{})}}async function _(t,e){let a=await p();if(e==="blur"&&a){let m=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),o=await $n(t);return`data:${L[o.format]||"image/jpeg"};base64,${m}`}if(e==="dominant-color"&&a){let{dominant:i}=await a(t).resize(1,1).toBuffer().then(async(m)=>{let o=await a(m).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${i.r}, ${i.g}, ${i.b})`}let r=await $n(t),n=u.join(V.tmpdir(),`stx-ph-${x.randomBytes(8).toString("hex")}.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(n,t);let i=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",o=await C(n,{strategy:i,width:i==="thumbhash"?void 0:32});if(e==="dominant-color"&&o.dominantColor)return o.dominantColor;if(o.dataURL)return o.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{await I.promises.unlink(n).catch(()=>{})}}function Re(t,e){return(e?t.filter((r)=>r.format===e):t).sort((r,n)=>r.width-n.width).map((r)=>`${r.url} ${r.width}w`).join(", ")}function ut(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,r)=>{let n=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(r[0].replace(/\D/g,""))||0)-n}).map(([a,r])=>`(max-width: ${a}) ${r}`).join(", ")+", 100vw"}function Mt(t){let e=t.filter((r)=>r.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((r,n)=>r.width-n.width);return a[Math.floor(a.length/2)]}function Nt(t){let e=new Map;for(let a of t){let r=e.get(a.format)||[];r.push(a),e.set(a.format,r)}return e}function Lt(t){let e=u.extname(t).toLowerCase();return O.includes(e)}function z(t){return L[t]||"application/octet-stream"}function jt(t){return t.reduce((e,a)=>e+a.size,0)}function Bt(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class En extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
3
- export{j,B,F,Ot,J,se,$n,Ji,Re,ut,Mt,Nt,Lt,z,jt,Bt,En};
2
+ import I from"fs";import u from"path";import V from"os";import x from"crypto";import{generatePlaceholder as C,processImage as D}from"ts-images";var j=[320,640,768,1024,1280,1536,1920],B=["webp","jpeg"],F=80,O=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],L={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},w=null,v=!1;async function p(){if(v)return w;v=!0;try{let t=await import("sharp");return w=t.default||t,w}catch{return null}}async function Ot(){return await p()!==null}async function J(){return!0}async function se(t,e={}){let{widths:a=j,formats:r=B,quality:n=F,fit:i="cover",placeholder:m="none",outputDir:o=".stx/images",baseUrl:b="/images"}=e,h,g;if(typeof t==="string"){if(g=t,!await Bun.file(t).exists())throw new En(`Image not found: ${t}`,"NOT_FOUND");h=await Bun.file(t).arrayBuffer().then((s)=>Buffer.from(s))}else g="buffer-input",h=t;let y=x.createHash("sha256").update(h).digest("hex").slice(0,12),k=await $n(h),{width:c,height:S}=k,P=c/S;await I.promises.mkdir(o,{recursive:!0});let E=[],R=u.basename(g,u.extname(g)),l=a.filter((s)=>s<=c);if(!l.includes(c)&&c<=Math.max(...a))l.push(c);l.sort((s,f)=>s-f);for(let s of l){let f=Math.round(s/P);for(let d of r){let U=`${R}-${s}w-${y}.${d}`,A=u.join(o,U),T=`${b}/${U}`,q=await Ji(h,{width:s,height:f,format:d,quality:n,fit:i});await Bun.write(A,q),E.push({path:A,url:T,width:s,height:f,format:d,size:q.length})}}let M;if(m!=="none")M=await _(h,m);return{src:g,variants:E,placeholder:M,width:c,height:S,aspectRatio:P,hash:y}}async function $n(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await p();if(a){let n=await a(e).metadata();return{width:n.width||0,height:n.height||0,format:n.format||"unknown",hasAlpha:n.hasAlpha}}return N(e)}function N(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let n=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:n,format:"jpeg",hasAlpha:!1}}let r=t.readUInt16BE(e+2);e+=2+r}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,r=t.readUInt16LE(28)&16383;return{width:a,height:r,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),r=(a&16383)+1,n=(a>>14&16383)+1;return{width:r,height:n,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new En("Unable to parse image dimensions","PARSE_ERROR")}async function Ji(t,e){let a=await p();if(a){let n=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":n=n.webp({quality:e.quality});break;case"avif":n=n.avif({quality:e.quality});break;case"jpeg":n=n.jpeg({quality:e.quality});break;case"png":n=n.png({quality:e.quality});break}return n.toBuffer()}let r=u.join(V.tmpdir(),`stx-img-${x.randomBytes(8).toString("hex")}.${e.format}`);try{return await D({input:t,output:r,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(r).arrayBuffer())}finally{await I.promises.unlink(r).catch(()=>{})}}async function _(t,e){let a=await p();if(e==="blur"&&a){let m=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),o=await $n(t);return`data:${L[o.format]||"image/jpeg"};base64,${m}`}if(e==="dominant-color"&&a){let{dominant:i}=await a(t).resize(1,1).toBuffer().then(async(m)=>{let o=await a(m).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${i.r}, ${i.g}, ${i.b})`}let r=await $n(t),n=u.join(V.tmpdir(),`stx-ph-${x.randomBytes(8).toString("hex")}.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(n,t);let i=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",o=await C(n,{strategy:i,width:i==="thumbhash"?void 0:32});if(e==="dominant-color"&&o.dominantColor)return o.dominantColor;if(o.dataURL)return o.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{await I.promises.unlink(n).catch(()=>{})}}function Re(t,e){return(e?t.filter((r)=>r.format===e):t).sort((r,n)=>r.width-n.width).map((r)=>`${r.url} ${r.width}w`).join(", ")}function dt(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,r)=>{let n=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(r[0].replace(/\D/g,""))||0)-n}).map(([a,r])=>`(max-width: ${a}) ${r}`).join(", ")+", 100vw"}function Mt(t){let e=t.filter((r)=>r.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((r,n)=>r.width-n.width);return a[Math.floor(a.length/2)]}function Nt(t){let e=new Map;for(let a of t){let r=e.get(a.format)||[];r.push(a),e.set(a.format,r)}return e}function Lt(t){let e=u.extname(t).toLowerCase();return O.includes(e)}function z(t){return L[t]||"application/octet-stream"}function jt(t){return t.reduce((e,a)=>e+a.size,0)}function Bt(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class En extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
3
+ export{j,B,F,Ot,J,se,$n,Ji,Re,dt,Mt,Nt,Lt,z,jt,Bt,En};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{cl}from"./chunk-2e4pegf1.js";import"./chunk-ag1v2tkm.js";import"./chunk-gjrbnzap.js";import"./chunk-2n5pjbw9.js";import"./chunk-0trfbqa7.js";import"./chunk-jbdqs7t6.js";import"./chunk-zydg3wgt.js";import"./chunk-gj90pnre.js";import"./chunk-p7j2g8y2.js";import"./chunk-pfm6cfph.js";import"./chunk-pf0d8y9n.js";import"./chunk-2jbyks2t.js";import"./chunk-88px183j.js";import"./chunk-jz7pvh7b.js";export{cl as buildApp};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{bt,Hr,Vr,Ur,bu,Wr}from"./chunk-39q77svv.js";import"./chunk-0trfbqa7.js";import"./chunk-zydg3wgt.js";import"./chunk-88px183j.js";export{Vr as buildServerApi,bu as createServerApi,bt as discoverServerApi,Hr as generateApiTypes,Wr as isServerApiSource,Ur as productionApiDispatcher};
2
+ import{bt,Hr,Vr,Ur,bd,Wr}from"./chunk-gasb5fhy.js";import"./chunk-0trfbqa7.js";import"./chunk-zydg3wgt.js";import"./chunk-88px183j.js";export{Vr as buildServerApi,bd as createServerApi,bt as discoverServerApi,Hr as generateApiTypes,Wr as isServerApiSource,Ur as productionApiDispatcher};