@stacksjs/stx 0.2.265 → 0.2.267

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 (170) hide show
  1. package/dist/app-shell.js +5 -24
  2. package/dist/caching.js +2 -0
  3. package/dist/{chunk-25de1sj7.js → chunk-0athjw48.js} +2 -2
  4. package/dist/{chunk-38ykv2gd.js → chunk-135mme4g.js} +1 -1
  5. package/dist/{chunk-4xr8099h.js → chunk-13ftt3qc.js} +1 -1
  6. package/dist/{chunk-w5b2bwxp.js → chunk-18nxwzv3.js} +109 -109
  7. package/dist/{chunk-gpt6ggxj.js → chunk-1hhxj2r5.js} +1 -1
  8. package/dist/{chunk-f0rjjfk0.js → chunk-1j77d7fw.js} +1 -1
  9. package/dist/{chunk-sr49fd8p.js → chunk-1m4sa11y.js} +1 -1
  10. package/dist/{chunk-nteg247p.js → chunk-278yw67q.js} +1 -1
  11. package/dist/{chunk-0mk858ne.js → chunk-2ed60g20.js} +2 -2
  12. package/dist/{chunk-qpsj28s2.js → chunk-2qsa4h1t.js} +2 -2
  13. package/dist/{chunk-3rnc94mp.js → chunk-2x9s5z8x.js} +1 -1
  14. package/dist/{chunk-va2wwrpf.js → chunk-455pgdzh.js} +1 -1
  15. package/dist/{chunk-k6st4606.js → chunk-4ay1ymgp.js} +1 -1
  16. package/dist/{chunk-x7pp10qb.js → chunk-4cr21p7m.js} +1 -1
  17. package/dist/chunk-4mvpapjz.js +2 -0
  18. package/dist/{chunk-7exqxjx5.js → chunk-4mw2kfqd.js} +1 -1
  19. package/dist/chunk-4wnnet1k.js +12 -0
  20. package/dist/{chunk-jt8as8j8.js → chunk-52wr95ps.js} +1 -1
  21. package/dist/{chunk-pbsfbgx7.js → chunk-5d4csjhx.js} +1 -1
  22. package/dist/chunk-5htqgzbb.js +2 -0
  23. package/dist/{chunk-z0aygs4h.js → chunk-5k0j7bjy.js} +1 -1
  24. package/dist/{chunk-aw651z2y.js → chunk-5wkwhjjn.js} +54 -20
  25. package/dist/{chunk-xr1758xj.js → chunk-6746wmsf.js} +1 -1
  26. package/dist/{chunk-new80es4.js → chunk-6g7m08rv.js} +1 -1
  27. package/dist/{chunk-bjj27mf3.js → chunk-6kcz7bg6.js} +2 -2
  28. package/dist/{chunk-p1rswnys.js → chunk-73yr54sg.js} +1 -1
  29. package/dist/{chunk-2pavh1yg.js → chunk-78bm61kd.js} +1 -1
  30. package/dist/chunk-7cts329z.js +2 -0
  31. package/dist/chunk-7kkc13rc.js +2 -0
  32. package/dist/chunk-8evws5cc.js +11 -0
  33. package/dist/{chunk-zr4emtxf.js → chunk-8jvmjzmr.js} +1 -1
  34. package/dist/{chunk-pfm1325e.js → chunk-8vewrjzp.js} +2 -2
  35. package/dist/{chunk-zr6m5k3t.js → chunk-987kjtg8.js} +1 -1
  36. package/dist/{chunk-3fa6t4fw.js → chunk-9gzmcxzg.js} +1 -1
  37. package/dist/{chunk-b3f5dwzz.js → chunk-9rdg7x9h.js} +1 -1
  38. package/dist/chunk-9rkcrzj4.js +2 -0
  39. package/dist/{chunk-8pvymy12.js → chunk-9y175wxc.js} +1 -1
  40. package/dist/chunk-b41qf397.js +2 -0
  41. package/dist/{chunk-dnhckx52.js → chunk-bby4emay.js} +1 -1
  42. package/dist/chunk-c1r9q5pk.js +15 -0
  43. package/dist/chunk-cd4v7xyr.js +2 -0
  44. package/dist/{chunk-ecyac25w.js → chunk-cksz4k5v.js} +2 -2
  45. package/dist/chunk-d3v3p15c.js +2 -0
  46. package/dist/{chunk-jq375v8t.js → chunk-dhe8sp1a.js} +1 -1
  47. package/dist/chunk-dpgp6rzq.js +2 -0
  48. package/dist/{chunk-0j9hrzjj.js → chunk-e6tvnnnz.js} +1 -1
  49. package/dist/chunk-e6vdk4v0.js +2 -0
  50. package/dist/{chunk-g8tce9rr.js → chunk-f1jd5qjb.js} +1 -1
  51. package/dist/{chunk-4qq5wj04.js → chunk-f3m0q482.js} +1 -1
  52. package/dist/{chunk-wb7dfcnc.js → chunk-f8g0zbm3.js} +1 -1
  53. package/dist/{chunk-0y6f4037.js → chunk-f8wjdg40.js} +1 -1
  54. package/dist/chunk-fcv00xs9.js +2 -0
  55. package/dist/{chunk-sne7938g.js → chunk-fn9yw31x.js} +1 -1
  56. package/dist/chunk-g4z7gah7.js +2 -0
  57. package/dist/{chunk-ph5f8eev.js → chunk-gej3rmfy.js} +1 -1
  58. package/dist/{chunk-1qnyvw5w.js → chunk-hhyf0s7s.js} +1 -1
  59. package/dist/chunk-j135b7xt.js +2 -0
  60. package/dist/{chunk-x84g0m0p.js → chunk-j24k071e.js} +1 -1
  61. package/dist/chunk-jb7h4qgh.js +22 -0
  62. package/dist/{chunk-ym3r8ktq.js → chunk-jcped0kt.js} +1 -1
  63. package/dist/{chunk-a8mnhryz.js → chunk-jnbhyzkv.js} +2 -2
  64. package/dist/{chunk-1n16xphq.js → chunk-jq4104he.js} +2 -2
  65. package/dist/chunk-k5c19t7e.js +2 -0
  66. package/dist/{chunk-6vqb54c8.js → chunk-k7n88ess.js} +1 -1
  67. package/dist/{chunk-3txrk37v.js → chunk-khfszwjy.js} +1 -1
  68. package/dist/{chunk-wj2trgsn.js → chunk-krgth3gf.js} +1 -1
  69. package/dist/{chunk-nqy2v6vh.js → chunk-m0aetx9j.js} +2 -2
  70. package/dist/chunk-mb0kqnwf.js +2 -0
  71. package/dist/{chunk-r7dd7c7y.js → chunk-mbvkvac6.js} +332 -343
  72. package/dist/{chunk-4w3gg4g7.js → chunk-mcn9mwzv.js} +1 -1
  73. package/dist/chunk-mzpb11dp.js +2 -0
  74. package/dist/{chunk-rp0m678g.js → chunk-n2r83qwt.js} +1 -1
  75. package/dist/chunk-ng1wyd2v.js +2 -0
  76. package/dist/{chunk-s2wm8qwg.js → chunk-q4n8a7sf.js} +1 -1
  77. package/dist/chunk-q5et8k2d.js +2 -0
  78. package/dist/chunk-qf5grrg1.js +2 -0
  79. package/dist/{chunk-k1e72asa.js → chunk-qh6223a0.js} +1 -1
  80. package/dist/{chunk-gg2en16q.js → chunk-qkbrbys7.js} +1 -1
  81. package/dist/{chunk-yjk7vyd8.js → chunk-r4nkpr60.js} +1 -1
  82. package/dist/chunk-r8qvm7a3.js +30 -0
  83. package/dist/{chunk-c17txgm7.js → chunk-r9z71gj0.js} +1 -1
  84. package/dist/{chunk-c59rkxwf.js → chunk-rc4zrsw3.js} +1 -1
  85. package/dist/chunk-rgh4njyv.js +2 -0
  86. package/dist/{chunk-10tcqry1.js → chunk-rwb4nztb.js} +1 -1
  87. package/dist/chunk-scdxk8nn.js +2 -0
  88. package/dist/{chunk-5h5ydexj.js → chunk-sde45gh3.js} +1 -1
  89. package/dist/{chunk-chsfdfqm.js → chunk-shtemwbq.js} +1 -1
  90. package/dist/chunk-sz51py35.js +2 -0
  91. package/dist/chunk-tc01rmwh.js +2 -0
  92. package/dist/{chunk-wx73fmky.js → chunk-tv6ds16a.js} +1 -1
  93. package/dist/chunk-v9xkrwxt.js +2 -0
  94. package/dist/{chunk-a90d3xne.js → chunk-vnrhn6b0.js} +1 -1
  95. package/dist/{chunk-95mj2e8x.js → chunk-vrskjx64.js} +1 -1
  96. package/dist/{chunk-4svmpj7y.js → chunk-w7gpyx2k.js} +1 -1
  97. package/dist/{chunk-gyga6sjp.js → chunk-wacr03x4.js} +1 -1
  98. package/dist/{chunk-j6e4vwv5.js → chunk-wrg838f0.js} +1 -1
  99. package/dist/chunk-xkb16kmv.js +2 -0
  100. package/dist/chunk-xpsxwbw0.js +2 -0
  101. package/dist/chunk-xv2mr8vq.js +2 -0
  102. package/dist/{chunk-rkrnb0ec.js → chunk-y9tv04zh.js} +2 -2
  103. package/dist/{chunk-yb3nrbqz.js → chunk-yhtq662h.js} +1 -1
  104. package/dist/chunk-ykxs16y7.js +2 -0
  105. package/dist/chunk-yxp7wv61.js +3 -0
  106. package/dist/{chunk-4zkv1vqh.js → chunk-z86pq9pd.js} +2 -2
  107. package/dist/{chunk-j59pkkzn.js → chunk-zr2rkgag.js} +2 -2
  108. package/dist/cli.js +14 -14
  109. package/dist/client-script-bundler.d.ts +14 -0
  110. package/dist/client-script-bundler.js +37 -21
  111. package/dist/client-script.d.ts +1 -0
  112. package/dist/client-script.js +4 -2
  113. package/dist/color-mode-boot.js +6 -3
  114. package/dist/component-client-factories.d.ts +29 -0
  115. package/dist/component-client-factories.js +24 -0
  116. package/dist/craft-entry.js +1 -1
  117. package/dist/craft.js +1 -1
  118. package/dist/database.js +1 -1
  119. package/dist/dev-server/crosswind.d.ts +0 -3
  120. package/dist/dev-server/crosswind.js +13 -0
  121. package/dist/fragment-container.js +15 -1
  122. package/dist/framework-composables.js +12 -2
  123. package/dist/performance-utils.d.ts +22 -1
  124. package/dist/performance-utils.js +30 -5
  125. package/dist/pwa.js +2 -2
  126. package/dist/render-memo.d.ts +40 -0
  127. package/dist/render-memo.js +33 -0
  128. package/dist/script-validation.js +25 -11
  129. package/dist/ssg.js +2 -2
  130. package/dist/store-loader.js +10 -1
  131. package/dist/style-scoping.js +18 -7
  132. package/dist/utils.js +108 -58
  133. package/dist/variable-extractor.js +14 -8
  134. package/dist/visual-testing.js +1 -1
  135. package/package.json +5 -5
  136. package/dist/chunk-0ha9e1wt.js +0 -5
  137. package/dist/chunk-0x022m9m.js +0 -2
  138. package/dist/chunk-14cps421.js +0 -2
  139. package/dist/chunk-1r8c2wws.js +0 -2
  140. package/dist/chunk-2p4v6ed7.js +0 -2
  141. package/dist/chunk-2qbde7w2.js +0 -2
  142. package/dist/chunk-3wwnx5d4.js +0 -2
  143. package/dist/chunk-4s2p4hry.js +0 -2
  144. package/dist/chunk-6gc8phhe.js +0 -2
  145. package/dist/chunk-7qgnd7z8.js +0 -2
  146. package/dist/chunk-85wgtm01.js +0 -2
  147. package/dist/chunk-8raem8ng.js +0 -2
  148. package/dist/chunk-9v8be077.js +0 -2
  149. package/dist/chunk-a5sn113x.js +0 -12
  150. package/dist/chunk-b3zes539.js +0 -11
  151. package/dist/chunk-c2mvr9z1.js +0 -2
  152. package/dist/chunk-fenb3cqw.js +0 -2
  153. package/dist/chunk-g4t9zc0a.js +0 -2
  154. package/dist/chunk-gayjne01.js +0 -2
  155. package/dist/chunk-gd9gfw08.js +0 -2
  156. package/dist/chunk-h44qqffw.js +0 -2
  157. package/dist/chunk-jftmdf4j.js +0 -2
  158. package/dist/chunk-k6wnmjhf.js +0 -3
  159. package/dist/chunk-m116b3d9.js +0 -2
  160. package/dist/chunk-m8hggrdc.js +0 -2
  161. package/dist/chunk-mjbsb088.js +0 -2
  162. package/dist/chunk-ptcpaeem.js +0 -11
  163. package/dist/chunk-qqfsm20p.js +0 -30
  164. package/dist/chunk-rs5w6cm5.js +0 -2
  165. package/dist/chunk-tn2kwwy4.js +0 -13
  166. package/dist/chunk-venjrj7g.js +0 -2
  167. package/dist/chunk-x0t0ndxd.js +0 -2
  168. package/dist/chunk-xezfdh27.js +0 -2
  169. package/dist/chunk-xmrwskw2.js +0 -2
  170. package/dist/chunk-zcz486dz.js +0 -2
@@ -1,30 +0,0 @@
1
- // @bun
2
- import{Aq as T,mm as E,nm as M}from"./chunk-r7dd7c7y.js";import{Fu as d,Hu as c,Iu as i}from"./chunk-aw651z2y.js";import{Pu as m,Su as p}from"./chunk-0y6f4037.js";var y=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function f(z,Q,F){let J={fullTag:F,content:Q,attrs:z};if(/\bserver\b/.test(z))return{...J,type:"server"};if(/\bdata-stx-scoped\b/.test(z))return{...J,type:"client"};if(y.test(Q))return{...J,type:"signals"};if(/\bclient\b/.test(z)||/\btype\s*=\s*["']module["']/.test(z)||/\bsrc\s*=/.test(z))return{...J,type:"client"};return{...J,type:"server"}}var g=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function P(z){let Q=[],F=[],J=[],$=0;while($<z.length){let Y=z.indexOf("<",$);if(Y===-1)break;let K=M(z,Y);if(K>Y){$=K;continue}let Z=E(z,Y);if(Z>Y){let B=z.slice(Y,Z),U=g.exec(B);if(U){let X=f(U[1],U[2],B);switch(X.type){case"signals":Q.push(X);break;case"client":F.push(X);break;case"server":J.push(X);break}}$=Z;continue}$=Y+(z.startsWith("<!--",Y)?4:1)}return{signals:Q,client:F,server:J}}var s="X-STX-Router",a="private, no-store";function R(z){return z.headers.get("X-STX-Router")==="true"}function u(z,Q){if(!z)return Q;return z.split(",").some((J)=>J.trim().toLowerCase()===Q.toLowerCase())?z:`${z}, ${Q}`}function t(z){return{Vary:u(z,"X-STX-Router")}}import L from"path";d();var h="stx-page-head:",o=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,I=null;function r(){if(I!==null)return I;try{let{getRouterScript:z}=(i(),m(c));I=`<script>${z()}</script>`}catch{I=""}return I}async function Yz(z,Q){if(Q===!1)return null;if(Q&&typeof Q==="string"){let J=L.resolve(z,Q);if(await Bun.file(J).exists())return J;return null}let F=L.join(z,"app.stx");if(await Bun.file(F).exists())return F;return null}async function Zz(z,Q){try{let F=await Bun.file(z).text(),J=F,$=F.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if($)J=$[1].trim();let Y=P(F),K=[...Y.client.map((j)=>j.fullTag),...Y.signals.map((j)=>j.fullTag)],Z=[],B=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,U;while((U=B.exec(F))!==null)Z.push(U[0]);let X=J;for(let j of Y.server)X=X.replace(j.fullTag,"");for(let j of Y.client)X=X.replace(j.fullTag,"");X=X.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let W="<!--__STX_PAGE_SLOT__-->";if(X=X.replace(/<slot\s*\/>/gi,W).replace(/<slot\s*>\s*<\/slot>/gi,W),!X.includes(W))return console.warn(`[stx] Shell ${z} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:q,extractVariables:k,defaultConfig:v,loadStxConfig:H}=await import("./chunk-4xr8099h.js"),w=await H(),A={__filename:z,__dirname:L.dirname(z)};for(let j of K){let N=j.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(N&&!j.includes("client")&&!j.includes('type="module"'))await k(N[1],A,z)}let V=await q(X,A,z,{...v,...w,...Q},new Set),G=V.indexOf(W);if(G===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:V.substring(0,G),afterSlot:V.substring(G+W.length),filePath:z,shellScripts:K,shellStyles:Z}}catch(F){return console.error(`[stx] Error processing shell ${z}:`,F),null}}function $z(z,Q,F){let J,$="",Y=Q.match(o);if(Y){Q=Q.replace(Y[0],"");try{let X=Buffer.from(Y[1],"base64").toString("utf8"),W=X.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(W)J=W[1].trim();$=X.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let K=F||J||"stx App",Z=r(),B="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";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>${K}</title>
8
- ${$?` ${$}
9
- `:""} ${z.shellStyles.join(`
10
- `)}
11
- </head>
12
- <body>
13
- ${z.beforeSlot}
14
- <div data-stx-content>${Q}</div>
15
- ${z.afterSlot}
16
- ${z.shellScripts.filter((X)=>!X.includes("server")).join(`
17
- `)}
18
- ${B}
19
- ${Z}
20
- </body>
21
- </html>`}function x(z,Q={}){let F=z.trim();if(!T(F))return z;let J=[],$=F.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if($){let B=$[1],U=/<style\b[^>]*>[\s\S]*?<\/style>/gi,X;while((X=U.exec(B))!==null)J.push(X[0])}if(Q.preserveHead&&$){let B=[],U=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,X;while((X=U.exec($[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(X[0]))continue;B.push(X[0])}if(B.length>0)J.unshift(`<!--${h}${Buffer.from(B.join(`
22
- `),"utf8").toString("base64")}-->`)}let Y=F.match(/<body\b[^>]*>/i),K=F.lastIndexOf("</body>");if(Y&&K!==-1){let B=Y.index+Y[0].length,U=F.slice(B,K).trim();if(J.length>0)return J.join(`
23
- `)+`
24
- `+U;return U}let Z=F;if(Z=Z.replace(/<!DOCTYPE\b[^>]*>/i,""),Z=Z.replace(/<html\b[^>]*>/i,""),Z=Z.replace(/<\/html\s*>/i,""),$)Z=Z.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,J.join(`
25
- `));return Z=Z.replace(/<body\b[^>]*>/i,""),Z=Z.replace(/<\/body\s*>/i,""),Z.trim()}function jz(z){return R(z)}function Bz(z,Q="main"){let F=z.trim(),J=[],$=[],Y=F.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(Y){let G=Y[1],j=/<style\b[^>]*>[\s\S]*?<\/style>/gi,N;while((N=j.exec(G))!==null)J.push(N[0]);let _=/<script\b[^>]*data-stx-route-params[^>]*>[\s\S]*?<\/script>/gi;while((N=_.exec(G))!==null)$.push(N[0])}let K=Q.replace(/^[.#]/,"").toLowerCase(),Z=new RegExp(`<${K}\\b[^>]*>`,"i"),B=F.match(Z);if(!B||B.index===void 0)return x(z);let U=B.index+B[0].length,X=new RegExp(`<${K}\\b[^>]*>`,"gi"),W=new RegExp(`</${K}\\s*>`,"gi");X.lastIndex=U,W.lastIndex=U;let q=1,k=-1;while(q>0){let G=X.exec(F),j=W.exec(F);if(!j)break;if(G&&G.index<j.index)q++,W.lastIndex=G.index+G[0].length;else if(q--,k=j.index,q>0)X.lastIndex=j.index+j[0].length}if(k===-1)return x(z);let v=F.slice(U,k).trim(),H=[],w=F.match(/<body\b[^>]*>/i),A=F.lastIndexOf("</body>");if(w&&w.index!==void 0&&A!==-1){let j=[[w.index+w[0].length,B.index],[k+`</${K}>`.length,A]],N=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[_,O]of j){if(_>=O)continue;let S=F.slice(_,O),b;N.lastIndex=0;while((b=N.exec(S))!==null)H.push(b[0])}}let V=[];if(J.length>0)V.push(J.join(`
26
- `));if($.length>0)V.push($.join(`
27
- `));if(H.length>0)V.push(H.join(`
28
- `));return V.push(v),V.join(`
29
- `)}import D from"fs";import C from"path";function Nz(z,Q,F){return{version:1,buildTime:new Date().toISOString(),routes:z,assets:Q,outputDir:F}}function Vz(z,Q){let F=C.join(Q,"manifest.json");D.writeFileSync(F,JSON.stringify(z,null,2))}function qz(z){let Q=C.join(z,"manifest.json");if(!D.existsSync(Q))return null;try{let F=D.readFileSync(Q,"utf-8"),J=JSON.parse(F);if(J.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${J.version}`),null;return J}catch(F){return console.warn("[stx] Failed to load manifest:",F),null}}
30
- export{f as xg,P as yg,s as zg,a as Ag,R as Bg,u as Cg,t as Dg,Yz as Eg,Zz as Fg,$z as Gg,x as Hg,jz as Ig,Bz as Jg,Nz as Kg,Vz as Lg,qz as Mg};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Eh as a,Fh as b,Gh as c,Hh as d,Ih as e,Jh as f}from"./chunk-7exqxjx5.js";import"./chunk-r7dd7c7y.js";import"./chunk-25de1sj7.js";import"./chunk-38ykv2gd.js";import"./chunk-4qq5wj04.js";import"./chunk-g8tce9rr.js";import"./chunk-ptcpaeem.js";import"./chunk-a8mnhryz.js";import"./chunk-dnhckx52.js";import"./chunk-jt8as8j8.js";import"./chunk-x84g0m0p.js";import"./chunk-5h5ydexj.js";import"./chunk-aw651z2y.js";import"./chunk-wj2trgsn.js";import"./chunk-0y6f4037.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
@@ -1,13 +0,0 @@
1
- // @bun
2
- import{il as N,jl as c}from"./chunk-0ha9e1wt.js";import{Sl as h,fs as d}from"./chunk-r7dd7c7y.js";import{mt as v}from"./chunk-dnhckx52.js";import $ from"path";import q from"fs";var a=5,o=1,n=new Map,R=600,e=100,F=new Map;async function zz(z){let G=F.get(z)??0;if(G>0&&G<e){F.set(z,G+1);return}F.set(z,1);try{let W=(await q.promises.readdir(z)).filter((Z)=>Z.endsWith(".js"));if(W.length<=R)return;let w=(await Promise.all(W.map(async(Z)=>{try{return{name:Z,at:(await q.promises.stat($.join(z,Z))).mtimeMs}}catch{return null}}))).filter((Z)=>Z!==null);w.sort((Z,J)=>J.at-Z.at);for(let Z of w.slice(R)){let J=Z.name.slice(0,-3);await q.promises.rm($.join(z,`${J}.js`),{force:!0}),await q.promises.rm($.join(z,`${J}.deps.json`),{force:!0})}C("pruned bundle cache to",R,"entries")}catch{}}function Hz(z){return n.get(z)??[]}function r(z,G){if(z)n.set(z,G)}function Gz(z=process.env){return z.STX_DEBUG==="true"||z.STX_DEBUG==="1"}function C(...z){if(Gz())console.log("[stx:bundler]",...z)}var E=[];function g(z,G,W){E.push({filePath:z||"<inline>",message:G,details:W})}function jz(){return E.slice()}function Mz(){E.length=0}var B;function kz(z){B=z}function m(){if(B)return B;try{let z=d.strict;return typeof z==="object"&&z!==null?z.bundlerFallback??"warn":"warn"}catch{return"warn"}}var u=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Oz(z){let G=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,W;while((W=G.exec(z))!==null){let w=W[1];if(!u.some((J)=>J.test(w)))return C("detected user import:",w),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((W=X.exec(z))!==null){let w=W[1];if(/\.css(?:\?.*)?$/.test(w))continue;if(!u.some((J)=>J.test(w)))return C("detected side-effect import:",w),!0}return!1}function Jz(z,G,W,X){let w=(Z,J)=>{let K=Z===W?G:$.dirname(Z),Q=$.resolve(K,J),H=[Q,`${Q}.ts`,`${Q}.tsx`,`${Q}.js`,`${Q}.mjs`,`${Q}.jsx`,$.join(Q,"index.ts"),$.join(Q,"index.tsx"),$.join(Q,"index.js"),$.join(Q,"index.mjs")];for(let k of H)try{if(q.existsSync(k)&&q.statSync(k,{throwIfNoEntry:!1})?.isFile())return k}catch{}return Q};return{name:"stx-client-bundle",setup(Z){Z.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(J)=>({path:J.path,external:!0})),Z.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(J)=>({path:J.path,external:!0})),Z.onResolve({filter:/^\//},(J)=>{if(q.existsSync(J.path))return{path:J.path};return{path:J.path,external:!0}}),Z.onResolve({filter:/^\.\.?\//},(J)=>{let K=w(J.importer,J.path);return X.add(K),{path:K}}),Z.onResolve({filter:/^[@~]\//},(J)=>{let K=$.resolve(z,J.path.slice(2)),Q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,$.join(K,"index.ts"),$.join(K,"index.tsx"),$.join(K,"index.js"),$.join(K,"index.mjs")];for(let H of Q)if(q.existsSync(H)&&q.statSync(H,{throwIfNoEntry:!1})?.isFile())return C(`resolved ${J.path[0]}/ import:`,J.path,"\u2192",H),X.add(H),{path:H};return console.warn(`[stx:bundler] could not resolve ${J.path[0]}/ import:`,J.path),{path:K}}),Z.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(J)=>{let K=$.extname(J.path).toLowerCase(),Q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(J.path!==W)X.add(J.path);return{contents:q.readFileSync(J.path,"utf8"),loader:Q}})}}}var _=new Map,p=Symbol.for("stx.client-bundle-build-queue");function Kz(z){let G=globalThis,X=(G[p]??Promise.resolve()).then(z,z);return G[p]=X.then(()=>{return},()=>{return}),X}async function Uz(z,G,W={}){let X=W.projectRoot||process.cwd(),w=W.minify??!1,Z=W.cacheDir||v(X,"bundle-cache"),J=new Bun.CryptoHasher("md5");J.update(`${a}\x00${z}\x00${G}`);let K=J.digest("hex").slice(0,12),Q=$.join(Z,`${K}.js`),H=$.join(Z,`${K}.deps.json`),k=Bun.file(Q);if(await k.exists()){let U=Bun.file(H),y=!0;if(await U.exists())try{let S=JSON.parse(await U.text());if(S.metadataVersion!==o||!Array.isArray(S.files))y=!1;for(let M of Array.isArray(S.files)?S.files:[])try{if(q.statSync(M.path).mtimeMs!==M.mtimeMs){y=!1;break}}catch{y=!1;break}}catch{y=!1}if(y){C("cache hit:",K);try{let S=JSON.parse(await Bun.file(H).text());r(G,(S.files??[]).map((M)=>M.path))}catch{}return await k.text()}C("cache invalidated by dep change:",K)}let A=_.get(K);if(A)return await A;let x=Kz(()=>Zz(z,G,{projectRoot:X,minify:w,cacheDir:Z,hash:K,cachePath:Q,depsPath:H}));_.set(K,x);try{return await x}finally{_.delete(K)}}async function Zz(z,G,W){let{projectRoot:X,minify:w,cacheDir:Z,hash:J,cachePath:K,depsPath:Q}=W,H=v(X,"bundle-tmp"),k=$.join(H,`${J}.ts`),A=$.join(H,"out",J);q.mkdirSync(H,{recursive:!0}),q.mkdirSync(A,{recursive:!0});let x=$.dirname(G),U=[],y=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,S=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M;while((M=y.exec(z))!==null){if(M[1])continue;if(M[2])M[2].split(",").forEach((O)=>{let j=$z(O);if(j)U.push(j)});else if(M[3])U.push(M[3])}while((M=S.exec(z))!==null){if(M[1])continue;U.push(M[2])}let P=U.length>0?`
3
- export { ${U.join(", ")} }`:"";await Bun.write(k,z+P),C("bundling:",J,"from:",$.basename(G));let D=new Set;try{let O=await Bun.build({entrypoints:[k],outdir:A,target:"browser",format:"esm",minify:w,plugins:[Jz(X,x,k,D)],define:{"process.env.NODE_ENV":w?'"production"':'"development"',...h()},root:X});if(!O.success){let L=O.logs.filter((I)=>I.level==="error").map((I)=>I.message).join(", ")||`Unable to bundle ${$.basename(G)}`,T=N(O.logs,G||void 0);if(console.warn("[stx:bundler] build failed:",L),g(G||"",L,T),m()==="error")throw Error(L);return z}let j="";for(let Y of O.outputs){j=await Y.text();break}let V=[];for(let Y of j.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let L of Y[1].split(",")){let T=L.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T){V.push([T[2],T[1]]);continue}let I=L.trim();if(/^[A-Za-z_$][\w$]*$/.test(I))V.push([I,I])}let l=j.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];j=j.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let b=`__stxBundle_${J}`,t=V.map(([Y,L])=>`${JSON.stringify(Y)}: ${L}`).join(", "),s=V.map(([Y])=>`var ${Y} = undefined;`).join(`
4
- `),i=V.map(([Y])=>`${Y} = ${b}[${JSON.stringify(Y)}];`).join(`
5
- `);if(j=`${l.join(`
6
- `)}
7
- ${s}
8
- var ${b} = (function() {
9
- ${j}
10
- return { ${t} };
11
- })();
12
- ${i}`.trim(),C("bundled:",J,"output:",j.length,"bytes"),U.length>0&&V.length===0)return console.warn(`[stx:bundler] dropped every binding for ${$.basename(G)} (${J}); serving the unbundled source and not caching this result`),z;q.mkdirSync(Z,{recursive:!0}),await Bun.write(K,j);let f=Array.from(D).map((Y)=>{try{return{path:Y,mtimeMs:q.statSync(Y).mtimeMs}}catch{return null}}).filter((Y)=>Y!==null);return await Bun.write(Q,JSON.stringify({metadataVersion:o,files:f})),r(G,f.map((Y)=>Y.path)),await zz(Z),j}catch(O){let j=N(O,G||void 0),V=c(O,G||void 0);if(console.warn(`[stx:bundler] error: ${V}`),g(G||"",V,j),m()==="error")throw O;return z}finally{try{q.rmSync(k,{force:!0}),q.rmSync(A,{recursive:!0,force:!0})}catch{}}}function $z(z){let G=z.trim();if(!G)return null;let W=G.indexOf("=");if(W!==-1)G=G.slice(0,W).trim();let X=G.indexOf(":");if(X!==-1)G=G.slice(X+1).trim();if(G.startsWith("..."))G=G.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(G)?G:null}
13
- export{Hz as _k,Gz as $k,g as al,jz as bl,Mz as cl,kz as dl,m as el,Oz as fl,Kz as gl,Uz as hl};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Js as a,Ks as b}from"./chunk-4qq5wj04.js";import"./chunk-0y6f4037.js";export{b as resolveStxTargets,a as looksLikeGlob};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Ef as a,Ff as b}from"./chunk-pbsfbgx7.js";import"./chunk-0y6f4037.js";export{b as captureScreenshots,a as captureScreenshot};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Oj as a,Pj as b,Qj as c,Rj as d,Sj as e,Tj as f,Uj as g,Vj as h,Wj as i,Xj as j,Yj as k}from"./chunk-k6wnmjhf.js";import"./chunk-r7dd7c7y.js";import"./chunk-25de1sj7.js";import"./chunk-38ykv2gd.js";import"./chunk-4qq5wj04.js";import"./chunk-g8tce9rr.js";import"./chunk-ptcpaeem.js";import"./chunk-a8mnhryz.js";import"./chunk-dnhckx52.js";import"./chunk-jt8as8j8.js";import"./chunk-x84g0m0p.js";import"./chunk-5h5ydexj.js";import"./chunk-aw651z2y.js";import"./chunk-wj2trgsn.js";import"./chunk-0y6f4037.js";export{a as templateCache,b as readFileCached,d as invalidateFileCacheByDir,c as invalidateFileCache,k as hashFilePath,f as getCachedSignalsRuntime,g as getCachedRouterScript,h as clearDevCaches,i as checkCache,j as cacheTemplate,e as __setSignalsGeneratorsForTest};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Vi as a,Wi as b}from"./chunk-b3zes539.js";import"./chunk-9n0gvfrg.js";import"./chunk-r7dd7c7y.js";import"./chunk-25de1sj7.js";import"./chunk-38ykv2gd.js";import"./chunk-4qq5wj04.js";import"./chunk-g8tce9rr.js";import"./chunk-ptcpaeem.js";import"./chunk-a8mnhryz.js";import"./chunk-dnhckx52.js";import"./chunk-jt8as8j8.js";import"./chunk-x84g0m0p.js";import"./chunk-5h5ydexj.js";import"./chunk-aw651z2y.js";import"./chunk-wj2trgsn.js";import"./chunk-0y6f4037.js";export{a as getStoreScript,b as clearStoreCache};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Gf as a}from"./chunk-1n16xphq.js";import"./chunk-r7dd7c7y.js";import"./chunk-25de1sj7.js";import"./chunk-38ykv2gd.js";import"./chunk-4qq5wj04.js";import"./chunk-g8tce9rr.js";import"./chunk-ptcpaeem.js";import"./chunk-a8mnhryz.js";import"./chunk-dnhckx52.js";import"./chunk-jt8as8j8.js";import"./chunk-x84g0m0p.js";import"./chunk-5h5ydexj.js";import"./chunk-aw651z2y.js";import"./chunk-wj2trgsn.js";import"./chunk-0y6f4037.js";export{a as startInteractive};